X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPVGUI%2FPVGUI_Module.h;h=bbeed82bdc63333b3f7fee268c1a9664b53d2809;hb=8c63a38303474ce53194ae7b312ef70f3b3daa9f;hp=dad5800a96f646fbd797c995acd760ac49d99af3;hpb=45730a713833b123768d9e895d06ffd86bca71d0;p=modules%2Fparavis.git diff --git a/src/PVGUI/PVGUI_Module.h b/src/PVGUI/PVGUI_Module.h index dad5800a..bbeed82b 100644 --- a/src/PVGUI/PVGUI_Module.h +++ b/src/PVGUI/PVGUI_Module.h @@ -1,12 +1,11 @@ // PARAVIS : ParaView wrapper SALOME module // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2010-2016 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 // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -20,232 +19,217 @@ // 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 - -#include +#include class QMenu; -class QDockWidget; -class QToolBar; -class vtkPVMain; -class pqOptions; +class QTimer; +class vtkEventQtSlotConnect; class pqServer; -class pqViewManager; -class pqMainWindowCore; +class pqPythonScriptEditor; +class pqPVApplicationCore; +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, - - ChangeInputId, - IgnoreTimeId, - DeleteId, - DeleteAllId, - - //InteractId, - //SelectCellsOnId, - //SelectPointsOnId, - //SelectCellsThroughId, - //SelectPointsThroughId, - //SelectBlockId, - - SettingsId, - ViewSettingsId, - - // Menu "View" - FullScreenId, -// ResetCameraId, -// PositiveXId, -// NegativeXId, -// PositiveYId, -// NegativeYId, -// PositiveZId, -// NegativeZId, -// -// ShowCenterId, -// ResetCenterId, -// PickCenterId, -// ShowColorLegendId, -// EditColorMapId, -// ResetRangeId, -// -// AnimationInspectorId, -// AnimationViewId, -// ComparativeViewInspectorId, -// SelectionInspectorId, -// LookmarkBrowserId, -// LookmarkInspectorId, -// ObjectInspectorId, -// PipelineBrowserId, -// StatisticsViewId, - - // Menu "Sources" - // TODO... - - // Menu "Filters" - // TODO... - - // Menu "Animation" - FirstFrameId, - PreviousFrameId, - PlayId, - NextFrameId, - LastFrameId, - LoopId, - - // Menu "Tools" - CreateCustomFilterId, - ManageCustomFiltersId, - CreateLookmarkId, - ManageLinksId, - AddCameraLinkId, - ManagePluginsExtensionsId, - DumpWidgetNamesId, - RecordTestId, - RecordTestScreenshotId, - PlayTestId, - MaxWindowSizeId, - TimerLogId, - OutputWindowId, - PythonShellId, - - // Menu "Help" - AboutParaViewId, - ParaViewHelpId, - EnableTooltipsId + 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, + OutputWindowId, + PythonShellId, + ShowTraceId, + RestartTraceId, + //----------- + // Menu "Help" + AboutParaViewId, + ParaViewHelpId, + EnableTooltipsId, // not used }; public: PVGUI_Module(); ~PVGUI_Module(); - virtual void initialize( CAM_Application* ); - virtual void windows( QMap& ) const; - - pqViewManager* getMultiViewManager() const; - - virtual QString engineIOR() const; + virtual void initialize( CAM_Application* ); + virtual void windows( QMap& ) const; - /*! Compares the contents of the window with the given reference image, - * returns true if they "match" within some tolerance - */ - /*bool compareView( const QString& ReferenceImage, double Threshold, - std::ostream& Output, const QString& TempDirectory );*/ + void openFile( const char* ); // not used inside PARAVIS + void executeScript( const char* ); // not used inside PARAVIS - void openFile(const char* theName); - void saveParaviewState(const char* theFileName); - void loadParaviewState(const char* theFileName); + void saveParaviewState( const QString& ); + void loadParaviewState( const QString& ); + void clearParaviewState(); QString getTraceString(); - void saveTrace(const char* theName); + void startTrace(); + void stopTrace(); + void saveTrace( const char* ); pqServer* getActiveServer(); virtual void createPreferences(); -public slots: - void onImportFromVisu(QString theEntry); + inline static PVServer_ServiceWrapper* GetEngine(); + inline static pqPVApplicationCore* GetPVApplication(); // not used inside PARAVIS + + virtual CAM_DataModel* createDataModel(); private: - //! 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 ); + void showView( bool ); - //! Returns QMenu object for a given menu id - QMenu* getMenu( const int ); + //! Get list of embedded macros files + QStringList getEmbeddedMacrosList(); - void deleteTemporaryFiles(); - - QList getParaViewToolbars(); + //! update macros state + void updateMacros(); -private slots: + //! store visibility of the common dockable windows (OB, PyConsole, ... etc.) + void storeCommonWindowsState(); - void showHelpForProxy( const QString& proxy ); - - void onPreAccept(); - void onPostAccept(); - void endWaitCursor(); + //! restore visibility of the common dockable windows (OB, PyConsole, ... etc.) + void restoreCommonWindowsState(); - void activateTrace(); +private slots: + void showHelpForProxy( const QString&, const QString& ); + + void onPreAccept(); // not used inside PARAVIS + void onPostAccept(); // not used inside PARAVIS + void endWaitCursor(); // not used inside PARAVIS - void buildToolbarsMenu(); + void onDataRepresentationUpdated(); - void showParaViewHelp(); - void showHelp(const QString& url); + void onStartProgress(); + void onEndProgress(); + void onShowTrace(); + void onRestartTrace(); + void onStopTrace(); public slots: virtual bool activateModule( SUIT_Study* ); virtual bool deactivateModule( SUIT_Study* ); virtual void onApplicationClosed( SUIT_Application* ); + virtual void studyClosed( SUIT_Study* ); -private: - class pqImplementation; - pqImplementation* Implementation; +protected slots: + virtual void onInitTimer(); + virtual void onViewManagerAdded( SUIT_ViewManager* ); + virtual void onViewManagerRemoved( SUIT_ViewManager* ); + virtual void onPVViewCreated( SUIT_ViewWindow* ); + virtual void onPVViewDelete( SUIT_ViewWindow* ); - int mySelectionControlsTb; +private: int mySourcesMenuId; int myFiltersMenuId; - int myToolbarsMenuId; int myMacrosMenuId; - - QList myDockWidgets; - - QStringList myTemporaryFiles; - - QMap myToolbarState; - - QtMsgHandler myOldMsgHandler; + int myRecentMenuId; + + typedef QMap WgMap; + WgMap myDockWidgets; + WgMap myToolbars; + WgMap myToolbarBreaks; + QList myMenus; + + typedef QMap DockWindowMap; + DockWindowMap myCommonMap; +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) + QtMsgHandler myOldMsgHandler; +#else + QtMessageHandler myOldMsgHandler; +#endif + vtkEventQtSlotConnect* VTKConnect; + + pqPythonScriptEditor* myTraceWindow; + + //! Single shot timer used to connect to the PVServer, and start the trace. + QTimer* myInitTimer; + + PVViewer_GUIElements* myGuiElements; }; #endif // PVGUI_Module_H