#include <SUIT_ViewWindow.h>
#include <SUIT_ResourceMgr.h>
+#ifndef DISABLE_OCCVIEWER
+ #include <OCCViewer_ViewFrame.h>
+#endif
+
#include "LightApp_FullScreenHelper.h"
#include "LightApp_Application.h"
STD_TabDesktop* desk = dynamic_cast<STD_TabDesktop*>( desktop );
- QtxWorkstack* wgStack = desk->workstack();
- wgStack->showActiveTabBar(false);
myWindowsList.clear();
- bool isHidding = false;
- SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
- if ( resMgr )
- isHidding = resMgr->booleanValue( "OCCViewer", "automatic_hiding", true );
+ myFrameHideMap.clear();
//Hide all toolbars and inactive window
QList<SUIT_ViewWindow*> aWindowList = desk->windows();
SUIT_ViewWindow* anActiveWindow = desk->activeWindow();
QList<SUIT_ViewWindow*>::const_iterator it = aWindowList.begin();
- for ( ; it!=aWindowList.end(); it++ ) {
- QList<QToolBar*> lst = (*it)->findChildren<QToolBar*>();
- if ( *it ) {
- myWindowsList.push_back(*it);
- ( *it )->hide();
- }
- if ( isHidding ) {
- QList<QToolBar*>::const_iterator iter = lst.begin();
- for ( ; iter!=lst.end(); iter++ ) {
- (*iter)->hide();
+ int aKey = 0;
+ for ( ; it != aWindowList.end(); it++ ) {
+ myWindowsList.push_back(*it);
+ #ifndef DISABLE_OCCVIEWER
+ OCCViewer_ViewFrame* anActiveOCCFrame = dynamic_cast<OCCViewer_ViewFrame*>( *it );
+ if ( anActiveOCCFrame ) {
+ QList<int> 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);
}
- if (anActiveWindow)
- anActiveWindow->show();
+
+ QtxWorkstack* wgStack = desk->workstack();
+ wgStack->splittersVisible(anActiveWindow, false);
desktop->setWindowState(desktop->windowState() ^ Qt::WindowFullScreen);
QList<QDockWidget*> aDocWidgets = desktop->findChildren<QDockWidget*>();
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 && !isHidding)? ob->parent() : 0;
}
}
}
-
+
QList<QToolBar*> aToolBars = desktop->findChildren<QToolBar*>();
myToolBarMap.clear();
foreach(QToolBar* aWidget, aToolBars ) {
myToolBarMap.insert(aWidget, isActionEnabled);
}
}
- }
+ }
}
/*!
desktop->setWindowState(desktop->windowState() ^ Qt::WindowFullScreen);
STD_TabDesktop* desk = dynamic_cast<STD_TabDesktop*>( desktop );
+ SUIT_ViewWindow* anActiveWindow = desk->activeWindow();
- QtxWorkstack* wgStack = desk->workstack();
- wgStack->showActiveTabBar(true);
-
- bool isHidding = false;
- SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
- if ( resMgr )
- isHidding = resMgr->booleanValue( "OCCViewer", "automatic_hiding", true );
//Show all toolbars and windows
QList<SUIT_ViewWindow*>::const_iterator itr = myWindowsList.begin();
- for ( ; itr!=myWindowsList.end(); itr++ ) {
- QList<QToolBar*> lst = (*itr)->findChildren<QToolBar*>();
- if (*itr && !(*itr)->isVisible())
- (*itr)->show();
- if ( isHidding ) {
- QList<QToolBar*>::const_iterator iter = lst.begin();
- for ( ; iter!=lst.end(); iter++ ) {
- (*iter)->show();
+ int aKey = 0;
+ for ( ; itr != myWindowsList.end(); itr++ ) {
+ #ifndef DISABLE_OCCVIEWER
+ OCCViewer_ViewFrame* anActiveOCCFrame = dynamic_cast<OCCViewer_ViewFrame*>( *itr );
+ if ( anActiveOCCFrame ) {
+ if ( (*itr) == anActiveWindow ) {
+ QList<int>::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++ ) {
QDockWidget* aWidget = it.key();
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<QToolBar*> lst = view->findChildren<QToolBar*>();
+ if ( isHidding ) {
+ QList<QToolBar*>::const_iterator iter = lst.begin();
+ for ( ; iter!=lst.end(); iter++ ) {
+ if ( *iter ) {
+ (*iter)->setVisible(toolbar_visible);
+ }
+ }
+ }
}
void switchToFullScreen();
void switchToNormalScreen();
+ private:
+ void toolbarVisible(SUIT_ViewWindow*, bool=false);
+
private:
typedef QMap<QDockWidget*,bool> DocWidgetMap;
DocWidgetMap myDocWidgetMap;
typedef QMap<QToolBar*, bool> ToolBarMap;
ToolBarMap myToolBarMap;
QList<SUIT_ViewWindow*> myWindowsList;
+ typedef QMap<int, QList<int> > FrameHideMap;
+ FrameHideMap myFrameHideMap;
bool myStatusBarVisibility;
myLayout->addWidget( view0, 0, 0 );
myMaximizedView = view0;
+ myActiveView = view0;
connectViewSignals(view0);
}
return ( i >= 0 && i < myViews.count() ) ? myViews.at( i ) : 0 ;
}
+//**************************************************************************************
+OCCViewer_ViewWindow* OCCViewer_ViewFrame::getActiveView( ) const
+{
+ return myActiveView;
+}
+
//**************************************************************************************
void OCCViewer_ViewFrame::setViewManager( SUIT_ViewManager* theMgr )
{
view = myViews.at(i);
view->setVisible( view->get2dMode() == No2dMode );
view->setMaximized( true, false );
- if (view->get2dMode() == No2dMode) myMaximizedView = view;
+ if (view->get2dMode() == No2dMode) {
+ myMaximizedView = view;
+ myActiveView = view;
+ }
}
myLayout->setColumnStretch(0, 0);
myLayout->setColumnStretch(1, 0);
void OCCViewer_ViewFrame::onMaximizedView( OCCViewer_ViewWindow* theView, bool isMaximized)
{
myMaximizedView = theView;
+ myActiveView = theView;
if (isMaximized) {
if (myViews.count() <= 1)
return;
this, SIGNAL( mouseDoubleClicked(SUIT_ViewWindow*, QMouseEvent*) ) );
connect( theView, SIGNAL( mousePressed(SUIT_ViewWindow*, QMouseEvent*) ),
this, SIGNAL( mousePressed(SUIT_ViewWindow*, QMouseEvent*) ) );
+ // The signal is used to mouse pressed for choose the current window
+ connect( theView, SIGNAL( mousePressed(SUIT_ViewWindow*, QMouseEvent*) ),
+ this, SLOT( onMousePressed(SUIT_ViewWindow*, QMouseEvent*) ) );
connect( theView, SIGNAL( mouseReleased(SUIT_ViewWindow*, QMouseEvent*) ),
this, SIGNAL( mouseReleased(SUIT_ViewWindow*, QMouseEvent*) ) );
connect( theView, SIGNAL( mouseMoving(SUIT_ViewWindow*, QMouseEvent*) ),
myPopupRequestedView = dynamic_cast<OCCViewer_ViewWindow*>(sender());
}
+void OCCViewer_ViewFrame::onMousePressed(SUIT_ViewWindow* view, QMouseEvent*)
+{
+ myActiveView = dynamic_cast<OCCViewer_ViewWindow*>(view);
+}
+
void OCCViewer_ViewFrame::onDumpView()
{
if (myPopupRequestedView) {
OCCViewer_ViewWindow* getView( const int ) const;
+ OCCViewer_ViewWindow* getActiveView() const;
+
virtual OCCViewer_ViewPort3d* getViewPort() { return getView(MAIN_VIEW)->getViewPort(); }
OCCViewer_ViewPort3d* getViewPort(int theView);
private slots:
void onContextMenuRequested(QContextMenuEvent*);
+ void onMousePressed(SUIT_ViewWindow*, QMouseEvent*);
private:
void connectViewSignals( OCCViewer_ViewWindow* theView );
QList<OCCViewer_ViewWindow*> myViews;
QGridLayout* myLayout;
OCCViewer_ViewWindow* myMaximizedView;
+ OCCViewer_ViewWindow* myActiveView;
int mySplitMode;
QList<int> myViewsMode;
}
/*!
- \brief Show/Hide active tab bar.
+ \brief Show/hide splitter state and area.
+ \param widget and parent area will be shown/hidden
+ \param split splitter will be shown/hidden
+ \param visible splitter
*/
-void QtxWorkstack::showActiveTabBar( bool visible )
+void QtxWorkstack::splitterVisible(QWidget* widget, QList<QSplitter*>& parentList, QSplitter* split, bool visible)
{
+ QList<QSplitter*> recList;
+ splitters( split, recList, false );
+ for ( QList<QSplitter*>::iterator itr = recList.begin(); itr != recList.end(); ++itr ) {
+ parentList.prepend( *itr );
+ splitterVisible( widget, parentList, *itr, visible );
+ }
+
QList<QtxWorkstackArea*> areaList;
- areas( mySplit, areaList, true );
- QList<QtxWorkstackArea*>::ConstIterator it;
- for ( it = areaList.begin(); it != areaList.end(); ++it )
- {
- (*it)->showTabBar( visible );
+ areas( split, areaList, false );
+ for ( QList<QtxWorkstackArea*>::const_iterator it = areaList.begin(); it != areaList.end(); ++it ) {
+ QtxWorkstackArea* area = *it;
+ bool isCurrentWidget = false;
+ area->showTabBar(visible);
+
+ QList<QtxWorkstackChild*> childList = area->childList();
+ for ( QList<QtxWorkstackChild*>::iterator itr = childList.begin(); itr != childList.end(); ++itr ) {
+ QWidget* aCurWid = (*itr)->widget();
+ if ( aCurWid == widget ) {
+ isCurrentWidget = true;
+ aCurWid->setVisible( true );
+ }
+ else
+ aCurWid->setVisible( visible );
+ }
+
+ if ( !isCurrentWidget || visible )
+ area->setVisible( visible );
+
+ if ( isCurrentWidget || visible ) {
+ QSplitter* pSplit = splitter( area );
+ int count = pSplit->count();
+ for ( int i = 0; i < count; i++ ) {
+ if ( pSplit->indexOf( area ) == i && !visible )
+ continue;
+ pSplit->widget(i)->setVisible( visible );
+ }
+ for ( QList<QSplitter*>::iterator itr = parentList.begin(); itr != parentList.end() && pSplit != mySplit; ++itr ) {
+ if ( pSplit == *itr )
+ continue;
+ QList<QSplitter*> splitlist;
+ splitters( *itr, splitlist, false );
+ for ( QList<QSplitter*>::iterator iter = splitlist.begin(); iter != splitlist.end(); ++iter ) {
+ if ( pSplit == (*iter) ) {
+ pSplit = *itr;
+ continue;
+ }
+ (*iter)->setVisible(visible);
+ }
+ }
+ }
}
- QList<QSplitter*> recList;
- splitters( mySplit, recList, true );
- for ( QList<QSplitter*>::iterator itr = recList.begin(); itr != recList.end(); ++itr )
- (*itr)->setVisible(visible);
+}
+
+/*!
+ \brief Show/hide splitters state and area.
+ \param widget and parent area will be shown/hidden
+ \param visible splitters
+*/
+void QtxWorkstack::splittersVisible(QWidget* widget, bool visible )
+{
+ QList<QSplitter*> parentList;
+ parentList.append(mySplit);
+ splitterVisible(widget, parentList, mySplit, visible );
}
/*!
void setOpaqueResize( bool = true );
bool opaqueResize() const;
- void showActiveTabBar( bool = true );
+ void splittersVisible( QWidget*, bool = true );
void Split( QWidget* wid, const Qt::Orientation o, const SplitType type );
void Attract( QWidget* wid1, QWidget* wid2, const bool all );
void SetRelativePosition( QWidget* wid, const Qt::Orientation o, const double pos );
void SetRelativePositionInSplitter( QWidget* wid, const double pos );
+ void updateState();
+
signals:
void windowActivated( QWidget* );
QtxWorkstackArea* createArea( QWidget* ) const;
- void updateState();
void updateState( QSplitter* );
+ void splitterVisible(QWidget*, QList<QSplitter*>&, QSplitter*, bool );
+
void distributeSpace( QSplitter* ) const;
int setPosition( QWidget* wid, QSplitter* split, const Qt::Orientation o,
if( anActorCollection )
{
+ if( !myShiftState &&
+ anActorCollection->GetNumberOfItems () > 1 &&
+ myLastHighlitedActor.GetPointer() ) {
+ anActorCollection->RemoveItem ( myLastHighlitedActor.GetPointer() );
+ }
anActorCollection->InitTraversal();
while( vtkActor* aVTKActor = anActorCollection->GetNextActor() )
{