Salome HOME
Join modifications from branch OCC_development_for_3_2_0a2
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_MergeNodesDlg.cxx
index 7ad8ccbe4c1f9bae6709c3e479afbe2ddad5d021..d089d8cbd690d64ed7d242303135cadd85d1bb21 100644 (file)
@@ -79,9 +79,7 @@ SMESHGUI_MergeNodesDlg::SMESHGUI_MergeNodesDlg( SMESHGUI* theModule, const char*
      : 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 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_MERGE_NODES")));
   QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
@@ -245,8 +243,12 @@ SMESHGUI_MergeNodesDlg::SMESHGUI_MergeNodesDlg( SMESHGUI* theModule, const char*
 
   RadioButton1->setChecked(TRUE);
 
+  myEditCurrentArgument = (QWidget*)LineEditMesh; 
+
   myActor = 0;
 
+  mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
+
   mySMESHGUI->SetActiveDialogBox((QDialog*)this);
 
   myMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH);
@@ -271,15 +273,14 @@ SMESHGUI_MergeNodesDlg::SMESHGUI_MergeNodesDlg( SMESHGUI* theModule, const char*
   /* to close dialog if study change */
   connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
 
-  /* Move widget on the botton right corner of main widget */
-  int x, y;
-  mySMESHGUI->DefineDlgPosition(this, x, y);
-  this->move(x, y);
   this->show(); /* displays Dialog */
 
   resize(0,0);
   buttonOk->setEnabled(false);
   buttonApply->setEnabled(false);
+
+  // Init Mesh field from selection
+  SelectionIntoArgument();
 }
 
 //=================================================================================
@@ -330,7 +331,7 @@ bool SMESHGUI_MergeNodesDlg::ClickOnApply()
   } catch(...) {
   }
 
-  mySelectionMgr->clearSelected();
+  //mySelectionMgr->clearSelected();
   SMESH::UpdateView();
 
   onDetect();
@@ -354,9 +355,10 @@ void SMESHGUI_MergeNodesDlg::ClickOnOk()
 void SMESHGUI_MergeNodesDlg::ClickOnCancel()
 {
   mySelectionMgr->clearFilters();
-  mySelectionMgr->clearSelected();
+  //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();
@@ -388,7 +390,8 @@ void SMESHGUI_MergeNodesDlg::updateControls()
 {
   if (ListCoincident->childCount() < 1) {
     SMESH::SetPointRepresentation(false);
-    myViewWindow->SetSelectionMode(ActorSelection);
+    if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+      aViewWindow->SetSelectionMode(ActorSelection);
     return;
   }
 
@@ -476,7 +479,8 @@ void SMESHGUI_MergeNodesDlg::onSelectNodesGroup()
   mySelectionMgr->setSelectedObjects(aList, false);
 
   SMESH::SetPointRepresentation(true);
-  myViewWindow->SetSelectionMode(NodeSelection);
+  if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+    aViewWindow->SetSelectionMode(NodeSelection);
 
   ListEdit->selectAll(true);
 }
@@ -590,7 +594,8 @@ void SMESHGUI_MergeNodesDlg::SetEditCurrentArgument()
   if (send == SelectMeshButton) {
     myEditCurrentArgument = (QWidget*)LineEditMesh;
     SMESH::SetPointRepresentation(false);
-    myViewWindow->SetSelectionMode(ActorSelection);
+    if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+      aViewWindow->SetSelectionMode(ActorSelection);
     mySelectionMgr->installFilter(myMeshOrSubMeshFilter);
   }