wxArt2D
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members

base command processor More...

#include <comevt.h>

Inheritance diagram for a2dCommandProcessor:
Inheritance graph
[legend]
Collaboration diagram for a2dCommandProcessor:
Collaboration graph
[legend]

Public Member Functions

 a2dCommandProcessor (int maxCommands=-1)
 Constructor. More...
 
virtual ~a2dCommandProcessor ()
 destructor
 
virtual bool Submit (a2dCommand *command, bool storeIt=true)
 next to the base class submit, it sets a2DocumentCommandProcessor for a2dCommand
 
virtual void Store (a2dCommand *command)
 just store the command without executing it
 
virtual bool Undo ()
 Undo one command or command group.
 
virtual bool Redo ()
 Redo one command or command group.
 
virtual bool CanUndo () const
 Are there commands to undo and can they be undone ?
 
virtual bool CanRedo () const
 Are there commands to redo and can they be redone ?
 
virtual void Initialize ()
 Initialises the current command and menu strings.
 
virtual void SetMenuStrings ()
 does sent an event to update menu strings after a command
 
wxString GetUndoMenuLabel () const
 Gets the current Undo menu label.
 
wxString GetRedoMenuLabel () const
 Gets the current Undo menu label.
 
a2dCommandGetCurrentCommand () const
 command list access
 
int GetMaxCommands () const
 get the limit on number of commands to store
 
a2dCommandGroupGetRootGroup () const
 return top/startgroup
 
a2dCommandGroupGetCurrentGroup () const
 return current group
 
void SetCurrentGroup (a2dCommandGroup *group)
 set current group More...
 
virtual void ClearCommands ()
 remove all commands stored
 
const wxString & GetUndoAccelerator () const
 By default, the accelerators are "\tCtrl+Z" and "\tCtrl+Y".
 
const wxString & GetRedoAccelerator () const
 By default, the accelerators are "\tCtrl+Z" and "\tCtrl+Y".
 
void SetUndoAccelerator (const wxString &accel)
 By default, the accelerators are "\tCtrl+Z" and "\tCtrl+Y".
 
void SetRedoAccelerator (const wxString &accel)
 By default, the accelerators are "\tCtrl+Z" and "\tCtrl+Y".
 
virtual bool SetOrAddPropertyToObject (a2dObject *propRefObject, const wxString &name, const wxString &value=wxT(""), bool withUndo=true)
 set a named property to the given object More...
 
virtual bool SetOrAddPropertyToObject (a2dObject *propRefObject, a2dNamedProperty *property, bool withUndo=true)
 set a named property to the given object More...
 
a2dCommandGroupCommandGroupBegin (const wxString &name)
 Start a new command group. More...
 
void CommandGroupBegin (a2dCommandGroup *group)
 Start a new command group.
 
void CommandGroupEnd (a2dCommandGroup *group)
 End a command group.
 
bool SmrtPtrRelease ()
 
- Public Member Functions inherited from a2dObject
virtual bool ProcessEvent (wxEvent &event)
 
bool SearchDynamicEventTable (wxEvent &event)
 
void Connect (int winid, int lastId, int eventType, wxObjectEventFunction func, wxObject *userData=(wxObject *) NULL, wxEvtHandler *eventSink=(wxEvtHandler *) NULL)
 
bool Disconnect (int winid, int lastId, wxEventType eventType, wxObjectEventFunction func=NULL, wxObject *userData=(wxObject *) NULL, wxEvtHandler *eventSink=(wxEvtHandler *) NULL)
 
void ProcessConnectedEvent (wxEvent &event)
 wxCHECK_VERSION(2,9,0) More...
 
void ConnectEvent (wxEventType type, wxEvtHandler *eventSink)
 
bool DisconnectEvent (wxEventType type, wxEvtHandler *eventSink)
 
bool DisconnectEventAll (wxEvtHandler *eventSink)
 Remove all dynamic events in classA, going to classB (eventSink) More...
 
 a2dObject ()
 constructor
 
virtual ~a2dObject ()
 destructor
 
void operator= (const a2dObject &other)
 assignment operator
 
int GetOwnedBy ()
 like it to be protected, but this does not work with wxList macros More...
 
virtual a2dObjectSetNonDynamic ()
 Call to mark this object as non-dynamic (static/local/auto) More...
 
void CheckReferences ()
 Check zero reference count and delete if count is 0. More...
 
a2dObjectClone (CloneOptions options, a2dRefMap *refs=NULL) const
 create an exact copy of this property
 
 a2dObject (const a2dObject &other, CloneOptions options, a2dRefMap *refs)
 
virtual wxString GetName () const
 Returns the name of this object, if no name is given the internal id will be returned. More...
 
virtual void SetName (const wxString &name)
 Creates the a2dStringProperty PROPID_Name. More...
 
virtual bool IsTemporary_DontSave () const
 Check if this is a temporary object, which should not be saved.
 
void SaveAsDocument (a2dIOHandlerXmlSerOut &out)
 Save this object and all below as an XML document. More...
 
virtual void Save (wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dObjectList *towrite)
 write all needed to an XML type of file called the CVG format More...
 
void LoadFromDocument (a2dIOHandlerXmlSerIn &parser)
 Load this object and all below from an XML document. More...
 
virtual void Load (wxObject *parent, a2dIOHandlerXmlSerIn &parser)
 load object from CVG file More...
 
wxInt64 GetUniqueSerializationId () const
 return a unique id for this object More...
 
virtual bool AlwaysWriteSerializationId () const
 If true, always write an id. More...
 
virtual bool LinkReference (a2dObject *other)
 link a reference in the object to the given value More...
 
virtual void ResolveInform ()
 inform an object that reference resolution was done More...
 
void Walker (wxObject *parent, a2dWalkerIOHandler &handler)
 This is used to recursively walk through an object tree.
 
void SetCheck (bool check)
 general flag use at will. More...
 
bool GetCheck () const
 general flag use at will.
 
void SetRelease (bool value)
 set release flag More...
 
bool GetRelease () const
 get release flag More...
 
a2dAutoZeroPtr< a2dObject > ** GetAutoZeroPtrList ()
 return the list head pointer for autozero pointers to this object More...
 
 DECLARE_PROPERTIES ()
 
a2dNamedPropertyGetProperty (const a2dPropertyId *propertyId, a2dPropertyId::Flags flags=a2dPropertyId::flag_none) const
 get property on this object More...
 
void SetProperty (a2dNamedProperty *propertyHolder, a2dPropertyId::SetFlags flags=a2dPropertyId::set_none)
 Set the property to the this object. More...
 
void SetProperty (const a2dNamedProperty &propertyHolder, a2dPropertyId::SetFlags flags=a2dPropertyId::set_none)
 Set the property to the this object and if enabled, to all childs and object members. More...
 
virtual a2dNamedPropertyFindProperty (const a2dPropertyId *id, a2dPropertyId::Flags flags=a2dPropertyId::flag_none)
 Find a dynamic property with given id in the property list. More...
 
virtual const a2dNamedPropertyFindProperty (const a2dPropertyId *id, a2dPropertyId::Flags flags=a2dPropertyId::flag_none) const
 Find a dynamic property with given id in the property list. More...
 
virtual bool HasProperty (const a2dPropertyId *id, const wxString &stringvalue=wxEmptyString) const
 Check if the object has a property with given id and string representation. More...
 
virtual void OnPropertyChanged (const a2dPropertyId *id)
 This function is called after a property changed. More...
 
virtual bool EditProperties (const a2dPropertyId *id, bool withUndo=true)
 edit properties of the object More...
 
void TakeOverProperties (a2dObject *from, a2dPropertyIdList *listOfIds)
 Properties in the id list are taken from the given object, en set to this. More...
 
wxURI GetURI () const
 quick way to get to PROPID_URI property More...
 
void SetURI (const wxURI &url)
 quickly set a property PROPID_URI More...
 
const a2dNamedPropertyListGetPropertyList () const
 Get the Property List. More...
 
bool HasDynamicProperties () const
 test if there are dynamic properties in the m_propertylist
 
virtual bool RemoveProperty (const a2dPropertyId *id, bool all=true)
 This function is called by a2dPropertyId to remove a property from the list. More...
 
void RemoveTemporaryProperties ()
 remove all temporary properties
 
virtual bool AddProperty (a2dNamedProperty *property)
 This function is called by a2dPropertyId to add a property to the list. More...
 

Protected Member Functions

void SentBusyEvent (bool start, a2dCommand *command)
 
a2dCommandGroupFindActiveGroup ()
 find the currently active command group
 
void SetCurrentToLastActive ()
 Set the current command to the last command in the active group.
 
virtual bool DoPreCommand (a2dCommand &cmd)
 Called before doing the actual command.
 
virtual bool DoPostCommand (a2dCommand &cmd)
 Called after doing the actual command.
 
virtual bool DoCommand (a2dCommand &cmd)
 sents a a2dCommandProcessorEvent with id ::wxEVT_DO
 
virtual bool UndoCommand (a2dCommand &cmd)
 sents a a2dCommandProcessorEvent with id ::wxEVT_UNDO
 
virtual bool RedoCommand (a2dCommand &cmd)
 sents a a2dCommandProcessorEvent with id ::wxEVT_REDO
 
- Protected Member Functions inherited from a2dObject
virtual bool DoIgnoreIfNotMember (const a2dPropertyId *id) const
 used to decide if a property shall be ignored, if it is not a member More...
 
virtual void DoWalker (wxObject *parent, a2dWalkerIOHandler &handler)
 iterate over this object and its children More...
 
virtual void DoSave (wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
 Save settings.
 
virtual void DoLoad (wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
 Load settings.
 

Protected Attributes

wxUint32 m_maxNoCommands
 maximum number of commands to store
 
a2dSmrtPtr< a2dCommandGroupm_rootGroup
 this is the root of the command group tree
 
a2dSmrtPtr< a2dCommandGroupm_currentGroup
 this is the parent group of the current command ( which may be a group itself )
 
a2dCommandPtr m_currentCommand
 this is the tree-trace to the currently active command
 
wxString m_undoAccelerator
 associated undo accelerator attached to menu
 
wxString m_redoAccelerator
 associated redo accelerator
 
- Protected Attributes inherited from a2dObject
a2dNamedPropertyList m_propertylist
 properties
 
int m_refcount
 how many references to this object do exist
 
bool m_check: 1
 used for linking multiple referenced objects when serializing
 
bool m_release: 1
 when set object is treated as being deleted, and wil be deleted in idle time.
 
bool m_recursion_active: 1
 this is used as a recursion stopper
 
bool m_pendingDisconnects: 1
 
unsigned int m_iteratorCount
 
a2dAutoZeroPtr< a2dObject > * m_autozeroptrlist
 this is a list of all a2dAutoZeroPtr object pointing to this object
 

Additional Inherited Members

- Public Types inherited from a2dObject
enum  CloneOptions {
  clone_members = 0x00000001, clone_properties = 0x00000002, clone_childs = 0x00000004, clone_unused = 0x00000008,
  clone_setoriginal = 0x00000010, clone_seteditcopy = 0x00000020, clone_noReference = 0x00000040, clone_noCameleonRef = 0x00000080,
  clone_toDrag = 0x00000100, clone_flat = 0x00000000, clone_deep = clone_members | clone_properties | clone_childs
}
 options for cloning More...
 
typedef a2dAutoZeroPtr< a2dObjectTAutoZeroPtrListClass
 this is needed inside the smart pointer template code
 
- Static Public Attributes inherited from a2dObject
static a2dPropertyIdBoolPROPID_Check = NULL
 used for linking multiple referenced objects when serializing
 
static a2dPropertyIdUriPROPID_URI = NULL
 attach an URL to the object
 
static a2dPropertyIdStringPROPID_Name = NULL
 Name property, to return name of this object.
 
static a2dPropertyIdVoidPtrPROPID_autozeroptrlist = NULL
 
static const a2dSignal sm_Edit_properties = wxNewId()
 edit properties event, see EditProperties()
 
- Protected Types inherited from a2dObject
enum  { refcount_nondynamic = 0x76543210 }
 special refcount value for non-dynamic objects
 

Detailed Description

base command processor

a2dCommand commands submitted to this class, are stored on a stack. Because commands can be nested, the command processor actually has not a stack, but a tree of nested commands. The tree is implemented by nesting a2dDocviewCommand's.

One can have a command stack for the whole application, and sub command stacks for documents. So undo can be called seperate for all documents, or even parts of documents.

See a2dCommand for how to organize undo information.

Definition at line 829 of file comevt.h.

Constructor & Destructor Documentation

a2dCommandProcessor::a2dCommandProcessor ( int  maxCommands = -1)

Constructor.

Parameters
maxCommandsmaximum of commands on the command stack, default -1 is unlimited.

Definition at line 697 of file comevt.cpp.

Member Function Documentation

a2dCommandGroup * a2dCommandProcessor::CommandGroupBegin ( const wxString &  name)

Start a new command group.

The return value is given to CommandGroupEnd.

Definition at line 1096 of file comevt.cpp.

void a2dCommandProcessor::SentBusyEvent ( bool  start,
a2dCommand command 
)
protected

sents a a2dCommandProcessorEvent event( wxEVT_BEGINBUSY, command ) or a2dCommandProcessorEvent event( wxEVT_ENDBUSY, command ) to this class. This is done before and after executing/submitting a command. You can intercept this event to set e.g a busy cursor.

Definition at line 823 of file comevt.cpp.

void a2dCommandProcessor::SetCurrentGroup ( a2dCommandGroup group)

set current group

When a derived a2dCommandGroup, is Submitted, its Do(0 member will normally gather the sub commands for the group. In this case, the group itself is already Submitted, and will be stored, only make sure using this function that the subcommands that are submitted, end up in this group.

Definition at line 1090 of file comevt.cpp.

bool a2dCommandProcessor::SetOrAddPropertyToObject ( a2dObject propRefObject,
const wxString &  name,
const wxString &  value = wxT( "" ),
bool  withUndo = true 
)
virtual

set a named property to the given object

Remarks
This function should only be used if the id comes as string from the user or a file. The id must be in the id list and the type is derived from the found id.
Parameters
propRefObjectobject to set the property to.
namethe name of the property to add.
valuethe value to set the property to.
withUndoif true the setting of this property can be undone.

Definition at line 1066 of file comevt.cpp.

bool a2dCommandProcessor::SetOrAddPropertyToObject ( a2dObject propRefObject,
a2dNamedProperty property,
bool  withUndo = true 
)
virtual

set a named property to the given object

Parameters
propRefObjectobject to set the property to.
propertythe property (id and value) to add.
withUndoif true the setting of this property can be undone.

Definition at line 1083 of file comevt.cpp.

bool a2dCommandProcessor::SmrtPtrRelease ( )
virtual

when releasing this, release first all command, since they may hold commands referencing this command processor, so it would never be deleted.

Reimplemented from a2dObject.

Definition at line 719 of file comevt.cpp.


The documentation for this class was generated from the following files:
a2dCommandProcessor Class Reference -- Sun Oct 12 2014 17:04:33 -- Sun Oct 12 2014 -- 1.8.5 -- wxArt2D -- . -- Main Page Reference Documentation