Back to index

salome-paravis  6.5.0
PVGUI_Module_actions.cxx
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_MenuActions.cxx
00022 // Author : Margarita KARPUNINA
00023 //
00024 
00025 #include "PVGUI_Module.h"
00026 
00027 #include <QtxAction.h>
00028 #include <QtxActionMenuMgr.h>
00029 #include <QtxActionToolMgr.h>
00030 #include <SUIT_Desktop.h>
00031 #include <SUIT_ResourceMgr.h>
00032 #include <SUIT_Session.h>
00033 #include <SalomeApp_Application.h>
00034 #include <LightApp_Application.h>
00035 
00036 #include <QAction>
00037 #include <QMenu>
00038 #include <QToolBar>
00039 #include <QFile>
00040 
00041 #include <pqApplicationCore.h>
00042 #include <pqColorScaleToolbar.h>
00043 #include <pqProgressManager.h>
00044 #include <pqRubberBandHelper.h>
00045 #include <pqScalarBarVisibilityAdaptor.h>
00046 #include <pqUndoStack.h>
00047 #include <pqVCRController.h>
00048 
00049 #include <pqSaveStateReaction.h>
00050 #include <pqLoadDataReaction.h>
00051 #include <pqLoadStateReaction.h>
00052 #include <pqSaveDataReaction.h>
00053 #include <pqSaveScreenshotReaction.h>
00054 #include <pqExportReaction.h>
00055 #include <pqSaveAnimationReaction.h>
00056 #include <pqSaveAnimationGeometryReaction.h>
00057 #include <pqServerConnectReaction.h>
00058 #include <pqServerDisconnectReaction.h>
00059 #include <pqCameraUndoRedoReaction.h>
00060 #include <pqUndoRedoReaction.h>
00061 #include <pqDeleteReaction.h>
00062 #include <pqChangePipelineInputReaction.h>
00063 #include <pqApplicationSettingsReaction.h>
00064 #include <pqViewSettingsReaction.h>
00065 #include <pqIgnoreSourceTimeReaction.h>
00066 #include <pqViewMenuManager.h>
00067 #include <pqParaViewMenuBuilders.h>
00068 #include <pqProxyGroupMenuManager.h>
00069 #include <pqCreateCustomFilterReaction.h>
00070 #include <pqManageLinksReaction.h>
00071 #include <pqManagePluginsReaction.h>
00072 #include <pqCameraLinkReaction.h>
00073 #include <pqManageCustomFiltersReaction.h>
00074 #include <pqSetName.h>
00075 #include <pqPythonShellReaction.h>
00076 #include <pqTimerLogReaction.h>
00077 #include <pqTestingReaction.h>
00078 #include <pqAboutDialogReaction.h>
00079 #include <pqHelpReaction.h>
00080 #include <pqViewManager.h>
00081 #include <pqDataQueryReaction.h>
00082 #include <pqRecentFilesMenu.h>
00083 
00084 #include "PVGUI_Tools.h"
00085 
00086 
00092 void PVGUI_Module::pvCreateActions()
00093 {
00094   SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
00095 
00096   QPixmap aPixmap;
00097   QAction* anAction;
00098   //QtxAction* aQtxAction;
00099   
00100   // --- Menu "File"
00101 
00102   // Open File
00103   aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_OPEN_FILE"), false );
00104   anAction = new QAction(QIcon(aPixmap), tr("MEN_OPEN_FILE"), this);
00105   anAction->setToolTip(tr("TOP_OPEN_FILE"));
00106   anAction->setStatusTip(tr("STB_OPEN_FILE"));
00107   registerAction(OpenFileId, anAction);
00108   new pqLoadDataReaction(anAction);
00109   
00110   // Load State
00111   anAction = new QAction(tr("MEN_LOAD_STATE"), this);
00112   anAction->setToolTip(tr("TOP_LOAD_STATE"));
00113   anAction->setStatusTip(tr("STB_LOAD_STATE"));
00114   registerAction(LoadStateId, anAction);
00115   new pqLoadStateReaction(anAction);
00116   
00117   // Save State
00118   anAction = new QAction(tr("MEN_SAVE_STATE"), this);
00119   anAction->setToolTip(tr("TOP_SAVE_STATE"));
00120   anAction->setStatusTip(tr("STB_SAVE_STATE"));
00121   registerAction(SaveStateId, anAction);
00122   new pqSaveStateReaction(anAction);
00123 
00124   // Save Data
00125   aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_SAVE_DATA"), false );
00126   anAction = new QAction(QIcon(aPixmap), tr("MEN_SAVE_DATA"), this);
00127   anAction->setToolTip(tr("TOP_SAVE_DATA"));
00128   anAction->setStatusTip(tr("STB_SAVE_DATA"));
00129   registerAction(SaveDataId, anAction);
00130   new pqSaveDataReaction(anAction);
00131 
00132   // Save Screenshot
00133   aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_SAVE_SCREENSHOT"), false );
00134   anAction = new QAction(QIcon(aPixmap), tr("MEN_SAVE_SCREENSHOT"), this);
00135   anAction->setToolTip(tr("TOP_SAVE_SCREENSHOT"));
00136   anAction->setStatusTip(tr("STB_SAVE_SCREENSHOT"));
00137   registerAction(SaveScreenshotId, anAction);
00138   new pqSaveScreenshotReaction(anAction);
00139 
00140   // Export
00141   anAction = new QAction(tr("MEN_EXPORT"), this);
00142   anAction->setToolTip(tr("TOP_EXPORT"));
00143   anAction->setStatusTip(tr("STB_EXPORT"));
00144   registerAction(ExportId, anAction);
00145   new pqExportReaction(anAction);
00146 
00147   // Save Animation
00148   aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_SAVE_ANIMATION"), false );
00149   anAction = new QAction(QIcon(aPixmap), tr("MEN_SAVE_ANIMATION"), this);
00150   anAction->setToolTip(tr("TOP_SAVE_ANIMATION"));
00151   anAction->setStatusTip(tr("STB_SAVE_ANIMATION"));
00152   registerAction(SaveAnimationId, anAction);
00153   new pqSaveAnimationReaction(anAction);
00154 
00155   // Save Geometry
00156   aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_SAVE_GEOMETRY"), false );
00157   anAction = new QAction(QIcon(aPixmap), tr("MEN_SAVE_GEOMETRY"), this);
00158   anAction->setToolTip(tr("TOP_SAVE_GEOMETRY"));
00159   anAction->setStatusTip(tr("STB_SAVE_GEOMETRY"));
00160   registerAction(SaveGeometryId, anAction);
00161   new pqSaveAnimationGeometryReaction(anAction);
00162 
00163   // Connect
00164   aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_CONNECT"), false );
00165   anAction = new QAction(QIcon(aPixmap), tr("MEN_CONNECT"), this);
00166   anAction->setToolTip(tr("TOP_CONNECT"));
00167   anAction->setStatusTip(tr("STB_CONNECT"));
00168   registerAction(ConnectId, anAction);
00169   new pqServerConnectReaction(anAction);
00170 
00171   // Disconnect
00172   aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_DISCONNECT"), false );
00173   anAction = new QAction(QIcon(aPixmap), tr("MEN_DISCONNECT"), this);
00174   anAction->setToolTip(tr("TOP_DISCONNECT"));
00175   anAction->setStatusTip(tr("STB_DISCONNECT"));
00176   registerAction(DisconnectId, anAction);
00177   new pqServerDisconnectReaction(anAction);
00178 
00179   // --- Menu "Edit"
00180 
00181   // Undo
00182   aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_UNDO"), false );
00183   anAction = new QAction(QIcon(aPixmap), tr("MEN_UNDO"), this);
00184   anAction->setToolTip(tr("TOP_UNDO"));
00185   anAction->setStatusTip(tr("STB_UNDO"));
00186   registerAction(UndoId, anAction);
00187   new pqUndoRedoReaction(anAction, true);
00188 
00189   // Redo
00190   aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_REDO"), false );
00191   anAction = new QAction(QIcon(aPixmap), tr("MEN_REDO"), this);
00192   anAction->setToolTip(tr("TOP_REDO"));
00193   anAction->setStatusTip(tr("STB_REDO"));
00194   registerAction(RedoId, anAction);
00195   new pqUndoRedoReaction(anAction, false);
00196 
00197   // Camera Undo
00198   aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_CAMERA_UNDO"), false );
00199   anAction = new QAction(QIcon(aPixmap), tr("MEN_CAMERA_UNDO"), this);
00200   anAction->setToolTip(tr("TOP_CAMERA_UNDO"));
00201   anAction->setStatusTip(tr("STB_CAMERA_UNDO"));
00202   registerAction(CameraUndoId, anAction);
00203   new pqCameraUndoRedoReaction(anAction, true);
00204   
00205   // Camera Redo
00206   aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_CAMERA_REDO"), false );
00207   anAction = new QAction(QIcon(aPixmap), tr("MEN_CAMERA_REDO"), this);
00208   anAction->setToolTip(tr("TOP_CAMERA_REDO"));
00209   anAction->setStatusTip(tr("STB_CAMERA_REDO"));
00210   registerAction(CameraRedoId, anAction);
00211   new pqCameraUndoRedoReaction(anAction, false);
00212 
00213   // Find Data
00214   anAction = new QAction(tr("MEN_FIND_DATA"), this);
00215   anAction->setToolTip("");
00216   anAction->setStatusTip("");
00217   registerAction(FindDataId, anAction);
00218   new pqDataQueryReaction(anAction);
00219   
00220   // Change Input
00221   anAction = new QAction(tr("MEN_CHANGE_INPUT"), this);
00222   anAction->setToolTip(tr("TOP_CHANGE_INPUT"));
00223   anAction->setStatusTip(tr("STB_CHANGE_INPUT"));
00224   registerAction(ChangeInputId, anAction);
00225   new pqChangePipelineInputReaction(anAction);
00226 
00227   // Ignore source time
00228   anAction = new QAction(tr("MEN_IGNORE_TIME"), this);
00229   anAction->setToolTip(tr("TOP_IGNORE_TIME"));
00230   anAction->setStatusTip(tr("STB_IGNORE_TIME"));
00231   anAction->setCheckable(true);
00232   registerAction(IgnoreTimeId, anAction);
00233   new pqIgnoreSourceTimeReaction(anAction);
00234 
00235   // Delete
00236   anAction = new QAction(tr("MEN_DELETE"), this);
00237   anAction->setToolTip(tr("TOP_DELETE"));
00238   anAction->setStatusTip(tr("STB_DELETE"));
00239   registerAction(DeleteId, anAction);
00240   new pqDeleteReaction(anAction);
00241 
00242   // Delete All
00243   anAction = new QAction(tr("MEN_DELETE_ALL"), this);
00244   anAction->setToolTip(tr("TOP_DELETE_ALL"));
00245   anAction->setStatusTip(tr("STB_DELETE_ALL"));
00246   registerAction(DeleteAllId, anAction);
00247   new pqDeleteReaction(anAction, true);
00248 
00249 
00250   // Setting
00251   /*anAction = new QAction(tr("MEN_SETTINGS"), this);
00252   anAction->setToolTip(tr("TOP_SETTINGS"));
00253   anAction->setStatusTip(tr("STB_SETTINGS"));
00254   registerAction(SettingsId, anAction);
00255   new pqApplicationSettingsReaction(anAction);*/
00256   
00257   // View Settings
00258   anAction = new QAction(tr("MEN_VIEW_SETTINGS"), this);
00259   anAction->setToolTip(tr("TOP_VIEW_SETTINGS"));
00260   anAction->setStatusTip(tr("STB_VIEW_SETTINGS"));
00261   registerAction(ViewSettingsId, anAction);
00262   new pqViewSettingsReaction(anAction);
00263 
00264   // --- Menu "View"
00265   //pqViewManager* viewManager = qobject_cast<pqViewManager*>(
00266   //                             pqApplicationCore::instance()->manager("MULTIVIEW_WIDGET"));
00267 
00268   //rnv: Commented to implement issue 
00269   //21318: EDF 1615 ALL: Display in full screen mode
00270   //Switching to the "Full screen" mode added in the SALOME GUI module.
00271   //if (viewManager) {
00272   //anAction = new QAction("Full Screen", this);
00273   //anAction->setObjectName("actionFullScreen");
00274   //anAction->setShortcut(QKeySequence("F11"));
00275   //connect(anAction, SIGNAL(triggered()), viewManager, SLOT(toggleFullScreen()));
00276   //registerAction(FullScreenId, anAction);
00277   //}
00278 
00279   // --- Menu "Tools"
00280   // Create Custom Filter
00281   anAction = new QAction(tr("MEN_CREATE_CUSTOM_FILTER"), this);
00282   anAction->setToolTip(tr("TOP_CREATE_CUSTOM_FILTER"));
00283   anAction->setStatusTip(tr("STB_CREATE_CUSTOM_FILTER"));
00284   registerAction(CreateCustomFilterId, anAction);
00285   new pqCreateCustomFilterReaction(anAction << pqSetName("actionToolsCreateCustomFilter"));
00286 
00287   // Manage Custom Filters
00288   anAction = new QAction(tr("MEN_MANAGE_CUSTOM_FILTERS"), this);
00289   anAction->setToolTip(tr("TOP_MANAGE_CUSTOM_FILTERS"));
00290   anAction->setStatusTip(tr("STB_MANAGE_CUSTOM_FILTERS"));
00291   registerAction(ManageCustomFiltersId, anAction);
00292   new pqManageCustomFiltersReaction(anAction << pqSetName("actionToolsManageCustomFilters"));
00293 
00294   // Manage Links
00295   anAction = new QAction(tr("MEN_MANAGE_LINKS"), this);
00296   anAction->setToolTip(tr("TOP_MANAGE_LINKS"));
00297   anAction->setStatusTip(tr("STB_MANAGE_LINKS"));
00298   registerAction(ManageLinksId, anAction);
00299   new pqManageLinksReaction(anAction << pqSetName("actionToolsManageLinks"));
00300 
00301   // Add Camera Link
00302   anAction = new QAction(tr("MEN_ADD_CAMERA_LINK"), this);
00303   anAction->setToolTip(tr("TOP_ADD_CAMERA_LINK"));
00304   anAction->setStatusTip(tr("STB_ADD_CAMERA_LINK"));
00305   registerAction(AddCameraLinkId, anAction);
00306   new pqCameraLinkReaction(anAction << pqSetName("actionToolsAddCameraLink"));
00307 
00308   // Manage Plugins/Extensions
00309   anAction = new QAction(tr("MEN_MANAGE_PLUGINS"), this);
00310   anAction->setToolTip(tr("TOP_MANAGE_PLUGINS"));
00311   anAction->setStatusTip(tr("STB_MANAGE_PLUGINS"));
00312   registerAction(ManagePluginsExtensionsId, anAction);
00313   new pqManagePluginsReaction(anAction << pqSetName("actionManage_Plugins"));
00314 
00315   // Record Test
00316   anAction = new QAction(tr("MEN_RECORD_TEST"), this);
00317   anAction->setToolTip(tr("TOP_RECORD_TEST"));
00318   anAction->setStatusTip(tr("STB_RECORD_TEST"));
00319   registerAction(RecordTestId, anAction);
00320   new pqTestingReaction(anAction << pqSetName("actionToolsRecordTest"), pqTestingReaction::RECORD);
00321 
00322   // Play Test
00323   anAction = new QAction(tr("MEN_PLAY_TEST"), this);
00324   anAction->setToolTip(tr("TOP_PLAY_TEST"));
00325   anAction->setStatusTip(tr("STB_PLAY_TEST"));
00326   registerAction(PlayTestId, anAction);
00327   new pqTestingReaction(anAction << pqSetName("actionToolsPlayTest"), pqTestingReaction::PLAYBACK);
00328 
00329   // Max Window Size
00330   anAction = new QAction(tr("MEN_MAX_WINDOW_SIZE"), this);
00331   anAction->setToolTip(tr("TOP_MAX_WINDOW_SIZE"));
00332   anAction->setStatusTip(tr("PRP_APP_MAX_WINDOW_SIZE"));
00333   anAction->setCheckable(true);
00334   registerAction(MaxWindowSizeId, anAction);
00335   new pqTestingReaction(anAction << pqSetName("actionTesting_Window_Size"),
00336                         pqTestingReaction::LOCK_VIEW_SIZE);
00337 
00338   // Custom Window Size
00339   anAction = new QAction(tr("MEN_CUSTOM_WINDOW_SIZE"), this);
00340   anAction->setToolTip(tr(""));
00341   anAction->setStatusTip(tr(""));
00342   anAction->setCheckable(true);
00343   registerAction(CustomWindowSizeId, anAction);
00344   new pqTestingReaction(anAction << pqSetName("actionTesting_Window_Size_Custom"),
00345                         pqTestingReaction::LOCK_VIEW_SIZE_CUSTOM);
00346 
00347   // Timer Log
00348   anAction = new QAction(tr("MEN_TIMER_LOG"), this);
00349   anAction->setToolTip(tr("TOP_TIMER_LOG"));
00350   anAction->setStatusTip(tr("STB_TIMER_LOG"));
00351   registerAction(TimerLogId, anAction);
00352   new pqTimerLogReaction(anAction << pqSetName("actionToolsTimerLog"));
00353 
00354   // Output Window
00355   anAction = new QAction(tr("MEN_OUTPUT_WINDOW"), this);
00356   anAction->setToolTip(tr("TOP_OUTPUT_WINDOW"));
00357   anAction->setStatusTip(tr("STB_OUTPUT_WINDOW"));
00358   registerAction(OutputWindowId, anAction);
00359   anAction << pqSetName("actionToolsOutputWindow");
00360   connect(anAction, SIGNAL(triggered()), pqApplicationCore::instance(), SLOT(showOutputWindow()));
00361   
00362  // Python Shell
00363   anAction = new QAction(tr("MEN_PYTHON_SHELL"), this);
00364   anAction->setToolTip(tr("TOP_PYTHON_SHELL"));
00365   anAction->setStatusTip(tr("STB_PYTHON_SHELL"));
00366   registerAction(PythonShellId, anAction);
00367   new pqPythonShellReaction(anAction << pqSetName("actionToolsPythonShell"));
00368 
00369   //Show Trace
00370   anAction = new QAction(tr("MEN_SHOW_TRACE"), this);
00371   anAction->setToolTip(tr("TOP_SHOW_TRACE"));
00372   anAction->setStatusTip(tr("STB_SHOW_TRACE"));
00373   connect(anAction, SIGNAL(triggered()), this, SLOT(onShowTrace()));
00374   registerAction(ShowTraceId, anAction);
00375 
00376   // --- Menu "Help"
00377 
00378   // About
00379   anAction = new QAction(tr("MEN_ABOUT"), this);
00380   anAction->setToolTip(tr("TOP_ABOUT"));
00381   anAction->setStatusTip(tr("STB_ABOUT"));
00382   registerAction(AboutParaViewId, anAction);
00383   new pqAboutDialogReaction(anAction << pqSetName("actionAbout"));
00384 
00385   // Native ParaView user documentation
00386   anAction = new QAction(tr("MEN_ABOUT"), this);
00387   registerAction(ParaViewHelpId, anAction);
00388   new pqHelpReaction(anAction);
00389   
00390   /*QString aFile = getHelpFileName();
00391   if (QFile::exists(aFile)) {
00392     aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_PARAVIEW_HELP"), false );
00393     anAction = new QAction(QIcon(aPixmap), tr("MEN_PARAVIEW_HELP"), this);
00394     anAction->setToolTip(tr("TOP_PARAVIEW_HELP"));
00395     anAction->setStatusTip(tr("STB_PARAVIEW_HELP"));
00396     anAction->setShortcut(QKeySequence::HelpContents);
00397     connect(anAction, SIGNAL(triggered()), this, SLOT(showParaViewHelp()));
00398     registerAction(ParaViewHelpId, anAction);
00399     }*/
00400 }
00401 
00410 void PVGUI_Module::pvCreateMenus()
00411 {
00412   SUIT_Desktop* desk = application()->desktop();
00413   
00414   // --- Menu "File"
00415   int aPVMnu = createMenu( tr( "MEN_DESK_FILE" ), -1, -1 );
00416 
00417   createMenu( OpenFileId, aPVMnu, 5 );
00418 
00419   // Recent Files
00420    myRecentMenuId = createMenu( tr( "MEN_RECENT_FILES" ), aPVMnu, -1, 5 );
00421    QMenu* aMenu = menuMgr()->findMenu( myRecentMenuId );
00422    pqRecentFilesMenu* aRecentFilesMenu = new pqRecentFilesMenu( *aMenu, getApp()->desktop() );
00423    QList<QAction*> anActns = aMenu->actions();
00424    for (int i = 0; i < anActns.size(); ++i) {
00425        createMenu( anActns.at(i), myRecentMenuId );
00426    }
00427 
00428 
00429   createMenu( separator(), aPVMnu, -1, 5 );
00430 
00431   createMenu( LoadStateId, aPVMnu, 15 );
00432   createMenu( SaveStateId, aPVMnu, 15 );
00433   createMenu( separator(), aPVMnu, -1, 15 );
00434 
00435   createMenu( SaveDataId, aPVMnu, 25 );
00436   createMenu( SaveScreenshotId, aPVMnu, 25 );
00437   createMenu( ExportId, aPVMnu, 25 );
00438   createMenu( separator(), aPVMnu, -1, 25 );
00439 
00440   createMenu( SaveAnimationId, aPVMnu, 35 );
00441   createMenu( SaveGeometryId, aPVMnu, 35 );
00442   createMenu( separator(), aPVMnu, -1, 35 );
00443 
00444   createMenu( ConnectId, aPVMnu, 45 );
00445   createMenu( DisconnectId, aPVMnu, 45 );
00446   createMenu( separator(), aPVMnu, -1, 45 );
00447 
00448   // --- Menu "Edit"
00449   aPVMnu = createMenu( tr( "MEN_DESK_EDIT" ), -1, -1 );
00450 
00451   createMenu( UndoId, aPVMnu );
00452   createMenu( RedoId, aPVMnu );
00453   createMenu( separator(), aPVMnu );
00454 
00455   createMenu( CameraUndoId, aPVMnu );
00456   createMenu( CameraRedoId, aPVMnu );
00457   createMenu( separator(), aPVMnu );
00458 
00459   createMenu( FindDataId, aPVMnu );
00460   createMenu( ChangeInputId, aPVMnu );
00461   createMenu( IgnoreTimeId, aPVMnu );
00462   createMenu( DeleteId, aPVMnu );
00463   createMenu( DeleteAllId, aPVMnu );
00464   createMenu( separator(), aPVMnu );
00465 
00466   //createMenu( SettingsId, aPVMnu );
00467   createMenu( ViewSettingsId, aPVMnu );
00468   createMenu( separator(), aPVMnu );
00469 
00470   // --- Menu "View"
00471   aPVMnu = createMenu( tr( "MEN_DESK_VIEW" ), -1, -1 );
00472   /*myToolbarsMenuId = createMenu( "Toolbars", aPVMnu );
00473   aMenu = getMenu( myToolbarsMenuId );
00474   if (aMenu) {
00475     buildToolbarsMenu();
00476     connect(aMenu, SIGNAL(aboutToShow()), this, SLOT(buildToolbarsMenu()));
00477   }
00478   createMenu( separator(), aPVMnu );*/
00479 
00480   createMenu( FullScreenId, aPVMnu );
00481   
00482   // --- Menu "Sources"
00483 
00484   // Install ParaView managers for "Sources" menu
00485   QMenu* aRes = 0;
00486   mySourcesMenuId = createMenu( tr( "MEN_DESK_SOURCES" ), -1, -1, 60);
00487   if ( (aRes = getMenu( mySourcesMenuId )) ) {
00488     pqParaViewMenuBuilders::buildSourcesMenu(*aRes, desk);
00489   }
00490   
00491   // --- Menu "Filters"
00492 
00493   // Install ParaView managers for "Filters" menu
00494   myFiltersMenuId = createMenu( tr( "MEN_DESK_FILTERS" ), -1, -1, 70 );
00495   if ( (aRes = getMenu( myFiltersMenuId )) ) {
00496     pqParaViewMenuBuilders::buildFiltersMenu(*aRes, desk);
00497   }
00498 
00499    // --- Menu "Macros"
00500   myMacrosMenuId = createMenu( tr( "MEN_MACROS" ), -1, -1, 80 );
00501   if ( (aRes = getMenu( myMacrosMenuId )) ) {
00502     pqParaViewMenuBuilders::buildMacrosMenu(*aRes);
00503   }
00504  
00505   // --- Menu "Tools"
00506 
00507   int aToolsMnu = createMenu( tr( "MEN_DESK_TOOLS" ), -1, -1, 90 );
00508 
00509   createMenu( CreateCustomFilterId, aToolsMnu );
00510   createMenu( AddCameraLinkId, aToolsMnu );
00511   createMenu( separator(), aToolsMnu );
00512   createMenu( ManageCustomFiltersId, aToolsMnu );
00513   createMenu( ManageLinksId, aToolsMnu );
00514   createMenu( ManagePluginsExtensionsId, aToolsMnu );
00515   createMenu( separator(), aToolsMnu );
00516 
00517   createMenu( RecordTestId, aToolsMnu );
00518   createMenu( PlayTestId, aToolsMnu );
00519   createMenu( MaxWindowSizeId, aToolsMnu );
00520   createMenu( CustomWindowSizeId, aToolsMnu );
00521   createMenu( separator(), aToolsMnu );
00522 
00523   createMenu( TimerLogId, aToolsMnu );
00524   createMenu( OutputWindowId, aToolsMnu );
00525   createMenu( separator(), aToolsMnu );
00526 
00527   createMenu( PythonShellId, aToolsMnu );
00528   createMenu( separator(), aToolsMnu );
00529   createMenu( ShowTraceId, aToolsMnu );
00530 
00531   // --- Menu "Help"
00532 
00533   int aHelpMnu = createMenu( tr( "MEN_DESK_HELP" ), -1, -1 );
00534   createMenu( AboutParaViewId, aHelpMnu );
00535 
00536   int aHelpModule = createMenu( LightApp_Application::tr( "MEN_DESK_MODULE_HELP" ), aHelpMnu, -1 );
00537   createMenu( ParaViewHelpId, aHelpModule );
00538 }
00539 
00544 void PVGUI_Module::pvCreateToolBars()
00545 {
00546   SUIT_Desktop* desk = application()->desktop();
00547   pqParaViewMenuBuilders::buildToolbars(*desk);
00548 }
00549 
00553 QMenu* PVGUI_Module::getMenu( const int id )
00554 {
00555   QMenu* res = 0;
00556   SalomeApp_Application* anApp = getApp();
00557   SUIT_Desktop* desk = anApp->desktop();
00558   if ( desk ){
00559     QtxActionMenuMgr* menuMgr = desk->menuMgr();
00560     res = menuMgr->findMenu( id );
00561   }
00562   return res;
00563 }
00564 
00568 /*QList<QToolBar*> PVGUI_Module::getParaViewToolbars()
00569 {
00570   QList<QToolBar*> all_toolbars = application()->desktop()->findChildren<QToolBar*>();
00571   // First two toolbars has to be ignored because they are not from ParaView
00572   if (all_toolbars.size() > 2) {
00573     all_toolbars.removeFirst();
00574     all_toolbars.removeFirst();
00575   }
00576   return all_toolbars;
00577   }*/
00578 
00579 
00580 
00584 /*void PVGUI_Module::buildToolbarsMenu()
00585 {
00586   SUIT_Desktop* desk = application()->desktop();
00587   QMenu* aMenu = menuMgr()->findMenu( myToolbarsMenuId );
00588   if (aMenu) {
00589     aMenu->clear();
00590     QList<QMenu*> child_menus = aMenu->findChildren<QMenu*>();
00591     foreach (QMenu* menu, child_menus) {
00592       delete menu;
00593     }
00594     QList<QToolBar*> all_toolbars = getParaViewToolbars();
00595 
00596     // Add menus for all toolbars and actions from them.
00597     // This puts menu actions for all toolbars making it possible to access all
00598     // toolbar actions even when the toolbar are not visible.
00599     // I wonder if I should ignore the pqMainControlsToolbar since those actions
00600     // are already placed at other places.
00601     foreach (QToolBar* toolbar, all_toolbars) {
00602       QMenu* sub_menu = new QMenu(aMenu) << pqSetName(toolbar->windowTitle());
00603       bool added = false;
00604       foreach (QAction* action, toolbar->actions()) {
00605         if (!action->text().isEmpty()) {
00606           added = true;
00607           sub_menu->addAction(action);
00608         }
00609       }
00610       if (added) {
00611         QAction* menu_action = aMenu->addMenu(sub_menu);
00612         menu_action->setText(toolbar->windowTitle());
00613       } else {
00614         delete sub_menu;
00615       }
00616     }
00617     disconnect(aMenu, SIGNAL(aboutToShow()), this, SLOT(buildToolbarsMenu()));
00618   }
00619   }*/
00620 
00624 void PVGUI_Module::createActions()
00625 {
00626   QAction* anAction;
00627 
00628   // New ParaView window
00629   anAction = new QtxAction(tr("MEN_NEW_PV_VIEW"), tr("MEN_NEW_PV_VIEW"), 0, 
00630                         this, false, "ParaViS:Create new ParaView view");
00631   connect(anAction, SIGNAL(triggered()), this, SLOT(onNewParaViewWindow()));
00632   registerAction(ParaViewNewWindowId, anAction);
00633 
00634   // Save state under the module root object
00635   anAction = new QAction(tr("MEN_SAVE_MULTI_STATE"), this);
00636   connect(anAction, SIGNAL(triggered()), this, SLOT(onSaveMultiState()));
00637   registerAction(SaveStatePopupId, anAction);
00638 
00639   // Restore the selected state by merging with the current one
00640   anAction = new QAction(tr("MEN_ADD_STATE"), this);
00641   connect(anAction, SIGNAL(triggered()), this, SLOT(onAddState()));
00642   registerAction(AddStatePopupId, anAction);
00643 
00644   // Clean the current state and restore the selected one
00645   anAction = new QAction(tr("MEN_CLEAN_ADD_STATE"), this);
00646   connect(anAction, SIGNAL(triggered()), this, SLOT(onCleanAddState()));
00647   registerAction(CleanAndAddStatePopupId, anAction);
00648 
00649   // Rename the selected object (Object Browser)
00650   anAction = new QAction(tr("MEN_PARAVIS_RENAME"), this);
00651   connect(anAction, SIGNAL(triggered()), this, SLOT(onRename()));
00652   registerAction(ParaVisRenameId, anAction);
00653 
00654   // Delete the selected object (Object Browser)
00655   anAction = new QAction(tr("MEN_PARAVIS_DELETE"), this);
00656   connect(anAction, SIGNAL(triggered()), this, SLOT(onDelete()));
00657   registerAction(ParaVisDeleteId, anAction);
00658 }
00659 
00663 void PVGUI_Module::createMenus()
00664 {
00665   // "Window" - "New Window" - "ParaView view" menu
00666   int aWindowMenu = createMenu(tr( "MEN_DESK_WINDOW" ), -1, -1);
00667   int aNewWindowMenu = createMenu(tr( "MEN_DESK_NEWWINDOW"), aWindowMenu, -1, -1);
00668   createMenu(ParaViewNewWindowId, aNewWindowMenu);
00669 }