]> SALOME platform Git repositories - modules/paravis.git/blob - src/PVGUI/PVGUI_Module.h
Salome HOME
Merge from BR_PARAVIS_LOT1_2 24/02/2010
[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 <SalomeApp_Module.h>
31
32 #include <ostream>
33
34 class QMenu;
35 class QDockWidget;
36 class QToolBar;
37 class vtkPVMain;
38 class pqOptions;
39 class pqServer;
40 class pqViewManager;
41 class pqMainWindowCore;
42
43 class PVGUI_Module : public SalomeApp_Module
44 {
45   Q_OBJECT
46    
47   //! Menu actions
48   enum { // Menu "File"
49          OpenFileId,
50
51          LoadStateId,
52          SaveStateId,
53
54          SaveDataId,
55          SaveScreenshotId,
56          ExportId,
57
58          SaveAnimationId,
59          SaveGeometryId,
60
61          ConnectId,
62          DisconnectId,
63
64          // Menu "Edit"
65          UndoId,
66          RedoId,
67
68          CameraUndoId,
69          CameraRedoId,
70
71          ChangeInputId,
72    IgnoreTimeId, 
73          DeleteId,
74          DeleteAllId,
75
76          //InteractId,
77          //SelectCellsOnId,
78          //SelectPointsOnId,
79          //SelectCellsThroughId,
80          //SelectPointsThroughId,
81          //SelectBlockId,
82
83          SettingsId,
84          ViewSettingsId,
85
86          // Menu "View"
87    FullScreenId, 
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 QString engineIOR() const;
159
160   /*! Compares the contents of the window with the given reference image,
161    * returns true if they "match" within some tolerance
162    */
163   /*bool                   compareView( const QString& ReferenceImage, double Threshold,
164     std::ostream& Output, const QString& TempDirectory );*/
165
166   void openFile(const char* theName);
167   void saveParaviewState(const char* theFileName);
168   void loadParaviewState(const char* theFileName);
169
170   QString getTraceString();
171   void saveTrace(const char* theName);
172
173   pqServer* getActiveServer();
174
175   virtual void createPreferences();
176
177 public slots:
178   void onImportFromVisu(QString theEntry);
179
180 private:
181   //! Initialize ParaView if not yet done (once per session)
182   static bool            pvInit();  
183  
184   //! Create actions for ParaView GUI operations
185   void                   pvCreateActions();
186
187   //! Create menus for ParaView GUI operations duplicating menus in pqMainWindow ParaView class
188   void                   pvCreateMenus();
189
190   //! Create toolbars for ParaView GUI operations duplicating toolbars in pqMainWindow ParaView class
191   void                   pvCreateToolBars();
192
193   //! Create dock widgets for ParaView widgets
194   void                   setupDockWidgets();
195
196   //! Save states of dockable ParaView widgets
197   void                   saveDockWidgetsState();
198
199   //! Restore states of dockable ParaView widgets
200   void                   restoreDockWidgetsState();
201
202   //! Shows or hides ParaView view window
203   void                   showView( bool );    
204
205   //! Returns QMenu object for a given menu id
206   QMenu*                 getMenu( const int );
207
208   void                   deleteTemporaryFiles();
209   
210   QList<QToolBar*>       getParaViewToolbars();
211
212 private slots:
213
214   void showHelpForProxy( const QString& proxy );
215   
216   void onPreAccept();
217   void onPostAccept();
218   void endWaitCursor();
219
220   void activateTrace();
221
222   void buildToolbarsMenu();
223
224   void showParaViewHelp();
225   void showHelp(const QString& url);
226
227 public slots:
228   virtual bool           activateModule( SUIT_Study* );
229   virtual bool           deactivateModule( SUIT_Study* );
230   virtual void           onApplicationClosed( SUIT_Application* );
231
232 private:
233   class pqImplementation;
234   pqImplementation*      Implementation;
235
236   int                    mySelectionControlsTb;
237   int                    mySourcesMenuId;
238   int                    myFiltersMenuId;
239   int                    myToolbarsMenuId;
240   int                    myMacrosMenuId;
241
242   QList<QDockWidget*>    myDockWidgets;
243
244   QStringList            myTemporaryFiles;
245
246   QMap<QToolBar*, bool>  myToolbarState;
247
248   QtMsgHandler           myOldMsgHandler;
249 };
250
251 #endif // PVGUI_Module_H