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();
222 void showHelpForProxy( const QString&, const QString& );
226 void endWaitCursor();
228 // void buildToolbarsMenu();
230 //void showParaViewHelp();
231 //void showHelp(const QString& url);
233 void onFinishedAddingServer(pqServer*);
234 void onDataRepresentationCreated(pqDataRepresentation*);
235 void onDataRepresentationUpdated();
236 void onVariableChanged(pqVariableType, const QString);
237 void onRepresentationChanged(pqRepresentation*);
239 void onStartProgress();
240 void onEndProgress();
242 void onRestartTrace();
244 void onNewParaViewWindow();
246 void onSaveMultiState();
248 void onCleanAddState();
254 virtual bool activateModule( SUIT_Study* );
255 virtual bool deactivateModule( SUIT_Study* );
256 virtual void onApplicationClosed( SUIT_Application* );
257 virtual void studyClosed( SUIT_Study* );
260 virtual void onModelOpened();
263 void timerEvent(QTimerEvent *event);
266 class pqImplementation;
267 pqImplementation* Implementation;
269 int mySelectionControlsTb;
272 int myToolbarsMenuId;
276 typedef QMap<QWidget*, bool> WgMap;
279 WgMap myToolbarBreaks;
280 QList<QMenu*> myMenus;
282 typedef QMap<int, bool> DockWindowMap;
283 DockWindowMap myCommonMap;
285 QStringList myTemporaryFiles;
287 QtMsgHandler myOldMsgHandler;
289 vtkEventQtSlotConnect *VTKConnect;
291 pqPythonScriptEditor* myTraceWindow;
295 static pqPVApplicationCore* MyCoreApp;
298 #endif // PVGUI_Module_H