1 // PARAVIS : ParaView wrapper SALOME module
3 // Copyright (C) 2010-2014 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
26 #ifndef PVGUI_Module_H
27 #define PVGUI_Module_H
29 #include <SalomeApp_Module.h>
30 #include "SALOMEconfig.h"
31 #include CORBA_SERVER_HEADER(SALOMEDS)
32 #ifndef PARAVIS_WITH_FULL_CORBA
33 # include CORBA_SERVER_HEADER(PARAVIS_Gen)
40 #include <pqVariableType.h>
48 class pqMainWindowCore;
49 class vtkEventQtSlotConnect;
50 class pqPythonScriptEditor;
51 class pqPVApplicationCore;
52 class pqDataRepresentation;
53 class pqRepresentation;
54 class PVViewer_GUIElements;
56 class PVGUI_Module : public SalomeApp_Module
105 CreateCustomFilterId,
106 ManageCustomFiltersId,
110 ManagePluginsExtensionsId,
113 RecordTestScreenshotId,
128 // Menu "Window" - "New Window"
131 // "Save state" ParaVis module root object popup
134 // "Add state" and "Reload state" popups
136 CleanAndAddStatePopupId,
138 // "Rename" and "Delete" popups (Object Browser)
147 virtual void initialize( CAM_Application* );
148 virtual void windows( QMap<int, int>& ) const;
150 virtual QString engineIOR() const;
152 void openFile(const char* theName);
153 void executeScript(const char *script);
154 void saveParaviewState(const char* theFileName);
155 void loadParaviewState(const char* theFileName);
156 void clearParaviewState();
158 QString getTraceString();
161 void saveTrace(const char* theName);
163 pqServer* getActiveServer();
165 virtual void createPreferences();
167 virtual void contextMenuPopup(const QString& theClient, QMenu* theMenu, QString& theTitle);
169 inline static PARAVIS_ORB::PARAVIS_Gen_var GetEngine();
170 inline static pqPVApplicationCore * GetPVApplication();
173 //void onImportFromVisu(QString theEntry);
176 void deleteTemporaryFiles();
178 //! Create actions for ParaView GUI operations
179 void pvCreateActions();
181 //! Create menus for ParaView GUI operations duplicating menus in pqMainWindow ParaView class
182 void pvCreateMenus();
184 //! Create toolbars for ParaView GUI operations duplicating toolbars in pqMainWindow ParaView class
185 void pvCreateToolBars();
187 //! Create dock widgets for ParaView widgets
188 void setupDockWidgets();
190 //! Save states of dockable ParaView widgets
191 void saveDockWidgetsState();
193 //! Restore states of dockable ParaView widgets
194 void restoreDockWidgetsState();
196 //! Shows or hides ParaView view window
197 void showView( bool );
199 //! Returns QMenu object for a given menu id
200 QMenu* getMenu( const int );
202 //! Discover help project files from the resources.
203 QString getHelpFileName();
205 //! Create actions for ParaViS
206 void createActions();
208 //! Create menus for ParaViS
211 //! Load selected state
212 void loadSelectedState(bool toClear);
214 //! Get list of embedded macros files
215 QStringList getEmbeddedMacrosList();
217 //! update macros state
220 //! store visibility of the common dockable windows (OB, PyConsole, ... etc.)
221 void storeCommonWindowsState();
223 //! restore visibility of the common dockable windows (OB, PyConsole, ... etc.)
224 void restoreCommonWindowsState();
228 void showHelpForProxy( const QString&, const QString& );
232 void endWaitCursor();
234 // void buildToolbarsMenu();
236 //void showParaViewHelp();
237 //void showHelp(const QString& url);
239 void onDataRepresentationUpdated();
241 void onStartProgress();
242 void onEndProgress();
244 void onRestartTrace();
246 void onNewParaViewWindow();
248 void onSaveMultiState();
250 void onCleanAddState();
256 virtual bool activateModule( SUIT_Study* );
257 virtual bool deactivateModule( SUIT_Study* );
258 virtual void onApplicationClosed( SUIT_Application* );
259 virtual void studyClosed( SUIT_Study* );
262 virtual void onModelOpened();
263 virtual void onPushTraceTimer();
264 virtual void onInitTimer();
267 int mySelectionControlsTb;
270 int myToolbarsMenuId;
274 typedef QMap<QWidget*, bool> WgMap;
277 WgMap myToolbarBreaks;
278 QList<QMenu*> myMenus;
280 typedef QMap<int, bool> DockWindowMap;
281 DockWindowMap myCommonMap;
283 QStringList myTemporaryFiles;
285 QtMsgHandler myOldMsgHandler;
287 vtkEventQtSlotConnect *VTKConnect;
289 pqPythonScriptEditor* myTraceWindow;
293 //! Single shot timer used to connect to the PVServer, and start the trace.
294 QTimer * myInitTimer;
296 //! Timer used to regularly push the Python trace to the engine.
297 QTimer * myPushTraceTimer;
299 PVViewer_GUIElements * myGuiElements;
302 #endif // PVGUI_Module_H