1 // PARAVIS : ParaView wrapper SALOME module
3 // Copyright (C) 2010-2015 CEA/DEN, EDF R&D
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 // File : PVGUI_Module.h
22 // Author : Sergey ANIKIN, Adrien BRUNETON
26 #ifndef PVGUI_Module_H
27 #define PVGUI_Module_H
29 #include <SalomeApp_Module.h>
30 #include <SALOMEconfig.h>
31 #include CORBA_SERVER_HEADER(PVSERVER_Gen)
37 #include <pqVariableType.h>
45 class pqMainWindowCore;
46 class vtkEventQtSlotConnect;
47 class pqPythonScriptEditor;
48 class pqPVApplicationCore;
49 class pqDataRepresentation;
50 class pqRepresentation;
51 class PVViewer_GUIElements;
52 class PVViewer_EngineWrapper;
53 class SUIT_ViewWindow;
55 class PVGUI_Module : public SalomeApp_Module
104 CreateCustomFilterId,
105 ManageCustomFiltersId,
109 ManagePluginsExtensionsId,
112 RecordTestScreenshotId,
127 // Menu "Window" - "New Window"
130 // "Save state" ParaVis module root object popup
133 // "Add state" and "Reload state" popups
135 CleanAndAddStatePopupId,
137 // "Rename" and "Delete" popups (Object Browser)
146 virtual void initialize( CAM_Application* );
147 virtual void windows( QMap<int, int>& ) const;
149 virtual QString engineIOR() const; // to be removed when becoming Light
151 void openFile(const char* theName);
152 void executeScript(const char *script);
153 void saveParaviewState(const char* theFileName);
154 void loadParaviewState(const char* theFileName);
155 void clearParaviewState();
157 QString getTraceString();
160 void saveTrace(const char* theName);
162 pqServer* getActiveServer();
164 virtual void createPreferences();
166 virtual void contextMenuPopup(const QString& theClient, QMenu* theMenu, QString& theTitle);
168 inline static PVViewer_EngineWrapper * GetEngine();
169 inline static PVSERVER_ORB::PVSERVER_Gen_var GetCPPEngine(); // to be removed once light!
170 inline static pqPVApplicationCore * GetPVApplication();
172 virtual CAM_DataModel* createDataModel();
173 void fixAnimationScene();
176 //void onImportFromVisu(QString theEntry);
179 void deleteTemporaryFiles();
181 //! Create actions for ParaView GUI operations
182 void pvCreateActions();
184 //! Create menus for ParaView GUI operations duplicating menus in pqMainWindow ParaView class
185 void pvCreateMenus();
187 //! Create toolbars for ParaView GUI operations duplicating toolbars in pqMainWindow ParaView class
188 void pvCreateToolBars();
190 //! Create dock widgets for ParaView widgets
191 void setupDockWidgets();
193 //! Save states of dockable ParaView widgets
194 void saveDockWidgetsState( bool hideWidgets = true );
196 //! Restore states of dockable ParaView widgets
197 void restoreDockWidgetsState();
199 //! Shows or hides ParaView view window
200 void showView( bool );
202 //! Returns QMenu object for a given menu id
203 QMenu* getMenu( const int );
205 //! Discover help project files from the resources.
206 QString getHelpFileName();
208 //! Create actions for ParaViS
209 void createActions();
211 //! Create menus for ParaViS
214 //! Load selected state
215 void loadSelectedState(bool toClear);
217 //! Get list of embedded macros files
218 QStringList getEmbeddedMacrosList();
220 //! update macros state
223 //! store visibility of the common dockable windows (OB, PyConsole, ... etc.)
224 void storeCommonWindowsState();
226 //! restore visibility of the common dockable windows (OB, PyConsole, ... etc.)
227 void restoreCommonWindowsState();
231 void showHelpForProxy( const QString&, const QString& );
235 void endWaitCursor();
237 // void buildToolbarsMenu();
239 //void showParaViewHelp();
240 //void showHelp(const QString& url);
242 void onDataRepresentationUpdated();
244 void onStartProgress();
245 void onEndProgress();
247 void onRestartTrace();
249 // void onNewParaViewWindow();
251 void onSaveMultiState();
253 void onCleanAddState();
259 virtual bool activateModule( SUIT_Study* );
260 virtual bool deactivateModule( SUIT_Study* );
261 virtual void onApplicationClosed( SUIT_Application* );
262 virtual void studyClosed( SUIT_Study* );
265 virtual void onModelOpened();
266 virtual void onPushTraceTimer();
267 virtual void onInitTimer();
268 virtual void onViewManagerAdded( SUIT_ViewManager* );
269 virtual void onViewManagerRemoved( SUIT_ViewManager* );
270 virtual void onPVViewCreated( SUIT_ViewWindow* );
271 virtual void onPVViewDelete( SUIT_ViewWindow* );
274 int mySelectionControlsTb;
277 int myToolbarsMenuId;
281 typedef QMap<QWidget*, bool> WgMap;
284 WgMap myToolbarBreaks;
285 QList<QMenu*> myMenus;
287 typedef QMap<int, bool> DockWindowMap;
288 DockWindowMap myCommonMap;
290 QStringList myTemporaryFiles;
292 QtMsgHandler myOldMsgHandler;
294 vtkEventQtSlotConnect *VTKConnect;
296 pqPythonScriptEditor* myTraceWindow;
300 //! Single shot timer used to connect to the PVServer, and start the trace.
301 QTimer * myInitTimer;
303 //! Timer used to regularly push the Python trace to the engine.
304 QTimer * myPushTraceTimer;
306 PVViewer_GUIElements * myGuiElements;
308 static PVSERVER_ORB::PVSERVER_Gen_var MyEngine;
312 #endif // PVGUI_Module_H