Salome HOME
Copyright update 2022
[modules/paravis.git] / src / PVGUI / PVGUI_Module.h
index 62d584277535d6916421594d9158680524c4c007..4715c0a9e1b1cb61782a834fd6a05493c0cbd20c 100644 (file)
@@ -1,6 +1,6 @@
 // PARAVIS : ParaView wrapper SALOME module
 //
-// Copyright (C) 2010-2014  CEA/DEN, EDF R&D
+// Copyright (C) 2010-2022  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 // File   : PVGUI_Module.h
-// Author : Sergey ANIKIN
+// Author : Sergey ANIKIN, Adrien BRUNETON
 //
 
 
 #ifndef PVGUI_Module_H
 #define PVGUI_Module_H
 
-#include <SalomeApp_Module.h>
-#include "SALOMEconfig.h"
-#include CORBA_SERVER_HEADER(SALOMEDS)
-#ifndef PARAVIS_WITH_FULL_CORBA
-#    include CORBA_SERVER_HEADER(PARAVIS_Gen)
-#endif
-
-#include <ostream>
-#include <vtkType.h>
-#include <QTimer>
-
-#include <pqVariableType.h>
+#include <LightApp_Module.h>
 
 class QMenu;
-class QDockWidget;
-class QToolBar;
-class vtkPVMain;
-class pqOptions;
-class pqServer;
-class pqTabbedMultiViewWidget;
-class pqMainWindowCore;
+class QTimer;
 class vtkEventQtSlotConnect;
+class pqServer;
 class pqPythonScriptEditor;
 class pqPVApplicationCore;
-class pqDataRepresentation;
-class pqRepresentation;
+class PVViewer_GUIElements;
+class PVServer_ServiceWrapper;
+class SUIT_ViewWindow;
 
-class PVGUI_Module : public SalomeApp_Module
+class PVGUI_Module: public LightApp_Module
 {
   Q_OBJECT
    
   //! Menu actions
-  enum { // Menu "File"
-     OpenFileId,
-
-     LoadStateId,
-     SaveStateId,
-
-     SaveDataId,
-     SaveScreenshotId,
-     ExportId,
-
-     SaveAnimationId,
-     SaveGeometryId,
-
-     ConnectId,
-     DisconnectId,
-
-     // Menu "Edit"
-     UndoId,
-     RedoId,
-
-     CameraUndoId,
-     CameraRedoId,
-
-     FindDataId,
-     ChangeInputId,
-     IgnoreTimeId,
-     DeleteId,
-     DeleteAllId,
-
-     SettingsId,
-     ViewSettingsId,
-
-     // Menu "View"
-     FullScreenId,
-
-     // Menu "Animation"
-     FirstFrameId,
-     PreviousFrameId,
-     PlayId,
-     NextFrameId,
-     LastFrameId,
-     LoopId,
-
-     // Menu "Tools"
-     CreateCustomFilterId,
-     ManageCustomFiltersId,
-     CreateLookmarkId,
-     ManageLinksId,
-     AddCameraLinkId,
-     ManagePluginsExtensionsId,
-     DumpWidgetNamesId,
-     RecordTestId,
-     RecordTestScreenshotId,
-     PlayTestId,
-     MaxWindowSizeId,
-     CustomWindowSizeId,
-     TimerLogId,
-     OutputWindowId,
-     PythonShellId,
-     ShowTraceId,
-     RestartTraceId,
-
-     // Menu "Help"
-     AboutParaViewId,
-     ParaViewHelpId,
-     EnableTooltipsId,
-
-     // Menu "Window" - "New Window"
-     ParaViewNewWindowId,
-
-     // "Save state" ParaVis module root object popup
-     SaveStatePopupId,
-
-     // "Add state" and "Reload state" popups
-     AddStatePopupId,
-     CleanAndAddStatePopupId,
-
-     // "Rename" and "Delete" popups (Object Browser)
-     ParaVisRenameId,
-     ParaVisDeleteId
+  enum {
+    //-----------
+    // Menu "File"
+    OpenFileId,
+    //-
+    LoadStateId,
+    SaveStateId,
+    //-
+    SaveDataId,
+    SaveScreenshotId,
+    ExportId,
+    //-
+    SaveAnimationId,
+    SaveGeometryId,
+    //-
+    ConnectId,
+    DisconnectId,
+    //-----------
+    // Menu "Edit"
+    UndoId,
+    RedoId,
+    //-
+    CameraUndoId,
+    CameraRedoId,
+    //-
+    FindDataId,
+    ChangeInputId,
+    IgnoreTimeId,
+    DeleteId,
+    DeleteAllId,
+    //-
+    SettingsId,             // not used
+    ViewSettingsId,         // not used
+    //-----------
+    // Menu "View"
+    FullScreenId,           // not used
+    //-----------
+    // Menu "Animation"
+    FirstFrameId,           // not used
+    PreviousFrameId,        // not used
+    PlayId,                 // not used
+    NextFrameId,            // not used
+    LastFrameId,            // not used
+    LoopId,                 // not used
+    //-----------
+    // Menu "Tools"
+    CreateCustomFilterId,
+    ManageCustomFiltersId,
+    CreateLookmarkId,       // not used
+    ManageLinksId,
+    AddCameraLinkId,
+    ManagePluginsExtensionsId,
+    DumpWidgetNamesId,      //  not used
+    RecordTestId,
+    RecordTestScreenshotId, // not used
+    PlayTestId,
+    MaxWindowSizeId,
+    CustomWindowSizeId,
+    TimerLogId,
+    PythonShellId,
+    ShowTraceId,
+    RestartTraceId,
+    //-----------
+    // Menu "Help"
+    AboutParaViewId,
+    ParaViewHelpId,
+    EnableTooltipsId,       // not used
   };
 
 public:
   PVGUI_Module();
   ~PVGUI_Module();
 
-  static PARAVIS_ORB::PARAVIS_Gen_var GetEngine();
+  virtual void initialize( CAM_Application* );
+  virtual void windows( QMap<int, int>& ) const;
 
-  virtual void           initialize( CAM_Application* );
-  virtual void           windows( QMap<int, int>& ) const;
+  void openFile( const char* );                   // not used inside PARAVIS
+  void executeScript( const char* );              // not used inside PARAVIS
 
-  pqTabbedMultiViewWidget*         getMultiViewManager() const;
-
-  virtual QString engineIOR() const;
-
-  void openFile(const char* theName);
-  void executeScript(const char *script);
-  void saveParaviewState(const char* theFileName);
-  void loadParaviewState(const char* theFileName);
+  void saveParaviewState( const QString& );
+  void loadParaviewState( const QString& );
   void clearParaviewState();
 
   QString getTraceString();
   void startTrace();
   void stopTrace();
-  void saveTrace(const char* theName);
+  void saveTrace( const char* );
 
   pqServer* getActiveServer();
 
   virtual void createPreferences();
 
-  virtual void contextMenuPopup(const QString& theClient, QMenu* theMenu, QString& theTitle);
+  inline static PVServer_ServiceWrapper* GetEngine();
+  inline static pqPVApplicationCore* GetPVApplication(); // not used inside PARAVIS
 
-public slots:
-  //void onImportFromVisu(QString theEntry);
+  virtual CAM_DataModel* createDataModel();
 
 private:
-  void deleteTemporaryFiles();
-
-  //! Initialize ParaView if not yet done (once per session)
-  static bool            pvInit();  
   //! Create actions for ParaView GUI operations
-  void                   pvCreateActions();
+  void pvCreateActions();
 
   //! Create menus for ParaView GUI operations duplicating menus in pqMainWindow ParaView class
-  void                   pvCreateMenus();
+  void pvCreateMenus();
 
   //! Create toolbars for ParaView GUI operations duplicating toolbars in pqMainWindow ParaView class
-  void                   pvCreateToolBars();
+  void pvCreateToolBars();
 
   //! Create dock widgets for ParaView widgets
-  void                   setupDockWidgets();
+  void setupDockWidgets();
 
   //! Save states of dockable ParaView widgets
-  void                   saveDockWidgetsState();
+  void saveDockWidgetsState( bool = true );
 
   //! Restore states of dockable ParaView widgets
-  void                   restoreDockWidgetsState();
+  void restoreDockWidgetsState();
 
   //! Shows or hides ParaView view window
-  void                   showView( bool );    
-
-  //! Returns QMenu object for a given menu id
-  QMenu*                 getMenu( const int );
-  
-  //! Discover help project files from the resources.
-  QString getHelpFileName();
-
-  //! Create actions for ParaViS
-  void createActions();
-
-  //! Create menus for ParaViS
-  void createMenus();
-
-  //! Load selected state
-  void loadSelectedState(bool toClear);
+  void showView( bool );    
 
   //! Get list of embedded macros files
   QStringList getEmbeddedMacrosList();
@@ -227,42 +174,20 @@ private:
   //! restore visibility of the common dockable windows (OB, PyConsole, ... etc.)
   void restoreCommonWindowsState();
 
-  //! Connect to the external PVServer, using the PARAVIS engine to launch it if it is not
-  //! already up.
-  bool connectToExternalPVServer();
-
 private slots:
-
   void showHelpForProxy( const QString&, const QString& );
   
-  void onPreAccept();
-  void onPostAccept();
-  void endWaitCursor();
-
-  //  void buildToolbarsMenu();
+  void onPreAccept();    // not used inside PARAVIS
+  void onPostAccept();   // not used inside PARAVIS
+  void endWaitCursor();  // not used inside PARAVIS
 
-  //void showParaViewHelp();
-  //void showHelp(const QString& url);
-
-  void onFinishedAddingServer(pqServer*);
-  void onDataRepresentationCreated(pqDataRepresentation*);
   void onDataRepresentationUpdated();
-  void onVariableChanged(pqVariableType, const QString);
-  void onRepresentationChanged(pqRepresentation*);
 
   void onStartProgress();
   void onEndProgress();
   void onShowTrace();
   void onRestartTrace();
-
-  void onNewParaViewWindow();
-
-  void onSaveMultiState();
-  void onAddState();
-  void onCleanAddState();
-
-  void onRename();
-  void onDelete();
+  void onStopTrace();
 
 public slots:
   virtual bool           activateModule( SUIT_Study* );
@@ -271,17 +196,18 @@ public slots:
   virtual void           studyClosed( SUIT_Study* );
 
 protected slots:
-  virtual void           onModelOpened();
-  virtual void           onPushTraceTimer();
   virtual void           onInitTimer();
+  virtual void           onViewManagerAdded( SUIT_ViewManager* );
+  virtual void           onViewManagerRemoved( SUIT_ViewManager* );
+  virtual void           onPVViewCreated( SUIT_ViewWindow* );
+  virtual void           onPVViewDelete( SUIT_ViewWindow* );
 
 private:
-  int                    mySelectionControlsTb;
   int                    mySourcesMenuId;
   int                    myFiltersMenuId;
-  int                    myToolbarsMenuId;
   int                    myMacrosMenuId;
   int                    myRecentMenuId;
+  int                    myCatalystMenuId;
   
   typedef QMap<QWidget*, bool> WgMap;
   WgMap                  myDockWidgets;
@@ -291,26 +217,16 @@ private:
 
   typedef QMap<int, bool> DockWindowMap;         
   DockWindowMap           myCommonMap; 
+  QtMessageHandler        myOldMsgHandler;
 
-  QStringList            myTemporaryFiles;
-
-  QtMsgHandler           myOldMsgHandler;
-
-  vtkEventQtSlotConnect *VTKConnect;
-
-  static pqPVApplicationCore* MyCoreApp;
-  static PARAVIS_ORB::PARAVIS_Gen_var myEngine;
-
-
-  pqPythonScriptEditor* myTraceWindow;
+  vtkEventQtSlotConnect*  VTKConnect;
 
-  int myStateCounter;
+  pqPythonScriptEditor*   myTraceWindow;
 
   //! Single shot timer used to connect to the PVServer, and start the trace.
-  QTimer             * myInitTimer;
+  QTimer*                 myInitTimer;
 
-  //! Timer used to regularly push the Python trace to the engine.
-  QTimer             * myPushTraceTimer;
+  PVViewer_GUIElements*   myGuiElements;
 };
 
 #endif // PVGUI_Module_H