X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSalomeApp%2FSalomeApp_Application.h;h=5a78e279ee3f6951017cf42827bf596cd388d455;hb=f2376a3d416ad43c5ad000a92deb0801f71ff4c4;hp=94ed79b40cb78adb0b8fde5aae74177045b511ad;hpb=765ec41de79da279a808efa0756582b52b3a89c2;p=modules%2Fgui.git diff --git a/src/SalomeApp/SalomeApp_Application.h b/src/SalomeApp/SalomeApp_Application.h index 94ed79b40..5a78e279e 100644 --- a/src/SalomeApp/SalomeApp_Application.h +++ b/src/SalomeApp/SalomeApp_Application.h @@ -1,8 +1,29 @@ +// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + // File: SalomeApp_Application.h // Created: 10/22/2004 3:37:25 PM // Author: Sergey LITONIN -// Copyright (C) CEA 2004 - +// #ifndef SALOMEAPP_APPLICATION_H #define SALOMEAPP_APPLICATION_H @@ -11,200 +32,191 @@ #endif // _MSC_VER > 1000 #include "SalomeApp.h" -#include +#include -#include +#include -#include +//#include //#include CORBA_CLIENT_HEADER(SALOMEDS) #include #include "SALOMEDSClient.hxx" -class QAction; -class QComboBox; -class QDockWindow; +#include -class LogWindow; -class OB_Browser; -class PythonConsole; -class SalomeApp_Module; -class SalomeApp_Preferences; -class SalomeApp_SelectionMgr; -class SalomeApp_WidgetContainer; +#include +class LightApp_Preferences; +class SalomeApp_Study; +#ifndef DISABLE_PYCONSOLE +class SalomeApp_NoteBook; +#endif +class SUIT_Desktop; class SALOME_LifeCycleCORBA; + #ifdef WIN32 #pragma warning( disable:4251 ) #endif -/* - Class : SalomeApp_Application - Description : Application containing SalomeApp module +/*! + \class SalomeApp_Application + \brief Application containing SalomeApp module or LightApp module */ -class SALOMEAPP_EXPORT SalomeApp_Application : public CAM_Application +class SALOMEAPPIMPL_EXPORT SalomeApp_Application : public LightApp_Application { Q_OBJECT public: - typedef enum { WT_ObjectBrowser, WT_PyConsole, WT_LogWindow, WT_User } WindowTypes; + enum { MenuToolsId = 5 }; + enum { DumpStudyId = LightApp_Application::UserID, LoadScriptId, PropertiesId, + CatalogGenId, RegDisplayId, FindActionId, SaveGUIStateId, ConnectId, DisconnectId, + UserID }; - enum { ModulesListId = STD_Application::UserID, NewGLViewId, - NewPlot2dId, NewOCCViewId, NewVTKViewId, DumpStudyId, - LoadScriptId,PropertiesId, PreferencesId, MRUId, UserID }; + typedef enum { WT_NoteBook = LightApp_Application::WT_User, + WT_User + } WindowTypes; + +protected: + enum { OpenRefresh = LightApp_Application::OpenReload + 1 }; + enum { CloseDisconnectSave = LightApp_Application::CloseDiscard + 1, CloseDisconnect }; + enum { LoadStudyId = LightApp_Application::OpenStudyId + 1, NewAndScriptId }; public: - SalomeApp_Application(); + SalomeApp_Application(SALOME_NamingService_Abstract *ns = nullptr); virtual ~SalomeApp_Application(); - - virtual QString applicationName() const; - virtual QString applicationVersion() const; - - virtual CAM_Module* loadModule( const QString& ); - virtual bool activateModule( const QString& ); - - virtual bool useStudy( const QString& ); - - SalomeApp_SelectionMgr* selectionMgr() const; - - LogWindow* logWindow(); - OB_Browser* objectBrowser(); - PythonConsole* pythonConsole(); virtual void updateObjectBrowser( const bool = true ); - SalomeApp_Preferences* preferences() const; - - virtual QString getFileFilter() const; - virtual QString getFileName( bool open, const QString& initial, const QString& filters, - const QString& caption, QWidget* parent ); - virtual QString getDirectory( const QString& initial, const QString& caption, QWidget* parent ); - virtual QStringList getOpenFileNames( const QString& initial, const QString& filters, - const QString& caption, QWidget* parent ); - - SUIT_ViewManager* getViewManager( const QString&, const bool ); + virtual void start(); - void updateActions(); + virtual void contextMenuPopup( const QString&, QMenu*, QString& ); - QWidget* getWindow( const int, const int = -1 ); + virtual bool checkDataObject(LightApp_DataObject* theObj); - QWidget* window( const int, const int = -1 ) const; - void addWindow( QWidget*, const int, const int = -1 ); - void removeWindow( const int, const int = -1 ); + virtual bool checkExistingDoc(); - bool isWindowVisible( const int ) const; - void setWindowShown( const int, const bool ); + static CORBA::ORB_var orb(); + static _PTR(Study) getStudy(); + static SALOME_NamingService_Abstract* namingService(); + static SALOME_LifeCycleCORBA* lcc(); - virtual void start(); + SUIT_ViewManager* newViewManager(const QString&); + void updateSavePointDataObjects( SalomeApp_Study* ); - virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& ); + virtual bool isPossibleToClose( bool& ); - virtual void createEmptyStudy(); + virtual bool useStudy( const QString& ); + virtual void updateDesktopTitle(); - static CORBA::ORB_var orb(); - static SALOMEDSClient_StudyManager* studyMgr(); - static SALOME_NamingService* namingService(); - static SALOME_LifeCycleCORBA* lcc(); - static QString defaultEngineIOR(); +#ifndef DISABLE_PYCONSOLE + virtual void setNoteBook(SalomeApp_NoteBook* theNoteBook); + virtual SalomeApp_NoteBook* getNoteBook() const; +#endif -signals: - void studyOpened(); - void studySaved(); - void studyClosed(); + virtual bool renameAllowed( const QString& ) const; + virtual bool renameObject( const QString&, const QString& ); public slots: virtual void onNewDoc(); - virtual void onOpenDoc(); - virtual void onHelpAbout(); - virtual bool onOpenDoc( const QString& ); virtual void onLoadDoc(); + virtual void onNewWithScript(); virtual bool onLoadDoc( const QString& ); + virtual void onUnloadDoc( bool ask = true); + virtual void onCloseDoc( bool ask = true); + virtual void onOpenDoc(); + virtual bool onOpenDoc( const QString& ); + virtual bool onReopenDoc(); + + virtual void onExit(); virtual void onCopy(); - virtual void onPaste(); - -private slots: - void onSelection(); - void onRefresh(); + virtual void onPaste(); + void onSaveGUIState();// called from VISU +#ifndef DISABLE_PYCONSOLE + void onUpdateStudy(); // called from NoteBook +#endif + bool onRestoreStudy( const QString& theDumpScript, + const QString& theStudyName, + bool theIsStudySaved ); + + virtual void onDockWindowVisibilityChanged( bool ); + +protected slots: + void onStudyCreated( SUIT_Study* ); + void onStudyOpened( SUIT_Study* ); + void onDesktopMessage( const QString& ); + + virtual void onModuleActivation( const QString& ); protected: virtual void createActions(); virtual SUIT_Study* createNewStudy(); virtual QWidget* createWindow( const int ); - virtual void defaultWindows( QMap& ) const; - virtual void defaultViewManagers( QStringList& ) const; - - virtual void setActiveStudy( SUIT_Study* ); virtual void updateCommandsStatus(); - virtual void onSelectionChanged(); - virtual void beforeCloseDoc( SUIT_Study* ); - virtual void afterCloseDoc(); + virtual void createPreferences( LightApp_Preferences* ); - virtual void moduleAdded( CAM_Module* ); - virtual bool activateModule( CAM_Module* = 0 ); + virtual bool closeAction( const int, bool& ); + virtual int closeChoice( const QString& ); - SalomeApp_Preferences* preferences( const bool ) const; + virtual int openChoice( const QString& ); + virtual bool openAction( const int, const QString& ); - virtual void createPreferences( SalomeApp_Preferences* ); - virtual void preferencesChanged( const QString&, const QString& ); - virtual void updateDesktopTitle(); + virtual QMap activateModuleActions() const; + virtual void moduleActionSelected( const int ); -protected slots: - virtual void onDesktopActivated(); + void objectBrowserColumnsVisibility(); -private slots: - void onNewWindow(); - void onModuleActivation( QAction* ); - void onCloseView( SUIT_ViewManager* ); +#ifndef DISABLE_PYCONSOLE + bool updateStudy(); + virtual PyConsole_Interp* createPyInterp(); +#endif - void onStudyCreated( SUIT_Study* ); - void onStudyOpened( SUIT_Study* ); - void onStudySaved( SUIT_Study* ); - void onStudyClosed( SUIT_Study* ); - + virtual bool canOpenDoc( const QString& ); + virtual void afterCloseDoc(); + + virtual void addCatalogue( const QString&, const QString& ); + +private slots: + void onDeleteInvalidReferences(); + void onDblClick( SUIT_DataObject* ); void onProperties(); void onDumpStudy(); - void onLoadScript(); + void onLoadScript(); - void onPreferences(); - void onMRUActivated( QString ); + void onDeleteGUIState(); + void onRestoreGUIState(); - void onPreferenceChanged( QString&, QString&, QString& ); + void onCatalogGen(); + void onRegDisplay(); + void onFindAction(); void onOpenWith(); + void onExtAction(); private: - void updateWindows(); - void updateViewManagers(); - void updateModuleActions(); - - void loadWindowsGeometry(); - void saveWindowsGeometry(); - - void updatePreference( const QString&, const QString&, const QString& ); - - QString defaultModule() const; - void currentWindows( QMap& ) const; - void currentViewManagers( QStringList& ) const; - SUIT_ViewManager* createViewManager( const QString& vmType ); - void moduleIconNames( QMap& ) const; - - void activateWindows(); + void createExtraActions(); + void ensureShaperIsActivated(); private: - typedef QMap ActionMap; - typedef QMap WindowMap; +#ifndef DISABLE_PYCONSOLE + QPointer myNoteBook; // Notebook instance +#endif + QMap myExtActions; // Map + bool myIsCloseFromExit; // "Close from Exit" flag -private: - SalomeApp_Preferences* myPrefs; - SalomeApp_SelectionMgr* mySelMgr; - ActionMap myActions; - WindowMap myWindows; + bool myToIgnoreMessages;// to ignore messages from SALOMEDS - static SalomeApp_Preferences* _prefs_; +signals: + void dumpedStudyClosed( const QString& theDumpScript, + const QString& theStudyName, + bool theIsStudySaved ); + void notebookVarUpdated( QString theVarName ); + void objectDoubleClicked( SUIT_DataObject* ); +protected: + static std::unique_ptr _ns; }; #ifdef WIN32