X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_ExtrusionDlg.cxx;h=16916a826e74b22238530c9f9102bb11292df244;hb=850cf38bd9a2823eefceec93229ad1b92ec78ba7;hp=84837045135ab723e004428ea7c209b4753e0e18;hpb=2f652b378401af2eefab3a17c9ea97b6cfc78abd;p=modules%2Fsmesh.git diff --git a/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx b/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx index 848370451..16916a826 100644 --- a/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx @@ -46,6 +46,9 @@ #include "SUIT_OverrideCursor.h" #include "SUIT_Desktop.h" #include "SUIT_MessageBox.h" +#include "SUIT_Session.h" + +#include "LightApp_Application.h" #include "SVTK_ViewModel.h" #include "SVTK_ViewWindow.h" @@ -134,6 +137,10 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule, GroupButtonsLayout->setAlignment(Qt::AlignTop); GroupButtonsLayout->setSpacing(6); GroupButtonsLayout->setMargin(11); + buttonHelp = new QPushButton(GroupButtons, "buttonHelp"); + buttonHelp->setText(tr("SMESH_BUT_HELP" )); + buttonHelp->setAutoDefault(TRUE); + GroupButtonsLayout->addWidget(buttonHelp, 0, 4); buttonCancel = new QPushButton(GroupButtons, "buttonCancel"); buttonCancel->setText(tr("SMESH_BUT_CLOSE" )); buttonCancel->setAutoDefault(TRUE); @@ -246,6 +253,8 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule, myMeshOrSubMeshOrGroupFilter = new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR); + myHelpFileName = "extrusion.htm"; + Init(); /***************************************************************/ @@ -253,8 +262,14 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule, connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); - connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int))); + connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); + // to update state of the Ok & Apply buttons + connect(SpinBox_Dx, SIGNAL(valueChanged(double)), SLOT(CheckIsEnable())); + connect(SpinBox_Dy, SIGNAL(valueChanged(double)), SLOT(CheckIsEnable())); + connect(SpinBox_Dz, SIGNAL(valueChanged(double)), SLOT(CheckIsEnable())); + + connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int))); connect(SelectElementsButton, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument())); connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); @@ -264,10 +279,7 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule, connect(CheckBoxMesh, SIGNAL(toggled(bool)), SLOT(onSelectMesh(bool))); /***************************************************************/ - /* Move widget on the botton right corner of main widget */ - int x, y; - mySMESHGUI->DefineDlgPosition(this, x, y); - this->move(x, y); + this->show(); // displays Dialog ConstructorsClicked(0); @@ -295,9 +307,6 @@ void SMESHGUI_ExtrusionDlg::Init (bool ResetControls) myElementsId = ""; myNbOkElements = 0; - buttonOk->setEnabled(false); - buttonApply->setEnabled(false); - myActor = 0; myMesh = SMESH::SMESH_Mesh::_nil(); @@ -310,6 +319,25 @@ void SMESHGUI_ExtrusionDlg::Init (bool ResetControls) CheckBoxMesh->setChecked(false); onSelectMesh(false); } + + CheckIsEnable(); +} + +//================================================================================= +// function : CheckIsEnable() +// purpose : Check whether the Ok and Apply buttons should be enabled or not +//================================================================================= +void SMESHGUI_ExtrusionDlg::CheckIsEnable() +{ + double aX = SpinBox_Dx->GetValue(); + double aY = SpinBox_Dy->GetValue(); + double aZ = SpinBox_Dz->GetValue(); + double aModule = sqrt(aX*aX + aY*aY + aZ*aZ); + + bool anIsEnable = myNbOkElements > 0 && aModule > 1.0E-38; + + buttonOk->setEnabled(anIsEnable); + buttonApply->setEnabled(anIsEnable); } //================================================================================= @@ -420,6 +448,23 @@ void SMESHGUI_ExtrusionDlg::ClickOnCancel() reject(); } +//================================================================================= +// function : ClickOnHelp() +// purpose : +//================================================================================= +void SMESHGUI_ExtrusionDlg::ClickOnHelp() +{ + LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); + if (app) + app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName); + else { + SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), + QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(myHelpFileName), + QObject::tr("BUT_OK")); + } +} + //================================================================================= // function : onTextChange() // purpose : @@ -437,9 +482,6 @@ void SMESHGUI_ExtrusionDlg::onTextChange (const QString& theNewText) if (send == LineEditElements) myNbOkElements = 0; - buttonOk->setEnabled(false); - buttonApply->setEnabled(false); - // hilight entered elements/nodes SMDS_Mesh* aMesh = 0; if (myActor) @@ -464,10 +506,7 @@ void SMESHGUI_ExtrusionDlg::onTextChange (const QString& theNewText) } } - if (myNbOkElements) { - buttonOk->setEnabled(true); - buttonApply->setEnabled(true); - } + CheckIsEnable(); myBusy = false; } @@ -493,8 +532,6 @@ void SMESHGUI_ExtrusionDlg::SelectionIntoArgument() myEditCurrentArgument->setText(aString); myNbOkElements = 0; - buttonOk->setEnabled(false); - buttonApply->setEnabled(false); myBusy = false; // get selected mesh @@ -596,10 +633,7 @@ void SMESHGUI_ExtrusionDlg::SelectionIntoArgument() myBusy = false; // OK - if (myNbOkElements) { - buttonOk->setEnabled(true); - buttonApply->setEnabled(true); - } + CheckIsEnable(); } //=================================================================================