X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_SingleEditDlg.cxx;h=11b9a66ba84ea765fccc6fb0a5cab8586da7cb89;hb=8e26c31d5f0060ccabf7c32d69f53a7368757aea;hp=cf7750be8bf7c5d3688e80597696e6c039036199;hpb=c38c10811a065cf5b13e8807ed71864d92ca7d80;p=modules%2Fsmesh.git diff --git a/src/SMESHGUI/SMESHGUI_SingleEditDlg.cxx b/src/SMESHGUI/SMESHGUI_SingleEditDlg.cxx index cf7750be8..11b9a66ba 100755 --- a/src/SMESHGUI/SMESHGUI_SingleEditDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_SingleEditDlg.cxx @@ -113,7 +113,6 @@ SMESHGUI_SingleEditDlg WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), mySelector(SMESH::GetViewWindow(theModule)->GetSelector()), mySelectionMgr(SMESH::GetSelectionMgr(theModule)), - myViewWindow(SMESH::GetViewWindow(theModule)), mySMESHGUI(theModule) { QVBoxLayout* aDlgLay = new QVBoxLayout(this, MARGIN, SPACING); @@ -137,7 +136,7 @@ QFrame* SMESHGUI_SingleEditDlg::createMainFrame (QWidget* theParent) { QGroupBox* aMainGrp = new QGroupBox(1, Qt::Vertical, tr("EDGE_BETWEEN"), theParent); - QPixmap aPix (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT"))); + QPixmap aPix (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT"))); new QLabel(tr("SMESH_EDGE"), aMainGrp); (new QPushButton(aMainGrp))->setPixmap(aPix); @@ -240,7 +239,8 @@ void SMESHGUI_SingleEditDlg::Init() this->show(); // set selection mode - myViewWindow->SetSelectionMode(EdgeOfCellSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(EdgeOfCellSelection); onSelectionDone(); } @@ -262,7 +262,8 @@ void SMESHGUI_SingleEditDlg::onOk() //======================================================================= void SMESHGUI_SingleEditDlg::onClose() { - myViewWindow->SetSelectionMode(ActorSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(ActorSelection); mySelectionMgr->clearSelected(); disconnect(mySelectionMgr, 0, this, 0); disconnect(mySMESHGUI, 0, this, 0); @@ -349,10 +350,10 @@ void SMESHGUI_SingleEditDlg::onTextChange (const QString& theNewText) // find a triangle and an edge nb const SMDS_MeshElement* tria[2]; allOk &= a2Nodes[0] != a2Nodes[1] && findTriangles(a2Nodes[0],a2Nodes[1],tria[0],tria[1]); - if(allOk){ - myBusy = true; // block onSelectionDone() + myBusy = true; // block onSelectionDone() + if(allOk) + { newIndices.Add(tria[0]->GetID()); - mySelector->AddOrRemoveIndex(anIO,newIndices, true); const SMDS_MeshNode* a3Nodes [3]; SMDS_ElemIteratorPtr it; @@ -368,15 +369,15 @@ void SMESHGUI_SingleEditDlg::onTextChange (const QString& theNewText) } } } - - newIndices.Clear(); newIndices.Add(-edgeInd-1); - mySelector->AddOrRemoveIndex(anIO,newIndices,true); - myBusy = false; myOkBtn->setEnabled(true); myApplyBtn->setEnabled(true); } + mySelector->AddOrRemoveIndex(anIO,newIndices, false); + SMESH::GetViewWindow(mySMESHGUI)->highlight( anIO, true, true ); + + myBusy = false; } } } @@ -406,19 +407,22 @@ void SMESHGUI_SingleEditDlg::onSelectionDone() myActor = SMESH::FindActorByEntry(anIO->getEntry()); if(myActor){ TVisualObjPtr aVisualObj = myActor->GetObject(); - if(SMDS_Mesh* aMesh = aVisualObj->GetMesh()){ - if(SMESH::GetEdgeNodes(mySelector, aVisualObj, anId1, anId2) >= 1){ + if(SMDS_Mesh* aMesh = aVisualObj->GetMesh()) + { + const SMDS_MeshElement* tria[2]; + if( SMESH::GetEdgeNodes( mySelector, aVisualObj, anId1, anId2 ) >= 1 && + findTriangles( aMesh->FindNode( anId1 ), aMesh->FindNode( anId2 ), tria[0],tria[1] ) ) + { QString aText = QString("%1-%2").arg(anId1).arg(anId2); myBusy = true; myEdge->setText(aText); myBusy = false; - const SMDS_MeshElement* tria[2]; - if (findTriangles(aMesh->FindNode(anId1), aMesh->FindNode(anId2), tria[0],tria[1])) { - myOkBtn->setEnabled(true); - myApplyBtn->setEnabled(true); - } - } else { + myOkBtn->setEnabled(true); + myApplyBtn->setEnabled(true); + } + else + { myEdge->clear(); } } @@ -442,7 +446,8 @@ void SMESHGUI_SingleEditDlg::enterEvent (QEvent*) { if (!isEnabled()) { mySMESHGUI->EmitSignalDeactivateDialog(); - myViewWindow->SetSelectionMode(EdgeOfCellSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(EdgeOfCellSelection); setEnabled(true); } } @@ -502,7 +507,9 @@ bool SMESHGUI_SingleEditDlg::onApply() // update actor if (aResult) { + mySelector->ClearIndex(); mySelectionMgr->setSelectedObjects(aList, false); + onSelectionDone(); SMESH::UpdateView(); }