1 // PARAVIS : ParaView wrapper SALOME module
3 // Copyright (C) 2010-2015 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"
26 #include <PVViewer_GUIElements.h>
27 #include <PVViewer_ViewManager.h>
29 #include <QtxAction.h>
30 #include <QtxActionMenuMgr.h>
31 #include <QtxActionToolMgr.h>
32 #include <SUIT_Desktop.h>
33 #include <SUIT_ResourceMgr.h>
34 #include <SUIT_Session.h>
35 #include <SalomeApp_Application.h> // should ultimately be a LightApp only
36 #include <LightApp_Application.h>
43 #include <pqApplicationCore.h>
44 //#include <pqProgressManager.h>
45 //#include <pqUndoStack.h>
46 //#include <pqVCRController.h>
48 #include <pqSaveStateReaction.h>
49 #include <pqLoadDataReaction.h>
50 #include <pqLoadStateReaction.h>
51 #include <pqSaveDataReaction.h>
52 #include <pqSaveScreenshotReaction.h>
53 #include <pqExportReaction.h>
54 #include <pqSaveAnimationReaction.h>
55 #include <pqSaveAnimationGeometryReaction.h>
56 #include <pqServerConnectReaction.h>
57 #include <pqServerDisconnectReaction.h>
58 #include <pqCameraUndoRedoReaction.h>
59 #include <pqUndoRedoReaction.h>
60 #include <pqDeleteReaction.h>
61 #include <pqChangePipelineInputReaction.h>
62 #include <pqApplicationSettingsReaction.h>
63 #include <pqIgnoreSourceTimeReaction.h>
64 #include <pqCreateCustomFilterReaction.h>
65 #include <pqManageLinksReaction.h>
66 #include <pqManagePluginsReaction.h>
67 #include <pqCameraLinkReaction.h>
68 #include <pqManageCustomFiltersReaction.h>
69 #include <pqTimerLogReaction.h>
70 #include <pqTestingReaction.h>
71 #include <pqAboutDialogReaction.h>
72 #include <pqHelpReaction.h>
73 #include <pqDataQueryReaction.h>
74 #include <pqPythonShellReaction.h>
76 #include <pqViewManager.h>
77 #include <pqViewMenuManager.h>
78 #include <pqParaViewMenuBuilders.h>
79 #include <pqProxyGroupMenuManager.h>
80 #include <pqSetName.h>
81 #include <pqRecentFilesMenu.h>
82 #include <pqPipelineBrowserWidget.h>
85 \brief Create actions for ParaView GUI operations
86 duplicating menus and toolbars in MainWindow class of
87 the standard ParaView GUI client application.
89 void PVGUI_Module::pvCreateActions()
91 SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
95 //QtxAction* aQtxAction;
100 aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_OPEN_FILE"), false );
101 anAction = new QAction(QIcon(aPixmap), tr("MEN_OPEN_FILE"), this);
102 anAction->setToolTip(tr("TOP_OPEN_FILE"));
103 anAction->setStatusTip(tr("STB_OPEN_FILE"));
104 registerAction(OpenFileId, anAction);
105 new pqLoadDataReaction(anAction);
108 anAction = new QAction(tr("MEN_LOAD_STATE"), this);
109 anAction->setToolTip(tr("TOP_LOAD_STATE"));
110 anAction->setStatusTip(tr("STB_LOAD_STATE"));
111 registerAction(LoadStateId, anAction);
112 new pqLoadStateReaction(anAction);
115 anAction = new QAction(tr("MEN_SAVE_STATE"), this);
116 anAction->setToolTip(tr("TOP_SAVE_STATE"));
117 anAction->setStatusTip(tr("STB_SAVE_STATE"));
118 registerAction(SaveStateId, anAction);
119 new pqSaveStateReaction(anAction);
122 aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_SAVE_DATA"), false );
123 anAction = new QAction(QIcon(aPixmap), tr("MEN_SAVE_DATA"), this);
124 anAction->setToolTip(tr("TOP_SAVE_DATA"));
125 anAction->setStatusTip(tr("STB_SAVE_DATA"));
126 registerAction(SaveDataId, anAction);
127 new pqSaveDataReaction(anAction);
130 aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_SAVE_SCREENSHOT"), false );
131 anAction = new QAction(QIcon(aPixmap), tr("MEN_SAVE_SCREENSHOT"), this);
132 anAction->setToolTip(tr("TOP_SAVE_SCREENSHOT"));
133 anAction->setStatusTip(tr("STB_SAVE_SCREENSHOT"));
134 registerAction(SaveScreenshotId, anAction);
135 new pqSaveScreenshotReaction(anAction);
138 anAction = new QAction(tr("MEN_EXPORT"), this);
139 anAction->setToolTip(tr("TOP_EXPORT"));
140 anAction->setStatusTip(tr("STB_EXPORT"));
141 registerAction(ExportId, anAction);
142 new pqExportReaction(anAction);
145 aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_SAVE_ANIMATION"), false );
146 anAction = new QAction(QIcon(aPixmap), tr("MEN_SAVE_ANIMATION"), this);
147 anAction->setToolTip(tr("TOP_SAVE_ANIMATION"));
148 anAction->setStatusTip(tr("STB_SAVE_ANIMATION"));
149 registerAction(SaveAnimationId, anAction);
150 new pqSaveAnimationReaction(anAction);
153 aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_SAVE_GEOMETRY"), false );
154 anAction = new QAction(QIcon(aPixmap), tr("MEN_SAVE_GEOMETRY"), this);
155 anAction->setToolTip(tr("TOP_SAVE_GEOMETRY"));
156 anAction->setStatusTip(tr("STB_SAVE_GEOMETRY"));
157 registerAction(SaveGeometryId, anAction);
158 new pqSaveAnimationGeometryReaction(anAction);
161 aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_CONNECT"), false );
162 anAction = new QAction(QIcon(aPixmap), tr("MEN_CONNECT"), this);
163 anAction->setToolTip(tr("TOP_CONNECT"));
164 anAction->setStatusTip(tr("STB_CONNECT"));
165 registerAction(ConnectId, anAction);
166 new pqServerConnectReaction(anAction);
169 aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_DISCONNECT"), false );
170 anAction = new QAction(QIcon(aPixmap), tr("MEN_DISCONNECT"), this);
171 anAction->setToolTip(tr("TOP_DISCONNECT"));
172 anAction->setStatusTip(tr("STB_DISCONNECT"));
173 registerAction(DisconnectId, anAction);
174 new pqServerDisconnectReaction(anAction);
179 aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_UNDO"), false );
180 anAction = new QAction(QIcon(aPixmap), tr("MEN_UNDO"), this);
181 anAction->setToolTip(tr("TOP_UNDO"));
182 anAction->setStatusTip(tr("STB_UNDO"));
183 registerAction(UndoId, anAction);
184 new pqUndoRedoReaction(anAction, true);
187 aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_REDO"), false );
188 anAction = new QAction(QIcon(aPixmap), tr("MEN_REDO"), this);
189 anAction->setToolTip(tr("TOP_REDO"));
190 anAction->setStatusTip(tr("STB_REDO"));
191 registerAction(RedoId, anAction);
192 new pqUndoRedoReaction(anAction, false);
195 aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_CAMERA_UNDO"), false );
196 anAction = new QAction(QIcon(aPixmap), tr("MEN_CAMERA_UNDO"), this);
197 anAction->setToolTip(tr("TOP_CAMERA_UNDO"));
198 anAction->setStatusTip(tr("STB_CAMERA_UNDO"));
199 registerAction(CameraUndoId, anAction);
200 new pqCameraUndoRedoReaction(anAction, true);
203 aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_CAMERA_REDO"), false );
204 anAction = new QAction(QIcon(aPixmap), tr("MEN_CAMERA_REDO"), this);
205 anAction->setToolTip(tr("TOP_CAMERA_REDO"));
206 anAction->setStatusTip(tr("STB_CAMERA_REDO"));
207 registerAction(CameraRedoId, anAction);
208 new pqCameraUndoRedoReaction(anAction, false);
211 anAction = new QAction(tr("MEN_FIND_DATA"), this);
212 anAction->setToolTip("");
213 anAction->setStatusTip("");
214 registerAction(FindDataId, anAction);
215 new pqDataQueryReaction(anAction);
218 anAction = new QAction(tr("MEN_CHANGE_INPUT"), this);
219 anAction->setToolTip(tr("TOP_CHANGE_INPUT"));
220 anAction->setStatusTip(tr("STB_CHANGE_INPUT"));
221 registerAction(ChangeInputId, anAction);
222 new pqChangePipelineInputReaction(anAction);
224 // Ignore source time
225 anAction = new QAction(tr("MEN_IGNORE_TIME"), this);
226 anAction->setToolTip(tr("TOP_IGNORE_TIME"));
227 anAction->setStatusTip(tr("STB_IGNORE_TIME"));
228 anAction->setCheckable(true);
229 registerAction(IgnoreTimeId, anAction);
230 new pqIgnoreSourceTimeReaction(anAction);
233 anAction = new QAction(tr("MEN_DELETE"), this);
234 anAction->setToolTip(tr("TOP_DELETE"));
235 anAction->setStatusTip(tr("STB_DELETE"));
236 registerAction(DeleteId, anAction);
237 new pqDeleteReaction(anAction);
240 anAction = new QAction(tr("MEN_DELETE_ALL"), this);
241 anAction->setToolTip(tr("TOP_DELETE_ALL"));
242 anAction->setStatusTip(tr("STB_DELETE_ALL"));
243 registerAction(DeleteAllId, anAction);
244 new pqDeleteReaction(anAction, true);
248 /*anAction = new QAction(tr("MEN_SETTINGS"), this);
249 anAction->setToolTip(tr("TOP_SETTINGS"));
250 anAction->setStatusTip(tr("STB_SETTINGS"));
251 registerAction(SettingsId, anAction);
252 new pqApplicationSettingsReaction(anAction);*/
255 // anAction = new QAction(tr("MEN_VIEW_SETTINGS"), this);
256 // anAction->setToolTip(tr("TOP_VIEW_SETTINGS"));
257 // anAction->setStatusTip(tr("STB_VIEW_SETTINGS"));
258 // registerAction(ViewSettingsId, anAction);
259 // new pqViewSettingsReaction(anAction);
262 //pqViewManager* viewManager = qobject_cast<pqViewManager*>(
263 // pqApplicationCore::instance()->manager("MULTIVIEW_WIDGET"));
265 //rnv: Commented to implement issue
266 //21318: EDF 1615 ALL: Display in full screen mode
267 //Switching to the "Full screen" mode added in the SALOME GUI module.
269 //anAction = new QAction("Full Screen", this);
270 //anAction->setObjectName("actionFullScreen");
271 //anAction->setShortcut(QKeySequence("F11"));
272 //connect(anAction, SIGNAL(triggered()), viewManager, SLOT(toggleFullScreen()));
273 //registerAction(FullScreenId, anAction);
277 // Create Custom Filter
278 anAction = new QAction(tr("MEN_CREATE_CUSTOM_FILTER"), this);
279 anAction->setToolTip(tr("TOP_CREATE_CUSTOM_FILTER"));
280 anAction->setStatusTip(tr("STB_CREATE_CUSTOM_FILTER"));
281 registerAction(CreateCustomFilterId, anAction);
282 new pqCreateCustomFilterReaction(anAction << pqSetName("actionToolsCreateCustomFilter"));
284 // Manage Custom Filters
285 anAction = new QAction(tr("MEN_MANAGE_CUSTOM_FILTERS"), this);
286 anAction->setToolTip(tr("TOP_MANAGE_CUSTOM_FILTERS"));
287 anAction->setStatusTip(tr("STB_MANAGE_CUSTOM_FILTERS"));
288 registerAction(ManageCustomFiltersId, anAction);
289 new pqManageCustomFiltersReaction(anAction << pqSetName("actionToolsManageCustomFilters"));
292 anAction = new QAction(tr("MEN_MANAGE_LINKS"), this);
293 anAction->setToolTip(tr("TOP_MANAGE_LINKS"));
294 anAction->setStatusTip(tr("STB_MANAGE_LINKS"));
295 registerAction(ManageLinksId, anAction);
296 new pqManageLinksReaction(anAction << pqSetName("actionToolsManageLinks"));
299 anAction = new QAction(tr("MEN_ADD_CAMERA_LINK"), this);
300 anAction->setToolTip(tr("TOP_ADD_CAMERA_LINK"));
301 anAction->setStatusTip(tr("STB_ADD_CAMERA_LINK"));
302 registerAction(AddCameraLinkId, anAction);
303 new pqCameraLinkReaction(anAction << pqSetName("actionToolsAddCameraLink"));
305 // Manage Plugins/Extensions
306 anAction = new QAction(tr("MEN_MANAGE_PLUGINS"), this);
307 anAction->setToolTip(tr("TOP_MANAGE_PLUGINS"));
308 anAction->setStatusTip(tr("STB_MANAGE_PLUGINS"));
309 registerAction(ManagePluginsExtensionsId, anAction);
310 new pqManagePluginsReaction(anAction << pqSetName("actionManage_Plugins"));
313 anAction = new QAction(tr("MEN_RECORD_TEST"), this);
314 anAction->setToolTip(tr("TOP_RECORD_TEST"));
315 anAction->setStatusTip(tr("STB_RECORD_TEST"));
316 registerAction(RecordTestId, anAction);
317 new pqTestingReaction(anAction << pqSetName("actionToolsRecordTest"), pqTestingReaction::RECORD);
320 anAction = new QAction(tr("MEN_PLAY_TEST"), this);
321 anAction->setToolTip(tr("TOP_PLAY_TEST"));
322 anAction->setStatusTip(tr("STB_PLAY_TEST"));
323 registerAction(PlayTestId, anAction);
324 new pqTestingReaction(anAction << pqSetName("actionToolsPlayTest"), pqTestingReaction::PLAYBACK);
327 anAction = new QAction(tr("MEN_MAX_WINDOW_SIZE"), this);
328 anAction->setToolTip(tr("TOP_MAX_WINDOW_SIZE"));
329 anAction->setStatusTip(tr("PRP_APP_MAX_WINDOW_SIZE"));
330 anAction->setCheckable(true);
331 registerAction(MaxWindowSizeId, anAction);
332 new pqTestingReaction(anAction << pqSetName("actionTesting_Window_Size"),
333 pqTestingReaction::LOCK_VIEW_SIZE);
335 // Custom Window Size
336 anAction = new QAction(tr("MEN_CUSTOM_WINDOW_SIZE"), this);
337 anAction->setToolTip(tr(""));
338 anAction->setStatusTip(tr(""));
339 anAction->setCheckable(true);
340 registerAction(CustomWindowSizeId, anAction);
341 new pqTestingReaction(anAction << pqSetName("actionTesting_Window_Size_Custom"),
342 pqTestingReaction::LOCK_VIEW_SIZE_CUSTOM);
345 anAction = new QAction(tr("MEN_TIMER_LOG"), this);
346 anAction->setToolTip(tr("TOP_TIMER_LOG"));
347 anAction->setStatusTip(tr("STB_TIMER_LOG"));
348 registerAction(TimerLogId, anAction);
349 new pqTimerLogReaction(anAction << pqSetName("actionToolsTimerLog"));
352 anAction = new QAction(tr("MEN_OUTPUT_WINDOW"), this);
353 anAction->setToolTip(tr("TOP_OUTPUT_WINDOW"));
354 anAction->setStatusTip(tr("STB_OUTPUT_WINDOW"));
355 registerAction(OutputWindowId, anAction);
356 anAction << pqSetName("actionToolsOutputWindow");
357 connect(anAction, SIGNAL(triggered()), pqApplicationCore::instance(), SLOT(showOutputWindow()));
360 anAction = new QAction(tr("MEN_PYTHON_SHELL"), this);
361 anAction->setToolTip(tr("TOP_PYTHON_SHELL"));
362 anAction->setStatusTip(tr("STB_PYTHON_SHELL"));
363 registerAction(PythonShellId, anAction);
364 new pqPythonShellReaction(anAction << pqSetName("actionToolsPythonShell"));
367 anAction = new QAction(tr("MEN_SHOW_TRACE"), this);
368 anAction->setToolTip(tr("TOP_SHOW_TRACE"));
369 anAction->setStatusTip(tr("STB_SHOW_TRACE"));
370 connect(anAction, SIGNAL(triggered()), this, SLOT(onShowTrace()));
371 registerAction(ShowTraceId, anAction);
374 anAction = new QAction(tr("MEN_RESTART_TRACE"), this);
375 anAction->setToolTip(tr("TOP_RESTART_TRACE"));
376 anAction->setStatusTip(tr("STB_RESTART_TRACE"));
377 connect(anAction, SIGNAL(triggered()), this, SLOT(onRestartTrace()));
378 registerAction(RestartTraceId, anAction);
383 anAction = new QAction(tr("MEN_ABOUT"), this);
384 anAction->setToolTip(tr("TOP_ABOUT"));
385 anAction->setStatusTip(tr("STB_ABOUT"));
386 registerAction(AboutParaViewId, anAction);
387 new pqAboutDialogReaction(anAction << pqSetName("actionAbout"));
390 // Native ParaView user documentation
391 aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_PARAVIEW_HELP"), false );
392 anAction = new QAction(tr("MEN_PARAVIEW_HELP"), this);
393 anAction->setToolTip(tr("TOP_PARAVIEW_HELP"));
394 anAction->setStatusTip(tr("STB_PARAVIEW_HELP"));
395 registerAction(ParaViewHelpId, anAction);
396 new pqHelpReaction(anAction);
401 \brief Create menus for ParaView GUI operations
402 duplicating menus in pqMainWindow ParaView class
404 In particular, ParaView is responsible for updating "Sources" and "Filters" menus.
405 For this, specific menu managers created by pqMainWindowCore class are used, and PVGUI_Module
406 is responsible for creation of corresponding QMenu objects only.
408 void PVGUI_Module::pvCreateMenus()
410 SUIT_Desktop* desk = application()->desktop();
413 int aPVMnu = createMenu( tr( "MEN_DESK_FILE" ), -1, -1 );
415 createMenu( OpenFileId, aPVMnu, 5 );
418 myRecentMenuId = createMenu( tr( "MEN_RECENT_FILES" ), aPVMnu, -1, 5 );
419 QMenu* aMenu = menuMgr()->findMenu( myRecentMenuId );
420 pqRecentFilesMenu* aRecentFilesMenu = new pqRecentFilesMenu( *aMenu, getApp()->desktop() );
421 QList<QAction*> anActns = aMenu->actions();
422 for (int i = 0; i < anActns.size(); ++i)
423 createMenu( anActns.at(i), myRecentMenuId );
425 createMenu( separator(), aPVMnu, -1, 5 );
427 createMenu( LoadStateId, aPVMnu, 15 );
428 createMenu( SaveStateId, aPVMnu, 15 );
429 createMenu( separator(), aPVMnu, -1, 15 );
431 createMenu( SaveDataId, aPVMnu, 25 );
432 createMenu( SaveScreenshotId, aPVMnu, 25 );
433 createMenu( ExportId, aPVMnu, 25 );
434 createMenu( separator(), aPVMnu, -1, 25 );
436 createMenu( SaveAnimationId, aPVMnu, 35 );
437 createMenu( SaveGeometryId, aPVMnu, 35 );
438 createMenu( separator(), aPVMnu, -1, 35 );
440 createMenu( ConnectId, aPVMnu, 45 );
441 createMenu( DisconnectId, aPVMnu, 45 );
442 createMenu( separator(), aPVMnu, -1, 45 );
445 aPVMnu = createMenu( tr( "MEN_DESK_EDIT" ), -1, -1 );
447 createMenu( UndoId, aPVMnu );
448 createMenu( RedoId, aPVMnu );
449 createMenu( separator(), aPVMnu );
451 createMenu( CameraUndoId, aPVMnu );
452 createMenu( CameraRedoId, aPVMnu );
453 createMenu( separator(), aPVMnu );
455 createMenu( FindDataId, aPVMnu );
456 createMenu( ChangeInputId, aPVMnu );
457 createMenu( IgnoreTimeId, aPVMnu );
458 createMenu( DeleteId, aPVMnu );
459 createMenu( DeleteAllId, aPVMnu );
460 createMenu( separator(), aPVMnu );
462 //createMenu( SettingsId, aPVMnu );
463 //createMenu( ViewSettingsId, aPVMnu );
464 createMenu( separator(), aPVMnu );
467 aPVMnu = createMenu( tr( "MEN_DESK_VIEW" ), -1, -1 );
468 /*myToolbarsMenuId = createMenu( "Toolbars", aPVMnu );
469 aMenu = getMenu( myToolbarsMenuId );
472 connect(aMenu, SIGNAL(aboutToShow()), this, SLOT(buildToolbarsMenu()));
474 createMenu( separator(), aPVMnu );*/
476 createMenu( FullScreenId, aPVMnu );
478 // --- Menu "Sources"
479 // Install ParaView managers for "Sources" menu
481 PVViewer_GUIElements * guiElements = PVViewer_GUIElements::GetInstance(desk);
482 aRes = guiElements->getSourcesMenu();
483 mySourcesMenuId = createMenu( tr( "MEN_DESK_SOURCES" ), -1, -1, 60, -1, aRes);
485 // --- Menu "Filters"
486 // Install ParaView managers for "Filters" menu
487 aRes = guiElements->getFiltersMenu();
488 myFiltersMenuId = createMenu( tr( "MEN_DESK_FILTERS" ), -1, -1, 70, -1, aRes);
491 aRes = guiElements->getMacrosMenu();
492 myMacrosMenuId = createMenu( tr( "MEN_MACROS" ), -1, -1, 80, -1, aRes);
495 int aToolsMnu = createMenu( tr( "MEN_DESK_TOOLS" ), -1, -1, 90 );
497 createMenu( CreateCustomFilterId, aToolsMnu );
498 createMenu( AddCameraLinkId, aToolsMnu );
499 createMenu( separator(), aToolsMnu );
500 createMenu( ManageCustomFiltersId, aToolsMnu );
501 createMenu( ManageLinksId, aToolsMnu );
502 createMenu( ManagePluginsExtensionsId, aToolsMnu );
503 createMenu( separator(), aToolsMnu );
505 createMenu( RecordTestId, aToolsMnu );
506 createMenu( PlayTestId, aToolsMnu );
507 createMenu( MaxWindowSizeId, aToolsMnu );
508 createMenu( CustomWindowSizeId, aToolsMnu );
509 createMenu( separator(), aToolsMnu );
511 createMenu( TimerLogId, aToolsMnu );
512 createMenu( OutputWindowId, aToolsMnu );
513 createMenu( separator(), aToolsMnu );
515 createMenu( PythonShellId, aToolsMnu );
516 createMenu( separator(), aToolsMnu );
517 createMenu( ShowTraceId, aToolsMnu );
518 createMenu( RestartTraceId, aToolsMnu );
522 int aHelpMnu = createMenu( tr( "MEN_DESK_HELP" ), -1, -1 );
523 int aPVHelpMnu = createMenu( tr( "ParaViS module" ), aHelpMnu, -1, 0 );
525 createMenu( ParaViewHelpId, aPVHelpMnu );
526 createMenu( separator(), aPVHelpMnu );
528 createMenu( AboutParaViewId, aPVHelpMnu );
530 // -- Context menu in the pipeline browser
531 pqPipelineBrowserWidget * pq = guiElements->getPipelineBrowserWidget();
532 pqParaViewMenuBuilders::buildPipelineBrowserContextMenu( *pq );
536 \brief Create toolbars for ParaView GUI operations
537 duplicating toolbars in pqMainWindow ParaView class
539 void PVGUI_Module::pvCreateToolBars()
541 SUIT_Desktop* desk = application()->desktop();
542 // pqParaViewMenuBuilders::buildToolbars(*desk);
543 PVViewer_GUIElements * guiElements = PVViewer_GUIElements::GetInstance(desk);
544 guiElements->setToolBarVisible(true);
548 \brief Returns QMenu by its id.
550 QMenu* PVGUI_Module::getMenu( const int id )
553 //SalomeApp_Application* anApp = getApp();
554 LightApp_Application* anApp = getApp();
555 SUIT_Desktop* desk = anApp->desktop();
557 QtxActionMenuMgr* menuMgr = desk->menuMgr();
558 res = menuMgr->findMenu( id );
564 \brief Returns list of ParaView toolbars
566 /*QList<QToolBar*> PVGUI_Module::getParaViewToolbars()
568 QList<QToolBar*> all_toolbars = application()->desktop()->findChildren<QToolBar*>();
569 // First two toolbars has to be ignored because they are not from ParaView
570 if (all_toolbars.size() > 2) {
571 all_toolbars.removeFirst();
572 all_toolbars.removeFirst();
580 \brief Builds a menu which referred to toolbars
582 /*void PVGUI_Module::buildToolbarsMenu()
584 SUIT_Desktop* desk = application()->desktop();
585 QMenu* aMenu = menuMgr()->findMenu( myToolbarsMenuId );
588 QList<QMenu*> child_menus = aMenu->findChildren<QMenu*>();
589 foreach (QMenu* menu, child_menus) {
592 QList<QToolBar*> all_toolbars = getParaViewToolbars();
594 // Add menus for all toolbars and actions from them.
595 // This puts menu actions for all toolbars making it possible to access all
596 // toolbar actions even when the toolbar are not visible.
597 // I wonder if I should ignore the pqMainControlsToolbar since those actions
598 // are already placed at other places.
599 foreach (QToolBar* toolbar, all_toolbars) {
600 QMenu* sub_menu = new QMenu(aMenu) << pqSetName(toolbar->windowTitle());
602 foreach (QAction* action, toolbar->actions()) {
603 if (!action->text().isEmpty()) {
605 sub_menu->addAction(action);
609 QAction* menu_action = aMenu->addMenu(sub_menu);
610 menu_action->setText(toolbar->windowTitle());
615 disconnect(aMenu, SIGNAL(aboutToShow()), this, SLOT(buildToolbarsMenu()));
620 \brief Create actions for ParaViS
622 void PVGUI_Module::createActions()
626 // Save state under the module root object
627 anAction = new QAction(tr("MEN_SAVE_MULTI_STATE"), this);
628 connect(anAction, SIGNAL(triggered()), this, SLOT(onSaveMultiState()));
629 registerAction(SaveStatePopupId, anAction);
631 // Restore the selected state by merging with the current one
632 anAction = new QAction(tr("MEN_ADD_STATE"), this);
633 connect(anAction, SIGNAL(triggered()), this, SLOT(onAddState()));
634 registerAction(AddStatePopupId, anAction);
636 // Clean the current state and restore the selected one
637 anAction = new QAction(tr("MEN_CLEAN_ADD_STATE"), this);
638 connect(anAction, SIGNAL(triggered()), this, SLOT(onCleanAddState()));
639 registerAction(CleanAndAddStatePopupId, anAction);
641 // Rename the selected object (Object Browser)
642 anAction = new QAction(tr("MEN_PARAVIS_RENAME"), this);
643 connect(anAction, SIGNAL(triggered()), this, SLOT(onRename()));
644 registerAction(ParaVisRenameId, anAction);
646 // Delete the selected object (Object Browser)
647 anAction = new QAction(tr("MEN_PARAVIS_DELETE"), this);
648 connect(anAction, SIGNAL(triggered()), this, SLOT(onDelete()));
649 registerAction(ParaVisDeleteId, anAction);
653 \brief Create actions for ParaViS
655 void PVGUI_Module::createMenus()
657 // "Window" - "New Window" - "ParaView view" menu
658 int aWindowMenu = createMenu(tr( "MEN_DESK_WINDOW" ), -1, -1);
659 int aNewWindowMenu = createMenu(tr( "MEN_DESK_NEWWINDOW"), aWindowMenu, -1, -1);
660 createMenu(ParaViewNewWindowId, aNewWindowMenu);