Salome HOME
Method isValid is redefined to allow other operations is started above this one.
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_InitMeshOp.cxx
index 7a062119b337fe3d573dc2a560472855d5b00d57..1165258e7fbe642cb47aecdf4bbe1b3742bb1432 100644 (file)
 
 #include <SalomeApp_SelectionMgr.h>
 #include <SalomeApp_Tools.h>
+#include <SalomeApp_UpdateFlags.h>
 
 #include <TColStd_MapOfInteger.hxx>
 
+#include <GEOMBase.h>
+
 //=================================================================================
 // function : Constructor
 // purpose  :
@@ -57,6 +60,7 @@ SMESHGUI_InitMeshOp::SMESHGUI_InitMeshOp()
   myHypothesisFilter( 0 ),
   myAlgorithmFilter( 0 )
 {
+  setAutoResumed( true );
 }
 
 //=================================================================================
@@ -107,7 +111,6 @@ void SMESHGUI_InitMeshOp::startOperation()
     myHypothesisFilter = new SMESH_TypeFilter (HYPOTHESIS);
     
   init();
-  myDlg->clearSelection();
   myDlg->show();
 }
 
@@ -230,10 +233,9 @@ bool SMESHGUI_InitMeshOp::onApply()
       }
     }
   }
-  // commit transaction
 
-  //update( UF_Model | UF_ObjBrowser );
-  module()->updateObjBrowser( true, 0 );
+  update( UF_Model | UF_ObjBrowser );
+
   init();
   return true;
 }
@@ -264,7 +266,11 @@ QString SMESHGUI_InitMeshOp::defaultMeshName() const
 void SMESHGUI_InitMeshOp::init()
 {
   if( myDlg )
+  {
     myDlg->setMeshName( defaultMeshName() );
+    myDlg->clearSelection();
+    myDlg->updateControlState();
+  }    
 }
 
 //=================================================================================
@@ -295,3 +301,50 @@ SMESH::SMESH_Mesh_var SMESHGUI_InitMeshOp::initMesh ( GEOM::GEOM_Object_ptr theS
   
   return aMesh._retn();
 }
+
+//=================================================================================
+// function : defaultMeshName()
+// purpose  :
+//=================================================================================
+void SMESHGUI_InitMeshOp::onSelectionChanged( int id )
+{
+  if( !myDlg->hasSelection( id ) )
+    return;
+    
+  if( id==SMESHGUI_InitMeshDlg::GeomObj )
+  {
+    QStringList selGeom;
+    myDlg->selectedObject( SMESHGUI_InitMeshDlg::GeomObj, selGeom );
+
+    _PTR(SObject) aGeomSO = studyDS()->FindObjectID( selGeom.first() );
+    GEOM::GEOM_Object_var myGeomShape = GEOM::GEOM_Object::_narrow( _CAST(SObject,aGeomSO)->GetObject() );
+    if( myGeomShape->_is_nil() || !GEOMBase::IsShape( myGeomShape ) )
+      myDlg->clearSelection( id );
+  }
+}
+
+//=================================================================================
+// function : isValid
+// purpose  :
+//=================================================================================
+bool SMESHGUI_InitMeshOp::isValid( SUIT_Operation* theOtherOp ) const
+{
+  if ( theOtherOp && theOtherOp->inherits( "SMESHGUI_AddSubMeshOp" ) )
+    return true;
+  else
+    return false;
+    
+}
+
+
+
+
+
+
+
+
+
+
+
+
+