1 // SMESH SMESHGUI : GUI for SMESH component
3 // Copyright (C) 2003 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : SMESHGUI_ExtrusionDlg.cxx
25 // Author : Michael ZORIN
29 #include "SMESHGUI_ExtrusionDlg.h"
31 #include "SMESHGUI_SpinBox.h"
32 #include "SMESHGUI_Utils.h"
33 #include "SMESHGUI_VTKUtils.h"
34 #include "SMESHGUI_MeshUtils.h"
35 #include "SMESHGUI_IdValidator.h"
36 #include "SMESH_Actor.h"
37 #include "SMESH_TypeFilter.hxx"
38 #include "SMDS_Mesh.hxx"
40 #include "QAD_Application.h"
41 #include "QAD_Desktop.h"
42 #include "QAD_MessageBox.h"
43 #include "utilities.h"
46 #include <qapplication.h>
47 #include <qbuttongroup.h>
48 #include <qgroupbox.h>
50 #include <qlineedit.h>
51 #include <qpushbutton.h>
52 #include <qradiobutton.h>
53 #include <qcheckbox.h>
56 #include <qvalidator.h>
60 #include "SALOMEconfig.h"
61 #include CORBA_SERVER_HEADER(SMESH_Group)
65 //=================================================================================
66 // class : SMESHGUI_ExtrusionDlg()
68 //=================================================================================
69 SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg( QWidget* parent, const char* name, SALOME_Selection* Sel,
70 bool modal, WFlags fl )
71 : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu |
72 Qt::WDestructiveClose)
74 QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_EDGE")));
75 QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_TRIANGLE")));
76 QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT")));
79 setName( "SMESHGUI_ExtrusionDlg" );
81 setCaption( tr( "EXTRUSION_ALONG_LINE" ) );
82 setSizeGripEnabled( TRUE );
83 SMESHGUI_ExtrusionDlgLayout = new QGridLayout( this );
84 SMESHGUI_ExtrusionDlgLayout->setSpacing( 6 );
85 SMESHGUI_ExtrusionDlgLayout->setMargin( 11 );
87 /***************************************************************/
88 GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
89 GroupConstructors->setTitle( tr( "SMESH_EXTRUSION" ) );
90 GroupConstructors->setExclusive( TRUE );
91 GroupConstructors->setColumnLayout(0, Qt::Vertical );
92 GroupConstructors->layout()->setSpacing( 0 );
93 GroupConstructors->layout()->setMargin( 0 );
94 GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
95 GroupConstructorsLayout->setAlignment( Qt::AlignTop );
96 GroupConstructorsLayout->setSpacing( 6 );
97 GroupConstructorsLayout->setMargin( 11 );
98 RadioButton1= new QRadioButton( GroupConstructors, "RadioButton1" );
99 RadioButton1->setText( tr( "" ) );
100 RadioButton1->setPixmap( image0 );
101 GroupConstructorsLayout->addWidget( RadioButton1, 0, 0 );
102 RadioButton2= new QRadioButton( GroupConstructors, "RadioButton2" );
103 RadioButton2->setText( tr( "" ) );
104 RadioButton2->setPixmap( image1 );
105 GroupConstructorsLayout->addWidget( RadioButton2, 0, 2 );
106 SMESHGUI_ExtrusionDlgLayout->addWidget( GroupConstructors, 0, 0 );
108 /***************************************************************/
109 GroupButtons = new QGroupBox( this, "GroupButtons" );
110 GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
111 GroupButtons->setTitle( tr( "" ) );
112 GroupButtons->setColumnLayout(0, Qt::Vertical );
113 GroupButtons->layout()->setSpacing( 0 );
114 GroupButtons->layout()->setMargin( 0 );
115 GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
116 GroupButtonsLayout->setAlignment( Qt::AlignTop );
117 GroupButtonsLayout->setSpacing( 6 );
118 GroupButtonsLayout->setMargin( 11 );
119 buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
120 buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) );
121 buttonCancel->setAutoDefault( TRUE );
122 GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
123 buttonApply = new QPushButton( GroupButtons, "buttonApply" );
124 buttonApply->setText( tr( "SMESH_BUT_APPLY" ) );
125 buttonApply->setAutoDefault( TRUE );
126 GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
127 QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
128 GroupButtonsLayout->addItem( spacer_9, 0, 2 );
129 buttonOk = new QPushButton( GroupButtons, "buttonOk" );
130 buttonOk->setText( tr( "SMESH_BUT_OK" ) );
131 buttonOk->setAutoDefault( TRUE );
132 buttonOk->setDefault( TRUE );
133 GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
134 SMESHGUI_ExtrusionDlgLayout->addWidget( GroupButtons, 2, 0 );
136 /***************************************************************/
137 GroupArguments = new QGroupBox( this, "GroupArguments" );
138 GroupArguments->setTitle( tr( "EXTRUSION_1D" ) );
139 GroupArguments->setColumnLayout(0, Qt::Vertical );
140 GroupArguments->layout()->setSpacing( 0 );
141 GroupArguments->layout()->setMargin( 0 );
142 GroupArgumentsLayout = new QGridLayout( GroupArguments->layout());
143 GroupArgumentsLayout->setAlignment( Qt::AlignTop );
144 GroupArgumentsLayout->setSpacing( 6 );
145 GroupArgumentsLayout->setMargin( 11 );
147 // Controls for elements selection
148 TextLabelElements = new QLabel( GroupArguments, "TextLabelElements" );
149 TextLabelElements->setText( tr( "SMESH_ID_ELEMENTS" ) );
150 TextLabelElements->setFixedWidth(74);
151 GroupArgumentsLayout->addWidget( TextLabelElements, 0, 0 );
153 SelectElementsButton = new QPushButton( GroupArguments, "SelectElementsButton" );
154 SelectElementsButton->setText( tr( "" ) );
155 SelectElementsButton->setPixmap( image2 );
156 SelectElementsButton->setToggleButton( FALSE );
157 GroupArgumentsLayout->addWidget( SelectElementsButton, 0, 1 );
159 LineEditElements = new QLineEdit( GroupArguments, "LineEditElements" );
160 LineEditElements->setValidator( new SMESHGUI_IdValidator( this, "validator" ));
161 GroupArgumentsLayout->addMultiCellWidget( LineEditElements, 0, 0, 2, 7 );
163 // Control for the whole mesh selection
164 CheckBoxMesh = new QCheckBox( GroupArguments, "CheckBoxMesh" );
165 CheckBoxMesh->setText( tr( "SMESH_SELECT_WHOLE_MESH" ) );
166 GroupArgumentsLayout->addMultiCellWidget( CheckBoxMesh, 1, 1, 0, 7 );
168 // Controls for vector selection
169 TextLabelVector = new QLabel( GroupArguments, "TextLabelVector" );
170 TextLabelVector->setText( tr( "SMESH_VECTOR" ) );
171 GroupArgumentsLayout->addWidget( TextLabelVector, 2, 0 );
173 TextLabelDx = new QLabel( GroupArguments, "TextLabelDx" );
174 TextLabelDx->setText( tr( "SMESH_DX" ) );
175 GroupArgumentsLayout->addWidget( TextLabelDx, 2, 2 );
177 SpinBox_Dx = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_Dx");
178 GroupArgumentsLayout->addWidget( SpinBox_Dx, 2, 3 );
180 TextLabelDy = new QLabel( GroupArguments, "TextLabelDy" );
181 TextLabelDy->setText( tr( "SMESH_DY" ) );
182 GroupArgumentsLayout->addWidget( TextLabelDy, 2, 4 );
184 SpinBox_Dy = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_Dy");
185 GroupArgumentsLayout->addWidget( SpinBox_Dy, 2, 5 );
187 TextLabelDz = new QLabel( GroupArguments, "TextLabelDz" );
188 TextLabelDz->setText( tr( "SMESH_DZ" ) );
189 GroupArgumentsLayout->addWidget( TextLabelDz, 2, 6 );
191 SpinBox_Dz = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_Dz");
192 GroupArgumentsLayout->addWidget( SpinBox_Dz, 2, 7 );
194 // Controls for nb. steps defining
195 TextLabelNbSteps = new QLabel( GroupArguments, "TextLabelNbSteps" );
196 TextLabelNbSteps->setText( tr( "SMESH_NUMBEROFSTEPS" ) );
197 GroupArgumentsLayout->addMultiCellWidget( TextLabelNbSteps, 3, 3, 0, 1 );
199 SpinBox_NbSteps = new QSpinBox(GroupArguments, "SpinBox_NbSteps");
200 GroupArgumentsLayout->addMultiCellWidget( SpinBox_NbSteps, 3, 3, 2, 7 );
202 SMESHGUI_ExtrusionDlgLayout->addWidget( GroupArguments, 1, 0 );
204 /* Initialisations */
205 SpinBox_Dx->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
206 SpinBox_Dy->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
207 SpinBox_Dz->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
209 QIntValidator* anIntValidator = new QIntValidator(SpinBox_NbSteps);
210 SpinBox_NbSteps->setValidator(anIntValidator);
211 SpinBox_NbSteps->setRange( 1, 999999 );
213 GroupArguments->show();
214 RadioButton1->setChecked( TRUE );
217 mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
218 mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
220 // Costruction of the logical filter
221 SMESH_ListOfFilter aListOfFilters;
222 Handle(SMESH_TypeFilter) aMeshOrSubMeshFilter = new SMESH_TypeFilter( MESHorSUBMESH );
223 if ( !aMeshOrSubMeshFilter.IsNull() )
224 aListOfFilters.Append( aMeshOrSubMeshFilter );
225 Handle(SMESH_TypeFilter) aSmeshGroupFilter = new SMESH_TypeFilter( GROUP );
226 if ( !aSmeshGroupFilter.IsNull() )
227 aListOfFilters.Append( aSmeshGroupFilter );
229 myMeshOrSubMeshOrGroupFilter = new SMESH_LogicalFilter( aListOfFilters, SMESH_LogicalFilter::LO_OR );
232 /* signals and slots connections */
233 connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
234 connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
235 connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
236 connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
238 connect( SelectElementsButton, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
239 connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
240 connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
241 /* to close dialog if study change */
242 connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
243 connect( LineEditElements, SIGNAL( textChanged( const QString& )),
244 SLOT( onTextChange( const QString& )));
245 connect( CheckBoxMesh, SIGNAL( toggled( bool )),
246 SLOT( onSelectMesh( bool )));
248 /* Move widget on the botton right corner of main widget */
250 mySMESHGUI->DefineDlgPosition( this, x, y ) ;
252 this->show() ; /* displays Dialog */
254 ConstructorsClicked(0);
257 //=================================================================================
258 // function : ~SMESHGUI_ExtrusionDlg()
259 // purpose : Destroys the object and frees any allocated resources
260 //=================================================================================
261 SMESHGUI_ExtrusionDlg::~SMESHGUI_ExtrusionDlg()
263 // no need to delete child widgets, Qt does it all for us
267 //=================================================================================
270 //=================================================================================
271 void SMESHGUI_ExtrusionDlg::Init( bool ResetControls )
275 LineEditElements->clear();
279 buttonOk->setEnabled( false );
280 buttonApply->setEnabled( false );
283 myMesh = SMESH::SMESH_Mesh::_nil();
287 SpinBox_NbSteps->setValue(1);
288 SpinBox_Dx->SetValue(0);
289 SpinBox_Dy->SetValue(0);
290 SpinBox_Dz->SetValue(0);
292 CheckBoxMesh->setChecked(false);
293 onSelectMesh( false );
298 //=================================================================================
299 // function : ConstructorsClicked()
300 // purpose : Radio button management
301 //=================================================================================
302 void SMESHGUI_ExtrusionDlg::ConstructorsClicked(int constructorId)
304 disconnect(mySelection, 0, this, 0);
306 switch(constructorId)
310 GroupArguments->setTitle( tr( "EXTRUSION_1D" ) );
311 if ( !CheckBoxMesh->isChecked() )
312 QAD_Application::getDesktop()->SetSelectionMode( EdgeSelection, true );
317 GroupArguments->setTitle( tr( "EXTRUSION_2D" ) );
318 if ( !CheckBoxMesh->isChecked() )
319 QAD_Application::getDesktop()->SetSelectionMode( FaceSelection, true );
324 myEditCurrentArgument = LineEditElements;
325 LineEditElements->setFocus();
327 if (CheckBoxMesh->isChecked())
330 connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
334 //=================================================================================
335 // function : ClickOnApply()
337 //=================================================================================
338 void SMESHGUI_ExtrusionDlg::ClickOnApply()
340 if (mySMESHGUI->ActiveStudyLocked())
345 QStringList aListElementsId = QStringList::split( " ", myElementsId, false);
347 SMESH::long_array_var anElementsId = new SMESH::long_array;
349 anElementsId->length( aListElementsId.count() );
350 for ( int i = 0; i < aListElementsId.count(); i++ )
351 anElementsId[i] = aListElementsId[i].toInt();
353 SMESH::DirStruct aVector;
354 aVector.PS.x = SpinBox_Dx->GetValue();
355 aVector.PS.y = SpinBox_Dy->GetValue();
356 aVector.PS.z = SpinBox_Dz->GetValue();
358 long aNbSteps = (long)SpinBox_NbSteps->value();
362 SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
363 QApplication::setOverrideCursor(Qt::waitCursor);
364 aMeshEditor->ExtrusionSweep(anElementsId.inout(), aVector, aNbSteps);
365 QApplication::restoreOverrideCursor();
371 mySelection->ClearIObjects();
374 ConstructorsClicked( GetConstructorId() );
378 //=================================================================================
379 // function : ClickOnOk()
381 //=================================================================================
382 void SMESHGUI_ExtrusionDlg::ClickOnOk()
389 //=================================================================================
390 // function : ClickOnCancel()
392 //=================================================================================
393 void SMESHGUI_ExtrusionDlg::ClickOnCancel()
395 mySelection->ClearFilters();
396 mySelection->ClearIObjects();
397 SMESH::SetPointRepresentation(false);
398 QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
399 disconnect( mySelection, 0, this, 0 );
400 mySMESHGUI->ResetState() ;
404 //=======================================================================
405 //function : onTextChange
407 //=======================================================================
408 void SMESHGUI_ExtrusionDlg::onTextChange(const QString& theNewText)
410 QLineEdit* send = (QLineEdit*)sender();
412 if ( myBusy ) return;
415 if (send == LineEditElements)
418 buttonOk->setEnabled( false );
419 buttonApply->setEnabled( false );
421 // hilight entered elements/nodes
422 SMDS_Mesh* aMesh = 0;
424 aMesh = myActor->GetObject()->GetMesh();
427 mySelection->ClearIObjects();
428 mySelection->AddIObject( myActor->getIO() );
430 QStringList aListId = QStringList::split( " ", theNewText, false);
432 if (send == LineEditElements) {
433 for ( int i = 0; i < aListId.count(); i++ ) {
434 const SMDS_MeshElement * e = aMesh->FindElement( aListId[ i ].toInt() );
436 if ( !mySelection->IsIndexSelected( myActor->getIO(), e->GetID() ))
437 mySelection->AddOrRemoveIndex (myActor->getIO(), e->GetID(), true);
441 myElementsId = theNewText;
445 if ( myNbOkElements ) {
446 buttonOk->setEnabled( true );
447 buttonApply->setEnabled( true );
453 //=================================================================================
454 // function : SelectionIntoArgument()
455 // purpose : Called when selection as changed or other case
456 //=================================================================================
457 void SMESHGUI_ExtrusionDlg::SelectionIntoArgument()
459 if ( myBusy ) return;
463 QString aString = "";
466 myEditCurrentArgument->setText( aString );
468 buttonOk->setEnabled( false );
469 buttonApply->setEnabled( false );
472 if ( !GroupButtons->isEnabled() ) // inactive
475 buttonOk->setEnabled( false );
476 buttonApply->setEnabled( false );
480 int nbSel = SMESH::GetNameOfSelectedIObjects(mySelection, aString);
484 Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
485 myMesh = SMESH::GetMeshByIO(IO);
486 if(myMesh->_is_nil())
488 myActor = SMESH::FindActorByObject(myMesh);
492 if (myEditCurrentArgument == LineEditElements)
497 if (CheckBoxMesh->isChecked())
499 SMESH::GetNameOfSelectedIObjects(mySelection, aString);
501 int aConstructorId = GetConstructorId();
503 if(!SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO)->_is_nil()) //MESH
506 SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
510 if (aConstructorId == 0)
512 SMDS_EdgeIteratorPtr anIter = aSMDSMesh->edgesIterator();
514 while ( anIter->more() )
516 const SMDS_MeshEdge * edge = anIter->next();
518 myElementsId += QString(" %1").arg(edge->GetID());
523 else if (aConstructorId == 1)
525 SMDS_FaceIteratorPtr anIter = aSMDSMesh->facesIterator();
526 while ( anIter->more() )
528 const SMDS_MeshFace * face = anIter->next();
530 myElementsId += QString(" %1").arg(face->GetID());
536 else if (!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil()) //SUBMESH
539 SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO) ;
541 // get IDs from submesh
542 SMESH::long_array_var anElementsIds = new SMESH::long_array;
543 if (aConstructorId == 0)
544 anElementsIds = aSubMesh->GetElementsByType(SMESH::EDGE);
545 else if (aConstructorId == 1)
546 anElementsIds = aSubMesh->GetElementsByType(SMESH::FACE);
548 for ( int i = 0; i < anElementsIds->length(); i++ )
549 myElementsId += QString(" %1").arg(anElementsIds[i]);
550 aNbElements = anElementsIds->length();
555 SMESH::SMESH_GroupBase_var aGroup =
556 SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
557 if (aGroup->_is_nil())
560 if ( (aConstructorId == 0 && aGroup->GetType()!= SMESH::EDGE) ||
561 (aConstructorId == 1 && aGroup->GetType()!= SMESH::FACE) )
564 // get IDs from smesh group
565 SMESH::long_array_var anElementsIds = new SMESH::long_array;
566 anElementsIds = aGroup->GetListOfID();
567 for ( int i = 0; i < anElementsIds->length(); i++ )
568 myElementsId += QString(" %1").arg(anElementsIds[i]);
569 aNbElements = anElementsIds->length();
574 aNbElements = SMESH::GetNameOfSelectedElements(mySelection, aString) ;
575 myElementsId = aString;
581 myNbOkElements = true;
585 myEditCurrentArgument->setText( aString );
592 buttonOk->setEnabled( true );
593 buttonApply->setEnabled( true );
598 //=================================================================================
599 // function : SetEditCurrentArgument()
601 //=================================================================================
602 void SMESHGUI_ExtrusionDlg::SetEditCurrentArgument()
604 QPushButton* send = (QPushButton*)sender();
606 disconnect( mySelection, 0, this, 0 );
607 mySelection->ClearIObjects();
608 mySelection->ClearFilters();
610 if(send == SelectElementsButton) {
611 myEditCurrentArgument = LineEditElements;
612 if (CheckBoxMesh->isChecked())
614 QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
615 mySelection->AddFilter(myMeshOrSubMeshOrGroupFilter);
619 int aConstructorId = GetConstructorId();
620 if (aConstructorId == 0)
621 QAD_Application::getDesktop()->SetSelectionMode( EdgeSelection, true );
622 else if (aConstructorId == 1)
623 QAD_Application::getDesktop()->SetSelectionMode( FaceSelection, true );
627 myEditCurrentArgument->setFocus();
628 connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
629 SelectionIntoArgument() ;
632 //=================================================================================
633 // function : DeactivateActiveDialog()
635 //=================================================================================
636 void SMESHGUI_ExtrusionDlg::DeactivateActiveDialog()
638 if ( GroupConstructors->isEnabled() ) {
639 GroupConstructors->setEnabled(false) ;
640 GroupArguments->setEnabled(false) ;
641 GroupButtons->setEnabled(false) ;
642 mySMESHGUI->ResetState() ;
643 mySMESHGUI->SetActiveDialogBox(0) ;
648 //=================================================================================
649 // function : ActivateThisDialog()
651 //=================================================================================
652 void SMESHGUI_ExtrusionDlg::ActivateThisDialog()
654 /* Emit a signal to deactivate the active dialog */
655 mySMESHGUI->EmitSignalDeactivateDialog() ;
656 GroupConstructors->setEnabled(true) ;
657 GroupArguments->setEnabled(true) ;
658 GroupButtons->setEnabled(true) ;
660 mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
662 ConstructorsClicked(GetConstructorId());
663 SelectionIntoArgument();
667 //=================================================================================
668 // function : enterEvent()
670 //=================================================================================
671 void SMESHGUI_ExtrusionDlg::enterEvent(QEvent* e)
673 if ( GroupConstructors->isEnabled() )
675 ActivateThisDialog() ;
679 //=================================================================================
680 // function : closeEvent()
682 //=================================================================================
683 void SMESHGUI_ExtrusionDlg::closeEvent( QCloseEvent* e )
685 /* same than click on cancel button */
686 this->ClickOnCancel() ;
690 //=======================================================================
691 //function : hideEvent
692 //purpose : caused by ESC key
693 //=======================================================================
695 void SMESHGUI_ExtrusionDlg::hideEvent ( QHideEvent * e )
697 if ( !isMinimized() )
702 //=======================================================================
703 //function : onSelectMesh
705 //=======================================================================
706 void SMESHGUI_ExtrusionDlg::onSelectMesh ( bool toSelectMesh )
709 TextLabelElements->setText( tr( "SMESH_NAME" ) );
711 TextLabelElements->setText( tr( "SMESH_ID_ELEMENTS" ) );
713 if (myEditCurrentArgument != LineEditElements)
715 LineEditElements->clear();
719 mySelection->ClearFilters() ;
723 QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
724 mySelection->AddFilter(myMeshOrSubMeshOrGroupFilter);
725 LineEditElements->setReadOnly(true);
729 int aConstructorId = GetConstructorId();
730 if (aConstructorId == 0)
731 QAD_Application::getDesktop()->SetSelectionMode( EdgeSelection, true );
732 else if (aConstructorId == 0)
733 QAD_Application::getDesktop()->SetSelectionMode( FaceSelection, true );
735 LineEditElements->setReadOnly(false);
736 onTextChange(LineEditElements->text());
739 SelectionIntoArgument();
743 //=================================================================================
744 // function : GetConstructorId()
746 //=================================================================================
747 int SMESHGUI_ExtrusionDlg::GetConstructorId()
749 if ( GroupConstructors != NULL && GroupConstructors->selected() != NULL )
750 return GroupConstructors->id( GroupConstructors->selected() );