1 // PARAVIS : ParaView wrapper SALOME module
3 // Copyright (C) 2010-2013 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.
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>
34 #include <pqVariableType.h>
42 class pqTabbedMultiViewWidget;
43 class pqMainWindowCore;
44 class vtkEventQtSlotConnect;
45 class pqPythonScriptEditor;
46 class pqPVApplicationCore;
47 class pqDataRepresentation;
48 class pqRepresentation;
51 class PVGUI_Module : public SalomeApp_Module
100 CreateCustomFilterId,
101 ManageCustomFiltersId,
105 ManagePluginsExtensionsId,
108 RecordTestScreenshotId,
123 // Menu "Window" - "New Window"
126 // "Save state" ParaVis module root object popup
129 // "Add state" and "Reload state" popups
131 CleanAndAddStatePopupId,
133 // "Rename" and "Delete" popups (Object Browser)
142 virtual void initialize( CAM_Application* );
143 virtual void windows( QMap<int, int>& ) const;
145 pqTabbedMultiViewWidget* getMultiViewManager() const;
147 virtual QString engineIOR() const;
149 void openFile(const char* theName);
150 void executeScript(const char *script);
151 void saveParaviewState(const char* theFileName);
152 void loadParaviewState(const char* theFileName);
153 void clearParaviewState();
155 QString getTraceString();
156 void saveTrace(const char* theName);
158 pqServer* getActiveServer();
160 virtual void createPreferences();
162 virtual void contextMenuPopup(const QString& theClient, QMenu* theMenu, QString& theTitle);
165 void onImportFromVisu(QString theEntry);
168 //! Initialize ParaView if not yet done (once per session)
169 static bool pvInit();
171 //! Create actions for ParaView GUI operations
172 void pvCreateActions();
174 //! Create menus for ParaView GUI operations duplicating menus in pqMainWindow ParaView class
175 void pvCreateMenus();
177 //! Create toolbars for ParaView GUI operations duplicating toolbars in pqMainWindow ParaView class
178 void pvCreateToolBars();
180 //! Create dock widgets for ParaView widgets
181 void setupDockWidgets();
183 //! Save states of dockable ParaView widgets
184 void saveDockWidgetsState();
186 //! Restore states of dockable ParaView widgets
187 void restoreDockWidgetsState();
189 //! Shows or hides ParaView view window
190 void showView( bool );
192 //! Returns QMenu object for a given menu id
193 QMenu* getMenu( const int );
195 //! Discover help project files from the resources.
196 QString getHelpFileName();
198 void deleteTemporaryFiles();
200 //QList<QToolBar*> getParaViewToolbars();
202 //! Create actions for ParaViS
203 void createActions();
205 //! Create menus for ParaViS
208 //! Load selected state
209 void loadSelectedState(bool toClear);
211 //! update macros state
214 //! store visibility of the common dockable windows (OB, PyConsole, ... etc.)
215 void storeCommonWindowsState();
217 //! restore visibility of the common dockable windows (OB, PyConsole, ... etc.)
218 void restoreCommonWindowsState();
220 //! run Python command
221 void execPythonCommand(const QString& cmd, bool inSalomeConsole = false);
225 void showHelpForProxy( const QString&, const QString& );
229 void endWaitCursor();
231 // void buildToolbarsMenu();
233 //void showParaViewHelp();
234 //void showHelp(const QString& url);
236 void onFinishedAddingServer(pqServer*);
237 void onDataRepresentationCreated(pqDataRepresentation*);
238 void onDataRepresentationUpdated();
239 void onVariableChanged(pqVariableType, const QString);
240 void onRepresentationChanged(pqRepresentation*);
242 void onStartProgress();
243 void onEndProgress();
245 void onRestartTrace();
247 void onNewParaViewWindow();
249 void onSaveMultiState();
251 void onCleanAddState();
257 virtual bool activateModule( SUIT_Study* );
258 virtual bool deactivateModule( SUIT_Study* );
259 virtual void onApplicationClosed( SUIT_Application* );
260 virtual void studyClosed( SUIT_Study* );
263 virtual void onModelOpened();
266 void timerEvent(QTimerEvent *event);
269 class pqImplementation;
270 pqImplementation* Implementation;
272 int mySelectionControlsTb;
275 int myToolbarsMenuId;
279 typedef QMap<QWidget*, bool> WgMap;
282 WgMap myToolbarBreaks;
283 QList<QMenu*> myMenus;
285 typedef QMap<int, bool> DockWindowMap;
286 DockWindowMap myCommonMap;
288 QStringList myTemporaryFiles;
290 QtMsgHandler myOldMsgHandler;
292 vtkEventQtSlotConnect *VTKConnect;
294 pqPythonScriptEditor* myTraceWindow;
298 static pqPVApplicationCore* MyCoreApp;
301 #endif // PVGUI_Module_H