X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_TranslationDlg.cxx;h=56cae0c67daab7ecc450a73c12d7f526aeef25e2;hb=07ec002dfd20ec187228e11533e8e2135eca08fd;hp=8df40714e1c69be12e2201e8c4b7a8c0d1789ca8;hpb=783b5a717c5967960d2adfdc43f158c8411c66ed;p=modules%2Fsmesh.git diff --git a/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx b/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx index 8df40714e..56cae0c67 100644 --- a/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx @@ -17,7 +17,7 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -42,12 +42,17 @@ #include "SUIT_Desktop.h" #include "SUIT_ResourceMgr.h" +#include "SUIT_Session.h" +#include "SUIT_MessageBox.h" + +#include "LightApp_Application.h" #include "SVTK_ViewModel.h" #include "SVTK_Selection.h" #include "SVTK_ViewWindow.h" #include "SVTK_Selector.h" #include "SALOME_ListIO.hxx" +#include "SALOMEDSClient_SObject.hxx" #include "utilities.h" @@ -71,9 +76,12 @@ // IDL Headers #include "SALOMEconfig.h" #include CORBA_SERVER_HEADER(SMESH_Group) +#include CORBA_SERVER_HEADER(SMESH_MeshEditor) using namespace std; +enum { MOVE_ELEMS_BUTTON = 0, COPY_ELEMS_BUTTON, MAKE_MESH_BUTTON }; //!< action type + //================================================================================= // class : SMESHGUI_TranslationDlg() // purpose : @@ -83,9 +91,7 @@ SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule, const cha : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose), mySMESHGUI( theModule ), - mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), - myViewWindow( SMESH::GetViewWindow( theModule ) ), - mySelector( myViewWindow->GetSelector() ) + mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) { QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_TRANSLATION_POINTS"))); QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_TRANSLATION_VECTOR"))); @@ -134,6 +140,10 @@ SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule, const cha 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); @@ -174,7 +184,7 @@ SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule, const cha SelectElementsButton->setToggleButton(FALSE); GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1); - LineEditElements = new QLineEdit(GroupArguments, "LineEditElements"); + LineEditElements = new QLineEdit(GroupArguments, "LineEditElements"); LineEditElements->setValidator(new SMESHGUI_IdValidator(this, "validator")); GroupArgumentsLayout->addMultiCellWidget(LineEditElements, 0, 0, 2, 7); @@ -194,18 +204,21 @@ SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule, const cha GroupArgumentsLayout->addWidget(SelectButton1, 2, 1); TextLabel1_1 = new QLabel(GroupArguments, "TextLabel1_1"); + TextLabel1_1->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs ); GroupArgumentsLayout->addWidget(TextLabel1_1, 2, 2); SpinBox1_1 = new SMESHGUI_SpinBox(GroupArguments, "SpinBox1_1"); GroupArgumentsLayout->addWidget(SpinBox1_1, 2, 3); TextLabel1_2 = new QLabel(GroupArguments, "TextLabel1_2"); + TextLabel1_2->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs ); GroupArgumentsLayout->addWidget(TextLabel1_2, 2, 4); SpinBox1_2 = new SMESHGUI_SpinBox(GroupArguments, "SpinBox1_2"); GroupArgumentsLayout->addWidget(SpinBox1_2, 2, 5); TextLabel1_3 = new QLabel(GroupArguments, "TextLabel1_3"); + TextLabel1_3->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs ); GroupArgumentsLayout->addWidget(TextLabel1_3, 2, 6); SpinBox1_3 = new SMESHGUI_SpinBox(GroupArguments, "SpinBox1_3"); @@ -222,6 +235,7 @@ SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule, const cha GroupArgumentsLayout->addWidget(SelectButton2, 3, 1); TextLabel2_1 = new QLabel(GroupArguments, "TextLabel2_1"); + TextLabel2_1->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs ); TextLabel2_1->setText(tr("SMESH_X" )); GroupArgumentsLayout->addWidget(TextLabel2_1, 3, 2); @@ -229,6 +243,7 @@ SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule, const cha GroupArgumentsLayout->addWidget(SpinBox2_1, 3, 3); TextLabel2_2 = new QLabel(GroupArguments, "TextLabel2_2"); + TextLabel2_2->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs ); TextLabel2_2->setText(tr("SMESH_Y" )); GroupArgumentsLayout->addWidget(TextLabel2_2, 3, 4); @@ -236,6 +251,7 @@ SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule, const cha GroupArgumentsLayout->addWidget(SpinBox2_2, 3, 5); TextLabel2_3 = new QLabel(GroupArguments, "TextLabel2_3"); + TextLabel2_3->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs ); TextLabel2_3->setText(tr("SMESH_Z")); GroupArgumentsLayout->addWidget(TextLabel2_3, 3, 6); @@ -243,24 +259,42 @@ SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule, const cha GroupArgumentsLayout->addWidget(SpinBox2_3, 3, 7); // Controls for "Create a copy" option - CheckBoxCopy = new QCheckBox(GroupArguments, "CheckBoxCopy"); - CheckBoxCopy->setText(tr("SMESH_CREATE_COPY")); - GroupArgumentsLayout->addMultiCellWidget(CheckBoxCopy, 4, 4, 0, 2); - +// CheckBoxCopy = new QCheckBox(GroupArguments, "CheckBoxCopy"); +// CheckBoxCopy->setText(tr("SMESH_CREATE_COPY")); +// GroupArgumentsLayout->addMultiCellWidget(CheckBoxCopy, 4, 4, 0, 2); + + // switch of action type + ActionGroup = new QButtonGroup(1, Qt::Horizontal, GroupArguments, "ActionGroup"); + ActionGroup->setExclusive(true); + ActionGroup->insert(new QRadioButton(tr("SMESH_MOVE_ELEMENTS"),ActionGroup), MOVE_ELEMS_BUTTON); + ActionGroup->insert(new QRadioButton(tr("SMESH_COPY_ELEMENTS"),ActionGroup), COPY_ELEMS_BUTTON); + ActionGroup->insert(new QRadioButton(tr("SMESH_CREATE_MESH" ),ActionGroup), MAKE_MESH_BUTTON); + GroupArgumentsLayout->addMultiCellWidget(ActionGroup, 4, 6, 0, 3); + + // CheckBox for groups generation + MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments); + MakeGroupsCheck->setChecked(false); + GroupArgumentsLayout->addMultiCellWidget(MakeGroupsCheck, 5, 5, 4, 7); + + // Name of a mesh to create + LineEditNewMesh = new QLineEdit(GroupArguments, "LineEditNewMesh"); + GroupArgumentsLayout->addMultiCellWidget(LineEditNewMesh, 6, 6, 4, 7); SMESHGUI_TranslationDlgLayout->addWidget(GroupArguments, 1, 0); /* Initialisations */ - SpinBox1_1->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3); - SpinBox1_2->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3); - SpinBox1_3->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3); - SpinBox2_1->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3); - SpinBox2_2->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3); - SpinBox2_3->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3); + SpinBox1_1->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY); + SpinBox1_2->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY); + SpinBox1_3->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY); + SpinBox2_1->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY); + SpinBox2_2->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY); + SpinBox2_3->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY); GroupArguments->show(); RadioButton1->setChecked(TRUE); + mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector(); + mySMESHGUI->SetActiveDialogBox((QDialog*)this); // Costruction of the logical filter @@ -274,12 +308,15 @@ SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule, const cha myMeshOrSubMeshOrGroupFilter = new SMESH_LogicalFilter(aListOfFilters, SMESH_LogicalFilter::LO_OR); + myHelpFileName = "translation_page.html"; + Init(); /* signals and slots connections */ connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int))); connect(SelectElementsButton, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument())); @@ -292,14 +329,13 @@ SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule, const cha connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); connect(LineEditElements, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&))); connect(CheckBoxMesh, SIGNAL(toggled(bool)), SLOT(onSelectMesh(bool))); + connect(ActionGroup, SIGNAL(clicked(int)), SLOT(onActionClicked(int))); - /* 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); + SelectionIntoArgument(); + onActionClicked(MOVE_ELEMS_BUTTON); resize(0,0); // ?? } @@ -339,8 +375,10 @@ void SMESHGUI_TranslationDlg::Init (bool ResetControls) SpinBox2_2->SetValue(0.0); SpinBox2_3->SetValue(0.0); - CheckBoxCopy->setChecked(false); + ((QRadioButton*) ActionGroup->find( MOVE_ELEMS_BUTTON ))->setChecked(TRUE); CheckBoxMesh->setChecked(false); +// MakeGroupsCheck->setChecked(false); +// MakeGroupsCheck->setEnabled(false); onSelectMesh(false); } } @@ -395,8 +433,8 @@ void SMESHGUI_TranslationDlg::ConstructorsClicked (int constructorId) if (myEditCurrentArgument != (QWidget*)LineEditElements) { SMESH::SetPointRepresentation(false); if (!CheckBoxMesh->isChecked()) - - myViewWindow->SetSelectionMode( CellSelection ); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode( CellSelection ); } myEditCurrentArgument = (QWidget*)LineEditElements; @@ -437,20 +475,38 @@ void SMESHGUI_TranslationDlg::ClickOnApply() aVector.PS.z = SpinBox1_3->GetValue(); } - bool toCreateCopy = CheckBoxCopy->isChecked(); - + int actionButton = ActionGroup->id( ActionGroup->selected() ); + bool makeGroups = ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ); try { SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor(); QApplication::setOverrideCursor(Qt::waitCursor); - aMeshEditor->Translate(anElementsId.inout(), aVector, toCreateCopy); + switch ( actionButton ) { + case MOVE_ELEMS_BUTTON: + aMeshEditor->Translate(anElementsId, aVector, false); + break; + case COPY_ELEMS_BUTTON: + if ( makeGroups ) + SMESH::ListOfGroups_var groups = + aMeshEditor->TranslateMakeGroups(anElementsId, aVector); + else + aMeshEditor->Translate(anElementsId, aVector, true); + break; + case MAKE_MESH_BUTTON: + SMESH::SMESH_Mesh_var mesh = + aMeshEditor->TranslateMakeMesh(anElementsId, aVector, makeGroups, + LineEditNewMesh->text().latin1()); + } QApplication::restoreOverrideCursor(); } catch (...) { } - mySelectionMgr->clearSelected(); SMESH::UpdateView(); + if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() || + actionButton == MAKE_MESH_BUTTON ) + mySMESHGUI->updateObjBrowser(true); // new groups may appear Init(false); ConstructorsClicked(GetConstructorId()); + SelectionIntoArgument(); } } @@ -472,13 +528,37 @@ void SMESHGUI_TranslationDlg::ClickOnCancel() { disconnect(mySelectionMgr, 0, this, 0); mySelectionMgr->clearFilters(); - mySelectionMgr->clearSelected(); + //mySelectionMgr->clearSelected(); SMESH::SetPointRepresentation(false); - myViewWindow->SetSelectionMode( ActorSelection ); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode( ActorSelection ); mySMESHGUI->ResetState(); reject(); } +//================================================================================= +// function : ClickOnHelp() +// purpose : +//================================================================================= +void SMESHGUI_TranslationDlg::ClickOnHelp() +{ + LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); + if (app) + app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName); + else { + QString platform; +#ifdef WIN32 + platform = "winapplication"; +#else + platform = "application"; +#endif + SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), + QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), + QObject::tr("BUT_OK")); + } +} + //======================================================================= // function : onTextChange() // purpose : @@ -518,7 +598,8 @@ void SMESHGUI_TranslationDlg::onTextChange (const QString& theNewText) } mySelector->AddOrRemoveIndex( anIO, newIndices, false ); - myViewWindow->highlight( anIO, true, true ); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->highlight( anIO, true, true ); myElementsId = theNewText; } @@ -579,6 +660,15 @@ void SMESHGUI_TranslationDlg::SelectionIntoArgument() if (myEditCurrentArgument == (QWidget*)LineEditElements) { myElementsId = ""; + // MakeGroups is available if there are groups and "Copy" + if ( myMesh->NbGroups() == 0 ) { + MakeGroupsCheck->setChecked(false); + MakeGroupsCheck->setEnabled(false); + } + else if ( ActionGroup->id( ActionGroup->selected() ) != MOVE_ELEMS_BUTTON ) { + MakeGroupsCheck->setEnabled(true); + } + if (CheckBoxMesh->isChecked()) { SMESH::GetNameOfSelectedIObjects( mySelectionMgr, aString ); @@ -622,7 +712,7 @@ void SMESHGUI_TranslationDlg::SelectionIntoArgument() aNbUnits = anElementsIds->length(); } } else { - aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, myActor->getIO(), aString); + aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, IO, aString); myElementsId = aString; } @@ -631,7 +721,7 @@ void SMESHGUI_TranslationDlg::SelectionIntoArgument() myNbOkElements = true; } else { - aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, myActor->getIO(), aString); + aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, IO, aString); if (aNbUnits != 1) return; @@ -650,7 +740,7 @@ void SMESHGUI_TranslationDlg::SelectionIntoArgument() if (myEditCurrentArgument == (QWidget*)SpinBox1_1) { SpinBox1_1->SetValue(x); SpinBox1_2->SetValue(y); - SpinBox2_3->SetValue(z); + SpinBox1_3->SetValue(z); } else if (myEditCurrentArgument == (QWidget*)SpinBox2_1) { SpinBox2_1->SetValue(x); SpinBox2_2->SetValue(y); @@ -659,8 +749,10 @@ void SMESHGUI_TranslationDlg::SelectionIntoArgument() } myBusy = true; - if (myEditCurrentArgument == (QWidget*)LineEditElements) + if (myEditCurrentArgument == (QWidget*)LineEditElements) { LineEditElements->setText(aString); + setNewMeshName(); + } myBusy = false; // OK @@ -686,22 +778,26 @@ void SMESHGUI_TranslationDlg::SetEditCurrentArgument() myEditCurrentArgument = (QWidget*)LineEditElements; SMESH::SetPointRepresentation(false); if (CheckBoxMesh->isChecked()) { - myViewWindow->SetSelectionMode( ActorSelection ); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode( ActorSelection ); mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter); } else { - myViewWindow->SetSelectionMode( CellSelection ); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode( CellSelection ); } } else if (send == SelectButton1) { myEditCurrentArgument = (QWidget*)SpinBox1_1; SMESH::SetPointRepresentation(true); - myViewWindow->SetSelectionMode( NodeSelection ); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode( NodeSelection ); } else if (send == SelectButton2) { myEditCurrentArgument = (QWidget*)SpinBox2_1; SMESH::SetPointRepresentation(true); - myViewWindow->SetSelectionMode( NodeSelection ); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode( NodeSelection ); } myEditCurrentArgument->setFocus(); @@ -738,7 +834,8 @@ void SMESHGUI_TranslationDlg::ActivateThisDialog() mySMESHGUI->SetActiveDialogBox((QDialog*)this); - myViewWindow->SetSelectionMode( CellSelection ); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode( CellSelection ); SelectionIntoArgument(); } @@ -793,11 +890,13 @@ void SMESHGUI_TranslationDlg::onSelectMesh (bool toSelectMesh) SMESH::SetPointRepresentation(false); if (toSelectMesh) { - myViewWindow->SetSelectionMode( ActorSelection ); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode( ActorSelection ); mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter); LineEditElements->setReadOnly(true); } else { - myViewWindow->SetSelectionMode( CellSelection ); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode( CellSelection ); LineEditElements->setReadOnly(false); onTextChange(LineEditElements->text()); } @@ -805,6 +904,60 @@ void SMESHGUI_TranslationDlg::onSelectMesh (bool toSelectMesh) SelectionIntoArgument(); } +//======================================================================= +//function : onActionClicked +//purpose : slot called when an action type changed +//======================================================================= + +void SMESHGUI_TranslationDlg::onActionClicked(int button) +{ + switch ( button ) { + case MOVE_ELEMS_BUTTON: + MakeGroupsCheck->setEnabled(false); + LineEditNewMesh->setEnabled(false); + break; + case COPY_ELEMS_BUTTON: + LineEditNewMesh->setEnabled(false); + MakeGroupsCheck->setText( tr("SMESH_MAKE_GROUPS")); + if ( myMesh->_is_nil() || myMesh->NbGroups() > 0) + MakeGroupsCheck->setEnabled(true); + else + MakeGroupsCheck->setEnabled(false); + break; + case MAKE_MESH_BUTTON: + LineEditNewMesh->setEnabled(true); + MakeGroupsCheck->setText( tr("SMESH_COPY_GROUPS")); + if ( myMesh->_is_nil() || myMesh->NbGroups() > 0) + MakeGroupsCheck->setEnabled(true); + else + MakeGroupsCheck->setEnabled(false); + break; + } + setNewMeshName(); +} + +//======================================================================= +//function : setNewMeshName +//purpose : update contents of LineEditNewMesh +//======================================================================= + +void SMESHGUI_TranslationDlg::setNewMeshName() +{ + LineEditNewMesh->setText(""); + if ( LineEditNewMesh->isEnabled() && !myMesh->_is_nil() ) { + QString name; + if ( CheckBoxMesh->isChecked() ) { + name = LineEditElements->text(); + } + else { + _PTR(SObject) meshSO = SMESH::FindSObject( myMesh ); + name = meshSO->GetName(); + } + if ( !name.isEmpty() ) + LineEditNewMesh->setText( SMESH::UniqueMeshName( name.latin1(), "translated")); + } +} + //================================================================================= // function : GetConstructorId() // purpose : @@ -815,3 +968,20 @@ int SMESHGUI_TranslationDlg::GetConstructorId() return GroupConstructors->id(GroupConstructors->selected()); return -1; } + +//================================================================================= +// function : keyPressEvent() +// purpose : +//================================================================================= +void SMESHGUI_TranslationDlg::keyPressEvent( QKeyEvent* e ) +{ + QDialog::keyPressEvent( e ); + if ( e->isAccepted() ) + return; + + if ( e->key() == Key_F1 ) + { + e->accept(); + ClickOnHelp(); + } +}