]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
IPAL 18079
authordmv <dmv@opencascade.com>
Mon, 11 Feb 2008 08:41:26 +0000 (08:41 +0000)
committerdmv <dmv@opencascade.com>
Mon, 11 Feb 2008 08:41:26 +0000 (08:41 +0000)
src/RepairGUI/RepairGUI_GlueDlg.cxx

index fbeac2c3b1a96aa41d2ff2f6ddfe0dea6dae597a..d723e1e80329e4154dc5183aecfc535f49586b11 100644 (file)
@@ -174,7 +174,7 @@ void RepairGUI_GlueDlg::Init()
   connect( mySubShapesChk, SIGNAL( stateChanged( int ) ), this, SLOT( onSubShapesChk() ) );
 
   connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 
-          SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()) );
+          SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()) );
 
   connect(myDetectBtn, SIGNAL(clicked()), this, SLOT(onDetect()));
 
@@ -240,8 +240,8 @@ void RepairGUI_GlueDlg::ConstructorsClicked( int constructorId )
 
   myEditCurrentArgument->setFocus();
 
-  connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 
-          SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+  connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
+         SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
 
   qApp->processEvents();
   updateGeometry();
@@ -294,8 +294,10 @@ bool RepairGUI_GlueDlg::ClickOnApply()
 //=================================================================================
 void RepairGUI_GlueDlg::SelectionIntoArgument()
 {
-  if ( mySubShapesChk->isChecked() &&  getConstructorId() == 1 )
+  if ( mySubShapesChk->isChecked() &&  getConstructorId() == 1 ) {
+    updateButtonState();
     return;
+  }
   
   erasePreview();
   myEditCurrentArgument->setText("");
@@ -350,7 +352,7 @@ void RepairGUI_GlueDlg::LineEditReturnPressed()
 void RepairGUI_GlueDlg::ActivateThisDialog()
 {
   GEOMBase_Skeleton::ActivateThisDialog();
-  connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 
+  connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
          SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
 
   //GroupPoints->LineEdit1->setText("");
@@ -651,6 +653,8 @@ void RepairGUI_GlueDlg::onDetect()
     msg = tr( "THERE_ARE_NO_FACES_FOR_GLUING" );
   }
   
+  connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
+          SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()) ) ;
   SUIT_MessageBox::info1( this, tr( "GEOM_FREE_BOUNDS_TLT" ), msg, "Close" );
   updateButtonState();
   activateSelection();
@@ -667,15 +671,15 @@ void RepairGUI_GlueDlg::activateSelection()
   int anId = getConstructorId();
   if ( anId == 0 )  // Case of whole gluing
   {
-    disconnect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 
-               SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()) ) ;
+    disconnect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
+               SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()) ) ;
     
     globalSelection( GEOM_ALLSHAPES );
     if (myObject->_is_nil()) 
       SelectionIntoArgument();
 
-    connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 
-             SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()) ) ;
+    connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
+            SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()) ) ;
   } 
   else // Second case of gluing
   {
@@ -684,10 +688,13 @@ void RepairGUI_GlueDlg::activateSelection()
     else 
     {
       displayPreview( true, false, false, 2/*line width*/, 1/*display mode*/, Quantity_NOC_RED );
+     disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
+               SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()) ) ;
       globalSelection( GEOM_PREVIEW );
-    }
+      connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
+              SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()) ) ;
+    } 
   }
-  
   updateViewer();
 }
 
@@ -706,9 +713,13 @@ void RepairGUI_GlueDlg::updateButtonState()
   }
   else
   {
+    bool wasSelected = false;
+    SALOME_ListIteratorOfListIO it ( selectedIO() );
+    if (it.More() > 0)
+      wasSelected = true;
     bool wasDetected = myTmpObjs.size() ? true : false;
-    buttonOk->setEnabled( hasMainObj && wasDetected );
-    buttonApply->setEnabled( hasMainObj && wasDetected );
+    buttonOk->setEnabled( hasMainObj && wasDetected && wasSelected);
+    buttonApply->setEnabled( hasMainObj && wasDetected && wasSelected);
     mySubShapesChk->setEnabled( hasMainObj && wasDetected );
     myDetectBtn->setEnabled( hasMainObj );
     if ( !hasMainObj || !wasDetected )