X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_SewingDlg.cxx;h=6ee03914146aa7263aa2329bcee5d0e986aaaf3e;hb=f87e54ae3a450f6adeee75d1b42c3b17e9c6250c;hp=a84e3834d40326526fa171fdc64a2fc730051f42;hpb=c38c10811a065cf5b13e8807ed71864d92ca7d80;p=modules%2Fsmesh.git diff --git a/src/SMESHGUI/SMESHGUI_SewingDlg.cxx b/src/SMESHGUI/SMESHGUI_SewingDlg.cxx index a84e3834d..6ee039141 100644 --- a/src/SMESHGUI/SMESHGUI_SewingDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_SewingDlg.cxx @@ -75,15 +75,14 @@ SMESHGUI_SewingDlg::SMESHGUI_SewingDlg( SMESHGUI* theModule, const char* name, : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose), mySMESHGUI( theModule ), - mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), - myViewWindow( SMESH::GetViewWindow( theModule ) ), - mySelector( myViewWindow->GetSelector() ) + mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) { - QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_FREEBORDERS"))); - QPixmap image1 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_CONFORM_FREEBORDERS"))); - QPixmap image2 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_BORDERTOSIDE"))); - QPixmap image3 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_SIDEELEMENTS"))); - QPixmap image4 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT"))); + SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI ); + QPixmap image0 (mgr->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_FREEBORDERS"))); + QPixmap image1 (mgr->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_CONFORM_FREEBORDERS"))); + QPixmap image2 (mgr->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_BORDERTOSIDE"))); + QPixmap image3 (mgr->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_SIDEELEMENTS"))); + QPixmap image4 (mgr->loadPixmap("SMESH", tr("ICON_SELECT"))); if (!name) setName("SMESHGUI_SewingDlg"); @@ -283,6 +282,8 @@ SMESHGUI_SewingDlg::SMESHGUI_SewingDlg( SMESHGUI* theModule, const char* name, LineEdit5->setValidator(new SMESHGUI_IdValidator(this, "validator", 1)); LineEdit6->setValidator(new SMESHGUI_IdValidator(this, "validator", 1)); + mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector(); + mySMESHGUI->SetActiveDialogBox((QDialog*)this); Init(); @@ -451,7 +452,8 @@ void SMESHGUI_SewingDlg::ConstructorsClicked (int constructorId) SMESH::SetPointRepresentation(false); - myViewWindow->SetSelectionMode(CellSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(CellSelection); break; } } @@ -469,7 +471,8 @@ void SMESHGUI_SewingDlg::ConstructorsClicked (int constructorId) SMESH::SetPointRepresentation(true); - myViewWindow->SetSelectionMode(NodeSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(NodeSelection); } connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); @@ -592,7 +595,8 @@ void SMESHGUI_SewingDlg::ClickOnCancel() { mySelectionMgr->clearSelected(); SMESH::SetPointRepresentation(false); - myViewWindow->SetSelectionMode(ActorSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(ActorSelection); disconnect(mySelectionMgr, 0, this, 0); mySMESHGUI->ResetState(); reject(); @@ -637,31 +641,21 @@ void SMESHGUI_SewingDlg::onTextChange (const QString& theNewText) send->clear(); if (aMesh) { - //mySelectionMgr->clearSelected(); - //mySelectionMgr->AddIObject(myActor->getIO()); - SALOME_ListIO aList; - aList.Append(myActor->getIO()); - mySelectionMgr->setSelectedObjects(aList, false); - - TColStd_IndexedMapOfInteger selectedIndices; TColStd_MapOfInteger newIndices; - mySelector->GetIndex( myActor->getIO(), selectedIndices); - + if (GetConstructorId() != 3 || (send != LineEdit1 && send != LineEdit4)) { SMESH::SetPointRepresentation(true); - myViewWindow->SetSelectionMode(NodeSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(NodeSelection); const SMDS_MeshNode * n = aMesh->FindNode(theNewText.toInt()); if (n) { - //if (!mySelectionMgr->IsIndexSelected(myActor->getIO(), n->GetID())) { - if (selectedIndices.Add(n->GetID())) { - //mySelectionMgr->AddOrRemoveIndex (myActor->getIO(), n->GetID(), true); - newIndices.Add(n->GetID()); - mySelector->AddOrRemoveIndex(myActor->getIO(), newIndices, true); - myViewWindow->highlight( myActor->getIO(), true, true ); - } - + newIndices.Add(n->GetID()); + mySelector->AddOrRemoveIndex(myActor->getIO(), newIndices, false); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->highlight( myActor->getIO(), true, true ); + if (send == LineEdit1) myOk1 = true; else if (send == LineEdit2) @@ -678,7 +672,8 @@ void SMESHGUI_SewingDlg::onTextChange (const QString& theNewText) } else { SMESH::SetPointRepresentation(false); - myViewWindow->SetSelectionMode(CellSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(CellSelection); QStringList aListId = QStringList::split(" ", theNewText, false); @@ -686,23 +681,18 @@ void SMESHGUI_SewingDlg::onTextChange (const QString& theNewText) for (int i = 0; i < aListId.count(); i++) { const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt()); - if (e) { - //if (!mySelectionMgr->IsIndexSelected(myActor->getIO(), e->GetID())) { - if (selectedIndices.Add(e->GetID())) { - //mySelectionMgr->AddOrRemoveIndex (myActor->getIO(), e->GetID(), true); - newIndices.Add(e->GetID()); - } + if (e) + newIndices.Add(e->GetID()); + if (!isEvenOneExists) isEvenOneExists = true; - } - } - - if (newIndices.Extent() > 0) - { - mySelector->AddOrRemoveIndex(myActor->getIO(), newIndices, true); - myViewWindow->highlight( myActor->getIO(), true, true ); } + + mySelector->AddOrRemoveIndex(myActor->getIO(), newIndices, false); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->highlight( myActor->getIO(), true, true ); + if (isEvenOneExists) { if (send == LineEdit1) myOk1 = true; @@ -838,11 +828,13 @@ void SMESHGUI_SewingDlg::SetEditCurrentArgument() if (GetConstructorId() != 3 || (send != SelectButton1 && send != SelectButton4)) { SMESH::SetPointRepresentation(true); - myViewWindow->SetSelectionMode(NodeSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(NodeSelection); } else { SMESH::SetPointRepresentation(false); - myViewWindow->SetSelectionMode(CellSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(CellSelection); } myEditCurrentArgument->setFocus();