X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_NodesDlg.cxx;h=8a1a13e2352c4019e4d93ed298246f0cfaf69431;hb=9d574375eec11986641d605770b5bf64dec9a7ed;hp=47e8f82c2a554187a58180597899e548b2f1fe96;hpb=9a358116f4ee87b52d3d86752c4fb6b3f814a69f;p=modules%2Fsmesh.git diff --git a/src/SMESHGUI/SMESHGUI_NodesDlg.cxx b/src/SMESHGUI/SMESHGUI_NodesDlg.cxx index 47e8f82c2..8a1a13e23 100644 --- a/src/SMESHGUI/SMESHGUI_NodesDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_NodesDlg.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 // // // @@ -49,10 +49,12 @@ #include "SUIT_Desktop.h" #include "SalomeApp_Study.h" -#include "SalomeApp_SelectionMgr.h" +#include "LightApp_Application.h" +#include "LightApp_SelectionMgr.h" #include "SVTK_Selector.h" #include "SVTK_ViewWindow.h" +#include "VTKViewer_CellLocationsArray.h" #include "SALOME_Actor.h" #include "SALOME_ListIO.hxx" @@ -62,13 +64,13 @@ // VTK Includes #include #include -#include #include #include #include #include #include #include +#include // QT Includes #include @@ -146,7 +148,7 @@ namespace SMESH { aCells->InsertNextCell(anIdList); aCellTypesArray->InsertNextValue(VTK_VERTEX); - vtkIntArray* aCellLocationsArray = vtkIntArray::New(); + VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New(); aCellLocationsArray->SetNumberOfComponents(1); aCellLocationsArray->SetNumberOfTuples(1); @@ -177,11 +179,11 @@ namespace SMESH { vtkProperty* aProp = vtkProperty::New(); aProp->SetRepresentationToPoints(); - float anRGB[3]; + vtkFloatingPointType anRGB[3]; GetColor( "SMESH", "node_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 255, 0 ) ); aProp->SetColor( anRGB[0], anRGB[1], anRGB[2] ); - float aPointSize = GetFloat( "SMESH:node_size", 3 ); + vtkFloatingPointType aPointSize = GetFloat( "SMESH:node_size", 3 ); aProp->SetPointSize( aPointSize ); myPreviewActor->SetProperty( aProp ); @@ -230,10 +232,9 @@ SMESHGUI_NodesDlg::SMESHGUI_NodesDlg (SMESHGUI* theModule, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose), mySelector(SMESH::GetViewWindow(theModule)->GetSelector()), mySelectionMgr(SMESH::GetSelectionMgr(theModule)), - myViewWindow(SMESH::GetViewWindow(theModule)), mySMESHGUI(theModule) { - mySimulation = new SMESH::TNodeSimulation(myViewWindow); + mySimulation = new SMESH::TNodeSimulation(SMESH::GetViewWindow( mySMESHGUI )); QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_NODE"))); if (!name) @@ -256,6 +257,10 @@ SMESHGUI_NodesDlg::SMESHGUI_NodesDlg (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); @@ -325,6 +330,8 @@ SMESHGUI_NodesDlg::SMESHGUI_NodesDlg (SMESHGUI* theModule, SMESHGUI_NodesDlgLayout->addWidget(GroupCoordinates, 1, 0); + myHelpFileName = "/files/adding_nodes_and_elements.htm#Adding_nodes"; + /* Initialisation and display */ Init(); } @@ -351,9 +358,9 @@ void SMESHGUI_NodesDlg::Init () step = 25.0; /* min, max, step and decimals for spin boxes */ - SpinBox_X->RangeStepAndValidator(-999.999, +999.999, step, 3); - SpinBox_Y->RangeStepAndValidator(-999.999, +999.999, step, 3); - SpinBox_Z->RangeStepAndValidator(-999.999, +999.999, step, 3); + SpinBox_X->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); + SpinBox_Y->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); + SpinBox_Z->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); SpinBox_X->SetValue(0.0); SpinBox_Y->SetValue(0.0); SpinBox_Z->SetValue(0.0); @@ -364,6 +371,7 @@ void SMESHGUI_NodesDlg::Init () 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(SpinBox_X, SIGNAL (valueChanged(double)), SLOT(ValueChangedInSpinBox(double))); connect(SpinBox_Y, SIGNAL (valueChanged(double)), SLOT(ValueChangedInSpinBox(double))); @@ -374,15 +382,12 @@ void SMESHGUI_NodesDlg::Init () /* to close dialog if study frame change */ connect(mySMESHGUI, SIGNAL (SignalStudyFrameChanged()), SLOT(ClickOnCancel())); - /* Move widget on the botton right corner of main widget */ - int x, y; - mySMESHGUI->DefineDlgPosition(this, x, y); - this->move(x, y); this->show(); // set selection mode SMESH::SetPointRepresentation(true); - myViewWindow->SetSelectionMode(NodeSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(NodeSelection); SelectionIntoArgument(); } @@ -468,7 +473,8 @@ bool SMESHGUI_NodesDlg::ClickOnApply() void SMESHGUI_NodesDlg::ClickOnCancel() { disconnect(mySelectionMgr, 0, this, 0); - myViewWindow->SetSelectionMode(ActorSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(ActorSelection); mySimulation->SetVisibility(false); SMESH::SetPointRepresentation(false); @@ -477,6 +483,23 @@ void SMESHGUI_NodesDlg::ClickOnCancel() reject(); } +//================================================================================= +// function : ClickOnHelp() +// purpose : +//================================================================================= +void SMESHGUI_NodesDlg::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 : SelectionIntoArgument() // purpose : Called when selection as changed or other case @@ -571,7 +594,25 @@ void SMESHGUI_NodesDlg::ActivateThisDialog() GroupButtons->setEnabled(true); SMESH::SetPointRepresentation(true); - myViewWindow->SetSelectionMode(NodeSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(NodeSelection); SelectionIntoArgument(); } + +//================================================================================= +// function : keyPressEvent() +// purpose : +//================================================================================= +void SMESHGUI_NodesDlg::keyPressEvent( QKeyEvent* e ) +{ + QDialog::keyPressEvent( e ); + if ( e->isAccepted() ) + return; + + if ( e->key() == Key_F1 ) + { + e->accept(); + ClickOnHelp(); + } +}