Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SalomeApp_Application.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2016 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 
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 
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  UserID };
74 
77  } WindowTypes;
78 
79 protected:
80  enum { OpenRefresh = LightApp_Application::OpenReload + 1 };
81  enum { CloseDisconnectSave = LightApp_Application::CloseDiscard + 1, CloseDisconnect };
82  enum { LoadStudyId = LightApp_Application::OpenStudyId + 1, NewAndScriptId };
83 
84 public:
86  virtual ~SalomeApp_Application();
87 
88  virtual void updateObjectBrowser( const bool = true );
89 
90  virtual void start();
91 
92  virtual void contextMenuPopup( const QString&, QMenu*, QString& );
93 
94  virtual bool checkDataObject(LightApp_DataObject* theObj);
95 
96  virtual bool checkExistingDoc();
97 
98  static CORBA::ORB_var orb();
99  static SALOMEDSClient_StudyManager* studyMgr();
100  static SALOME_NamingService* namingService();
101  static SALOME_LifeCycleCORBA* lcc();
102 
103  SUIT_ViewManager* newViewManager(const QString&);
104  void updateSavePointDataObjects( SalomeApp_Study* );
105 
106  virtual bool isPossibleToClose( bool& );
107 
108  virtual bool useStudy( const QString& );
109  virtual void updateDesktopTitle();
110 
111 #ifndef DISABLE_PYCONSOLE
112  virtual void setNoteBook(SalomeApp_NoteBook* theNoteBook);
113  virtual SalomeApp_NoteBook* getNoteBook() const;
114 #endif
115 
116  virtual bool renameAllowed( const QString& ) const;
117  virtual bool renameObject( const QString&, const QString& );
118 
119 public slots:
120  virtual void onLoadDoc();
121  virtual void onNewWithScript();
122  virtual bool onLoadDoc( const QString& );
123  virtual void onUnloadDoc( bool ask = true);
124  virtual void onCloseDoc( bool ask = true);
125 
126  virtual void onExit();
127  virtual void onCopy();
128  virtual void onPaste();
129  void onSaveGUIState();// called from VISU
130 #ifndef DISABLE_PYCONSOLE
131  void onUpdateStudy(); // called from NoteBook
132 #endif
133  bool onRestoreStudy( const QString& theDumpScript,
134  const QString& theStudyName,
135  bool theIsStudySaved );
136 
137  virtual void onDockWindowVisibilityChanged( bool );
138 
139 protected slots:
140  void onStudyCreated( SUIT_Study* );
141  void onStudyOpened( SUIT_Study* );
142  void onDesktopMessage( const QString& );
143 
144 protected:
145  virtual void createActions();
146  virtual SUIT_Study* createNewStudy();
147  virtual QWidget* createWindow( const int );
148 
149  virtual void updateCommandsStatus();
150  virtual void onSelectionChanged();
151 
152  virtual void createPreferences( LightApp_Preferences* );
153 
154  virtual bool closeAction( const int, bool& );
155  virtual int closeChoice( const QString& );
156 
157  virtual int openChoice( const QString& );
158  virtual bool openAction( const int, const QString& );
159 
160  virtual QMap<int, QString> activateModuleActions() const;
161  virtual void moduleActionSelected( const int );
162 
163  void objectBrowserColumnsVisibility();
164 
165 #ifndef DISABLE_PYCONSOLE
166  bool updateStudy();
167  virtual PyConsole_Interp* createPyInterp();
168 #endif
169 
170  virtual void afterCloseDoc();
171 
172 private slots:
173  void onDeleteInvalidReferences();
174  void onDblClick( SUIT_DataObject* );
175  void onProperties();
176  void onDumpStudy();
177  void onLoadScript();
178 
179  void onDeleteGUIState();
180  void onRestoreGUIState();
181 
182  void onCatalogGen();
183  void onRegDisplay();
184  void onOpenWith();
185  void onExtAction();
186 
187 private:
188  void createExtraActions();
189 
190 private:
191 #ifndef DISABLE_PYCONSOLE
192  QPointer<SalomeApp_NoteBook> myNoteBook; // Notebook instance
193 #endif
194  QMap<QString, QAction*> myExtActions; // Map <AttributeUserID, QAction>
195  bool myIsCloseFromExit; // "Close from Exit" flag
196 
197 signals:
198  void dumpedStudyClosed( const QString& theDumpScript,
199  const QString& theStudyName,
200  bool theIsStudySaved );
201  void notebookVarUpdated( QString theVarName );
202  void objectDoubleClicked( SUIT_DataObject* );
203 };
204 
205 #ifdef WIN32
206 #pragma warning( default:4251 )
207 #endif
208 
209 #endif