Salome HOME
NPAL16716. Compound: To create the groups of initial meshes.
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_CreatePolyhedralVolumeDlg.cxx
index 02ac5a08dba68cc6459ba0f262daeca24d6ba254..8e1e55c69a2e699073bf3791c2a34dbfa78f50f1 100644 (file)
@@ -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
 //
 //
 //
 #include "SMDS_Mesh.hxx"
 
 #include "SUIT_ResourceMgr.h"
+#include "SUIT_Session.h"
+#include "SUIT_MessageBox.h"
 
 #include "SalomeApp_Application.h"
 #include "SalomeApp_Study.h"
 #include "SUIT_Desktop.h"
 #include "SUIT_MessageBox.h"
+#include "LightApp_Application.h"
 #include "LightApp_SelectionMgr.h"
 #include "utilities.h"
 
@@ -81,6 +84,7 @@
 // IDL Headers
 #include "SALOMEconfig.h"
 #include CORBA_SERVER_HEADER(SMESH_Group)
+#include CORBA_SERVER_HEADER(SMESH_MeshEditor)
 
 using namespace std;
 
@@ -112,12 +116,12 @@ class TPolySimulation{
       myPreviewActor->SetMapper( myMapper );
       myPreviewActor->SetRepresentation( 3 );
 
-      float anRGB[3];
+      vtkFloatingPointType anRGB[3];
       vtkProperty* aProp = vtkProperty::New();
       GetColor( "SMESH", "selection_element_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) );
       aProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
       myPreviewActor->SetProperty( aProp );
-      float aFactor,aUnits;
+      vtkFloatingPointType aFactor,aUnits;
       myPreviewActor->SetResolveCoincidentTopology(true);
       myPreviewActor->GetPolygonOffsetParameters(aFactor,aUnits);
       myPreviewActor->SetPolygonOffsetParameters(aFactor,0.2*aUnits);
@@ -249,6 +253,11 @@ SMESHGUI_CreatePolyhedralVolumeDlg::SMESHGUI_CreatePolyhedralVolumeDlg( SMESHGUI
   buttonOk->setAutoDefault( TRUE );
   buttonOk->setDefault( TRUE );
   GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
+  buttonHelp = new QPushButton(GroupButtons, "buttonHelp");
+  buttonHelp->setText(tr("SMESH_BUT_HELP" ));
+  buttonHelp->setAutoDefault(TRUE);
+  GroupButtonsLayout->addWidget(buttonHelp, 0, 4);
+
   SMESHGUI_CreatePolyhedralVolumeDlgLayout->addWidget( GroupButtons, 2, 0 );
 
   /***************************************************************/
@@ -315,6 +324,8 @@ SMESHGUI_CreatePolyhedralVolumeDlg::SMESHGUI_CreatePolyhedralVolumeDlg( SMESHGUI
   RadioButton1->setChecked( TRUE );
  
   mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
+
+  myHelpFileName = "adding_nodes_and_elements_page.html#adding_polyhedrons_anchor";
   
   Init();
 }
@@ -348,6 +359,7 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::Init()
   connect(buttonOk, SIGNAL( clicked() ),     SLOT( ClickOnOk() ) );
   connect(buttonCancel, SIGNAL( clicked() ), SLOT( ClickOnCancel() ) ) ;
   connect(buttonApply, SIGNAL( clicked() ),  SLOT(ClickOnApply() ) );
+  connect(buttonHelp, SIGNAL(clicked()),     SLOT(ClickOnHelp() ) );
 
   connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
   connect(SelectElementsButton, SIGNAL( clicked() ), SLOT( SetEditCurrentArgument() ) ) ;
@@ -560,6 +572,29 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::ClickOnCancel()
   reject() ;
 }
 
+//=================================================================================
+// function : ClickOnHelp()
+// purpose  :
+//=================================================================================
+void SMESHGUI_CreatePolyhedralVolumeDlg::ClickOnHelp()
+{
+  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"));
+  }
+}
+
 //=======================================================================
 //function : onTextChange
 //purpose  : 
@@ -1070,3 +1105,20 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::onListSelectionChanged()
   
   busy = false;
 }
+
+//=================================================================================
+// function : keyPressEvent()
+// purpose  :
+//=================================================================================
+void SMESHGUI_CreatePolyhedralVolumeDlg::keyPressEvent( QKeyEvent* e )
+{
+  QDialog::keyPressEvent( e );
+  if ( e->isAccepted() )
+    return;
+
+  if ( e->key() == Key_F1 )
+    {
+      e->accept();
+      ClickOnHelp();
+    }
+}