Salome HOME
PARAVIS HTML docs
[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          lgLoadFile = 931,   //!< load text file
150          lgSaveFile,         //!< save text file
151          lgDisplayLine,      //!< display selected line
152          lgEraseLine,        //!< erase selected line
153          lgEditLine,         //!< edit selected line
154          lgAddLine,          //!< insert new line
155          lgDelLine,          //!< delete selected line
156          lgClear             //!< clear all contents
157          */
158   };
159
160 public:
161   PVGUI_Module();
162   ~PVGUI_Module();
163
164   virtual void           initialize( CAM_Application* );
165   virtual void           windows( QMap<int, int>& ) const;
166
167   //virtual LightApp_Selection* createSelection() const;
168
169   pqViewManager*         getMultiViewManager() const;
170
171   virtual bool           eventFilter( QObject*, QEvent* );
172
173   //! Compares the contents of the window with the given reference image, returns true if they "match" within some tolerance
174   bool                   compareView( const QString& ReferenceImage, double Threshold,
175                                       ostream& Output, const QString& TempDirectory );
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