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