1 // PARAVIS : ParaView wrapper SALOME module
3 // Copyright (C) 2010-2014 CEA/DEN, EDF R&D
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 // File : PVGUI_Module_MenuActions.cxx
22 // Author : Margarita KARPUNINA
25 #include "PVGUI_Module.h"
27 #include <QtxAction.h>
28 #include <QtxActionMenuMgr.h>
29 #include <QtxActionToolMgr.h>
30 #include <SUIT_Desktop.h>
31 #include <SUIT_ResourceMgr.h>
32 #include <SUIT_Session.h>
33 #include <SalomeApp_Application.h>
34 #include <LightApp_Application.h>
41 #include <pqApplicationCore.h>
42 #include <pqColorScaleToolbar.h>
43 #include <pqProgressManager.h>
44 #include <pqRubberBandHelper.h>
45 #include <pqScalarBarVisibilityAdaptor.h>
46 #include <pqUndoStack.h>
47 #include <pqVCRController.h>
49 #include <pqSaveStateReaction.h>
50 #include <pqLoadDataReaction.h>
51 #include <pqLoadStateReaction.h>
52 #include <pqSaveDataReaction.h>
53 #include <pqSaveScreenshotReaction.h>
54 #include <pqExportReaction.h>
55 #include <pqSaveAnimationReaction.h>
56 #include <pqSaveAnimationGeometryReaction.h>
57 #include <pqServerConnectReaction.h>
58 #include <pqServerDisconnectReaction.h>
59 #include <pqCameraUndoRedoReaction.h>
60 #include <pqUndoRedoReaction.h>
61 #include <pqDeleteReaction.h>
62 #include <pqChangePipelineInputReaction.h>
63 #include <pqApplicationSettingsReaction.h>
64 #include <pqViewSettingsReaction.h>
65 #include <pqIgnoreSourceTimeReaction.h>
66 #include <pqViewMenuManager.h>
67 #include <pqParaViewMenuBuilders.h>
68 #include <pqProxyGroupMenuManager.h>
69 #include <pqCreateCustomFilterReaction.h>
70 #include <pqManageLinksReaction.h>
71 #include <pqManagePluginsReaction.h>
72 #include <pqCameraLinkReaction.h>
73 #include <pqManageCustomFiltersReaction.h>
74 #include <pqSetName.h>
75 #include <pqPythonShellReaction.h>
76 #include <pqTimerLogReaction.h>
77 #include <pqTestingReaction.h>
78 #include <pqAboutDialogReaction.h>
79 #include <pqHelpReaction.h>
80 #include <pqViewManager.h>
81 #include <pqDataQueryReaction.h>
82 #include <pqRecentFilesMenu.h>
84 #include "PVGUI_Tools.h"
88 \brief Create actions for ParaView GUI operations
89 duplicating menus and toolbars in MainWindow class of
90 the standard ParaView GUI client application.
92 void PVGUI_Module::pvCreateActions()
94 SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
98 //QtxAction* aQtxAction;
103 aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_OPEN_FILE"), false );
104 anAction = new QAction(QIcon(aPixmap), tr("MEN_OPEN_FILE"), this);
105 anAction->setToolTip(tr("TOP_OPEN_FILE"));
106 anAction->setStatusTip(tr("STB_OPEN_FILE"));
107 registerAction(OpenFileId, anAction);
108 new pqLoadDataReaction(anAction);
111 anAction = new QAction(tr("MEN_LOAD_STATE"), this);
112 anAction->setToolTip(tr("TOP_LOAD_STATE"));
113 anAction->setStatusTip(tr("STB_LOAD_STATE"));
114 registerAction(LoadStateId, anAction);
115 new pqLoadStateReaction(anAction);
118 anAction = new QAction(tr("MEN_SAVE_STATE"), this);
119 anAction->setToolTip(tr("TOP_SAVE_STATE"));
120 anAction->setStatusTip(tr("STB_SAVE_STATE"));
121 registerAction(SaveStateId, anAction);
122 new pqSaveStateReaction(anAction);
125 aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_SAVE_DATA"), false );
126 anAction = new QAction(QIcon(aPixmap), tr("MEN_SAVE_DATA"), this);
127 anAction->setToolTip(tr("TOP_SAVE_DATA"));
128 anAction->setStatusTip(tr("STB_SAVE_DATA"));
129 registerAction(SaveDataId, anAction);
130 new pqSaveDataReaction(anAction);
133 aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_SAVE_SCREENSHOT"), false );
134 anAction = new QAction(QIcon(aPixmap), tr("MEN_SAVE_SCREENSHOT"), this);
135 anAction->setToolTip(tr("TOP_SAVE_SCREENSHOT"));
136 anAction->setStatusTip(tr("STB_SAVE_SCREENSHOT"));
137 registerAction(SaveScreenshotId, anAction);
138 new pqSaveScreenshotReaction(anAction);
141 anAction = new QAction(tr("MEN_EXPORT"), this);
142 anAction->setToolTip(tr("TOP_EXPORT"));
143 anAction->setStatusTip(tr("STB_EXPORT"));
144 registerAction(ExportId, anAction);
145 new pqExportReaction(anAction);
148 aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_SAVE_ANIMATION"), false );
149 anAction = new QAction(QIcon(aPixmap), tr("MEN_SAVE_ANIMATION"), this);
150 anAction->setToolTip(tr("TOP_SAVE_ANIMATION"));
151 anAction->setStatusTip(tr("STB_SAVE_ANIMATION"));
152 registerAction(SaveAnimationId, anAction);
153 new pqSaveAnimationReaction(anAction);
156 aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_SAVE_GEOMETRY"), false );
157 anAction = new QAction(QIcon(aPixmap), tr("MEN_SAVE_GEOMETRY"), this);
158 anAction->setToolTip(tr("TOP_SAVE_GEOMETRY"));
159 anAction->setStatusTip(tr("STB_SAVE_GEOMETRY"));
160 registerAction(SaveGeometryId, anAction);
161 new pqSaveAnimationGeometryReaction(anAction);
164 aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_CONNECT"), false );
165 anAction = new QAction(QIcon(aPixmap), tr("MEN_CONNECT"), this);
166 anAction->setToolTip(tr("TOP_CONNECT"));
167 anAction->setStatusTip(tr("STB_CONNECT"));
168 registerAction(ConnectId, anAction);
169 new pqServerConnectReaction(anAction);
172 aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_DISCONNECT"), false );
173 anAction = new QAction(QIcon(aPixmap), tr("MEN_DISCONNECT"), this);
174 anAction->setToolTip(tr("TOP_DISCONNECT"));
175 anAction->setStatusTip(tr("STB_DISCONNECT"));
176 registerAction(DisconnectId, anAction);
177 new pqServerDisconnectReaction(anAction);
182 aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_UNDO"), false );
183 anAction = new QAction(QIcon(aPixmap), tr("MEN_UNDO"), this);
184 anAction->setToolTip(tr("TOP_UNDO"));
185 anAction->setStatusTip(tr("STB_UNDO"));
186 registerAction(UndoId, anAction);
187 new pqUndoRedoReaction(anAction, true);
190 aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_REDO"), false );
191 anAction = new QAction(QIcon(aPixmap), tr("MEN_REDO"), this);
192 anAction->setToolTip(tr("TOP_REDO"));
193 anAction->setStatusTip(tr("STB_REDO"));
194 registerAction(RedoId, anAction);
195 new pqUndoRedoReaction(anAction, false);
198 aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_CAMERA_UNDO"), false );
199 anAction = new QAction(QIcon(aPixmap), tr("MEN_CAMERA_UNDO"), this);
200 anAction->setToolTip(tr("TOP_CAMERA_UNDO"));
201 anAction->setStatusTip(tr("STB_CAMERA_UNDO"));
202 registerAction(CameraUndoId, anAction);
203 new pqCameraUndoRedoReaction(anAction, true);
206 aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_CAMERA_REDO"), false );
207 anAction = new QAction(QIcon(aPixmap), tr("MEN_CAMERA_REDO"), this);
208 anAction->setToolTip(tr("TOP_CAMERA_REDO"));
209 anAction->setStatusTip(tr("STB_CAMERA_REDO"));
210 registerAction(CameraRedoId, anAction);
211 new pqCameraUndoRedoReaction(anAction, false);
214 anAction = new QAction(tr("MEN_FIND_DATA"), this);
215 anAction->setToolTip("");
216 anAction->setStatusTip("");
217 registerAction(FindDataId, anAction);
218 new pqDataQueryReaction(anAction);
221 anAction = new QAction(tr("MEN_CHANGE_INPUT"), this);
222 anAction->setToolTip(tr("TOP_CHANGE_INPUT"));
223 anAction->setStatusTip(tr("STB_CHANGE_INPUT"));
224 registerAction(ChangeInputId, anAction);
225 new pqChangePipelineInputReaction(anAction);
227 // Ignore source time
228 anAction = new QAction(tr("MEN_IGNORE_TIME"), this);
229 anAction->setToolTip(tr("TOP_IGNORE_TIME"));
230 anAction->setStatusTip(tr("STB_IGNORE_TIME"));
231 anAction->setCheckable(true);
232 registerAction(IgnoreTimeId, anAction);
233 new pqIgnoreSourceTimeReaction(anAction);
236 anAction = new QAction(tr("MEN_DELETE"), this);
237 anAction->setToolTip(tr("TOP_DELETE"));
238 anAction->setStatusTip(tr("STB_DELETE"));
239 registerAction(DeleteId, anAction);
240 new pqDeleteReaction(anAction);
243 anAction = new QAction(tr("MEN_DELETE_ALL"), this);
244 anAction->setToolTip(tr("TOP_DELETE_ALL"));
245 anAction->setStatusTip(tr("STB_DELETE_ALL"));
246 registerAction(DeleteAllId, anAction);
247 new pqDeleteReaction(anAction, true);
251 /*anAction = new QAction(tr("MEN_SETTINGS"), this);
252 anAction->setToolTip(tr("TOP_SETTINGS"));
253 anAction->setStatusTip(tr("STB_SETTINGS"));
254 registerAction(SettingsId, anAction);
255 new pqApplicationSettingsReaction(anAction);*/
258 anAction = new QAction(tr("MEN_VIEW_SETTINGS"), this);
259 anAction->setToolTip(tr("TOP_VIEW_SETTINGS"));
260 anAction->setStatusTip(tr("STB_VIEW_SETTINGS"));
261 registerAction(ViewSettingsId, anAction);
262 new pqViewSettingsReaction(anAction);
265 //pqViewManager* viewManager = qobject_cast<pqViewManager*>(
266 // pqApplicationCore::instance()->manager("MULTIVIEW_WIDGET"));
268 //rnv: Commented to implement issue
269 //21318: EDF 1615 ALL: Display in full screen mode
270 //Switching to the "Full screen" mode added in the SALOME GUI module.
272 //anAction = new QAction("Full Screen", this);
273 //anAction->setObjectName("actionFullScreen");
274 //anAction->setShortcut(QKeySequence("F11"));
275 //connect(anAction, SIGNAL(triggered()), viewManager, SLOT(toggleFullScreen()));
276 //registerAction(FullScreenId, anAction);
280 // Create Custom Filter
281 anAction = new QAction(tr("MEN_CREATE_CUSTOM_FILTER"), this);
282 anAction->setToolTip(tr("TOP_CREATE_CUSTOM_FILTER"));
283 anAction->setStatusTip(tr("STB_CREATE_CUSTOM_FILTER"));
284 registerAction(CreateCustomFilterId, anAction);
285 new pqCreateCustomFilterReaction(anAction << pqSetName("actionToolsCreateCustomFilter"));
287 // Manage Custom Filters
288 anAction = new QAction(tr("MEN_MANAGE_CUSTOM_FILTERS"), this);
289 anAction->setToolTip(tr("TOP_MANAGE_CUSTOM_FILTERS"));
290 anAction->setStatusTip(tr("STB_MANAGE_CUSTOM_FILTERS"));
291 registerAction(ManageCustomFiltersId, anAction);
292 new pqManageCustomFiltersReaction(anAction << pqSetName("actionToolsManageCustomFilters"));
295 anAction = new QAction(tr("MEN_MANAGE_LINKS"), this);
296 anAction->setToolTip(tr("TOP_MANAGE_LINKS"));
297 anAction->setStatusTip(tr("STB_MANAGE_LINKS"));
298 registerAction(ManageLinksId, anAction);
299 new pqManageLinksReaction(anAction << pqSetName("actionToolsManageLinks"));
302 anAction = new QAction(tr("MEN_ADD_CAMERA_LINK"), this);
303 anAction->setToolTip(tr("TOP_ADD_CAMERA_LINK"));
304 anAction->setStatusTip(tr("STB_ADD_CAMERA_LINK"));
305 registerAction(AddCameraLinkId, anAction);
306 new pqCameraLinkReaction(anAction << pqSetName("actionToolsAddCameraLink"));
308 // Manage Plugins/Extensions
309 anAction = new QAction(tr("MEN_MANAGE_PLUGINS"), this);
310 anAction->setToolTip(tr("TOP_MANAGE_PLUGINS"));
311 anAction->setStatusTip(tr("STB_MANAGE_PLUGINS"));
312 registerAction(ManagePluginsExtensionsId, anAction);
313 new pqManagePluginsReaction(anAction << pqSetName("actionManage_Plugins"));
316 anAction = new QAction(tr("MEN_RECORD_TEST"), this);
317 anAction->setToolTip(tr("TOP_RECORD_TEST"));
318 anAction->setStatusTip(tr("STB_RECORD_TEST"));
319 registerAction(RecordTestId, anAction);
320 new pqTestingReaction(anAction << pqSetName("actionToolsRecordTest"), pqTestingReaction::RECORD);
323 anAction = new QAction(tr("MEN_PLAY_TEST"), this);
324 anAction->setToolTip(tr("TOP_PLAY_TEST"));
325 anAction->setStatusTip(tr("STB_PLAY_TEST"));
326 registerAction(PlayTestId, anAction);
327 new pqTestingReaction(anAction << pqSetName("actionToolsPlayTest"), pqTestingReaction::PLAYBACK);
330 anAction = new QAction(tr("MEN_MAX_WINDOW_SIZE"), this);
331 anAction->setToolTip(tr("TOP_MAX_WINDOW_SIZE"));
332 anAction->setStatusTip(tr("PRP_APP_MAX_WINDOW_SIZE"));
333 anAction->setCheckable(true);
334 registerAction(MaxWindowSizeId, anAction);
335 new pqTestingReaction(anAction << pqSetName("actionTesting_Window_Size"),
336 pqTestingReaction::LOCK_VIEW_SIZE);
338 // Custom Window Size
339 anAction = new QAction(tr("MEN_CUSTOM_WINDOW_SIZE"), this);
340 anAction->setToolTip(tr(""));
341 anAction->setStatusTip(tr(""));
342 anAction->setCheckable(true);
343 registerAction(CustomWindowSizeId, anAction);
344 new pqTestingReaction(anAction << pqSetName("actionTesting_Window_Size_Custom"),
345 pqTestingReaction::LOCK_VIEW_SIZE_CUSTOM);
348 anAction = new QAction(tr("MEN_TIMER_LOG"), this);
349 anAction->setToolTip(tr("TOP_TIMER_LOG"));
350 anAction->setStatusTip(tr("STB_TIMER_LOG"));
351 registerAction(TimerLogId, anAction);
352 new pqTimerLogReaction(anAction << pqSetName("actionToolsTimerLog"));
355 anAction = new QAction(tr("MEN_OUTPUT_WINDOW"), this);
356 anAction->setToolTip(tr("TOP_OUTPUT_WINDOW"));
357 anAction->setStatusTip(tr("STB_OUTPUT_WINDOW"));
358 registerAction(OutputWindowId, anAction);
359 anAction << pqSetName("actionToolsOutputWindow");
360 connect(anAction, SIGNAL(triggered()), pqApplicationCore::instance(), SLOT(showOutputWindow()));
363 anAction = new QAction(tr("MEN_PYTHON_SHELL"), this);
364 anAction->setToolTip(tr("TOP_PYTHON_SHELL"));
365 anAction->setStatusTip(tr("STB_PYTHON_SHELL"));
366 registerAction(PythonShellId, anAction);
367 new pqPythonShellReaction(anAction << pqSetName("actionToolsPythonShell"));
370 anAction = new QAction(tr("MEN_SHOW_TRACE"), this);
371 anAction->setToolTip(tr("TOP_SHOW_TRACE"));
372 anAction->setStatusTip(tr("STB_SHOW_TRACE"));
373 connect(anAction, SIGNAL(triggered()), this, SLOT(onShowTrace()));
374 registerAction(ShowTraceId, anAction);
377 anAction = new QAction(tr("MEN_RESTART_TRACE"), this);
378 anAction->setToolTip(tr("TOP_RESTART_TRACE"));
379 anAction->setStatusTip(tr("STB_RESTART_TRACE"));
380 connect(anAction, SIGNAL(triggered()), this, SLOT(onRestartTrace()));
381 registerAction(RestartTraceId, anAction);
386 anAction = new QAction(tr("MEN_ABOUT"), this);
387 anAction->setToolTip(tr("TOP_ABOUT"));
388 anAction->setStatusTip(tr("STB_ABOUT"));
389 registerAction(AboutParaViewId, anAction);
390 new pqAboutDialogReaction(anAction << pqSetName("actionAbout"));
393 // Native ParaView user documentation
394 aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_PARAVIEW_HELP"), false );
395 anAction = new QAction(tr("MEN_PARAVIEW_HELP"), this);
396 anAction->setToolTip(tr("TOP_PARAVIEW_HELP"));
397 anAction->setStatusTip(tr("STB_PARAVIEW_HELP"));
398 registerAction(ParaViewHelpId, anAction);
399 new pqHelpReaction(anAction);
404 \brief Create menus for ParaView GUI operations
405 duplicating menus in pqMainWindow ParaView class
407 In particular, ParaView is responsible for updating "Sources" and "Filters" menus.
408 For this, specific menu managers created by pqMainWindowCore class are used, and PVGUI_Module
409 is responsible for creation of corresponding QMenu objects only.
411 void PVGUI_Module::pvCreateMenus()
413 SUIT_Desktop* desk = application()->desktop();
416 int aPVMnu = createMenu( tr( "MEN_DESK_FILE" ), -1, -1 );
418 createMenu( OpenFileId, aPVMnu, 5 );
421 myRecentMenuId = createMenu( tr( "MEN_RECENT_FILES" ), aPVMnu, -1, 5 );
422 QMenu* aMenu = menuMgr()->findMenu( myRecentMenuId );
423 pqRecentFilesMenu* aRecentFilesMenu = new pqRecentFilesMenu( *aMenu, getApp()->desktop() );
424 QList<QAction*> anActns = aMenu->actions();
425 for (int i = 0; i < anActns.size(); ++i) {
426 createMenu( anActns.at(i), myRecentMenuId );
430 createMenu( separator(), aPVMnu, -1, 5 );
432 createMenu( LoadStateId, aPVMnu, 15 );
433 createMenu( SaveStateId, aPVMnu, 15 );
434 createMenu( separator(), aPVMnu, -1, 15 );
436 createMenu( SaveDataId, aPVMnu, 25 );
437 createMenu( SaveScreenshotId, aPVMnu, 25 );
438 createMenu( ExportId, aPVMnu, 25 );
439 createMenu( separator(), aPVMnu, -1, 25 );
441 createMenu( SaveAnimationId, aPVMnu, 35 );
442 createMenu( SaveGeometryId, aPVMnu, 35 );
443 createMenu( separator(), aPVMnu, -1, 35 );
445 createMenu( ConnectId, aPVMnu, 45 );
446 createMenu( DisconnectId, aPVMnu, 45 );
447 createMenu( separator(), aPVMnu, -1, 45 );
450 aPVMnu = createMenu( tr( "MEN_DESK_EDIT" ), -1, -1 );
452 createMenu( UndoId, aPVMnu );
453 createMenu( RedoId, aPVMnu );
454 createMenu( separator(), aPVMnu );
456 createMenu( CameraUndoId, aPVMnu );
457 createMenu( CameraRedoId, aPVMnu );
458 createMenu( separator(), aPVMnu );
460 createMenu( FindDataId, aPVMnu );
461 createMenu( ChangeInputId, aPVMnu );
462 createMenu( IgnoreTimeId, aPVMnu );
463 createMenu( DeleteId, aPVMnu );
464 createMenu( DeleteAllId, aPVMnu );
465 createMenu( separator(), aPVMnu );
467 //createMenu( SettingsId, aPVMnu );
468 createMenu( ViewSettingsId, aPVMnu );
469 createMenu( separator(), aPVMnu );
472 aPVMnu = createMenu( tr( "MEN_DESK_VIEW" ), -1, -1 );
473 /*myToolbarsMenuId = createMenu( "Toolbars", aPVMnu );
474 aMenu = getMenu( myToolbarsMenuId );
477 connect(aMenu, SIGNAL(aboutToShow()), this, SLOT(buildToolbarsMenu()));
479 createMenu( separator(), aPVMnu );*/
481 createMenu( FullScreenId, aPVMnu );
483 // --- Menu "Sources"
485 // Install ParaView managers for "Sources" menu
487 mySourcesMenuId = createMenu( tr( "MEN_DESK_SOURCES" ), -1, -1, 60);
488 if ( (aRes = getMenu( mySourcesMenuId )) ) {
489 pqParaViewMenuBuilders::buildSourcesMenu(*aRes, desk);
492 // --- Menu "Filters"
494 // Install ParaView managers for "Filters" menu
495 myFiltersMenuId = createMenu( tr( "MEN_DESK_FILTERS" ), -1, -1, 70 );
496 if ( (aRes = getMenu( myFiltersMenuId )) ) {
497 pqParaViewMenuBuilders::buildFiltersMenu(*aRes, desk);
501 myMacrosMenuId = createMenu( tr( "MEN_MACROS" ), -1, -1, 80 );
502 if ( (aRes = getMenu( myMacrosMenuId )) ) {
503 pqParaViewMenuBuilders::buildMacrosMenu(*aRes);
508 int aToolsMnu = createMenu( tr( "MEN_DESK_TOOLS" ), -1, -1, 90 );
510 createMenu( CreateCustomFilterId, aToolsMnu );
511 createMenu( AddCameraLinkId, aToolsMnu );
512 createMenu( separator(), aToolsMnu );
513 createMenu( ManageCustomFiltersId, aToolsMnu );
514 createMenu( ManageLinksId, aToolsMnu );
515 createMenu( ManagePluginsExtensionsId, aToolsMnu );
516 createMenu( separator(), aToolsMnu );
518 createMenu( RecordTestId, aToolsMnu );
519 createMenu( PlayTestId, aToolsMnu );
520 createMenu( MaxWindowSizeId, aToolsMnu );
521 createMenu( CustomWindowSizeId, aToolsMnu );
522 createMenu( separator(), aToolsMnu );
524 createMenu( TimerLogId, aToolsMnu );
525 createMenu( OutputWindowId, aToolsMnu );
526 createMenu( separator(), aToolsMnu );
528 createMenu( PythonShellId, aToolsMnu );
529 createMenu( separator(), aToolsMnu );
530 createMenu( ShowTraceId, aToolsMnu );
531 createMenu( RestartTraceId, aToolsMnu );
535 int aHelpMnu = createMenu( tr( "MEN_DESK_HELP" ), -1, -1 );
536 int aPVHelpMnu = createMenu( tr( "ParaViS module" ), aHelpMnu, -1, 0 );
538 createMenu( ParaViewHelpId, aPVHelpMnu );
539 createMenu( separator(), aPVHelpMnu );
541 createMenu( AboutParaViewId, aPVHelpMnu );
545 \brief Create toolbars for ParaView GUI operations
546 duplicating toolbars in pqMainWindow ParaView class
548 void PVGUI_Module::pvCreateToolBars()
550 SUIT_Desktop* desk = application()->desktop();
551 pqParaViewMenuBuilders::buildToolbars(*desk);
555 \brief Returns QMenu by its id.
557 QMenu* PVGUI_Module::getMenu( const int id )
560 SalomeApp_Application* anApp = getApp();
561 SUIT_Desktop* desk = anApp->desktop();
563 QtxActionMenuMgr* menuMgr = desk->menuMgr();
564 res = menuMgr->findMenu( id );
570 \brief Returns list of ParaView toolbars
572 /*QList<QToolBar*> PVGUI_Module::getParaViewToolbars()
574 QList<QToolBar*> all_toolbars = application()->desktop()->findChildren<QToolBar*>();
575 // First two toolbars has to be ignored because they are not from ParaView
576 if (all_toolbars.size() > 2) {
577 all_toolbars.removeFirst();
578 all_toolbars.removeFirst();
586 \brief Builds a menu which referred to toolbars
588 /*void PVGUI_Module::buildToolbarsMenu()
590 SUIT_Desktop* desk = application()->desktop();
591 QMenu* aMenu = menuMgr()->findMenu( myToolbarsMenuId );
594 QList<QMenu*> child_menus = aMenu->findChildren<QMenu*>();
595 foreach (QMenu* menu, child_menus) {
598 QList<QToolBar*> all_toolbars = getParaViewToolbars();
600 // Add menus for all toolbars and actions from them.
601 // This puts menu actions for all toolbars making it possible to access all
602 // toolbar actions even when the toolbar are not visible.
603 // I wonder if I should ignore the pqMainControlsToolbar since those actions
604 // are already placed at other places.
605 foreach (QToolBar* toolbar, all_toolbars) {
606 QMenu* sub_menu = new QMenu(aMenu) << pqSetName(toolbar->windowTitle());
608 foreach (QAction* action, toolbar->actions()) {
609 if (!action->text().isEmpty()) {
611 sub_menu->addAction(action);
615 QAction* menu_action = aMenu->addMenu(sub_menu);
616 menu_action->setText(toolbar->windowTitle());
621 disconnect(aMenu, SIGNAL(aboutToShow()), this, SLOT(buildToolbarsMenu()));
626 \brief Create actions for ParaViS
628 void PVGUI_Module::createActions()
632 // New ParaView window
633 anAction = new QtxAction(tr("MEN_NEW_PV_VIEW"), tr("MEN_NEW_PV_VIEW"), 0,
634 this, false, "ParaViS:Create new ParaView view");
635 connect(anAction, SIGNAL(triggered()), this, SLOT(onNewParaViewWindow()));
636 registerAction(ParaViewNewWindowId, anAction);
638 // Save state under the module root object
639 anAction = new QAction(tr("MEN_SAVE_MULTI_STATE"), this);
640 connect(anAction, SIGNAL(triggered()), this, SLOT(onSaveMultiState()));
641 registerAction(SaveStatePopupId, anAction);
643 // Restore the selected state by merging with the current one
644 anAction = new QAction(tr("MEN_ADD_STATE"), this);
645 connect(anAction, SIGNAL(triggered()), this, SLOT(onAddState()));
646 registerAction(AddStatePopupId, anAction);
648 // Clean the current state and restore the selected one
649 anAction = new QAction(tr("MEN_CLEAN_ADD_STATE"), this);
650 connect(anAction, SIGNAL(triggered()), this, SLOT(onCleanAddState()));
651 registerAction(CleanAndAddStatePopupId, anAction);
653 // Rename the selected object (Object Browser)
654 anAction = new QAction(tr("MEN_PARAVIS_RENAME"), this);
655 connect(anAction, SIGNAL(triggered()), this, SLOT(onRename()));
656 registerAction(ParaVisRenameId, anAction);
658 // Delete the selected object (Object Browser)
659 anAction = new QAction(tr("MEN_PARAVIS_DELETE"), this);
660 connect(anAction, SIGNAL(triggered()), this, SLOT(onDelete()));
661 registerAction(ParaVisDeleteId, anAction);
665 \brief Create actions for ParaViS
667 void PVGUI_Module::createMenus()
669 // "Window" - "New Window" - "ParaView view" menu
670 int aWindowMenu = createMenu(tr( "MEN_DESK_WINDOW" ), -1, -1);
671 int aNewWindowMenu = createMenu(tr( "MEN_DESK_NEWWINDOW"), aWindowMenu, -1, -1);
672 createMenu(ParaViewNewWindowId, aNewWindowMenu);