wxArt2D
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
a2dDocumentCommandProcessor Class Reference

One object of this class may be created in an application, to manage all the templates and documents. More...

#include <doccom.h>

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

Public Member Functions

 a2dDocumentCommandProcessor (long flags=a2dDEFAULT_DOCUMENT_FLAGS, bool initialize=true, int maxCommands=-1)
 Constructor. More...
 
 a2dDocumentCommandProcessor (a2dDocumentCommandProcessor *other)
 construct and initilize based on other.
 
 ~a2dDocumentCommandProcessor ()
 destructor
 
void OnMenu (wxCommandEvent &event)
 All menu's ( also using a2dMenuIdItem ) can be intercepted here. More...
 
wxString AskFile (const wxString &message, const wxString &default_path="", const wxString &default_filename="", const wxString &default_extension="", const wxString &wildcard="*.*", int flags=0, int x=-1, int y=-1)
 ask for a file using a file selector. More...
 
virtual void OnExit ()
 Called by Exit() More...
 
virtual void Initialize ()
 Initializes data; currently just calls OnCreateFileHistory. More...
 
virtual bool SubmitToDocument (a2dCommand *command, bool storeIt=true)
 redirect the command to the current document ( if available )
 
bool FileClose (bool force=true)
 Closes and deletes the currently active document unless Close was vetod.
 
a2dError FileNew (a2dDocumentPtr &doc, a2dTemplateFlagMask docTemplateFlags=a2dTemplateFlag::VISIBLE)
 Creates a document from a list of templates (if more than one template).
 
a2dDocumentTemplateGetPreferredOpenDocumentTemplate ()
 Return the preferred document template for Opening files.
 
void SetPreferredOpenDocumentTemplate (a2dDocumentTemplate *docTemplate)
 Set the preferred document template for Opening files.
 
a2dError FileOpen (a2dDocumentPtr &doc, const wxFileName &file=wxFileName(wxT("")), a2dTemplateFlagMask docTemplateFlags=a2dTemplateFlag::VISIBLE|a2dTemplateFlag::LOAD)
 Creates a new document and reads in the selected file. More...
 
a2dError FilesOpen (const wxString &openPath=wxT(""), int dialogFlags=wxFD_MULTIPLE|wxFD_OPEN, a2dTemplateFlagMask docTemplateFlags=a2dTemplateFlag::VISIBLE|a2dTemplateFlag::LOAD)
 open one or more files using a file dialog More...
 
a2dError FileOpenCheck (a2dDocumentPtr &doc, const wxFileName &file, bool checkModification)
 Return existing document, or open it from file. More...
 
bool FileRevert ()
 revert the current document to the non saved document on disk. More...
 
bool FileSave ()
 Saves the current document by calling wxDocument::Save for the current document.
 
bool FileSaveAll ()
 Saves the documents by calling wxDocument::Save for each document.
 
bool FileSaveAs (const wxFileName &file=wxFileName(wxT("")), a2dDocumentFlagMask flags=a2dREFDOC_NON)
 Calls wxDocument::SaveAs for the current document. More...
 
a2dDocumentTemplateGetPreferredExportDocumentTemplate ()
 Return the preferred document template for Exporting files.
 
void SetPreferredExportDocumentTemplate (a2dDocumentTemplate *docTemplate)
 Set the preferred document template for Exporting files.
 
bool FileExport (const wxFileName &file=wxFileName(wxT("")), const wxString &description=wxT(""), a2dDocumentFlagMask flags=a2dREFDOC_NON)
 Calls a2dDocument::Export for the current document. More...
 
a2dDocumentTemplateGetPreferredImportDocumentTemplate ()
 Return the preferred document template for Importing files.
 
void SetPreferredImportDocumentTemplate (a2dDocumentTemplate *docTemplate)
 Set the preferred document template for Importing files.
 
bool FileImport (const wxFileName &file=wxFileName(wxT("")), const wxString &description=wxT(""), a2dDocumentFlagMask flags=a2dREFDOC_NON)
 Calls a2dDocument::Import for the current document. More...
 
bool Print (a2dPrintWhat printWhat=a2dPRINT_Print)
 print the current active view.
 
bool Preview (a2dPrintWhat printWhat=a2dPRINT_Preview)
 print preview of the current active view.
 
bool PrintSetup (a2dPrintWhat printWhat)
 printer setup the current active document or central command processor.
 
wxPageSetupDialogData GetDefaultPrintSettings ()
 Return page setup data, as set in the current default printer.
 
wxPageSetupDialogData * GetPrintSetup (a2dPrintWhat printWhat)
 get printer setup the current active view or document or the one from central command processor.
 
void OnCannotOpenDocument (a2dCommandEvent &event)
 default handler when a file could not be opened More...
 
virtual a2dError CreateDocuments (const wxString &path, a2dDocumentFlagMask documentflags=a2dREFDOC_NON, a2dDocumentTemplate *wantedDocTemplate=NULL, int dialogflags=wxFD_OPEN, a2dTemplateFlagMask docTemplateFlags=a2dTemplateFlag::VISIBLE)
 Creates new documents in a manner determined by the flags parameter, which can be: More...
 
a2dViewAddDocumentCreateView (a2dDocument *newDoc, const wxString &viewTypeName=wxT(""), a2dDocumentFlagMask documentflags=a2dREFDOC_NEW, a2dTemplateFlagMask docTemplateFlags=a2dTemplateFlag::VISIBLE, a2dTemplateFlagMask viewTemplateFlags=a2dTemplateFlag::VISIBLE)
 adds the given document, and creates a view for it. More...
 
a2dError AddCreatedDocument (a2dDocument *newDoc, bool sentPreAddCreatedDocumentEvent=false, bool sentPostCreateDocumentEvent=false, a2dDocumentFlagMask documentflags=a2dREFDOC_NEW, a2dTemplateFlagMask docTemplateFlags=a2dTemplateFlag::VISIBLE)
 add a in memory created document, but do not create a view. More...
 
virtual a2dViewCreateView (a2dDocument *doc, const wxString &viewTypeName=wxT(""), a2dDocumentFlagMask flags=a2dREFDOC_NON, a2dTemplateFlagMask viewTemplateFlags=a2dTemplateFlag::VISIBLE)
 Creates a new view for the given document. More...
 
void ReleaseTemplate (a2dDocumentTemplate *temp, long flags=0)
 remove/release a template More...
 
virtual bool FlushDoc (a2dDocument *doc)
 
a2dDocumentTemplateMatchTemplate (const wxString &path)
 return template suitable for loading the file in path, using FindTemplateForPath.
 
virtual a2dError SelectDocumentPath (const wxString &title, const a2dDocumentTemplateList &docTemplates, wxString &path, a2dDocumentFlagMask flags, wxArrayString *selectedPaths, a2dDocumentTemplate **chosenTemplate, int dialogflags=wxFD_OPEN, a2dTemplateFlagMask docTemplateFlags=a2dTemplateFlag::VISIBLE, const a2dDocumentTemplate *preferedTemplate=NULL)
 pops up a file selector with optional a list of filters More...
 
virtual a2dDocumentTemplateSelectDocumentType (bool sort=false, a2dTemplateFlagMask docTemplateFlags=a2dTemplateFlag::VISIBLE)
 Returns a document template by asking the user. More...
 
virtual a2dDocumentTemplateFindTemplateForPath (const a2dDocumentTemplateList &docTemplates, const wxString &path, a2dTemplateFlagMask mask=a2dTemplateFlag::VISIBLE)
 function used in CreateDocument() when a2dREFDOC_SILENT is used for creating it. More...
 
virtual a2dViewTemplateSelectViewType (a2dDocument *doc, const a2dViewTemplateList &list, const wxString &viewTypeName=wxT(""), bool sort=false, a2dTemplateFlagMask viewTemplateFlags=a2dTemplateFlag::VISIBLE)
 Returns a view template by asking the user. More...
 
void AssociateDocTemplate (a2dDocumentTemplate *temp)
 add a reference to a a2dDocumentTemplate to the a2dDocumentTemplateList
 
void DisassociateDocTemplate (a2dDocumentTemplate *temp)
 remove a reference to a a2dDocumentTemplate to the a2dDocumentTemplateList
 
void AssociateViewTemplate (a2dViewTemplate *temp)
 add a reference to a a2dViewTemplate to the wxViewTemplateReflist
 
void DisassociateViewTemplate (a2dViewTemplate *temp)
 remove a reference to a a2dViewTemplate to the wxViewTemplateReflist
 
void SetCurrentDocument (a2dDocument *document)
 set the current document, only needed in cases More...
 
a2dDocumentGetCurrentDocument () const
 Get the current Document, which is the document that was last accessed from a view. More...
 
a2dCommandProcessorGetCurrentDocumentCommandProcessor () const
 get the command processor of the current document. More...
 
void SetMaxDocsOpen (size_t n)
 Sets the maximum number of documents that can be open at a time. More...
 
size_t GetMaxDocsOpen () const
 Gets the maximum number of documents that can be open at a time.
 
void AddDocument (a2dDocument *doc)
 Add a document to the manager's list. More...
 
void RemoveDocument (a2dDocument *doc)
 remove a document from the manager's list More...
 
bool CloseDocuments (bool force=true)
 closes all currently open documents More...
 
bool Clear (bool force=true)
 Clear remaining documents and templates. More...
 
bool Exit (bool force=true)
 Called to Exit the application properly. More...
 
void SetBusyExit (bool exitBusy)
 
bool GetBusyExit ()
 return true if the application is bussy exiting.
 
a2dViewGetCurrentView () const
 return the one that is active right now (e.g. has focus in case of a wxWindow), or NULL
 
const a2dDocumentListGetDocuments () const
 returns a reference to the a2dDocumentList, which contains all a2dDocument's that are open.
 
const a2dDocumentTemplateListGetDocTemplates ()
 returns a reference to the a2dDocumentTemplateList, which contains all a2dDocumentTemplate's.
 
const a2dViewTemplateListGetViewTemplates ()
 returns a reference to the a2dViewTemplateList, which contains all a2dViewTemplate's.
 
virtual bool MakeDefaultName (wxString &buf)
 Make a default document name.
 
virtual wxString MakeFrameTitle (a2dDocument *doc, const wxString &modifiedIndicator=wxT(""))
 Make a frame title (override this to do something different) More...
 
virtual a2dFileHistoryOnCreateFileHistory ()
 A hook to allow a derived class to create a different type of file history. Called from Initialize.
 
virtual a2dFileHistoryGetFileHistory () const
 returns a pointer to the file history list
 
virtual void AddFileToHistory (const wxFileName &file, a2dDocumentTemplate *docTemplate=NULL, a2dViewTemplate *viewTemplate=NULL)
 File history management.
 
virtual void RemoveFileFromHistory (size_t i)
 Remove a file from history.
 
virtual size_t GetHistoryFilesCount () const
 Return number fo files in history.
 
virtual a2dFileHistoryItemGetHistoryFileItem (size_t i) const
 return the a2dFileHistoryItem of the i'th file in the history
 
virtual wxString GetHistoryFile (size_t i) const
 return the filename of the i'th file in the history
 
virtual void FileHistoryUseMenu (wxMenu *menu)
 Use this menu for appending recently-visited document filenames,. More...
 
virtual void FileHistoryRemoveMenu (wxMenu *menu)
 Removes the given menu from the list of menus managed by the file history object.
 
virtual void FileHistoryAddFilesToMenu ()
 Appends the files in the history list, to all menus managed by the file history object.
 
virtual void FileHistoryAddFilesToMenu (wxMenu *menu)
 Appends the files in the history list, to the given menu only.
 
wxString GetLastDirectory () const
 Gets the directory to be displayed to the user when opening a file. Initially this is empty.
 
void SetLastDirectory (const wxString &dir)
 Sets the directory to be displayed to the user when opening a file. Initially this is empty.
 
virtual void SetCurrentView (a2dView *view)
 To set the curent view. More...
 
void CheckCurrentView (a2dView *view)
 Views do inform the document manager when a view will be destroyed. More...
 
wxPageSetupDialogData * GetPageSetupData (void) const
 
void SetPageSetupData (const wxPageSetupDialogData &pageSetupData)
 
void SetPageSetupData (wxPageSetupDialogData *pageSetupData)
 
virtual bool ProcessEvent (wxEvent &event)
 
void SetUndo (bool withUndo)
 set undo storage or not
 
bool GetUndo ()
 get undo storage setting
 
- Public Member Functions inherited from a2dCommandProcessor
 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 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
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 OnUndo (wxCommandEvent &event)
 default handler for GUI event with id wxID_UNDO
 
void OnRedo (wxCommandEvent &event)
 default handler for GUI event with id wxID_REDO
 
void OnUpdateFileOpen (wxUpdateUIEvent &event)
 Handlers for UI update commands.
 
void OnUpdateFileClose (wxUpdateUIEvent &event)
 Handlers for UI update commands.
 
void OnUpdateFileCloseAll (wxUpdateUIEvent &event)
 Handlers for UI update commands.
 
void OnUpdateFileRevert (wxUpdateUIEvent &event)
 Handlers for UI update commands.
 
void OnUpdateFileNew (wxUpdateUIEvent &event)
 Handlers for UI update commands.
 
void OnUpdateFileSave (wxUpdateUIEvent &event)
 Handlers for UI update commands.
 
void OnUpdateFileSaveAll (wxUpdateUIEvent &event)
 Handlers for UI update commands.
 
void OnUpdateFileSaveAs (wxUpdateUIEvent &event)
 Handlers for UI update commands.
 
void OnUpdateCreateView (wxUpdateUIEvent &event)
 Handlers for UI update commands.
 
void OnUpdateUndo (wxUpdateUIEvent &event)
 Handlers for UI update commands.
 
void OnUpdateRedo (wxUpdateUIEvent &event)
 Handlers for UI update commands.
 
void OnUpdatePrint (wxUpdateUIEvent &event)
 Handlers for UI update commands.
 
void OnUpdatePrintSetup (wxUpdateUIEvent &event)
 Handlers for UI update commands.
 
void OnUpdatePreview (wxUpdateUIEvent &event)
 Handlers for UI update commands.
 
void OnActivateView (a2dViewEvent &viewevent)
 Views do inform the document manager. More...
 
void OnRemoveView (a2dDocumentEvent &viewevent)
 Views do inform the document manager when a view will be removed. More...
 
void OnAddView (a2dDocumentEvent &docevent)
 It works when a2dView::SetDocument() executing.
 
- Protected Member Functions inherited from a2dCommandProcessor
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

long m_flags
 user flags use at will ( not used internal )
 
int m_defaultDocumentNameCounter
 to create unique new names for file
 
size_t m_maxDocsOpen
 the maximum of documents allowed open
 
a2dDocumentList m_docs
 list of all that are open
 
a2dDocumentTemplateList m_docTemplates
 templates for documents
 
a2dViewTemplateList m_viewTemplates
 templates for views
 
a2dViewm_currentView
 the current view (active or inactive)
 
a2dDocumentm_currentDocument
 the current active document
 
a2dFileHistorym_fileHistory
 the file history
 
wxString m_lastDirectory
 the last visited directory
 
a2dDocumentTemplatem_preferredImportTemplate
 preferred document template for Importing files.
 
a2dDocumentTemplatem_preferredExportTemplate
 preferred document template for Exporting files.
 
a2dDocumentTemplatem_preferredOpenTemplate
 preferred document template for Opening files.
 
bool m_withUndo
 if set, for commands which can undo, will be submitted like that.
 
bool m_busyExit
 set when terminating application
 
wxPageSetupDialogData * m_pageSetupData
 this is the global printer page setup data for printer
 
- Protected Attributes inherited from a2dCommandProcessor
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

One object of this class may be created in an application, to manage all the templates and documents.

Events not handled by a a2dDocumentFrame or derived class, are redirected to this class Events in the Application Child frames are also routed to the Parent Frame and from there to this class. This is convenient for combining the event table that is used for menu's in child as well as parent frames.

The a2dDocumentCommandProcessor class is part of the document/view framework supported by wxDocview, and cooperates with the a2dView, a2dDocument, a2dDocumentTemplate, a2dViewTemplate and a2dViewConnector classes.

All open documents and templates are maintained here, and functions to open new documents and views ( via its templates ), are setup from within this class. As such it is the communication class within the docview framework.

It is derived from a2dCommandProcessor, in order to use it as a command interpreter. Although not so much for Undo and Redo in this case. Much more to have a in between level for the Graphical User Interfaces and the commands that open up new documents and views. Defining your own docview commands in a derived a2dDocumentCommandProcessor, makes it easy to implement macro recording to a file, and replay the same macro from a file. Calling all member function of a2dDocumentCommandProcessor directly from the GUI, would make this impractible. So by issueing commands through the Submit() function, you will have a central point for calling member functions on the a2dDocumentCommandProcessor. But you are still free to call all member function directly.

Definition at line 242 of file doccom.h.

Constructor & Destructor Documentation

Constructor.

Create a document manager instance dynamically near the start of your application before doing any document or view operations.

Parameters
flagsis currently unused.
initializeif true, the Initialize function will be called to create a default history list object. If you derive from a2dDocumentCommandProcessor, you may wish to call the base constructor with false, and then call Initialize in your own constructor, to allow your own Initialize or OnCreateFileHistory functions to be called.
maxCommandsmaximum of commands on the command stack, default -1 is unlimited.

Definition at line 225 of file doccom.cpp.

Member Function Documentation

a2dError a2dDocumentCommandProcessor::AddCreatedDocument ( a2dDocument newDoc,
bool  sentPreAddCreatedDocumentEvent = false,
bool  sentPostCreateDocumentEvent = false,
a2dDocumentFlagMask  documentflags = a2dREFDOC_NEW,
a2dTemplateFlagMask  docTemplateFlags = a2dTemplateFlag::VISIBLE 
)

add a in memory created document, but do not create a view.

The first document template with the same GetDocumentTypeName() as the document, is set to the document. The sentPreAddCreatedDocumentEvent can be sent to the a2dViewConnector via the document template, to take an action before the new document is add to the document list. For instance to close other files or disconnect views to use them again for the new document. The sentPostCreateDocumentEvent should be sent to use the a2dViewConnector system to create new frames with views.

Parameters
newDocThe document to be added.
sentPreAddDocumentEventif true this event is sent to document template
sentPostCreateDocumentEventif true this event is sent to document template
documentflagsUse at will, default a2dREFDOC_NEW
docTemplateFlagstemplate mask for document template, to filter shown templates.
Returns
a2dError

Definition at line 1457 of file doccom.cpp.

void a2dDocumentCommandProcessor::AddDocument ( a2dDocument doc)

Add a document to the manager's list.

The a2dCommandEvent of type ::wxEVT_ADD_DOCUMENT is sent, this can be used to do some action after a new document is added. (e.g add to overview window of all open documents)

Definition at line 2066 of file doccom.cpp.

a2dView * a2dDocumentCommandProcessor::AddDocumentCreateView ( a2dDocument newDoc,
const wxString &  viewTypeName = wxT( "" ),
a2dDocumentFlagMask  documentflags = a2dREFDOC_NEW,
a2dTemplateFlagMask  docTemplateFlags = a2dTemplateFlag::VISIBLE,
a2dTemplateFlagMask  viewTemplateFlags = a2dTemplateFlag::VISIBLE 
)

adds the given document, and creates a view for it.

If more than one view is allowed for the document (by virtue of multiple templates mentioning the same document type), a choice of view is presented to the user.

Parameters
newDocdocument to add and for which to create a new view
viewTypeNameis not empty, this type of view will be searched in the available templates
documentflagsUse at will, default a2dREFDOC_NEW
docTemplateFlagstemplate mask for document template, to filter shown templates.
viewTemplateFlagstemplate mask for view template, to filter shown templates.

Definition at line 1447 of file doccom.cpp.

wxString a2dDocumentCommandProcessor::AskFile ( const wxString &  message,
const wxString &  default_path = "",
const wxString &  default_filename = "",
const wxString &  default_extension = "",
const wxString &  wildcard = "*.*",
int  flags = 0,
int  x = -1,
int  y = -1 
)
inline

ask for a file using a file selector.

If your path contains internal variables, they will be expanded.

Definition at line 294 of file doccom.h.

void a2dDocumentCommandProcessor::CheckCurrentView ( a2dView view)

Views do inform the document manager when a view will be destroyed.

The function sets the m_currentView to NULL, if eqaul to the view destroyed.

Parameters
viewif not NULL, set the m_currentView to NULL if equal to view. If view is NULL set the m_currentView to NULL.

Definition at line 2156 of file doccom.cpp.

bool a2dDocumentCommandProcessor::Clear ( bool  force = true)

Clear remaining documents and templates.

releases templates and documents, the documents are first closed, if vetod, the clearing of documents and templates is skipped, and return is false.

Definition at line 469 of file doccom.cpp.

bool a2dDocumentCommandProcessor::CloseDocuments ( bool  force = true)

closes all currently open documents

If force is true the closing of the document can not be vetod. If force is false only the documents which did not veto the close are Closed.

Remarks
closing a document means its views are closed, by calling a2dView::Close()
Returns
If Close of a document is vetod, returns false else true.

Definition at line 419 of file doccom.cpp.

a2dError a2dDocumentCommandProcessor::CreateDocuments ( const wxString &  path,
a2dDocumentFlagMask  documentflags = a2dREFDOC_NON,
a2dDocumentTemplate wantedDocTemplate = NULL,
int  dialogflags = wxFD_OPEN,
a2dTemplateFlagMask  docTemplateFlags = a2dTemplateFlag::VISIBLE 
)
virtual

Creates new documents in a manner determined by the flags parameter, which can be:

wxDOC_NEW Creates a fresh document.

wxDOC_SILENT Silently loads the given document file.

If wxDOC_NEW is present, a new document will be created and returned, possibly after asking the user for a template to use if there is more than one document template.

If wxDOC_SILENT is present, a new document will be created and the given file loaded into it, using the first template which fits the file format to read, either based on extension or on the iohandler of the template. See FindTemplateForPath().

If neither of these flags is present, the user will be presented with a file selector for the file to load, and the template to use will be determined by the extension (Windows) or by popping up a template choice list (other platforms).

When a new document is created and added to the document list the event ::wxEVT_POST_CREATE_DOCUMENT is sent to the a2dDocumentTemplate::GetViewConnector(). It depends on the type of a2dViewConnector what happens, e.g one could create an a2dView instance of the type chosen by the user from a list of a2dViewTemplates. The actual a2dView is created by calling the a2dViewTemplate::CreateView(). And this last sents the ::wxEVT_POST_CREATE_VIEW event to the a2dViewConnector. And that is the time to set the created view into a a2dDocumentViewWindow and maybe create frames and windows first followed by setting the new view to one of its windows. Another possibility is that the a2dViewConnector does not create new views, but instead of that uses existing views. The things happing in responds to ::wxEVT_POST_CREATE_DOCUMENT, is what makes this docview framework flexible. Replacing the a2dViewConnector is in general enough to swicth from on type of application (MDI SDI etc. ) to another.

If the maximum number of documents has been reached, this function will delete the oldest currently loaded document before creating a new one.

Parameters
pathpath to file in case of flags != wxDOC_NEW and flags == wxDOC_SILENT
documentflagsUse at will
wantedDocTemplateif given, only use this template to create new documents
dialogflagsif not a new document or creating silenet a document, this will be the flags towards the selection dialog
docTemplateFlagstemplate mask for document template, to filter shown templates.
Returns
a2dError

Definition at line 1197 of file doccom.cpp.

a2dView * a2dDocumentCommandProcessor::CreateView ( a2dDocument doc,
const wxString &  viewTypeName = wxT( "" ),
a2dDocumentFlagMask  flags = a2dREFDOC_NON,
a2dTemplateFlagMask  viewTemplateFlags = a2dTemplateFlag::VISIBLE 
)
virtual

Creates a new view for the given document.

If more than one view is allowed for the document (by virtue of multiple templates mentioning the same document type), a choice of view is presented to the user.

Parameters
docdocument for which to create a new view
viewTypeNameis not empty, this type of view will be searched in the available templates
flagsDocument flags
maskmask for views to show.

Definition at line 1550 of file doccom.cpp.

bool a2dDocumentCommandProcessor::Exit ( bool  force = true)

Called to Exit the application properly.

Set m_busyExit, and next calls CleanUp() and Clear( true ).

One normally exits the main event loop (and the application) by deleting the top window. In that case this function is called automatically. But in case of a script command this function makes sure the top window is closed.

Definition at line 479 of file doccom.cpp.

bool a2dDocumentCommandProcessor::FileExport ( const wxFileName &  file = wxFileName( wxT( "" ) ),
const wxString &  description = wxT( "" ),
a2dDocumentFlagMask  flags = a2dREFDOC_NON 
)

Calls a2dDocument::Export for the current document.

This to export a document to a file of the chosen type.

Parameters
filespecification for the file to export , no description means use file extension, if empty file path ask user.
descriptiondescription of a2dDocumentTemplate to use, if empty use filename ext to search template.
flagsfor way of export a2dREFDOC_SILENT for saving without filedialog

Definition at line 789 of file doccom.cpp.

void a2dDocumentCommandProcessor::FileHistoryUseMenu ( wxMenu *  menu)
virtual

Use this menu for appending recently-visited document filenames,.

for convenient access. Calling this function with a valid menu pointer enables the history list functionality.

Note that you can add multiple menus using this function, to be managed by the file history object.

Definition at line 1670 of file doccom.cpp.

bool a2dDocumentCommandProcessor::FileImport ( const wxFileName &  file = wxFileName( wxT( "" ) ),
const wxString &  description = wxT( "" ),
a2dDocumentFlagMask  flags = a2dREFDOC_NON 
)

Calls a2dDocument::Import for the current document.

This to import into the current document the data stored in a file.

Parameters
filespecification for the file to import , no description means use file extension, if empty file path ask user.
descriptiondescription of a2dDocumentTemplate to use, if empty use filename ext to search template.
flagsfor way of export a2dREFDOC_SILENT for saving without filedialog

Definition at line 900 of file doccom.cpp.

a2dError a2dDocumentCommandProcessor::FileOpen ( a2dDocumentPtr doc,
const wxFileName &  file = wxFileName( wxT( "" ) ),
a2dTemplateFlagMask  docTemplateFlags = a2dTemplateFlag::VISIBLE | a2dTemplateFlag::LOAD 
)

Creates a new document and reads in the selected file.

CreateDocument() is called with an empty string as path, and therefore a filedialog will be displayed, including the filters from templates, and you need to choose a file like that. If file is not empty, the file will silently be opened, using the right template based on file extension or template IoHandler.

Parameters
docreturns pointer to document in smart pointer.
filespecification for the file to load
docTemplateFlagsflags for templates, default visible templates.

Definition at line 553 of file doccom.cpp.

a2dError a2dDocumentCommandProcessor::FileOpenCheck ( a2dDocumentPtr doc,
const wxFileName &  file,
bool  checkModification 
)

Return existing document, or open it from file.

Check document list for this file. If it not in the list, it will open the file.

Parameters
docreturns pointer to document in smart pointer.
filespecification for the file to load
checkModificationcheck if file on disk is newer

Definition at line 612 of file doccom.cpp.

bool a2dDocumentCommandProcessor::FileRevert ( )

revert the current document to the non saved document on disk.

Currently call Revert() on current document.

Definition at line 724 of file doccom.cpp.

bool a2dDocumentCommandProcessor::FileSaveAs ( const wxFileName &  file = wxFileName( wxT( "" ) ),
a2dDocumentFlagMask  flags = a2dREFDOC_NON 
)

Calls wxDocument::SaveAs for the current document.

This to save a document to a file of the same type it was created with.

Parameters
filespecification for the file to saveas
flagsdocument flags e.g. a2dREFDOC_SILENT does not show dialog first.

Definition at line 766 of file doccom.cpp.

a2dError a2dDocumentCommandProcessor::FilesOpen ( const wxString &  openPath = wxT( "" ),
int  dialogFlags = wxFD_MULTIPLE | wxFD_OPEN,
a2dTemplateFlagMask  docTemplateFlags = a2dTemplateFlag::VISIBLE | a2dTemplateFlag::LOAD 
)

open one or more files using a file dialog

Parameters
openPathdefault path to open the file dialog in.
dialogFlagsflags for file dialog
docTemplateFlagsflags for templates, default visible templates.

Definition at line 697 of file doccom.cpp.

a2dDocumentTemplate * a2dDocumentCommandProcessor::FindTemplateForPath ( const a2dDocumentTemplateList docTemplates,
const wxString &  path,
a2dTemplateFlagMask  mask = a2dTemplateFlag::VISIBLE 
)
virtual

function used in CreateDocument() when a2dREFDOC_SILENT is used for creating it.

It iterates over the document templates, to find a template for the file that is to be loaded. To test each template it uses a2dDocumentTemplate::FileMatchesTemplate() The first matching template is returned. This is based on the file extension, or if not given on the input iohandler of a template, which can load the file.

Parameters
docTemplatesthe templates to test the filepath against.
pathinput filename to an existing file, for which we want to find a template
docTemplateFlagtemplate filter
Returns
The first matching template is returned.

Definition at line 1719 of file doccom.cpp.

a2dDocument * a2dDocumentCommandProcessor::GetCurrentDocument ( ) const

Get the current Document, which is the document that was last accessed from a view.

The current document is the document that is set when: -When a view is activated (has focus in case of a wxWindow), via SetActive() -Last document added, but which does not have a view yet, via AddDocument() -When set from the outside with SetCurrentDocument()

When a a2dView is deactivated, the current document is not modified until another view is activated. So you can still get to the document if the active view is deactivated. This happens for instance when a modeless dialog is activated.

The current document is used by a2dDocumentCommandProcessor to issue commands on the document its private commandprocessor. And only in very special cases you will need to set it yourself, normally it will be set to the view which has the focus.

Definition at line 1582 of file doccom.cpp.

a2dCommandProcessor * a2dDocumentCommandProcessor::GetCurrentDocumentCommandProcessor ( ) const

get the command processor of the current document.

When the current document is set and it has a commandprocessor, this will be returned.

Definition at line 1590 of file doccom.cpp.

void a2dDocumentCommandProcessor::Initialize ( )
virtual

Initializes data; currently just calls OnCreateFileHistory.

Some data cannot always be initialized in the constructor because the programmer must be given the opportunity to override functionality. If OnCreateFileHistory was called from the constructor, an overridden virtual OnCreateFileHistory would not be called due to C++'s 'interesting' constructor semantics.

Reimplemented from a2dCommandProcessor.

Definition at line 399 of file doccom.cpp.

wxString a2dDocumentCommandProcessor::MakeFrameTitle ( a2dDocument doc,
const wxString &  modifiedIndicator = wxT( "" ) 
)
virtual

Make a frame title (override this to do something different)

This method asks the document for its printable name and adds this and the application name to the returned string. If no document is given the returned string is the application name. The returned string will have a format like "Printable name - Application name"

Remarks
If you use the modified indicator you've to update the frame title (call this method again) if you save the document, otherwise the modified indicator will stay at your frame. You may want to catch the ::wxEVT_CHANGEDMODIFY_DOCUMENT event to update the frame title.
Parameters
docThe document to ask for the printable name or NULL
modifiedIndicatorIf set (i.e. a "*"), the indicator will be attached to the printable name if doc is modified

Definition at line 1612 of file doccom.cpp.

void a2dDocumentCommandProcessor::OnActivateView ( a2dViewEvent viewevent)
protected

Views do inform the document manager.

when a view is (in) activated ( the window containing the view is in or out of focus ) The default handler sets the active view for the document manager. The current active view, is set to the last view which did sent an activate event with value true. If the view sending the event is the current and the event value is false, the current view is set to NULL. The last view that was m_currentView until now, is set inactive from here by calling a2dView::Activate().

Definition at line 2286 of file doccom.cpp.

void a2dDocumentCommandProcessor::OnCannotOpenDocument ( a2dCommandEvent event)

default handler when a file could not be opened

The document is already created, and it depends on the document its a2dDocument::OnOpenDocument() how much of the wrong file is stored in it. When nothing is done, to store this document here in the command processor, it will automatically be released on return from this event. If you decide to display what has bin stored in the doc sofar, it can be done here.

The default implementation closes all views that were created on the document, delete its contents, and generates an error log.

Definition at line 1190 of file doccom.cpp.

void a2dDocumentCommandProcessor::OnExit ( )
virtual

Called by Exit()

Use e.g. to clean up modeless dialogs created from here.

It is common practice to create ( via commands to this class ) tool dialogs, color dialogs modeless, meaning without parent window. You can use this central command processor as owner of such dialogs, by just storing them in a derived commands processor. The trick is to destroy those dialogs when the application terminates. Implementing this can be done by overriding this function here.

Reimplemented in a2dCentralCanvasCommandProcessor, and a2dLuaCentralCommandProcessor.

Definition at line 395 of file doccom.cpp.

void a2dDocumentCommandProcessor::OnMenu ( wxCommandEvent &  event)

All menu's ( also using a2dMenuIdItem ) can be intercepted here.

Calling functions like a2dDocumentFrame::AddCmdMenu(), will generate a menu event in a2dDocumentFrame, but often the event is not handled there, but redirected to this command porcessor. The idea is that the menu triggers a certain action. In case of an action on a a2dDocument, often this is done by submitting a a2dCommand. That action can be undone, if implemented. Other actions, only call a member function. Having a central entry point for actions, instead of calling the function directly, makes it easy to get a notification when an action was issued. If you want to know about a menu/action that is taken, make a dynamic connect to this class for the menu id in question. Do Skip the event in your handler, in order to continue processing here.

Definition at line 293 of file doccom.cpp.

void a2dDocumentCommandProcessor::OnRemoveView ( a2dDocumentEvent viewevent)
protected

Views do inform the document manager when a view will be removed.

The default handler sets the m_lastView and/or m_currentView to NULL, if eqaul to the view removed.

Definition at line 2301 of file doccom.cpp.

bool a2dDocumentCommandProcessor::ProcessEvent ( wxEvent &  event)
virtual

process an event with a protection of repeated working in MDI by klion

Parameters
eventevent that is to be processed by a2dDocumentCommandProcessor.

Reimplemented from a2dObject.

Reimplemented in a2dCentralCanvasCommandProcessor.

Definition at line 2309 of file doccom.cpp.

void a2dDocumentCommandProcessor::ReleaseTemplate ( a2dDocumentTemplate temp,
long  flags = 0 
)

remove/release a template

Keep in mind that templates or reference counted and placed in smart pointer lists. So releasing it here, might keep it intact when placed/used somewhere else ( e.g. a2dViewConnector ).

Definition at line 1566 of file doccom.cpp.

void a2dDocumentCommandProcessor::RemoveDocument ( a2dDocument doc)

remove a document from the manager's list

The a2dCommandEvent of type ::wxEVT_REMOVE_DOCUMENT is sent, this can be used to do some action after a document is removed. (e.g remove from an overview window of all open documents)

Definition at line 2080 of file doccom.cpp.

a2dError a2dDocumentCommandProcessor::SelectDocumentPath ( const wxString &  title,
const a2dDocumentTemplateList docTemplates,
wxString &  path,
a2dDocumentFlagMask  flags,
wxArrayString *  selectedPaths,
a2dDocumentTemplate **  chosenTemplate,
int  dialogflags = wxFD_OPEN,
a2dTemplateFlagMask  docTemplateFlags = a2dTemplateFlag::VISIBLE,
const a2dDocumentTemplate preferedTemplate = NULL 
)
virtual

pops up a file selector with optional a list of filters

corresponding to the document templates to choose from.

Based on the list a2dDocumentTemplateList the list of file filters is setup. Next a file dialog is displayed, to select one or more file, depending on the dialogflags. In case of opening a file, it is checked for existence.

The file dialog opens in path, after that path is set to the directory from which the file(s) were selected.

Parameters
titletitle for the dialog
docTemplatesthe doctemplates which are used to present the file filters/types in the file dialog, and/or which are used to test the file chosen against.
pathinitial directory where the dialog should be opened, returns chosen directory.
flagsflags = a2dREFDOC_NON
selectedPathsthe files choosen are stored in here
chosenTemplateThe a2dDocumentTemplate corresponding to the selected file's extension/filter or its iohandler, is returned.
dialogflagsmay be a combination of wxFD_OPEN, wxFD_SAVE, wxFD_OVERWRITE_PROMPT, wxHIDE_READONLY, wxFD_FILE_MUST_EXIST.
docTemplateFlagsuse only templates matching this mask
preferedTemplatethe template to show in the file selection dialog as default.
Returns
a2dFileDialogReturn

This function is used in a2dDocumentCommandProcessor::CreateDocument() and other locations, to present a dialog for loading and saving a document according to document templates.

Definition at line 1759 of file doccom.cpp.

a2dDocumentTemplate * a2dDocumentCommandProcessor::SelectDocumentType ( bool  sort = false,
a2dTemplateFlagMask  docTemplateFlags = a2dTemplateFlag::VISIBLE 
)
virtual

Returns a document template by asking the user.

(if there is more than one template). This function is used in a2dDocumentCommandProcessor::CreateDocument.

Parameters
sortIf more than one template then this parameter indicates whether the list of templates that the user will have to choose from is sorted or not when shown the choice box dialog. Default is false.
docTemplateFlagtemplate filter

Definition at line 1870 of file doccom.cpp.

a2dViewTemplate * a2dDocumentCommandProcessor::SelectViewType ( a2dDocument doc,
const a2dViewTemplateList list,
const wxString &  viewTypeName = wxT( "" ),
bool  sort = false,
a2dTemplateFlagMask  viewTemplateFlags = a2dTemplateFlag::VISIBLE 
)
virtual

Returns a view template by asking the user.

(if there is more than one template), displaying a list of valid views.

This function is used in a2dDocumentCommandProcessor::CreateView. The dialog normally will not appear because the array of templates only contains those relevant to the document in question, and often there will only be one such.

a2dViewConnector::CreateView() also uses his function to present the templates a2dViewTemplate's associated with a a2dViewConnector, or if not to present all a2dViewTemplate from the a2dDocumentCommandProcessor itself.

\param doc the document to select a viewtype for.
\param list template list to choose  a view template from
\param viewTypeName the name of the view, if empty a list is presented, else a check is done
if the given name is indeed a view template.

\param sort If more than one template, then this parameter
indicates whether the list of templates that the user will have to choose from is
sorted or not when shown the choice box dialog. Default is false.
\param mask which view are allowed.

Definition at line 1949 of file doccom.cpp.

void a2dDocumentCommandProcessor::SetBusyExit ( bool  exitBusy)
inline

set this when you are exiting the application When this class is destructed, it is set automatically.

Definition at line 770 of file doccom.h.

void a2dDocumentCommandProcessor::SetCurrentDocument ( a2dDocument document)

set the current document, only needed in cases

where it was not set right already (rarely), and you need to have it set to be able to use a2dDocumentCommandProcessor to get to a document.

It also used internal, in order to sent the ::wxEVT_CHANGED_DOCUMENT event. This event can be intercepted by other classes, when they need to know this.

See Also
GetCurrentDocument()

Definition at line 2167 of file doccom.cpp.

void a2dDocumentCommandProcessor::SetCurrentView ( a2dView view)
virtual

To set the curent view.

In general you will get two events, first for the view that is deactivated, and next for the new active view. m_currentView is set to the last activated or deactivated view.

Parameters
viewif not NULL, the new active view is set to this view, else NULL.

Reimplemented in a2dCentralCanvasCommandProcessor.

Definition at line 2095 of file doccom.cpp.

void a2dDocumentCommandProcessor::SetMaxDocsOpen ( size_t  n)
inline

Sets the maximum number of documents that can be open at a time.

By default, this is 10,000. If you set it to 1, existing documents will be saved and deleted when the user tries to open or create a new one (similar to the behaviour of Windows Write, for example). Allowing multiple documents gives behaviour more akin to MS Word and other Multiple Document Interface applications.

Definition at line 720 of file doccom.h.


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