Salome HOME
Merge akl/tests_update: update tests
[modules/paravis.git] / src / PVGUI / PVGUI_Module_actions.cxx
1 // PARAVIS : ParaView wrapper SALOME module
2 //
3 // Copyright (C) 2010-2014  CEA/DEN, EDF R&D
4 //
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.
9 //
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.
14 //
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
18 //
19 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 //
21 // File   : PVGUI_Module_MenuActions.cxx
22 // Author : Margarita KARPUNINA
23 //
24
25 #include "PVGUI_Module.h"
26
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>
35
36 #include <QAction>
37 #include <QMenu>
38 #include <QToolBar>
39 #include <QFile>
40
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>
48
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>
83
84 #include "PVGUI_Tools.h"
85
86
87 /*!
88   \brief Create actions for ParaView GUI operations
89   duplicating menus and toolbars in MainWindow class of
90   the standard ParaView GUI client application.
91 */
92 void PVGUI_Module::pvCreateActions()
93 {
94   SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
95
96   QPixmap aPixmap;
97   QAction* anAction;
98   //QtxAction* aQtxAction;
99   
100   // --- Menu "File"
101
102   // Open File
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);
109   
110   // Load State
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);
116   
117   // Save State
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);
123
124   // Save Data
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);
131
132   // Save Screenshot
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);
139
140   // Export
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);
146
147   // Save Animation
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);
154
155   // Save Geometry
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);
162
163   // Connect
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);
170
171   // Disconnect
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);
178
179   // --- Menu "Edit"
180
181   // Undo
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);
188
189   // Redo
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);
196
197   // Camera Undo
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);
204   
205   // Camera Redo
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);
212
213   // Find Data
214   anAction = new QAction(tr("MEN_FIND_DATA"), this);
215   anAction->setToolTip("");
216   anAction->setStatusTip("");
217   registerAction(FindDataId, anAction);
218   new pqDataQueryReaction(anAction);
219   
220   // Change Input
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);
226
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);
234
235   // Delete
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);
241
242   // Delete All
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);
248
249
250   // Setting
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);*/
256   
257   // View Settings
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);
263
264   // --- Menu "View"
265   //pqViewManager* viewManager = qobject_cast<pqViewManager*>(
266   //                             pqApplicationCore::instance()->manager("MULTIVIEW_WIDGET"));
267
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.
271   //if (viewManager) {
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);
277   //}
278
279   // --- Menu "Tools"
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"));
286
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"));
293
294   // Manage Links
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"));
300
301   // Add Camera Link
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"));
307
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"));
314
315   // Record Test
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);
321
322   // Play Test
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);
328
329   // Max Window Size
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);
337
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);
346
347   // Timer Log
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"));
353
354   // Output Window
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()));
361   
362  // Python Shell
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"));
368
369   //Show Trace
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);
375
376   //Show Trace
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);
382
383   // --- Menu "Help"
384
385   // About
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"));
391
392 #ifdef HAS_PV_DOC
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);
400 #endif
401 }
402
403 /*!
404   \brief Create menus for ParaView GUI operations
405   duplicating menus in pqMainWindow ParaView class
406
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.
410 */
411 void PVGUI_Module::pvCreateMenus()
412 {
413   SUIT_Desktop* desk = application()->desktop();
414   
415   // --- Menu "File"
416   int aPVMnu = createMenu( tr( "MEN_DESK_FILE" ), -1, -1 );
417
418   createMenu( OpenFileId, aPVMnu, 5 );
419
420   // Recent Files
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 );
427    }
428
429
430   createMenu( separator(), aPVMnu, -1, 5 );
431
432   createMenu( LoadStateId, aPVMnu, 15 );
433   createMenu( SaveStateId, aPVMnu, 15 );
434   createMenu( separator(), aPVMnu, -1, 15 );
435
436   createMenu( SaveDataId, aPVMnu, 25 );
437   createMenu( SaveScreenshotId, aPVMnu, 25 );
438   createMenu( ExportId, aPVMnu, 25 );
439   createMenu( separator(), aPVMnu, -1, 25 );
440
441   createMenu( SaveAnimationId, aPVMnu, 35 );
442   createMenu( SaveGeometryId, aPVMnu, 35 );
443   createMenu( separator(), aPVMnu, -1, 35 );
444
445   createMenu( ConnectId, aPVMnu, 45 );
446   createMenu( DisconnectId, aPVMnu, 45 );
447   createMenu( separator(), aPVMnu, -1, 45 );
448
449   // --- Menu "Edit"
450   aPVMnu = createMenu( tr( "MEN_DESK_EDIT" ), -1, -1 );
451
452   createMenu( UndoId, aPVMnu );
453   createMenu( RedoId, aPVMnu );
454   createMenu( separator(), aPVMnu );
455
456   createMenu( CameraUndoId, aPVMnu );
457   createMenu( CameraRedoId, aPVMnu );
458   createMenu( separator(), aPVMnu );
459
460   createMenu( FindDataId, aPVMnu );
461   createMenu( ChangeInputId, aPVMnu );
462   createMenu( IgnoreTimeId, aPVMnu );
463   createMenu( DeleteId, aPVMnu );
464   createMenu( DeleteAllId, aPVMnu );
465   createMenu( separator(), aPVMnu );
466
467   //createMenu( SettingsId, aPVMnu );
468   createMenu( ViewSettingsId, aPVMnu );
469   createMenu( separator(), aPVMnu );
470
471   // --- Menu "View"
472   aPVMnu = createMenu( tr( "MEN_DESK_VIEW" ), -1, -1 );
473   /*myToolbarsMenuId = createMenu( "Toolbars", aPVMnu );
474   aMenu = getMenu( myToolbarsMenuId );
475   if (aMenu) {
476     buildToolbarsMenu();
477     connect(aMenu, SIGNAL(aboutToShow()), this, SLOT(buildToolbarsMenu()));
478   }
479   createMenu( separator(), aPVMnu );*/
480
481   createMenu( FullScreenId, aPVMnu );
482   
483   // --- Menu "Sources"
484
485   // Install ParaView managers for "Sources" menu
486   QMenu* aRes = 0;
487   mySourcesMenuId = createMenu( tr( "MEN_DESK_SOURCES" ), -1, -1, 60);
488   if ( (aRes = getMenu( mySourcesMenuId )) ) {
489     pqParaViewMenuBuilders::buildSourcesMenu(*aRes, desk);
490   }
491   
492   // --- Menu "Filters"
493
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);
498   }
499
500    // --- Menu "Macros"
501   myMacrosMenuId = createMenu( tr( "MEN_MACROS" ), -1, -1, 80 );
502   if ( (aRes = getMenu( myMacrosMenuId )) ) {
503     pqParaViewMenuBuilders::buildMacrosMenu(*aRes);
504   }
505  
506   // --- Menu "Tools"
507
508   int aToolsMnu = createMenu( tr( "MEN_DESK_TOOLS" ), -1, -1, 90 );
509
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 );
517
518   createMenu( RecordTestId, aToolsMnu );
519   createMenu( PlayTestId, aToolsMnu );
520   createMenu( MaxWindowSizeId, aToolsMnu );
521   createMenu( CustomWindowSizeId, aToolsMnu );
522   createMenu( separator(), aToolsMnu );
523
524   createMenu( TimerLogId, aToolsMnu );
525   createMenu( OutputWindowId, aToolsMnu );
526   createMenu( separator(), aToolsMnu );
527
528   createMenu( PythonShellId, aToolsMnu );
529   createMenu( separator(), aToolsMnu );
530   createMenu( ShowTraceId, aToolsMnu );
531   createMenu( RestartTraceId, aToolsMnu );
532
533   // --- Menu "Help"
534
535   int aHelpMnu = createMenu( tr( "MEN_DESK_HELP" ), -1, -1 );
536   int aPVHelpMnu = createMenu( tr( "ParaViS module" ), aHelpMnu, -1, 0 );
537 #ifdef HAS_PV_DOC
538   createMenu( ParaViewHelpId,  aPVHelpMnu );
539   createMenu( separator(),     aPVHelpMnu );
540 #endif
541   createMenu( AboutParaViewId, aPVHelpMnu );
542 }
543
544 /*!
545   \brief Create toolbars for ParaView GUI operations
546   duplicating toolbars in pqMainWindow ParaView class
547 */
548 void PVGUI_Module::pvCreateToolBars()
549 {
550   SUIT_Desktop* desk = application()->desktop();
551   pqParaViewMenuBuilders::buildToolbars(*desk);
552 }
553
554 /*!
555   \brief Returns QMenu by its id.
556 */
557 QMenu* PVGUI_Module::getMenu( const int id )
558 {
559   QMenu* res = 0;
560   SalomeApp_Application* anApp = getApp();
561   SUIT_Desktop* desk = anApp->desktop();
562   if ( desk ){
563     QtxActionMenuMgr* menuMgr = desk->menuMgr();
564     res = menuMgr->findMenu( id );
565   }
566   return res;
567 }
568
569 /*!
570   \brief Returns list of ParaView toolbars
571 */
572 /*QList<QToolBar*> PVGUI_Module::getParaViewToolbars()
573 {
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();
579   }
580   return all_toolbars;
581   }*/
582
583
584
585 /*!
586   \brief Builds a menu which referred to toolbars
587 */
588 /*void PVGUI_Module::buildToolbarsMenu()
589 {
590   SUIT_Desktop* desk = application()->desktop();
591   QMenu* aMenu = menuMgr()->findMenu( myToolbarsMenuId );
592   if (aMenu) {
593     aMenu->clear();
594     QList<QMenu*> child_menus = aMenu->findChildren<QMenu*>();
595     foreach (QMenu* menu, child_menus) {
596       delete menu;
597     }
598     QList<QToolBar*> all_toolbars = getParaViewToolbars();
599
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());
607       bool added = false;
608       foreach (QAction* action, toolbar->actions()) {
609         if (!action->text().isEmpty()) {
610           added = true;
611           sub_menu->addAction(action);
612         }
613       }
614       if (added) {
615         QAction* menu_action = aMenu->addMenu(sub_menu);
616         menu_action->setText(toolbar->windowTitle());
617       } else {
618         delete sub_menu;
619       }
620     }
621     disconnect(aMenu, SIGNAL(aboutToShow()), this, SLOT(buildToolbarsMenu()));
622   }
623   }*/
624
625 /*!
626   \brief Create actions for ParaViS
627 */
628 void PVGUI_Module::createActions()
629 {
630   QAction* anAction;
631
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);
637
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);
642
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);
647
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);
652
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);
657
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);
662 }
663
664 /*!
665   \brief Create actions for ParaViS
666 */
667 void PVGUI_Module::createMenus()
668 {
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);
673 }