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 <pqColorScaleToolbar.h>
45 #include <pqProgressManager.h>
46 //#include <pqRubberBandHelper.h>
47 //#include <pqScalarBarVisibilityAdaptor.h>
48 #include <pqUndoStack.h>
49 #include <pqVCRController.h>
51 #include <pqSaveStateReaction.h>
52 #include <pqLoadDataReaction.h>
53 #include <pqLoadStateReaction.h>
54 #include <pqSaveDataReaction.h>
55 #include <pqSaveScreenshotReaction.h>
56 #include <pqExportReaction.h>
57 #include <pqSaveAnimationReaction.h>
58 #include <pqSaveAnimationGeometryReaction.h>
59 #include <pqServerConnectReaction.h>
60 #include <pqServerDisconnectReaction.h>
61 #include <pqCameraUndoRedoReaction.h>
62 #include <pqUndoRedoReaction.h>
63 #include <pqDeleteReaction.h>
64 #include <pqChangePipelineInputReaction.h>
65 #include <pqApplicationSettingsReaction.h>
66 //#include <pqViewSettingsReaction.h>
67 #include <pqIgnoreSourceTimeReaction.h>
68 #include <pqViewMenuManager.h>
69 #include <pqParaViewMenuBuilders.h>
70 #include <pqProxyGroupMenuManager.h>
71 #include <pqCreateCustomFilterReaction.h>
72 #include <pqManageLinksReaction.h>
73 #include <pqManagePluginsReaction.h>
74 #include <pqCameraLinkReaction.h>
75 #include <pqManageCustomFiltersReaction.h>
76 #include <pqSetName.h>
77 #include <pqPythonShellReaction.h>
78 #include <pqTimerLogReaction.h>
79 #include <pqTestingReaction.h>
80 #include <pqAboutDialogReaction.h>
81 #include <pqHelpReaction.h>
82 #include <pqViewManager.h>
83 #include <pqDataQueryReaction.h>
84 #include <pqRecentFilesMenu.h>
85 #include <pqPipelineBrowserWidget.h>
87 #include "PVGUI_Tools.h"
91 \brief Create actions for ParaView GUI operations
92 duplicating menus and toolbars in MainWindow class of
93 the standard ParaView GUI client application.
95 void PVGUI_Module::pvCreateActions()
97 SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
101 //QtxAction* aQtxAction;
106 aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_OPEN_FILE"), false );
107 anAction = new QAction(QIcon(aPixmap), tr("MEN_OPEN_FILE"), this);
108 anAction->setToolTip(tr("TOP_OPEN_FILE"));
109 anAction->setStatusTip(tr("STB_OPEN_FILE"));
110 registerAction(OpenFileId, anAction);
111 new pqLoadDataReaction(anAction);
114 anAction = new QAction(tr("MEN_LOAD_STATE"), this);
115 anAction->setToolTip(tr("TOP_LOAD_STATE"));
116 anAction->setStatusTip(tr("STB_LOAD_STATE"));
117 registerAction(LoadStateId, anAction);
118 new pqLoadStateReaction(anAction);
121 anAction = new QAction(tr("MEN_SAVE_STATE"), this);
122 anAction->setToolTip(tr("TOP_SAVE_STATE"));
123 anAction->setStatusTip(tr("STB_SAVE_STATE"));
124 registerAction(SaveStateId, anAction);
125 new pqSaveStateReaction(anAction);
128 aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_SAVE_DATA"), false );
129 anAction = new QAction(QIcon(aPixmap), tr("MEN_SAVE_DATA"), this);
130 anAction->setToolTip(tr("TOP_SAVE_DATA"));
131 anAction->setStatusTip(tr("STB_SAVE_DATA"));
132 registerAction(SaveDataId, anAction);
133 new pqSaveDataReaction(anAction);
136 aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_SAVE_SCREENSHOT"), false );
137 anAction = new QAction(QIcon(aPixmap), tr("MEN_SAVE_SCREENSHOT"), this);
138 anAction->setToolTip(tr("TOP_SAVE_SCREENSHOT"));
139 anAction->setStatusTip(tr("STB_SAVE_SCREENSHOT"));
140 registerAction(SaveScreenshotId, anAction);
141 new pqSaveScreenshotReaction(anAction);
144 anAction = new QAction(tr("MEN_EXPORT"), this);
145 anAction->setToolTip(tr("TOP_EXPORT"));
146 anAction->setStatusTip(tr("STB_EXPORT"));
147 registerAction(ExportId, anAction);
148 new pqExportReaction(anAction);
151 aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_SAVE_ANIMATION"), false );
152 anAction = new QAction(QIcon(aPixmap), tr("MEN_SAVE_ANIMATION"), this);
153 anAction->setToolTip(tr("TOP_SAVE_ANIMATION"));
154 anAction->setStatusTip(tr("STB_SAVE_ANIMATION"));
155 registerAction(SaveAnimationId, anAction);
156 new pqSaveAnimationReaction(anAction);
159 aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_SAVE_GEOMETRY"), false );
160 anAction = new QAction(QIcon(aPixmap), tr("MEN_SAVE_GEOMETRY"), this);
161 anAction->setToolTip(tr("TOP_SAVE_GEOMETRY"));
162 anAction->setStatusTip(tr("STB_SAVE_GEOMETRY"));
163 registerAction(SaveGeometryId, anAction);
164 new pqSaveAnimationGeometryReaction(anAction);
167 aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_CONNECT"), false );
168 anAction = new QAction(QIcon(aPixmap), tr("MEN_CONNECT"), this);
169 anAction->setToolTip(tr("TOP_CONNECT"));
170 anAction->setStatusTip(tr("STB_CONNECT"));
171 registerAction(ConnectId, anAction);
172 new pqServerConnectReaction(anAction);
175 aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_DISCONNECT"), false );
176 anAction = new QAction(QIcon(aPixmap), tr("MEN_DISCONNECT"), this);
177 anAction->setToolTip(tr("TOP_DISCONNECT"));
178 anAction->setStatusTip(tr("STB_DISCONNECT"));
179 registerAction(DisconnectId, anAction);
180 new pqServerDisconnectReaction(anAction);
185 aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_UNDO"), false );
186 anAction = new QAction(QIcon(aPixmap), tr("MEN_UNDO"), this);
187 anAction->setToolTip(tr("TOP_UNDO"));
188 anAction->setStatusTip(tr("STB_UNDO"));
189 registerAction(UndoId, anAction);
190 new pqUndoRedoReaction(anAction, true);
193 aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_REDO"), false );
194 anAction = new QAction(QIcon(aPixmap), tr("MEN_REDO"), this);
195 anAction->setToolTip(tr("TOP_REDO"));
196 anAction->setStatusTip(tr("STB_REDO"));
197 registerAction(RedoId, anAction);
198 new pqUndoRedoReaction(anAction, false);
201 aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_CAMERA_UNDO"), false );
202 anAction = new QAction(QIcon(aPixmap), tr("MEN_CAMERA_UNDO"), this);
203 anAction->setToolTip(tr("TOP_CAMERA_UNDO"));
204 anAction->setStatusTip(tr("STB_CAMERA_UNDO"));
205 registerAction(CameraUndoId, anAction);
206 new pqCameraUndoRedoReaction(anAction, true);
209 aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_CAMERA_REDO"), false );
210 anAction = new QAction(QIcon(aPixmap), tr("MEN_CAMERA_REDO"), this);
211 anAction->setToolTip(tr("TOP_CAMERA_REDO"));
212 anAction->setStatusTip(tr("STB_CAMERA_REDO"));
213 registerAction(CameraRedoId, anAction);
214 new pqCameraUndoRedoReaction(anAction, false);
217 anAction = new QAction(tr("MEN_FIND_DATA"), this);
218 anAction->setToolTip("");
219 anAction->setStatusTip("");
220 registerAction(FindDataId, anAction);
221 new pqDataQueryReaction(anAction);
224 anAction = new QAction(tr("MEN_CHANGE_INPUT"), this);
225 anAction->setToolTip(tr("TOP_CHANGE_INPUT"));
226 anAction->setStatusTip(tr("STB_CHANGE_INPUT"));
227 registerAction(ChangeInputId, anAction);
228 new pqChangePipelineInputReaction(anAction);
230 // Ignore source time
231 anAction = new QAction(tr("MEN_IGNORE_TIME"), this);
232 anAction->setToolTip(tr("TOP_IGNORE_TIME"));
233 anAction->setStatusTip(tr("STB_IGNORE_TIME"));
234 anAction->setCheckable(true);
235 registerAction(IgnoreTimeId, anAction);
236 new pqIgnoreSourceTimeReaction(anAction);
239 anAction = new QAction(tr("MEN_DELETE"), this);
240 anAction->setToolTip(tr("TOP_DELETE"));
241 anAction->setStatusTip(tr("STB_DELETE"));
242 registerAction(DeleteId, anAction);
243 new pqDeleteReaction(anAction);
246 anAction = new QAction(tr("MEN_DELETE_ALL"), this);
247 anAction->setToolTip(tr("TOP_DELETE_ALL"));
248 anAction->setStatusTip(tr("STB_DELETE_ALL"));
249 registerAction(DeleteAllId, anAction);
250 new pqDeleteReaction(anAction, true);
254 /*anAction = new QAction(tr("MEN_SETTINGS"), this);
255 anAction->setToolTip(tr("TOP_SETTINGS"));
256 anAction->setStatusTip(tr("STB_SETTINGS"));
257 registerAction(SettingsId, anAction);
258 new pqApplicationSettingsReaction(anAction);*/
261 // anAction = new QAction(tr("MEN_VIEW_SETTINGS"), this);
262 // anAction->setToolTip(tr("TOP_VIEW_SETTINGS"));
263 // anAction->setStatusTip(tr("STB_VIEW_SETTINGS"));
264 // registerAction(ViewSettingsId, anAction);
265 // new pqViewSettingsReaction(anAction);
268 //pqViewManager* viewManager = qobject_cast<pqViewManager*>(
269 // pqApplicationCore::instance()->manager("MULTIVIEW_WIDGET"));
271 //rnv: Commented to implement issue
272 //21318: EDF 1615 ALL: Display in full screen mode
273 //Switching to the "Full screen" mode added in the SALOME GUI module.
275 //anAction = new QAction("Full Screen", this);
276 //anAction->setObjectName("actionFullScreen");
277 //anAction->setShortcut(QKeySequence("F11"));
278 //connect(anAction, SIGNAL(triggered()), viewManager, SLOT(toggleFullScreen()));
279 //registerAction(FullScreenId, anAction);
283 // Create Custom Filter
284 anAction = new QAction(tr("MEN_CREATE_CUSTOM_FILTER"), this);
285 anAction->setToolTip(tr("TOP_CREATE_CUSTOM_FILTER"));
286 anAction->setStatusTip(tr("STB_CREATE_CUSTOM_FILTER"));
287 registerAction(CreateCustomFilterId, anAction);
288 new pqCreateCustomFilterReaction(anAction << pqSetName("actionToolsCreateCustomFilter"));
290 // Manage Custom Filters
291 anAction = new QAction(tr("MEN_MANAGE_CUSTOM_FILTERS"), this);
292 anAction->setToolTip(tr("TOP_MANAGE_CUSTOM_FILTERS"));
293 anAction->setStatusTip(tr("STB_MANAGE_CUSTOM_FILTERS"));
294 registerAction(ManageCustomFiltersId, anAction);
295 new pqManageCustomFiltersReaction(anAction << pqSetName("actionToolsManageCustomFilters"));
298 anAction = new QAction(tr("MEN_MANAGE_LINKS"), this);
299 anAction->setToolTip(tr("TOP_MANAGE_LINKS"));
300 anAction->setStatusTip(tr("STB_MANAGE_LINKS"));
301 registerAction(ManageLinksId, anAction);
302 new pqManageLinksReaction(anAction << pqSetName("actionToolsManageLinks"));
305 anAction = new QAction(tr("MEN_ADD_CAMERA_LINK"), this);
306 anAction->setToolTip(tr("TOP_ADD_CAMERA_LINK"));
307 anAction->setStatusTip(tr("STB_ADD_CAMERA_LINK"));
308 registerAction(AddCameraLinkId, anAction);
309 new pqCameraLinkReaction(anAction << pqSetName("actionToolsAddCameraLink"));
311 // Manage Plugins/Extensions
312 anAction = new QAction(tr("MEN_MANAGE_PLUGINS"), this);
313 anAction->setToolTip(tr("TOP_MANAGE_PLUGINS"));
314 anAction->setStatusTip(tr("STB_MANAGE_PLUGINS"));
315 registerAction(ManagePluginsExtensionsId, anAction);
316 new pqManagePluginsReaction(anAction << pqSetName("actionManage_Plugins"));
319 anAction = new QAction(tr("MEN_RECORD_TEST"), this);
320 anAction->setToolTip(tr("TOP_RECORD_TEST"));
321 anAction->setStatusTip(tr("STB_RECORD_TEST"));
322 registerAction(RecordTestId, anAction);
323 new pqTestingReaction(anAction << pqSetName("actionToolsRecordTest"), pqTestingReaction::RECORD);
326 anAction = new QAction(tr("MEN_PLAY_TEST"), this);
327 anAction->setToolTip(tr("TOP_PLAY_TEST"));
328 anAction->setStatusTip(tr("STB_PLAY_TEST"));
329 registerAction(PlayTestId, anAction);
330 new pqTestingReaction(anAction << pqSetName("actionToolsPlayTest"), pqTestingReaction::PLAYBACK);
333 anAction = new QAction(tr("MEN_MAX_WINDOW_SIZE"), this);
334 anAction->setToolTip(tr("TOP_MAX_WINDOW_SIZE"));
335 anAction->setStatusTip(tr("PRP_APP_MAX_WINDOW_SIZE"));
336 anAction->setCheckable(true);
337 registerAction(MaxWindowSizeId, anAction);
338 new pqTestingReaction(anAction << pqSetName("actionTesting_Window_Size"),
339 pqTestingReaction::LOCK_VIEW_SIZE);
341 // Custom Window Size
342 anAction = new QAction(tr("MEN_CUSTOM_WINDOW_SIZE"), this);
343 anAction->setToolTip(tr(""));
344 anAction->setStatusTip(tr(""));
345 anAction->setCheckable(true);
346 registerAction(CustomWindowSizeId, anAction);
347 new pqTestingReaction(anAction << pqSetName("actionTesting_Window_Size_Custom"),
348 pqTestingReaction::LOCK_VIEW_SIZE_CUSTOM);
351 anAction = new QAction(tr("MEN_TIMER_LOG"), this);
352 anAction->setToolTip(tr("TOP_TIMER_LOG"));
353 anAction->setStatusTip(tr("STB_TIMER_LOG"));
354 registerAction(TimerLogId, anAction);
355 new pqTimerLogReaction(anAction << pqSetName("actionToolsTimerLog"));
358 anAction = new QAction(tr("MEN_OUTPUT_WINDOW"), this);
359 anAction->setToolTip(tr("TOP_OUTPUT_WINDOW"));
360 anAction->setStatusTip(tr("STB_OUTPUT_WINDOW"));
361 registerAction(OutputWindowId, anAction);
362 anAction << pqSetName("actionToolsOutputWindow");
363 connect(anAction, SIGNAL(triggered()), pqApplicationCore::instance(), SLOT(showOutputWindow()));
366 anAction = new QAction(tr("MEN_PYTHON_SHELL"), this);
367 anAction->setToolTip(tr("TOP_PYTHON_SHELL"));
368 anAction->setStatusTip(tr("STB_PYTHON_SHELL"));
369 registerAction(PythonShellId, anAction);
370 new pqPythonShellReaction(anAction << pqSetName("actionToolsPythonShell"));
373 anAction = new QAction(tr("MEN_SHOW_TRACE"), this);
374 anAction->setToolTip(tr("TOP_SHOW_TRACE"));
375 anAction->setStatusTip(tr("STB_SHOW_TRACE"));
376 connect(anAction, SIGNAL(triggered()), this, SLOT(onShowTrace()));
377 registerAction(ShowTraceId, anAction);
380 anAction = new QAction(tr("MEN_RESTART_TRACE"), this);
381 anAction->setToolTip(tr("TOP_RESTART_TRACE"));
382 anAction->setStatusTip(tr("STB_RESTART_TRACE"));
383 connect(anAction, SIGNAL(triggered()), this, SLOT(onRestartTrace()));
384 registerAction(RestartTraceId, anAction);
389 anAction = new QAction(tr("MEN_ABOUT"), this);
390 anAction->setToolTip(tr("TOP_ABOUT"));
391 anAction->setStatusTip(tr("STB_ABOUT"));
392 registerAction(AboutParaViewId, anAction);
393 new pqAboutDialogReaction(anAction << pqSetName("actionAbout"));
396 // Native ParaView user documentation
397 aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_PARAVIEW_HELP"), false );
398 anAction = new QAction(tr("MEN_PARAVIEW_HELP"), this);
399 anAction->setToolTip(tr("TOP_PARAVIEW_HELP"));
400 anAction->setStatusTip(tr("STB_PARAVIEW_HELP"));
401 registerAction(ParaViewHelpId, anAction);
402 new pqHelpReaction(anAction);
407 \brief Create menus for ParaView GUI operations
408 duplicating menus in pqMainWindow ParaView class
410 In particular, ParaView is responsible for updating "Sources" and "Filters" menus.
411 For this, specific menu managers created by pqMainWindowCore class are used, and PVGUI_Module
412 is responsible for creation of corresponding QMenu objects only.
414 void PVGUI_Module::pvCreateMenus()
416 SUIT_Desktop* desk = application()->desktop();
419 int aPVMnu = createMenu( tr( "MEN_DESK_FILE" ), -1, -1 );
421 createMenu( OpenFileId, aPVMnu, 5 );
424 myRecentMenuId = createMenu( tr( "MEN_RECENT_FILES" ), aPVMnu, -1, 5 );
425 QMenu* aMenu = menuMgr()->findMenu( myRecentMenuId );
426 pqRecentFilesMenu* aRecentFilesMenu = new pqRecentFilesMenu( *aMenu, getApp()->desktop() );
427 QList<QAction*> anActns = aMenu->actions();
428 for (int i = 0; i < anActns.size(); ++i)
429 createMenu( anActns.at(i), myRecentMenuId );
431 createMenu( separator(), aPVMnu, -1, 5 );
433 createMenu( LoadStateId, aPVMnu, 15 );
434 createMenu( SaveStateId, aPVMnu, 15 );
435 createMenu( separator(), aPVMnu, -1, 15 );
437 createMenu( SaveDataId, aPVMnu, 25 );
438 createMenu( SaveScreenshotId, aPVMnu, 25 );
439 createMenu( ExportId, aPVMnu, 25 );
440 createMenu( separator(), aPVMnu, -1, 25 );
442 createMenu( SaveAnimationId, aPVMnu, 35 );
443 createMenu( SaveGeometryId, aPVMnu, 35 );
444 createMenu( separator(), aPVMnu, -1, 35 );
446 createMenu( ConnectId, aPVMnu, 45 );
447 createMenu( DisconnectId, aPVMnu, 45 );
448 createMenu( separator(), aPVMnu, -1, 45 );
451 aPVMnu = createMenu( tr( "MEN_DESK_EDIT" ), -1, -1 );
453 createMenu( UndoId, aPVMnu );
454 createMenu( RedoId, aPVMnu );
455 createMenu( separator(), aPVMnu );
457 createMenu( CameraUndoId, aPVMnu );
458 createMenu( CameraRedoId, aPVMnu );
459 createMenu( separator(), aPVMnu );
461 createMenu( FindDataId, aPVMnu );
462 createMenu( ChangeInputId, aPVMnu );
463 createMenu( IgnoreTimeId, aPVMnu );
464 createMenu( DeleteId, aPVMnu );
465 createMenu( DeleteAllId, aPVMnu );
466 createMenu( separator(), aPVMnu );
468 //createMenu( SettingsId, aPVMnu );
469 //createMenu( ViewSettingsId, aPVMnu );
470 createMenu( separator(), aPVMnu );
473 aPVMnu = createMenu( tr( "MEN_DESK_VIEW" ), -1, -1 );
474 /*myToolbarsMenuId = createMenu( "Toolbars", aPVMnu );
475 aMenu = getMenu( myToolbarsMenuId );
478 connect(aMenu, SIGNAL(aboutToShow()), this, SLOT(buildToolbarsMenu()));
480 createMenu( separator(), aPVMnu );*/
482 createMenu( FullScreenId, aPVMnu );
484 // --- Menu "Sources"
485 // Install ParaView managers for "Sources" menu
487 PVViewer_GUIElements * guiElements = PVViewer_GUIElements::GetInstance(desk);
488 aRes = guiElements->getSourcesMenu();
489 mySourcesMenuId = createMenu( tr( "MEN_DESK_SOURCES" ), -1, -1, 60, -1, aRes);
491 // --- Menu "Filters"
492 // Install ParaView managers for "Filters" menu
493 aRes = guiElements->getFiltersMenu();
494 myFiltersMenuId = createMenu( tr( "MEN_DESK_FILTERS" ), -1, -1, 70, -1, aRes);
497 aRes = guiElements->getMacrosMenu();
498 myMacrosMenuId = createMenu( tr( "MEN_MACROS" ), -1, -1, 80, -1, aRes);
501 int aToolsMnu = createMenu( tr( "MEN_DESK_TOOLS" ), -1, -1, 90 );
503 createMenu( CreateCustomFilterId, aToolsMnu );
504 createMenu( AddCameraLinkId, aToolsMnu );
505 createMenu( separator(), aToolsMnu );
506 createMenu( ManageCustomFiltersId, aToolsMnu );
507 createMenu( ManageLinksId, aToolsMnu );
508 createMenu( ManagePluginsExtensionsId, aToolsMnu );
509 createMenu( separator(), aToolsMnu );
511 createMenu( RecordTestId, aToolsMnu );
512 createMenu( PlayTestId, aToolsMnu );
513 createMenu( MaxWindowSizeId, aToolsMnu );
514 createMenu( CustomWindowSizeId, aToolsMnu );
515 createMenu( separator(), aToolsMnu );
517 createMenu( TimerLogId, aToolsMnu );
518 createMenu( OutputWindowId, aToolsMnu );
519 createMenu( separator(), aToolsMnu );
521 createMenu( PythonShellId, aToolsMnu );
522 createMenu( separator(), aToolsMnu );
523 createMenu( ShowTraceId, aToolsMnu );
524 createMenu( RestartTraceId, aToolsMnu );
528 int aHelpMnu = createMenu( tr( "MEN_DESK_HELP" ), -1, -1 );
529 int aPVHelpMnu = createMenu( tr( "ParaViS module" ), aHelpMnu, -1, 0 );
531 createMenu( ParaViewHelpId, aPVHelpMnu );
532 createMenu( separator(), aPVHelpMnu );
534 createMenu( AboutParaViewId, aPVHelpMnu );
536 // -- Context menu in the pipeline browser
537 pqPipelineBrowserWidget * pq = guiElements->getPipelineBrowserWidget();
538 pqParaViewMenuBuilders::buildPipelineBrowserContextMenu( *pq );
540 // // Reload configuration to populate dynamic menus from ParaView:
541 // PVViewer_ViewManager::ParaviewLoadConfigurations(true);
543 // // Disable all filters for now (for some weird reasons they are all on when starting?)
544 // QList<QMenu*> sub_menus = filtersMenu->findChildren<QMenu*>();
545 // foreach(QMenu * m, sub_menus)
547 // QList<QAction *> act_list = m->actions();
548 // foreach(QAction * a, act_list)
550 // a->setEnabled(false);
556 \brief Create toolbars for ParaView GUI operations
557 duplicating toolbars in pqMainWindow ParaView class
559 void PVGUI_Module::pvCreateToolBars()
561 SUIT_Desktop* desk = application()->desktop();
562 // pqParaViewMenuBuilders::buildToolbars(*desk);
563 PVViewer_GUIElements * guiElements = PVViewer_GUIElements::GetInstance(desk);
564 guiElements->setToolBarVisible(true);
568 \brief Returns QMenu by its id.
570 QMenu* PVGUI_Module::getMenu( const int id )
573 //SalomeApp_Application* anApp = getApp();
574 LightApp_Application* anApp = getApp();
575 SUIT_Desktop* desk = anApp->desktop();
577 QtxActionMenuMgr* menuMgr = desk->menuMgr();
578 res = menuMgr->findMenu( id );
584 \brief Returns list of ParaView toolbars
586 /*QList<QToolBar*> PVGUI_Module::getParaViewToolbars()
588 QList<QToolBar*> all_toolbars = application()->desktop()->findChildren<QToolBar*>();
589 // First two toolbars has to be ignored because they are not from ParaView
590 if (all_toolbars.size() > 2) {
591 all_toolbars.removeFirst();
592 all_toolbars.removeFirst();
600 \brief Builds a menu which referred to toolbars
602 /*void PVGUI_Module::buildToolbarsMenu()
604 SUIT_Desktop* desk = application()->desktop();
605 QMenu* aMenu = menuMgr()->findMenu( myToolbarsMenuId );
608 QList<QMenu*> child_menus = aMenu->findChildren<QMenu*>();
609 foreach (QMenu* menu, child_menus) {
612 QList<QToolBar*> all_toolbars = getParaViewToolbars();
614 // Add menus for all toolbars and actions from them.
615 // This puts menu actions for all toolbars making it possible to access all
616 // toolbar actions even when the toolbar are not visible.
617 // I wonder if I should ignore the pqMainControlsToolbar since those actions
618 // are already placed at other places.
619 foreach (QToolBar* toolbar, all_toolbars) {
620 QMenu* sub_menu = new QMenu(aMenu) << pqSetName(toolbar->windowTitle());
622 foreach (QAction* action, toolbar->actions()) {
623 if (!action->text().isEmpty()) {
625 sub_menu->addAction(action);
629 QAction* menu_action = aMenu->addMenu(sub_menu);
630 menu_action->setText(toolbar->windowTitle());
635 disconnect(aMenu, SIGNAL(aboutToShow()), this, SLOT(buildToolbarsMenu()));
640 \brief Create actions for ParaViS
642 void PVGUI_Module::createActions()
646 // // New ParaView window
647 // anAction = new QtxAction(tr("MEN_NEW_PV_VIEW"), tr("MEN_NEW_PV_VIEW"), 0,
648 // this, false, "ParaViS:Create new ParaView view");
649 // connect(anAction, SIGNAL(triggered()), this, SLOT(onNewParaViewWindow()));
650 // registerAction(ParaViewNewWindowId, anAction);
652 // Save state under the module root object
653 anAction = new QAction(tr("MEN_SAVE_MULTI_STATE"), this);
654 connect(anAction, SIGNAL(triggered()), this, SLOT(onSaveMultiState()));
655 registerAction(SaveStatePopupId, anAction);
657 // Restore the selected state by merging with the current one
658 anAction = new QAction(tr("MEN_ADD_STATE"), this);
659 connect(anAction, SIGNAL(triggered()), this, SLOT(onAddState()));
660 registerAction(AddStatePopupId, anAction);
662 // Clean the current state and restore the selected one
663 anAction = new QAction(tr("MEN_CLEAN_ADD_STATE"), this);
664 connect(anAction, SIGNAL(triggered()), this, SLOT(onCleanAddState()));
665 registerAction(CleanAndAddStatePopupId, anAction);
667 // Rename the selected object (Object Browser)
668 anAction = new QAction(tr("MEN_PARAVIS_RENAME"), this);
669 connect(anAction, SIGNAL(triggered()), this, SLOT(onRename()));
670 registerAction(ParaVisRenameId, anAction);
672 // Delete the selected object (Object Browser)
673 anAction = new QAction(tr("MEN_PARAVIS_DELETE"), this);
674 connect(anAction, SIGNAL(triggered()), this, SLOT(onDelete()));
675 registerAction(ParaVisDeleteId, anAction);
679 \brief Create actions for ParaViS
681 void PVGUI_Module::createMenus()
683 // "Window" - "New Window" - "ParaView view" menu
684 int aWindowMenu = createMenu(tr( "MEN_DESK_WINDOW" ), -1, -1);
685 int aNewWindowMenu = createMenu(tr( "MEN_DESK_NEWWINDOW"), aWindowMenu, -1, -1);
686 createMenu(ParaViewNewWindowId, aNewWindowMenu);