From 8c9b2c105aeb032c37265148efa1c4a44eff8b94 Mon Sep 17 00:00:00 2001 From: asv Date: Mon, 20 Mar 2006 14:43:47 +0000 Subject: [PATCH] Fix for bug PAL11186: if a dockable window was hidden by user (closed with X button) then it should NOT appear in the next loaded module. --- src/LightApp/LightApp_Application.cxx | 49 ++++++++++++++++++--------- src/LightApp/LightApp_Application.h | 3 ++ 2 files changed, 36 insertions(+), 16 deletions(-) diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index 0f2b882a0..12ad26ac5 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -81,11 +81,11 @@ #include #endif -#ifndef DISABLE_SUPERVGRAPHVIEWER - #include - #include - #include -#endif +//#ifndef DISABLE_SUPERVGRAPHVIEWER +// #include +// #include +// #include +//#endif #include @@ -948,6 +948,8 @@ void LightApp_Application::addWindow( QWidget* wid, const int flag, const int st LightApp_WidgetContainer* newWC = new LightApp_WidgetContainer( flag, desktop() ); connect( newWC, SIGNAL( destroyed ( QObject* ) ), this, SLOT( onWCDestroyed( QObject* ) ) ); + // asv: connecting a slot for storing visibility flag of a window + connect( newWC, SIGNAL( visibilityChanged ( bool ) ), SLOT( onVisibilityChanged( bool ) ) ); myWindows.insert( flag, newWC ); if ( winMap.contains( flag ) ) desktop()->moveDockWindow( myWindows[flag], (Dock)winMap[flag] ); @@ -1185,16 +1187,12 @@ SUIT_ViewManager* LightApp_Application::createViewManager( const QString& vmType } } #endif -#ifndef DISABLE_SUPERVGRAPHVIEWER - if( vmType == SUPERVGraph_Viewer::Type() ) - { - viewMgr = new SUPERVGraph_ViewManager( activeStudy(), desktop() ); - SUPERVGraph_Viewer* vm = new SUPERVGraph_Viewer(); - SUPERVGraph_ViewFrame* view = dynamic_cast( vm->getViewManager()->getActiveView() ); - if( view ) - view->setBackgroundColor( resMgr->colorValue( "SUPERVGraph", "Background", view->backgroundColor() ) ); - } -#endif + //#ifndef DISABLE_SUPERVGRAPHVIEWER + // if( vmType == SUPERVGraph_Viewer::Type() ) + // { + // viewMgr = new SUPERVGraph_ViewManager( activeStudy(), desktop(), new SUPERVGraph_Viewer() ); + // } + //#endif #ifndef DISABLE_OCCVIEWER if( vmType == OCCViewer_Viewer::Type() ) { @@ -1940,8 +1938,14 @@ void LightApp_Application::updateWindows() // setWindowShown should be done even if no study is active (open). in this case all open windows // will be hidden, which is neccessary in this case. - for ( WindowMap::ConstIterator itr = myWindows.begin(); itr != myWindows.end(); ++itr ) + for ( WindowMap::ConstIterator itr = myWindows.begin(); itr != myWindows.end(); ++itr ) { + + if ( myWindowsVisible.contains( itr.key() ) && + !myWindowsVisible[ itr.key() ] ) + continue; + setWindowShown( itr.key(), !itr.data()->isEmpty() && winMap.contains( itr.key() ) ); + } } /*!Update view managers.*/ @@ -2161,3 +2165,16 @@ void LightApp_Application::setDefaultStudyName( const QString& theName ) updateDesktopTitle(); } } + +/*! slot, called on show/hide of a dock window */ +void LightApp_Application::onVisibilityChanged( bool visible ) +{ + const QObject* win = sender(); + + for ( WindowMap::ConstIterator itr = myWindows.begin(); itr != myWindows.end(); ++itr ) + if ( itr.data() == win ) + { + myWindowsVisible[ itr.key() ] = visible; + return; + } +} diff --git a/src/LightApp/LightApp_Application.h b/src/LightApp/LightApp_Application.h index c435188a4..a85a2e7cf 100644 --- a/src/LightApp/LightApp_Application.h +++ b/src/LightApp/LightApp_Application.h @@ -189,6 +189,7 @@ private slots: void onMRUActivated( QString ); void onPreferenceChanged( QString&, QString&, QString& ); void onRenameWindow(); + void onVisibilityChanged( bool ); protected: void updateWindows(); @@ -212,12 +213,14 @@ protected: protected: typedef QMap ActionMap; typedef QMap WindowMap; + typedef QMap WindowVisibilityMap; protected: LightApp_Preferences* myPrefs; LightApp_SelectionMgr* mySelMgr; ActionMap myActions; WindowMap myWindows; + WindowVisibilityMap myWindowsVisible; SUIT_Accel* myAccel; -- 2.39.2