From 789adf898b7d2986a3211500fd8821f34d9ecec8 Mon Sep 17 00:00:00 2001 From: dmv Date: Fri, 5 Sep 2008 14:01:48 +0000 Subject: [PATCH] 0019050: EDF 521 (For GEOM/BasicGUI): Improve selection process in the dialogs --- src/BasicGUI/BasicGUI_ArcDlg.cxx | 140 ++++++++++++--- src/BasicGUI/BasicGUI_CircleDlg.cxx | 164 +++++++++++++++--- src/BasicGUI/BasicGUI_CurveDlg.cxx | 1 + src/BasicGUI/BasicGUI_EllipseDlg.cxx | 64 +++++-- src/BasicGUI/BasicGUI_LineDlg.cxx | 15 +- src/BasicGUI/BasicGUI_MarkerDlg.cxx | 44 ++++- src/BasicGUI/BasicGUI_PlaneDlg.cxx | 126 +++++++++++--- src/BasicGUI/BasicGUI_PointDlg.cxx | 32 +++- src/BasicGUI/BasicGUI_VectorDlg.cxx | 46 ++++- src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx | 53 ++++-- .../OperationGUI_PartitionDlg.cxx | 1 + src/PrimitiveGUI/PrimitiveGUI_FaceDlg.cxx | 2 +- 12 files changed, 562 insertions(+), 126 deletions(-) diff --git a/src/BasicGUI/BasicGUI_ArcDlg.cxx b/src/BasicGUI/BasicGUI_ArcDlg.cxx index 4446ed790..8ca36253b 100644 --- a/src/BasicGUI/BasicGUI_ArcDlg.cxx +++ b/src/BasicGUI/BasicGUI_ArcDlg.cxx @@ -79,6 +79,10 @@ BasicGUI_ArcDlg::BasicGUI_ArcDlg( GeometryGUI* theGeometryGUI, QWidget* parent, Group3Pnts->LineEdit2->setReadOnly( true ); Group3Pnts->LineEdit3->setReadOnly( true ); + Group3Pnts->LineEdit1->setEnabled(true); + Group3Pnts->LineEdit2->setEnabled(false); + Group3Pnts->LineEdit3->setEnabled(false); + Group3Pnts->PushButton1->setIcon(image2); Group3Pnts->PushButton2->setIcon(image2); Group3Pnts->PushButton3->setIcon(image2); @@ -95,6 +99,10 @@ BasicGUI_ArcDlg::BasicGUI_ArcDlg( GeometryGUI* theGeometryGUI, QWidget* parent, Group3Pnts2->LineEdit2->setReadOnly( true ); Group3Pnts2->LineEdit3->setReadOnly( true ); + Group3Pnts2->LineEdit1->setEnabled(true); + Group3Pnts2->LineEdit2->setEnabled(false); + Group3Pnts2->LineEdit3->setEnabled(false); + Group3Pnts2->PushButton1->setIcon( image2 ); Group3Pnts2->PushButton2->setIcon( image2 ); Group3Pnts2->PushButton3->setIcon( image2 ); @@ -132,6 +140,7 @@ void BasicGUI_ArcDlg::Init() myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil(); Group3Pnts2->CheckButton1->setChecked( false ); + Group3Pnts->PushButton1->setDown(true); /* signals and slots connections */ connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ); @@ -190,6 +199,7 @@ bool BasicGUI_ArcDlg::ClickOnApply() return false; initName(); + ConstructorsClicked( getConstructorId() ); return true; } @@ -260,16 +270,45 @@ void BasicGUI_ArcDlg::SelectionIntoArgument() myEditCurrentArgument->setText(aName); + if (!aSelectedObject->_is_nil()) { // clear selection if something selected + globalSelection(); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); + } + switch ( getConstructorId() ) { case 0: - if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = aSelectedObject; - else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2 = aSelectedObject; - else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3 = aSelectedObject; + if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) { + myPoint1 = aSelectedObject; + if ( !myPoint1->_is_nil() && myPoint2->_is_nil() ) + Group3Pnts->PushButton2->click(); + } + else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) { + myPoint2 = aSelectedObject; + if ( !myPoint2->_is_nil() && myPoint3->_is_nil() ) + Group3Pnts->PushButton3->click(); + } + else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) { + myPoint3 = aSelectedObject; + if ( !myPoint3->_is_nil() && myPoint1->_is_nil() ) + Group3Pnts->PushButton1->click(); + } break; case 1: - if ( myEditCurrentArgument == Group3Pnts2->LineEdit1 ) myPoint1 = aSelectedObject; - else if ( myEditCurrentArgument == Group3Pnts2->LineEdit2 ) myPoint2 = aSelectedObject; - else if ( myEditCurrentArgument == Group3Pnts2->LineEdit3 ) myPoint3 = aSelectedObject; + if ( myEditCurrentArgument == Group3Pnts2->LineEdit1 ) { + myPoint1 = aSelectedObject; + if ( !myPoint1->_is_nil() && myPoint2->_is_nil() ) + Group3Pnts2->PushButton2->click(); + } + else if ( myEditCurrentArgument == Group3Pnts2->LineEdit2 ) { + myPoint2 = aSelectedObject; + if ( !myPoint2->_is_nil() && myPoint3->_is_nil() ) + Group3Pnts2->PushButton3->click(); + } + else if ( myEditCurrentArgument == Group3Pnts2->LineEdit3 ) { + myPoint3 = aSelectedObject; + if ( !myPoint3->_is_nil() && myPoint1->_is_nil() ) + Group3Pnts2->PushButton1->click(); + } break; } } @@ -284,21 +323,68 @@ void BasicGUI_ArcDlg::SelectionIntoArgument() //================================================================================= void BasicGUI_ArcDlg::SetEditCurrentArgument() { + globalSelection(); // close local selection to clear it + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); + QPushButton* send = (QPushButton*)sender(); switch ( getConstructorId() ) { case 0: - if ( send == Group3Pnts->PushButton1 ) myEditCurrentArgument = Group3Pnts->LineEdit1; - else if ( send == Group3Pnts->PushButton2 ) myEditCurrentArgument = Group3Pnts->LineEdit2; - else if ( send == Group3Pnts->PushButton3 ) myEditCurrentArgument = Group3Pnts->LineEdit3; + if ( send == Group3Pnts->PushButton1 ) { + myEditCurrentArgument = Group3Pnts->LineEdit1; + Group3Pnts->PushButton2->setDown(false); + Group3Pnts->PushButton3->setDown(false); + Group3Pnts->LineEdit1->setEnabled(true); + Group3Pnts->LineEdit2->setEnabled(false); + Group3Pnts->LineEdit3->setEnabled(false); + } + else if ( send == Group3Pnts->PushButton2 ) { + myEditCurrentArgument = Group3Pnts->LineEdit2; + Group3Pnts->PushButton1->setDown(false); + Group3Pnts->PushButton3->setDown(false); + Group3Pnts->LineEdit1->setEnabled(false); + Group3Pnts->LineEdit2->setEnabled(true); + Group3Pnts->LineEdit3->setEnabled(false); + } + else if ( send == Group3Pnts->PushButton3 ) { + myEditCurrentArgument = Group3Pnts->LineEdit3; + Group3Pnts->PushButton1->setDown(false); + Group3Pnts->PushButton2->setDown(false); + Group3Pnts->LineEdit1->setEnabled(false); + Group3Pnts->LineEdit2->setEnabled(false); + Group3Pnts->LineEdit3->setEnabled(true); + } break; case 1: - if ( send == Group3Pnts2->PushButton1 ) myEditCurrentArgument = Group3Pnts2->LineEdit1; - else if ( send == Group3Pnts2->PushButton2 ) myEditCurrentArgument = Group3Pnts2->LineEdit2; - else if ( send == Group3Pnts2->PushButton3 ) myEditCurrentArgument = Group3Pnts2->LineEdit3; + if ( send == Group3Pnts2->PushButton1 ) { + myEditCurrentArgument = Group3Pnts2->LineEdit1; + Group3Pnts2->PushButton2->setDown(false); + Group3Pnts2->PushButton3->setDown(false); + Group3Pnts2->LineEdit1->setEnabled(true); + Group3Pnts2->LineEdit2->setEnabled(false); + Group3Pnts2->LineEdit3->setEnabled(false); + } + else if ( send == Group3Pnts2->PushButton2 ) { + myEditCurrentArgument = Group3Pnts2->LineEdit2; + Group3Pnts2->PushButton1->setDown(false); + Group3Pnts2->PushButton3->setDown(false); + Group3Pnts2->LineEdit1->setEnabled(false); + Group3Pnts2->LineEdit2->setEnabled(true); + Group3Pnts2->LineEdit3->setEnabled(false); + } + else if ( send == Group3Pnts2->PushButton3 ) { + myEditCurrentArgument = Group3Pnts2->LineEdit3; + Group3Pnts2->PushButton1->setDown(false); + Group3Pnts2->PushButton2->setDown(false); + Group3Pnts2->LineEdit1->setEnabled(false); + Group3Pnts2->LineEdit2->setEnabled(false); + Group3Pnts2->LineEdit3->setEnabled(true); + } break; } myEditCurrentArgument->setFocus(); - SelectionIntoArgument(); + // SelectionIntoArgument(); + send->setDown(true); + displayPreview(); } @@ -439,10 +525,16 @@ void BasicGUI_ArcDlg::ConstructorsClicked( int constructorId ) Group3Pnts2->hide(); Group3Pnts->show(); - - Group3Pnts->LineEdit1->setText( Group3Pnts2->LineEdit1->text() ); - Group3Pnts->LineEdit2->setText( Group3Pnts2->LineEdit2->text() ); - Group3Pnts->LineEdit3->setText( Group3Pnts2->LineEdit3->text() ); + Group3Pnts->PushButton1->setDown(true); + Group3Pnts->PushButton2->setDown(false); + Group3Pnts->PushButton3->setDown(false); + Group3Pnts->LineEdit1->setText( "" ); + Group3Pnts->LineEdit2->setText( "" ); + Group3Pnts->LineEdit3->setText( "" ); + Group3Pnts->LineEdit1->setEnabled(true); + Group3Pnts->LineEdit2->setEnabled(false); + Group3Pnts->LineEdit3->setEnabled(false); + myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil(); myEditCurrentArgument = Group3Pnts->LineEdit1; break; @@ -454,10 +546,16 @@ void BasicGUI_ArcDlg::ConstructorsClicked( int constructorId ) Group3Pnts->hide(); Group3Pnts2->show(); - - Group3Pnts2->LineEdit1->setText( Group3Pnts->LineEdit1->text() ); - Group3Pnts2->LineEdit2->setText( Group3Pnts->LineEdit2->text() ); - Group3Pnts2->LineEdit3->setText( Group3Pnts->LineEdit3->text() ); + Group3Pnts2->PushButton1->setDown(true); + Group3Pnts2->PushButton2->setDown(false); + Group3Pnts2->PushButton3->setDown(false); + Group3Pnts2->LineEdit1->setText( "" ); + Group3Pnts2->LineEdit2->setText( "" ); + Group3Pnts2->LineEdit3->setText( "" ); + Group3Pnts2->LineEdit1->setEnabled(true); + Group3Pnts2->LineEdit2->setEnabled(false); + Group3Pnts2->LineEdit3->setEnabled(false); + myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil(); myEditCurrentArgument = Group3Pnts2->LineEdit1; break; diff --git a/src/BasicGUI/BasicGUI_CircleDlg.cxx b/src/BasicGUI/BasicGUI_CircleDlg.cxx index 23fc15a4d..4efa33edc 100644 --- a/src/BasicGUI/BasicGUI_CircleDlg.cxx +++ b/src/BasicGUI/BasicGUI_CircleDlg.cxx @@ -74,10 +74,14 @@ BasicGUI_CircleDlg::BasicGUI_CircleDlg( GeometryGUI* theGeometryGUI, QWidget* pa GroupPntVecR->TextLabel3->setText( tr( "GEOM_RADIUS" ) ); GroupPntVecR->PushButton1->setIcon( image1 ); GroupPntVecR->PushButton2->setIcon( image1 ); + GroupPntVecR->PushButton1->setDown( true ); GroupPntVecR->LineEdit1->setReadOnly( true ); GroupPntVecR->LineEdit2->setReadOnly( true ); + GroupPntVecR->LineEdit1->setEnabled( true ); + GroupPntVecR->LineEdit2->setEnabled( false ); + Group3Pnts = new DlgRef_3Sel( centralWidget() ); Group3Pnts->GroupBox1->setTitle( tr( "GEOM_3_POINTS" ) ); @@ -87,10 +91,14 @@ BasicGUI_CircleDlg::BasicGUI_CircleDlg( GeometryGUI* theGeometryGUI, QWidget* pa Group3Pnts->PushButton1->setIcon( image1 ); Group3Pnts->PushButton2->setIcon( image1 ); Group3Pnts->PushButton3->setIcon( image1 ); + Group3Pnts->PushButton1->setDown( true ); Group3Pnts->LineEdit1->setReadOnly( true ); Group3Pnts->LineEdit2->setReadOnly( true ); Group3Pnts->LineEdit3->setReadOnly( true ); + Group3Pnts->LineEdit1->setEnabled( true ); + Group3Pnts->LineEdit2->setEnabled( false ); + Group3Pnts->LineEdit3->setEnabled( false ); GroupCenter2Pnts = new DlgRef_3Sel( centralWidget() ); GroupCenter2Pnts->GroupBox1->setTitle( tr( "GEOM_CENTER_2POINTS" ) ); @@ -100,11 +108,16 @@ BasicGUI_CircleDlg::BasicGUI_CircleDlg( GeometryGUI* theGeometryGUI, QWidget* pa GroupCenter2Pnts->PushButton1->setIcon( image1 ); GroupCenter2Pnts->PushButton2->setIcon( image1 ); GroupCenter2Pnts->PushButton3->setIcon( image1 ); + GroupCenter2Pnts->PushButton1->setDown( true ); GroupCenter2Pnts->LineEdit1->setReadOnly( true ); GroupCenter2Pnts->LineEdit2->setReadOnly( true ); GroupCenter2Pnts->LineEdit3->setReadOnly( true ); + GroupCenter2Pnts->LineEdit1->setEnabled( true ); + GroupCenter2Pnts->LineEdit2->setEnabled( false ); + GroupCenter2Pnts->LineEdit3->setEnabled( false ); + QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); layout->setMargin( 0 ); layout->setSpacing( 6 ); layout->addWidget( GroupPntVecR ); @@ -210,6 +223,10 @@ void BasicGUI_CircleDlg::ConstructorsClicked( int constructorId ) myEditCurrentArgument = GroupPntVecR->LineEdit1; GroupPntVecR->LineEdit1->setText( "" ); GroupPntVecR->LineEdit2->setText( "" ); + GroupPntVecR->PushButton1->setDown( true ); + GroupPntVecR->PushButton2->setDown( false ); + GroupPntVecR->LineEdit1->setEnabled( true ); + GroupPntVecR->LineEdit2->setEnabled( false ); break; } case 1: @@ -222,6 +239,12 @@ void BasicGUI_CircleDlg::ConstructorsClicked( int constructorId ) Group3Pnts->LineEdit1->setText( "" ); Group3Pnts->LineEdit2->setText( "" ); Group3Pnts->LineEdit3->setText( "" ); + Group3Pnts->PushButton1->setDown( true ); + Group3Pnts->PushButton2->setDown( false ); + Group3Pnts->PushButton3->setDown( false ); + Group3Pnts->LineEdit1->setEnabled( true ); + Group3Pnts->LineEdit2->setEnabled( false ); + Group3Pnts->LineEdit3->setEnabled( false ); break; } case 2: @@ -234,6 +257,12 @@ void BasicGUI_CircleDlg::ConstructorsClicked( int constructorId ) GroupCenter2Pnts->LineEdit1->setText( "" ); GroupCenter2Pnts->LineEdit2->setText( "" ); GroupCenter2Pnts->LineEdit3->setText( "" ); + GroupCenter2Pnts->PushButton1->setDown( true ); + GroupCenter2Pnts->PushButton2->setDown( false ); + GroupCenter2Pnts->PushButton3->setDown( false ); + GroupCenter2Pnts->LineEdit1->setEnabled( true ); + GroupCenter2Pnts->LineEdit2->setEnabled( false ); + GroupCenter2Pnts->LineEdit3->setEnabled( false ); break; } } @@ -308,13 +337,13 @@ void BasicGUI_CircleDlg::SelectionIntoArgument() if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { QString aName = GEOMBase::GetName( aSelectedObject ); + TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX; + if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 ) + aNeedType = TopAbs_EDGE; + // If selected Vertex or Edge on the some Shape Get selection Subshape TopoDS_Shape aShape; if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) { - TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX; - if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 ) - aNeedType = TopAbs_EDGE; - TColStd_IndexedMapOfInteger aMap; aSelMgr->GetIndexes(anIO, aMap); if ( aMap.Extent() == 1 ) { // Local Selection @@ -345,14 +374,51 @@ void BasicGUI_CircleDlg::SelectionIntoArgument() myEditCurrentArgument->setText( aName ); - if ( myEditCurrentArgument == GroupPntVecR->LineEdit1 ) myPoint = aSelectedObject; - else if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 ) myDir = aSelectedObject; - else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = aSelectedObject; - else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2 = aSelectedObject; - else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3 = aSelectedObject; - else if ( myEditCurrentArgument == GroupCenter2Pnts->LineEdit1 ) myPoint4 = aSelectedObject; - else if ( myEditCurrentArgument == GroupCenter2Pnts->LineEdit2 ) myPoint5 = aSelectedObject; - else if ( myEditCurrentArgument == GroupCenter2Pnts->LineEdit3 ) myPoint6 = aSelectedObject; + if (!aSelectedObject->_is_nil()) { // clear selection if something selected + globalSelection(); + localSelection( GEOM::GEOM_Object::_nil(), aNeedType ); + } + + if ( myEditCurrentArgument == GroupPntVecR->LineEdit1 ) { + myPoint = aSelectedObject; + if ( !myPoint->_is_nil() && myDir->_is_nil() ) + GroupPntVecR->PushButton2->click(); + } + else if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 ) { + myDir = aSelectedObject; + if ( !myDir->_is_nil() && myPoint->_is_nil() ) + GroupPntVecR->PushButton1->click(); + } + else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) { + myPoint1 = aSelectedObject; + if ( !myPoint1->_is_nil() && myPoint2->_is_nil() ) + Group3Pnts->PushButton2->click(); + } + else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) { + myPoint2 = aSelectedObject; + if ( !myPoint2->_is_nil() && myPoint3->_is_nil() ) + Group3Pnts->PushButton3->click(); + } + else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) { + myPoint3 = aSelectedObject; + if ( !myPoint3->_is_nil() && myPoint1->_is_nil() ) + Group3Pnts->PushButton1->click(); + } + else if ( myEditCurrentArgument == GroupCenter2Pnts->LineEdit1 ) { + myPoint4 = aSelectedObject; + if ( !myPoint4->_is_nil() && myPoint5->_is_nil() ) + GroupCenter2Pnts->PushButton2->click(); + } + else if ( myEditCurrentArgument == GroupCenter2Pnts->LineEdit2 ) { + myPoint5 = aSelectedObject; + if ( !myPoint5->_is_nil() && myPoint6->_is_nil() ) + GroupCenter2Pnts->PushButton3->click(); + } + else if ( myEditCurrentArgument == GroupCenter2Pnts->LineEdit3 ) { + myPoint6 = aSelectedObject; + if ( !myPoint6->_is_nil() && myPoint4->_is_nil() ) + GroupCenter2Pnts->PushButton1->click(); + } } displayPreview(); @@ -367,14 +433,67 @@ void BasicGUI_CircleDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - if ( send == GroupPntVecR->PushButton1 ) myEditCurrentArgument = GroupPntVecR->LineEdit1; - else if ( send == GroupPntVecR->PushButton2 ) myEditCurrentArgument = GroupPntVecR->LineEdit2; - else if ( send == Group3Pnts->PushButton1 ) myEditCurrentArgument = Group3Pnts->LineEdit1; - else if ( send == Group3Pnts->PushButton2 ) myEditCurrentArgument = Group3Pnts->LineEdit2; - else if ( send == Group3Pnts->PushButton3 ) myEditCurrentArgument = Group3Pnts->LineEdit3; - else if ( send == GroupCenter2Pnts->PushButton1 ) myEditCurrentArgument = GroupCenter2Pnts->LineEdit1; - else if ( send == GroupCenter2Pnts->PushButton2 ) myEditCurrentArgument = GroupCenter2Pnts->LineEdit2; - else if ( send == GroupCenter2Pnts->PushButton3 ) myEditCurrentArgument = GroupCenter2Pnts->LineEdit3; + if ( send == GroupPntVecR->PushButton1 ) { + myEditCurrentArgument = GroupPntVecR->LineEdit1; + GroupPntVecR->PushButton2->setDown(false); + GroupPntVecR->LineEdit1->setEnabled( true ); + GroupPntVecR->LineEdit2->setEnabled( false ); + } + else if ( send == GroupPntVecR->PushButton2 ) { + myEditCurrentArgument = GroupPntVecR->LineEdit2; + GroupPntVecR->PushButton1->setDown(false); + GroupPntVecR->LineEdit1->setEnabled( false ); + GroupPntVecR->LineEdit2->setEnabled( true ); + } + else if ( send == Group3Pnts->PushButton1 ) { + myEditCurrentArgument = Group3Pnts->LineEdit1; + Group3Pnts->PushButton2->setDown( false ); + Group3Pnts->PushButton3->setDown( false ); + Group3Pnts->LineEdit1->setEnabled( true ); + Group3Pnts->LineEdit2->setEnabled( false ); + Group3Pnts->LineEdit3->setEnabled( false ); + } + else if ( send == Group3Pnts->PushButton2 ) { + myEditCurrentArgument = Group3Pnts->LineEdit2; + Group3Pnts->PushButton1->setDown( false ); + Group3Pnts->PushButton3->setDown( false ); + Group3Pnts->LineEdit1->setEnabled( false ); + Group3Pnts->LineEdit2->setEnabled( true ); + Group3Pnts->LineEdit3->setEnabled( false ); + } + else if ( send == Group3Pnts->PushButton3 ) { + myEditCurrentArgument = Group3Pnts->LineEdit3; + Group3Pnts->PushButton1->setDown( false ); + Group3Pnts->PushButton2->setDown( false ); + Group3Pnts->LineEdit1->setEnabled( false ); + Group3Pnts->LineEdit2->setEnabled( false ); + Group3Pnts->LineEdit3->setEnabled( true ); + } + else if ( send == GroupCenter2Pnts->PushButton1 ) { + myEditCurrentArgument = GroupCenter2Pnts->LineEdit1; + GroupCenter2Pnts->PushButton2->setDown( false ); + GroupCenter2Pnts->PushButton3->setDown( false ); + GroupCenter2Pnts->LineEdit1->setEnabled( true ); + GroupCenter2Pnts->LineEdit2->setEnabled( false ); + GroupCenter2Pnts->LineEdit3->setEnabled( false ); + } + else if ( send == GroupCenter2Pnts->PushButton2 ) { + myEditCurrentArgument = GroupCenter2Pnts->LineEdit2; + GroupCenter2Pnts->PushButton1->setDown( false ); + GroupCenter2Pnts->PushButton3->setDown( false ); + GroupCenter2Pnts->LineEdit1->setEnabled( false ); + GroupCenter2Pnts->LineEdit2->setEnabled( true ); + GroupCenter2Pnts->LineEdit3->setEnabled( false ); + + } + else if ( send == GroupCenter2Pnts->PushButton3 ) { + myEditCurrentArgument = GroupCenter2Pnts->LineEdit3; + GroupCenter2Pnts->PushButton1->setDown( false ); + GroupCenter2Pnts->PushButton2->setDown( false ); + GroupCenter2Pnts->LineEdit1->setEnabled( false ); + GroupCenter2Pnts->LineEdit2->setEnabled( false ); + GroupCenter2Pnts->LineEdit3->setEnabled( true ); + } myEditCurrentArgument->setFocus(); @@ -388,7 +507,10 @@ void BasicGUI_CircleDlg::SetEditCurrentArgument() localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); } - SelectionIntoArgument(); + myEditCurrentArgument->setFocus(); + // SelectionIntoArgument(); + send->setDown(true); + displayPreview(); } //================================================================================= diff --git a/src/BasicGUI/BasicGUI_CurveDlg.cxx b/src/BasicGUI/BasicGUI_CurveDlg.cxx index a3e278ad1..aa1921875 100644 --- a/src/BasicGUI/BasicGUI_CurveDlg.cxx +++ b/src/BasicGUI/BasicGUI_CurveDlg.cxx @@ -73,6 +73,7 @@ BasicGUI_CurveDlg::BasicGUI_CurveDlg( GeometryGUI* theGeometryGUI, QWidget* pare GroupPoints->GroupBox1->setTitle( tr( "GEOM_NODES" ) ); GroupPoints->TextLabel1->setText( tr( "GEOM_POINTS" ) ); GroupPoints->PushButton1->setIcon( image1 ); + GroupPoints->PushButton1->setDown( true ); GroupPoints->LineEdit1->setReadOnly( true ); diff --git a/src/BasicGUI/BasicGUI_EllipseDlg.cxx b/src/BasicGUI/BasicGUI_EllipseDlg.cxx index 519e088a3..36af5ff21 100644 --- a/src/BasicGUI/BasicGUI_EllipseDlg.cxx +++ b/src/BasicGUI/BasicGUI_EllipseDlg.cxx @@ -78,6 +78,8 @@ BasicGUI_EllipseDlg::BasicGUI_EllipseDlg( GeometryGUI* theGeometryGUI, QWidget* GroupPoints->LineEdit1->setReadOnly( true ); GroupPoints->LineEdit2->setReadOnly( true ); + GroupPoints->LineEdit1->setEnabled( true ); + GroupPoints->LineEdit2->setEnabled( false ); QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); layout->setMargin( 0 ); layout->setSpacing( 6 ); @@ -109,6 +111,7 @@ void BasicGUI_EllipseDlg::Init() myEditCurrentArgument = GroupPoints->LineEdit1; globalSelection(); // close local contexts, if any localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); + GroupPoints->PushButton1->setDown(true); myPoint = myDir = GEOM::GEOM_Object::_nil(); @@ -187,8 +190,12 @@ bool BasicGUI_EllipseDlg::ClickOnApply() myPoint = myDir = GEOM::GEOM_Object::_nil(); GroupPoints->LineEdit1->setText( "" ); GroupPoints->LineEdit2->setText( "" ); + GroupPoints->PushButton1->setDown(true); + GroupPoints->PushButton2->setDown(false); + GroupPoints->LineEdit1->setEnabled( true ); + GroupPoints->LineEdit2->setEnabled( false ); myEditCurrentArgument = GroupPoints->LineEdit1; - //globalSelection(GEOM_POINT); + globalSelection(); // close local contexts, if any localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); displayPreview(); @@ -218,12 +225,12 @@ void BasicGUI_EllipseDlg::SelectionIntoArgument() // Get Selected object if selected subshape TopoDS_Shape aShape; + + TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX; + if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) + aNeedType = TopAbs_EDGE; if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) { - TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX; - if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) - aNeedType = TopAbs_EDGE; - LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); TColStd_IndexedMapOfInteger aMap; aSelMgr->GetIndexes( anIO, aMap ); @@ -255,8 +262,21 @@ void BasicGUI_EllipseDlg::SelectionIntoArgument() myEditCurrentArgument->setText( aName ); - if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint = aSelectedObject; - else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myDir = aSelectedObject; + if (!aSelectedObject->_is_nil()) { // clear selection if something selected + globalSelection(); + localSelection( GEOM::GEOM_Object::_nil(), aNeedType ); + } + + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) { + myPoint = aSelectedObject; + if ( !myPoint->_is_nil() && myDir->_is_nil() ) + GroupPoints->PushButton2->click(); + } + else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) { + myDir = aSelectedObject; + if ( !myDir->_is_nil() && myPoint->_is_nil() ) + GroupPoints->PushButton1->click(); + } } displayPreview(); @@ -270,18 +290,30 @@ void BasicGUI_EllipseDlg::SelectionIntoArgument() void BasicGUI_EllipseDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - globalSelection( GEOM_POINT ); - if ( send == GroupPoints->PushButton1 ) myEditCurrentArgument = GroupPoints->LineEdit1; - else if ( send == GroupPoints->PushButton2 ) myEditCurrentArgument = GroupPoints->LineEdit2; - - myEditCurrentArgument->setFocus(); + 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 ); + } + globalSelection(); // close local contexts, if any + TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX; if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); - else - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); - SelectionIntoArgument(); + aNeedType = TopAbs_EDGE; + localSelection( GEOM::GEOM_Object::_nil(), aNeedType ); + + myEditCurrentArgument->setFocus(); + //SelectionIntoArgument(); + send->setDown(true); + displayPreview(); } //================================================================================= diff --git a/src/BasicGUI/BasicGUI_LineDlg.cxx b/src/BasicGUI/BasicGUI_LineDlg.cxx index 63c938cb9..489f8ee25 100644 --- a/src/BasicGUI/BasicGUI_LineDlg.cxx +++ b/src/BasicGUI/BasicGUI_LineDlg.cxx @@ -327,14 +327,6 @@ void BasicGUI_LineDlg::SelectionIntoArgument() //================================================================================= void BasicGUI_LineDlg::SetEditCurrentArgument() { - if ( IObjectCount() != 0 ) { - globalSelection(); // close local selection to clear it - 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; @@ -360,6 +352,13 @@ void BasicGUI_LineDlg::SetEditCurrentArgument() GroupFaces->LineEdit1->setEnabled(false); GroupFaces->LineEdit2->setEnabled(true); } + + globalSelection(); // close local selection to clear it + TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX; + if ( myEditCurrentArgument == GroupFaces->LineEdit1 || myEditCurrentArgument == GroupFaces->LineEdit2 ) + aNeedType = TopAbs_FACE; + localSelection( GEOM::GEOM_Object::_nil(), aNeedType ); + myEditCurrentArgument->setFocus(); // SelectionIntoArgument(); send->setDown(true); diff --git a/src/BasicGUI/BasicGUI_MarkerDlg.cxx b/src/BasicGUI/BasicGUI_MarkerDlg.cxx index 3f0f2fc24..098e39dc0 100644 --- a/src/BasicGUI/BasicGUI_MarkerDlg.cxx +++ b/src/BasicGUI/BasicGUI_MarkerDlg.cxx @@ -76,6 +76,7 @@ BasicGUI_MarkerDlg::BasicGUI_MarkerDlg( GeometryGUI* theGeometryGUI, QWidget* th Group1->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) ); Group1->TextLabel1->setText( tr( "GEOM_OBJECT" ) ); Group1->PushButton1->setIcon( iconSelect ); + Group1->PushButton1->setDown( true ); Group2 = new DlgRef_3Sel( centralWidget() ); @@ -86,6 +87,7 @@ BasicGUI_MarkerDlg::BasicGUI_MarkerDlg( GeometryGUI* theGeometryGUI, QWidget* th Group2->PushButton1->setIcon( iconSelect ); Group2->PushButton2->setIcon( iconSelect ); Group2->PushButton3->setIcon( iconSelect ); + Group2->PushButton1->setDown( true ); aMainGrp = new QFrame( centralWidget() ); aMainGrp->setFrameStyle( QFrame::NoFrame | QFrame::Plain ); @@ -172,6 +174,9 @@ void BasicGUI_MarkerDlg::Init() Group2->LineEdit1->setReadOnly( true ); Group2->LineEdit2->setReadOnly( true ); Group2->LineEdit3->setReadOnly( true ); + Group2->LineEdit1->setEnabled( true ); + Group2->LineEdit2->setEnabled( false ); + Group2->LineEdit3->setEnabled( false ); connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) ); @@ -267,7 +272,7 @@ void BasicGUI_MarkerDlg::ConstructorsClicked( int constructorId ) aMainGrp->hide(); Group2->hide(); Group1->show(); - + Group1->PushButton1->setDown( true ); globalSelection( GEOM_ALLGEOM ); myEditCurrentArgument = Group1->LineEdit1; Group1->LineEdit1->setText( "" ); @@ -276,15 +281,20 @@ void BasicGUI_MarkerDlg::ConstructorsClicked( int constructorId ) case 2: { aMainGrp->hide(); - Group1->show(); + Group1->hide(); Group2->show(); - + Group2->PushButton1->setDown( true ); + Group2->PushButton2->setDown( false ); + Group2->PushButton3->setDown( false ); globalSelection(); // close local contexts, if any localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); myEditCurrentArgument = Group2->LineEdit1; Group2->LineEdit1->setText( "" ); Group2->LineEdit2->setText( "" ); Group2->LineEdit3->setText( "" ); + Group2->LineEdit1->setEnabled( true ); + Group2->LineEdit2->setEnabled( false ); + Group2->LineEdit3->setEnabled( false ); break; } } @@ -477,6 +487,8 @@ void BasicGUI_MarkerDlg::onSelectionDone() myData[ Y ]->setValue( aPnt.Y() ); myData[ Z ]->setValue( aPnt.Z() ); myEditCurrentArgument->setText( aName ); + if (Group2->LineEdit2->text() == "") + Group2->PushButton2->click(); } else { myData[ X ]->setValue( 0 ); @@ -494,6 +506,8 @@ void BasicGUI_MarkerDlg::onSelectionDone() myData[ DY1 ]->setValue( aDir.Y() ); myData[ DZ1 ]->setValue( aDir.Z() ); myEditCurrentArgument->setText( aName ); + if (Group2->LineEdit3->text() == "") + Group2->PushButton3->click(); } else { myData[ DX1 ]->setValue( 0 ); @@ -511,6 +525,8 @@ void BasicGUI_MarkerDlg::onSelectionDone() myData[ DY2 ]->setValue( aDir.Y() ); myData[ DZ2 ]->setValue( aDir.Z() ); myEditCurrentArgument->setText( aName ); + if (Group2->LineEdit1->text() == "") + Group2->PushButton1->click(); } else { myData[ DX2 ]->setValue( 0 ); @@ -565,6 +581,7 @@ void BasicGUI_MarkerDlg::onSelectionDone() void BasicGUI_MarkerDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); + globalSelection(); // close local contexts, if any if ( send == Group1->PushButton1 ) { myEditCurrentArgument = Group1->LineEdit1; @@ -572,23 +589,34 @@ void BasicGUI_MarkerDlg::SetEditCurrentArgument() } else if ( send == Group2->PushButton1 ) { myEditCurrentArgument = Group2->LineEdit1; - //globalSelection( GEOM_POINT ); - globalSelection(); // close local contexts, if any localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); + Group2->PushButton2->setDown( false ); + Group2->PushButton3->setDown( false ); + Group2->LineEdit1->setEnabled( true ); + Group2->LineEdit2->setEnabled( false ); + Group2->LineEdit3->setEnabled( false ); } else if ( send == Group2->PushButton2 ) { myEditCurrentArgument = Group2->LineEdit2; - //globalSelection( GEOM_LINE ); - globalSelection(); // close local contexts, if any localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); + Group2->PushButton1->setDown( false ); + Group2->PushButton3->setDown( false ); + Group2->LineEdit1->setEnabled( false ); + Group2->LineEdit2->setEnabled( true ); + Group2->LineEdit3->setEnabled( false ); } else if ( send == Group2->PushButton3 ) { myEditCurrentArgument = Group2->LineEdit3; - globalSelection(); // close local contexts, if any localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); + Group2->PushButton1->setDown( false ); + Group2->PushButton2->setDown( false ); + Group2->LineEdit1->setEnabled( false ); + Group2->LineEdit2->setEnabled( false ); + Group2->LineEdit3->setEnabled( true ); } myEditCurrentArgument->setFocus(); + send->setDown(true); onSelectionDone(); } diff --git a/src/BasicGUI/BasicGUI_PlaneDlg.cxx b/src/BasicGUI/BasicGUI_PlaneDlg.cxx index 598ecab16..1a621e093 100644 --- a/src/BasicGUI/BasicGUI_PlaneDlg.cxx +++ b/src/BasicGUI/BasicGUI_PlaneDlg.cxx @@ -78,6 +78,9 @@ BasicGUI_PlaneDlg::BasicGUI_PlaneDlg( GeometryGUI* theGeometryGUI, QWidget* pare GroupPntDir->PushButton2->setIcon( image3 ); GroupPntDir->LineEdit1->setReadOnly( true ); GroupPntDir->LineEdit2->setReadOnly( true ); + GroupPntDir->PushButton1->setDown( true ); + GroupPntDir->LineEdit1->setEnabled( true ); + GroupPntDir->LineEdit2->setEnabled( false ); Group3Pnts = new DlgRef_3Sel1Spin( centralWidget() ); Group3Pnts->GroupBox1->setTitle( tr( "GEOM_3_POINTS" ) ); @@ -88,16 +91,21 @@ BasicGUI_PlaneDlg::BasicGUI_PlaneDlg( GeometryGUI* theGeometryGUI, QWidget* pare Group3Pnts->PushButton1->setIcon( image3 ); Group3Pnts->PushButton2->setIcon( image3 ); Group3Pnts->PushButton3->setIcon( image3 ); + Group3Pnts->PushButton1->setDown( true ); Group3Pnts->LineEdit1->setReadOnly( true ); Group3Pnts->LineEdit2->setReadOnly( true ); Group3Pnts->LineEdit3->setReadOnly( true ); + Group3Pnts->LineEdit1->setEnabled( true ); + Group3Pnts->LineEdit2->setEnabled( false ); + Group3Pnts->LineEdit3->setEnabled( false ); GroupFace = new DlgRef_1Sel1Spin( centralWidget() ); GroupFace->GroupBox1->setTitle( tr( "GEOM_FACE_OR_LCS" ) ); GroupFace->TextLabel1->setText( tr( "GEOM_SELECTION" ) ); GroupFace->TextLabel2->setText( tr( "GEOM_PLANE_SIZE" ) ); GroupFace->PushButton1->setIcon( image3 ); + GroupFace->PushButton1->setDown( true ); GroupFace->LineEdit1->setReadOnly( true ); @@ -217,6 +225,10 @@ void BasicGUI_PlaneDlg::ConstructorsClicked( int constructorId ) myEditCurrentArgument = GroupPntDir->LineEdit1; GroupPntDir->LineEdit1->setText( "" ); GroupPntDir->LineEdit2->setText( "" ); + GroupPntDir->PushButton1->setDown( true ); + GroupPntDir->PushButton2->setDown( false ); + GroupPntDir->LineEdit1->setEnabled( true ); + GroupPntDir->LineEdit2->setEnabled( false ); /* for the first argument */ globalSelection(); // close local contexts, if any @@ -233,6 +245,12 @@ void BasicGUI_PlaneDlg::ConstructorsClicked( int constructorId ) Group3Pnts->LineEdit1->setText( "" ); Group3Pnts->LineEdit2->setText( "" ); Group3Pnts->LineEdit3->setText( "" ); + Group3Pnts->PushButton1->setDown( true ); + Group3Pnts->PushButton2->setDown( false ); + Group3Pnts->PushButton3->setDown( false ); + Group3Pnts->LineEdit1->setEnabled( true ); + Group3Pnts->LineEdit2->setEnabled( false ); + Group3Pnts->LineEdit3->setEnabled( false ); /* for the first argument */ globalSelection(); // close local contexts, if any @@ -247,6 +265,7 @@ void BasicGUI_PlaneDlg::ConstructorsClicked( int constructorId ) myEditCurrentArgument = GroupFace->LineEdit1; GroupFace->LineEdit1->setText( "" ); + GroupFace->PushButton1->setDown( true ); /* for the first argument */ //globalSelection( GEOM_PLANE ); @@ -316,15 +335,12 @@ void BasicGUI_PlaneDlg::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 == GroupPntDir->LineEdit2 ) + aNeedType = TopAbs_EDGE; TopoDS_Shape aShape; if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) { - TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX; - if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) - aNeedType = TopAbs_EDGE; - else if ( myEditCurrentArgument == GroupFace->LineEdit1 ) - aNeedType = TopAbs_FACE; - LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); TColStd_IndexedMapOfInteger aMap; aSelMgr->GetIndexes( firstIObject(), aMap ); @@ -358,12 +374,45 @@ void BasicGUI_PlaneDlg::SelectionIntoArgument() myEditCurrentArgument->setText( aName ); - if ( myEditCurrentArgument == GroupPntDir->LineEdit1 ) myPoint = aSelectedObject; - else if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) myDir = aSelectedObject; - else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = aSelectedObject; - else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2 = aSelectedObject; - else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3 = aSelectedObject; - else if ( myEditCurrentArgument == GroupFace->LineEdit1 ) myFace = aSelectedObject; + if (!aSelectedObject->_is_nil()) { // clear selection if something selected + globalSelection(); + if ( myEditCurrentArgument == GroupFace->LineEdit1 ) { + TColStd_MapOfInteger aMap; + aMap.Add( GEOM_PLANE ); + aMap.Add( GEOM_MARKER ); + globalSelection( aMap ); + } + else + localSelection( GEOM::GEOM_Object::_nil(), aNeedType ); + } + + if ( myEditCurrentArgument == GroupPntDir->LineEdit1 ) { + myPoint = aSelectedObject; + if ( !myPoint->_is_nil() && myDir->_is_nil() ) + GroupPntDir->PushButton2->click(); + } + else if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) { + myDir = aSelectedObject; + if ( !myDir->_is_nil() && myPoint->_is_nil() ) + GroupPntDir->PushButton1->click(); + } + else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) { + myPoint1 = aSelectedObject; + if ( !myPoint1->_is_nil() && myPoint2->_is_nil() ) + Group3Pnts->PushButton2->click(); + } + else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) { + myPoint2 = aSelectedObject; + if ( !myPoint2->_is_nil() && myPoint3->_is_nil() ) + Group3Pnts->PushButton3->click(); + } + else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) { + myPoint3 = aSelectedObject; + if ( !myPoint3->_is_nil() && myPoint1->_is_nil() ) + Group3Pnts->PushButton1->click(); + } + else if ( myEditCurrentArgument == GroupFace->LineEdit1 ) + myFace = aSelectedObject; } displayPreview(); @@ -379,17 +428,50 @@ void BasicGUI_PlaneDlg::SetEditCurrentArgument() QPushButton* send = (QPushButton*)sender(); globalSelection( GEOM_POINT ); - if ( send == GroupPntDir->PushButton1 ) myEditCurrentArgument = GroupPntDir->LineEdit1; - else if ( send == GroupPntDir->PushButton2 ) myEditCurrentArgument = GroupPntDir->LineEdit2; - else if ( send == Group3Pnts->PushButton1 ) myEditCurrentArgument = Group3Pnts->LineEdit1; - else if ( send == Group3Pnts->PushButton2 ) myEditCurrentArgument = Group3Pnts->LineEdit2; - else if ( send == Group3Pnts->PushButton3 ) myEditCurrentArgument = Group3Pnts->LineEdit3; - else if ( send == GroupFace->PushButton1 ) myEditCurrentArgument = GroupFace->LineEdit1; + if ( send == GroupPntDir->PushButton1 ) { + myEditCurrentArgument = GroupPntDir->LineEdit1; + GroupPntDir->PushButton2->setDown( false ); + GroupPntDir->LineEdit1->setEnabled( true ); + GroupPntDir->LineEdit2->setEnabled( false ); + } + else if ( send == GroupPntDir->PushButton2 ) { + myEditCurrentArgument = GroupPntDir->LineEdit2; + GroupPntDir->PushButton1->setDown( false ); + GroupPntDir->LineEdit1->setEnabled( false ); + GroupPntDir->LineEdit2->setEnabled( true ); + } + else if ( send == Group3Pnts->PushButton1 ) { + myEditCurrentArgument = Group3Pnts->LineEdit1; + Group3Pnts->PushButton2->setDown( false ); + Group3Pnts->PushButton3->setDown( false ); + Group3Pnts->LineEdit1->setEnabled( true ); + Group3Pnts->LineEdit2->setEnabled( false ); + Group3Pnts->LineEdit3->setEnabled( false ); + } + else if ( send == Group3Pnts->PushButton2 ) { + myEditCurrentArgument = Group3Pnts->LineEdit2; + Group3Pnts->PushButton1->setDown( false ); + Group3Pnts->PushButton3->setDown( false ); + Group3Pnts->LineEdit1->setEnabled( false ); + Group3Pnts->LineEdit2->setEnabled( true ); + Group3Pnts->LineEdit3->setEnabled( false ); + } + else if ( send == Group3Pnts->PushButton3 ) { + myEditCurrentArgument = Group3Pnts->LineEdit3; + Group3Pnts->PushButton1->setDown( false ); + Group3Pnts->PushButton2->setDown( false ); + Group3Pnts->LineEdit1->setEnabled( false ); + Group3Pnts->LineEdit2->setEnabled( false ); + Group3Pnts->LineEdit3->setEnabled( true ); + } + else if ( send == GroupFace->PushButton1 ) { + myEditCurrentArgument = GroupFace->LineEdit1; + GroupFace->PushButton1->setDown( true ); + } myEditCurrentArgument->setFocus(); if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) { - globalSelection(); // close local contexts, if any localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); } else if ( myEditCurrentArgument == GroupFace->LineEdit1 ) { @@ -399,11 +481,13 @@ void BasicGUI_PlaneDlg::SetEditCurrentArgument() globalSelection( aMap ); } else { // 3 Pnts - globalSelection(); // close local contexts, if any localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); } - SelectionIntoArgument(); + // SelectionIntoArgument(); + myEditCurrentArgument->setFocus(); + send->setDown(true); + displayPreview(); } diff --git a/src/BasicGUI/BasicGUI_PointDlg.cxx b/src/BasicGUI/BasicGUI_PointDlg.cxx index 59b1121cc..e0e620ac9 100644 --- a/src/BasicGUI/BasicGUI_PointDlg.cxx +++ b/src/BasicGUI/BasicGUI_PointDlg.cxx @@ -112,6 +112,7 @@ BasicGUI_PointDlg::BasicGUI_PointDlg( GeometryGUI* theGeometryGUI, QWidget* pare GroupLineIntersection->TextLabel2->setText( tr( "GEOM_LINE2" ) ); GroupLineIntersection->PushButton1->setIcon( image2 ); GroupLineIntersection->PushButton2->setIcon( image2 ); + GroupLineIntersection->LineEdit2->setEnabled(false); myCoordGrp = new QGroupBox( tr( "GEOM_COORDINATES" ), centralWidget() ); QGridLayout* myCoordGrpLayout = new QGridLayout( myCoordGrp ); @@ -174,6 +175,8 @@ void BasicGUI_PointDlg::Init() GroupRefPoint->LineEdit1->setReadOnly( true ); GroupLineIntersection->LineEdit1->setReadOnly( true ); GroupLineIntersection->LineEdit2->setReadOnly( true ); + GroupLineIntersection->LineEdit1->setEnabled( true ); + GroupLineIntersection->LineEdit2->setEnabled( false ); myEdge = GEOM::GEOM_Object::_nil(); myRefPoint = GEOM::GEOM_Object::_nil(); @@ -296,7 +299,7 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId) myEditCurrentArgument = GroupRefPoint->LineEdit1; myEditCurrentArgument->setText( "" ); myRefPoint = GEOM::GEOM_Object::_nil(); - + GroupRefPoint->PushButton1->setDown(true); localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); GroupXYZ->hide(); @@ -314,7 +317,7 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId) myEditCurrentArgument = GroupOnCurve->LineEdit1; myEditCurrentArgument->setText( "" ); myEdge = GEOM::GEOM_Object::_nil(); - + GroupOnCurve->PushButton1->setDown(true); localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); GroupXYZ->hide(); @@ -332,8 +335,12 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId) myEditCurrentArgument = GroupLineIntersection->LineEdit1; GroupLineIntersection->LineEdit1->setText( "" ); GroupLineIntersection->LineEdit2->setText( "" ); + GroupLineIntersection->LineEdit1->setEnabled( true ); + GroupLineIntersection->LineEdit2->setEnabled( false ); myLine1 = GEOM::GEOM_Object::_nil(); myLine2 = GEOM::GEOM_Object::_nil(); + GroupLineIntersection->PushButton1->setDown(true); + GroupLineIntersection->PushButton2->setDown(false); localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); @@ -352,7 +359,7 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId) myEditCurrentArgument = GroupOnSurface->LineEdit1; myEditCurrentArgument->setText( "" ); myFace = GEOM::GEOM_Object::_nil(); - + GroupOnSurface->PushButton1->setDown(true); localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE ); GroupXYZ->hide(); @@ -483,13 +490,18 @@ void BasicGUI_PointDlg::SelectionIntoArgument() GroupOnCurve->LineEdit1->setText( aName ); } else if ( id == 3 ) { + myEditCurrentArgument->setText( aName ); + globalSelection(); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); if ( myEditCurrentArgument == GroupLineIntersection->LineEdit1 ) { myLine1 = aSelectedObject; - myEditCurrentArgument->setText( aName ); + if ( !myLine1->_is_nil() && myLine2->_is_nil() ) + GroupLineIntersection->PushButton2->click(); } else if ( myEditCurrentArgument == GroupLineIntersection->LineEdit2 ) { myLine2 = aSelectedObject; - myEditCurrentArgument->setText( aName ); + if ( !myLine2->_is_nil() && myLine1->_is_nil() ) + GroupLineIntersection->PushButton1->click(); } } else if ( id == 4 ) @@ -530,7 +542,6 @@ void BasicGUI_PointDlg::SetEditCurrentArgument() globalSelection(); // close local contexts, if any QPushButton* send = (QPushButton*)sender(); - globalSelection( GEOM_POINT ); // to break previous local selection if ( send == GroupRefPoint->PushButton1 ) { GroupRefPoint->LineEdit1->setFocus(); @@ -554,15 +565,20 @@ void BasicGUI_PointDlg::SetEditCurrentArgument() else if ( send == GroupLineIntersection->PushButton1 ) { GroupLineIntersection->LineEdit1->setFocus(); myEditCurrentArgument = GroupLineIntersection->LineEdit1; - + GroupLineIntersection->PushButton2->setDown( false ); + GroupLineIntersection->LineEdit1->setEnabled(true); + GroupLineIntersection->LineEdit2->setEnabled(false); localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); } else if ( send == GroupLineIntersection->PushButton2 ) { GroupLineIntersection->LineEdit2->setFocus(); myEditCurrentArgument = GroupLineIntersection->LineEdit2; - + GroupLineIntersection->PushButton1->setDown( false ); + GroupLineIntersection->LineEdit1->setEnabled(false); + GroupLineIntersection->LineEdit2->setEnabled(true); localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); } + send->setDown(true); } diff --git a/src/BasicGUI/BasicGUI_VectorDlg.cxx b/src/BasicGUI/BasicGUI_VectorDlg.cxx index 9408a0a39..e00aacd41 100644 --- a/src/BasicGUI/BasicGUI_VectorDlg.cxx +++ b/src/BasicGUI/BasicGUI_VectorDlg.cxx @@ -73,9 +73,12 @@ BasicGUI_VectorDlg::BasicGUI_VectorDlg( GeometryGUI* theGeometryGUI, QWidget* pa GroupPoints->TextLabel2->setText( tr( "GEOM_POINT_I" ).arg( 2 ) ); GroupPoints->PushButton1->setIcon( image2 ); GroupPoints->PushButton2->setIcon( image2 ); + GroupPoints->PushButton1->setDown( true ); GroupPoints->LineEdit1->setReadOnly( true ); GroupPoints->LineEdit2->setReadOnly( true ); + GroupPoints->LineEdit1->setEnabled( true ); + GroupPoints->LineEdit2->setEnabled( false ); GroupDimensions = new DlgRef_3Spin1Check( centralWidget() ); GroupDimensions->GroupBox1->setTitle( tr( "GEOM_COORDINATES" ) ); @@ -197,6 +200,10 @@ void BasicGUI_VectorDlg::ConstructorsClicked( int constructorId ) myEditCurrentArgument = GroupPoints->LineEdit1; GroupPoints->LineEdit1->setText( "" ); GroupPoints->LineEdit2->setText( "" ); + GroupPoints->PushButton1->setDown( true ); + GroupPoints->PushButton2->setDown( false ); + GroupPoints->LineEdit1->setEnabled( true ); + GroupPoints->LineEdit2->setEnabled( false ); globalSelection(); // close local contexts, if any localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); @@ -251,7 +258,7 @@ bool BasicGUI_VectorDlg::ClickOnApply() initName(); if ( getConstructorId() != 1 ) - ConstructorsClicked( getConstructorId() ); + ConstructorsClicked( getConstructorId() ); return true; } @@ -308,8 +315,21 @@ void BasicGUI_VectorDlg::SelectionIntoArgument() myEditCurrentArgument->setText(aName); - if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint1 = aSelectedObject; - else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myPoint2 = aSelectedObject; + if (!aSelectedObject->_is_nil()) { // clear selection if something selected + globalSelection(); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); + } + + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) { + myPoint1 = aSelectedObject; + if ( !myPoint1->_is_nil() && myPoint2->_is_nil() ) + GroupPoints->PushButton2->click(); + } + else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) { + myPoint2 = aSelectedObject; + if ( !myPoint2->_is_nil() && myPoint1->_is_nil() ) + GroupPoints->PushButton1->click(); + } } displayPreview(); @@ -323,10 +343,24 @@ void BasicGUI_VectorDlg::SelectionIntoArgument() void BasicGUI_VectorDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - if ( send == GroupPoints->PushButton1 ) myEditCurrentArgument = GroupPoints->LineEdit1; - else if ( send == GroupPoints->PushButton2 ) myEditCurrentArgument = GroupPoints->LineEdit2; + 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); + } myEditCurrentArgument->setFocus(); - SelectionIntoArgument(); + // SelectionIntoArgument(); + globalSelection(); // close local selection to clear it + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); + send->setDown(true); + displayPreview(); } diff --git a/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx b/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx index 55bba2858..dd2edc470 100644 --- a/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx +++ b/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx @@ -91,6 +91,9 @@ BasicGUI_WorkingPlaneDlg::BasicGUI_WorkingPlaneDlg( GeometryGUI* theGeometryGUI, Group2->PushButton2->setIcon( image0 ); Group2->LineEdit1->setReadOnly( true ); Group2->LineEdit2->setReadOnly( true ); + Group2->PushButton1->setDown( true ); + Group2->LineEdit1->setEnabled( true ); + Group2->LineEdit2->setEnabled( false ); Group3 = new DlgRef_3Check( centralWidget() ); @@ -192,16 +195,14 @@ void BasicGUI_WorkingPlaneDlg::ConstructorsClicked( int constructorId ) switch ( constructorId ) { case 0: { - //globalSelection( GEOM_PLANE ); TColStd_MapOfInteger aMap; aMap.Add( GEOM_PLANE ); aMap.Add( GEOM_MARKER ); globalSelection( aMap ); - Group2->hide(); Group3->hide(); Group1->show(); - + Group1->PushButton1->setDown(true); myEditCurrentArgument = Group1->LineEdit1; Group1->LineEdit1->setText( "" ); myFace = GEOM::GEOM_Object::_nil(); @@ -211,17 +212,17 @@ void BasicGUI_WorkingPlaneDlg::ConstructorsClicked( int constructorId ) } case 1: { - //globalSelection( GEOM_LINE ); - GEOM::GEOM_Object_var anObj; - localSelection( anObj, TopAbs_EDGE ); - + globalSelection( GEOM_LINE ); Group1->hide(); Group3->hide(); Group2->show(); - myEditCurrentArgument = Group2->LineEdit1; Group2->LineEdit1->setText( "" ); Group2->LineEdit2->setText( "" ); + Group2->PushButton1->setDown( true ); + Group2->PushButton2->setDown( false ); + Group2->LineEdit1->setEnabled( true ); + Group2->LineEdit2->setEnabled( false ); myVectX = GEOM::GEOM_Object::_nil(); myVectZ = GEOM::GEOM_Object::_nil(); @@ -233,7 +234,6 @@ void BasicGUI_WorkingPlaneDlg::ConstructorsClicked( int constructorId ) Group1->hide(); Group2->hide(); Group3->show(); - Group3->RadioButton1->setChecked( true ); aOriginType = 1; break; @@ -337,10 +337,10 @@ void BasicGUI_WorkingPlaneDlg::SelectionIntoArgument() myVectZ = aShapesOp->GetSubShape( aSelectedObject, anIndex ); } else { - if ( myEditCurrentArgument == Group2->LineEdit1 ) - myVectX = aSelectedObject; - else - myVectZ = aSelectedObject; + if ( aShape.ShapeType() != TopAbs_EDGE ) { + aSelectedObject = GEOM::GEOM_Object::_nil(); + aName = ""; + } } aSelMgr->clearSelected(); } @@ -349,6 +349,17 @@ void BasicGUI_WorkingPlaneDlg::SelectionIntoArgument() myEditCurrentArgument->setText( aName ); + if ( myEditCurrentArgument == Group2->LineEdit1 ) { + myVectX = aSelectedObject; + if ( !myVectX->_is_nil() && myVectZ->_is_nil() ) + Group2->PushButton2->click(); + } + else { + myVectZ = aSelectedObject; + if ( !myVectZ->_is_nil() && myVectX->_is_nil() ) + Group2->PushButton1->click(); + } + updateWPlane(); } @@ -368,16 +379,26 @@ void BasicGUI_WorkingPlaneDlg::SetEditCurrentArgument() else if ( send == Group2->PushButton1 ) { myEditCurrentArgument = Group2->LineEdit1; GEOM::GEOM_Object_var anObj; - localSelection( anObj, TopAbs_EDGE ); + // localSelection( anObj, TopAbs_EDGE ); + globalSelection( GEOM_LINE ); + Group2->PushButton2->setDown( false ); + Group2->LineEdit1->setEnabled( true ); + Group2->LineEdit2->setEnabled( false ); } else if ( send == Group2->PushButton2 ) { myEditCurrentArgument = Group2->LineEdit2; GEOM::GEOM_Object_var anObj; - localSelection( anObj, TopAbs_EDGE ); + // localSelection( anObj, TopAbs_EDGE ); + globalSelection( GEOM_LINE ); + Group2->PushButton1->setDown( false ); + Group2->LineEdit1->setEnabled( false ); + Group2->LineEdit2->setEnabled( true ); } myEditCurrentArgument->setFocus(); - SelectionIntoArgument(); + // SelectionIntoArgument(); + send->setDown(true); + displayPreview(); } diff --git a/src/OperationGUI/OperationGUI_PartitionDlg.cxx b/src/OperationGUI/OperationGUI_PartitionDlg.cxx index 6c92e41a7..662cba75c 100644 --- a/src/OperationGUI/OperationGUI_PartitionDlg.cxx +++ b/src/OperationGUI/OperationGUI_PartitionDlg.cxx @@ -286,6 +286,7 @@ void OperationGUI_PartitionDlg::SetEditCurrentArgument() 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); diff --git a/src/PrimitiveGUI/PrimitiveGUI_FaceDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_FaceDlg.cxx index 011ceb53b..168a00a41 100755 --- a/src/PrimitiveGUI/PrimitiveGUI_FaceDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_FaceDlg.cxx @@ -102,7 +102,7 @@ PrimitiveGUI_FaceDlg::PrimitiveGUI_FaceDlg( GeometryGUI* theGeometryGUI, QWidget /***************************************************************/ - setHelpFileName( "create_face_page.html" ); + setHelpFileName( "create_squareface_page.html" ); Init(); } -- 2.39.2