1 // Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // GEOM RepairGUI : GUI for Geometry component
24 // File : RepairGUI_GlueDlg.cxx
25 // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
27 #include "RepairGUI_GlueDlg.h"
30 #include <GeometryGUI.h>
32 #include <SalomeApp_DoubleSpinBox.h>
34 #include <SalomeApp_Application.h>
35 #include <LightApp_SelectionMgr.h>
36 #include <SalomeApp_Study.h>
37 #include <SalomeApp_Tools.h>
38 #include <SUIT_Session.h>
39 #include <SUIT_Desktop.h>
40 #include <SUIT_MessageBox.h>
41 #include <SUIT_OverrideCursor.h>
42 #include <SUIT_ResourceMgr.h>
43 #include <SUIT_ViewWindow.h>
44 #include <SUIT_ViewManager.h>
45 #include <OCCViewer_ViewModel.h>
46 #include <SALOME_ListIteratorOfListIO.hxx>
48 #include <GEOMImpl_Types.hxx>
50 #include <TCollection_AsciiString.hxx>
52 #define DEFAULT_TOLERANCE_VALUE 1e-07
54 //=================================================================================
55 // class : RepairGUI_GlueDlg()
56 // purpose : Constructs a RepairGUI_GlueDlg which is a child of 'parent', with the
57 // name 'name' and widget flags set to 'f'.
58 // The dialog will by default be modeless, unless you set 'modal' to
59 // TRUE to construct a modal dialog.
60 //=================================================================================
61 RepairGUI_GlueDlg::RepairGUI_GlueDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
63 : GEOMBase_Skeleton( theGeometryGUI, parent, modal ),
66 QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_GLUE_FACES" ) ) );
67 QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_GLUE_FACES2" ) ));
68 QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
70 setWindowTitle( tr( "GEOM_GLUE_TITLE" ) );
72 /***************************************************************/
73 mainFrame()->GroupConstructors->setTitle( tr( "GEOM_GLUE_TITLE" ) );
74 mainFrame()->RadioButton1->setIcon( image0 );
75 mainFrame()->RadioButton2->setIcon( image2 );
76 mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
77 mainFrame()->RadioButton3->close();
79 GroupPoints = new DlgRef_1SelExt( centralWidget() );
80 GroupPoints->GroupBox1->setTitle( tr( "GEOM_GLUE" ) );
81 GroupPoints->TextLabel1->setText( tr( "GEOM_SELECTED_SHAPE" ) );
82 GroupPoints->PushButton1->setIcon( image1 );
83 GroupPoints->LineEdit1->setReadOnly( true );
85 QLabel* aTolLab = new QLabel( tr( "GEOM_TOLERANCE" ), GroupPoints->Box );
86 myTolEdt = new SalomeApp_DoubleSpinBox( GroupPoints->Box );
87 initSpinBox( myTolEdt, 0., 100., DEFAULT_TOLERANCE_VALUE, "len_tol_precision" );
88 myTolEdt->setValue( DEFAULT_TOLERANCE_VALUE );
90 QGridLayout* boxLayout = new QGridLayout( GroupPoints->Box );
91 boxLayout->setMargin( 0 ); boxLayout->setSpacing( 6 );
92 boxLayout->addWidget( aTolLab, 0, 0 );
93 boxLayout->addWidget( myTolEdt, 0, 2 );
94 /***************************************************************/
96 GroupPoints2 = new DlgRef_1SelExt( centralWidget() );
97 GroupPoints2->GroupBox1->setTitle( tr( "GEOM_GLUE" ) );
98 GroupPoints2->TextLabel1->setText( tr( "GEOM_SELECTED_SHAPE" ) );
99 GroupPoints2->PushButton1->setIcon( image1 );
100 GroupPoints2->LineEdit1->setReadOnly( true );
102 QLabel* aTolLab2 = new QLabel( tr( "GEOM_TOLERANCE" ), GroupPoints2->Box );
103 myTolEdt2 = new SalomeApp_DoubleSpinBox( GroupPoints2->Box );
104 initSpinBox( myTolEdt2, 0., 100., DEFAULT_TOLERANCE_VALUE, "len_tol_precision" );
105 myTolEdt2->setValue( DEFAULT_TOLERANCE_VALUE );
107 myDetectBtn = new QPushButton( tr( "GEOM_DETECT" ) + QString( " [%1]" ).arg( tr( "GLUE_FACES" ) ),
109 mySubShapesChk = new QCheckBox( tr( "SELECT_FACES" ), GroupPoints2->Box );
111 boxLayout = new QGridLayout( GroupPoints2->Box );
112 boxLayout->setMargin( 0 ); boxLayout->setSpacing( 6 );
113 boxLayout->addWidget( aTolLab2, 0, 0 );
114 boxLayout->addWidget( myTolEdt2, 0, 2 );
115 boxLayout->addWidget( myDetectBtn, 1, 0, 1, 3 );
116 boxLayout->addWidget( mySubShapesChk, 2, 0, 1, 3 );
118 QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
119 layout->setMargin( 0 ); layout->setSpacing( 6 );
120 layout->addWidget( GroupPoints );
121 layout->addWidget( GroupPoints2 );
123 /***************************************************************/
125 setHelpFileName( "glue_faces_operation_page.html" );
127 // Disable second way of gluing if OCC viewer is not active one
128 if ( myGeomGUI->getApp()->desktop()->activeWindow()->getViewManager()->getType()
129 != OCCViewer_Viewer::Type() )
130 mainFrame()->RadioButton2->setEnabled( false );
136 //=================================================================================
137 // function : ~RepairGUI_GlueDlg()
138 // purpose : Destroys the object and frees any allocated resources
139 //=================================================================================
140 RepairGUI_GlueDlg::~RepairGUI_GlueDlg()
145 //=================================================================================
148 //=================================================================================
149 void RepairGUI_GlueDlg::Init()
152 myEditCurrentArgument = GroupPoints->LineEdit1;
154 myObject = GEOM::GEOM_Object::_nil();
156 //myGeomGUI->SetState( 0 );
157 //globalSelection( GEOM_COMPOUND );
159 mainFrame()->GroupBoxPublish->show();
160 //Hide preview checkbox
161 mainFrame()->CheckBoxPreview->hide();
163 /* signals and slots connections */
164 connect( buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
165 connect( buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
167 connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
169 connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
170 connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
172 connect( GroupPoints2->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
173 connect( GroupPoints2->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
174 connect( myTolEdt2, SIGNAL( valueChanged( double ) ), this, SLOT( onTolerChanged( double ) ) );
175 connect( mySubShapesChk, SIGNAL( stateChanged( int ) ), this, SLOT( onSubShapesChk() ) );
177 connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
178 this, SLOT( SelectionIntoArgument() ) );
180 connect( myDetectBtn, SIGNAL( clicked() ), this, SLOT( onDetect() ) );
182 initName( tr( "GLUE_NEW_OBJ_NAME" ) );
184 ConstructorsClicked( 0 );
191 //=================================================================================
192 // function : ConstructorsClicked()
193 // purpose : Radio button management
194 //=================================================================================
195 void RepairGUI_GlueDlg::ConstructorsClicked( int constructorId )
197 if ( myCurrConstrId == constructorId )
200 disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 );
202 switch ( constructorId ) {
204 GroupPoints2->hide();
206 GroupPoints->LineEdit1->setText( "" );
207 myEditCurrentArgument = GroupPoints->LineEdit1;
209 if ( myCurrConstrId >= 0 ) {
210 // i.e. it is not initialisation
211 // copy tolerance from previous tolerance field
212 myTolEdt->setValue( myTolEdt2->value() );
217 GroupPoints2->show();
218 GroupPoints->LineEdit1->setText( "" );
219 myEditCurrentArgument = GroupPoints2->LineEdit1;
221 if ( myCurrConstrId >= 0 ) {
222 // i.e. it is not initialisation
223 // copy tolerance from previous tolerance field
224 myTolEdt2->setValue( myTolEdt->value() );
225 mySubShapesChk->setChecked( false );
231 myCurrConstrId = constructorId;
233 myEditCurrentArgument->setFocus();
235 connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
236 this, SLOT( SelectionIntoArgument() ) );
238 qApp->processEvents();
240 resize( minimumSizeHint() );
245 SelectionIntoArgument();
249 //=================================================================================
250 // function : ClickOnOk()
251 // purpose : Same than click on apply but close this dialog.
252 //=================================================================================
253 void RepairGUI_GlueDlg::ClickOnOk()
255 setIsApplyAndClose( true );
256 if ( ClickOnApply() )
261 //=================================================================================
262 // function : ClickOnApply()
264 //=================================================================================
265 bool RepairGUI_GlueDlg::ClickOnApply()
267 if ( !onAcceptLocal() )
272 //GroupPoints->LineEdit1->setText("");
273 //myObject = GEOM::GEOM_Object::_nil();
275 //globalSelection( GEOM_COMPOUND );
277 ConstructorsClicked( getConstructorId() );
283 //=================================================================================
284 // function : SelectionIntoArgument()
285 // purpose : Called when selection
286 //=================================================================================
287 void RepairGUI_GlueDlg::SelectionIntoArgument()
289 if ( mySubShapesChk->isChecked() && getConstructorId() == 1 ) {
295 myEditCurrentArgument->setText( "" );
296 myObject = GEOM::GEOM_Object::_nil();
298 LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
299 SALOME_ListIO aSelList;
300 aSelMgr->selectedObjects(aSelList);
302 if ( aSelList.Extent() == 1 ) {
303 Handle(SALOME_InteractiveObject) anIO = aSelList.First();
304 myObject = GEOMBase::ConvertIOinGEOMObject( anIO );
305 if ( !CORBA::is_nil( myObject ) )
306 myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) );
311 //=================================================================================
312 // function : SetEditCurrentArgument()
314 //=================================================================================
315 void RepairGUI_GlueDlg::SetEditCurrentArgument()
317 const QObject* send = sender();
318 if ( send == GroupPoints->PushButton1 || send == GroupPoints2->PushButton1 ) {
319 myEditCurrentArgument->setFocus();
320 SelectionIntoArgument();
325 //=================================================================================
326 // function : LineEditReturnPressed()
328 //=================================================================================
329 void RepairGUI_GlueDlg::LineEditReturnPressed()
331 const QObject* send = sender();
332 if ( send == GroupPoints->LineEdit1 ) {
333 myEditCurrentArgument = GroupPoints->LineEdit1;
334 GEOMBase_Skeleton::LineEditReturnPressed();
336 else if ( send == GroupPoints2->LineEdit1 ) {
337 myEditCurrentArgument = GroupPoints2->LineEdit1;
338 GEOMBase_Skeleton::LineEditReturnPressed();
343 //=================================================================================
344 // function : ActivateThisDialog()
346 //=================================================================================
347 void RepairGUI_GlueDlg::ActivateThisDialog()
349 GEOMBase_Skeleton::ActivateThisDialog();
350 connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
351 this, SLOT( SelectionIntoArgument() ) );
353 //GroupPoints->LineEdit1->setText("");
354 //GroupPoints2->LineEdit1->setText("");
355 //myObject = GEOM::GEOM_Object::_nil();
357 //myGeomGUI->SetState( 0 );
358 //globalSelection( GEOM_COMPOUND );
363 //=================================================================================
364 // function : enterEvent()
365 // purpose : Mouse enter onto the dialog to activate it
366 //=================================================================================
367 void RepairGUI_GlueDlg::enterEvent( QEvent* )
369 if ( !mainFrame()->GroupConstructors->isEnabled() )
370 ActivateThisDialog();
374 //=================================================================================
375 // function : createOperation
377 //=================================================================================
378 GEOM::GEOM_IOperations_ptr RepairGUI_GlueDlg::createOperation()
380 return getGeomEngine()->GetIShapesOperations( getStudyId() );
383 //=================================================================================
384 // function : isValid
386 //=================================================================================
387 bool RepairGUI_GlueDlg::isValid( QString& msg )
391 switch ( getConstructorId() )
394 v = myTolEdt->value();
395 ok = myTolEdt->isValid( msg, !IsPreview() );
398 v = myTolEdt2->value();
399 ok = myTolEdt2->isValid( msg, !IsPreview() );
402 return !myObject->_is_nil() && ( IsPreview() || v > 0. ) && ok;
405 //=================================================================================
406 // function : execute
408 //=================================================================================
409 bool RepairGUI_GlueDlg::execute( ObjectList& objects )
411 bool aResult = false;
414 GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow( getOperation() );
415 switch ( getConstructorId() ) {
418 GEOM::GEOM_Object_var anObj = anOper->MakeGlueFaces( myObject, myTolEdt->value(), true );
419 aResult = !anObj->_is_nil();
420 if ( aResult && !IsPreview() )
422 QStringList aParameters;
423 aParameters << myTolEdt->text();
424 anObj->SetParameters(aParameters.join(":").toLatin1().constData());
426 objects.push_back( anObj._retn() );
433 // if this method is used for displaying preview then we must detect glue faces only
434 for ( int i = 0; i < myTmpObjs.count(); i++ ) {
435 myTmpObjs[i].get()->Register(); // increment counter, since calling function will call UnRegister()
436 objects.push_back( myTmpObjs[i].copy() );
438 return !myTmpObjs.isEmpty();
441 // Make glue face by list.
442 // Iterate through myTmpObjs and verifies where each object is currently selected or not.
443 QSet<QString> selected;
445 // Get names of selected objects
446 LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
447 SALOME_ListIO aSelList;
448 aSelMgr->selectedObjects(aSelList);
450 SALOME_ListIteratorOfListIO it (aSelList);
451 for (; it.More(); it.Next())
452 selected.insert(it.Value()->getName());
454 // Iterate through result and select objects with names from selection
455 // ObjectList toRemoveFromEnggine;
458 GEOM::ListOfGO_var aListForGlue = new GEOM::ListOfGO();
459 aListForGlue->length( myTmpObjs.count() );
461 for ( int i = 0; i < myTmpObjs.count(); i++ ) {
462 CORBA::String_var tmpior = myGeomGUI->getApp()->orb()->object_to_string(myTmpObjs[i].get());
463 if ( selected.contains( tmpior.in() ) )
464 aListForGlue[ added++ ] = myTmpObjs[i].copy();
467 GEOM::GEOM_Object_var anObj = anOper->MakeGlueFacesByList( myObject, myTolEdt2->value(), aListForGlue.in(), true );
469 aResult = !anObj->_is_nil();
475 QStringList aParameters;
476 aParameters << myTolEdt2->text();
477 anObj->SetParameters(aParameters.join(":").toLatin1().constData());
479 objects.push_back( anObj._retn() );
482 // Remove from engine useless objects
494 //=================================================================================
495 // function : restoreSubShapes
497 //=================================================================================
498 void RepairGUI_GlueDlg::restoreSubShapes( SALOMEDS::Study_ptr theStudy,
499 SALOMEDS::SObject_ptr theSObject )
501 if ( mainFrame()->CheckBoxRestoreSS->isChecked() ) {
502 GEOM::find_shape_method aFindMethod = GEOM::FSM_GetInPlace;
503 if ( getConstructorId() == 0 ) // MakeGlueFaces
504 aFindMethod = GEOM::FSM_GetInPlaceByHistory;
506 // empty list of arguments means that all arguments should be restored
507 getGeomEngine()->RestoreSubShapesSO( theStudy, theSObject, GEOM::ListOfGO(),
508 aFindMethod, /*theInheritFirstArg=*/true,
509 mainFrame()->CheckBoxAddPrefix->isChecked() );
513 //================================================================
514 // Function : clearShapeBufferLocal
516 //================================================================
517 void RepairGUI_GlueDlg::clearShapeBufferLocal( GEOM::GEOM_Object_ptr theObj )
519 if ( CORBA::is_nil( theObj ) )
522 CORBA::String_var IOR = myGeomGUI->getApp()->orb()->object_to_string( theObj );
523 TCollection_AsciiString asciiIOR( (char *)( IOR.in() ) );
524 myGeomGUI->GetShapeReader().RemoveShapeFromBuffer( asciiIOR );
526 if ( !getStudy() || !( getStudy()->studyDS() ) )
529 _PTR(Study) aStudy = getStudy()->studyDS();
530 _PTR(SObject) aSObj ( aStudy->FindObjectIOR( std::string( IOR.in() ) ) );
534 _PTR(ChildIterator) anIt ( aStudy->NewChildIterator( aSObj ) );
535 for ( anIt->InitEx( true ); anIt->More(); anIt->Next() ) {
536 _PTR(GenericAttribute) anAttr;
537 if ( anIt->Value()->FindAttribute(anAttr, "AttributeIOR") ) {
538 _PTR(AttributeIOR) anIOR ( anAttr );
539 TCollection_AsciiString asciiIOR( (char*)anIOR->Value().c_str() );
540 myGeomGUI->GetShapeReader().RemoveShapeFromBuffer( asciiIOR );
545 //================================================================
546 // Function : onAccept
547 // Purpose : This method should be called from dialog's slots onOk() and onApply()
548 // It perfroms user input validation, then it
549 // performs a proper operation and manages transactions, etc.
550 //================================================================
551 bool RepairGUI_GlueDlg::onAcceptLocal()
553 if ( !getStudy() || !( getStudy()->studyDS() ) )
556 _PTR(Study) aStudy = getStudy()->studyDS();
558 bool aLocked = aStudy->GetProperties()->IsLocked();
560 MESSAGE("GEOMBase_Helper::onAccept - ActiveStudy is locked");
561 SUIT_MessageBox::warning( this, tr( "WRN_WARNING" ), tr( "WRN_STUDY_LOCKED" ), tr( "BUT_OK" ) );
566 if ( !isValid( msg ) ) {
571 erasePreview( false );
574 if ( openCommand() ) {
575 SUIT_OverrideCursor wc;
577 myGeomGUI->getApp()->putInfo( "" );
580 if ( !execute( objects ) ) {
586 const int nbObjs = objects.size();
587 for ( ObjectList::iterator it = objects.begin(); it != objects.end(); ++it ) {
588 QString aName = getNewObjectName();
590 if ( aName.isEmpty() )
591 aName = getPrefix( *it );
592 aName = GEOMBase::GetDefaultName( aName );
595 // PAL6521: use a prefix, if some dialog box doesn't reimplement getNewObjectName()
596 if ( aName.isEmpty() )
597 aName = GEOMBase::GetDefaultName( getPrefix( *it ) );
599 addInStudy( *it, aName.toLatin1().data() );
600 display( *it, false );
606 myGeomGUI->getApp()->putInfo( QObject::tr("GEOM_PRP_DONE") );
612 // JFA 28.12.2004 BEGIN // To enable warnings
613 GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow( getOperation() );
614 if ( !CORBA::is_nil(anOper) && !anOper->IsDone() ) {
616 QString msgw = QObject::tr( anOper->GetErrorCode() );
617 SUIT_MessageBox::warning( this, tr( "WRN_WARNING" ), msgw, tr( "BUT_OK" ) );
619 // JFA 28.12.2004 END
623 catch( const SALOME::SALOME_Exception& e ) {
624 SalomeApp_Tools::QtCatchCorbaException( e );
636 //=================================================================================
637 // function : onDetect
639 //=================================================================================
640 void RepairGUI_GlueDlg::onDetect()
644 if ( !isValid( msg ) ) {
649 buttonOk()->setEnabled( false );
650 buttonApply()->setEnabled( false );
651 globalSelection( GEOM_ALLSHAPES );
653 GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow( getOperation() );
654 GEOM::ListOfGO_var aList = anOper->GetGlueFaces( myObject.in(), myTolEdt2->value() );
656 for ( int i = 0, n = aList->length(); i < n; i++ )
657 myTmpObjs << GEOM::GeomObjPtr( aList[i].in() );
659 if ( !myTmpObjs.isEmpty() ) {
660 msg = tr( "FACES_FOR_GLUING_ARE_DETECTED" ).arg( myTmpObjs.count() );
661 mySubShapesChk->setChecked( true );
664 msg = tr( "THERE_ARE_NO_FACES_FOR_GLUING" );
667 connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
668 this, SLOT( SelectionIntoArgument() ) ) ;
669 SUIT_MessageBox::information( this, tr( "GEOM_FREE_BOUNDS_TLT" ), msg, tr( "Close" ) );
674 //=================================================================================
675 // function : activateSelection
676 // purpose : Redisplay preview and Activate selection
677 //=================================================================================
678 void RepairGUI_GlueDlg::activateSelection()
680 erasePreview( false );
682 int anId = getConstructorId();
684 // Case of whole gluing
685 disconnect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
686 this, SLOT( SelectionIntoArgument() ) );
688 globalSelection( GEOM_ALLSHAPES );
689 if ( myObject->_is_nil())
690 SelectionIntoArgument();
692 connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
693 this, SLOT( SelectionIntoArgument() ) );
696 // Second case of gluing
697 if ( !mySubShapesChk->isChecked() )
698 globalSelection( GEOM_ALLSHAPES );
700 displayPreview( true, true, false, false, 2/*line width*/, 1/*display mode*/, Quantity_NOC_RED );
701 disconnect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
702 this, SLOT( SelectionIntoArgument() ) ) ;
703 globalSelection( GEOM_PREVIEW );
704 connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
705 this, SLOT( SelectionIntoArgument() ) ) ;
711 //=================================================================================
712 // function : updateButtonState
713 // purpose : Update button state
714 //=================================================================================
715 void RepairGUI_GlueDlg::updateButtonState()
717 int anId = getConstructorId();
718 bool hasMainObj = !myObject->_is_nil();
720 buttonOk()->setEnabled( hasMainObj );
721 buttonApply()->setEnabled( hasMainObj );
725 LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
726 SALOME_ListIO aSelList;
727 aSelMgr->selectedObjects(aSelList);
729 SALOME_ListIteratorOfListIO it (aSelList);
730 bool wasSelected = it.More() > 0;
731 bool wasDetected = !myTmpObjs.isEmpty();
732 buttonOk()->setEnabled( hasMainObj && wasDetected && wasSelected );
733 buttonApply()->setEnabled( hasMainObj && wasDetected && wasSelected );
734 mySubShapesChk->setEnabled( hasMainObj && wasDetected );
735 myDetectBtn->setEnabled( hasMainObj );
736 if ( !hasMainObj || !wasDetected )
737 mySubShapesChk->setChecked( false );
741 //=================================================================================
742 // function : clearTemporary
743 // purpose : Remove temporary objects from engine
744 //=================================================================================
745 void RepairGUI_GlueDlg::clearTemporary()
750 //=================================================================================
751 // function : onTolerChanged
752 // purpose : Remove temporary objects from engine
753 //=================================================================================
754 void RepairGUI_GlueDlg::onTolerChanged( double /*theVal*/ )
761 //=================================================================================
762 // function : onSubShapesChk
763 // purpose : Update selection mode
764 //=================================================================================
765 void RepairGUI_GlueDlg::onSubShapesChk()
767 if ( !mySubShapesChk->isChecked() )
773 //=================================================================================
774 // function : ClickOnCancel
775 // purpose : Remove temporary objects from engine and call method of base class
776 //=================================================================================
777 void RepairGUI_GlueDlg::ClickOnCancel()
780 GEOMBase_Skeleton::ClickOnCancel();