X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_MeshPatternDlg.cxx;h=1c99b81efc5735210f7c07b8938eee928997b817;hb=07ec002dfd20ec187228e11533e8e2135eca08fd;hp=a3a862b00609ce6a7074cfde7e6087f2f619ca39;hpb=a2fe500c74ac7743004e5acb2d01914219e3b9da;p=modules%2Fsmesh.git diff --git a/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx b/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx index a3a862b00..1c99b81ef 100755 --- a/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshPatternDlg.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 // // // @@ -46,10 +46,13 @@ #include "SUIT_ResourceMgr.h" #include "SUIT_Desktop.h" #include "SUIT_FileDlg.h" +#include "SUIT_Session.h" +#include "SUIT_MessageBox.h" #include "LightApp_SelectionMgr.h" #include "SalomeApp_Tools.h" #include "SalomeApp_Study.h" +#include "LightApp_Application.h" #include "SALOMEDS_SObject.hxx" @@ -59,6 +62,7 @@ #include "SVTK_ViewModel.h" #include "SVTK_Selector.h" #include "SVTK_ViewWindow.h" +#include "VTKViewer_CellLocationsArray.h" // OCCT Includes #include @@ -86,11 +90,11 @@ // VTK Includes #include #include -#include #include #include #include #include +#include #define SPACING 5 #define MARGIN 10 @@ -128,6 +132,8 @@ SMESHGUI_MeshPatternDlg::SMESHGUI_MeshPatternDlg( SMESHGUI* theModule, mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector(); + myHelpFileName = "pattern_mapping_page.html"; + Init(); } @@ -289,6 +295,7 @@ QFrame* SMESHGUI_MeshPatternDlg::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); @@ -298,10 +305,12 @@ QFrame* SMESHGUI_MeshPatternDlg::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; } @@ -350,9 +359,6 @@ void SMESHGUI_MeshPatternDlg::Init() activateSelection(); onSelectionDone(); - int x, y; - mySMESHGUI->DefineDlgPosition(this, x, y); - this->move(x, y); this->show(); } @@ -377,6 +383,13 @@ bool SMESHGUI_MeshPatternDlg::isValid (const bool theMess) return false; } + if ( myName->text()=="" ) { + if (theMess) + QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"), + tr("SMESHGUI_INVALID_PARAMETERS"), QMessageBox::Ok); + return false; + } + return true; } @@ -414,7 +427,7 @@ bool SMESHGUI_MeshPatternDlg::onApply() bool toCreatePolygons = myCreatePolygonsChk->isChecked(); bool toCreatePolyedrs = myCreatePolyedrsChk->isChecked(); if ( myPattern->MakeMesh( myMesh, toCreatePolygons, toCreatePolyedrs ) ) { - mySelectionMgr->clearSelected(); + //mySelectionMgr->clearSelected(); bool autoUpdate = SMESHGUI::automaticUpdate(); if (!isRefine() && autoUpdate) { _PTR(SObject) aSO = SMESH::FindSObject(myMesh.in()); @@ -427,9 +440,13 @@ bool SMESHGUI_MeshPatternDlg::onApply() } } } + mySelectionMgr->clearSelected(); SMESH::UpdateView(); mySMESHGUI->updateObjBrowser(true); + + mySelEdit[ Ids ]->setText(""); + return true; } else { QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"), @@ -471,6 +488,29 @@ void SMESHGUI_MeshPatternDlg::onClose() reject(); } +//================================================================================= +// function : onHelp() +// purpose : +//================================================================================= +void SMESHGUI_MeshPatternDlg::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_MeshPatternDlg::onSelectionDone // Purpose : SLOT called when selection changed @@ -1199,7 +1239,7 @@ vtkUnstructuredGrid* SMESHGUI_MeshPatternDlg::getGrid() else aCellTypesArray->InsertNextValue(VTK_EMPTY_CELL); } - vtkIntArray* aCellLocationsArray = vtkIntArray::New(); + VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New(); aCellLocationsArray->SetNumberOfComponents(1); aCellLocationsArray->SetNumberOfTuples(aNbCells); @@ -1334,3 +1374,20 @@ int SMESHGUI_MeshPatternDlg::getNode (bool second) const { return second ? myNode2->value() - 1 : myNode1->value() - 1; } + +//================================================================================= +// function : keyPressEvent() +// purpose : +//================================================================================= +void SMESHGUI_MeshPatternDlg::keyPressEvent( QKeyEvent* e ) +{ + QDialog::keyPressEvent( e ); + if ( e->isAccepted() ) + return; + + if ( e->key() == Key_F1 ) + { + e->accept(); + onHelp(); + } +}