X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_MoveNodesDlg.cxx;h=56ac27c0f11a0965f143d8da67f854a31878f6f9;hb=f8edb512e6bee4bc4371638843cf9843eaab7e09;hp=1cb0413fbca6efc0e61f5fd7af359c25c66c02db;hpb=25c935e78afdc192fe4c74d675afe2ed9ec42124;p=modules%2Fsmesh.git diff --git a/src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx b/src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx index 1cb0413fb..56ac27c0f 100644 --- a/src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx @@ -1,6 +1,6 @@ -// SMESH SMESHGUI : GUI for SMESH component +// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// Copyright (C) 2003-2007 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 @@ -17,15 +17,14 @@ // 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 // +// SMESH SMESHGUI : GUI for SMESH component // File : SMESHGUI_MoveNodesDlg.cxx // Author : Nicolas REJNERI // Module : SMESH // $Header$ - +// #include "SMESHGUI_MoveNodesDlg.h" #include "SMESHGUI.h" @@ -40,8 +39,11 @@ #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 "SVTK_Selector.h" #include "SVTK_ViewModel.h" @@ -49,6 +51,7 @@ #include "SALOME_ListIO.hxx" #include "SVTK_ViewWindow.h" +#include "VTKViewer_CellLocationsArray.h" #include "utilities.h" @@ -58,11 +61,11 @@ // VTK includes #include #include -#include #include #include #include #include +#include // QT includes #include @@ -78,6 +81,7 @@ // IDL Headers #include #include CORBA_SERVER_HEADER(SMESH_Mesh) +#include CORBA_SERVER_HEADER(SMESH_MeshEditor) #define MARGIN 10 #define SPACING 5 @@ -113,6 +117,8 @@ SMESHGUI_MoveNodesDlg::SMESHGUI_MoveNodesDlg (SMESHGUI* theModule, mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector(); + myHelpFileName = "moving_nodes_page.html"; + Init(); } @@ -125,9 +131,10 @@ QFrame* SMESHGUI_MoveNodesDlg::createButtonFrame (QWidget* theParent) QFrame* aFrame = new QFrame(theParent); aFrame->setFrameStyle(QFrame::Box | QFrame::Sunken); - myOkBtn = new QPushButton(tr("SMESH_BUT_OK" ), aFrame); myApplyBtn = new QPushButton(tr("SMESH_BUT_APPLY"), aFrame); myCloseBtn = new QPushButton(tr("SMESH_BUT_CLOSE"), aFrame); + myOkBtn = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), aFrame); + myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP"), aFrame); QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); @@ -137,10 +144,12 @@ QFrame* SMESHGUI_MoveNodesDlg::createButtonFrame (QWidget* theParent) aLay->addWidget(myApplyBtn); aLay->addItem(aSpacer); aLay->addWidget(myCloseBtn); + aLay->addWidget(myHelpBtn); connect(myOkBtn, SIGNAL(clicked()), SLOT(onOk())); connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose())); connect(myApplyBtn, SIGNAL(clicked()), SLOT(onApply())); + connect(myHelpBtn, SIGNAL(clicked()), SLOT(onHelp())); return aFrame; } @@ -169,16 +178,23 @@ QFrame* SMESHGUI_MoveNodesDlg::createMainFrame (QWidget* theParent) myId->setValidator(new SMESHGUI_IdValidator(this, "validator", 1)); QGroupBox* aCoordGrp = new QGroupBox(1, Qt::Vertical, tr("SMESH_COORDINATES"), aFrame); - new QLabel(tr("SMESH_X"), aCoordGrp); + QLabel* aXLabel = new QLabel(tr("SMESH_X"), aCoordGrp); + aXLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); myX = new SMESHGUI_SpinBox(aCoordGrp); - new QLabel(tr("SMESH_Y"), aCoordGrp); + + QLabel* aYLabel = new QLabel(tr("SMESH_Y"), aCoordGrp); + //aYLabel->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs ); + aYLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); myY = new SMESHGUI_SpinBox(aCoordGrp); - new QLabel(tr("SMESH_Z"), aCoordGrp); + + QLabel* aZLabel = new QLabel(tr("SMESH_Z"), aCoordGrp); + //aZLabel->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs ); + aZLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); myZ = new SMESHGUI_SpinBox(aCoordGrp); - myX->RangeStepAndValidator(-999999.999, +999999.999, 25.0, 3); - myY->RangeStepAndValidator(-999999.999, +999999.999, 25.0, 3); - myZ->RangeStepAndValidator(-999999.999, +999999.999, 25.0, 3); + 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->addWidget(aPixGrp); @@ -223,9 +239,6 @@ void SMESHGUI_MoveNodesDlg::Init() reset(); setEnabled(true); - int x, y; - mySMESHGUI->DefineDlgPosition(this, x, y); - this->move(x, y); this->show(); // set selection mode @@ -333,6 +346,29 @@ void SMESHGUI_MoveNodesDlg::onClose() reject(); } +//================================================================================= +// function : onHelp() +// purpose : +//================================================================================= +void SMESHGUI_MoveNodesDlg::onHelp() +{ + 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")); + } +} + //======================================================================= // name : SMESHGUI_MoveNodesDlg::onTextChange // Purpose : @@ -524,7 +560,7 @@ void SMESHGUI_MoveNodesDlg::redisplayPreview() aCellTypesArray->InsertNextValue(VTK_VERTEX); anIdList->Delete(); - vtkIntArray* aCellLocationsArray = vtkIntArray::New(); + VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New(); aCellLocationsArray->SetNumberOfComponents(1); aCellLocationsArray->SetNumberOfTuples(1); @@ -563,3 +599,20 @@ void SMESHGUI_MoveNodesDlg::redisplayPreview() aViewWindow->Repaint(); } } + +//================================================================================= +// function : keyPressEvent() +// purpose : +//================================================================================= +void SMESHGUI_MoveNodesDlg::keyPressEvent( QKeyEvent* e ) +{ + QDialog::keyPressEvent( e ); + if ( e->isAccepted() ) + return; + + if ( e->key() == Key_F1 ) + { + e->accept(); + onHelp(); + } +}