]> SALOME platform Git repositories - modules/gui.git/blob - src/SalomeApp/SalomeApp_Application.h
Salome HOME
Multi-study support removal: finalization
[modules/gui.git] / src / SalomeApp / SalomeApp_Application.h
1 // Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 // File:      SalomeApp_Application.h
24 // Created:   10/22/2004 3:37:25 PM
25 // Author:    Sergey LITONIN
26 //
27 #ifndef SALOMEAPP_APPLICATION_H
28 #define SALOMEAPP_APPLICATION_H
29
30 #if _MSC_VER > 1000
31 #pragma once
32 #endif // _MSC_VER > 1000
33
34 #include "SalomeApp.h"
35 #include <LightApp_Application.h>
36
37 #include <omniORB4/CORBA.h>
38
39 //#include <SALOMEconfig.h>
40 //#include CORBA_CLIENT_HEADER(SALOMEDS)
41 #include <SALOME_NamingService.hxx>
42
43 #include "SALOMEDSClient.hxx"
44
45 #include <QPointer>
46
47 class LightApp_Preferences;
48 class SalomeApp_Study;
49 #ifndef DISABLE_PYCONSOLE
50 class SalomeApp_NoteBook;
51 #endif
52 class SUIT_Desktop;
53 class SALOME_LifeCycleCORBA;
54
55
56 #ifdef WIN32
57 #pragma warning( disable:4251 )
58 #endif
59
60 /*!
61   \class SalomeApp_Application
62   \brief Application containing SalomeApp module or LightApp module
63 */
64
65 class SALOMEAPP_EXPORT SalomeApp_Application : public LightApp_Application
66 {
67   Q_OBJECT
68
69 public:
70   enum { MenuToolsId = 5 };
71   enum { DumpStudyId = LightApp_Application::UserID, LoadScriptId, PropertiesId,
72          CatalogGenId, RegDisplayId, SaveGUIStateId, ConnectId, DisconnectId,
73          SimanCheckInId, SimanLocalCheckInId,
74          UserID };
75
76   typedef enum { WT_NoteBook = LightApp_Application::WT_User,
77                  WT_User
78                } WindowTypes;
79
80 protected:
81   enum { OpenRefresh = LightApp_Application::OpenReload + 1 };
82   enum { CloseDisconnectSave = LightApp_Application::CloseDiscard + 1, CloseDisconnect };
83   enum { LoadStudyId = LightApp_Application::OpenStudyId + 1, NewAndScriptId };
84
85 public:
86   SalomeApp_Application();
87   virtual ~SalomeApp_Application();
88
89   virtual void                        updateObjectBrowser( const bool = true );
90
91   virtual QString                     getFileFilter() const;
92
93   virtual void                        start();
94
95   virtual void                        contextMenuPopup( const QString&, QMenu*, QString& );
96
97   virtual bool                        checkDataObject(LightApp_DataObject* theObj);
98   
99   virtual bool                        checkExistingDoc();
100
101   static CORBA::ORB_var               orb();
102   static SALOMEDSClient_StudyManager* studyMgr();
103   static SALOME_NamingService*        namingService();
104   static SALOME_LifeCycleCORBA*       lcc();
105
106   SUIT_ViewManager*                   newViewManager(const QString&);
107   void                                updateSavePointDataObjects( SalomeApp_Study* );
108
109   virtual bool                        isPossibleToClose( bool& );
110
111   virtual bool                        useStudy( const QString& );
112   virtual void                        updateDesktopTitle();
113
114 #ifndef DISABLE_PYCONSOLE
115   virtual void                        setNoteBook(SalomeApp_NoteBook* theNoteBook);
116   virtual SalomeApp_NoteBook*         getNoteBook() const;
117 #endif
118
119   virtual bool                        renameAllowed( const QString& ) const;
120   virtual bool                        renameObject( const QString&, const QString& );
121   
122 public slots:
123   virtual void                        onLoadDoc();
124   virtual void                        onNewWithScript();
125   virtual bool                        onLoadDoc( const QString& );
126   virtual void                        onUnloadDoc( bool ask = true);
127   virtual void                        onCloseDoc( bool ask = true);
128
129   virtual void                        onExit();
130   virtual void                        onCopy();
131   virtual void                        onPaste();
132   void                                onSaveGUIState();// called from VISU
133 #ifndef DISABLE_PYCONSOLE
134   void                                onUpdateStudy(); // called from NoteBook
135 #endif
136   bool                                onRestoreStudy( const QString& theDumpScript,
137                                                       const QString& theStudyName,
138                                                       bool theIsStudySaved );
139
140   virtual void                        onCheckIn();
141   virtual void                        onLocalCheckIn();
142
143 protected slots:
144   void                                onStudyCreated( SUIT_Study* );
145   void                                onStudyOpened( SUIT_Study* );
146   void                                onDesktopMessage( const QString& );
147   
148 protected:
149   virtual void                        createActions();
150   virtual SUIT_Study*                 createNewStudy();
151   virtual QWidget*                    createWindow( const int );
152
153   virtual void                        updateCommandsStatus();
154   virtual void                        onSelectionChanged();
155
156   virtual void                        createPreferences( LightApp_Preferences* );
157
158   virtual bool                        closeAction( const int, bool& );
159   virtual int                         closeChoice( const QString& );
160
161   virtual int                         openChoice( const QString& );
162   virtual bool                        openAction( const int, const QString& );
163
164   virtual QMap<int, QString>          activateModuleActions() const;
165   virtual void                        moduleActionSelected( const int );
166
167   void                                objectBrowserColumnsVisibility();
168
169 #ifndef DISABLE_PYCONSOLE
170   bool                                updateStudy();
171 #endif
172
173   virtual void                        afterCloseDoc();
174
175 private slots:
176   void                                onDeleteInvalidReferences();
177   void                                onDblClick( SUIT_DataObject* );
178   void                                onProperties();
179   void                                onDumpStudy();
180   void                                onLoadScript();
181
182   void                                onDeleteGUIState();
183   void                                onRestoreGUIState();
184
185   void                                onCatalogGen();
186   void                                onRegDisplay();
187   void                                onOpenWith();
188   void                                onExtAction();
189
190 private:
191   void                                createExtraActions();
192
193 private:
194 #ifndef DISABLE_PYCONSOLE
195   QPointer<SalomeApp_NoteBook>        myNoteBook;        // Notebook instance
196 #endif
197   QMap<QString, QAction*>             myExtActions;      // Map <AttributeUserID, QAction>
198   bool                                myIsSiman;         // application corresponds to the siman study flag
199   bool                                myIsCloseFromExit; // "Close from Exit" flag
200
201 signals:
202   void                                dumpedStudyClosed( const QString& theDumpScript, 
203                                                          const QString& theStudyName, 
204                                                          bool theIsStudySaved );
205   void                                notebookVarUpdated( QString theVarName );
206
207 };
208
209 #ifdef WIN32
210 #pragma warning( default:4251 )
211 #endif
212
213 #endif