From: san Date: Mon, 24 Nov 2008 17:22:36 +0000 (+0000) Subject: ParaView menu managers X-Git-Tag: PARAVIS_TEST~12 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7592c2fc79cd8242074a503ba43f7257a75d9cf5;p=modules%2Fparavis.git ParaView menu managers Basic plugin test --- diff --git a/src/PVGUI/PVGUI_Module.cxx b/src/PVGUI/PVGUI_Module.cxx index 9cdc4c1b..4826000e 100644 --- a/src/PVGUI/PVGUI_Module.cxx +++ b/src/PVGUI/PVGUI_Module.cxx @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -367,7 +368,7 @@ void PVGUI_Module::showView( bool toShow ) SUIT_ViewWindow* wnd = viewMgr->createViewWindow(); // Simulate ParaView client main window - Implementation = new pqImplementation( wnd ); + Implementation = new pqImplementation( anApp->desktop() ); PVGUI_ViewWindow* pvWnd = dynamic_cast( wnd ); pvWnd->setMultiViewManager( &Implementation->Core.multiViewManager() ); @@ -378,19 +379,45 @@ void PVGUI_Module::showView( bool toShow ) /*! \brief Create actions for ParaView GUI operations - duplicating menus and toolbars in pqMainWindow ParaView class + duplicating menus and toolbars in MainWindow class of + the standard ParaView GUI client application. + + In particular, ParaView is responsible for updating "Sources" and "Filters" menus. + For this, specific menu managers created by pqMainWindowCore class are used, and PVGUI_Module + is responsible for creation of corresponding QMenu objects only. */ void PVGUI_Module::pvCreateActions() { // TODO... SUIT_Desktop* desk = application()->desktop(); - // TEST + // Manage plug-ins int actionManagePlugins = 999; createAction( actionManagePlugins, tr( "TOP_MANAGE_PLUGINS" ), QIcon(), tr( "MEN_MANAGE_PLUGINS" ), tr( "STB_MANAGE_PLUGINS" ), 0, desk, false, &Implementation->Core, SLOT( onManagePlugins() ) ); - int aPVMnu = createMenu( tr( "MEN_TEST_PARAVIEW" ), -1, -1, 50 ); + int aPVMnu = createMenu( tr( "MEN_TOOLS" ), -1, -1, 50 ); createMenu( actionManagePlugins, aPVMnu, 10 ); + + // Install ParaView managers for "Sources" and "Filters" menus + QMenu* res = 0; + aPVMnu = createMenu( tr( "Sources" ), -1, -1, 60 ); + res = getMenu( aPVMnu ); + if ( res ){ + Implementation->Core.setSourceMenu( res ); + connect(&this->Implementation->Core, + SIGNAL(enableSourceCreate(bool)), + res, + SLOT(setEnabled(bool))); + } + aPVMnu = createMenu( tr( "Filters" ), -1, -1, 70 ); + res = getMenu( aPVMnu ); + if ( res ){ + Implementation->Core.setFilterMenu( res ); + connect(&this->Implementation->Core, + SIGNAL(enableFilterCreate(bool)), + res, + SLOT(setEnabled(bool))); + } } @@ -412,6 +439,17 @@ pqViewManager* PVGUI_Module::getMultiViewManager() const return aMVM; } +QMenu* PVGUI_Module::getMenu( const int id ) +{ + QMenu* res = 0; + LightApp_Application* anApp = getApp(); + SUIT_Desktop* desk = anApp->desktop(); + if ( desk ){ + QtxActionMenuMgr* menuMgr = desk->menuMgr(); + res = menuMgr->findMenu( id ); + } + return res; +} /*! \brief Activate module. diff --git a/src/PVGUI/PVGUI_Module.h b/src/PVGUI/PVGUI_Module.h index 3b9de145..48a805cb 100644 --- a/src/PVGUI/PVGUI_Module.h +++ b/src/PVGUI/PVGUI_Module.h @@ -82,7 +82,10 @@ private: void setupDockWidgets(); //! Shows or hides ParaView view window - void showView( bool ); + void showView( bool ); + + //! Returns QMenu object for a given menu id + QMenu* getMenu( const int ); public slots: virtual bool activateModule( SUIT_Study* ); diff --git a/src/PVGUI/PVGUI_ViewWindow.cxx b/src/PVGUI/PVGUI_ViewWindow.cxx index b186eeef..51ec369e 100644 --- a/src/PVGUI/PVGUI_ViewWindow.cxx +++ b/src/PVGUI/PVGUI_ViewWindow.cxx @@ -90,6 +90,8 @@ void PVGUI_ViewWindow::setMultiViewManager( pqViewManager* viewMgr ) { myPVMgr = viewMgr; myPVMgr->setParent( this ); + // This is mandatory, see setParent() documentation + myPVMgr->show(); setCentralWidget( myPVMgr ); myPVMgr->installEventFilter( this ); } diff --git a/src/PVGUI/resources/PARAVIS_msg_en.ts b/src/PVGUI/resources/PARAVIS_msg_en.ts index eb885a42..b981aaf8 100644 --- a/src/PVGUI/resources/PARAVIS_msg_en.ts +++ b/src/PVGUI/resources/PARAVIS_msg_en.ts @@ -159,30 +159,14 @@ - LIGHTGUI + PVGUI_Module - LIGHTGUI_ADD_LINE - Add new line before the selected one + MEN_TOOLS + Tools - LIGHTGUI_MEN_DUMP - Dump - - - LIGHTGUI_MEN_LOAD - Load - - - LIGHTGUI_MEN_TXT_FILES - Text Files ( *.txt ) - - - LIGHTGUI_EDIT_LINE - Edit selected line - - - LIGHTGUI_MEN_ALL_FILES - All Files ( * ) + MEN_MANAGE_PLUGINS + Manage plug-ins...