Salome HOME
52943: "Apply and Close" button does not active on symmetry dialog box
authoreap <eap@opencascade.com>
Wed, 11 Nov 2015 13:13:01 +0000 (16:13 +0300)
committereap <eap@opencascade.com>
Wed, 11 Nov 2015 13:13:01 +0000 (16:13 +0300)
  Fix same pb in all similar dlg

src/SMESHGUI/SMESHGUI_CopyMeshDlg.cxx
src/SMESHGUI/SMESHGUI_Make2DFrom3DOp.cxx
src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx
src/SMESHGUI/SMESHGUI_RotationDlg.cxx
src/SMESHGUI/SMESHGUI_ScaleDlg.cxx
src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx
src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx
src/SMESHGUI/SMESHGUI_TranslationDlg.cxx

index 9f85f5c2762a0215fbfb152b0578db62865afb97..35611dfe5a004b715b44c329b90647a09ee02190 100644 (file)
@@ -494,6 +494,9 @@ void SMESHGUI_CopyMeshDlg::onTextChange (const QString& theNewText)
 void SMESHGUI_CopyMeshDlg::SelectionIntoArgument()
 {
   if (myBusy) return;
 void SMESHGUI_CopyMeshDlg::SelectionIntoArgument()
 {
   if (myBusy) return;
+  if (myFilterDlg && myFilterDlg->isVisible()) return; // filter dlg active
+  if (!GroupButtons->isEnabled()) return;              // inactive
+
   BusyLocker lock( myBusy );
 
   // clear
   BusyLocker lock( myBusy );
 
   // clear
@@ -677,6 +680,15 @@ void SMESHGUI_CopyMeshDlg::setFilters()
   if ( !myFilterDlg )
     myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, SMESH::ALL );
 
   if ( !myFilterDlg )
     myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, SMESH::ALL );
 
+  QList<int> types;
+  if ( myMesh->NbEdges()     ) types << SMESH::EDGE;
+  if ( myMesh->NbFaces()     ) types << SMESH::FACE;
+  if ( myMesh->NbVolumes()   ) types << SMESH::VOLUME;
+  if ( myMesh->NbBalls()     ) types << SMESH::BALL;
+  if ( myMesh->Nb0DElements()) types << SMESH::ELEM0D;
+  if ( types.count() > 1 )     types << SMESH::ALL;
+
+  myFilterDlg->Init( types );
   myFilterDlg->SetSelection();
   myFilterDlg->SetMesh( myMesh );
   myFilterDlg->SetSourceWg( myLineEditElements );
   myFilterDlg->SetSelection();
   myFilterDlg->SetMesh( myMesh );
   myFilterDlg->SetSourceWg( myLineEditElements );
index 199bdf420e29ce3ff830d3d64cc28956da8e89a3..1767a2805ebbd2b177749c070cfd6718f3da0284 100644 (file)
@@ -299,14 +299,14 @@ void SMESHGUI_Make2DFrom3DOp::selectionDone()
       myDlg->selectObject( names, types, ids );
 
       // enable/desable "new mesh" button
       myDlg->selectObject( names, types, ids );
 
       // enable/desable "new mesh" button
-      bool isMesh = true; // EAP - it's sometimes necessary to copy to a new mesh
-      // for ( int i = 0; i < ids.count() && isMesh; ++i )
-      // {
-      //   _PTR(SObject) sobj =
-      //     SMESHGUI::activeStudy()->studyDS()->FindObjectID( ids[i].toLatin1().constData() );
-      //   mySrcMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>( sobj );  
-      //   isMesh = !mySrcMesh->_is_nil();
-      // }
+      bool isMesh = true;
+      for ( int i = 0; i < ids.count() && isMesh; ++i )
+      {
+        _PTR(SObject) sobj =
+          SMESHGUI::activeStudy()->studyDS()->FindObjectID( ids[i].toLatin1().constData() );
+        mySrcMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>( sobj );  
+        //isMesh = !mySrcMesh->_is_nil(); // EAP - it's sometimes necessary to copy to a new mesh
+      }
       myDlg->setNewMeshEnabled( isMesh );
     }
     catch ( const SALOME::SALOME_Exception& S_ex ) {
       myDlg->setNewMeshEnabled( isMesh );
     }
     catch ( const SALOME::SALOME_Exception& S_ex ) {
index a8cdcb1ea362f6e1d2e7e5549ceee3d3d08c371e..1ebfd06227d4aeace34ea6495fa66f0c7e473292 100644 (file)
@@ -377,7 +377,7 @@ void SMESHGUI_RemoveElementsDlg::onTextChange(const QString& theNewText)
 void SMESHGUI_RemoveElementsDlg::SelectionIntoArgument()
 {
   if (myBusy) return;                                  // busy
 void SMESHGUI_RemoveElementsDlg::SelectionIntoArgument()
 {
   if (myBusy) return;                                  // busy
-  if (myFilterDlg && myFilterDlg->isVisible()) return; // filter digl active
+  if (myFilterDlg && myFilterDlg->isVisible()) return; // filter dlg active
   if (!GroupButtons->isEnabled()) return;              // inactive
 
   // clear
   if (!GroupButtons->isEnabled()) return;              // inactive
 
   // clear
index 9531609ab967351f2706ee710467974516717fe3..1ed6e0a793191070f98d738d3a15c034a9b53fae 100644 (file)
@@ -677,6 +677,7 @@ void SMESHGUI_RotationDlg::onTextChange (const QString& theNewText)
 void SMESHGUI_RotationDlg::SelectionIntoArgument()
 {
   if (myBusy) return;
 void SMESHGUI_RotationDlg::SelectionIntoArgument()
 {
   if (myBusy) return;
+  if (myFilterDlg && myFilterDlg->isVisible()) return; // filter dlg active
 
   // clear
   myActor = 0;
 
   // clear
   myActor = 0;
@@ -1064,6 +1065,15 @@ void SMESHGUI_RotationDlg::setFilters()
   if ( !myFilterDlg )
     myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, SMESH::ALL );
 
   if ( !myFilterDlg )
     myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, SMESH::ALL );
 
+  QList<int> types;
+  if ( myMeshes[0]->NbEdges()     ) types << SMESH::EDGE;
+  if ( myMeshes[0]->NbFaces()     ) types << SMESH::FACE;
+  if ( myMeshes[0]->NbVolumes()   ) types << SMESH::VOLUME;
+  if ( myMeshes[0]->NbBalls()     ) types << SMESH::BALL;
+  if ( myMeshes[0]->Nb0DElements()) types << SMESH::ELEM0D;
+  if ( types.count() > 1 )          types << SMESH::ALL;
+
+  myFilterDlg->Init( types );
   myFilterDlg->SetSelection();
   myFilterDlg->SetMesh( myMeshes[0] );
   myFilterDlg->SetSourceWg( LineEditElements );
   myFilterDlg->SetSelection();
   myFilterDlg->SetMesh( myMeshes[0] );
   myFilterDlg->SetSourceWg( LineEditElements );
index 1e712f0a348148f80ff5c8ed8100e4de4835c852..8f4ab6993949a8623b7abb9b675e0ff74775fdf8 100644 (file)
@@ -715,6 +715,8 @@ void SMESHGUI_ScaleDlg::onTextChange (const QString& theNewText)
 void SMESHGUI_ScaleDlg::SelectionIntoArgument()
 {
   if (myBusy) return;
 void SMESHGUI_ScaleDlg::SelectionIntoArgument()
 {
   if (myBusy) return;
+  if (myFilterDlg && myFilterDlg->isVisible()) return; // filter dlg active
+
   BusyLocker lock( myBusy );
   // clear
   myActor = 0;
   BusyLocker lock( myBusy );
   // clear
   myActor = 0;
@@ -1112,6 +1114,15 @@ void SMESHGUI_ScaleDlg::setFilters()
   if ( !myFilterDlg )
     myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, SMESH::ALL );
 
   if ( !myFilterDlg )
     myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, SMESH::ALL );
 
+  QList<int> types;
+  if ( myMeshes[0]->NbEdges()     ) types << SMESH::EDGE;
+  if ( myMeshes[0]->NbFaces()     ) types << SMESH::FACE;
+  if ( myMeshes[0]->NbVolumes()   ) types << SMESH::VOLUME;
+  if ( myMeshes[0]->NbBalls()     ) types << SMESH::BALL;
+  if ( myMeshes[0]->Nb0DElements()) types << SMESH::ELEM0D;
+  if ( types.count() > 1 )          types << SMESH::ALL;
+
+  myFilterDlg->Init( types );
   myFilterDlg->SetSelection();
   myFilterDlg->SetMesh( myMeshes[0] );
   myFilterDlg->SetSourceWg( LineEditElements );
   myFilterDlg->SetSelection();
   myFilterDlg->SetMesh( myMeshes[0] );
   myFilterDlg->SetSourceWg( LineEditElements );
index 30c98a6aaa6d1374e970dbb5ed61fa4c2afd738e..e272d010c091bf338f045343605d732a81770a89 100644 (file)
@@ -566,6 +566,7 @@ void SMESHGUI_SmoothingDlg::onTextChange (const QString& theNewText)
 void SMESHGUI_SmoothingDlg::SelectionIntoArgument()
 {
   if (myBusy) return;
 void SMESHGUI_SmoothingDlg::SelectionIntoArgument()
 {
   if (myBusy) return;
+  if (myFilterDlg && myFilterDlg->isVisible()) return; // filter dlg active
 
   // clear
   QString aString = "";
 
   // clear
   QString aString = "";
@@ -574,7 +575,8 @@ void SMESHGUI_SmoothingDlg::SelectionIntoArgument()
   BusyLocker lock( myBusy );
 
   if (myEditCurrentArgument == LineEditElements ||
   BusyLocker lock( myBusy );
 
   if (myEditCurrentArgument == LineEditElements ||
-      myEditCurrentArgument == LineEditNodes) {
+      myEditCurrentArgument == LineEditNodes)
+  {
     myEditCurrentArgument->setText(aString);
     if (myEditCurrentArgument == LineEditElements) {
       myNbOkElements = 0;
     myEditCurrentArgument->setText(aString);
     if (myEditCurrentArgument == LineEditElements) {
       myNbOkElements = 0;
index 1b484b5b3750a210cb8505e9930715adc034bddd..eebc605dffffcd88586bd4836e4bec89a0a56473 100644 (file)
@@ -736,6 +736,7 @@ void SMESHGUI_SymmetryDlg::onTextChange (const QString& theNewText)
 void SMESHGUI_SymmetryDlg::SelectionIntoArgument()
 {
   if (myBusy) return;
 void SMESHGUI_SymmetryDlg::SelectionIntoArgument()
 {
   if (myBusy) return;
+  if (myFilterDlg && myFilterDlg->isVisible()) return; // filter dlg active
 
   // clear
   myActor = 0;
 
   // clear
   myActor = 0;
@@ -1134,6 +1135,15 @@ void SMESHGUI_SymmetryDlg::setFilters()
   if ( !myFilterDlg )
     myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, SMESH::ALL );
 
   if ( !myFilterDlg )
     myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, SMESH::ALL );
 
+  QList<int> types;
+  if ( myMeshes[0]->NbEdges()     ) types << SMESH::EDGE;
+  if ( myMeshes[0]->NbFaces()     ) types << SMESH::FACE;
+  if ( myMeshes[0]->NbVolumes()   ) types << SMESH::VOLUME;
+  if ( myMeshes[0]->NbBalls()     ) types << SMESH::BALL;
+  if ( myMeshes[0]->Nb0DElements()) types << SMESH::ELEM0D;
+  if ( types.count() > 1 )          types << SMESH::ALL;
+
+  myFilterDlg->Init( types );
   myFilterDlg->SetSelection();
   myFilterDlg->SetMesh( myMeshes[0] );
   myFilterDlg->SetSourceWg( LineEditElements );
   myFilterDlg->SetSelection();
   myFilterDlg->SetMesh( myMeshes[0] );
   myFilterDlg->SetSourceWg( LineEditElements );
@@ -1173,10 +1183,13 @@ bool SMESHGUI_SymmetryDlg::isValid()
 // function : onDisplaySimulation
 // purpose  : Show/Hide preview
 //=================================================================================
 // function : onDisplaySimulation
 // purpose  : Show/Hide preview
 //=================================================================================
-void SMESHGUI_SymmetryDlg::onDisplaySimulation( bool toDisplayPreview ) {
-  if (myPreviewCheckBox->isChecked() && toDisplayPreview) {
-    if ( myNbOkElements && isValid() && IsMirrorOk() ) {
-      QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);      
+void SMESHGUI_SymmetryDlg::onDisplaySimulation( bool toDisplayPreview )
+{
+  if (myPreviewCheckBox->isChecked() && toDisplayPreview)
+  {
+    if ( myNbOkElements && isValid() && IsMirrorOk() )
+    {
+      QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
       SMESH::long_array_var anElementsId = new SMESH::long_array;
 
       anElementsId->length(aListElementsId.count());
       SMESH::long_array_var anElementsId = new SMESH::long_array;
 
       anElementsId->length(aListElementsId.count());
@@ -1185,7 +1198,7 @@ void SMESHGUI_SymmetryDlg::onDisplaySimulation( bool toDisplayPreview ) {
 
       SMESH::AxisStruct aMirror;
       SMESH::SMESH_MeshEditor::MirrorType aMirrorType;
 
       SMESH::AxisStruct aMirror;
       SMESH::SMESH_MeshEditor::MirrorType aMirrorType;
-      
+
       getMirror(aMirror,aMirrorType);
 
       try {
       getMirror(aMirror,aMirrorType);
 
       try {
@@ -1201,7 +1214,7 @@ void SMESHGUI_SymmetryDlg::onDisplaySimulation( bool toDisplayPreview ) {
           }
         else {
           SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditPreviewer();
           }
         else {
           SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditPreviewer();
-          aMeshEditor->Mirror(anElementsId, aMirror, aMirrorType, copy );        
+          aMeshEditor->Mirror(anElementsId, aMirror, aMirrorType, copy );
           aMeshPreviewStruct << aMeshEditor->GetPreviewData();
         }
         setSimulationPreview(aMeshPreviewStruct);
           aMeshPreviewStruct << aMeshEditor->GetPreviewData();
         }
         setSimulationPreview(aMeshPreviewStruct);
@@ -1210,7 +1223,7 @@ void SMESHGUI_SymmetryDlg::onDisplaySimulation( bool toDisplayPreview ) {
       }
     } else {
       hidePreview();
       }
     } else {
       hidePreview();
-    } 
+    }
   } else {
     hidePreview();
   }
   } else {
     hidePreview();
   }
@@ -1220,7 +1233,9 @@ void SMESHGUI_SymmetryDlg::onDisplaySimulation( bool toDisplayPreview ) {
 // function : getMirror
 // purpose  : return mirror parameters
 //=================================================================================
 // function : getMirror
 // purpose  : return mirror parameters
 //=================================================================================
-void SMESHGUI_SymmetryDlg::getMirror(SMESH::AxisStruct& theMirror, SMESH::SMESH_MeshEditor::MirrorType& theMirrorType) {
+void SMESHGUI_SymmetryDlg::getMirror(SMESH::AxisStruct&                   theMirror,
+                                     SMESH::SMESH_MeshEditor::MirrorType& theMirrorType)
+{
   theMirror.x =  SpinBox_X->GetValue();
   theMirror.y =  SpinBox_Y->GetValue();
   theMirror.z =  SpinBox_Z->GetValue();
   theMirror.x =  SpinBox_X->GetValue();
   theMirror.y =  SpinBox_Y->GetValue();
   theMirror.z =  SpinBox_Z->GetValue();
index 32c94694a7c8947ebd02e8cfc6fea9e0275300db..5d1c66901861fc991501cb8d5443cc804078414f 100644 (file)
@@ -745,6 +745,8 @@ void SMESHGUI_TranslationDlg::onTextChange (const QString& theNewText)
 void SMESHGUI_TranslationDlg::SelectionIntoArgument()
 {
   if (myBusy) return;
 void SMESHGUI_TranslationDlg::SelectionIntoArgument()
 {
   if (myBusy) return;
+  if (myFilterDlg && myFilterDlg->isVisible()) return; // filter dlg active
+
   BusyLocker lock( myBusy );
   // clear
   myActor = 0;
   BusyLocker lock( myBusy );
   // clear
   myActor = 0;
@@ -1106,6 +1108,15 @@ void SMESHGUI_TranslationDlg::setFilters()
   if ( !myFilterDlg )
     myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, SMESH::ALL );
 
   if ( !myFilterDlg )
     myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, SMESH::ALL );
 
+  QList<int> types;
+  if ( myMeshes[0]->NbEdges()     ) types << SMESH::EDGE;
+  if ( myMeshes[0]->NbFaces()     ) types << SMESH::FACE;
+  if ( myMeshes[0]->NbVolumes()   ) types << SMESH::VOLUME;
+  if ( myMeshes[0]->NbBalls()     ) types << SMESH::BALL;
+  if ( myMeshes[0]->Nb0DElements()) types << SMESH::ELEM0D;
+  if ( types.count() > 1 )          types << SMESH::ALL;
+
+  myFilterDlg->Init( types );
   myFilterDlg->SetSelection();
   myFilterDlg->SetMesh( myMeshes[0] );
   myFilterDlg->SetSourceWg( LineEditElements );
   myFilterDlg->SetSelection();
   myFilterDlg->SetMesh( myMeshes[0] );
   myFilterDlg->SetSourceWg( LineEditElements );
@@ -1147,9 +1158,10 @@ bool SMESHGUI_TranslationDlg::isValid()
 //=================================================================================
 void SMESHGUI_TranslationDlg::onDisplaySimulation( bool toDisplayPreview )
 {
 //=================================================================================
 void SMESHGUI_TranslationDlg::onDisplaySimulation( bool toDisplayPreview )
 {
-  if (myPreviewCheckBox->isChecked() && toDisplayPreview) {
-
-    if (isValid() && myNbOkElements) {
+  if (myPreviewCheckBox->isChecked() && toDisplayPreview)
+  {
+    if (isValid() && myNbOkElements)
+    {
       QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
 
       SMESH::long_array_var anElementsId = new SMESH::long_array;
       QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
 
       SMESH::long_array_var anElementsId = new SMESH::long_array;