Salome HOME
Documentation of the ParaView GUI integration.
[modules/paravis.git] / src / PVGUI / PVGUI_Module.h
1 // PARAVIS : ParaView wrapper SALOME module
2 //
3 // Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 // File   : PVGUI_Module.h
23 // Author : Sergey ANIKIN
24 //
25
26 /*!
27   \mainpage
28
29   Insert the content of introduction page here.
30
31 */
32
33 #ifndef PVGUI_Module_H
34 #define PVGUI_Module_H
35
36 #include <LightApp_Module.h>
37
38 class QMenu;
39 class QDockWidget;
40 class LightApp_Selection;
41 class LightApp_SelectionMgr;
42 class PVGUI_ProcessModuleHelper;
43 class vtkPVMain;
44 class pqOptions;
45 class pqServer;
46 class pqActiveServer;
47 class pqViewManager;
48
49 class PVGUI_Module : public LightApp_Module
50 {
51   Q_OBJECT
52    
53   //! Menu actions
54   enum { // Menu "File"
55          OpenFileId,
56
57          LoadStateId,
58          SaveStateId,
59
60          SaveDataId,
61          SaveScreenshotId,
62          ExportId,
63
64          SaveAnimationId,
65          SaveGeometryId,
66
67          ConnectId,
68          DisconnectId,
69
70          // Menu "Edit"
71          UndoId,
72          RedoId,
73
74          CameraUndoId,
75          CameraRedoId,
76
77          ChangeInputId,
78          DeleteId,
79          DeleteAllId,
80
81          InteractId,
82          SelectCellsOnId,
83          SelectPointsOnId,
84          SelectCellsThroughId,
85          SelectPointsThroughId,
86          SelectBlockId,
87
88          SettingsId,
89          ViewSettingsId,
90
91          // Menu "View"
92          ResetCameraId,
93          PositiveXId,
94          NegativeXId,
95          PositiveYId,
96          NegativeYId,
97          PositiveZId,
98          NegativeZId,
99
100          ShowCenterId,
101          ResetCenterId,
102          PickCenterId,
103          ShowColorLegendId,
104          EditColorMapId,
105          ResetRangeId,
106
107          AnimationInspectorId,
108          AnimationViewId,
109          ComparativeViewInspectorId,
110          SelectionInspectorId,
111          LookmarkBrowserId,
112          LookmarkInspectorId,
113          ObjectInspectorId,
114          PipelineBrowserId,
115          StatisticsViewId,
116
117          // Menu "Sources"
118          // TODO...
119
120          // Menu "Filters"
121          // TODO...
122
123          // Menu "Animation"
124          FirstFrameId,
125          PreviousFrameId,
126          PlayId,
127          NextFrameId,
128          LastFrameId,
129          LoopId,
130
131          // Menu "Tools" 
132          CreateCustomFilterId,
133          ManageCustomFiltersId,
134          CreateLookmarkId,
135          ManageLinksId,
136          AddCameraLinkId,
137          ManagePluginsExtensionsId,
138          DumpWidgetNamesId,
139          RecordTestId,
140          RecordTestScreenshotId,
141          PlayTestId,
142          MaxWindowSizeId,
143          TimerLogId,
144          OutputWindowId,
145          PythonShellId,
146
147          // Menu "Help" 
148          AboutParaViewId,
149          ParaViewHelpId,
150          EnableTooltipsId
151
152          /*
153          lgLoadFile = 931,   //!< load text file
154          lgSaveFile,         //!< save text file
155          lgDisplayLine,      //!< display selected line
156          lgEraseLine,        //!< erase selected line
157          lgEditLine,         //!< edit selected line
158          lgAddLine,          //!< insert new line
159          lgDelLine,          //!< delete selected line
160          lgClear             //!< clear all contents
161          */
162   };
163
164 public:
165   PVGUI_Module();
166   ~PVGUI_Module();
167
168   virtual void           initialize( CAM_Application* );
169   virtual void           windows( QMap<int, int>& ) const;
170
171   //virtual LightApp_Selection* createSelection() const;
172
173   pqViewManager*         getMultiViewManager() const;
174
175   virtual bool           eventFilter( QObject*, QEvent* );
176
177 protected:
178   //virtual CAM_DataModel* createDataModel();
179
180 private:
181   //! Initialize ParaView if not yet done (once per session)
182   static bool            pvInit();  
183   //! Shutdown ParaView, should be called on application exit
184   static void            pvShutdown();   
185  
186   //! Create actions for ParaView GUI operations
187   void                   pvCreateActions();
188
189   //! Create menus for ParaView GUI operations
190   //! duplicating menus in pqMainWindow ParaView class
191   void                   pvCreateMenus();
192
193   //! Create toolbars for ParaView GUI operations
194   //! duplicating toolbars in pqMainWindow ParaView class
195   void                   pvCreateToolBars();
196
197   //! Create dock widgets for ParaView widgets
198   void                   setupDockWidgets();
199
200   //! Create dock widgets context menus
201   void                   setupDockWidgetsContextMenu();
202
203   //! Save states of dockable ParaView widgets
204   void                   saveDockWidgetsState();
205
206   //! Restore states of dockable ParaView widgets
207   void                   restoreDockWidgetsState();
208
209   //! Shows or hides ParaView view window
210   void                   showView( bool );    
211
212   //! Returns QMenu object for a given menu id
213   QMenu*                 getMenu( const int );
214
215 private slots:
216   void onUndoLabel( const QString& );
217   void onRedoLabel( const QString& );
218   
219   void onCameraUndoLabel( const QString& );
220   void onCameraRedoLabel( const QString& );
221
222   void onDeleteAll();
223
224   void onSelectionModeChanged( int mode );
225
226   void onShowCenterAxisChanged( bool );
227
228   void setTimeRanges( double, double );
229
230   void onPlaying( bool );
231   
232   void onAddCameraLink();
233   
234   void onHelpAbout();
235
236   void showHelpForProxy( const QString& proxy );
237   void makeAssistant();
238   void assistantError( const QString& err );
239   
240   void onPreAccept();
241   void onPostAccept();
242   void endWaitCursor();
243
244 public slots:
245   virtual bool           activateModule( SUIT_Study* );
246   virtual bool           deactivateModule( SUIT_Study* );
247
248 private:
249   class pqImplementation;
250   pqImplementation*      Implementation;
251
252   int                    mySelectionControlsTb;
253   int                    mySourcesMenuId;
254   int                    myFiltersMenuId;
255
256   QList<QDockWidget*>    myDockWidgets;
257 };
258
259 #endif // PVGUI_Module_H