]> SALOME platform Git repositories - modules/paravis.git/blob - src/PVGUI/PVGUI_Module.h
Salome HOME
Updated copyright comment
[modules/paravis.git] / src / PVGUI / PVGUI_Module.h
1 // PARAVIS : ParaView wrapper SALOME module
2 //
3 // Copyright (C) 2010-2024  CEA, EDF
4 //
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.
9 //
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.
14 //
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
18 //
19 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 //
21 // File   : PVGUI_Module.h
22 // Author : Sergey ANIKIN, Adrien BRUNETON
23 //
24
25
26 #ifndef PVGUI_Module_H
27 #define PVGUI_Module_H
28
29 #include <LightApp_Module.h>
30
31 class QMenu;
32 class QTimer;
33 class vtkEventQtSlotConnect;
34 class pqServer;
35 class pqPythonScriptEditor;
36 class pqPVApplicationCore;
37 class PVViewer_GUIElements;
38 class PVServer_ServiceWrapper;
39 class SUIT_ViewWindow;
40
41 class PVGUI_Module: public LightApp_Module
42 {
43   Q_OBJECT
44    
45   //! Menu actions
46   enum {
47     //-----------
48     // Menu "File"
49     OpenFileId,
50     //-
51     LoadStateId,
52     SaveStateId,
53     //-
54     SaveDataId,
55     SaveScreenshotId,
56     ExportId,
57     //-
58     SaveAnimationId,
59     SaveGeometryId,
60     //-
61     LoadMaterialsId,
62     //-
63     ConnectId,
64     DisconnectId,
65     //-----------
66     // Menu "Edit"
67     UndoId,
68     RedoId,
69     //-
70     CameraUndoId,
71     CameraRedoId,
72     //-
73     FindDataId,
74     ChangeInputId,
75     IgnoreTimeId,
76     DeleteId,
77     DeleteAllId,
78     //-
79     SettingsId,             // not used
80     ViewSettingsId,         // not used
81     //-----------
82     // Menu "View"
83     FullScreenId,           // not used
84     //-----------
85     // Menu "Animation"
86     FirstFrameId,           // not used
87     PreviousFrameId,        // not used
88     PlayId,                 // not used
89     NextFrameId,            // not used
90     LastFrameId,            // not used
91     LoopId,                 // not used
92     //-----------
93     // Menu "Tools"
94     CreateCustomFilterId,
95     ManageCustomFiltersId,
96     CreateLookmarkId,       // not used
97     ManageLinksId,
98     AddCameraLinkId,
99     ManagePluginsExtensionsId,
100     DumpWidgetNamesId,      //  not used
101     RecordTestId,
102     RecordTestScreenshotId, // not used
103     PlayTestId,
104     MaxWindowSizeId,
105     CustomWindowSizeId,
106     TimerLogId,
107     PythonShellId,
108     ShowTraceId,
109     RestartTraceId,
110     //-----------
111     // Menu "Help"
112     AboutParaViewId,
113     ParaViewHelpId,
114     EnableTooltipsId,       // not used
115   };
116
117 public:
118   PVGUI_Module();
119   ~PVGUI_Module();
120
121   virtual void initialize( CAM_Application* );
122   virtual void windows( QMap<int, int>& ) const;
123
124   void openFile( const char* );                   // not used inside PARAVIS
125   void executeScript( const char* );              // not used inside PARAVIS
126
127   void saveParaviewState( const QString& );
128   void loadParaviewState( const QString& );
129   void clearParaviewState();
130
131   QString getTraceString();
132   void startTrace();
133   void stopTrace();
134   void saveTrace( const char* );
135
136   pqServer* getActiveServer();
137
138   virtual void createPreferences();
139
140   inline static PVServer_ServiceWrapper* GetEngine();
141   inline static pqPVApplicationCore* GetPVApplication(); // not used inside PARAVIS
142
143   virtual CAM_DataModel* createDataModel();
144
145 private:
146   //! Create actions for ParaView GUI operations
147   void pvCreateActions();
148
149   //! Create menus for ParaView GUI operations duplicating menus in pqMainWindow ParaView class
150   void pvCreateMenus();
151
152   //! Create toolbars for ParaView GUI operations duplicating toolbars in pqMainWindow ParaView class
153   void pvCreateToolBars();
154
155   //! Create dock widgets for ParaView widgets
156   void setupDockWidgets();
157
158   //! Save states of dockable ParaView widgets
159   void saveDockWidgetsState( bool = true );
160
161   //! Restore states of dockable ParaView widgets
162   void restoreDockWidgetsState();
163
164   //! Shows or hides ParaView view window
165   void showView( bool );    
166
167   //! Get list of embedded macros files
168   QStringList getEmbeddedMacrosList();
169
170   //! update macros state
171   void updateMacros();
172
173   //! store visibility of the common dockable windows (OB, PyConsole, ... etc.)
174   void storeCommonWindowsState();
175
176   //! restore visibility of the common dockable windows (OB, PyConsole, ... etc.)
177   void restoreCommonWindowsState();
178
179 private slots:
180   void showHelpForProxy( const QString&, const QString& );
181   
182   void onPreAccept();    // not used inside PARAVIS
183   void onPostAccept();   // not used inside PARAVIS
184   void endWaitCursor();  // not used inside PARAVIS
185
186   void onDataRepresentationUpdated();
187
188   void onStartProgress();
189   void onEndProgress();
190   void onShowTrace();
191   void onRestartTrace();
192   void onStopTrace();
193
194 public slots:
195   virtual bool           activateModule( SUIT_Study* );
196   virtual bool           deactivateModule( SUIT_Study* );
197   virtual void           onApplicationClosed( SUIT_Application* );
198   virtual void           studyClosed( SUIT_Study* );
199
200 protected slots:
201   virtual void           onInitTimer();
202   virtual void           onViewManagerAdded( SUIT_ViewManager* );
203   virtual void           onViewManagerRemoved( SUIT_ViewManager* );
204   virtual void           onPVViewCreated( SUIT_ViewWindow* );
205   virtual void           onPVViewDelete( SUIT_ViewWindow* );
206
207 private:
208   int                    mySourcesMenuId;
209   int                    myFiltersMenuId;
210   int                    myMacrosMenuId;
211   int                    myRecentMenuId;
212   int                    myCatalystMenuId;
213   
214   typedef QMap<QWidget*, bool> WgMap;
215   WgMap                  myDockWidgets;
216   WgMap                  myToolbars;
217   WgMap                  myToolbarBreaks;
218   QList<QMenu*>          myMenus;
219
220   typedef QMap<int, bool> DockWindowMap;         
221   DockWindowMap           myCommonMap; 
222   QtMessageHandler        myOldMsgHandler;
223
224   vtkEventQtSlotConnect*  VTKConnect;
225
226   pqPythonScriptEditor*   myTraceWindow;
227
228   //! Single shot timer used to connect to the PVServer, and start the trace.
229   QTimer*                 myInitTimer;
230
231   PVViewer_GUIElements*   myGuiElements;
232 };
233
234 #endif // PVGUI_Module_H