Salome HOME
0019050 Test integration
authordmv <dmv@opencascade.com>
Fri, 5 Sep 2008 07:46:10 +0000 (07:46 +0000)
committerdmv <dmv@opencascade.com>
Fri, 5 Sep 2008 07:46:10 +0000 (07:46 +0000)
src/BasicGUI/BasicGUI_LineDlg.cxx
src/OperationGUI/OperationGUI_PartitionDlg.cxx

index b36f3379fefeb293a6550d1bc6dba885e73c607e..63c938cb9f95c0118054ed88bb66b2e93985cacc 100644 (file)
@@ -75,6 +75,8 @@ BasicGUI_LineDlg::BasicGUI_LineDlg( GeometryGUI* theGeometryGUI, QWidget* parent
   GroupPoints->PushButton2->setIcon( image1 );
   GroupPoints->LineEdit1->setReadOnly( true );
   GroupPoints->LineEdit2->setReadOnly( true );
+  GroupPoints->LineEdit1->setEnabled( true );
+  GroupPoints->LineEdit2->setEnabled( false );
 
   GroupFaces = new DlgRef_2Sel( centralWidget() );
   GroupFaces->GroupBox1->setTitle( tr( "GEOM_FACES" ) );
@@ -84,6 +86,8 @@ BasicGUI_LineDlg::BasicGUI_LineDlg( GeometryGUI* theGeometryGUI, QWidget* parent
   GroupFaces->PushButton2->setIcon( image1 );
   GroupFaces->LineEdit1->setReadOnly( true );
   GroupFaces->LineEdit2->setReadOnly( true );
+  GroupFaces->LineEdit1->setEnabled( true );
+  GroupFaces->LineEdit2->setEnabled( false );
 
   QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
   layout->setMargin( 0 ); layout->setSpacing( 6 );
@@ -195,6 +199,8 @@ void BasicGUI_LineDlg::ConstructorsClicked( int constructorId )
       myPoint2 = GEOM::GEOM_Object::_nil();
       GroupPoints->PushButton1->setDown(true);
       GroupPoints->PushButton2->setDown(false);
+      GroupPoints->LineEdit1->setEnabled(true);
+      GroupPoints->LineEdit2->setEnabled(false);
       GroupPoints->show();
       GroupFaces->hide();
       break;
@@ -210,6 +216,8 @@ void BasicGUI_LineDlg::ConstructorsClicked( int constructorId )
       myFace2 = GEOM::GEOM_Object::_nil();
       GroupFaces->PushButton1->setDown(true);
       GroupFaces->PushButton2->setDown(false);
+      GroupFaces->LineEdit1->setEnabled(true);
+      GroupFaces->LineEdit2->setEnabled(false);
       GroupPoints->hide();
       GroupFaces->show();
       break;
@@ -244,14 +252,13 @@ void BasicGUI_LineDlg::SelectionIntoArgument()
   GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes );
   if ( !CORBA::is_nil( aSelectedObject ) && aRes ) {
     QString aName = GEOMBase::GetName( aSelectedObject );
+    TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
+    if ( myEditCurrentArgument == GroupFaces->LineEdit1 ||
+        myEditCurrentArgument == GroupFaces->LineEdit2 )
+      aNeedType = TopAbs_FACE;
     
     TopoDS_Shape aShape;
     if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
-      TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
-      if ( myEditCurrentArgument == GroupFaces->LineEdit1 ||
-          myEditCurrentArgument == GroupFaces->LineEdit2 )
-        aNeedType = TopAbs_FACE;
-
       LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
       TColStd_IndexedMapOfInteger aMap;
       aSelMgr->GetIndexes( firstIObject(), aMap );
@@ -283,24 +290,31 @@ void BasicGUI_LineDlg::SelectionIntoArgument()
 
     myEditCurrentArgument->setText( aName );
 
+    if (!aSelectedObject->_is_nil()) { // clear selection if something selected
+      globalSelection();
+      localSelection( GEOM::GEOM_Object::_nil(), aNeedType );      
+    }
+
     if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
       myPoint1 = aSelectedObject;
-      if ( !myPoint1->_is_nil() && myPoint2->_is_nil() ) {
-       globalSelection(); // close local selection to clear it
-       localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
-       GroupPoints->PushButton2->click();      
-      }
+      if ( !myPoint1->_is_nil() && myPoint2->_is_nil() )
+       GroupPoints->PushButton2->click();
     }
     else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) {
       myPoint2 = aSelectedObject;
-      if ( !myPoint2->_is_nil() && myPoint1->_is_nil() ) {
-       globalSelection(); // close local selection to clear it
-       localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
-       GroupPoints->PushButton1->click();      
-      }
+      if ( !myPoint2->_is_nil() && myPoint1->_is_nil() )
+       GroupPoints->PushButton1->click();
+    }
+    else if ( myEditCurrentArgument == GroupFaces->LineEdit1 ) {
+      myFace1 = aSelectedObject;
+      if ( !myFace1->_is_nil() && myFace2->_is_nil() )
+       GroupFaces->PushButton2->click();
+    }
+    else if ( myEditCurrentArgument == GroupFaces->LineEdit2 ) {
+      myFace2 = aSelectedObject;
+      if ( !myFace2->_is_nil() && myFace1->_is_nil() )
+       GroupFaces->PushButton1->click();      
     }
-    else if ( myEditCurrentArgument == GroupFaces->LineEdit1 )  myFace1 = aSelectedObject;
-    else if ( myEditCurrentArgument == GroupFaces->LineEdit2 )  myFace2 = aSelectedObject;
   }
   
   displayPreview();
@@ -315,24 +329,36 @@ void BasicGUI_LineDlg::SetEditCurrentArgument()
 {
   if ( IObjectCount() != 0 ) {
     globalSelection(); // close local selection to clear it
-    localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+    TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
+    if ( myEditCurrentArgument == GroupFaces->LineEdit1 || myEditCurrentArgument == GroupFaces->LineEdit2 )
+      aNeedType = TopAbs_FACE;
+    localSelection( GEOM::GEOM_Object::_nil(), aNeedType );
   }
+
   QPushButton* send = (QPushButton*)sender();
   if ( send == GroupPoints->PushButton1 ) {
     myEditCurrentArgument = GroupPoints->LineEdit1;
     GroupPoints->PushButton2->setDown(false);
+    GroupPoints->LineEdit1->setEnabled(true);
+    GroupPoints->LineEdit2->setEnabled(false);
   }
   else if ( send == GroupPoints->PushButton2 ) {
     myEditCurrentArgument = GroupPoints->LineEdit2;
     GroupPoints->PushButton1->setDown(false);
+    GroupPoints->LineEdit1->setEnabled(false);
+    GroupPoints->LineEdit2->setEnabled(true);
   }
   else if ( send == GroupFaces->PushButton1 ) {
     myEditCurrentArgument = GroupFaces->LineEdit1;
     GroupFaces->PushButton2->setDown(false);
+    GroupFaces->LineEdit1->setEnabled(true);
+    GroupFaces->LineEdit2->setEnabled(false);
   }
   else if ( send == GroupFaces->PushButton2 ) {
     myEditCurrentArgument = GroupFaces->LineEdit2;
     GroupFaces->PushButton1->setDown(false);
+    GroupFaces->LineEdit1->setEnabled(false);
+    GroupFaces->LineEdit2->setEnabled(true);
   }
   myEditCurrentArgument->setFocus();
   //  SelectionIntoArgument();
index a84730d6fa453685b76e2800dac1b0a35045b32b..6c92e41a7a4584358c92921674f5fca7c59c1432 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() );
@@ -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;
   } 
 
@@ -270,10 +279,17 @@ 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 ) {
     myEditCurrentArgument = GroupPoints->LineEdit2;
+    GroupPoints->PushButton1->setDown(false);
+    GroupPoints->LineEdit1->setEnabled(false);
+    GroupPoints->LineEdit2->setEnabled(true);
     if ( getConstructorId() == 1 )
       globalSelection( GEOM_PLANE  );
   }
@@ -282,6 +298,7 @@ void OperationGUI_PartitionDlg::SetEditCurrentArgument()
       
   myEditCurrentArgument->setFocus();
   SelectionIntoArgument();
+  send->setDown(true);
 }