13 #include "wxartbaseprec.h"
32 #include "wx/string.h"
42 #if defined(__WXMSW__) && defined(__MEMDEBUG__)
43 #include <wx/msw/msvcrt.h>
56 DEFINE_EVENT_TYPE( wxEVT_DO )
57 DEFINE_EVENT_TYPE( wxEVT_UNDO )
58 DEFINE_EVENT_TYPE( wxEVT_REDO )
59 DEFINE_EVENT_TYPE( wxEVT_MENUSTRINGS )
60 DEFINE_EVENT_TYPE( wxEVT_BEGINBUSY )
61 DEFINE_EVENT_TYPE( wxEVT_ENDBUSY )
62 DEFINE_EVENT_TYPE( a2dEVT_PROPOBJECT_EDITPROPERTIES_EVENT )
63 DEFINE_EVENT_TYPE( wxEVT_RECORD )
74 for(
int indx = 1; GetHashMap().find( commandName ) != GetHashMap().end(); indx++ )
76 wxASSERT_MSG( 0, _(
"The command id name '" ) + commandName + _(
"' already exists" ) );
79 GetHashMap()[commandName] =
this;
84 a2dHashMapCommandIds::iterator iterCommand =
GetHashMap().find( commandName );
91 static a2dHashMapCommandIds namehash;
106 const wxString& menuString )
115 #if defined(_DEBUG) && defined (SMART_POINTER_DEBUG)
116 extern wxObject* CurrentSmartPointerOwner;
117 CurrentSmartPointerOwner =
this;
129 m_modifies = other.m_modifies;
151 wxASSERT_MSG( 0 , _(
"a2dCommand::CloneAndBind not overloaded in derived class" ) );
162 return current ==
this;
182 return command ==
this;
185 void a2dCommand::DistributeEvent( wxEventType eventType )
187 if ( eventType == wxEVT_DO )
190 event.SetEventObject( GetCommandProcessor() );
191 GetCommandProcessor()->ProcessEvent( event );
193 else if ( eventType == wxEVT_UNDO )
196 event.SetEventObject( GetCommandProcessor() );
197 GetCommandProcessor()->ProcessEvent( event );
199 else if ( eventType == wxEVT_REDO )
202 event.SetEventObject( GetCommandProcessor() );
203 GetCommandProcessor()->ProcessEvent( event );
216 idName.Printf( wxT(
"%s_%ld" ), name.c_str(),
wxGenNewId() );
230 const wxString& menuString
232 :
a2dCommand( true, commandId, commandTypeId, menuString )
266 if( current ==
this )
270 a2dCommandList::reverse_iterator iter =
m_subcommands.rbegin();
277 a2dCommandList::reverse_iterator iterr =
m_subcommands.rbegin();
299 if( ( fromcommand == NULL || fromcommand == command || start ) )
319 a2dCommandList::const_reverse_iterator iter =
m_subcommands.rbegin();
348 a2dCommandList::const_reverse_iterator iter =
m_subcommands.rbegin();
381 a2dCommandList::reverse_iterator iter =
m_subcommands.rbegin();
385 if ( command == obj )
391 if ( obj->
Remove( command ) )
407 if( command ==
this )
410 a2dCommandList::reverse_iterator iter =
m_subcommands.rbegin();
457 obj->DistributeEvent( wxEVT_REDO );
470 a2dCommandList::reverse_iterator iter =
m_subcommands.rbegin();
477 obj->DistributeEvent( wxEVT_UNDO );
487 DEFINE_EVENT_TYPE( wxEVT_PROPOBJECT_EDITPROPERTIES_EVENT )
490 :
a2dEvent( wxID_ANY, a2dEVT_PROPOBJECT_EDITPROPERTIES_EVENT )
492 SetEventObject(
object );
493 m_properties = properties;
500 m_properties = other.m_properties;
501 m_edited = other.m_edited;
528 m_id =
property->GetId();
532 a2dCommand( true, Id, sm_noCommandTypeId, id->GetName() )
542 a2dCommand( true, Id, sm_noCommandTypeId, id->GetName() )
552 a2dCommand( true, Id, sm_noCommandTypeId, id->GetName() )
562 a2dCommand( true, Id, sm_noCommandTypeId, id->GetName() )
572 a2dCommand( true, Id, sm_noCommandTypeId, id->GetName() )
582 a2dCommand( true, Id, sm_noCommandTypeId, id->GetName() )
592 a2dCommand( true, Id, sm_noCommandTypeId, id->GetName() )
602 a2dCommand( true, Id, sm_noCommandTypeId, id->GetName() )
612 a2dCommand( true, Id, sm_noCommandTypeId, id->GetName() )
622 a2dCommand( true, Id, sm_noCommandTypeId, id->GetName() )
632 a2dCommand( true, Id, sm_noCommandTypeId, id->GetName() )
642 a2dCommand_SetProperty::~a2dCommand_SetProperty(
void )
713 a2dObject* a2dCommandProcessor::DoClone( CloneOptions WXUNUSED( options ),
a2dRefMap* refs )
const
715 wxFAIL_MSG( wxT(
"cannot clone a2dIOHandler" ) );
722 wxASSERT_MSG(
m_refcount >= 0, wxT(
"a2dCommandProcessor Own/Release not matched (extra Release calls)" ) );
771 #if defined(A2D_COMMAND_DEBUG)
772 wxLogDebug( wxT(
"Pre Do name = %s 0x%p" ), cmd.
GetName().c_str(), &cmd );
774 bool ret = cmd.
PreDo();
780 #if defined(A2D_COMMAND_DEBUG)
781 wxLogDebug( wxT(
"Post Do name = %s 0x%p" ), cmd.
GetName().c_str(), &cmd );
789 #if defined(A2D_COMMAND_DEBUG)
790 wxLogDebug( wxT(
"Do name = %s 0x%p" ), cmd.
GetName().c_str(), &cmd );
795 cmd.DistributeEvent( wxEVT_DO );
801 #if defined(A2D_COMMAND_DEBUG)
802 wxLogDebug( wxT(
"UnDo name = %s 0x%p" ), cmd.
GetName().c_str(), &cmd );
804 bool ret = cmd.
Undo();
807 cmd.DistributeEvent( wxEVT_UNDO );
813 #if defined(A2D_COMMAND_DEBUG)
814 wxLogDebug( wxT(
"ReDo name = %s 0x%p" ), cmd.
GetName().c_str(), &cmd );
816 bool ret = cmd.
Redo();
819 cmd.DistributeEvent( wxEVT_REDO );
828 event.SetEventObject(
this );
829 this->ProcessEvent( event );
834 event.SetEventObject(
this );
835 this->ProcessEvent( event );
844 wxCHECK_MSG( command,
false, _(
"no command in a2dCommandProcessor::Submit" ) );
897 wxCHECK_RET( command, _(
"no command in a2dCommandProcessor::Store" ) );
971 return command && command->CanUndo();
980 return next->CanUndo();
1005 event.SetEventObject(
this );
1006 ProcessEvent( event );
1016 if ( commandName.IsEmpty() ) commandName = _(
"Unnamed command" );
1021 buf = wxString( _(
"Can't &Undo" ) ) + wxT(
" " ) + commandName +
m_undoAccelerator;
1048 wxString redoCommandName( redoCommand->
GetName() );
1049 if ( redoCommandName.IsEmpty() ) redoCommandName = _(
"Unnamed command" );
1050 buf = wxString( _(
"&Redo" ) ) + wxT(
" " ) + redoCommandName +
m_redoAccelerator;
1068 wxASSERT_MSG( propRefObject != 0 , _(
"a2dObject not NULL" ) );
1085 wxASSERT_MSG( propRefObject != 0, _(
"a2dObject not NULL" ) );
1099 #if defined(A2D_COMMAND_DEBUG)
1100 wxLogDebug( wxT(
"Open Group = %s 0x%p" ), name.c_str(), group );
1115 #if defined(A2D_COMMAND_DEBUG)
1116 wxLogDebug( wxT(
"Open Group = %s 0x%p" ), name.c_str(), group );
1133 #if defined(A2D_COMMAND_DEBUG)
1134 wxLogDebug( wxT(
"End Group = %s 0x%p" ), group->
GetGroupName().c_str(), group );
1158 void a2dGeneralModule::OnExit()
1178 m_logConnectedEvents =
false;
1182 a2dGeneralGlobal::~a2dGeneralGlobal()
1187 a2dObject* a2dGeneralGlobal::DoClone( CloneOptions WXUNUSED( options ),
a2dRefMap* refs )
const
1189 wxLogMessage( _(
"Not implemented" ) );
1193 #if wxART2D_USE_CVGIO
1194 void a2dGeneralGlobal::DoSave( wxObject* WXUNUSED( parent ),
a2dIOHandlerXmlSerOut& WXUNUSED( out ), a2dXmlSer_flag WXUNUSED( xmlparts ),
a2dObjectList* WXUNUSED( towrite ) )
1196 wxLogMessage( _(
"Not implemented" ) );
1199 void a2dGeneralGlobal::DoLoad( wxObject* WXUNUSED( parent ),
a2dIOHandlerXmlSerIn& WXUNUSED( parser ), a2dXmlSer_flag WXUNUSED( xmlparts ) )
1201 wxLogMessage( _(
"Not implemented" ) );
1204 #endif //wxART2D_USE_CVGIO
1227 if ( !errorstr.IsEmpty() )
1237 #if wxCHECK_VERSION(2,9,0)
1239 #if !wxUSE_UTF8_LOCALE_ONLY
1240 void a2dGeneralGlobal::DoPrintfWchar(
const a2dError& error,
const wxChar* format, ... )
1243 va_start( args, format );
1246 out.PrintfV( format, args );
1252 void a2dGeneralGlobal::DoPrintfWcharWarn(
const a2dError& error,
const wxChar* format, ... )
1255 va_start( args, format );
1258 out.PrintfV( format, args );
1264 #endif // !wxUSE_UTF8_LOCALE_ONLY
1266 #if wxUSE_UNICODE_UTF8
1267 void a2dGeneralGlobal::DoPrintfUtf8(
const a2dError& error,
const char* format, ... )
1270 va_start( args, format );
1273 out.PrintfV( format, args );
1279 void a2dGeneralGlobal::DoPrintfUtf8Warn(
const a2dError& error,
const char* format, ... )
1282 va_start( args, format );
1285 out.PrintfV( format, args );
1291 #endif // wxUSE_UNICODE_UTF8
1317 va_start( ap, Format );
1319 errorstr.PrintfV( Format, ap );
1330 va_start( ap, Format );
1332 errorstr.PrintfV( Format, ap );
1338 #endif //wxCHECK_VERSION(2,9,0)
1347 if ( !errorstr.IsEmpty() )
1348 errorsmes = errorstr;
1353 wxLogWarning( errorsmes );
1361 a2dErrorVector::value_type errorRecord = *iter;
1362 errors += errorRecord.GetErrorMessage() + wxT(
".\n" );
1373 a2dErrorVector::value_type errorRecord = *iter;
1374 wxLogError( errorRecord.GetErrorMessage() );
1383 return m_errors.back().GetErrorCode();
1387 a2dError a2dGeneralGlobal::GetLastError()
const
1394 void a2dGeneralGlobal::RecordF( wxObject* sender,
const wxChar* Format, ... )
1398 wxString recordstring;
1399 va_start( ap, Format );
1403 recordstring.PrintfV( Format, ap );
1407 event.SetEventObject( sender );
1409 ProcessEvent( event );
1412 void a2dGeneralGlobal::RecordF(
const wxChar* Format, ... )
1416 wxString recordstring;
1417 va_start( ap, Format );
1421 recordstring.PrintfV( Format, ap );
1425 event.SetEventObject(
this );
1427 ProcessEvent( event );
1443 wxString a2dGeneralGlobal::GetWxArt2DVar(
bool withSep )
const
1446 wxGetEnv( wxT(
"WXART2D" ), &art2Droot );
1447 wxFileName artdir = wxFileName( art2Droot, wxEmptyString );
1448 art2Droot = artdir.GetVolume() + artdir.GetVolumeSeparator() + artdir.GetPath(0, wxPATH_UNIX);
1450 if( art2Droot.IsEmpty() )
1453 wxMessageBox( _(
" WXART2D variable not set\nPlease set the WXART2D environment string to the correct dir.\n\nExample : WXART2D=c:\\wxArt2D\n\n" ), _(
"environment error" ), wxOK );
1455 wxMessageBox( _(
" WXART2D variable not set\nPlease set the WXART2D environment string to the correct dir.\n\nExample : WXART2D=/user/home/wxArt2D; export WXART2D \n\n" ), _(
"environment error" ), wxOK );
1461 return art2Droot + wxFileName::GetPathSeparator(wxPATH_UNIX);
1466 wxString a2dGeneralGlobal::GetWxArt2DArtVar(
bool withSep,
bool silent )
const
1468 wxString* artdir =
a2dGeneralGlobals->GetVariablesHash().GetVariableString( wxT(
"WXART2D_ART" ) );
1470 if ( !artdir || artdir->IsEmpty() )
1472 wxGetEnv( wxT(
"WXART2D_ART" ), &artroot );
1473 if( artroot.IsEmpty() )
1475 wxGetEnv( wxT(
"WXART2D" ), &artroot );
1476 if( artroot.IsEmpty() )
1481 wxMessageBox( _(
"WXART2D_ART or WXART2D variable not set\nPlease set the WXART2D environment string to the correct dir.\n\nExample : WXART2D=c:\\wxArt2D\n\n" ), _(
"environment error" ), wxOK );
1483 wxMessageBox( _(
"WXART2D_ART or WXART2D variable not set\nPlease set the WXART2D environment string to the correct dir.\n\nExample : WXART2D=/user/home/wxArt2D; export WXART2D \n\n" ), _(
"environment error" ), wxOK );
1488 artroot = artroot + wxFileName::GetPathSeparator(wxPATH_UNIX) + wxT(
"art" );
1494 return artroot + wxFileName::GetPathSeparator(wxPATH_UNIX);
1511 static a2dMenuIdItemMap ms_Name2Id;
1518 m_isChecked =
false;
1519 m_id = wxXmlResource::GetXRCID( menuIdName );
1521 if ( m_id == wxID_ANY )
1523 if ( m_id == wxID_SEPARATOR )
1524 m_kind = wxITEM_SEPARATOR;
1529 m_name = menuIdName;
1535 wxFAIL_MSG( wxT(
"duplicate id" ) );
1540 a2dMenuIdItemMap::iterator iter;
1549 art2d += wxT(
"resources/" ) ;
1552 if ( wxFileExists( art2d + item.m_name + wxT(
".ico" ) ) )
1554 if ( image.LoadFile( art2d + item.m_name + wxT(
".ico" ), wxBITMAP_TYPE_ICO ) )
1556 item.m_bmpChecked = wxBitmap( image );
1557 wxASSERT_MSG( item.m_bmpChecked.Ok(),
1558 _(
"Bitmap for a2dMenuIdItem wrong" ) );
1560 item.m_bmpUnchecked = item.m_bmpChecked;
1562 if ( wxFileExists( art2d + item.m_name + wxT(
".bmp" ) ) )
1564 if ( image.LoadFile( art2d + item.m_name + wxT(
".bmp" ), wxBITMAP_TYPE_BMP ) )
1566 item.m_bmpChecked = wxBitmap( image );
1567 wxASSERT_MSG( item.m_bmpChecked.Ok(),
1568 _(
"Bitmap for a2dMenuIdItem wrong" ) );
1570 item.m_bmpUnchecked = item.m_bmpChecked;
1572 if ( wxFileExists( art2d + item.m_name + wxT(
".png" ) ) )
1574 if ( image.LoadFile( art2d + item.m_name + wxT(
".png" ), wxBITMAP_TYPE_PNG ) )
1576 item.m_bmpChecked = wxBitmap( image );
1577 wxASSERT_MSG( item.m_bmpChecked.Ok(),
1578 _(
"Bitmap for a2dMenuIdItem wrong" ) );
1581 item.m_bmpUnchecked = item.m_bmpChecked;
1583 if ( wxFileExists( art2d + item.m_name + wxT(
"_Un.ico" ) ) )
1585 if ( image.LoadFile( art2d + item.m_name + wxT(
"_Un.ico" ), wxBITMAP_TYPE_ICO ) )
1587 item.m_bmpUnchecked = wxBitmap( image );
1588 wxASSERT_MSG( item.m_bmpUnchecked.Ok(),
1589 _(
"Bitmap for a2dMenuIdItem wrong" ) );
1592 if ( wxFileExists( art2d + item.m_name + wxT(
"_Un.bmp" ) ) )
1594 if ( image.LoadFile( art2d + item.m_name + wxT(
"_Un.bmp" ), wxBITMAP_TYPE_BMP ) )
1596 item.m_bmpUnchecked = wxBitmap( image );
1597 wxASSERT_MSG( item.m_bmpUnchecked.Ok(),
1598 _(
"Bitmap for a2dMenuIdItem wrong" ) );
1601 if ( wxFileExists( art2d + item.m_name + wxT(
"_Un.png" ) ) )
1603 if ( image.LoadFile( art2d + item.m_name + wxT(
"_Un.png" ), wxBITMAP_TYPE_PNG ) )
1605 item.m_bmpUnchecked = wxBitmap( image );
1606 wxASSERT_MSG( item.m_bmpUnchecked.Ok(),
1607 _(
"Bitmap for a2dMenuIdItem wrong" ) );
1613 m_bitmapinitialized =
true;
1618 a2dMenuIdItemMap::iterator iterCommand =
GetHashMap().find( menuIdName );
1624 wxAcceleratorEntry* a2dMenuIdItem::GetAccel()
const
1626 return wxAcceleratorEntry::Create(
GetText() );
1629 void a2dMenuIdItem::SetAccel( wxAcceleratorEntry* accel )
1631 wxString text = m_text.BeforeFirst( wxT(
'\t' ) );
1634 text += wxT(
'\t' );
1635 text += accel->ToString();
1641 #endif // wxUSE_ACCEL
1643 void a2dMenuIdItem::SetText(
const wxString& str )
1648 void a2dMenuIdItem::SetHelp(
const wxString& str )
1655 return wxStripMenuCodes( label );
1658 void a2dMenuIdItem::SetBitmaps(
const wxBitmap& bmpChecked,
const wxBitmap& bmpUnchecked )
1660 m_bmpChecked = bmpChecked;
1661 m_bmpUnchecked = bmpUnchecked;
virtual bool ContainsCommand(a2dCommand *command)
return true if this command/group are nested group contains the given command
wxString m_menuString
if set this will be used for menu Undo/Redo labels, else the m_commandId its name is used...
void SetCommandProcessor(a2dCommandProcessor *cmp)
set when submitting this command via a2dCommandProcessor
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
virtual bool Undo()=0
Override this to undo a command.
virtual ~a2dCommandProcessor()
destructor
property to hold an unsigned 4 byte integer type variable to be associated with a a2dObject ...
(In) Visible property that can be added to Docview Objects.
static const a2dCommandId Id
Set a string environment variable.
A2DGENERALDLLEXP long wxGenNewId()
This function is like wxNewId, but it has its own ID set.
static a2dVariablesHash m_variableList
aliaslist containing internal variables
virtual bool RedoCommand(a2dCommand &cmd)
sents a a2dCommandProcessorEvent with id ::wxEVT_REDO
bool Undo()
Override this to undo a command.
virtual bool Undo()
Undo one command or command group.
wxString GetIdName() const
name of the name of this error id
virtual bool ContainsCommand(a2dCommand *command)
return true if this command/group are nested group contains the given command
virtual bool PostDo()
Override this to perform a dependency action after command is done.
virtual wxString GetGroupName() const
return command name
const a2dError a2dError_CommandError
virtual bool Redo()
Redo one command or command group.
static a2dPathList m_configpath
Path(s) for configuration file(s) in an application.
void IgnoreError(unsigned int id)
Add an error to the list of ignored errors.
virtual bool CanUndo() const
Are there commands to undo and can they be undone ?
virtual bool DoCommand(a2dCommand &cmd)
sents a a2dCommandProcessorEvent with id ::wxEVT_DO
virtual bool ClearAfterCurrentCommand(a2dCommand *current)
Hierarchically clear all commands after current command.
const a2dError a2dError_GetVar
class to map references to objects stored in XML, in order to make the connection later on...
see a2dCommandProcessorEvent
wxString GetUndoMenuLabel() const
Gets the current Undo menu label.
~a2dCommandGroup(void)
destructor
a2dAutoZeroPtr< a2dObject > m_propRefObject
all property references will be set NULL when this object, having the property, will be deleted...
virtual bool Do()=0
Override this to perform a command.
bool Do()
Override this to perform a command.
One Global instance of this class exists, in order to get to global needed objects.
virtual a2dCommand * CloneAndBind(a2dObject *object)
Copy and instantiate the command.
virtual a2dCommand * FindNext(a2dCommand *current) const
Find the next command of the given command.
const a2dError a2dError_NoError
int a2dErrorWarningCode
error codes generated in docview framework.
a2dObject * Clone(CloneOptions options, a2dRefMap *refs=NULL) const
create an exact copy of this property
property to hold a double type variable to be associated with a a2dObject
a2dErrorWarningCode GetLastErrorCode() const
code of the last warning or error
property to hold a bool type variable to be associated with a a2dObject
Input and output handler for the XmlSer format.
static const a2dCommandId Id
Set a string environment variable.
wxString m_redoAccelerator
associated redo accelerator
a2dNamedProperty * GetProperty(const a2dPropertyId *propertyId, a2dPropertyId::Flags flags=a2dPropertyId::flag_none) const
get property on this object
bool m_canUndo
can this command be undone
a2dCommandProcessor * m_cmp
allows commands to get to the command processor that submitted the command.
wxString m_groupName
name of group of commands
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
list of a2dNamedProperty objects
const a2dCommandId * m_commandId
can be used to identify the command
virtual void Initialize()
Initialises the current command and menu strings.
property to hold a FileName type variable to be associated with a a2dObject
property to hold a a2dObjectPtr smart pointer type variable to be associated with a a2dObject ...
void SetParentGroup(a2dCommandGroup *parent)
set the parent group of this group
static const a2dCommandId sm_groupCommandId
property for group command id
~a2dCommand(void)
destructor
property to hold a 2 byte integer type variable to be associated with a a2dObject ...
virtual bool UndoCommand(a2dCommand &cmd)
sents a a2dCommandProcessorEvent with id ::wxEVT_UNDO
wxString GetRedoMenuLabel() const
Gets the current Undo menu label.
void SetProperty(a2dNamedProperty *propertyHolder, a2dPropertyId::SetFlags flags=a2dPropertyId::set_none)
Set the property to the this object.
a2dCommandPtr m_currentCommand
this is the tree-trace to the currently active command
a2dCommandGroup * FindActiveGroup()
find the currently active command group
Set a environment variable.
a group of commands, used to group commands together for undo/redo
property to hold a 2 byte integer type variable to be associated with a a2dObject ...
const a2dPropertyId * m_id
id of the property that is set.
bool m_active
If true, this command group is not yet closed and may still receive commands.
virtual a2dCommand * FindNext(a2dCommand *current) const
Find the next command of the given command.
a2dCommandGroup * m_parentGroup
this is the parent group of this group
virtual bool DoPreCommand(a2dCommand &cmd)
Called before doing the actual command.
virtual bool Remove(a2dCommand *command)
Remove the given command in this group or a subgroup.
a2dCommandGroup(const wxString &name, a2dCommandGroup *parent=NULL)
constructor
virtual class a2dCommandGroup * IsCommandGroup()
This is like a wxDynamicCast, but much faster.
static const a2dCommandId sm_noCommandTypeId
property for type of command id
#define forEachIn(listtype, list)
easy iteration for a2dlist
virtual void ReportError(const a2dError &error, const wxString &errorstr=wxEmptyString)
concatenate to the the error report the given error.
void CommandGroupEnd(a2dCommandGroup *group)
End a command group.
wxUint32 m_maxNoCommands
maximum number of commands to store
a2dCommandGroup * CommandGroupBegin(const wxString &name)
Start a new command group.
a2dSmrtPtr< a2dCommandGroup > m_currentGroup
this is the parent group of the current command ( which may be a group itself )
virtual bool CanRedo() const
Are there commands to redo and can they be redone ?
const a2dCommandId * GetCommandId()
a specific id for this command.
#define wxStaticCast(obj, className)
The wxWindows 2.4.2 wxStaticCast is buggy. It evaluates its argument twice.
wxString m_undoAccelerator
associated undo accelerator attached to menu
wxString * GetVariableString(const wxString &variablename)
get a variable from the internal aliases list
A2DGENERALDLLEXP a2dSmrtPtr< a2dGeneralGlobal > a2dGeneralGlobals
a global pointer to get to global instance of important classes.
Set a string variable inside wxDocview.
a2dNamedProperty * Clone(a2dObject::CloneOptions options, a2dRefMap *refs=NULL) const
Virtual copy constructor.
static const a2dCommandId & GetCommandByName(const wxString &commandName)
search Id given the name of the command
Holds internal variables to be used whereever needed.
virtual bool Undo()
Override this to undo a command.
static const a2dCommandId Id
Set a string variable inside wxDocview.
virtual bool ClearAfterCurrentCommand(a2dCommand *current)
Hierarchically clear all commands after current.
a2dCommand * GetCurrentCommand() const
command list access
Input and output handler for the XmlSer format.
virtual bool PreDo()
Override this to perform a dependency action before command is done.
a2dVariablesHash & GetVariablesHash()
aliases list for setting internal variables
virtual void ReportWarning(const a2dError &error, const wxString &errorstr)
concatenate to the error report the given warning.
a2dCommandList m_subcommands
the list of subcommands
virtual void ClearCommands()
remove all commands stored
void SentBusyEvent(bool start, a2dCommand *command)
Each a2dCommand is given a command id at construction.
wxString * GetVariableString(const wxString &variableName)
get an existing wxString variable
virtual bool Submit(a2dCommand *command, bool storeIt=true)
next to the base class submit, it sets a2DocumentCommandProcessor for a2dCommand
int m_refcount
how many references to this object do exist
property to hold a wxString type variable to be associated with a a2dObject
a2dSmrtPtr< a2dCommandGroup > m_rootGroup
this is the root of the command group tree
a2dCommand(bool canUndo=false, const a2dCommandId &commandId=sm_noCommandId, const a2dCommandId &commandTypeId=sm_noCommandTypeId, const wxString &menuString=wxEmptyString)
constructor
static a2dErrorVector m_errors
list of all possible errors
a2dPropertyEditEvent(a2dObject *object, a2dNamedPropertyList *properties=NULL)
constructor
virtual bool Remove(a2dCommand *command)
Remove the given command.
static wxArrayInt m_ignoredErrorIds
list of error id's to be ignored.
virtual wxString GetName() const
void SetCurrentGroup(a2dCommandGroup *group)
set current group
virtual bool DoPostCommand(a2dCommand &cmd)
Called after doing the actual command.
bool ClearCommandsById(const a2dCommandId &commandId, a2dCommand *fromcommand=NULL)
erase commands with a certain id, starting at fromcommand
virtual bool SetOrAddPropertyToObject(a2dObject *propRefObject, const wxString &name, const wxString &value=wxT(""), bool withUndo=true)
set a named property to the given object
virtual a2dCommand * FindPrevious(a2dCommand *current) const
Find the previous command of the given command.
wxString GetErrorsAsString()
concatenate all errors found into one string.
const a2dCommandId * m_commandTypeId
if set can be used to identify groups of commands
void SetCurrentToLastActive()
Set the current command to the last command in the active group.
This is the base class for all kinds of property id's for a2dObject.
virtual void SetMenuStrings()
does sent an event to update menu strings after a command
static bool m_directlog
logging to wxLog target on or off
void SetErrorMessage(const wxString &error)
set error message
a2dErrorWarningCode GetErrorCode() const
get error code
wxString GetErrorMessage() const
get error string
a2dNamedPropertyPtr m_property
property set to the object.
virtual void ReportErrorF(const a2dError &error, const wxChar *Format,...)
concatenate to the the error report the given error.
property to hold a wxObject variable to be associated with a a2dObject
command processor and intializing and event handling classes specific for wxDocview.
Event sent to a2dCommandProcessor.
static a2dHashMapCommandIds & GetHashMap()
return hash of commands
void SendToLogTarget()
all stored errors and warning are sent to log target using wxLogError()
virtual bool RemoveProperty(const a2dPropertyId *id, bool all=true)
This function is called by a2dPropertyId to remove a property from the list.
virtual void ReportWarningF(const a2dError &error, const wxChar *Format,...)
concatenate to the error report the given warning.
virtual void Store(a2dCommand *command)
just store the command without executing it
virtual void ResetErrors()
reset the error report to empty.
This template class is for property ids with a known data type.
initializes the general module
virtual bool Do()
Override this to perform a command.
a2dCommandProcessor(int maxCommands=-1)
Constructor.
wxString GetName() const
get name
CloneOptions
options for cloning
a2dCommand_SetProperty()
for dynamic creation
void Add(a2dCommand *command)
add a command to the group
static const a2dCommandId sm_noCommandId
property for command id
For exceptions thrown from commands.
used to change a property on objects
virtual a2dCommand * FindPrevious(a2dCommand *current) const
Find the previous command of the given command.
property to hold an unsigned 2 byte integer type variable to be associated with a a2dObject ...
a base command for the a2dCommandProcessor
a2dSmrtPtrList< a2dPropertyId > a2dPropertyIdList
list to hold a set of property id objects pointers