X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_MoveNodesDlg.cxx;h=131e60b9fac739318c6186be7d144ad33e9fdd6e;hb=d303154d91eb916a55ac93a372cbdb918aa18d14;hp=4fc7e997b4e24a4010412b0f4eea9b7e4cf45fd7;hpb=9d574375eec11986641d605770b5bf64dec9a7ed;p=modules%2Fsmesh.git diff --git a/src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx b/src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx index 4fc7e997b..131e60b9f 100644 --- a/src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx @@ -1,31 +1,29 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_MoveNodesDlg.cxx +// Author : Nicolas REJNERI, Open CASCADE S.A.S. // -// -// File : SMESHGUI_MoveNodesDlg.cxx -// Author : Nicolas REJNERI -// Module : SMESH -// $Header$ +// SMESH includes #include "SMESHGUI_MoveNodesDlg.h" #include "SMESHGUI.h" @@ -35,32 +33,27 @@ #include "SMESHGUI_VTKUtils.h" #include "SMESHGUI_MeshUtils.h" -#include "SMESH_Actor.h" -#include "SMDS_Mesh.hxx" -#include "SMDS_MeshNode.hxx" - -#include "LightApp_SelectionMgr.h" -#include "LightApp_Application.h" -#include "SUIT_ResourceMgr.h" -#include "SUIT_Desktop.h" -#include "SUIT_Session.h" -#include "SUIT_MessageBox.h" +#include +#include -#include "SVTK_Selector.h" -#include "SVTK_ViewModel.h" -#include "SVTK_ViewWindow.h" -#include "SALOME_ListIO.hxx" +// SALOME GUI includes +#include +#include +#include +#include +#include +#include -#include "SVTK_ViewWindow.h" -#include "VTKViewer_CellLocationsArray.h" +#include +#include +#include -#include "utilities.h" +#include // OCCT includes #include // VTK includes -#include #include #include #include @@ -68,56 +61,52 @@ #include #include -// QT includes -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// IDL Headers +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include + +// IDL includes #include #include CORBA_SERVER_HEADER(SMESH_Mesh) +#include CORBA_SERVER_HEADER(SMESH_MeshEditor) -#define MARGIN 10 -#define SPACING 5 - +#define SPACING 6 +#define MARGIN 11 //================================================================================= // name : SMESHGUI_MoveNodesDlg::SMESHGUI_MoveNodesDlg // Purpose : //================================================================================= -SMESHGUI_MoveNodesDlg::SMESHGUI_MoveNodesDlg (SMESHGUI* theModule, - const char* theName): - QDialog(SMESH::GetDesktop(theModule), - theName, - false, - WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), +SMESHGUI_MoveNodesDlg::SMESHGUI_MoveNodesDlg(SMESHGUI* theModule): + QDialog(SMESH::GetDesktop(theModule)), mySelectionMgr(SMESH::GetSelectionMgr(theModule)), mySMESHGUI(theModule) { myPreviewActor = 0; myBusy = false; - setCaption(tr("CAPTION")); + setModal(false); + setWindowTitle(tr("CAPTION")); - QVBoxLayout* aDlgLay = new QVBoxLayout (this, MARGIN, SPACING); + QVBoxLayout* aDlgLay = new QVBoxLayout(this); + aDlgLay->setSpacing(SPACING); + aDlgLay->setMargin(MARGIN); - QFrame* aMainFrame = createMainFrame (this); - QFrame* aBtnFrame = createButtonFrame(this); + QWidget* aMainFrame = createMainFrame (this); + QWidget* aBtnFrame = createButtonFrame(this); aDlgLay->addWidget(aMainFrame); aDlgLay->addWidget(aBtnFrame); - aDlgLay->setStretchFactor(aMainFrame, 1); - mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector(); - myHelpFileName = "/files/displacing_nodes.htm"; + myHelpFileName = "moving_nodes_page.html"; Init(); } @@ -126,7 +115,7 @@ SMESHGUI_MoveNodesDlg::SMESHGUI_MoveNodesDlg (SMESHGUI* theModule, // name : SMESHGUI_MoveNodesDlg::createButtonFrame // Purpose : Create frame containing buttons //======================================================================= -QFrame* SMESHGUI_MoveNodesDlg::createButtonFrame (QWidget* theParent) +QWidget* SMESHGUI_MoveNodesDlg::createButtonFrame (QWidget* theParent) { QFrame* aFrame = new QFrame(theParent); aFrame->setFrameStyle(QFrame::Box | QFrame::Sunken); @@ -134,15 +123,17 @@ QFrame* SMESHGUI_MoveNodesDlg::createButtonFrame (QWidget* theParent) myOkBtn = new QPushButton(tr("SMESH_BUT_OK" ), aFrame); myApplyBtn = new QPushButton(tr("SMESH_BUT_APPLY"), aFrame); myCloseBtn = new QPushButton(tr("SMESH_BUT_CLOSE"), aFrame); - myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP"), aFrame); - - QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); + myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP"), aFrame); - QHBoxLayout* aLay = new QHBoxLayout(aFrame, MARGIN, SPACING); + QHBoxLayout* aLay = new QHBoxLayout(aFrame); + aLay->setSpacing(SPACING); + aLay->setMargin(MARGIN); aLay->addWidget(myOkBtn); + aLay->addSpacing(10); aLay->addWidget(myApplyBtn); - aLay->addItem(aSpacer); + aLay->addSpacing(10); + aLay->addStretch(); aLay->addWidget(myCloseBtn); aLay->addWidget(myHelpBtn); @@ -158,42 +149,78 @@ QFrame* SMESHGUI_MoveNodesDlg::createButtonFrame (QWidget* theParent) // name : SMESHGUI_MoveNodesDlg::createMainFrame // Purpose : Create frame containing dialog's input fields //======================================================================= -QFrame* SMESHGUI_MoveNodesDlg::createMainFrame (QWidget* theParent) +QWidget* SMESHGUI_MoveNodesDlg::createMainFrame (QWidget* theParent) { - QFrame* aFrame = new QFrame(theParent); + QWidget* aFrame = new QWidget(theParent); QPixmap iconMoveNode (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_MOVE_NODE"))); QPixmap iconSelect (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT"))); - QButtonGroup* aPixGrp = new QButtonGroup(1, Qt::Vertical, tr("MESH_NODE"), aFrame); - aPixGrp->setExclusive(TRUE); + //------------------------------------------------------------ + QGroupBox* aPixGrp = new QGroupBox(tr("MESH_NODE"), aFrame); + QHBoxLayout* aPixGrpLayout = new QHBoxLayout(aPixGrp); + aPixGrpLayout->setSpacing(SPACING); + aPixGrpLayout->setMargin(MARGIN); + QRadioButton* aRBut = new QRadioButton(aPixGrp); - aRBut->setPixmap(iconMoveNode); - aRBut->setChecked(TRUE); + aRBut->setIcon(iconMoveNode); + aRBut->setChecked(true); + + aPixGrpLayout->addWidget(aRBut); + aPixGrpLayout->addStretch(); + + //------------------------------------------------------------ + QGroupBox* anIdGrp = new QGroupBox(tr("SMESH_MOVE"), aFrame); + QHBoxLayout* anIdGrpLayout = new QHBoxLayout(anIdGrp); + anIdGrpLayout->setSpacing(SPACING); + anIdGrpLayout->setMargin(MARGIN); - QGroupBox* anIdGrp = new QGroupBox(1, Qt::Vertical, tr("SMESH_MOVE"), aFrame); - new QLabel(tr("NODE_ID"), anIdGrp); - (new QPushButton(anIdGrp))->setPixmap(iconSelect); + QLabel* idLabl = new QLabel(tr("NODE_ID"), anIdGrp); + QPushButton* idBtn = new QPushButton(anIdGrp); + idBtn->setIcon(iconSelect); myId = new QLineEdit(anIdGrp); - myId->setValidator(new SMESHGUI_IdValidator(this, "validator", 1)); + myId->setValidator(new SMESHGUI_IdValidator(this, 1)); - QGroupBox* aCoordGrp = new QGroupBox(1, Qt::Vertical, tr("SMESH_COORDINATES"), aFrame); - new QLabel(tr("SMESH_X"), aCoordGrp); + anIdGrpLayout->addWidget(idLabl); + anIdGrpLayout->addWidget(idBtn); + anIdGrpLayout->addWidget(myId); + + //------------------------------------------------------------ + QGroupBox* aCoordGrp = new QGroupBox(tr("SMESH_COORDINATES"), aFrame); + QHBoxLayout* aCoordGrpLayout = new QHBoxLayout(aCoordGrp); + aCoordGrpLayout->setSpacing(SPACING); + aCoordGrpLayout->setMargin(MARGIN); + + QLabel* aXLabel = new QLabel(tr("SMESH_X"), aCoordGrp); myX = new SMESHGUI_SpinBox(aCoordGrp); - new QLabel(tr("SMESH_Y"), aCoordGrp); + + QLabel* aYLabel = new QLabel(tr("SMESH_Y"), aCoordGrp); myY = new SMESHGUI_SpinBox(aCoordGrp); - new QLabel(tr("SMESH_Z"), aCoordGrp); + + QLabel* aZLabel = new QLabel(tr("SMESH_Z"), aCoordGrp); myZ = new SMESHGUI_SpinBox(aCoordGrp); - myX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 25.0, 3); - myY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 25.0, 3); - myZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 25.0, 3); + aCoordGrpLayout->addWidget(aXLabel); + aCoordGrpLayout->addWidget(myX); + aCoordGrpLayout->addWidget(aYLabel); + aCoordGrpLayout->addWidget(myY); + aCoordGrpLayout->addWidget(aZLabel); + aCoordGrpLayout->addWidget(myZ); + + //------------------------------------------------------------ + myX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 25.0, DBL_DIGITS_DISPLAY); + myY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 25.0, DBL_DIGITS_DISPLAY); + myZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 25.0, DBL_DIGITS_DISPLAY); + //------------------------------------------------------------ QVBoxLayout* aLay = new QVBoxLayout(aFrame); + aLay->setMargin(0); + aLay->setMargin(SPACING); aLay->addWidget(aPixGrp); aLay->addWidget(anIdGrp); aLay->addWidget(aCoordGrp); + //------------------------------------------------------------ // connect signale and slots connect(myX, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview())); connect(myY, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview())); @@ -232,8 +259,6 @@ void SMESHGUI_MoveNodesDlg::Init() reset(); setEnabled(true); - this->show(); - // set selection mode SMESH::SetPointRepresentation(true); if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) @@ -246,12 +271,12 @@ void SMESHGUI_MoveNodesDlg::Init() // name : SMESHGUI_MoveNodesDlg::isValid // Purpose : Verify validity of entry information //======================================================================= -bool SMESHGUI_MoveNodesDlg::isValid (const bool theMess) const +bool SMESHGUI_MoveNodesDlg::isValid (const bool theMess) { if (myId->text().isEmpty()) { if (theMess) - QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_WARNING"), - tr("NODE_ID_IS_NOT_DEFINED"), QMessageBox::Ok); + SUIT_MessageBox::information(this, tr("SMESH_WARNING"), + tr("NODE_ID_IS_NOT_DEFINED")); return false; } return true; @@ -285,8 +310,8 @@ bool SMESHGUI_MoveNodesDlg::onApply() SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO(myMeshActor->getIO()); if (aMesh->_is_nil()) { - QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"), - tr("SMESHG_NO_MESH"), QMessageBox::Ok); + SUIT_MessageBox::information(this, tr("SMESH_ERROR"), + tr("SMESHG_NO_MESH")); return false; } @@ -349,10 +374,17 @@ void SMESHGUI_MoveNodesDlg::onHelp() 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")); + QString platform; +#ifdef WIN32 + platform = "winapplication"; +#else + platform = "application"; +#endif + SUIT_MessageBox::warning(this, tr("WRN_WARNING"), + tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", + platform)). + arg(myHelpFileName)); } } @@ -597,9 +629,8 @@ void SMESHGUI_MoveNodesDlg::keyPressEvent( QKeyEvent* e ) if ( e->isAccepted() ) return; - if ( e->key() == Key_F1 ) - { - e->accept(); - onHelp(); - } + if ( e->key() == Qt::Key_F1 ) { + e->accept(); + onHelp(); + } }