1 // Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // File: SalomeApp_Application.h
24 // Created: 10/22/2004 3:37:25 PM
25 // Author: Sergey LITONIN
27 #ifndef SALOMEAPP_APPLICATION_H
28 #define SALOMEAPP_APPLICATION_H
32 #endif // _MSC_VER > 1000
34 #include "SalomeApp.h"
35 #include <LightApp_Application.h>
37 #include <omniORB4/CORBA.h>
39 //#include <SALOMEconfig.h>
40 //#include CORBA_CLIENT_HEADER(SALOMEDS)
41 #include <SALOME_NamingService.hxx>
43 #include "SALOMEDSClient.hxx"
47 class LightApp_Preferences;
48 class SalomeApp_Study;
49 #ifndef DISABLE_PYCONSOLE
50 class SalomeApp_NoteBook;
53 class SALOME_LifeCycleCORBA;
57 #pragma warning( disable:4251 )
61 \class SalomeApp_Application
62 \brief Application containing SalomeApp module or LightApp module
65 class SALOMEAPP_EXPORT SalomeApp_Application : public LightApp_Application
70 enum { MenuToolsId = 5 };
71 enum { DumpStudyId = LightApp_Application::UserID, LoadScriptId, PropertiesId,
72 CatalogGenId, RegDisplayId, SaveGUIStateId, ConnectId, DisconnectId,
75 typedef enum { WT_NoteBook = LightApp_Application::WT_User,
80 enum { OpenRefresh = LightApp_Application::OpenReload + 1 };
81 enum { CloseDisconnectSave = LightApp_Application::CloseDiscard + 1, CloseDisconnect };
82 enum { LoadStudyId = LightApp_Application::OpenStudyId + 1, NewAndScriptId };
85 SalomeApp_Application();
86 virtual ~SalomeApp_Application();
88 virtual void updateObjectBrowser( const bool = true );
92 virtual void contextMenuPopup( const QString&, QMenu*, QString& );
94 virtual bool checkDataObject(LightApp_DataObject* theObj);
96 virtual bool checkExistingDoc();
98 static CORBA::ORB_var orb();
99 static _PTR(Study) getStudy();
100 static SALOME_NamingService* namingService();
101 static SALOME_LifeCycleCORBA* lcc();
103 SUIT_ViewManager* newViewManager(const QString&);
104 void updateSavePointDataObjects( SalomeApp_Study* );
106 virtual bool isPossibleToClose( bool& );
108 virtual bool useStudy( const QString& );
109 virtual void updateDesktopTitle();
111 #ifndef DISABLE_PYCONSOLE
112 virtual void setNoteBook(SalomeApp_NoteBook* theNoteBook);
113 virtual SalomeApp_NoteBook* getNoteBook() const;
116 virtual bool renameAllowed( const QString& ) const;
117 virtual bool renameObject( const QString&, const QString& );
120 virtual void onNewDoc();
121 virtual void onLoadDoc();
122 virtual void onNewWithScript();
123 virtual bool onLoadDoc( const QString& );
124 virtual void onUnloadDoc( bool ask = true);
125 virtual void onCloseDoc( bool ask = true);
126 virtual void onOpenDoc();
127 virtual bool onOpenDoc( const QString& );
128 virtual bool onReopenDoc();
130 virtual void onExit();
131 virtual void onCopy();
132 virtual void onPaste();
133 void onSaveGUIState();// called from VISU
134 #ifndef DISABLE_PYCONSOLE
135 void onUpdateStudy(); // called from NoteBook
137 bool onRestoreStudy( const QString& theDumpScript,
138 const QString& theStudyName,
139 bool theIsStudySaved );
141 virtual void onDockWindowVisibilityChanged( bool );
144 void onStudyCreated( SUIT_Study* );
145 void onStudyOpened( SUIT_Study* );
146 void onDesktopMessage( const QString& );
148 virtual void onModuleActivation( const QString& );
151 virtual void createActions();
152 virtual SUIT_Study* createNewStudy();
153 virtual QWidget* createWindow( const int );
155 virtual void updateCommandsStatus();
156 virtual void onSelectionChanged();
158 virtual void createPreferences( LightApp_Preferences* );
160 virtual bool closeAction( const int, bool& );
161 virtual int closeChoice( const QString& );
163 virtual int openChoice( const QString& );
164 virtual bool openAction( const int, const QString& );
166 virtual QMap<int, QString> activateModuleActions() const;
167 virtual void moduleActionSelected( const int );
169 void objectBrowserColumnsVisibility();
171 #ifndef DISABLE_PYCONSOLE
173 virtual PyConsole_Interp* createPyInterp();
176 virtual void afterCloseDoc();
179 void onDeleteInvalidReferences();
180 void onDblClick( SUIT_DataObject* );
185 void onDeleteGUIState();
186 void onRestoreGUIState();
194 void createExtraActions();
197 #ifndef DISABLE_PYCONSOLE
198 QPointer<SalomeApp_NoteBook> myNoteBook; // Notebook instance
200 QMap<QString, QAction*> myExtActions; // Map <AttributeUserID, QAction>
201 bool myIsCloseFromExit; // "Close from Exit" flag
203 bool myToIgnoreMessages;// to ignore messages from SALOMEDS
206 void dumpedStudyClosed( const QString& theDumpScript,
207 const QString& theStudyName,
208 bool theIsStudySaved );
209 void notebookVarUpdated( QString theVarName );
210 void objectDoubleClicked( SUIT_DataObject* );
214 #pragma warning( default:4251 )