Salome HOME
Distributed Geom, Smesh. Modifications by Anthony GEAY.
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_ExtrusionAlongPathDlg.cxx
index 7b68e4817fa855e564b75c407b77bf7261e8564f..da79f4aca580cfa286658768c00db9f18d15419c 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
 //
 //
 //
@@ -48,6 +48,9 @@
 #include "SUIT_OverrideCursor.h"
 #include "SUIT_Desktop.h"
 #include "SUIT_MessageBox.h"
+#include "SUIT_Session.h"
+
+#include "LightApp_Application.h"
 
 #include "SVTK_ViewModel.h"
 #include "SVTK_ViewWindow.h"
@@ -85,6 +88,7 @@
 // IDL Headers
 #include "SALOMEconfig.h"
 #include CORBA_SERVER_HEADER(SMESH_Group)
+#include CORBA_SERVER_HEADER(SMESH_MeshEditor)
 
 using namespace std;
 
@@ -216,10 +220,13 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod
   SelectBasePointButton->setPixmap(selectImage);
 
   XLab  = new QLabel(tr("SMESH_X"), BasePointGrp);
+  XLab->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs );
   XSpin = new SMESHGUI_SpinBox(BasePointGrp);
   YLab  = new QLabel(tr("SMESH_Y"), BasePointGrp);
+  YLab->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs );
   YSpin = new SMESHGUI_SpinBox(BasePointGrp);
   ZLab  = new QLabel(tr("SMESH_Z"), BasePointGrp);
+  ZLab->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs );
   ZSpin = new SMESHGUI_SpinBox(BasePointGrp);
 
   // layouting
@@ -295,10 +302,14 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod
   CloseButton = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons);
   CloseButton->setAutoDefault(true);
 
+  HelpButton = new QPushButton(tr("SMESH_BUT_HELP"), GroupButtons);
+  HelpButton->setAutoDefault(true);
+
   // layouting
   GroupButtonsLayout->addWidget(OkButton,    0, 0);
   GroupButtonsLayout->addWidget(ApplyButton, 0, 1);
   GroupButtonsLayout->addWidget(CloseButton, 0, 3);
+  GroupButtonsLayout->addWidget(HelpButton, 0, 4);
   GroupButtonsLayout->addColSpacing(2, 10);
   GroupButtonsLayout->setColStretch(2, 10);
 
@@ -310,10 +321,10 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod
 
   /***************************************************************/
   // Initialisations
-  XSpin->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
-  YSpin->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
-  ZSpin->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
-  AngleSpin->RangeStepAndValidator(-999999.999, +999999.999, 5.0, 3);
+  XSpin->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
+  YSpin->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
+  ZSpin->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
+  AngleSpin->RangeStepAndValidator(-180.0, 180.0, 5.0, 3);
 
   mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
 
@@ -330,6 +341,8 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod
   myElementsFilter = new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR);
   myPathMeshFilter = new SMESH_TypeFilter (MESH);
 
+  myHelpFileName = "extrusion_along_a_path.htm";
+
   Init();
 
   /***************************************************************/
@@ -337,6 +350,7 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod
   connect(OkButton,     SIGNAL(clicked()), this, SLOT(ClickOnOk()));
   connect(CloseButton,  SIGNAL(clicked()), this, SLOT(reject()));
   connect(ApplyButton,  SIGNAL(clicked()), this, SLOT(ClickOnApply()));
+  connect(HelpButton,   SIGNAL(clicked()), this, SLOT(ClickOnHelp()));
 
   connect(AddAngleButton,    SIGNAL(clicked()), this, SLOT(OnAngleAdded()));
   connect(RemoveAngleButton, SIGNAL(clicked()), this, SLOT(OnAngleRemoved()));
@@ -370,10 +384,7 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod
   ZSpin->editor()->installEventFilter(this);
 
   /***************************************************************/
-  // set position and show dialog box
-  int x, y;
-  mySMESHGUI->DefineDlgPosition(this, x, y);
-  this->move(x, y);
+  
   this->show(); // displays Dialog
 }
 
@@ -657,6 +668,29 @@ void SMESHGUI_ExtrusionAlongPathDlg::ClickOnOk()
     reject();
 }
 
+//=================================================================================
+// function : ClickOnHelp()
+// purpose  :
+//=================================================================================
+void SMESHGUI_ExtrusionAlongPathDlg::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 : reject()
 // purpose  : Called when dialog box is closed
@@ -809,7 +843,7 @@ void SMESHGUI_ExtrusionAlongPathDlg::SelectionIntoArgument()
       // try to get selected elements IDs
       QString aString;
       //int aNbUnits = SMESH::GetNameOfSelectedElements(mySelectionMgr, aString);
-      SMESH::GetNameOfSelectedElements(mySelector, myMeshActor->getIO(), aString);
+      SMESH::GetNameOfSelectedElements(mySelector, IO, aString);
       ElementsLineEdit->setText(aString);
     }
   } else if (myEditCurrentArgument == PathMeshLineEdit) {
@@ -1172,3 +1206,20 @@ bool SMESHGUI_ExtrusionAlongPathDlg::eventFilter (QObject* object, QEvent* event
   }
   return QDialog::eventFilter(object, event);
 }
+
+//=================================================================================
+// function : keyPressEvent()
+// purpose  :
+//=================================================================================
+void SMESHGUI_ExtrusionAlongPathDlg::keyPressEvent( QKeyEvent* e )
+{
+  QDialog::keyPressEvent( e );
+  if ( e->isAccepted() )
+    return;
+
+  if ( e->key() == Key_F1 )
+    {
+      e->accept();
+      ClickOnHelp();
+    }
+}