From cf0ecc3c366225cb0a83dffc5006c5f06f40700f Mon Sep 17 00:00:00 2001 From: asl Date: Thu, 16 Jun 2005 10:25:13 +0000 Subject: [PATCH] Start "Create group" with selected GEOM object occurs crash --- src/SMESHGUI/SMESHGUI.cxx | 41 ++++++++++++++++++++---------- src/SMESHGUI/SMESHGUI_VTKUtils.cxx | 12 ++------- 2 files changed, 30 insertions(+), 23 deletions(-) diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index 1c17f26c4..e3d8df787 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -1097,11 +1097,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) if( !mgr ) return false; - SUIT_ViewManager* vm = application()->activeViewManager(); - if( !vm ) - return false; - - SUIT_ViewWindow* view =vm->getActiveView(); + SUIT_ViewWindow* view = application()->desktop()->activeWindow(); SVTK_ViewWindow* vtkwnd = dynamic_cast( view ); QAction* act = action( theCommandID ); @@ -1179,6 +1175,10 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) { if(checkLock(aStudy)) break; SMESH::UpdateView(); + + SALOME_ListIO l; + SalomeApp_SelectionMgr *aSel = SMESHGUI::selectionMgr(); + aSel->setSelectedObjects( l ); break; } @@ -1532,6 +1532,13 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) } case 801: // CREATE GROUP { + if ( !vtkwnd ) + { + SUIT_MessageBox::warn1( desktop(), tr( "SMESH_WRN_WARNING" ), + tr( "NOT_A_VTK_VIEWER" ),tr( "SMESH_BUT_OK" ) ); + break; + } + if(checkLock(aStudy)) break; EmitSignalDeactivateDialog(); SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_nil(); @@ -1553,6 +1560,13 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) case 802: // CONSTRUCT GROUP { + if ( !vtkwnd ) + { + SUIT_MessageBox::warn1( desktop(), tr( "SMESH_WRN_WARNING" ), + tr( "NOT_A_VTK_VIEWER" ),tr( "SMESH_BUT_OK" ) ); + break; + } + if(checkLock(aStudy)) break; EmitSignalDeactivateDialog(); @@ -2833,17 +2847,18 @@ void SMESHGUI::initialize( CAM_Application* app ) isNotEmpty("numberOfNodes <> 0"), // has nodes, edges, etc in VISIBLE! actor - hasNodes("(numberOfNodes > 0 && isVisible)"), - hasElems("count( elemTypes ) > 0"), - hasDifferentElems("count( elemTypes ) > 1"), - hasEdges("{'Edge'} in elemTypes"), - hasFaces("{'Face'} in elemTypes"), - hasVolumes("{'Volume'} in elemTypes"); + hasNodes("(numberOfNodes > 0 )"),//&& isVisible)"), + hasElems("(count( elemTypes ) > 0)"), + hasDifferentElems("(count( elemTypes ) > 1)"), + hasEdges("({'Edge'} in elemTypes)"), + hasFaces("({'Face'} in elemTypes)"), + hasVolumes("({'Volume'} in elemTypes)"); QString aSelCount = QString( "%1 = 1" ).arg( QtxPopupMgr::Selection::defSelCountParam() ); - QString aClient = QString( "%1client in {%2}" ).arg( QtxPopupMgr::Selection::defEquality() ).arg( View ); + QString lc = QtxPopupMgr::Selection::defEquality(); + QString aClient = QString( "%1client in {%2}" ).arg( lc ).arg( "'VTKViewer' 'ObjectBrowser'" ); QString aType = QString( "%1type in {%2}" ).arg( QtxPopupMgr::Selection::defEquality() ).arg( mesh_group ); - QString aMeshInVTK = aClient + "&&" + aType + "&&" + aSelCount; + QString aMeshInVTK = aClient + "&&" + aType;// + "&&" + aSelCount; //------------------------------------------------- // Numbering diff --git a/src/SMESHGUI/SMESHGUI_VTKUtils.cxx b/src/SMESHGUI/SMESHGUI_VTKUtils.cxx index 734a07600..924450bb9 100644 --- a/src/SMESHGUI/SMESHGUI_VTKUtils.cxx +++ b/src/SMESHGUI/SMESHGUI_VTKUtils.cxx @@ -145,16 +145,8 @@ namespace SMESH{ SVTK_ViewWindow* GetViewWindow(const SalomeApp_Module* theModule) { - if(SalomeApp_Application* anApp = theModule->getApp()){ - if(SUIT_ViewManager* aViewManager = anApp->activeViewManager()){ - if(aViewManager->getType() == SVTK_Viewer::Type()){ - if(SUIT_ViewWindow* aViewWindow = aViewManager->getActiveView()){ - return dynamic_cast(aViewWindow); - } - } - } - } - return NULL; + if(SalomeApp_Application* anApp = theModule->getApp()) + return dynamic_cast(anApp->desktop()->activeWindow()); } SVTK_ViewWindow* FindVtkViewWindow( SUIT_ViewManager* theMgr, -- 2.39.2