Back to index

salome-paravis  6.5.0
PVGUI_Module.h
Go to the documentation of this file.
00001 // PARAVIS : ParaView wrapper SALOME module
00002 //
00003 // Copyright (C) 2010-2012  CEA/DEN, EDF R&D
00004 //
00005 // This library is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU Lesser General Public
00007 // License as published by the Free Software Foundation; either
00008 // version 2.1 of the License.
00009 //
00010 // This library is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 // Lesser General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU Lesser General Public
00016 // License along with this library; if not, write to the Free Software
00017 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00018 //
00019 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00020 //
00021 // File   : PVGUI_Module.h
00022 // Author : Sergey ANIKIN
00023 //
00024 
00025 
00026 #ifndef PVGUI_Module_H
00027 #define PVGUI_Module_H
00028 
00029 #include <SalomeApp_Module.h>
00030 
00031 #include <ostream>
00032 #include <vtkType.h>
00033 
00034 class QMenu;
00035 class QDockWidget;
00036 class QToolBar;
00037 class vtkPVMain;
00038 class pqOptions;
00039 class pqServer;
00040 class pqTabbedMultiViewWidget;
00041 class pqMainWindowCore;
00042 class vtkEventQtSlotConnect;
00043 class pqPythonScriptEditor;
00044 class pqPVApplicationCore;
00045 
00046 
00047 class PVGUI_Module : public SalomeApp_Module
00048 {
00049   Q_OBJECT
00050    
00052   enum { // Menu "File"
00053          OpenFileId,
00054 
00055         LoadStateId,
00056         SaveStateId,
00057 
00058         SaveDataId,
00059         SaveScreenshotId,
00060         ExportId,
00061 
00062         SaveAnimationId,
00063         SaveGeometryId,
00064 
00065         ConnectId,
00066         DisconnectId,
00067 
00068         // Menu "Edit"
00069         UndoId,
00070         RedoId,
00071 
00072         CameraUndoId,
00073         CameraRedoId,
00074 
00075    FindDataId,   
00076         ChangeInputId,
00077    IgnoreTimeId, 
00078         DeleteId,
00079         DeleteAllId,
00080 
00081         SettingsId,
00082         ViewSettingsId,
00083 
00084         // Menu "View"
00085    FullScreenId, 
00086 
00087         // Menu "Animation"
00088         FirstFrameId,
00089         PreviousFrameId,
00090         PlayId,
00091         NextFrameId,
00092         LastFrameId,
00093         LoopId,
00094 
00095         // Menu "Tools" 
00096         CreateCustomFilterId,
00097         ManageCustomFiltersId,
00098         CreateLookmarkId,
00099         ManageLinksId,
00100         AddCameraLinkId,
00101         ManagePluginsExtensionsId,
00102         DumpWidgetNamesId,
00103         RecordTestId,
00104         RecordTestScreenshotId,
00105         PlayTestId,
00106         MaxWindowSizeId,
00107         CustomWindowSizeId,
00108         TimerLogId,
00109         OutputWindowId,
00110         PythonShellId,
00111         ShowTraceId,
00112 
00113         // Menu "Help" 
00114         AboutParaViewId,
00115         ParaViewHelpId,
00116         EnableTooltipsId,
00117 
00118         // Menu "Window" - "New Window"
00119         ParaViewNewWindowId,
00120 
00121         // "Save state" ParaVis module root object popup
00122         SaveStatePopupId,
00123 
00124         // "Add state" and "Reload state" popups
00125         AddStatePopupId,
00126         CleanAndAddStatePopupId,
00127 
00128         // "Rename" and "Delete" popups (Object Browser)
00129         ParaVisRenameId,
00130         ParaVisDeleteId
00131   };
00132 
00133 public:
00134   PVGUI_Module();
00135   ~PVGUI_Module();
00136 
00137   virtual void           initialize( CAM_Application* );
00138   virtual void           windows( QMap<int, int>& ) const;
00139 
00140   pqTabbedMultiViewWidget*         getMultiViewManager() const;
00141 
00142   virtual QString engineIOR() const;
00143 
00144   void openFile(const char* theName);
00145   void executeScript(const char *script);
00146   void saveParaviewState(const char* theFileName);
00147   void loadParaviewState(const char* theFileName);
00148   void clearParaviewState();
00149 
00150   QString getTraceString();
00151   void saveTrace(const char* theName);
00152 
00153   pqServer* getActiveServer();
00154 
00155   virtual void createPreferences();
00156 
00157   virtual void contextMenuPopup(const QString& theClient, QMenu* theMenu, QString& theTitle);
00158 
00159 public slots:
00160   void onImportFromVisu(QString theEntry);
00161 
00162 private:
00164   static bool            pvInit();  
00165  
00167   void                   pvCreateActions();
00168 
00170   void                   pvCreateMenus();
00171 
00173   void                   pvCreateToolBars();
00174 
00176   void                   setupDockWidgets();
00177 
00179   void                   saveDockWidgetsState();
00180 
00182   void                   restoreDockWidgetsState();
00183 
00185   void                   showView( bool );    
00186 
00188   QMenu*                 getMenu( const int );
00189   
00191   QString getHelpFileName();
00192 
00193   void                   deleteTemporaryFiles();
00194   
00195   //QList<QToolBar*>       getParaViewToolbars();
00196 
00198   void createActions();
00199 
00201   void createMenus();
00202 
00204   void loadSelectedState(bool toClear);
00205 
00207   void updateMacros();
00208 
00209 private slots:
00210 
00211   void showHelpForProxy( const QString&, const QString& );
00212   
00213   void onPreAccept();
00214   void onPostAccept();
00215   void endWaitCursor();
00216 
00217   //  void buildToolbarsMenu();
00218 
00219   //void showParaViewHelp();
00220   //void showHelp(const QString& url);
00221 
00222   void onFinishedAddingServer(pqServer*);
00223 
00224   void onStartProgress();
00225   void onEndProgress();
00226   void onShowTrace();
00227 
00228   void onNewParaViewWindow();
00229 
00230   void onSaveMultiState();
00231   void onAddState();
00232   void onCleanAddState();
00233 
00234   void onRename();
00235   void onDelete();
00236 
00237 public slots:
00238   virtual bool           activateModule( SUIT_Study* );
00239   virtual bool           deactivateModule( SUIT_Study* );
00240   virtual void           onApplicationClosed( SUIT_Application* );
00241   virtual void           studyClosed( SUIT_Study* );
00242 
00243 protected slots:
00244   virtual void           onModelOpened();
00245 
00246 protected:
00247   void timerEvent(QTimerEvent *event);
00248 
00249 private:
00250   class pqImplementation;
00251   pqImplementation*      Implementation;
00252 
00253   int                    mySelectionControlsTb;
00254   int                    mySourcesMenuId;
00255   int                    myFiltersMenuId;
00256   int                    myToolbarsMenuId;
00257   int                    myMacrosMenuId;
00258   int                    myRecentMenuId;
00259   
00260   typedef QMap<QWidget*, bool> WgMap;
00261   WgMap                  myDockWidgets;
00262   WgMap                  myToolbars;
00263   WgMap                  myToolbarBreaks;
00264 
00265   QStringList            myTemporaryFiles;
00266 
00267   QtMsgHandler           myOldMsgHandler;
00268 
00269   vtkEventQtSlotConnect *VTKConnect;
00270 
00271   pqPythonScriptEditor* myTraceWindow;
00272 
00273   int myStateCounter;
00274 
00275   static pqPVApplicationCore* MyCoreApp;
00276 };
00277 
00278 #endif // PVGUI_Module_H