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.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File : SMESHGUI_ExtrusionDlg.cxx
23 // Author : Michael ZORIN, Open CASCADE S.A.S.
27 #include "SMESHGUI_ExtrusionDlg.h"
30 #include "SMESHGUI_Utils.h"
31 #include "SMESHGUI_VTKUtils.h"
32 #include "SMESHGUI_MeshUtils.h"
33 #include "SMESHGUI_SpinBox.h"
34 #include "SMESHGUI_IdValidator.h"
36 #include <SMESH_Actor.h>
37 #include <SMESH_TypeFilter.hxx>
38 #include <SMESH_LogicalFilter.hxx>
40 #include <SMDS_Mesh.hxx>
42 // SALOME GUI includes
43 #include <SUIT_ResourceMgr.h>
44 #include <SUIT_Desktop.h>
45 #include <SUIT_MessageBox.h>
46 #include <SUIT_Session.h>
48 #include <LightApp_Application.h>
49 #include <LightApp_SelectionMgr.h>
51 #include <SVTK_ViewModel.h>
52 #include <SVTK_ViewWindow.h>
55 #include <TColStd_MapOfInteger.hxx>
56 #include <TColStd_IndexedMapOfInteger.hxx>
59 #include <QApplication>
60 #include <QButtonGroup>
64 #include <QPushButton>
65 #include <QRadioButton>
68 #include <QHBoxLayout>
69 #include <QVBoxLayout>
70 #include <QGridLayout>
74 #include <SALOMEconfig.h>
75 #include CORBA_SERVER_HEADER(SMESH_Group)
76 #include CORBA_SERVER_HEADER(SMESH_MeshEditor)
81 //=================================================================================
82 // function : SMESHGUI_ExtrusionDlg()
83 // purpose : constructor
84 //=================================================================================
85 SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule)
86 : QDialog( SMESH::GetDesktop( theModule ) ),
87 mySMESHGUI( theModule ),
88 mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
90 QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_EDGE")));
91 QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_TRIANGLE")));
92 QPixmap image2 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
95 setAttribute( Qt::WA_DeleteOnClose, true );
96 setWindowTitle(tr("EXTRUSION_ALONG_LINE"));
97 setSizeGripEnabled(true);
99 QVBoxLayout* SMESHGUI_ExtrusionDlgLayout = new QVBoxLayout(this);
100 SMESHGUI_ExtrusionDlgLayout->setSpacing(SPACING);
101 SMESHGUI_ExtrusionDlgLayout->setMargin(MARGIN);
103 /***************************************************************/
104 ConstructorsBox = new QGroupBox(tr("SMESH_EXTRUSION"), this);
105 GroupConstructors = new QButtonGroup(this);
106 QHBoxLayout* ConstructorsBoxLayout = new QHBoxLayout(ConstructorsBox);
107 ConstructorsBoxLayout->setSpacing(SPACING);
108 ConstructorsBoxLayout->setMargin(MARGIN);
110 RadioButton1= new QRadioButton(ConstructorsBox);
111 RadioButton1->setIcon(image0);
112 RadioButton2= new QRadioButton(ConstructorsBox);
113 RadioButton2->setIcon(image1);
115 ConstructorsBoxLayout->addWidget(RadioButton1);
116 ConstructorsBoxLayout->addWidget(RadioButton2);
118 GroupConstructors->addButton(RadioButton1, 0);
119 GroupConstructors->addButton(RadioButton2, 1);
121 /***************************************************************/
122 GroupButtons = new QGroupBox(this);
123 QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons);
124 GroupButtonsLayout->setSpacing(SPACING);
125 GroupButtonsLayout->setMargin(MARGIN);
127 buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons);
128 buttonOk->setAutoDefault(true);
129 buttonOk->setDefault(true);
130 buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons);
131 buttonApply->setAutoDefault(true);
132 buttonCancel = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons);
133 buttonCancel->setAutoDefault(true);
134 buttonHelp = new QPushButton(tr("SMESH_BUT_HELP"), GroupButtons);
135 buttonHelp->setAutoDefault(true);
137 GroupButtonsLayout->addWidget(buttonOk);
138 GroupButtonsLayout->addSpacing(10);
139 GroupButtonsLayout->addWidget(buttonApply);
140 GroupButtonsLayout->addSpacing(10);
141 GroupButtonsLayout->addStretch();
142 GroupButtonsLayout->addWidget(buttonCancel);
143 GroupButtonsLayout->addWidget(buttonHelp);
145 /***************************************************************/
146 GroupArguments = new QGroupBox(tr("EXTRUSION_1D"), this);
147 QGridLayout* GroupArgumentsLayout = new QGridLayout(GroupArguments);
148 GroupArgumentsLayout->setSpacing(SPACING);
149 GroupArgumentsLayout->setMargin(MARGIN);
151 myIdValidator = new SMESHGUI_IdValidator(this);
153 // Controls for elements selection
154 TextLabelElements = new QLabel(tr("SMESH_ID_ELEMENTS"), GroupArguments);
156 SelectElementsButton = new QPushButton(GroupArguments);
157 SelectElementsButton->setIcon(image2);
159 LineEditElements = new QLineEdit(GroupArguments);
160 LineEditElements->setValidator(myIdValidator);
162 // Control for the whole mesh selection
163 CheckBoxMesh = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments);
165 // Controls for vector selection
166 TextLabelVector = new QLabel(tr("SMESH_VECTOR"), GroupArguments);
168 TextLabelDx = new QLabel(tr("SMESH_DX"), GroupArguments);
169 SpinBox_Dx = new SMESHGUI_SpinBox(GroupArguments);
171 TextLabelDy = new QLabel(tr("SMESH_DY"), GroupArguments);
172 SpinBox_Dy = new SMESHGUI_SpinBox(GroupArguments);
174 TextLabelDz = new QLabel(tr("SMESH_DZ"), GroupArguments);
175 SpinBox_Dz = new SMESHGUI_SpinBox(GroupArguments);
177 // Controls for nb. steps defining
178 TextLabelNbSteps = new QLabel(tr("SMESH_NUMBEROFSTEPS"), GroupArguments);
179 SpinBox_NbSteps = new QSpinBox(GroupArguments);
181 // CheckBox for groups generation
182 MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
184 GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
185 GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
186 GroupArgumentsLayout->addWidget(LineEditElements, 0, 2, 1, 6);
187 GroupArgumentsLayout->addWidget(CheckBoxMesh, 1, 0, 1, 8);
188 GroupArgumentsLayout->addWidget(TextLabelVector, 2, 0);
189 GroupArgumentsLayout->addWidget(TextLabelDx, 2, 2);
190 GroupArgumentsLayout->addWidget(SpinBox_Dx, 2, 3);
191 GroupArgumentsLayout->addWidget(TextLabelDy, 2, 4);
192 GroupArgumentsLayout->addWidget(SpinBox_Dy, 2, 5);
193 GroupArgumentsLayout->addWidget(TextLabelDz, 2, 6);
194 GroupArgumentsLayout->addWidget(SpinBox_Dz, 2, 7);
195 GroupArgumentsLayout->addWidget(TextLabelNbSteps, 3, 0);
196 GroupArgumentsLayout->addWidget(SpinBox_NbSteps, 3, 2, 1, 6);
197 GroupArgumentsLayout->addWidget(MakeGroupsCheck, 4, 0, 1, 8);
199 /***************************************************************/
200 SMESHGUI_ExtrusionDlgLayout->addWidget(ConstructorsBox);
201 SMESHGUI_ExtrusionDlgLayout->addWidget(GroupArguments);
202 SMESHGUI_ExtrusionDlgLayout->addWidget(GroupButtons);
204 /* Initialisations */
205 SpinBox_Dx->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
206 SpinBox_Dy->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
207 SpinBox_Dz->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
209 SpinBox_NbSteps->setRange(1, 999999);
211 RadioButton1->setChecked(true);
212 MakeGroupsCheck->setChecked(true);
214 mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
216 mySMESHGUI->SetActiveDialogBox(this);
218 // Costruction of the logical filter for the elements: mesh/sub-mesh/group
219 SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH);
220 SMESH_TypeFilter* aSmeshGroupFilter = new SMESH_TypeFilter (GROUP);
222 QList<SUIT_SelectionFilter*> aListOfFilters;
223 if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter);
224 if (aSmeshGroupFilter) aListOfFilters.append(aSmeshGroupFilter);
226 myMeshOrSubMeshOrGroupFilter =
227 new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR);
229 myHelpFileName = "extrusion_page.html";
233 /***************************************************************/
234 // signals and slots connections
235 connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
236 connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
237 connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
238 connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp()));
240 // to update state of the Ok & Apply buttons
241 connect(SpinBox_Dx, SIGNAL(valueChanged(double)), SLOT(CheckIsEnable()));
242 connect(SpinBox_Dy, SIGNAL(valueChanged(double)), SLOT(CheckIsEnable()));
243 connect(SpinBox_Dz, SIGNAL(valueChanged(double)), SLOT(CheckIsEnable()));
245 connect(GroupConstructors, SIGNAL(buttonClicked(int)), SLOT(ConstructorsClicked(int)));
246 connect(SelectElementsButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
247 connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
248 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
249 /* to close dialog if study change */
250 connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
251 connect(LineEditElements, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
252 connect(CheckBoxMesh, SIGNAL(toggled(bool)), SLOT(onSelectMesh(bool)));
254 /***************************************************************/
256 ConstructorsClicked(0);
257 SelectionIntoArgument();
260 //=================================================================================
261 // function : ~SMESHGUI_ExtrusionDlg()
262 // purpose : destructor
263 //=================================================================================
264 SMESHGUI_ExtrusionDlg::~SMESHGUI_ExtrusionDlg()
268 //=================================================================================
270 // purpose : initialization
271 //=================================================================================
272 void SMESHGUI_ExtrusionDlg::Init (bool ResetControls)
276 LineEditElements->clear();
280 myMesh = SMESH::SMESH_Mesh::_nil();
283 SpinBox_NbSteps->setValue(1);
284 SpinBox_Dx->SetValue(0);
285 SpinBox_Dy->SetValue(0);
286 SpinBox_Dz->SetValue(0);
288 CheckBoxMesh->setChecked(false);
295 //=================================================================================
296 // function : CheckIsEnable()
297 // purpose : Check whether the Ok and Apply buttons should be enabled or not
298 //=================================================================================
299 void SMESHGUI_ExtrusionDlg::CheckIsEnable()
301 double aX = SpinBox_Dx->GetValue();
302 double aY = SpinBox_Dy->GetValue();
303 double aZ = SpinBox_Dz->GetValue();
304 double aModule = sqrt(aX*aX + aY*aY + aZ*aZ);
306 bool anIsEnable = myNbOkElements > 0 && aModule > 1.0E-38;
308 buttonOk->setEnabled(anIsEnable);
309 buttonApply->setEnabled(anIsEnable);
312 //=================================================================================
313 // function : ConstructorsClicked()
314 // purpose : Radio button management
315 //=================================================================================
316 void SMESHGUI_ExtrusionDlg::ConstructorsClicked (int constructorId)
318 disconnect(mySelectionMgr, 0, this, 0);
320 switch (constructorId) {
323 GroupArguments->setTitle(tr("EXTRUSION_1D"));
324 if (!CheckBoxMesh->isChecked())
326 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
327 aViewWindow->SetSelectionMode(EdgeSelection);
333 GroupArguments->setTitle(tr("EXTRUSION_2D"));
334 if (!CheckBoxMesh->isChecked())
336 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
337 aViewWindow->SetSelectionMode(FaceSelection);
343 myEditCurrentArgument = LineEditElements;
344 LineEditElements->setFocus();
346 if (CheckBoxMesh->isChecked())
349 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
352 //=================================================================================
353 // function : ClickOnApply()
354 // purpose : Called when user presses <Apply> button
355 //=================================================================================
356 bool SMESHGUI_ExtrusionDlg::ClickOnApply()
358 if (mySMESHGUI->isActiveStudyLocked())
361 if (myNbOkElements) {
363 SMESH::DirStruct aVector;
364 aVector.PS.x = SpinBox_Dx->GetValue();
365 aVector.PS.y = SpinBox_Dy->GetValue();
366 aVector.PS.z = SpinBox_Dz->GetValue();
368 long aNbSteps = (long)SpinBox_NbSteps->value();
371 SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
372 QApplication::setOverrideCursor(Qt::WaitCursor);
374 if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
375 SMESH::ListOfGroups_var groups =
376 aMeshEditor->ExtrusionSweepMakeGroups(myElementsId.inout(), aVector, aNbSteps);
378 aMeshEditor->ExtrusionSweep(myElementsId.inout(), aVector, aNbSteps);
380 QApplication::restoreOverrideCursor();
385 if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
386 mySMESHGUI->updateObjBrowser(true); // new groups may appear
388 ConstructorsClicked(GetConstructorId());
389 SelectionIntoArgument();
394 //=================================================================================
395 // function : ClickOnOk()
396 // purpose : Called when user presses <OK> button
397 //=================================================================================
398 void SMESHGUI_ExtrusionDlg::ClickOnOk()
404 //=================================================================================
405 // function : ClickOnCancel()
406 // purpose : Called when dialog box is closed
407 //=================================================================================
408 void SMESHGUI_ExtrusionDlg::ClickOnCancel()
410 disconnect(mySelectionMgr, 0, this, 0);
411 mySelectionMgr->clearFilters();
412 //mySelectionMgr->clearSelected();
413 SMESH::SetPickable(); // ???
414 SMESH::SetPointRepresentation(false);
415 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
416 aViewWindow->SetSelectionMode(ActorSelection);
417 mySMESHGUI->ResetState();
421 //=================================================================================
422 // function : ClickOnHelp()
424 //=================================================================================
425 void SMESHGUI_ExtrusionDlg::ClickOnHelp()
427 LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
429 app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
433 platform = "winapplication";
435 platform = "application";
437 SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
438 tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
439 arg(app->resourceMgr()->stringValue("ExternalBrowser",
441 arg(myHelpFileName));
445 //=================================================================================
446 // function : onTextChange()
448 //=================================================================================
449 void SMESHGUI_ExtrusionDlg::onTextChange (const QString& theNewText)
451 QLineEdit* send = (QLineEdit*)sender();
459 if (send == LineEditElements)
462 // hilight entered elements/nodes
464 if (!myIO.IsNull()) {
465 QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
467 if (send == LineEditElements)
469 SMDS_Mesh* aMesh = myActor ? myActor->GetObject()->GetMesh() : 0;
470 SMESH::ElementType SMESHType = GetConstructorId() ? SMESH::FACE : SMESH::EDGE;
471 SMDSAbs_ElementType SMDSType = GetConstructorId() ? SMDSAbs_Face: SMDSAbs_Edge;
473 myElementsId = new SMESH::long_array;
474 myElementsId->length( aListId.count() );
475 TColStd_MapOfInteger newIndices;
476 for (int i = 0; i < aListId.count(); i++) {
477 int id = aListId[ i ].toInt();
478 bool validId = false;
481 const SMDS_MeshElement * e = aMesh->FindElement( id );
482 validId = ( e && e->GetType() == SMDSType );
484 validId = ( myMesh->GetElementType( id, true ) == SMESHType );
487 if ( validId && newIndices.Add( id ))
488 myElementsId[ newIndices.Extent()-1 ] = id;
490 myElementsId->length( myNbOkElements = newIndices.Extent() );
491 mySelector->AddOrRemoveIndex(myIO, newIndices, false);
492 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
493 aViewWindow->highlight( myIO, true, true );
502 //=================================================================================
503 // function : SelectionIntoArgument()
504 // purpose : Called when selection as changed or other case
505 //=================================================================================
506 void SMESHGUI_ExtrusionDlg::SelectionIntoArgument()
510 // return if dialog box is inactive
511 if (!GroupButtons->isEnabled())
517 QString aString = "";
522 myEditCurrentArgument->setText(aString);
528 mySelectionMgr->selectedObjects(aList, SVTK_Viewer::Type());
529 int nbSel = SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
533 Handle(SALOME_InteractiveObject) IO = aList.First();
534 myMesh = SMESH::GetMeshByIO(IO);
535 if (myMesh->_is_nil())
538 myActor = SMESH::FindActorByObject(myMesh);
540 if (myEditCurrentArgument == LineEditElements) {
543 // MakeGroups is available if there are groups
544 if ( myMesh->NbGroups() == 0 ) {
545 MakeGroupsCheck->setChecked(false);
546 MakeGroupsCheck->setEnabled(false);
548 MakeGroupsCheck->setEnabled(true);
551 if (CheckBoxMesh->isChecked()) {
552 SMESH::ElementType neededType = GetConstructorId() ? SMESH::FACE : SMESH::EDGE;
554 SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
556 SMESH::SMESH_Mesh_var mesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO);
558 if (!mesh->_is_nil()) { //MESH
559 // get elements from mesh
560 myElementsId = mesh->GetElementsByType(neededType);
561 aNbElements = myElementsId->length();
563 SMESH::SMESH_subMesh_var aSubMesh =
564 SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO);
566 if (!aSubMesh->_is_nil()) { //SUBMESH
567 // get IDs from submesh
568 myElementsId = aSubMesh->GetElementsByType(neededType);
569 aNbElements = myElementsId->length();
571 SMESH::SMESH_GroupBase_var aGroup =
572 SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
574 if (!aGroup->_is_nil() && aGroup->GetType() == neededType) { // GROUP
575 // get IDs from smesh group
576 myElementsId = aGroup->GetListOfID();
577 aNbElements = myElementsId->length();
582 // get indices of selcted elements
583 TColStd_IndexedMapOfInteger aMapIndex;
584 mySelector->GetIndex(IO,aMapIndex);
585 aNbElements = aMapIndex.Extent();
587 myElementsId = new SMESH::long_array;
588 myElementsId->length( aNbElements );
590 for ( int i = 0; i < aNbElements; ++i )
591 aString += QString(" %1").arg( myElementsId[ i ] = aMapIndex( i+1 ) );
597 myNbOkElements = true;
601 myEditCurrentArgument->setText(aString);
608 //=================================================================================
609 // function : SetEditCurrentArgument()
611 //=================================================================================
612 void SMESHGUI_ExtrusionDlg::SetEditCurrentArgument()
614 QPushButton* send = (QPushButton*)sender();
616 disconnect(mySelectionMgr, 0, this, 0);
617 mySelectionMgr->clearSelected();
618 mySelectionMgr->clearFilters();
620 if (send == SelectElementsButton) {
621 myEditCurrentArgument = LineEditElements;
622 if (CheckBoxMesh->isChecked()) {
623 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
624 aViewWindow->SetSelectionMode(ActorSelection);
625 mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
627 int aConstructorId = GetConstructorId();
628 if (aConstructorId == 0)
630 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
631 aViewWindow->SetSelectionMode(EdgeSelection);
633 else if (aConstructorId == 1)
635 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
636 aViewWindow->SetSelectionMode(FaceSelection);
641 myEditCurrentArgument->setFocus();
642 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
643 SelectionIntoArgument();
646 //=================================================================================
647 // function : DeactivateActiveDialog()
648 // purpose : Deactivates this dialog
649 //=================================================================================
650 void SMESHGUI_ExtrusionDlg::DeactivateActiveDialog()
652 if (ConstructorsBox->isEnabled()) {
653 ConstructorsBox->setEnabled(false);
654 GroupArguments->setEnabled(false);
655 GroupButtons->setEnabled(false);
656 mySMESHGUI->ResetState();
657 mySMESHGUI->SetActiveDialogBox(0);
661 //=================================================================================
662 // function : ActivateThisDialog()
663 // purpose : Activates this dialog
664 //=================================================================================
665 void SMESHGUI_ExtrusionDlg::ActivateThisDialog()
667 // Emit a signal to deactivate the active dialog
668 mySMESHGUI->EmitSignalDeactivateDialog();
669 ConstructorsBox->setEnabled(true);
670 GroupArguments->setEnabled(true);
671 GroupButtons->setEnabled(true);
673 mySMESHGUI->SetActiveDialogBox(this);
675 ConstructorsClicked(GetConstructorId());
676 SelectionIntoArgument();
679 //=================================================================================
680 // function : enterEvent()
681 // purpose : Mouse enter event
682 //=================================================================================
683 void SMESHGUI_ExtrusionDlg::enterEvent (QEvent*)
685 if (!ConstructorsBox->isEnabled())
686 ActivateThisDialog();
689 //=================================================================================
690 // function : onSelectMesh()
692 //=================================================================================
693 void SMESHGUI_ExtrusionDlg::onSelectMesh (bool toSelectMesh)
696 TextLabelElements->setText(tr("SMESH_NAME"));
698 TextLabelElements->setText(tr("SMESH_ID_ELEMENTS"));
700 if (myEditCurrentArgument != LineEditElements) {
701 LineEditElements->clear();
705 mySelectionMgr->clearFilters();
708 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
709 aViewWindow->SetSelectionMode(ActorSelection);
710 mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
711 LineEditElements->setReadOnly(true);
712 LineEditElements->setValidator(0);
714 int aConstructorId = GetConstructorId();
715 if (aConstructorId == 0)
717 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
718 aViewWindow->SetSelectionMode(EdgeSelection);
720 else if (aConstructorId == 0)
722 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
723 aViewWindow->SetSelectionMode(FaceSelection);
726 LineEditElements->setReadOnly(false);
727 LineEditElements->setValidator(myIdValidator);
728 onTextChange(LineEditElements->text());
731 SelectionIntoArgument();
734 //=================================================================================
735 // function : GetConstructorId()
737 //=================================================================================
738 int SMESHGUI_ExtrusionDlg::GetConstructorId()
740 return GroupConstructors->checkedId();
743 //=================================================================================
744 // function : keyPressEvent()
746 //=================================================================================
747 void SMESHGUI_ExtrusionDlg::keyPressEvent( QKeyEvent* e )
749 QDialog::keyPressEvent( e );
750 if ( e->isAccepted() )
753 if ( e->key() == Qt::Key_F1 ) {