Salome HOME
210b89e1f109c5c4c1879bdc0b478855adb3ba96
[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 #ifndef PVGUI_Module_H
27 #define PVGUI_Module_H
28
29 #include <LightApp_Module.h>
30
31 class QMenu;
32 class QDockWidget;
33 class LightApp_Selection;
34 class LightApp_SelectionMgr;
35 class PVGUI_ProcessModuleHelper;
36 class vtkPVMain;
37 class pqOptions;
38 class pqServer;
39 class pqActiveServer;
40 class pqViewManager;
41
42 class PVGUI_Module : public LightApp_Module
43 {
44   Q_OBJECT
45    
46   //! Menu actions
47   enum { // Menu "File"
48          OpenFileId,
49
50          LoadStateId,
51          SaveStateId,
52
53          SaveDataId,
54          SaveScreenshotId,
55          ExportId,
56
57          SaveAnimationId,
58          SaveGeometryId,
59
60          ConnectId,
61          DisconnectId,
62
63          // Menu "Edit"
64          UndoId,
65          RedoId,
66
67          CameraUndoId,
68          CameraRedoId,
69
70          ChangeInputId,
71          DeleteId,
72          DeleteAllId,
73
74          InteractId,
75          SelectCellsOnId,
76          SelectPointsOnId,
77          SelectCellsThroughId,
78          SelectPointsThroughId,
79          SelectBlockId,
80
81          SettingsId,
82          ViewSettingsId,
83
84          // Menu "View"
85          ResetCameraId,
86          PositiveXId,
87          NegativeXId,
88          PositiveYId,
89          NegativeYId,
90          PositiveZId,
91          NegativeZId,
92
93          ShowCenterId,
94          ResetCenterId,
95          PickCenterId,
96          ShowColorLegendId,
97          EditColorMapId,
98          ResetRangeId,
99
100          AnimationInspectorId,
101          AnimationViewId,
102          ComparativeViewInspectorId,
103          SelectionInspectorId,
104          LookmarkBrowserId,
105          LookmarkInspectorId,
106          ObjectInspectorId,
107          PipelineBrowserId,
108          StatisticsViewId,
109
110          // Menu "Sources"
111          // TODO...
112
113          // Menu "Filters"
114          // TODO...
115
116          // Menu "Animation"
117          FirstFrameId,
118          PreviousFrameId,
119          PlayId,
120          NextFrameId,
121          LastFrameId,
122          LoopId,
123
124          // Menu "Tools" 
125          CreateCustomFilterId,
126          ManageCustomFiltersId,
127          CreateLookmarkId,
128          ManageLinksId,
129          AddCameraLinkId,
130          ManagePluginsExtensionsId,
131          DumpWidgetNamesId,
132          RecordTestId,
133          RecordTestScreenshotId,
134          PlayTestId,
135          MaxWindowSizeId,
136          TimerLogId,
137          OutputWindowId,
138          PythonShellId,
139
140          // Menu "Help" 
141          AboutParaViewId,
142          ParaViewHelpId,
143          EnableTooltipsId
144
145          /*
146          lgLoadFile = 931,   //!< load text file
147          lgSaveFile,         //!< save text file
148          lgDisplayLine,      //!< display selected line
149          lgEraseLine,        //!< erase selected line
150          lgEditLine,         //!< edit selected line
151          lgAddLine,          //!< insert new line
152          lgDelLine,          //!< delete selected line
153          lgClear             //!< clear all contents
154          */
155   };
156
157 public:
158   PVGUI_Module();
159   ~PVGUI_Module();
160
161   virtual void           initialize( CAM_Application* );
162   virtual void           windows( QMap<int, int>& ) const;
163
164   //virtual LightApp_Selection* createSelection() const;
165
166   pqViewManager*         getMultiViewManager() const;
167
168   virtual bool           eventFilter( QObject*, QEvent* );
169
170 protected:
171   //virtual CAM_DataModel* createDataModel();
172
173 private:
174   //! Initialize ParaView if not yet done (once per session)
175   static bool            pvInit();  
176   //! Shutdown ParaView, should be called on application exit
177   static void            pvShutdown();   
178  
179   //! Create actions for ParaView GUI operations
180   //! duplicating menus and toolbars in pqMainWindow ParaView class
181   void                   pvCreateActions();
182
183   //! Create menus for ParaView GUI operations
184   //! duplicating menus in pqMainWindow ParaView class
185   void                   pvCreateMenus();
186
187   //! Create toolbars for ParaView GUI operations
188   //! duplicating toolbars in pqMainWindow ParaView class
189   void                   pvCreateToolBars();
190
191   //! Create dock widgets for ParaView widgets
192   void                   setupDockWidgets();
193
194   //! Create dock widgets context menus
195   void                   setupDockWidgetsContextMenu();
196
197   //! Save states of dockable ParaView widgets
198   void                   saveDockWidgetsState();
199
200   //! Restore states of dockable ParaView widgets
201   void                   restoreDockWidgetsState();
202
203   //! Shows or hides ParaView view window
204   void                   showView( bool );    
205
206   //! Returns QMenu object for a given menu id
207   QMenu*                 getMenu( const int );
208
209 private slots:
210   void onUndoLabel( const QString& );
211   void onRedoLabel( const QString& );
212   
213   void onCameraUndoLabel( const QString& );
214   void onCameraRedoLabel( const QString& );
215
216   void onDeleteAll();
217
218   void onSelectionModeChanged( int mode );
219
220   void onShowCenterAxisChanged( bool );
221
222   void setTimeRanges( double, double );
223
224   void onPlaying( bool );
225   
226   void onAddCameraLink();
227   
228   void onHelpAbout();
229
230   void showHelpForProxy( const QString& proxy );
231   void makeAssistant();
232   void assistantError( const QString& err );
233   
234   void onPreAccept();
235   void onPostAccept();
236   void endWaitCursor();
237
238 public slots:
239   virtual bool           activateModule( SUIT_Study* );
240   virtual bool           deactivateModule( SUIT_Study* );
241
242 private:
243   class pqImplementation;
244   pqImplementation*      Implementation;
245
246   int                    mySelectionControlsTb;
247   int                    mySourcesMenuId;
248   int                    myFiltersMenuId;
249
250   QList<QDockWidget*>    myDockWidgets;
251 };
252
253 #endif // PVGUI_Module_H