Salome HOME
yfr : merge 1.2
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_AddSubMeshDlg.cxx
1 //  SMESH SMESHGUI : GUI for SMESH component
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
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. 
10 // 
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. 
15 // 
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 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : SMESHGUI_AddSubMeshDlg.cxx
25 //  Author : Nicolas REJNERI
26 //  Module : SMESH
27 //  $Header$
28
29 using namespace std;
30 #include "SMESHGUI_AddSubMeshDlg.h"
31 #include "SMESHGUI.h"
32 #include "SALOME_ListIteratorOfListIO.hxx"
33
34 #include "QAD_Application.h"
35 #include "QAD_Desktop.h"
36 #include "utilities.h"
37
38 // QT Includes
39 #include <qbuttongroup.h>
40 #include <qgroupbox.h>
41 #include <qlabel.h>
42 #include <qlineedit.h>
43 #include <qpushbutton.h>
44 #include <qradiobutton.h>
45 #include <qlayout.h>
46 #include <qvariant.h>
47 #include <qtooltip.h>
48 #include <qwhatsthis.h>
49 #include <qimage.h>
50 #include <qpixmap.h>
51
52
53 //=================================================================================
54 // class    : SMESHGUI_AddSubMeshDlg()
55 // purpose  : Constructs a SMESHGUI_AddSubMeshDlg which is a child of 'parent', with the 
56 //            name 'name' and widget flags set to 'f'.
57 //            The dialog will by default be modeless, unless you set 'modal' to
58 //            TRUE to construct a modal dialog.
59 //=================================================================================
60 SMESHGUI_AddSubMeshDlg::SMESHGUI_AddSubMeshDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
61     : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
62 {
63     QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_ADD_SUBMESH")));
64     QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT")));
65     if ( !name )
66         setName( "SMESHGUI_AddSubMeshDlg" );
67     resize( 303, 175 ); 
68     setCaption( tr( "SMESH_ADD_SUBMESH"  ) );
69     setSizeGripEnabled( TRUE );
70     SMESHGUI_AddSubMeshDlgLayout = new QGridLayout( this ); 
71     SMESHGUI_AddSubMeshDlgLayout->setSpacing( 6 );
72     SMESHGUI_AddSubMeshDlgLayout->setMargin( 11 );
73     
74     /***************************************************************/
75     GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
76     GroupConstructors->setTitle( tr( "SMESH_SUBMESH"  ) );
77     GroupConstructors->setExclusive( TRUE );
78     GroupConstructors->setColumnLayout(0, Qt::Vertical );
79     GroupConstructors->layout()->setSpacing( 0 );
80     GroupConstructors->layout()->setMargin( 0 );
81     GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
82     GroupConstructorsLayout->setAlignment( Qt::AlignTop );
83     GroupConstructorsLayout->setSpacing( 6 );
84     GroupConstructorsLayout->setMargin( 11 );
85     Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
86     Constructor1->setText( tr( ""  ) );
87     Constructor1->setPixmap( image1 );
88     Constructor1->setChecked( TRUE );
89     Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
90     Constructor1->setMinimumSize( QSize( 50, 0 ) );
91     GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
92     QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
93     GroupConstructorsLayout->addItem( spacer, 0, 1 );
94     SMESHGUI_AddSubMeshDlgLayout->addWidget( GroupConstructors, 0, 0 );
95     
96     /***************************************************************/
97     GroupButtons = new QGroupBox( this, "GroupButtons" );
98     GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); 
99     GroupButtons->setTitle( tr( ""  ) );
100     GroupButtons->setColumnLayout(0, Qt::Vertical );
101     GroupButtons->layout()->setSpacing( 0 );
102     GroupButtons->layout()->setMargin( 0 );
103     GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
104     GroupButtonsLayout->setAlignment( Qt::AlignTop );
105     GroupButtonsLayout->setSpacing( 6 );
106     GroupButtonsLayout->setMargin( 11 );
107     buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
108     buttonCancel->setText( tr( "SMESH_BUT_CLOSE"  ) );
109     buttonCancel->setAutoDefault( TRUE );
110     GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
111     buttonApply = new QPushButton( GroupButtons, "buttonApply" );
112     buttonApply->setText( tr( "SMESH_BUT_APPLY"  ) );
113     buttonApply->setAutoDefault( TRUE );
114     GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
115     QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
116     GroupButtonsLayout->addItem( spacer_9, 0, 2 );
117     buttonOk = new QPushButton( GroupButtons, "buttonOk" );
118     buttonOk->setText( tr( "SMESH_BUT_OK"  ) );
119     buttonOk->setAutoDefault( TRUE );
120     buttonOk->setDefault( TRUE );
121     GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
122     SMESHGUI_AddSubMeshDlgLayout->addWidget( GroupButtons, 2, 0 );
123
124     /***************************************************************/
125     GroupC1 = new QGroupBox( this, "GroupC1" );
126     GroupC1->setTitle( tr( "SMESH_ARGUMENTS"  ) );
127     GroupC1->setMinimumSize( QSize( 0, 0 ) );
128     GroupC1->setFrameShape( QGroupBox::Box );
129     GroupC1->setFrameShadow( QGroupBox::Sunken );
130     GroupC1->setColumnLayout(0, Qt::Vertical );
131     GroupC1->layout()->setSpacing( 0 );
132     GroupC1->layout()->setMargin( 0 );
133     GroupC1Layout = new QGridLayout( GroupC1->layout() );
134     GroupC1Layout->setAlignment( Qt::AlignTop );
135     GroupC1Layout->setSpacing( 6 );
136     GroupC1Layout->setMargin( 11 );
137
138     TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
139     TextLabelC1A1->setText( tr( "SMESH_OBJECT_MESH"  ) );
140     TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
141     TextLabelC1A1->setFrameShape( QLabel::NoFrame );
142     TextLabelC1A1->setFrameShadow( QLabel::Plain );
143     GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 );
144     SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
145     SelectButtonC1A1->setText( tr( ""  ) );
146     SelectButtonC1A1->setPixmap( image0 );
147     SelectButtonC1A1->setToggleButton( FALSE );
148     GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
149     LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
150     GroupC1Layout->addWidget( LineEditC1A1, 0, 2 );
151
152     TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" );
153     TextLabelC1A2->setText( tr( "SMESH_OBJECT_GEOM"  ) );
154     TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) );
155     TextLabelC1A2->setFrameShape( QLabel::NoFrame );
156     TextLabelC1A2->setFrameShadow( QLabel::Plain );
157     GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 );
158     SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" );
159     SelectButtonC1A2->setText( tr( ""  ) );
160     SelectButtonC1A2->setPixmap( image0 );
161     SelectButtonC1A2->setToggleButton( FALSE );
162     GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 );
163     LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" );
164     GroupC1Layout->addWidget( LineEditC1A2, 1, 2 );
165
166     TextLabel_NameMesh = new QLabel( GroupC1, "TextLabel_NameMesh" );
167     TextLabel_NameMesh->setText( tr( "SMESH_NAME"  ) );
168     GroupC1Layout->addWidget( TextLabel_NameMesh, 2, 0 );
169     LineEdit_NameMesh = new QLineEdit( GroupC1, "LineEdit_NameMesh" );
170     GroupC1Layout->addWidget( LineEdit_NameMesh, 2, 2 );
171
172     TextLabelC1A1Hyp = new QLabel( GroupC1, "TextLabelC1A1Hyp" );
173     TextLabelC1A1Hyp->setText( tr( "SMESH_OBJECT_HYPOTHESIS" ) );
174     TextLabelC1A1Hyp->setMinimumSize( QSize( 50, 0 ) );
175     TextLabelC1A1Hyp->setFrameShape( QLabel::NoFrame );
176     TextLabelC1A1Hyp->setFrameShadow( QLabel::Plain );
177     GroupC1Layout->addWidget( TextLabelC1A1Hyp, 3, 0 );
178     SelectButtonC1A1Hyp = new QPushButton( GroupC1, "SelectButtonC1A1Hyp" );
179     SelectButtonC1A1Hyp->setText( tr( ""  ) );
180     SelectButtonC1A1Hyp->setPixmap( image0 );
181     GroupC1Layout->addWidget( SelectButtonC1A1Hyp, 3, 1 );
182     LineEditC1A1Hyp = new QLineEdit( GroupC1, "LineEditC1A1Hyp" );
183     LineEditC1A1Hyp->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1Hyp->sizePolicy().hasHeightForWidth() ) );
184     GroupC1Layout->addWidget( LineEditC1A1Hyp, 3, 2 );
185
186     TextLabelC1A1Algo = new QLabel( GroupC1, "TextLabelC1A1Algo" );
187     TextLabelC1A1Algo->setText( tr( "SMESH_OBJECT_ALGORITHM" ) );
188     TextLabelC1A1Algo->setMinimumSize( QSize( 50, 0 ) );
189     TextLabelC1A1Algo->setFrameShape( QLabel::NoFrame );
190     TextLabelC1A1Algo->setFrameShadow( QLabel::Plain );
191     GroupC1Layout->addWidget( TextLabelC1A1Algo, 4, 0 );
192     SelectButtonC1A1Algo = new QPushButton( GroupC1, "SelectButtonC1A1Algo" );
193     SelectButtonC1A1Algo->setText( tr( ""  ) );
194     SelectButtonC1A1Algo->setPixmap( image0 );
195     GroupC1Layout->addWidget( SelectButtonC1A1Algo, 4, 1 );
196     LineEditC1A1Algo = new QLineEdit( GroupC1, "LineEditC1A1Algo" );
197     LineEditC1A1Algo->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1Algo->sizePolicy().hasHeightForWidth() ) );
198     GroupC1Layout->addWidget( LineEditC1A1Algo, 4, 2 );
199
200     SMESHGUI_AddSubMeshDlgLayout->addWidget( GroupC1, 1, 0 );
201     /***************************************************************/
202
203     Init(Sel) ;
204 }
205
206
207 //=================================================================================
208 // function : ~SMESHGUI_AddSubMeshDlg()
209 // purpose  : Destroys the object and frees any allocated resources
210 //=================================================================================
211 SMESHGUI_AddSubMeshDlg::~SMESHGUI_AddSubMeshDlg()
212 {
213     // no need to delete child widgets, Qt does it all for us
214 }
215
216
217 //=================================================================================
218 // function : Init()
219 // purpose  :
220 //=================================================================================
221 void SMESHGUI_AddSubMeshDlg::Init( SALOME_Selection* Sel )
222 {
223   GroupC1->show();
224   myConstructorId = 0 ;
225   Constructor1->setChecked( TRUE );
226   myEditCurrentArgument = LineEditC1A1 ;        
227   mySelection = Sel;
228   mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
229   mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
230
231   myGeomFilter = new SALOME_TypeFilter( "GEOM" );
232   myMeshFilter = new SMESH_TypeFilter( MESH );
233
234   myAlgorithmFilter = new SMESH_TypeFilter( ALGORITHM );
235   myHypothesisFilter = new SMESH_TypeFilter( HYPOTHESIS );
236
237   myNameSubMesh = "SubMesh";
238
239   myGeomShape = GEOM::GEOM_Shape::_nil();
240   myMesh = SMESH::SMESH_Mesh::_nil();
241
242   /* signals and slots connections */
243   connect( buttonOk, SIGNAL( clicked() ),     this, SLOT( ClickOnOk() ) );
244   connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
245   connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
246   connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
247
248   connect( SelectButtonC1A1, SIGNAL (clicked() ),   this, SLOT( SetEditCurrentArgument() ) ) ;
249   connect( SelectButtonC1A2, SIGNAL (clicked() ),   this, SLOT( SetEditCurrentArgument() ) ) ;
250   connect( LineEdit_NameMesh, SIGNAL (textChanged(const QString&)  ), this, SLOT( TextChangedInLineEdit(const QString&) ) ) ;
251
252   connect( SelectButtonC1A1Hyp, SIGNAL (clicked() ),  this, SLOT( SetEditCurrentArgument() ) ) ;
253   connect( SelectButtonC1A1Algo, SIGNAL (clicked() ),  this, SLOT( SetEditCurrentArgument() ) ) ;
254
255   connect( mySelection, SIGNAL( currentSelectionChanged() ),     this, SLOT( SelectionIntoArgument() ) );
256   connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
257   connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
258   
259   int x, y ;
260   mySMESHGUI->DefineDlgPosition( this, x, y ) ;
261   this->move( x, y ) ;
262   this->show() ; 
263
264   SelectionIntoArgument();
265
266   return ;
267 }
268
269
270 //=================================================================================
271 // function : ConstructorsClicked()
272 // purpose  : Radio button management
273 //=================================================================================
274 void SMESHGUI_AddSubMeshDlg::ConstructorsClicked(int constructorId)
275 {
276   return ;
277 }
278
279 //=================================================================================
280 // function : ClickOnOk()
281 // purpose  :
282 //=================================================================================
283 void SMESHGUI_AddSubMeshDlg::ClickOnOk()
284 {
285   this->ClickOnApply() ;
286   this->ClickOnCancel() ;
287 }
288
289 //=================================================================================
290 // function : ClickOnApply()
291 // purpose  :
292 //=================================================================================
293 void SMESHGUI_AddSubMeshDlg::ClickOnApply()
294 {
295   switch(myConstructorId)
296     { 
297     case 0 :
298       { 
299         if ( !myNameSubMesh.isEmpty() && !myNameSubMesh.isNull() && 
300              !myGeomShape->_is_nil() && !myMesh->_is_nil()) {
301           mySubMesh = mySMESHGUI->AddSubMesh( myMesh, myGeomShape, myNameSubMesh ) ;
302         }
303         
304         if( myOkHypothesis && !mySubMesh->_is_nil() ) {
305           SALOME_ListIteratorOfListIO It( HypoList );
306           for(;It.More();It.Next()) {
307             Handle(SALOME_InteractiveObject) IObject = It.Value();
308             Standard_Boolean testResult;
309             myHypothesis = mySMESHGUI->ConvertIOinSMESHHypothesis(IObject, testResult) ;
310             if( testResult )
311               mySMESHGUI->AddHypothesisOnSubMesh(mySubMesh, myHypothesis) ;
312           }
313         }
314
315         if( myOkAlgorithm && !mySubMesh->_is_nil() ) {
316           SALOME_ListIteratorOfListIO It( AlgoList );
317           for(;It.More();It.Next()) {
318             Handle(SALOME_InteractiveObject) IObject = It.Value();
319             Standard_Boolean testResult;
320             myAlgorithm = mySMESHGUI->ConvertIOinSMESHHypothesis(IObject, testResult) ;
321             if( testResult )
322               mySMESHGUI->AddAlgorithmOnSubMesh(mySubMesh, myAlgorithm) ;
323           }
324         }
325         
326         break ;
327       }
328     }
329 }
330
331
332 //=================================================================================
333 // function : ClickOnCancel()
334 // purpose  :
335 //=================================================================================
336 void SMESHGUI_AddSubMeshDlg::ClickOnCancel()
337 {
338   disconnect( mySelection, 0, this, 0 );
339   mySMESHGUI->ResetState() ;
340   mySelection->ClearFilters() ;
341   reject() ;
342   return ;
343 }
344
345
346 //=================================================================================
347 // function : SelectionIntoArgument()
348 // purpose  : Called when selection as changed or other case
349 //=================================================================================
350 void SMESHGUI_AddSubMeshDlg::SelectionIntoArgument()
351 {
352   myEditCurrentArgument->setText("") ;
353   QString aString = ""; 
354
355   int nbSel = mySMESHGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
356
357   switch (myConstructorId) 
358     {
359     case 0:
360       {
361         if ( myEditCurrentArgument == LineEditC1A1 ) {
362           if ( nbSel != 1 ) {
363             myOkHypothesis = false;
364             myOkAlgorithm = false;
365             return ;
366           } else {
367             Standard_Boolean testResult ;
368             Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
369             myMesh = mySMESHGUI->ConvertIOinMesh(IO, testResult) ;
370             if( !testResult ) {
371               myMesh = SMESH::SMESH_Mesh::_nil();
372               return ;
373             }
374           }
375         } else if ( myEditCurrentArgument == LineEditC1A2 ) {
376           if ( nbSel != 1 ) {
377             myOkHypothesis = false;
378             myOkAlgorithm = false;
379             return ;
380           } else {
381             Standard_Boolean testResult ;
382             Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
383             myGeomShape = mySMESHGUI->ConvertIOinGEOMShape(IO, testResult) ;
384             if( !testResult ) {
385               myGeomShape = GEOM::GEOM_Shape::_nil();
386               return ;
387             }
388           }
389         } else if ( myEditCurrentArgument == LineEditC1A1Hyp ) {
390           if ( nbSel >= 1 ) {
391             HypoList.Clear();
392             SALOME_ListIteratorOfListIO Itinit( mySelection->StoredIObjects() );
393             for (; Itinit.More(); Itinit.Next()) {
394               HypoList.Append(Itinit.Value());
395             }
396             myOkHypothesis = true ;
397             if (nbSel > 1)
398               aString = tr("%1 Hypothesis").arg(nbSel) ;
399             LineEditC1A1Hyp->setText(aString) ;
400           }
401           else {
402             myOkHypothesis = false ;
403             return ;
404           }
405         } else if ( myEditCurrentArgument == LineEditC1A1Algo ) {
406           if ( nbSel >= 1 ) {
407             AlgoList.Clear(); 
408             SALOME_ListIteratorOfListIO Itinit( mySelection->StoredIObjects() );
409             for (; Itinit.More(); Itinit.Next()) {
410               AlgoList.Append(Itinit.Value());
411             }
412             myOkAlgorithm = true ;
413             if (nbSel > 1)
414               aString = tr("%1 Algorithms").arg(nbSel) ;
415             LineEditC1A1Algo->setText(aString) ;
416           }
417           else {
418             myOkAlgorithm = false ;
419             return ;
420           }
421         }
422         break;
423       }
424     }
425   
426   myEditCurrentArgument->setText(aString) ;
427 }
428
429
430 //=================================================================================
431 // function : SetEditCurrentArgument()
432 // purpose  :
433 //=================================================================================
434 void SMESHGUI_AddSubMeshDlg::SetEditCurrentArgument()
435 {
436   QPushButton* send = (QPushButton*)sender();
437   switch (myConstructorId)
438     {
439     case 0: /* default constructor */
440       { 
441         if(send == SelectButtonC1A1) {
442           LineEditC1A1->setFocus() ;
443           myEditCurrentArgument = LineEditC1A1;
444           mySelection->ClearFilters() ;   
445           mySelection->AddFilter(myMeshFilter) ;
446         } else if (send == SelectButtonC1A2) {
447           LineEditC1A2->setFocus() ;
448           myEditCurrentArgument = LineEditC1A2;
449           mySelection->ClearFilters() ;
450           mySelection->AddFilter(myGeomFilter) ;
451         } else if( send == SelectButtonC1A1Hyp ) {
452           LineEditC1A1Hyp->setFocus() ;
453           myEditCurrentArgument = LineEditC1A1Hyp ;
454           mySelection->ClearFilters() ;   
455           mySelection->AddFilter(myHypothesisFilter) ;
456         } else if( send == SelectButtonC1A1Algo ) {
457           LineEditC1A1Algo->setFocus() ;
458           myEditCurrentArgument = LineEditC1A1Algo ;
459           mySelection->ClearFilters() ;   
460           mySelection->AddFilter(myAlgorithmFilter) ;
461         }
462         SelectionIntoArgument() ;
463         break;
464       }
465     }
466   return ;
467 }
468
469 //=================================================================================
470 // function : DeactivateActiveDialog()
471 // purpose  :
472 //=================================================================================
473 void SMESHGUI_AddSubMeshDlg::DeactivateActiveDialog()
474 {
475   if ( GroupConstructors->isEnabled() ) {
476     disconnect( mySelection, 0, this, 0 );
477     GroupConstructors->setEnabled(false) ;
478     GroupC1->setEnabled(false) ;
479     GroupButtons->setEnabled(false) ;
480   }
481 }
482
483
484 //=================================================================================
485 // function : ActivateThisDialog()
486 // purpose  :
487 //=================================================================================
488 void SMESHGUI_AddSubMeshDlg::ActivateThisDialog()
489 {
490   mySMESHGUI->EmitSignalDeactivateDialog() ;   
491   GroupConstructors->setEnabled(true) ;
492   GroupC1->setEnabled(true) ;
493   GroupButtons->setEnabled(true) ;
494   connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
495   return ;
496 }
497
498
499 //=================================================================================
500 // function : enterEvent()
501 // purpose  :
502 //=================================================================================
503 void SMESHGUI_AddSubMeshDlg::enterEvent(QEvent* e)
504 {
505   if ( GroupConstructors->isEnabled() )
506     return ;  
507   ActivateThisDialog() ;
508   return ;
509 }
510
511
512 //=================================================================================
513 // function : closeEvent()
514 // purpose  :
515 //=================================================================================
516 void SMESHGUI_AddSubMeshDlg::closeEvent( QCloseEvent* e )
517 {
518   this->ClickOnCancel() ;
519   return ;
520 }
521
522 //=================================================================================
523 // function : TextChangedInLineEdit()
524 // purpose  :
525 //=================================================================================
526 void SMESHGUI_AddSubMeshDlg::TextChangedInLineEdit(const QString& newText)
527 {  
528   QLineEdit* send = (QLineEdit*)sender();
529   QString newT = strdup(newText) ;
530   
531   if (send == LineEdit_NameMesh) {
532     myNameSubMesh = newText;
533   }
534   return ;
535 }