Salome HOME
Merge remote branch 'origin/abn/guifix' into V7_5_BR
[modules/paravis.git] / src / PVGUI / PVGUI_Module_widgets.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 #include "PVViewer_ViewManager.h"
27 #include "PVViewer_GUIElements.h"
28
29 #include <QtxActionToolMgr.h>
30 #include <LightApp_Application.h>
31 #include <SalomeApp_Application.h>   // // should ultimately be a LightApp only
32 #include <SUIT_Desktop.h>
33
34 #include <QApplication>
35 #include <QAction>
36 #include <QDockWidget>
37 #include <QToolBar>
38 #include <QStatusBar>
39 #include <QShortcut>
40 #include <QScrollArea>
41 #include <QVBoxLayout>
42 #include <QShowEvent>
43 #include <QToolButton>
44
45 #include <pqAnimationViewWidget.h> 
46 #include <pqAnimationWidget.h> 
47
48 #include <pqApplicationCore.h>
49 #include <pqComparativeVisPanel.h>
50 #include <pqPipelineBrowserWidget.h>
51 #include <pqProxyInformationWidget.h>
52 #include <pqSettings.h>
53 #include <pqDataInformationWidget.h>
54 #include <pqPVAnimationWidget.h>
55 #include <pqFindDataSelectionDisplayFrame.h>
56 #include <pqMultiBlockInspectorPanel.h>
57 #include <pqProgressWidget.h>
58 #include <pqProgressManager.h>
59 //#include <pqDisplayProxyEditorWidget.h>
60 #include <pqPropertiesPanel.h>
61
62 #include <pqApplicationCore.h>
63 #include <pqPluginManager.h>
64 #include <pqParaViewMenuBuilders.h>
65 #include <pqCollaborationPanel.h>
66 #include <pqMemoryInspectorPanel.h>
67 #include <pqColorMapEditor.h>
68 #include <pqDeleteReaction.h>
69
70 #include <vtkPVGeneralSettings.h>
71
72 class ResizeHelper : public pqPVAnimationWidget
73 {
74   // TEMPORARILY WORKAROUND AROUND PARAVIEW 3.14 BUG:
75   // WHEN ANIMATION VIEW IS RESIZED, ITS CONTENTS IS NOT PREPERLY RE-ARRANGED
76   // CAUSING SOME CONTROLS TO STAY NON-VISIBLE
77   // THIS BUG IS NATURALLY FIXED BY ADDING
78   //      this->updateGeometries();
79   // TO THE
80   //     void pqAnimationWidget::resizeEvent(QResizeEvent* e);
81   // BUT THIS CANNOT BE DONE DIRECTLY, SINCE CORRESPONDING API IS NOT PUBLIC
82   // THE ONLY WAY TO DO THIS BY SENDING SHOW EVENT TO THE WIDGET
83
84 public:
85   ResizeHelper( QWidget* parent ) : pqPVAnimationWidget( parent ) {}
86 protected:
87   void resizeEvent(QResizeEvent* e)
88   {
89     pqAnimationWidget* w = findChild<pqAnimationWidget*>( "pqAnimationWidget" );
90     if ( w ) {
91       QShowEvent e;
92       QApplication::sendEvent( w, &e );
93     }
94     pqPVAnimationWidget::resizeEvent( e );
95   }
96 };
97
98
99
100 /*!
101   \brief Create dock widgets for ParaView widgets such as object inspector, pipeline browser, etc.
102   ParaView pqMainWindowCore class is fully responsible for these dock widgets' contents.
103   ==> To update this function, see the reference set up of ParaView in Application/Paraview/ParaviewMainWindow.ui
104 */
105 void PVGUI_Module::setupDockWidgets()
106 {
107   SUIT_Desktop* desk = application()->desktop();
108   PVViewer_GUIElements * guiElements = PVViewer_GUIElements::GetInstance(desk);
109  
110   desk->setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
111   desk->setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
112   desk->setTabPosition(Qt::LeftDockWidgetArea, QTabWidget::North);
113
114   // Pipeline
115   QDockWidget* pipelineBrowserDock = new QDockWidget( tr( "TTL_PIPELINE_BROWSER" ), desk );
116   pipelineBrowserDock->setObjectName("pipelineBrowserDock");
117   pipelineBrowserDock->setAllowedAreas( Qt::LeftDockWidgetArea|Qt::NoDockWidgetArea|Qt::RightDockWidgetArea );
118   desk->addDockWidget( Qt::LeftDockWidgetArea, pipelineBrowserDock );
119   pqPipelineBrowserWidget* browser = guiElements->getPipelineBrowserWidget();
120   pipelineBrowserDock->setWidget(browser);
121   myDockWidgets[pipelineBrowserDock] = true;
122   pipelineBrowserDock->hide();
123
124   // PROPERTIES, DISPLAY and VIEW:
125   // See ParaViewMainWindow.cxx - those three panels can be separated or grouped.
126   pqSettings *settings = pqApplicationCore::instance()->settings();
127
128   //    Properties dock (previously called OBJECT_INSPECTOR)
129   QDockWidget* propertiesDock = new QDockWidget( tr( "TTL_OBJECT_INSPECTOR" ), desk );
130   propertiesDock->setObjectName("propertiesDock");
131   propertiesDock->setAllowedAreas( Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea );
132   desk->addDockWidget( Qt::LeftDockWidgetArea, propertiesDock );
133
134   pqPropertiesPanel* propertiesPanel = guiElements->getPropertiesPanel();
135   propertiesDock->setWidget(propertiesPanel);
136   connect( propertiesPanel, SIGNAL( helpRequested(const QString&, const QString&) ),  this, SLOT( showHelpForProxy(const QString&, const QString&) ) );
137   //            hook delete to pqDeleteReaction.
138   QAction* tempDeleteAction = new QAction(this);
139   pqDeleteReaction* handler = new pqDeleteReaction(tempDeleteAction);
140   handler->connect(propertiesPanel, SIGNAL(deleteRequested(pqPipelineSource*)), SLOT(deleteSource(pqPipelineSource*)));
141   myDockWidgets[propertiesDock] = true;
142   propertiesDock->hide();
143
144   // Display dock
145   QDockWidget* displayPropertiesDock = new QDockWidget( tr( "TTL_DISPLAY" ), desk );
146   displayPropertiesDock->setObjectName("displayPropertiesDock");
147   displayPropertiesDock->setAllowedAreas( Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea );
148   desk->addDockWidget( Qt::LeftDockWidgetArea, displayPropertiesDock );
149
150   pqPropertiesPanel* displayPropertiesPanel = new pqPropertiesPanel();
151   displayPropertiesPanel->setObjectName("displayPropertiesPanel");
152   displayPropertiesPanel->setProperty("panelMode", QVariant(2));  // probably to have only the Display part
153   displayPropertiesDock->setWidget(displayPropertiesPanel);
154   myDockWidgets[displayPropertiesDock] = false;
155   displayPropertiesDock->hide();
156
157   // View dock
158   QDockWidget* viewPropertiesDock = new QDockWidget( tr( "TTL_VIEW_PANEL" ), desk );
159   viewPropertiesDock->setObjectName("viewPropertiesDock");
160   viewPropertiesDock->setAllowedAreas( Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea );
161   desk->addDockWidget( Qt::LeftDockWidgetArea, viewPropertiesDock );
162
163   pqPropertiesPanel* viewPropertiesPanel = new pqPropertiesPanel();
164   viewPropertiesPanel->setObjectName("viewPropertiesPanel");
165   viewPropertiesPanel->setProperty("panelMode", QVariant(4)); // probably to have only the View part
166   viewPropertiesDock->setWidget(viewPropertiesPanel);
167   myDockWidgets[viewPropertiesDock] = false;
168   viewPropertiesDock->hide();
169
170   // Taken from ParaViewMainWindow.cxx:
171   int propertiesPanelMode = settings->value(
172       "GeneralSettings.PropertiesPanelMode", vtkPVGeneralSettings::ALL_IN_ONE).toInt();
173   switch (propertiesPanelMode)
174   {
175     case vtkPVGeneralSettings::SEPARATE_DISPLAY_PROPERTIES:
176       viewPropertiesDock->hide();
177       propertiesPanel->setPanelMode(
178           pqPropertiesPanel::SOURCE_PROPERTIES|pqPropertiesPanel::VIEW_PROPERTIES);
179       break;
180
181     case vtkPVGeneralSettings::SEPARATE_VIEW_PROPERTIES:
182       displayPropertiesDock->hide();
183       propertiesPanel->setPanelMode(
184           pqPropertiesPanel::SOURCE_PROPERTIES|pqPropertiesPanel::DISPLAY_PROPERTIES);
185       break;
186
187     case vtkPVGeneralSettings::ALL_SEPARATE:
188       propertiesPanel->setPanelMode(pqPropertiesPanel::SOURCE_PROPERTIES);
189       break;
190
191     case vtkPVGeneralSettings::ALL_IN_ONE:
192     default:
193       propertiesPanel->setPanelMode(
194                 pqPropertiesPanel::SOURCE_PROPERTIES|pqPropertiesPanel::VIEW_PROPERTIES|pqPropertiesPanel::DISPLAY_PROPERTIES);
195       viewPropertiesDock->hide();
196       displayPropertiesDock->hide();
197       break;
198   }
199
200   // Information dock
201   QDockWidget* informationDock = new QDockWidget(tr( "TTL_INFORMATION" ), desk);
202   informationDock->setObjectName("informationDock");
203
204   QWidget* informationWidgetFrame = new QWidget(informationDock);
205   informationWidgetFrame->setObjectName("informationWidgetFrame");
206
207   QVBoxLayout* verticalLayout_2 = new QVBoxLayout(informationWidgetFrame);
208   verticalLayout_2->setSpacing(0);
209   verticalLayout_2->setContentsMargins(0, 0, 0, 0);
210
211   QScrollArea* informationScrollArea = new QScrollArea(informationWidgetFrame);
212   informationScrollArea->setObjectName("informationScrollArea") ;
213   informationScrollArea->setWidgetResizable(true);
214
215   pqProxyInformationWidget* informationWidget = new pqProxyInformationWidget();
216   informationWidget->setObjectName("informationWidget");
217   informationWidget->setGeometry(QRect(0, 0, 77, 214));
218   informationScrollArea->setWidget(informationWidget);
219
220   verticalLayout_2->addWidget(informationScrollArea);
221   informationDock->setWidget(informationWidgetFrame);
222
223   myDockWidgets[informationDock] = true;
224
225   desk->tabifyDockWidget(propertiesDock, viewPropertiesDock);
226   desk->tabifyDockWidget(propertiesDock, displayPropertiesDock);
227   desk->tabifyDockWidget(propertiesDock, informationDock);
228   propertiesDock->raise();
229
230   // Statistic View
231   QDockWidget* statisticsViewDock  = new QDockWidget( tr( "TTL_STATISTICS_VIEW" ), desk );
232   statisticsViewDock->setObjectName("statisticsViewDock");
233   statisticsViewDock->setAllowedAreas(Qt::BottomDockWidgetArea|Qt::LeftDockWidgetArea|
234                                       Qt::NoDockWidgetArea|Qt::RightDockWidgetArea );
235   desk->addDockWidget( Qt::BottomDockWidgetArea, statisticsViewDock );
236   pqDataInformationWidget* aStatWidget = new pqDataInformationWidget(statisticsViewDock);
237   statisticsViewDock->setWidget(aStatWidget);
238   myDockWidgets[statisticsViewDock] = false; // hidden by default
239
240   //Animation view
241   QDockWidget* animationViewDock     = new QDockWidget( tr( "TTL_ANIMATION_VIEW" ), desk );
242   animationViewDock->setObjectName("animationViewDock");
243   desk->addDockWidget( Qt::BottomDockWidgetArea, animationViewDock );
244   pqPVAnimationWidget* animation_panel = new ResizeHelper(animationViewDock); // [ABN] was resizeHelper
245   animationViewDock->setWidget(animation_panel);
246   myDockWidgets[animationViewDock] = false; // hidden by default
247
248   desk->tabifyDockWidget(animationViewDock,  statisticsViewDock);
249
250   // Selection inspector
251   QDockWidget* selectionDisplayDock = new QDockWidget( tr( "TTL_SELECTION_INSPECTOR" ), desk );
252   selectionDisplayDock->setObjectName("selectionInspectorDock");
253   selectionDisplayDock->setAllowedAreas( Qt::AllDockWidgetAreas );
254   desk->addDockWidget( Qt::LeftDockWidgetArea, selectionDisplayDock );
255   pqFindDataSelectionDisplayFrame* aSelInspector = new pqFindDataSelectionDisplayFrame(selectionDisplayDock);
256   selectionDisplayDock->setWidget(aSelInspector);
257   myDockWidgets[selectionDisplayDock] = false; // hidden by default
258
259   // Multi-block inspector
260   QDockWidget* multiBlockInspectorPanelDock  = new QDockWidget( tr( "TTL_MUTLI_BLOCK_INSPECTOR" ), desk );
261   multiBlockInspectorPanelDock->setObjectName("multiBlockInspectorPanelDock");
262   desk->addDockWidget( Qt::LeftDockWidgetArea, multiBlockInspectorPanelDock );
263   pqMultiBlockInspectorPanel* mbi_panel = new pqMultiBlockInspectorPanel( multiBlockInspectorPanelDock );
264   multiBlockInspectorPanelDock->setWidget(mbi_panel);
265   myDockWidgets[multiBlockInspectorPanelDock] = false; // hidden by default
266
267   // Comparative View
268   QDockWidget* comparativePanelDock  = new QDockWidget( tr( "TTL_COMPARATIVE_VIEW_INSPECTOR" ), desk );
269   comparativePanelDock->setObjectName("comparativePanelDock");
270   desk->addDockWidget( Qt::LeftDockWidgetArea, comparativePanelDock );
271   pqComparativeVisPanel* cv_panel = new pqComparativeVisPanel( comparativePanelDock );
272   comparativePanelDock->setWidget(cv_panel);
273   myDockWidgets[comparativePanelDock] = false; // hidden by default
274
275   // Collaboration view
276   QDockWidget* collaborationPanelDock = new QDockWidget(tr( "TTL_COLLABORATIVE_DOCK" ), desk);
277   collaborationPanelDock->setObjectName("collaborationPanelDock");
278   pqCollaborationPanel* collaborationPanel = new pqCollaborationPanel();
279   collaborationPanel->setObjectName("collaborationPanel");
280   collaborationPanelDock->setWidget(collaborationPanel);
281   desk->addDockWidget(Qt::RightDockWidgetArea, collaborationPanelDock);
282   myDockWidgets[collaborationPanelDock] = false; // hidden by default
283
284   // Color map editor
285   QDockWidget* colorMapEditorDock  = new QDockWidget( tr( "TTL_COLOR_MAP_EDITOR" ), desk );
286   colorMapEditorDock->setObjectName("colorMapEditorDock");
287   desk->addDockWidget( Qt::LeftDockWidgetArea, colorMapEditorDock );
288   pqColorMapEditor* cmed_panel = new pqColorMapEditor( colorMapEditorDock );
289   colorMapEditorDock->setWidget(cmed_panel);
290   myDockWidgets[colorMapEditorDock] = false; // hidden by default
291
292   // Provide access to the color-editor panel for the application.
293   pqApplicationCore::instance()->registerManager(
294     "COLOR_EDITOR_PANEL", colorMapEditorDock);
295   
296   // Memory inspector dock
297   QDockWidget* memoryInspectorDock = new QDockWidget(tr( "TTL_MEMORY_INSPECTOR" ), desk);
298   memoryInspectorDock->setObjectName("memoryInspectorDock");
299 #ifndef WIN32
300   pqMemoryInspectorPanel* dockWidgetContents = new pqMemoryInspectorPanel();
301   dockWidgetContents->setObjectName("dockWidgetContents");
302   memoryInspectorDock->setWidget(dockWidgetContents);
303 #endif
304   desk->addDockWidget(Qt::RightDockWidgetArea, memoryInspectorDock);
305   myDockWidgets[memoryInspectorDock] = false; // hidden by default
306
307   // Setup the statusbar ...
308   pqProgressManager* progress_manager =
309     pqApplicationCore::instance()->getProgressManager();
310
311   // Progress bar/button management
312   pqProgressWidget* aProgress = new pqProgressWidget(desk->statusBar());
313   progress_manager->addNonBlockableObject(aProgress);
314   progress_manager->addNonBlockableObject(aProgress->getAbortButton());
315   
316   QObject::connect( progress_manager, SIGNAL(enableProgress(bool)),
317                     aProgress,        SLOT(enableProgress(bool)));
318
319   QObject::connect( progress_manager, SIGNAL(progress(const QString&, int)),
320                     aProgress,        SLOT(setProgress(const QString&, int)));
321
322   QObject::connect( progress_manager, SIGNAL(enableAbort(bool)),
323                     aProgress,        SLOT(enableAbort(bool)));
324
325   QObject::connect( aProgress,        SIGNAL(abortPressed()),
326                     progress_manager, SLOT(triggerAbort()));
327
328   desk->statusBar()->addPermanentWidget(aProgress);
329   aProgress->setEnabled(true);
330
331   // Set up the dock window corners to give the vertical docks more room.
332 //  desk->setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
333 //  desk->setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
334
335   // Setup the default dock configuration ...
336   statisticsViewDock->hide();
337   comparativePanelDock->hide();
338   animationViewDock->hide();
339   multiBlockInspectorPanelDock->hide();
340   selectionDisplayDock->hide();
341   collaborationPanelDock->hide();
342   memoryInspectorDock->hide();
343   colorMapEditorDock->hide();
344 }
345
346 /*!
347   \brief Save states of dockable ParaView widgets.
348 */
349 void PVGUI_Module::saveDockWidgetsState()
350 {
351   SUIT_Desktop* desk = application()->desktop();
352
353   // VSR: 19/06/2011: do not use Paraview's methods, since it conflicts with SALOME GUI architecture
354   // ... the following code is commented...
355   // Save the state of the window ...
356   // pqApplicationCore::instance()->settings()->saveState(*desk, "MainWindow");
357   //
358   //for (int i = 0; i < myDockWidgets.size(); ++i)
359   //  myDockWidgets.at(i)->setParent(0);
360   // ... and replaced - manually hide dock windows
361
362   // store dock widgets visibility state and hide'em all
363   QMapIterator<QWidget*, bool> it1( myDockWidgets );
364   while( it1.hasNext() ) {
365     it1.next();
366     QDockWidget* dw = qobject_cast<QDockWidget*>( it1.key() );
367     myDockWidgets[dw] = dw->isVisible();
368     dw->setVisible( false );
369     dw->toggleViewAction()->setVisible( false );
370   }
371   // store toolbar breaks state and remove all tollbar breaks 
372   QMapIterator<QWidget*, bool> it2( myToolbarBreaks );
373   while( it2.hasNext() ) {
374     it2.next();
375     QToolBar* tb = qobject_cast<QToolBar*>( it2.key() );
376     myToolbarBreaks[tb] = desk->toolBarBreak( tb );
377     if ( myToolbarBreaks[tb] )
378       desk->removeToolBarBreak( tb );
379   }
380   // store toolbars visibility state and hide'em all
381   QMapIterator<QWidget*, bool> it3( myToolbars );
382   while( it3.hasNext() ) {
383     it3.next();
384     QToolBar* tb = qobject_cast<QToolBar*>( it3.key() );
385     myToolbars[tb] = tb->isVisible();
386     tb->setVisible( false );
387     tb->toggleViewAction()->setVisible( false );
388   }
389 }
390
391 /*!
392   \brief Restore states of dockable ParaView widgets.
393 */
394 void PVGUI_Module::restoreDockWidgetsState()
395 {
396   SUIT_Desktop* desk = application()->desktop();
397
398   // VSR: 19/06/2011: do not use Paraview's methods, since it conflicts with SALOME GUI architecture
399   // ... the following code is commented...
400   //for (int i = 0; i < myDockWidgets.size(); ++i)
401   //  myDockWidgets.at(i)->setParent(desk);
402   //
403   // Restore the state of the window ...
404   //pqApplicationCore::instance()->settings()->restoreState("MainWindow", *desk);
405   // ... and replaced - manually hide dock windows
406
407   // restore dock widgets visibility state
408   QMapIterator<QWidget*, bool> it1( myDockWidgets );
409   while( it1.hasNext() ) {
410     it1.next();
411     QDockWidget* dw = qobject_cast<QDockWidget*>( it1.key() );
412     dw->setVisible( it1.value() );
413     dw->toggleViewAction()->setVisible( true );
414   }
415
416     // restore toolbar breaks state
417     QMapIterator<QWidget*, bool> it2( myToolbarBreaks );
418     while( it2.hasNext() ) {
419         it2.next();
420         QToolBar* tb = qobject_cast<QToolBar*>( it2.key() );
421         if ( myToolbarBreaks[tb] )
422           desk->insertToolBarBreak( tb );
423     }
424
425   // restore toolbar visibility state
426   QMapIterator<QWidget*, bool> it3( myToolbars );
427   while( it3.hasNext() ) {
428     it3.next();
429     QToolBar* tb = qobject_cast<QToolBar*>( it3.key() );
430     tb->setVisible( it3.value() );
431     tb->toggleViewAction()->setVisible( true );
432   }
433 }
434
435
436
437 /*!
438   \brief Store visibility of the common dockable windows (OB, PyConsole, ... etc.)
439 */
440 void PVGUI_Module::storeCommonWindowsState() {  
441   //rnv: Make behaviour of the dockable windows and toolbars coherent with others
442   //     modules: if 'Save position of the windows' or 'Save position of the toolbars' 
443   //     in the General SALOME preferences are cheked, then properties of the windows and/or toolbars
444   //     are stored/restored using standard Qt saveState(...) and restoreState(...) methods.
445   //     Otherwise to the windows and toolbars applied default settins stored int the SalomeApp.xml
446   //     configuration file.
447   //
448   //     But in contrast to others modules ParaVis module default settings hide some dockable
449   //     windows, so to restore it at the moment of the ParaVis de-activation we call 
450   //     restoreCommonWindowsState() method, and at the moment of the ParaVis activation we call 
451   //     this method.
452
453   //LightApp_Application* anApp = getApp();
454   SalomeApp_Application* anApp = getApp();
455   if(!anApp)
456     return;
457
458 //  int begin = SalomeApp_Application::WT_ObjectBrowser;
459 //  int end = SalomeApp_Application::WT_NoteBook;
460   int begin = LightApp_Application::WT_ObjectBrowser;
461   int end = LightApp_Application::WT_User;
462   for( int i = begin; i <= end; i++ ) {
463     QWidget* wg = anApp->getWindow(i);
464     if(wg) {
465       QDockWidget* dock = 0;
466       QWidget* w = wg->parentWidget();
467       while ( w && !dock ) {
468           dock = ::qobject_cast<QDockWidget*>( w );
469           w = w->parentWidget();
470       }
471       if(dock){
472           if(!myCommonMap.contains(i)){
473               myCommonMap.insert(i,dock->isVisible());
474           } else {
475               myCommonMap[i] = dock->isVisible();
476           }
477       }
478     }
479   }
480 }
481
482 /*!
483   \brief Restore visibility of the common dockable windows (OB, PyConsole, ... etc.)
484 */
485 void PVGUI_Module::restoreCommonWindowsState() {
486   SalomeApp_Application* anApp = getApp();
487 //  LightApp_Application* anApp = getApp();
488   if(!anApp)
489     return;
490   DockWindowMap::const_iterator it = myCommonMap.begin();
491   for( ;it != myCommonMap.end(); it++ ) {
492     QWidget* wg = anApp->getWindow(it.key());
493     if(wg) {
494       QDockWidget* dock = 0;
495       QWidget* w = wg->parentWidget();
496       while ( w && !dock ) {
497           dock = ::qobject_cast<QDockWidget*>( w );
498           w = w->parentWidget();
499       }
500       if(dock) {
501           dock->setVisible(it.value());
502       }
503     }
504   }
505 }