1 // PARAVIS : ParaView wrapper SALOME module
3 // Copyright (C) 2010-2012 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.
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);
379 anAction = new QAction(tr("MEN_ABOUT"), this);
380 anAction->setToolTip(tr("TOP_ABOUT"));
381 anAction->setStatusTip(tr("STB_ABOUT"));
382 registerAction(AboutParaViewId, anAction);
383 new pqAboutDialogReaction(anAction << pqSetName("actionAbout"));
386 // Native ParaView user documentation
387 aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_PARAVIEW_HELP"), false );
388 anAction = new QAction(tr("MEN_PARAVIEW_HELP"), this);
389 anAction->setToolTip(tr("TOP_PARAVIEW_HELP"));
390 anAction->setStatusTip(tr("STB_PARAVIEW_HELP"));
391 registerAction(ParaViewHelpId, anAction);
392 new pqHelpReaction(anAction);
397 \brief Create menus for ParaView GUI operations
398 duplicating menus in pqMainWindow ParaView class
400 In particular, ParaView is responsible for updating "Sources" and "Filters" menus.
401 For this, specific menu managers created by pqMainWindowCore class are used, and PVGUI_Module
402 is responsible for creation of corresponding QMenu objects only.
404 void PVGUI_Module::pvCreateMenus()
406 SUIT_Desktop* desk = application()->desktop();
409 int aPVMnu = createMenu( tr( "MEN_DESK_FILE" ), -1, -1 );
411 createMenu( OpenFileId, aPVMnu, 5 );
414 myRecentMenuId = createMenu( tr( "MEN_RECENT_FILES" ), aPVMnu, -1, 5 );
415 QMenu* aMenu = menuMgr()->findMenu( myRecentMenuId );
416 pqRecentFilesMenu* aRecentFilesMenu = new pqRecentFilesMenu( *aMenu, getApp()->desktop() );
417 QList<QAction*> anActns = aMenu->actions();
418 for (int i = 0; i < anActns.size(); ++i) {
419 createMenu( anActns.at(i), myRecentMenuId );
423 createMenu( separator(), aPVMnu, -1, 5 );
425 createMenu( LoadStateId, aPVMnu, 15 );
426 createMenu( SaveStateId, aPVMnu, 15 );
427 createMenu( separator(), aPVMnu, -1, 15 );
429 createMenu( SaveDataId, aPVMnu, 25 );
430 createMenu( SaveScreenshotId, aPVMnu, 25 );
431 createMenu( ExportId, aPVMnu, 25 );
432 createMenu( separator(), aPVMnu, -1, 25 );
434 createMenu( SaveAnimationId, aPVMnu, 35 );
435 createMenu( SaveGeometryId, aPVMnu, 35 );
436 createMenu( separator(), aPVMnu, -1, 35 );
438 createMenu( ConnectId, aPVMnu, 45 );
439 createMenu( DisconnectId, aPVMnu, 45 );
440 createMenu( separator(), aPVMnu, -1, 45 );
443 aPVMnu = createMenu( tr( "MEN_DESK_EDIT" ), -1, -1 );
445 createMenu( UndoId, aPVMnu );
446 createMenu( RedoId, aPVMnu );
447 createMenu( separator(), aPVMnu );
449 createMenu( CameraUndoId, aPVMnu );
450 createMenu( CameraRedoId, aPVMnu );
451 createMenu( separator(), aPVMnu );
453 createMenu( FindDataId, aPVMnu );
454 createMenu( ChangeInputId, aPVMnu );
455 createMenu( IgnoreTimeId, aPVMnu );
456 createMenu( DeleteId, aPVMnu );
457 createMenu( DeleteAllId, aPVMnu );
458 createMenu( separator(), aPVMnu );
460 //createMenu( SettingsId, aPVMnu );
461 createMenu( ViewSettingsId, aPVMnu );
462 createMenu( separator(), aPVMnu );
465 aPVMnu = createMenu( tr( "MEN_DESK_VIEW" ), -1, -1 );
466 /*myToolbarsMenuId = createMenu( "Toolbars", aPVMnu );
467 aMenu = getMenu( myToolbarsMenuId );
470 connect(aMenu, SIGNAL(aboutToShow()), this, SLOT(buildToolbarsMenu()));
472 createMenu( separator(), aPVMnu );*/
474 createMenu( FullScreenId, aPVMnu );
476 // --- Menu "Sources"
478 // Install ParaView managers for "Sources" menu
480 mySourcesMenuId = createMenu( tr( "MEN_DESK_SOURCES" ), -1, -1, 60);
481 if ( (aRes = getMenu( mySourcesMenuId )) ) {
482 pqParaViewMenuBuilders::buildSourcesMenu(*aRes, desk);
485 // --- Menu "Filters"
487 // Install ParaView managers for "Filters" menu
488 myFiltersMenuId = createMenu( tr( "MEN_DESK_FILTERS" ), -1, -1, 70 );
489 if ( (aRes = getMenu( myFiltersMenuId )) ) {
490 pqParaViewMenuBuilders::buildFiltersMenu(*aRes, desk);
494 myMacrosMenuId = createMenu( tr( "MEN_MACROS" ), -1, -1, 80 );
495 if ( (aRes = getMenu( myMacrosMenuId )) ) {
496 pqParaViewMenuBuilders::buildMacrosMenu(*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 );
527 int aHelpMnu = createMenu( tr( "MEN_DESK_HELP" ), -1, -1 );
528 int aPVHelpMnu = createMenu( tr( "ParaViS module" ), aHelpMnu, -1, 0 );
530 createMenu( ParaViewHelpId, aPVHelpMnu );
531 createMenu( separator(), aPVHelpMnu );
533 createMenu( AboutParaViewId, aPVHelpMnu );
537 \brief Create toolbars for ParaView GUI operations
538 duplicating toolbars in pqMainWindow ParaView class
540 void PVGUI_Module::pvCreateToolBars()
542 SUIT_Desktop* desk = application()->desktop();
543 pqParaViewMenuBuilders::buildToolbars(*desk);
547 \brief Returns QMenu by its id.
549 QMenu* PVGUI_Module::getMenu( const int id )
552 SalomeApp_Application* anApp = getApp();
553 SUIT_Desktop* desk = anApp->desktop();
555 QtxActionMenuMgr* menuMgr = desk->menuMgr();
556 res = menuMgr->findMenu( id );
562 \brief Returns list of ParaView toolbars
564 /*QList<QToolBar*> PVGUI_Module::getParaViewToolbars()
566 QList<QToolBar*> all_toolbars = application()->desktop()->findChildren<QToolBar*>();
567 // First two toolbars has to be ignored because they are not from ParaView
568 if (all_toolbars.size() > 2) {
569 all_toolbars.removeFirst();
570 all_toolbars.removeFirst();
578 \brief Builds a menu which referred to toolbars
580 /*void PVGUI_Module::buildToolbarsMenu()
582 SUIT_Desktop* desk = application()->desktop();
583 QMenu* aMenu = menuMgr()->findMenu( myToolbarsMenuId );
586 QList<QMenu*> child_menus = aMenu->findChildren<QMenu*>();
587 foreach (QMenu* menu, child_menus) {
590 QList<QToolBar*> all_toolbars = getParaViewToolbars();
592 // Add menus for all toolbars and actions from them.
593 // This puts menu actions for all toolbars making it possible to access all
594 // toolbar actions even when the toolbar are not visible.
595 // I wonder if I should ignore the pqMainControlsToolbar since those actions
596 // are already placed at other places.
597 foreach (QToolBar* toolbar, all_toolbars) {
598 QMenu* sub_menu = new QMenu(aMenu) << pqSetName(toolbar->windowTitle());
600 foreach (QAction* action, toolbar->actions()) {
601 if (!action->text().isEmpty()) {
603 sub_menu->addAction(action);
607 QAction* menu_action = aMenu->addMenu(sub_menu);
608 menu_action->setText(toolbar->windowTitle());
613 disconnect(aMenu, SIGNAL(aboutToShow()), this, SLOT(buildToolbarsMenu()));
618 \brief Create actions for ParaViS
620 void PVGUI_Module::createActions()
624 // New ParaView window
625 anAction = new QtxAction(tr("MEN_NEW_PV_VIEW"), tr("MEN_NEW_PV_VIEW"), 0,
626 this, false, "ParaViS:Create new ParaView view");
627 connect(anAction, SIGNAL(triggered()), this, SLOT(onNewParaViewWindow()));
628 registerAction(ParaViewNewWindowId, anAction);
630 // Save state under the module root object
631 anAction = new QAction(tr("MEN_SAVE_MULTI_STATE"), this);
632 connect(anAction, SIGNAL(triggered()), this, SLOT(onSaveMultiState()));
633 registerAction(SaveStatePopupId, anAction);
635 // Restore the selected state by merging with the current one
636 anAction = new QAction(tr("MEN_ADD_STATE"), this);
637 connect(anAction, SIGNAL(triggered()), this, SLOT(onAddState()));
638 registerAction(AddStatePopupId, anAction);
640 // Clean the current state and restore the selected one
641 anAction = new QAction(tr("MEN_CLEAN_ADD_STATE"), this);
642 connect(anAction, SIGNAL(triggered()), this, SLOT(onCleanAddState()));
643 registerAction(CleanAndAddStatePopupId, anAction);
645 // Rename the selected object (Object Browser)
646 anAction = new QAction(tr("MEN_PARAVIS_RENAME"), this);
647 connect(anAction, SIGNAL(triggered()), this, SLOT(onRename()));
648 registerAction(ParaVisRenameId, anAction);
650 // Delete the selected object (Object Browser)
651 anAction = new QAction(tr("MEN_PARAVIS_DELETE"), this);
652 connect(anAction, SIGNAL(triggered()), this, SLOT(onDelete()));
653 registerAction(ParaVisDeleteId, anAction);
657 \brief Create actions for ParaViS
659 void PVGUI_Module::createMenus()
661 // "Window" - "New Window" - "ParaView view" menu
662 int aWindowMenu = createMenu(tr( "MEN_DESK_WINDOW" ), -1, -1);
663 int aNewWindowMenu = createMenu(tr( "MEN_DESK_NEWWINDOW"), aWindowMenu, -1, -1);
664 createMenu(ParaViewNewWindowId, aNewWindowMenu);