X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPVGUI%2FPVGUI_Module.h;h=0b30e767f72741eb8006aa13d4bc198d7a372652;hb=2323d9818282b17d8c199c6c807db387513e58ac;hp=6e562fe09fc62d0c87f077e4dfad289a551dc406;hpb=3a58e6c4d5232c6f059162bf179695c720e00fb6;p=modules%2Fparavis.git diff --git a/src/PVGUI/PVGUI_Module.h b/src/PVGUI/PVGUI_Module.h index 6e562fe0..0b30e767 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-2014 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 @@ -23,33 +22,119 @@ // Author : Sergey ANIKIN // + #ifndef PVGUI_Module_H #define PVGUI_Module_H -#include +#include + +#include +#include + +#include class QMenu; -class LightApp_Selection; -class LightApp_SelectionMgr; -class PVGUI_ProcessModuleHelper; +class QDockWidget; +class QToolBar; class vtkPVMain; class pqOptions; +class pqServer; +class pqTabbedMultiViewWidget; +class pqMainWindowCore; +class vtkEventQtSlotConnect; +class pqPythonScriptEditor; +class pqPVApplicationCore; +class pqDataRepresentation; +class pqRepresentation; + +class PyConsole_Interp; -class PVGUI_Module: public LightApp_Module +class PVGUI_Module : public SalomeApp_Module { Q_OBJECT //! Menu actions - /*enum { - lgLoadFile = 931, //!< load text file - lgSaveFile, //!< save text file - lgDisplayLine, //!< display selected line - lgEraseLine, //!< erase selected line - lgEditLine, //!< edit selected line - lgAddLine, //!< insert new line - lgDelLine, //!< delete selected line - lgClear //!< clear all contents - };*/ + 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 + }; public: PVGUI_Module(); @@ -58,32 +143,163 @@ public: virtual void initialize( CAM_Application* ); virtual void windows( QMap& ) const; - //virtual LightApp_Selection* createSelection() const; + pqTabbedMultiViewWidget* getMultiViewManager() const; -protected: - //virtual CAM_DataModel* createDataModel(); + 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 clearParaviewState(); + + QString getTraceString(); + void saveTrace(const char* theName); + + pqServer* getActiveServer(); + + virtual void createPreferences(); + + virtual void contextMenuPopup(const QString& theClient, QMenu* theMenu, QString& theTitle); + +public slots: + void onImportFromVisu(QString theEntry); private: //! Initialize ParaView if not yet done (once per session) static bool pvInit(); - //! Shutdown ParaView, should be called on application exit - static void pvShutdown(); //! Create actions for ParaView GUI operations - //! duplicating menus and toolbars in pqMainWindow ParaView class - void pvCreateActions(); + void pvCreateActions(); + + //! Create menus for ParaView GUI operations duplicating menus in pqMainWindow ParaView class + void pvCreateMenus(); + + //! Create toolbars for ParaView GUI operations duplicating toolbars in pqMainWindow ParaView class + void pvCreateToolBars(); + + //! Create dock widgets for ParaView widgets + void setupDockWidgets(); + + //! Save states of dockable ParaView widgets + void saveDockWidgetsState(); + + //! Restore states of dockable ParaView widgets + 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 ); + + //! Discover help project files from the resources. + QString getHelpFileName(); + + void deleteTemporaryFiles(); + + //QList getParaViewToolbars(); + + //! Create actions for ParaViS + void createActions(); + + //! Create menus for ParaViS + void createMenus(); + + //! Load selected state + void loadSelectedState(bool toClear); + + //! Get list of embedded macros files + QStringList getEmbeddedMacrosList(); + + //! update macros state + void updateMacros(); + + //! store visibility of the common dockable windows (OB, PyConsole, ... etc.) + void storeCommonWindowsState(); + + //! restore visibility of the common dockable windows (OB, PyConsole, ... etc.) + void restoreCommonWindowsState(); + + //! run Python command (either in SALOME's Python interpreter, or in ParaView's Python's interpreter) + void execPythonCommand(const QString& cmd, bool inSalomeConsole=false); + +private slots: + + void showHelpForProxy( const QString&, const QString& ); + + void onPreAccept(); + void onPostAccept(); + void endWaitCursor(); + + // void buildToolbarsMenu(); + + //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(); public slots: virtual bool activateModule( SUIT_Study* ); virtual bool deactivateModule( SUIT_Study* ); + virtual void onApplicationClosed( SUIT_Application* ); + virtual void studyClosed( SUIT_Study* ); + +protected slots: + virtual void onModelOpened(); + +protected: + void timerEvent(QTimerEvent *event); private: - static vtkPVMain* myPVMain; - static pqOptions* myPVOptions; - static PVGUI_ProcessModuleHelper* myPVHelper; + class pqImplementation; + pqImplementation* Implementation; + + int mySelectionControlsTb; + int mySourcesMenuId; + int myFiltersMenuId; + int myToolbarsMenuId; + int myMacrosMenuId; + int myRecentMenuId; + + typedef QMap WgMap; + WgMap myDockWidgets; + WgMap myToolbars; + WgMap myToolbarBreaks; + QList myMenus; + + typedef QMap DockWindowMap; + DockWindowMap myCommonMap; + + QStringList myTemporaryFiles; + + QtMsgHandler myOldMsgHandler; + + vtkEventQtSlotConnect *VTKConnect; + + pqPythonScriptEditor* myTraceWindow; + + int myStateCounter; + + static pqPVApplicationCore* MyCoreApp; }; #endif // PVGUI_Module_H