X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_GroupDlg.cxx;h=dc1a29fa3b5c42cf4c09a45bd8222090c01842d6;hp=d954febb218bd9efec7febb09696ec8d10259bbd;hb=10191484fe88a27e962b8e4b57e09d390d8705c7;hpb=7eda9ca931ed2a11cb5e4637e4ffe19f5c061115 diff --git a/src/SMESHGUI/SMESHGUI_GroupDlg.cxx b/src/SMESHGUI/SMESHGUI_GroupDlg.cxx index d954febb2..dc1a29fa3 100644 --- a/src/SMESHGUI/SMESHGUI_GroupDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_GroupDlg.cxx @@ -444,7 +444,6 @@ void SMESHGUI_GroupDlg::initDialog( bool create) /* Init selection */ mySMESHGUI->SetActiveDialogBox(this); - mySMESHGUI->SetState(800); SalomeApp_Study* aStudy = dynamic_cast( mySMESHGUI->application()->activeStudy() ); mySelectionMode = grpNoSelection; @@ -499,10 +498,7 @@ QString SMESHGUI_GroupDlg::GetDefaultName(const QString& theOperation) QString aName = ""; // collect all object names of SMESH component - SalomeApp_Study* appStudy = - dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); - if ( !appStudy ) return aName; - _PTR(Study) aStudy = appStudy->studyDS(); + _PTR(Study) aStudy = SMESH::getStudy(); std::set aSet; _PTR(SComponent) aMeshCompo (aStudy->FindComponent( "SMESH" )); @@ -529,14 +525,13 @@ QString SMESHGUI_GroupDlg::GetDefaultName(const QString& theOperation) void SMESHGUI_GroupDlg::setDefaultName() const { QString aResName; - _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); int i=1; QString aPrefix ="Group_"; _PTR(SObject) anObj; do { aResName = aPrefix + QString::number( i++ ); - anObj = aStudy->FindObject( SMESH::toUtf8(aResName) ); + anObj = SMESH::getStudy()->FindObject( SMESH::toUtf8(aResName) ); } while ( anObj ); myName->setText(aResName); @@ -665,7 +660,7 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_GroupBase_ptr theGroup, else if ( grpType == 1 ) // group on geom { QString aShapeName( "" ); - _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); + _PTR(Study) aStudy = SMESH::getStudy(); GEOM::GEOM_Object_var aGroupShape = myGroupOnGeom->GetShape(); if (!aGroupShape->_is_nil()) { @@ -916,7 +911,7 @@ void SMESHGUI_GroupDlg::setSelectionMode (int theMode) //================================================================================= bool SMESHGUI_GroupDlg::onApply() { - if (mySMESHGUI->isActiveStudyLocked()) + if (SMESHGUI::isStudyLocked()) return false; if (myName->text().trimmed().isEmpty()) @@ -936,7 +931,7 @@ bool SMESHGUI_GroupDlg::onApply() QStringList anEntryList; SMESH::SMESH_GroupBase_var resultGroup; - bool isCreation, isConversion = false; + bool isCreation = false, isConversion = false; SUIT_OverrideCursor wc; @@ -1051,7 +1046,7 @@ bool SMESHGUI_GroupDlg::onApply() if (myMesh->_is_nil() || !myGeomObjects->length()) return false; - _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); + _PTR(Study) aStudy = SMESH::getStudy(); if (myGeomObjects->length() == 1) { myGroupOnGeom = myMesh->CreateGroupFromGEOM(aType, @@ -1065,12 +1060,11 @@ bool SMESHGUI_GroupDlg::onApply() // create a geometry group GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen(); - _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); - if (geomGen->_is_nil() || !aStudy) + if (geomGen->_is_nil()) return false; - GEOM::GEOM_IGroupOperations_wrap op = geomGen->GetIGroupOperations(aStudy->StudyId()); + GEOM::GEOM_IGroupOperations_wrap op = geomGen->GetIGroupOperations(); if (op->_is_nil()) return false; @@ -1096,7 +1090,7 @@ bool SMESHGUI_GroupDlg::onApply() QString aNewGeomGroupName ( "Auto_group_for_" ); aNewGeomGroupName += myName->text(); SALOMEDS::SObject_var aNewGroupSO = - geomGen->AddInStudy(aSMESHGen->GetCurrentStudy(), aGroupVar, + geomGen->AddInStudy(aGroupVar, SMESH::toUtf8(aNewGeomGroupName), aMeshShape); } @@ -1119,14 +1113,14 @@ bool SMESHGUI_GroupDlg::onApply() { if ( myFilter->_is_nil() ) return false; - if (CORBA::is_nil(myGroupOnFilter)) { // creation + if (CORBA::is_nil(myGroupOnFilter)) // creation + { if (myMesh->_is_nil()) return false; myGroupOnFilter = myMesh->CreateGroupFromFilter(aType, SMESH::toUtf8(myName->text()), myFilter); - resultGroup = SMESH::SMESH_GroupBase::_narrow( myGroupOnFilter ); isCreation = true; } @@ -1140,7 +1134,7 @@ bool SMESHGUI_GroupDlg::onApply() anIsOk = true; } - if( anIsOk ) + if ( anIsOk ) { SALOMEDS::Color aColor = getGroupColor(); resultGroup->SetColor(aColor); @@ -1413,13 +1407,12 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged() continue; // Check if group constructed on the same shape as a mesh or on its child - _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); // The main shape of the group GEOM::GEOM_Object_var aGroupMainShape; if (aGeomGroup->GetType() == 37) { GEOM::GEOM_IGroupOperations_wrap anOp = - SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId()); + SMESH::GetGEOMGen()->GetIGroupOperations(); aGroupMainShape = anOp->GetMainShape(aGeomGroup); // aGroupMainShape is an existing servant => GEOM_Object_var not GEOM_Object_wrap } @@ -1428,7 +1421,7 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged() aGroupMainShape->Register(); } _PTR(SObject) aGroupMainShapeSO = - aStudy->FindObjectID(aGroupMainShape->GetStudyEntry()); + SMESH::getStudy()->FindObjectID(aGroupMainShape->GetStudyEntry()); _PTR(SObject) anObj, aRef; bool isRefOrSubShape = false; @@ -1609,6 +1602,8 @@ void SMESHGUI_GroupDlg::onSelectAll() mySortBtn->setEnabled ( !noElemsModif ); mySelectBox->setEnabled ( !noElemsModif ); myAllowElemsModif->setEnabled( !mySelectAll->isChecked() ); + if ( noElemsModif ) mySMESHGUI->ResetState(); + else mySMESHGUI->SetState(800); int selMode = mySelectionMode; mySelectionMode = grpNoSelection; @@ -2005,9 +2000,8 @@ void SMESHGUI_GroupDlg::onAdd() onListSelectionChanged(); } else if (myCurrentLineEdit == myGeomGroupLine && myGeomObjects->length() == 1) { - _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); GEOM::GEOM_IGroupOperations_wrap aGroupOp = - SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId()); + SMESH::GetGEOMGen()->GetIGroupOperations(); SMESH::ElementType aGroupType = SMESH::ALL; switch(aGroupOp->GetType(myGeomObjects[0])) { @@ -2020,8 +2014,8 @@ void SMESHGUI_GroupDlg::onAdd() if (aGroupType == aType) { _PTR(SObject) aGroupSO = - //aStudy->FindObjectIOR(aStudy->ConvertObjectToIOR(myGeomGroup)); - aStudy->FindObjectID(myGeomObjects[0]->GetStudyEntry()); + //SMESH::getStudy()->FindObjectIOR(SMESH::getStudy()->ConvertObjectToIOR(myGeomGroup)); + SMESH::getStudy()->FindObjectID(myGeomObjects[0]->GetStudyEntry()); // Construct filter SMESH::FilterManager_var aFilterMgr = SMESH::GetFilterManager(); SMESH::Filter_var aFilter = aFilterMgr->CreateFilter(); @@ -2332,9 +2326,9 @@ void SMESHGUI_GroupDlg::enterEvent (QEvent*) setEnabled(true); mySelectionMode = grpNoSelection; setSelectionMode(myTypeId); - //mySMESHGUI->SetActiveDialogBox((QDialog*)this); mySMESHGUI->SetActiveDialogBox(this); - mySMESHGUI->SetState(800); + if ( mySelectBox->isEnabled() ) mySMESHGUI->SetState(800); + else mySMESHGUI->ResetState(); } } @@ -2453,8 +2447,7 @@ void SMESHGUI_GroupDlg::onPublishShapeByMeshDlg(SUIT_Operation* op) if ( !aGeomVar->_is_nil() ) { QString ID = aGeomVar->GetStudyEntry(); - _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); - if ( _PTR(SObject) aGeomSO = aStudy->FindObjectID( ID.toLatin1().data() )) { + if ( _PTR(SObject) aGeomSO = SMESH::getStudy()->FindObjectID( ID.toLatin1().data() )) { SALOME_ListIO anIOList; Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject ( aGeomSO->GetID().c_str(), "SMESH", aGeomSO->GetName().c_str() );