Go to the documentation of this file.
8 namespace Core {
class Command; }
17 class CoreApplicationP;
39 return ((this->Why == m.
Why) && (this->Doc == m.
Doc) && (this->CreateGui == m.
CreateGui) &&
45 bool SetAsActiveDocument =
true;
102 bool createGui =
true,
103 bool setAsActiveDocument =
true,
104 bool createDefaultObjects =
true);
110 bool createGui =
true,
111 bool savepath =
true,
112 bool setAsActiveDocument =
true);
141 #ifndef LXAPI // INTERFACES BELOW ARE -NOT- PART OF THE LEXOCAD API
191 bool onClose(
bool forceClose,
bool dontNotify,
bool& hardClose);
279 static void cleanOldTempDirectories();
284 CoreApplicationP* _pimpl =
nullptr;
287 std::set<CA_CommandObserver*> _commandObserverRegistry;
288 std::set<CA_TransactionObserver*> _transactionObserverRegistry;
292 std::function<
Core::Command*(
const std::string&)> _createCommand;
296 std::string _activeTransactionName =
"";
297 int _activeTransactionID = 0;
298 int _activeTransactionGuard = 0;
299 bool _activeTransactionTmpName =
false;
Definition: CA_CommandObserver.h:56
Base::String getTmpDirectory(Core::CoreDocument *doc)
Gets the TempDir of the specified document. If doc = 0 takes the active document.
bool runPythonScript(const Base::String &scr, Base::String &err) const
Core::CoreDocument * openDocument(const std::string &typeName, const Base::String &path=Base::String(), bool createGui=true, bool savepath=true, bool setAsActiveDocument=true)
Opens a document. If no path is provided and the application has a Gui the user is prompted with a fi...
void notifyDocumentOpened(Core::CoreDocument *doc)
void initPython() const
Initialize the Python interpreter (if not already initialized). Call it before using any other Python...
bool operator==(const AppChanges &m) const
Definition: CoreApplication.h:37
bool closeDocument(Core::CoreDocument *doc)
Closes the document. Returns 'true' if successful, 'false' if canceled.
Definition: CoreDocument.h:269
void notifyDocumentClosed(Core::CoreDocument *doc)
void setCreateCommandFunction(std::function< Core::Command *(const std::string &)> f)
Definition: CoreApplication.h:229
void notifyPropertyCreate(Core::CoreDocument *doc, Core::DocObject *obj, Core::Property *pro)
void notifyDocumentSaved(Core::CoreDocument *doc)
void unref(void)
Decrements the reference count by one.
void notifyApp(Core::CoreDocument *doc, AppChanges::why why, bool createGui, bool setAsActiveDocument=true)
void notifyDocumentSetActive(Core::CoreDocument *doc)
static std::string getBuildDateTime()
int getOpenDocuments(std::vector< Core::CoreDocument * > &vec)
virtual ~PartAcis(void)
Definition: CoreApplication.h:63
basic_observer< entity > observer
Alias declaration for the most common use case.
Definition: entt.hpp:3793
void ref(void)
Increments the reference count by one.
bool closeApplication(bool forceClose, bool dontNotify, bool &hardClose)
std::map< Base::String, Core::CoreDocument * > _documentMap
Map of all documents.
Definition: CoreApplication.h:276
Definition: CoreApplication.h:60
virtual Core::DocObject * create_PartGeometry(Core::CoreDocument *doc, const std::string &type)=0
bool isDocumentValid(Core::CoreDocument *testedDocument) const
static void destroy()
Deletes the Singleton.
virtual ~LoadedDll(void)
Definition: CoreApplication.h:53
void notifyDocumentRenamed(Core::CoreDocument *doc)
enum Core::AppChanges::why Why
void setCommandFactory(Core::CommandFactory *commandFactory)
Definition: CoreApplication.h:224
void notifyObject(Core::CoreDocument *doc, Core::DocObject *obj, Core::Property *pro, CA_Transaction::why transaction)
Core::CoreDocument * getActiveDocument() const
Returns the active document. Returns Null if there is no active document.
bool registerCommandObserver(CA_CommandObserver *observer)
Register an Observer for Commands.
static int getDocumentVersionAsInteger()
Base::String getUniqueDocumentName(const Base::String &s) const
Base::String getApplicationName() const
Returns the name of the application.
why
Definition: CoreApplication.h:31
void notifyObjectHasError(Core::CoreDocument *doc, Core::DocObject *obj)
static long getRefCount()
Returns the reference count of the Application.
static unsigned int getVersionYear()
void closeActiveTransaction(bool abort=false, int id=0)
bool runPythonString(const Base::String &str) const
Core::CoreDocument * Doc
Definition: CoreApplication.h:43
Definition: DocObject.h:54
Definition: CoreApplication.h:28
const char * getActiveTransaction(int *tid=nullptr) const
Return the current active transaction name and ID.
void setApplicationName(const Base::String &name)
Sets the application name.
CA_TransactionObserver_Vector getTransactionObservers()
virtual Base::String getInfo()=0
bool unregisterCommandObserver(CA_CommandObserver *observer)
Unregister an Observer for Commands.
void notifyDocumentChanged(Core::CoreDocument *doc, Core::Property *pro)
CoreApplication(int argc, char **argv)
bool runPythonString(const Base::String &str, Base::String &err) const
LoadedDll(void)
Definition: CoreApplication.h:52
why
Definition: CA_CommandObserver.h:22
bool SetAsActiveDocument
Definition: CoreApplication.h:45
void notifyDocumentDeleted(Core::CoreDocument *doc)
virtual Base::String getInfo()=0
static CoreApplication * instance(void)
Returns the Singleton.
void notifyPropertyChanged(Core::CoreDocument *doc, Core::DocObject *obj, Core::Property *pro)
virtual const char * subject_name(void)
Definition: CoreApplication.h:231
void deleteDocument(Core::CoreDocument *doc)
Physically deletes a document. The maps are not effected.
Definition: CoreApplication.h:50
Definition: CoreApplication.h:71
void notifyPropertyDeleted(Core::CoreDocument *doc, Core::DocObject *obj, Core::Property *pro)
ca_CommandObserver_Vector getCommandObserver()
Returns a List of CA_CommandObserver.
void setModulePreferenceValue(const std::string &moduleName, const std::string &key, const std::string &value)
Sets a persistent preference key and value for a module. On Windows the key and value are stored in t...
static std::string getDocumentVersion()
Definition: CA_CommandObserver.h:68
LoadedDll * loadDllByName(const Base::String &name)
std::vector< CA_CommandObserver * > ca_CommandObserver_Vector
Definition: CoreApplication.h:11
void finalizePython() const
void notifyRecomputeFailed(Core::CoreDocument *doc)
void notifyCmdObservers(Core::CoreDocument *doc, bool createGui)
int setActiveTransaction(const char *name, bool persist=false)
void notifyObjectDeleted(Core::CoreDocument *doc, Core::DocObject *obj)
void notifyDocumentCreated(Core::CoreDocument *doc)
bool closeDocument(Core::CoreDocument *doc, bool forceClose, bool dontNotify=false)
Closes a document.
Core::CommandFactory * getCommandFactory() const
Definition: CoreApplication.h:225
Core::Command * createCommand(const std::string &commandName)
Definition: CoreApplication.h:228
Core::CoreDocument * getDocumentByName(const Base::String &name)
Returns the document by name.
Core::CoreDocument * _newDocument(const std::string &typeName, const Base::String &name, bool createGui)
void closeApplication()
Closes the application.
std::vector< CA_TransactionObserver * > CA_TransactionObserver_Vector
Definition: CoreApplication.h:12
Definition: Property.h:72
Core::CoreDocument * newCoreDocument(const std::string &typeName, const Base::String &name=Base::String())
Creates a new document without Gui. The new document becomes NOT the active document....
PartAcis(void)
Definition: CoreApplication.h:62
Helper class to manager transaction (i.e. undo/redo)
Definition: AutoTransaction.h:50
void notifyRecomputeSuccess(Core::CoreDocument *doc)
@ NewDocument
Definition: CoreApplication.h:32
bool onClose(bool forceClose, bool dontNotify, bool &hardClose)
Gets the version number of the application.
A Utf-16 (windows) or ucs4 (unix) encoded string class.
Definition: String.h:18
void notifyDocumentFinishedRead(Core::CoreDocument *doc)
static void reset()
Resets the Singleton.
std::vector< Core::CoreDocument * > getDocuments() const
get a list of all documents in the application
std::vector< CA_TransactionObserver * > CA_TransactionObserver_Vector
Definition: CA_CommandObserver.h:102
void notifyObjectAdded(Core::CoreDocument *doc, Core::DocObject *obj)
SetActiveDocument
Definition: Globals.h:43
bool runPythonScript(const Base::String &scr) const
Core::CoreDocument * openCoreDocument(const std::string &typeName, const Base::String &path)
Opens a document without Gui. The document path is not saved. The new document becomes NOT the active...
Base::String getApplicationPath() const
Get the Application-Path.
void notifyObjectCreated(Core::CoreDocument *doc, Core::DocObject *obj)
bool remove_TransactionObserver(CA_TransactionObserver *observer)
Core::CoreDocument * newDocument(const std::string &typeName, const Base::String &name=Base::String(), bool createGui=true, bool setAsActiveDocument=true, bool createDefaultObjects=true)
bool setActiveDocument(Core::CoreDocument *doc)
Sets the active document.
std::vector< CA_CommandObserver * > ca_CommandObserver_Vector
Definition: CA_CommandObserver.h:101
bool CreateGui
Definition: CoreApplication.h:44
@ CloseDocument
Definition: CoreApplication.h:33
bool add_TransactionObserver(CA_TransactionObserver *observer)
void notifyObjectChanged(Core::CoreDocument *doc, Core::DocObject *obj, Core::Property *pro)
std::string getModulePreferenceValue(const std::string &moduleName, const std::string &key)
Returns the persistent value of a preference key for a module. Returns empty string if key or module ...