X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FLightApp%2FLightApp_FullScreenHelper.cxx;h=f9aa635c3a6921f7a12e0f7e4c1d0c4703edfd70;hb=8091ffdec0e55752a16ec4d46ac1b944fc1e1ddf;hp=8d5e738750492827d66c3cd7bdcba3beaca306c8;hpb=034a705024b224972c148e1e3834c5ee38df184b;p=modules%2Fgui.git diff --git a/src/LightApp/LightApp_FullScreenHelper.cxx b/src/LightApp/LightApp_FullScreenHelper.cxx index 8d5e73875..f9aa635c3 100644 --- a/src/LightApp/LightApp_FullScreenHelper.cxx +++ b/src/LightApp/LightApp_FullScreenHelper.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -27,14 +27,22 @@ #include #include #include +#include -#include +#include #include +#include #include #include #include +#include +#include + +#ifndef DISABLE_OCCVIEWER + #include +#endif #include "LightApp_FullScreenHelper.h" #include "LightApp_Application.h" @@ -76,6 +84,47 @@ void LightApp_FullScreenHelper::switchToFullScreen() { if(!desktop) return; + STD_TabDesktop* desk = dynamic_cast( desktop ); + + myWindowsList.clear(); + myFrameHideMap.clear(); + //Hide all toolbars and inactive window + QList aWindowList = desk->windows(); + SUIT_ViewWindow* anActiveWindow = desk->activeWindow(); + QList::const_iterator it = aWindowList.begin(); + int aKey = 0; + for ( ; it != aWindowList.end(); it++ ) { + myWindowsList.push_back(*it); + #ifndef DISABLE_OCCVIEWER + OCCViewer_ViewFrame* anActiveOCCFrame = dynamic_cast( *it ); + if ( anActiveOCCFrame ) { + QList aList; + if ( (*it) == anActiveWindow ) { + OCCViewer_ViewWindow* anActiveOCCWindow = anActiveOCCFrame->getActiveView(); + for (int i = OCCViewer_ViewFrame::BOTTOM_RIGHT; i <= OCCViewer_ViewFrame::TOP_RIGHT; i++ ) { + OCCViewer_ViewWindow* aCurrentOCCWindow = anActiveOCCFrame->getView(i); + if ( aCurrentOCCWindow && aCurrentOCCWindow->isVisible() ) { + if ( aCurrentOCCWindow != anActiveOCCWindow ) { + aCurrentOCCWindow->hide(); + toolbarVisible(aCurrentOCCWindow, false); + } + if ( anActiveOCCWindow ) + aList.append(i); + } + } + } + if ( aList.count() > 0 ) { + myFrameHideMap.insert(aKey, aList); + aKey++; + } + } + #endif + toolbarVisible(*it, false); + } + + QtxWorkstack* wgStack = desk->workstack(); + wgStack->splittersVisible(anActiveWindow, false); + desktop->setWindowState(desktop->windowState() ^ Qt::WindowFullScreen); if(desktop->menuBar()) @@ -93,8 +142,13 @@ void LightApp_FullScreenHelper::switchToFullScreen() { QList aDocWidgets = desktop->findChildren(); myDocWidgetMap.clear(); + bool isHidding = false; + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + if ( resMgr ) + isHidding = resMgr->booleanValue( "OCCViewer", "automatic_hiding", true ); + QWidget* ob = app->objectBrowser(); - QObject* obParent = ob ? ob->parent() : 0; + QObject* obParent = (ob && !isHidding)? ob->parent() : 0; foreach(QDockWidget* aWidget, aDocWidgets) { if(aWidget && aWidget->parent() == desktop) { @@ -113,7 +167,7 @@ void LightApp_FullScreenHelper::switchToFullScreen() { } } } - + QList aToolBars = desktop->findChildren(); myToolBarMap.clear(); foreach(QToolBar* aWidget, aToolBars ) { @@ -131,7 +185,7 @@ void LightApp_FullScreenHelper::switchToFullScreen() { myToolBarMap.insert(aWidget, isActionEnabled); } } - } + } } /*! @@ -155,6 +209,32 @@ void LightApp_FullScreenHelper::switchToNormalScreen() { desktop->setWindowState(desktop->windowState() ^ Qt::WindowFullScreen); + STD_TabDesktop* desk = dynamic_cast( desktop ); + SUIT_ViewWindow* anActiveWindow = desk->activeWindow(); + + //Show all toolbars and windows + QList::const_iterator itr = myWindowsList.begin(); + int aKey = 0; + for ( ; itr != myWindowsList.end(); itr++ ) { + #ifndef DISABLE_OCCVIEWER + OCCViewer_ViewFrame* anActiveOCCFrame = dynamic_cast( *itr ); + if ( anActiveOCCFrame ) { + if ( (*itr) == anActiveWindow ) { + QList::const_iterator it = myFrameHideMap[aKey].begin(); + for (; it != myFrameHideMap[aKey].end(); it++) { + OCCViewer_ViewWindow* aCurrentOCCWindow = anActiveOCCFrame->getView(*it); + aCurrentOCCWindow->show(); + toolbarVisible( aCurrentOCCWindow, true); + } + aKey++; + } + } + #endif + toolbarVisible( *itr, true ); + } + + QtxWorkstack* wgStack = desk->workstack(); + wgStack->splittersVisible(anActiveWindow, true); DocWidgetMap::iterator it = myDocWidgetMap.begin(); for( ;it != myDocWidgetMap.end() ; it++ ) { @@ -185,5 +265,24 @@ void LightApp_FullScreenHelper::switchToNormalScreen() { if(act) act->setEnabled(true); } - +} + +/*! + * Show/Hide toolbars on current view. + */ +void LightApp_FullScreenHelper::toolbarVisible(SUIT_ViewWindow* view, bool toolbar_visible) +{ + bool isHidding = false; + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + if ( resMgr ) + isHidding = resMgr->booleanValue( "OCCViewer", "automatic_hiding", true ); + QList lst = view->findChildren(); + if ( isHidding ) { + QList::const_iterator iter = lst.begin(); + for ( ; iter!=lst.end(); iter++ ) { + if ( *iter ) { + (*iter)->setVisible(toolbar_visible); + } + } + } }