Salome HOME
Update GUI documentation for bugs 16559
[modules/geom.git] / src / MeasureGUI / MeasureGUI_Skeleton.cxx
index 85eac7a0ad4d33525408e33d8da6a444c1c70b44..def236c386b04e011220b6e42934931fe55f4601 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 "GEOM_Displayer.h"
 #include "GeometryGUI.h"
 
+#include "LightApp_Application.h"
+#include "LightApp_SelectionMgr.h"
 #include "SalomeApp_Application.h"
-#include "SalomeApp_SelectionMgr.h"
 #include "SalomeApp_Tools.h"
+#include "SUIT_MessageBox.h"
 #include "SUIT_Session.h"
 #include "SUIT_OverrideCursor.h"
 
@@ -56,21 +58,22 @@ MeasureGUI_Skeleton::MeasureGUI_Skeleton( GeometryGUI*      GUI,
                                           const char*       name )
 : MeasureGUI_Skeleton_QTD( parent, name, false,
                           WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose ),
+  GEOMBase_Helper( dynamic_cast<SUIT_Desktop*>( parent ) ),
   myGeomGUI( GUI )
 {
-
   mySelBtn = 0;
   mySelEdit = 0;
   myDisplayer = 0;
-  
+  myHelpFileName = "";
+
   if ( !name )
     setName( "MeasureGUI_Skeleton" );
 
   buttonClose->setText( tr( "GEOM_BUT_CLOSE" ) );
+  buttonHelp->setText(tr("GEOM_BUT_HELP"));
 
   buttonClose->setAutoDefault( false );
 
-  GroupMedium->close( TRUE );
   resize( 350, 0 );
 }
 
@@ -99,6 +102,9 @@ void MeasureGUI_Skeleton::Init()
   
   connect( buttonClose, SIGNAL( clicked() ),
           this,         SLOT( ClickOnCancel() ) );
+
+  connect( buttonHelp,  SIGNAL( clicked() ), 
+          this,        SLOT( ClickOnHelp() ) );
   
   connect( myGeomGUI,   SIGNAL( SignalDeactivateActiveDialog() ),
            this,        SLOT  ( DeactivateActiveDialog() ) );
@@ -112,7 +118,7 @@ void MeasureGUI_Skeleton::Init()
   connect( mySelBtn,    SIGNAL( clicked() ),
            this,        SLOT  ( SetEditCurrentArgument() ) );
 
-  SalomeApp_SelectionMgr* aSel = ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr();
+  LightApp_SelectionMgr* aSel = ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr();
   if ( aSel )
     connect( aSel, SIGNAL( currentSelectionChanged() ), 
             this, SLOT  ( SelectionIntoArgument() ) ) ;
@@ -135,6 +141,28 @@ void MeasureGUI_Skeleton::ClickOnCancel()
   close();
 }
 
+//=================================================================================
+// function : ClickOnHelp()
+// purpose  :
+//=================================================================================
+void MeasureGUI_Skeleton::ClickOnHelp()
+{
+  LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
+  if (app) 
+    app->onHelpContextModule(myGeomGUI ? app->moduleName(myGeomGUI->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 : LineEditReturnPressed()
@@ -162,7 +190,7 @@ void MeasureGUI_Skeleton::DeactivateActiveDialog()
 {
   setEnabled( false );
   
-  SalomeApp_SelectionMgr* aSel = ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr();
+  LightApp_SelectionMgr* aSel = ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr();
   if ( aSel )
     disconnect( aSel, 0, this, 0 );
   
@@ -184,7 +212,7 @@ void MeasureGUI_Skeleton::ActivateThisDialog()
   
   myGeomGUI->SetActiveDialogBox( ( QDialog* )this );
 
-  SalomeApp_SelectionMgr* aSel = ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr();
+  LightApp_SelectionMgr* aSel = ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr();
   if ( aSel )
     connect( aSel, SIGNAL( currentSelectionChanged() ), 
             this, SLOT  ( SelectionIntoArgument() ) ) ;
@@ -244,7 +272,7 @@ void MeasureGUI_Skeleton::processObject()
 //=================================================================================
 void MeasureGUI_Skeleton::closeEvent( QCloseEvent* e )
 {
-  SalomeApp_SelectionMgr* aSel = ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr();
+  LightApp_SelectionMgr* aSel = ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr();
   if ( aSel )
     disconnect( aSel, 0, this, 0 );
   QDialog::closeEvent( e );
@@ -342,10 +370,18 @@ GEOM::GEOM_IOperations_ptr MeasureGUI_Skeleton::createOperation()
 }
 
 //=================================================================================
-// function : getDesktop()
+// function : keyPressEvent()
 // purpose  :
 //=================================================================================
-SUIT_Desktop*  MeasureGUI_Skeleton::getDesktop() const
+void MeasureGUI_Skeleton::keyPressEvent( QKeyEvent* e )
 {
-  return dynamic_cast<SUIT_Desktop*>( parentWidget() );
+  QDialog::keyPressEvent( e );
+  if ( e->isAccepted() )
+    return;
+
+  if ( e->key() == Key_F1 )
+    {
+      e->accept();
+      ClickOnHelp();
+    }
 }