Salome HOME
Join modifications from branch BR_DEBUG_3_2_0b1
[modules/visu.git] / src / VISUGUI / VisuGUI_SetupPlot2dDlg.cxx
index 120785fa09892ef8966a928289aab865ab64a675..f0e11c12613bab4310a4dc009034bb7602ef50bb 100644 (file)
@@ -1,6 +1,21 @@
-//  Copyright (C) 2003  CEA/DEN, EDF R&D
-//
-//
+//  Copyright (C) 2003  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 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  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.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //  File   : VisuGUI_SetupPlot2dDlg.cxx
 //  Author : Vadim SANDLER
 //  $Header$
 
 #include "VisuGUI_SetupPlot2dDlg.h"
+#include "VisuGUI.h"
 #include "SPlot2d_Curve.h"
 
 #include "SUIT_Tools.h"
 #include "SUIT_MessageBox.h"
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_Session.h"
+
+#include "LightApp_Application.h"
 
 #include <SALOMEDSClient_AttributeTableOfInteger.hxx>
 #include <SALOMEDSClient_AttributeTableOfReal.hxx>
@@ -183,20 +203,24 @@ VisuGUI_SetupPlot2dDlg::VisuGUI_SetupPlot2dDlg( _PTR(SObject) object, QWidget* p
   
   myView->setMinimumWidth( frame->sizeHint().width() + MARGIN_SIZE * 2 );
 
-  /* OK/Cancel buttons */
+  /* OK/Cancel/Help buttons */
   myOkBtn = new QPushButton( tr( "BUT_OK" ), this, "buttonOk" );
   myOkBtn->setAutoDefault( TRUE );
   myOkBtn->setDefault( TRUE );
   myCancelBtn = new QPushButton( tr( "BUT_CANCEL" ), this, "buttonCancel" );
   myCancelBtn->setAutoDefault( TRUE );
+  myHelpBtn = new QPushButton( tr( "BUT_HELP" ), this, "buttonHelp" );
+  myHelpBtn->setAutoDefault( TRUE );
 
-  topLayout->addMultiCellWidget( myView, 0, 0, 0, 2 );
+  topLayout->addMultiCellWidget( myView, 0, 0, 0, 3 );
   topLayout->addWidget( myOkBtn, 1, 0 );
   topLayout->setColStretch( 1, 5 );
   topLayout->addWidget( myCancelBtn, 1, 2 );
+  topLayout->addWidget( myHelpBtn, 1, 3 );
 
   connect( myOkBtn,     SIGNAL( clicked() ), this, SLOT( accept() ) );
   connect( myCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) );
+  connect( myHelpBtn,   SIGNAL( clicked() ), this, SLOT( onHelp() ) );
 
   enableControls();
 
@@ -426,6 +450,24 @@ void VisuGUI_SetupPlot2dDlg::onVBtnToggled( bool on )
   }
   enableControls();
 }
+/*!
+  Slot, called when <Help> button is clicked
+*/
+void VisuGUI_SetupPlot2dDlg::onHelp()
+{
+  QString aHelpFileName = "/files/creating_curves.htm";
+  LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
+  if (app) {
+    VisuGUI* aVisuGUI = dynamic_cast<VisuGUI*>( app->activeModule() );
+    app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName);
+  }
+  else {
+    SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
+                          QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+                          arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName),
+                          QObject::tr("BUT_OK"));
+  }
+}
 /*!
   Enables/disables buttons 
 */