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