+
+void GEOMToolsGUI::OnCreateFolder()
+{
+ SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+ if ( !app ) return;
+
+ SalomeApp_Study* appStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy() );
+ if ( !appStudy ) return;
+
+ LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
+ if ( !aSelMgr ) return;
+
+ SALOME_ListIO selected;
+ aSelMgr->selectedObjects( selected );
+ if ( selected.IsEmpty() ) return;
+
+ Handle(SALOME_InteractiveObject) anIObject = selected.First();
+
+ _PTR(Study) aStudy = appStudy->studyDS();
+ if( !aStudy ) return;
+ _PTR(SObject) aFatherSO(aStudy->FindObjectID(anIObject->getEntry()));
+ if ( !aFatherSO ) return;
+
+ GeometryGUI::GetGeomGen()->CreateFolder( tr("NEW_FOLDER_NAME").toUtf8().constData(),
+ _CAST(SObject, aFatherSO)->GetSObject() );
+ app->updateObjectBrowser( false );
+}
+
+void GEOMToolsGUI::OnSortChildren()
+{
+ SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+ if ( !app ) return;
+
+ SalomeApp_Study* appStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy() );
+ if ( !appStudy ) return;
+
+ LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
+ if ( !aSelMgr ) return;
+
+ SALOME_ListIO selected;
+ aSelMgr->selectedObjects( selected );
+ if ( selected.IsEmpty() ) return;
+
+ Handle(SALOME_InteractiveObject) anIObject = selected.First();
+
+ _PTR(Study) aStudy = appStudy->studyDS();
+ if( !aStudy ) return;
+ _PTR(SObject) aFatherSO(aStudy->FindObjectID(anIObject->getEntry()));
+ if ( !aFatherSO ) return;
+
+ aStudy->GetUseCaseBuilder()->SortChildren( aFatherSO, true/*AscendingOrder*/ );
+
+ app->updateObjectBrowser( true );
+}
+
+#ifndef DISABLE_GRAPHICSVIEW
+void GEOMToolsGUI::OnShowDependencyTree()
+{
+ //SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
+
+ SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+ if ( !app ) return;
+
+#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 ( !depVm ) {
+ DependencyTree_View* view = new DependencyTree_View();
+ DependencyTree_ViewModel* viewModel = new DependencyTree_ViewModel( GraphicsView_Viewer::Type(), view );
+ depVm = app->createViewManager( viewModel );
+
+ LightApp_SelectionMgr* selMgr = app->selectionMgr();
+ new DependencyTree_Selector( viewModel, (SUIT_SelectionMgr*)selMgr );
+
+ depVw = depVm->getActiveView();
+ GraphicsView_ViewFrame* aViewFrame = 0;
+ if ( !depVw ) depVw = depVm->createViewWindow();
+ if ( depVw ) aViewFrame = dynamic_cast<GraphicsView_ViewFrame*>( depVw );
+
+ view->init( aViewFrame );
+ depVm->setTitle( view->getViewName() );
+ }
+ else if ( DependencyTree_ViewModel* viewModel = dynamic_cast<DependencyTree_ViewModel*>( depVm->getViewModel() ) ) {
+ if ( DependencyTree_View* view = dynamic_cast<DependencyTree_View*>( viewModel->getActiveViewPort() ) ) {
+ depVw = depVm->getActiveView();
+ view->updateModel();
+ }
+ }
+
+#ifdef LAYOUT_DEPVIEW
+ // layout views properly
+ STD_TabDesktop* d = dynamic_cast<STD_TabDesktop*>( 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();
+}
+#endif
+
+void GEOMToolsGUI::OnReduceStudy()
+{
+ QDialog* dlg = new GEOMToolsGUI_ReduceStudyDlg( SUIT_Session::session()->activeApplication()->desktop() );
+ if( dlg != NULL )
+ dlg->show();
+}