diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index bd6b572ab..1ac42576e 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -1840,8 +1840,8 @@ void GeometryGUI::onWindowActivated( SUIT_ViewWindow* win ) if ( !win ) return; - const bool ViewOCC = ( win->getViewManager()->getType() == OCCViewer_Viewer::Type() ); - //const bool ViewVTK = ( win->getViewManager()->getType() == SVTK_Viewer::Type() ); + const bool ViewOCC = ( win->getViewManager() ? win->getViewManager()->getType() == OCCViewer_Viewer::Type() : false ); + //const bool ViewVTK = ( win->getViewManager() ? win->getViewManager()->getType() == SVTK_Viewer::Type() : false ); // disable non-OCC viewframe menu commands // action( GEOMOp::Op2dSketcher )->setEnabled( ViewOCC ); // SKETCHER diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx index d3cdf6095..9a5ce23ea 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx @@ -74,6 +74,10 @@ #include #include +#include + +#include + #include #include #include @@ -98,6 +102,7 @@ // QT Includes #include +#include #include #include #include @@ -112,13 +117,15 @@ // VTK includes #include -class QtxDialog; // If the next macro is defined, autocolor feature works for all sub-shapes; // if it is undefined, autocolor feature works for groups only #define GENERAL_AUTOCOLOR // Below macro, when uncommented, switches on simplified (more performant) algorithm // of auto-color picking up #define SIMPLE_AUTOCOLOR +// Below macro, when defined, switches on automatic layouting of OCC and Dependecy views +// on Show Dependencies operation +#define LAYOUT_DEPVIEW void GEOMToolsGUI::OnCheckGeometry() { @@ -883,30 +890,48 @@ void GEOMToolsGUI::OnShowDependencyTree() SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); if ( !app ) return; - SUIT_ViewManager *svm = app->getViewManager( GraphicsView_Viewer::Type(), false ); +#ifdef LAYOUT_DEPVIEW + SUIT_ViewManager* occVm = app->getViewManager( OCCViewer_Viewer::Type(), true ); + SUIT_ViewWindow* occVw = occVm->getActiveView(); +#endif + SUIT_ViewManager* depVm = app->getViewManager( GraphicsView_Viewer::Type(), false ); + SUIT_ViewWindow* depVw = 0; - if( !svm ) { + if ( !depVm ) { DependencyTree_View* view = new DependencyTree_View(); DependencyTree_ViewModel* viewModel = new DependencyTree_ViewModel( GraphicsView_Viewer::Type(), view ); - SUIT_ViewManager *svm = app->createViewManager( viewModel ); + depVm = app->createViewManager( viewModel ); LightApp_SelectionMgr* selMgr = app->selectionMgr(); new DependencyTree_Selector( viewModel, (SUIT_SelectionMgr*)selMgr ); - SUIT_ViewWindow* svw = svm->getActiveView(); + depVw = depVm->getActiveView(); GraphicsView_ViewFrame* aViewFrame = 0; - if (!svw) svw = svm->createViewWindow(); - if (svw) aViewFrame = dynamic_cast(svw); + if ( !depVw ) depVw = depVm->createViewWindow(); + if ( depVw ) aViewFrame = dynamic_cast( depVw ); view->init( aViewFrame ); - svm->setTitle( view->getViewName() ); + depVm->setTitle( view->getViewName() ); } - else - if( DependencyTree_ViewModel* viewModel = dynamic_cast( svm->getViewModel() ) ) - if( DependencyTree_View* view = dynamic_cast( viewModel->getActiveViewPort() ) ) { - svm->getActiveView()->setFocus(); - view->updateModel(); - } + else if ( DependencyTree_ViewModel* viewModel = dynamic_cast( depVm->getViewModel() ) ) { + if ( DependencyTree_View* view = dynamic_cast( viewModel->getActiveViewPort() ) ) { + depVw = depVm->getActiveView(); + view->updateModel(); + } + } + +#ifdef LAYOUT_DEPVIEW + // layout views properly + STD_TabDesktop* d = dynamic_cast( app->desktop() ); + if ( d && depVw && occVw ) { + QtxWorkstack* ws = d->workstack(); + ws->stack(); + QApplication::instance()->processEvents(); + ws->Split( depVw, Qt::Horizontal, QtxWorkstack::SplitMove ); + occVw->setFocus(); + } +#endif + depVw->setFocus(); } void GEOMToolsGUI::OnReduceStudy()