Salome HOME
Join modifications from branch OCC_debug_for_3_2_0b1
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_CreatePatternDlg.cxx
index d2f316fda323ae3c4837619f02fe6a90ba0abfdc..5545054d96285d9f009ad399bd9a82247419532b 100755 (executable)
 #include "SUIT_ResourceMgr.h"\r
 #include "SUIT_Desktop.h"\r
 #include "SUIT_FileDlg.h"\r
+#include "SUIT_Session.h"\r
+#include "SUIT_MessageBox.h"\r
 \r
 #include "SalomeApp_Study.h"\r
+#include "LightApp_Application.h"\r
 #include "LightApp_DataOwner.h"\r
 #include "LightApp_SelectionMgr.h"\r
 #include "SalomeApp_Tools.h"\r
@@ -105,6 +108,8 @@ SMESHGUI_CreatePatternDlg::SMESHGUI_CreatePatternDlg( SMESHGUI*   theModule,
   if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))\r
     mySelector = aViewWindow->GetSelector();\r
 \r
+  myHelpFileName = "pattern_mapping.htm";\r
+\r
   Init(theType);\r
 }\r
 \r
@@ -185,6 +190,7 @@ QFrame* SMESHGUI_CreatePatternDlg::createButtonFrame (QWidget* theParent)
   myOkBtn    = new QPushButton(tr("SMESH_BUT_OK"    ), aFrame);\r
   mySaveBtn  = new QPushButton(tr("SAVE"            ), aFrame);\r
   myCloseBtn = new QPushButton(tr("SMESH_BUT_CANCEL"), aFrame);\r
+  myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP"), aFrame);\r
 \r
   QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);\r
 \r
@@ -194,10 +200,12 @@ QFrame* SMESHGUI_CreatePatternDlg::createButtonFrame (QWidget* theParent)
   aLay->addWidget(mySaveBtn);\r
   aLay->addItem(aSpacer);\r
   aLay->addWidget(myCloseBtn);\r
+  aLay->addWidget(myHelpBtn);\r
 \r
   connect(myOkBtn,    SIGNAL(clicked()), SLOT(onOk()));\r
   connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose()));\r
   connect(mySaveBtn, SIGNAL(clicked()), SLOT(onSave()));\r
+  connect(myHelpBtn, SIGNAL(clicked()), SLOT(onHelp()));\r
 \r
   return aFrame;\r
 }\r
@@ -463,6 +471,23 @@ void SMESHGUI_CreatePatternDlg::onClose()
   emit Close();\r
 }\r
 \r
+//=================================================================================\r
+// function : onHelp()\r
+// purpose  :\r
+//=================================================================================\r
+void SMESHGUI_CreatePatternDlg::onHelp()\r
+{\r
+  LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());\r
+  if (app) \r
+    app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);\r
+  else {\r
+    SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),\r
+                          QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").\r
+                          arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(myHelpFileName),\r
+                          QObject::tr("BUT_OK"));\r
+  }\r
+}\r
+\r
 //=======================================================================\r
 // function : loadFromObject()\r
 // purpose  : Load pattern from geom object corresponding to the mesh/submesh\r
@@ -491,6 +516,7 @@ bool SMESHGUI_CreatePatternDlg::loadFromObject (const bool theMess)
       if      (aCode == SMESH::SMESH_Pattern::ERR_LOAD_EMPTY_SUBMESH  ) aMess = tr("ERR_LOAD_EMPTY_SUBMESH");\r
       else if (aCode == SMESH::SMESH_Pattern::ERR_LOADF_NARROW_FACE   ) aMess = tr("ERR_LOADF_NARROW_FACE");\r
       else if (aCode == SMESH::SMESH_Pattern::ERR_LOADF_CLOSED_FACE   ) aMess = tr("ERR_LOADF_CLOSED_FACE");\r
+      else if (aCode == SMESH::SMESH_Pattern::ERR_LOADF_CANT_PROJECT   ) aMess = tr("ERR_LOADF_CANT_PROJECT");\r
       else if (aCode == SMESH::SMESH_Pattern::ERR_LOADV_BAD_SHAPE     ) aMess = tr("ERR_LOADV_BAD_SHAPE");\r
       else if (aCode == SMESH::SMESH_Pattern::ERR_LOADV_COMPUTE_PARAMS) aMess = tr("ERR_LOADV_COMPUTE_PARAMS");\r
       else                                                              aMess = tr("ERROR_OF_CREATION");\r