Salome HOME
Copyright update 2021
[modules/geom.git] / src / GEOMBase / GEOMBase_Skeleton.cxx
index df5b463b96637357de0db7dbae45d95bb190bfd6..18b09a10f84402cc1d10325745d8955fdb4f7b81 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2021  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -6,7 +6,7 @@
 // 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.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -25,6 +25,7 @@
 // Author : Damien COQUERET, Open CASCADE S.A.S.
 
 #include "GEOMBase_Skeleton.h"
+#include "GEOMBase_DlgSkeleton.h"
 #include "GEOMBase.h"
 
 #include <DlgRef.h>
 #include <QKeyEvent>
 #include <QSpinBox>
 #include <QDoubleSpinBox>
+#include <QButtonGroup>
 
 //=================================================================================
 // class    : GEOMBase_Skeleton()
-// purpose  : Constructs a GEOMBase_Skeleton which is a child of 'parent', with the 
+// purpose  : Constructs a GEOMBase_Skeleton which is a child of 'parent', with the
 //            name 'name' and widget flags set to 'f'.
 //            The dialog will by default be modeless, unless you set 'modal' to
 //            true to construct a modal dialog.
 //=================================================================================
 GEOMBase_Skeleton::GEOMBase_Skeleton( GeometryGUI* theGeometryGUI, QWidget* parent,
                                       bool modal, Qt::WindowFlags fl )
-  : QDialog( parent, fl ), 
+  : QDialog( parent, fl ),
     GEOMBase_Helper( dynamic_cast<SUIT_Desktop*>( parent ) ),
     myGeomGUI( theGeometryGUI ),
     myRBGroup( 0 )
@@ -62,7 +64,7 @@ GEOMBase_Skeleton::GEOMBase_Skeleton( GeometryGUI* theGeometryGUI, QWidget* pare
 
   setModal( modal );
 
-  myMainFrame = new DlgRef_Skeleton( this );
+  myMainFrame = new GEOMBase_DlgSkeleton( this );
   QVBoxLayout* topLayout = new QVBoxLayout( this );
   topLayout->setMargin( 0 ); topLayout->setSpacing( 0 );
   topLayout->addWidget( myMainFrame );
@@ -138,16 +140,16 @@ void GEOMBase_Skeleton::Init()
 
   SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
   bool aPrv = (resMgr == 0) ? false : resMgr->booleanValue( "Geometry", "geom_preview", false );
-  
+
   myMainFrame->CheckBoxPreview->setChecked( aPrv );
   myMainFrame->GroupBoxPublish->hide();
 }
 
 //=================================================================================
 // function : initSpinBox()
-// purpose  : 
+// purpose  :
 //=================================================================================
-void GEOMBase_Skeleton::initSpinBox( QSpinBox* spinBox, 
+void GEOMBase_Skeleton::initSpinBox( QSpinBox* spinBox,
                                      int min,  int max, int step )
 {
   spinBox->setRange( min, max );
@@ -156,25 +158,25 @@ void GEOMBase_Skeleton::initSpinBox( QSpinBox* spinBox,
 
 //=================================================================================
 // function : initSpinBox()
-// purpose  : 
+// purpose  :
 //=================================================================================
-void GEOMBase_Skeleton::initSpinBox( SalomeApp_DoubleSpinBox* spinBox, 
-                                     double min,  double max, 
+void GEOMBase_Skeleton::initSpinBox( SalomeApp_DoubleSpinBox* spinBox,
+                                     double min,  double max,
                                      double step, const char* quantity )
 {
   // Obtain precision from preferences
   SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
   int aPrecision = resMgr->integerValue( "Geometry", quantity, 6 );
-  
+
   spinBox->setPrecision( aPrecision );
   spinBox->setDecimals( qAbs( aPrecision ) ); // it's necessary to set decimals before the range setting,
                                     // by default Qt rounds boundaries to 2 decimals at setRange
   spinBox->setRange( min, max );
   spinBox->setSingleStep( step );
-  
+
   // Add a hint for the user saying how to tune precision
   QString userPropName = QObject::tr( QString( "GEOM_PREF_%1" ).arg( quantity ).toLatin1().constData() );
-  spinBox->setProperty( "validity_tune_hint", 
+  spinBox->setProperty( "validity_tune_hint",
                         QVariant( QObject::tr( "GEOM_PRECISION_HINT" ).arg( userPropName ) ) );
 }
 
@@ -186,7 +188,7 @@ void GEOMBase_Skeleton::initSpinBox( SalomeApp_DoubleSpinBox* spinBox,
 void GEOMBase_Skeleton::updateAttributes( GEOM::GEOM_Object_ptr theObj,
                                           const QStringList& theParameters)
 {
-  SALOMEDS::Study_var aStudy = GeometryGUI::ClientStudyToStudy(getStudy()->studyDS());
+  SALOMEDS::Study_var aStudy = GeometryGUI::getStudyServant();
   SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
   SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(theObj->GetStudyEntry());
   SALOMEDS::GenericAttribute_var anAttr = aStudyBuilder->FindOrCreateAttribute(aSObject, "AttributeString");
@@ -224,7 +226,7 @@ void GEOMBase_Skeleton::LineEditReturnPressed()
     return;
 
   /* User name of object input management                          */
-  /* If successfull the selection is changed and signal emitted... */
+  /* If successful the selection is changed and signal emitted... */
   /* so SelectionIntoArgument() is automatically called.           */
   const QString objectUserName = myEditCurrentArgument->text();
   QWidget* thisWidget = (QWidget*)this;
@@ -347,8 +349,15 @@ void GEOMBase_Skeleton::unsetConstructorId()
 void GEOMBase_Skeleton::ClickOnHelp()
 {
   LightApp_Application* app = (LightApp_Application*)( SUIT_Session::session()->activeApplication() );
-  if ( app ) 
-    app->onHelpContextModule( myGeomGUI ? app->moduleName( myGeomGUI->moduleName() ) : QString(""), myHelpFileName );
+
+  QString context;
+  if(myHelpContext.isEmpty()) {
+    context = myGeomGUI ? app->moduleName( myGeomGUI->moduleName() ) : QString("");
+  } else {
+    context = myHelpContext;
+  }
+  if ( app )
+    app->onHelpContextModule( context , myHelpFileName );
   else {
     QString platform;
 #ifdef WIN32
@@ -372,7 +381,7 @@ void GEOMBase_Skeleton::setHelpFileName( const QString& theName )
   myHelpFileName = theName;
 }
 
-DlgRef_Skeleton* GEOMBase_Skeleton::mainFrame()
+GEOMBase_DlgSkeleton* GEOMBase_Skeleton::mainFrame()
 {
   return myMainFrame;
 }
@@ -421,7 +430,7 @@ void GEOMBase_Skeleton::keyPressEvent( QKeyEvent* e )
 //=================================================================================
 // function : showOnlyPreviewControl()
 // purpose  : display only CheckBoxPreview check box,
-//            hide CheckBoxRestoreSS and CheckBoxAddPrefix 
+//            hide CheckBoxRestoreSS and CheckBoxAddPrefix
 //=================================================================================
 void GEOMBase_Skeleton::showOnlyPreviewControl(){
   mainFrame()->GroupBoxPublish->show();