Salome HOME
Join modifications from branch OCC_development_for_3_2_0a2
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_AddMeshElementDlg.cxx
index 823716a853bb6cd4f69b87c496538c69aba2e665..df2bb4df18227499a267cbd2d308177a8aa19966 100644 (file)
@@ -65,6 +65,7 @@
 #include <vtkUnsignedCharArray.h>
 #include <vtkUnstructuredGrid.h>
 #include <vtkDataSetMapper.h>
+#include <vtkProperty.h>
 
 // QT Includes
 #include <qbuttongroup.h>
@@ -410,10 +411,6 @@ void SMESHGUI_AddMeshElementDlg::Init()
   if (Reverse)
     connect(Reverse, SIGNAL(stateChanged(int)), SLOT(CheckBox(int)));
 
-  // 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
 
   // set selection mode
@@ -457,6 +454,7 @@ void SMESHGUI_AddMeshElementDlg::ClickOnApply()
     }
 
     SALOME_ListIO aList; aList.Append( myActor->getIO() );
+    mySelector->ClearIndex();
     mySelectionMgr->setSelectedObjects( aList, false );
 
     SMESH::UpdateView();
@@ -488,7 +486,7 @@ void SMESHGUI_AddMeshElementDlg::ClickOnOk()
 //=================================================================================
 void SMESHGUI_AddMeshElementDlg::ClickOnCancel()
 {
-  mySelectionMgr->clearSelected();
+  //mySelectionMgr->clearSelected();
   mySimulation->SetVisibility(false);
   SMESH::SetPointRepresentation(false);
   if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
@@ -524,23 +522,30 @@ void SMESHGUI_AddMeshElementDlg::onTextChange (const QString& theNewText)
     TColStd_MapOfInteger newIndices;
     
     QStringList aListId = QStringList::split(" ", theNewText, false);
+    bool allOk = true;
     for (int i = 0; i < aListId.count(); i++) {
       if( const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() ) )
       {
        newIndices.Add( n->GetID() );
        myNbOkNodes++;
       }
+      else
+       allOk = false;  
     }
     
     mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, false );
     if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
       aViewWindow->highlight( myActor->getIO(), true, true );
     
-    bool aNodesOK = false;
-    if (myIsPoly && myElementType == SMDSAbs_Face && aListId.count() >=3 ){
-      myNbOkNodes = aListId.count();
-      aNodesOK = true;
-    }
+    myNbOkNodes = ( allOk && myNbNodes == aListId.count() );
+    
+    if (myIsPoly)
+      {
+       if ( !allOk || myElementType != SMDSAbs_Face || aListId.count() < 3 )
+         myNbOkNodes = 0;
+       else
+         myNbOkNodes = aListId.count();
+      }
   }
   
   if(myNbOkNodes) {