Salome HOME
Additional minor fix of issue 0017431: unset the MODAL behavior for the 'Basic Proper...
[modules/geom.git] / src / OperationGUI / OperationGUI_PartitionDlg.cxx
index a729d4dfcd4d8528ca40bcf03932675bbab9244b..9c787d2cef546053ee9f21e21665a5b2a9b1fd78 100644 (file)
@@ -71,6 +71,8 @@ OperationGUI_PartitionDlg::OperationGUI_PartitionDlg( GeometryGUI* theGeometryGU
   GroupPoints->PushButton2->setIcon( image2 );
   GroupPoints->LineEdit1->setReadOnly( true );
   GroupPoints->LineEdit2->setReadOnly( true );
+  GroupPoints->LineEdit1->setEnabled(true);
+  GroupPoints->LineEdit2->setEnabled(false);
   GroupPoints->CheckButton1->setText( tr( "GEOM_KEEP_NONLIMIT_SHAPES" ) );
 
   QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
@@ -119,6 +121,8 @@ void OperationGUI_PartitionDlg::Init()
   GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_VERTEX" ) );
   GroupPoints->CheckButton1->setChecked( false );
   
+  mainFrame()->GroupBoxPublish->show();
+
   /* signals and slots connections */
   connect( buttonOk(),    SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
   connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
@@ -132,8 +136,6 @@ void OperationGUI_PartitionDlg::Init()
   connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
   
   connect( GroupPoints->ComboBox1, SIGNAL( activated( int ) ), this, SLOT( ComboTextChanged() ) );
-  
-  connect( GroupPoints->CheckButton1, SIGNAL( stateChanged( int ) ), this, SLOT( ReverseSense( int ) ) );
 
   connect( myGeomGUI->getApp()->selectionMgr(),
           SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
@@ -141,6 +143,7 @@ void OperationGUI_PartitionDlg::Init()
   initName( tr( "GEOM_PARTITION" ) );
 
   ConstructorsClicked( 0 );
+  GroupPoints->PushButton1->click();
 }
 
 
@@ -167,6 +170,10 @@ void OperationGUI_PartitionDlg::ConstructorsClicked( int constructorId )
     GroupPoints->ComboBox1->show();
     GroupPoints->ComboBox1->setCurrentIndex( 0 );
     GroupPoints->CheckButton1->show();
+    GroupPoints->PushButton1->setDown( true );
+    GroupPoints->PushButton2->setDown( false );
+    GroupPoints->LineEdit1->setEnabled(true);
+    GroupPoints->LineEdit2->setEnabled(false);
     break;
   case 1: /*Half-space partition */
     GroupPoints->GroupBox1->setTitle( tr( "GEOM_PARTITION_HALFSPACE" ) );
@@ -174,6 +181,8 @@ void OperationGUI_PartitionDlg::ConstructorsClicked( int constructorId )
     GroupPoints->ComboBox1->hide();
     GroupPoints->TextLabel2->setText( tr( "GEOM_PLANE" ) );
     GroupPoints->CheckButton1->hide();
+    GroupPoints->PushButton1->setDown( true );
+    GroupPoints->LineEdit1->setEnabled(true);
     break;
   } 
 
@@ -226,7 +235,11 @@ void OperationGUI_PartitionDlg::SelectionIntoArgument()
   myEditCurrentArgument->setText( "" );
   QString aString = "";
   
-  int nbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aString, true );
+  LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+  SALOME_ListIO aSelList;
+  aSelMgr->selectedObjects(aSelList);
+
+  int nbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aString, true);
     
   if ( nbSel < 1 ) {
     if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
@@ -239,7 +252,7 @@ void OperationGUI_PartitionDlg::SelectionIntoArgument()
   
   // One and only one plane can be selected
   
-  if ( getConstructorId() == 1 && 
+  if ( getConstructorId() == 1 &&
        myEditCurrentArgument == GroupPoints->LineEdit2 && 
        nbSel != 1 ) {
     myListTools.length( 0 );
@@ -247,13 +260,13 @@ void OperationGUI_PartitionDlg::SelectionIntoArgument()
   }
   
   if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
-    GEOMBase::ConvertListOfIOInListOfGO( selectedIO(), myListShapes, true );
+    GEOMBase::ConvertListOfIOInListOfGO(aSelList, myListShapes, true);
     myListMaterials.length( 0 );
     if ( !myListShapes.length() )
       return;
   }
   else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) {
-    GEOMBase::ConvertListOfIOInListOfGO( selectedIO(), myListTools, true );
+    GEOMBase::ConvertListOfIOInListOfGO(aSelList, myListTools, true);
     if ( !myListTools.length() )
       return;
   }
@@ -270,10 +283,18 @@ void OperationGUI_PartitionDlg::SetEditCurrentArgument()
 {
   QPushButton* send = (QPushButton*)sender();
   
-  if ( send == GroupPoints->PushButton1 ) 
+  if ( send == GroupPoints->PushButton1 ) {
     myEditCurrentArgument = GroupPoints->LineEdit1;
+    GroupPoints->PushButton2->setDown(false);
+    GroupPoints->LineEdit1->setEnabled(true);
+    GroupPoints->LineEdit2->setEnabled(false);
+  }
   else if ( send == GroupPoints->PushButton2 ) {
+    myGeomGUI->getApp()->selectionMgr()->clearSelected(); //clear prewious selection
     myEditCurrentArgument = GroupPoints->LineEdit2;
+    GroupPoints->PushButton1->setDown(false);
+    GroupPoints->LineEdit1->setEnabled(false);
+    GroupPoints->LineEdit2->setEnabled(true);
     if ( getConstructorId() == 1 )
       globalSelection( GEOM_PLANE  );
   }
@@ -282,6 +303,7 @@ void OperationGUI_PartitionDlg::SetEditCurrentArgument()
       
   myEditCurrentArgument->setFocus();
   SelectionIntoArgument();
+  send->setDown(true);
 }
 
 
@@ -388,6 +410,20 @@ bool OperationGUI_PartitionDlg::execute( ObjectList& objects )
   return res;
 }
 
+//=================================================================================
+// function : restoreSubShapes
+// purpose  :
+//=================================================================================
+void OperationGUI_PartitionDlg::restoreSubShapes( SALOMEDS::Study_ptr   theStudy,
+                                                  SALOMEDS::SObject_ptr theSObject )
+{
+  if ( mainFrame()->CheckBoxRestoreSS->isChecked() ) {
+    // empty list of arguments means that all arguments should be restored
+    getGeomEngine()->RestoreSubShapesSO( theStudy, theSObject, GEOM::ListOfGO(),
+                                        /*theFindMethod=*/GEOM::FSM_GetInPlaceByHistory,
+                                        /*theInheritFirstArg=*/myListShapes.length() == 1 ); // ? false
+  }
+}
 
 //=======================================================================
 //function : ComboTextChanged
@@ -404,7 +440,6 @@ void OperationGUI_PartitionDlg::ComboTextChanged()
   //GroupPoints->PushButton4->setEnabled(IsEnabled);
 }
 
-
 //=================================================================================
 // function : GetLimit()
 // purpose  :