From: vsr Date: Tue, 16 Oct 2007 14:15:43 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: snapshot_171207~14 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4e7b28499d7e5528357aa0bbae4fdf49cdd464b6;p=modules%2Fgeom.git *** empty log message *** --- diff --git a/src/BasicGUI/BasicGUI_ArcDlg.cxx b/src/BasicGUI/BasicGUI_ArcDlg.cxx index 931b13631..49a05d5cf 100644 --- a/src/BasicGUI/BasicGUI_ArcDlg.cxx +++ b/src/BasicGUI/BasicGUI_ArcDlg.cxx @@ -45,7 +45,7 @@ //================================================================================= BasicGUI_ArcDlg::BasicGUI_ArcDlg( GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl ) - : GEOMBase_Skeleton( theGeometryGUI, parent, "BasicGUI_ArcDlg", modal, fl ) + : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ) { QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_ARC" ) ) ); QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_ARC_CENTER" ) ) ); diff --git a/src/BasicGUI/BasicGUI_CircleDlg.cxx b/src/BasicGUI/BasicGUI_CircleDlg.cxx index 35ff7a815..4e5f1f392 100644 --- a/src/BasicGUI/BasicGUI_CircleDlg.cxx +++ b/src/BasicGUI/BasicGUI_CircleDlg.cxx @@ -46,7 +46,7 @@ //================================================================================= BasicGUI_CircleDlg::BasicGUI_CircleDlg( GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl ) - : GEOMBase_Skeleton( theGeometryGUI, parent, "BasicGUI_CircleDlg", modal, fl ) + : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ) { QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_CIRCLE_PV" ) ) ); QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_CIRCLE_PNTS" ) ) ); diff --git a/src/BasicGUI/BasicGUI_CurveDlg.cxx b/src/BasicGUI/BasicGUI_CurveDlg.cxx index e8255f369..1067819bd 100644 --- a/src/BasicGUI/BasicGUI_CurveDlg.cxx +++ b/src/BasicGUI/BasicGUI_CurveDlg.cxx @@ -47,7 +47,7 @@ //================================================================================= BasicGUI_CurveDlg::BasicGUI_CurveDlg( GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl ) - : GEOMBase_Skeleton( theGeometryGUI, parent, "BasicGUI_CurveDlg", modal, fl ) + : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ) { QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_POLYLINE" ) ) ); QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_SPLINE" ) ) ); diff --git a/src/BasicGUI/BasicGUI_EllipseDlg.cxx b/src/BasicGUI/BasicGUI_EllipseDlg.cxx index d79c91e4b..e65df3882 100644 --- a/src/BasicGUI/BasicGUI_EllipseDlg.cxx +++ b/src/BasicGUI/BasicGUI_EllipseDlg.cxx @@ -45,7 +45,7 @@ //================================================================================= BasicGUI_EllipseDlg::BasicGUI_EllipseDlg( GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl ) - : GEOMBase_Skeleton( theGeometryGUI, parent, "BasicGUI_EllipseDlg", modal, fl ) + : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ) { QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_ELLIPSE_PV" ) ) ); QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); diff --git a/src/BasicGUI/BasicGUI_LineDlg.cxx b/src/BasicGUI/BasicGUI_LineDlg.cxx index be317e3ff..1d1ddb543 100644 --- a/src/BasicGUI/BasicGUI_LineDlg.cxx +++ b/src/BasicGUI/BasicGUI_LineDlg.cxx @@ -45,7 +45,7 @@ //================================================================================= BasicGUI_LineDlg::BasicGUI_LineDlg( GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl ) - : GEOMBase_Skeleton( theGeometryGUI, parent, "BasicGUI_LineDlg", modal, fl ) + : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ) { QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_LINE_2P" ) ) ); QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); diff --git a/src/BasicGUI/BasicGUI_MarkerDlg.cxx b/src/BasicGUI/BasicGUI_MarkerDlg.cxx index 20b2d85c6..29120aa3f 100644 --- a/src/BasicGUI/BasicGUI_MarkerDlg.cxx +++ b/src/BasicGUI/BasicGUI_MarkerDlg.cxx @@ -56,7 +56,7 @@ // purpose : Constructor //================================================================================= BasicGUI_MarkerDlg::BasicGUI_MarkerDlg( GeometryGUI* theGeometryGUI, QWidget* theParent ) - : GEOMBase_Skeleton( theGeometryGUI, theParent, "BasicGUI_MarkerDlg", false, + : GEOMBase_Skeleton( theGeometryGUI, theParent, false, Qt::WindowTitleHint | Qt::WindowSystemMenuHint ) { QPixmap iconCS1 ( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_MARKER" ) ) ); diff --git a/src/BasicGUI/BasicGUI_PlaneDlg.cxx b/src/BasicGUI/BasicGUI_PlaneDlg.cxx index b3f4e67f0..7474a8acb 100644 --- a/src/BasicGUI/BasicGUI_PlaneDlg.cxx +++ b/src/BasicGUI/BasicGUI_PlaneDlg.cxx @@ -48,7 +48,7 @@ //================================================================================= BasicGUI_PlaneDlg::BasicGUI_PlaneDlg( GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl ) - : GEOMBase_Skeleton( theGeometryGUI, parent, "BasicGUI_PlaneDlg", modal, fl ) + : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ) { QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_PLANE_PV" ) ) ); QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_PLANE_3PNTS" ) ) ); diff --git a/src/BasicGUI/BasicGUI_PointDlg.cxx b/src/BasicGUI/BasicGUI_PointDlg.cxx index 9e422b25b..8bc8ade37 100644 --- a/src/BasicGUI/BasicGUI_PointDlg.cxx +++ b/src/BasicGUI/BasicGUI_PointDlg.cxx @@ -58,7 +58,7 @@ //================================================================================= BasicGUI_PointDlg::BasicGUI_PointDlg( GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl ) - : GEOMBase_Skeleton( theGeometryGUI, parent, "BasicGUI_PointDlg", modal, fl ) + : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ) { QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_POINT") ) ); QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_POINT_EDGE" ) ) ); diff --git a/src/BasicGUI/BasicGUI_VectorDlg.cxx b/src/BasicGUI/BasicGUI_VectorDlg.cxx index 6daee5345..2d91ba4ef 100644 --- a/src/BasicGUI/BasicGUI_VectorDlg.cxx +++ b/src/BasicGUI/BasicGUI_VectorDlg.cxx @@ -45,7 +45,7 @@ //================================================================================= BasicGUI_VectorDlg::BasicGUI_VectorDlg( GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl ) - : GEOMBase_Skeleton( theGeometryGUI, parent, "BasicGUI_VectorDlg", modal, fl ) + : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ) { QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_VECTOR_2P" ) ) ); QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_VECTOR_DXYZ" ) ) ); diff --git a/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx b/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx index 262c3a7d6..bf2ba69eb 100644 --- a/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx +++ b/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx @@ -57,7 +57,7 @@ //================================================================================= BasicGUI_WorkingPlaneDlg::BasicGUI_WorkingPlaneDlg( GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl ) - : GEOMBase_Skeleton( theGeometryGUI, parent, "BasicGUI_WorkingPlaneDlg", modal, fl ) + : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ) { QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_WPLANE_FACE" ) ) ); diff --git a/src/GEOMBase/GEOMBase_Skeleton.cxx b/src/GEOMBase/GEOMBase_Skeleton.cxx index 1a93f1971..91263070a 100644 --- a/src/GEOMBase/GEOMBase_Skeleton.cxx +++ b/src/GEOMBase/GEOMBase_Skeleton.cxx @@ -50,17 +50,12 @@ using namespace std; // true to construct a modal dialog. //================================================================================= GEOMBase_Skeleton::GEOMBase_Skeleton( GeometryGUI* theGeometryGUI, QWidget* parent, - const char* name, bool modal, Qt::WindowFlags fl ) - : QDialog( parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint ), + bool modal, Qt::WindowFlags fl ) + : QDialog( parent, fl ), GEOMBase_Helper( dynamic_cast( parent ) ), myGeomGUI( theGeometryGUI ), myRBGroup( 0 ) { - if ( !name ) - setObjectName( "GEOMBase_Skeleton" ); - else - setObjectName( name ); - setAttribute( Qt::WA_DeleteOnClose ); setModal( modal ); diff --git a/src/GEOMBase/GEOMBase_Skeleton.h b/src/GEOMBase/GEOMBase_Skeleton.h index 089681038..e38b14cf0 100644 --- a/src/GEOMBase/GEOMBase_Skeleton.h +++ b/src/GEOMBase/GEOMBase_Skeleton.h @@ -41,6 +41,8 @@ class QPushButton; #ifndef COORD_MIN # define COORD_MIN -1e+15 # define COORD_MAX +1e+15 +# define MAX_NUMBER 100000 +# define DBL_DIGITS_DISPLAY 16 #endif // COORD_MIN class GEOMBASE_EXPORT GEOMBase_Skeleton : public QDialog, public GEOMBase_Helper @@ -48,7 +50,7 @@ class GEOMBASE_EXPORT GEOMBase_Skeleton : public QDialog, public GEOMBase_Helper Q_OBJECT public: - GEOMBase_Skeleton( GeometryGUI*, QWidget* = 0, const char* = 0, bool = false, Qt::WindowFlags = 0 ); + GEOMBase_Skeleton( GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0 ); ~GEOMBase_Skeleton(); private: diff --git a/src/GenerationGUI/GenerationGUI.cxx b/src/GenerationGUI/GenerationGUI.cxx index 3de74cbf6..40baaeee2 100644 --- a/src/GenerationGUI/GenerationGUI.cxx +++ b/src/GenerationGUI/GenerationGUI.cxx @@ -1,51 +1,46 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : GenerationGUI.cxx +// Author : Damien COQUERET, Open CASCADE S.A.S. // -// -// File : GenerationGUI.cxx -// Author : Damien COQUERET -// Module : GEOM -// $Header$ #include "GenerationGUI.h" -#include "GeometryGUI.h" - -#include "SUIT_Desktop.h" +#include -#include "SalomeApp_Application.h" +#include +#include #include "GenerationGUI_PrismDlg.h" // Method PRISM #include "GenerationGUI_RevolDlg.h" // Method REVOL #include "GenerationGUI_FillingDlg.h" // Method FILLING #include "GenerationGUI_PipeDlg.h" // Method PIPE -using namespace std; - //======================================================================= // function : GenerationGUI() // purpose : Constructor //======================================================================= -GenerationGUI::GenerationGUI(GeometryGUI* parent) : GEOMGUI(parent) +GenerationGUI::GenerationGUI( GeometryGUI* parent ) + : GEOMGUI( parent ) { } @@ -71,17 +66,16 @@ bool GenerationGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) QDialog* aDlg = NULL; - switch (theCommandID) - { - case 4031: aDlg = new GenerationGUI_PrismDlg ( getGeometryGUI(), parent, ""); break; - case 4032: aDlg = new GenerationGUI_RevolDlg ( getGeometryGUI(), parent, ""); break; - case 4033: aDlg = new GenerationGUI_FillingDlg ( getGeometryGUI(), parent, ""); break; - case 4034: aDlg = new GenerationGUI_PipeDlg ( getGeometryGUI(), parent, ""); break; + switch ( theCommandID ) { + case 4031: aDlg = new GenerationGUI_PrismDlg ( getGeometryGUI(), parent ); break; + case 4032: aDlg = new GenerationGUI_RevolDlg ( getGeometryGUI(), parent ); break; + case 4033: aDlg = new GenerationGUI_FillingDlg ( getGeometryGUI(), parent ); break; + case 4034: aDlg = new GenerationGUI_PipeDlg ( getGeometryGUI(), parent ); break; - default: app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) ); break; + default: app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) ); break; } - if (aDlg != NULL) + if (aDlg != NULL ) aDlg->show(); return true; @@ -93,9 +87,11 @@ bool GenerationGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) //===================================================================================== extern "C" { -GENERATIONGUI_EXPORT - GEOMGUI* GetLibGUI(GeometryGUI* parent) +#ifdef WIN32 + __declspec( dllexport ) +#endif + GEOMGUI* GetLibGUI( GeometryGUI* parent ) { - return new GenerationGUI(parent); + return new GenerationGUI( parent ); } } diff --git a/src/GenerationGUI/GenerationGUI.h b/src/GenerationGUI/GenerationGUI.h index a809bdcf7..6f117cd95 100644 --- a/src/GenerationGUI/GenerationGUI.h +++ b/src/GenerationGUI/GenerationGUI.h @@ -1,56 +1,44 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : GenerationGUI.h +// Author : Damien COQUERET, Open CASCADE S.A.S. // -// -// File : GenerationGUI.h -// Author : Damien COQUERET -// Module : GEOM #ifndef GENERATIONGUI_H #define GENERATIONGUI_H -#ifdef WNT -# if defined GENERATIONGUI_EXPORTS -# define GENERATIONGUI_EXPORT __declspec( dllexport ) -# else -# define GENERATIONGUI_EXPORT __declspec( dllimport ) -# endif -#else -# define GENERATIONGUI_EXPORT -#endif - -#include "GEOMGUI.h" +#include //================================================================================= // class : GenerationGUI // purpose : //================================================================================= -class GENERATIONGUI_EXPORT GenerationGUI : public GEOMGUI +class GenerationGUI : public GEOMGUI { public: - GenerationGUI(GeometryGUI* parent); + GenerationGUI( GeometryGUI* ); ~GenerationGUI(); - bool OnGUIEvent( int theCommandID, SUIT_Desktop* parent ); + bool OnGUIEvent( int, SUIT_Desktop* ); }; #endif diff --git a/src/GenerationGUI/GenerationGUI_FillingDlg.cxx b/src/GenerationGUI/GenerationGUI_FillingDlg.cxx index 43ff12233..4cac5f7b3 100644 --- a/src/GenerationGUI/GenerationGUI_FillingDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_FillingDlg.cxx @@ -1,45 +1,41 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// 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 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. +// 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 +// 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 : GenerationGUI_FillingDlg.cxx +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // -// -// File : GenerationGUI_FillingDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ #include "GenerationGUI_FillingDlg.h" -#include "DlgRef_1Sel5Spin.h" -#include "DlgRef_SpinBox.h" -#include "GeometryGUI.h" -#include "GEOMBase.h" +#include +#include +#include -#include "SUIT_ResourceMgr.h" -#include "SUIT_Session.h" -#include "SalomeApp_Application.h" -#include "LightApp_SelectionMgr.h" +#include +#include +#include +#include #include -#include "GEOMImpl_Types.hxx" +#include //================================================================================= // class : GenerationGUI_FillingDlg() @@ -48,38 +44,40 @@ // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -GenerationGUI_FillingDlg::GenerationGUI_FillingDlg(GeometryGUI* theGeometryGUI, QWidget* parent, - const char* name, bool modal, Qt::WindowFlags fl) - :GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) +GenerationGUI_FillingDlg::GenerationGUI_FillingDlg( GeometryGUI* theGeometryGUI, QWidget* parent, + bool modal, Qt::WindowFlags fl ) + : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ) { - QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_FILLING"))); - QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT"))); + QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_FILLING" ) ) ); + QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); - setWindowTitle(tr("GEOM_FILLING_TITLE")); + setWindowTitle( tr( "GEOM_FILLING_TITLE" ) ); /***************************************************************/ - GroupConstructors->setTitle(tr("GEOM_FILLING")); - RadioButton1->setIcon(image0); - RadioButton2->setAttribute( Qt::WA_DeleteOnClose ); - RadioButton2->close(); - RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); - RadioButton3->close(); - - GroupPoints = new DlgRef_1Sel5Spin(this, "GroupPoints"); - GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); - GroupPoints->TextLabel1->setText(tr("GEOM_FILLING_COMPOUND")); - GroupPoints->TextLabel2->setText(tr("GEOM_FILLING_MIN_DEG")); - GroupPoints->TextLabel3->setText(tr("GEOM_FILLING_TOL_2D")); - GroupPoints->TextLabel4->setText(tr("GEOM_FILLING_NB_ITER")); - GroupPoints->TextLabel5->setText(tr("GEOM_FILLING_MAX_DEG")); - GroupPoints->TextLabel6->setText(tr("GEOM_FILLING_TOL_3D")); - GroupPoints->PushButton1->setIcon(image1); + mainFrame()->GroupConstructors->setTitle( tr ( "GEOM_FILLING" ) ); + mainFrame()->RadioButton1->setIcon( image0 ); + mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose ); + mainFrame()->RadioButton2->close(); + mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); + mainFrame()->RadioButton3->close(); + + GroupPoints = new DlgRef_1Sel5Spin( centralWidget() ); + GroupPoints->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) ); + GroupPoints->TextLabel1->setText( tr( "GEOM_FILLING_COMPOUND" ) ); + GroupPoints->TextLabel2->setText( tr( "GEOM_FILLING_MIN_DEG" ) ); + GroupPoints->TextLabel3->setText( tr( "GEOM_FILLING_TOL_2D" ) ); + GroupPoints->TextLabel4->setText( tr( "GEOM_FILLING_NB_ITER" ) ); + GroupPoints->TextLabel5->setText( tr( "GEOM_FILLING_MAX_DEG" ) ); + GroupPoints->TextLabel6->setText( tr( "GEOM_FILLING_TOL_3D" ) ); + GroupPoints->PushButton1->setIcon( image1 ); GroupPoints->LineEdit1->setReadOnly( true ); - gridLayout1->addWidget(GroupPoints, 2, 0); + QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); + layout->setMargin( 0 ); layout->setSpacing( 6 ); + layout->addWidget( GroupPoints ); /***************************************************************/ - setHelpFileName("filling.htm"); + setHelpFileName( "filling.htm" ); /* Initialisations */ Init(); @@ -116,41 +114,43 @@ void GenerationGUI_FillingDlg::Init() double SpecificStep1 = 1; double SpecificStep2 = 0.0001; /* min, max, step and decimals for spin boxes & initial values */ - GroupPoints->SpinBox_1->RangeStepAndValidator(2.0, MAX_NUMBER, SpecificStep1, 3); - GroupPoints->SpinBox_2->RangeStepAndValidator(0.00001, 10000.0, SpecificStep2, 5); - GroupPoints->SpinBox_3->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep1, 3); - GroupPoints->SpinBox_4->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep1, 3); - GroupPoints->SpinBox_5->RangeStepAndValidator(0.00001, 10000.0, SpecificStep2, 5); - - GroupPoints->SpinBox_1->SetValue(myMinDeg); - GroupPoints->SpinBox_2->SetValue(myTol2D); - GroupPoints->SpinBox_3->SetValue(myNbIter); - GroupPoints->SpinBox_4->SetValue(myMaxDeg); - GroupPoints->SpinBox_5->SetValue(myTol3D); + initSpinBox( GroupPoints->SpinBox1, 2.0, MAX_NUMBER, SpecificStep1, 3 ); + initSpinBox( GroupPoints->SpinBox2, 0.00001, 10000.0, SpecificStep2, 5 ); + initSpinBox( GroupPoints->SpinBox3, 1.0, MAX_NUMBER, SpecificStep1, 3 ); + initSpinBox( GroupPoints->SpinBox4, 1.0, MAX_NUMBER, SpecificStep1, 3 ); + initSpinBox( GroupPoints->SpinBox5, 0.00001, 10000.0, SpecificStep2, 5 ); + + GroupPoints->SpinBox1->setValue( myMinDeg ); + GroupPoints->SpinBox2->setValue( myTol2D ); + GroupPoints->SpinBox3->setValue( myNbIter ); + GroupPoints->SpinBox4->setValue( myMaxDeg ); + GroupPoints->SpinBox5->setValue( myTol3D ); /* signals and slots connections */ - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); - - connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - - connect(GroupPoints->SpinBox_1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(GroupPoints->SpinBox_2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(GroupPoints->SpinBox_3, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(GroupPoints->SpinBox_4, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(GroupPoints->SpinBox_5, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_1, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_2, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_3, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_4, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_5, SLOT(SetStep(double))); - - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; - - initName(tr("GEOM_FILLING").toLatin1().constData()); + connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); + + connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + + connect( GroupPoints->SpinBox1, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( GroupPoints->SpinBox2, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( GroupPoints->SpinBox3, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( GroupPoints->SpinBox4, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( GroupPoints->SpinBox5, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + + // VSR: TODO ->> + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupPoints->SpinBox1, SLOT( SetStep( double ) ) ); + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupPoints->SpinBox2, SLOT( SetStep( double ) ) ); + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupPoints->SpinBox3, SLOT( SetStep( double ) ) ); + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupPoints->SpinBox4, SLOT( SetStep( double ) ) ); + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupPoints->SpinBox5, SLOT( SetStep( double ) ) ); + // <<- + + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + + initName( tr( "GEOM_FILLING" ) ); } @@ -186,28 +186,27 @@ bool GenerationGUI_FillingDlg::ClickOnApply() void GenerationGUI_FillingDlg::SelectionIntoArgument() { erasePreview(); - myEditCurrentArgument->setText(""); + myEditCurrentArgument->setText( "" ); - if(IObjectCount() != 1) { - if(myEditCurrentArgument == GroupPoints->LineEdit1) + if ( IObjectCount() != 1 ) { + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myOkCompound = false; return; } // nbSel == 1 Standard_Boolean testResult = Standard_False; - GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); + GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); - if (!testResult) + if ( !testResult ) return; - if(myEditCurrentArgument == GroupPoints->LineEdit1) { + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) { TopoDS_Shape S; myOkCompound = false; if ( GEOMBase::GetShape(aSelectedObject, S) && - S.ShapeType() == TopAbs_COMPOUND) - { + S.ShapeType() == TopAbs_COMPOUND ) { // myCompound should be a compound of edges for ( TopoDS_Iterator it( S ); it.More(); it.Next() ) if ( it.Value().ShapeType() != TopAbs_EDGE ) @@ -231,7 +230,7 @@ void GenerationGUI_FillingDlg::SetEditCurrentArgument() QPushButton* send = (QPushButton*)sender(); globalSelection( GEOM_ALLSHAPES ); - if(send == GroupPoints->PushButton1) { + if ( send == GroupPoints->PushButton1 ) { GroupPoints->LineEdit1->setFocus(); myEditCurrentArgument = GroupPoints->LineEdit1; globalSelection( GEOM_COMPOUND ); @@ -247,11 +246,10 @@ void GenerationGUI_FillingDlg::SetEditCurrentArgument() void GenerationGUI_FillingDlg::LineEditReturnPressed() { QLineEdit* send = (QLineEdit*)sender(); - if(send == GroupPoints->LineEdit1) - { - myEditCurrentArgument = send; - GEOMBase_Skeleton::LineEditReturnPressed(); - } + if ( send == GroupPoints->LineEdit1 ) { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } } @@ -262,8 +260,8 @@ void GenerationGUI_FillingDlg::LineEditReturnPressed() void GenerationGUI_FillingDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); globalSelection( GEOM_COMPOUND ); displayPreview(); } @@ -273,9 +271,9 @@ void GenerationGUI_FillingDlg::ActivateThisDialog() // function : enterEvent() // purpose : //================================================================================= -void GenerationGUI_FillingDlg::enterEvent(QEvent* e) +void GenerationGUI_FillingDlg::enterEvent( QEvent* ) { - if ( !GroupConstructors->isEnabled() ) + if ( !mainFrame()->GroupConstructors->isEnabled() ) ActivateThisDialog(); } @@ -284,19 +282,19 @@ void GenerationGUI_FillingDlg::enterEvent(QEvent* e) // function : ValueChangedInSpinBox() // purpose : //================================================================================= -void GenerationGUI_FillingDlg::ValueChangedInSpinBox(double newValue) +void GenerationGUI_FillingDlg::ValueChangedInSpinBox( double newValue ) { QObject* send = (QObject*)sender(); - if(send == GroupPoints->SpinBox_1) - myMinDeg = int(newValue); - else if(send == GroupPoints->SpinBox_2) + if ( send == GroupPoints->SpinBox1 ) + myMinDeg = int( newValue ); + else if ( send == GroupPoints->SpinBox2 ) myTol2D = newValue; - else if(send == GroupPoints->SpinBox_3) + else if ( send == GroupPoints->SpinBox3 ) myNbIter = int(newValue); - else if(send == GroupPoints->SpinBox_4) + else if ( send == GroupPoints->SpinBox4 ) myMaxDeg = int(newValue); - else if(send == GroupPoints->SpinBox_5) + else if ( send == GroupPoints->SpinBox5 ) myTol3D = newValue; displayPreview(); diff --git a/src/GenerationGUI/GenerationGUI_FillingDlg.h b/src/GenerationGUI/GenerationGUI_FillingDlg.h index 2b5775fa4..23be3e400 100644 --- a/src/GenerationGUI/GenerationGUI_FillingDlg.h +++ b/src/GenerationGUI/GenerationGUI_FillingDlg.h @@ -1,36 +1,32 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// 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 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. +// 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 +// 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 : GenerationGUI_FillingDlg.h +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // -// -// File : GenerationGUI_FillingDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM - -#ifndef DIALOGBOX_FILLING_H -#define DIALOGBOX_FILLING_H -#include "GenerationGUI.h" +#ifndef GENERATIONGUI_FILLINGDLG_H +#define GENERATIONGUI_FILLINGDLG_H -#include "GEOMBase_Skeleton.h" +#include class DlgRef_1Sel5Spin; @@ -38,43 +34,43 @@ class DlgRef_1Sel5Spin; // class : GenerationGUI_FillingDlg // purpose : //================================================================================= -class GENERATIONGUI_EXPORT GenerationGUI_FillingDlg : public GEOMBase_Skeleton +class GenerationGUI_FillingDlg : public GEOMBase_Skeleton { - Q_OBJECT + Q_OBJECT public: - GenerationGUI_FillingDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, - const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0); - ~GenerationGUI_FillingDlg(); + GenerationGUI_FillingDlg( GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0 ); + ~GenerationGUI_FillingDlg(); protected: - // redefined from GEOMBase_Helper - virtual GEOM::GEOM_IOperations_ptr createOperation(); - virtual bool isValid( QString& msg ); - virtual bool execute( ObjectList& objects ); + // redefined from GEOMBase_Helper + virtual GEOM::GEOM_IOperations_ptr createOperation(); + virtual bool isValid( QString& ); + virtual bool execute( ObjectList& ); private: - void Init(); - void enterEvent(QEvent* e); + void Init(); + void enterEvent( QEvent* ); - GEOM::GEOM_Object_var myCompound; /* compound of curves */ - Standard_Integer myMinDeg; - Standard_Integer myMaxDeg; - Standard_Real myTol3D; - Standard_Real myTol2D; - Standard_Integer myNbIter; - bool myOkCompound; /* to check when curv. compound is defined */ - - DlgRef_1Sel5Spin* GroupPoints; +private: + GEOM::GEOM_Object_var myCompound; /* compound of curves */ + Standard_Integer myMinDeg; + Standard_Integer myMaxDeg; + Standard_Real myTol3D; + Standard_Real myTol2D; + Standard_Integer myNbIter; + bool myOkCompound; /* to check when curv. compound is defined */ + DlgRef_1Sel5Spin* GroupPoints; + private slots: - void ClickOnOk(); - bool ClickOnApply(); - void ActivateThisDialog(); - void LineEditReturnPressed(); - void SelectionIntoArgument(); - void SetEditCurrentArgument(); - void ValueChangedInSpinBox(double newValue); + void ClickOnOk(); + bool ClickOnApply(); + void ActivateThisDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ValueChangedInSpinBox( double ); }; -#endif // DIALOGBOX_FILLING_H +#endif // GENERATIONGUI_FILLINGDLG_H diff --git a/src/GenerationGUI/GenerationGUI_PipeDlg.cxx b/src/GenerationGUI/GenerationGUI_PipeDlg.cxx index a02b4f54b..7df3e97eb 100644 --- a/src/GenerationGUI/GenerationGUI_PipeDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_PipeDlg.cxx @@ -1,42 +1,40 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// 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 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. +// 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 +// 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 : GenerationGUI_PipeDlg.cxx +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // -// -// File : GenerationGUI_PipeDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ #include "GenerationGUI_PipeDlg.h" -#include "GeometryGUI.h" -#include "GEOMBase.h" +#include +#include +#include -#include "SUIT_ResourceMgr.h" -#include "SUIT_Session.h" -#include "SalomeApp_Application.h" -#include "LightApp_SelectionMgr.h" +#include +#include +#include +#include -#include "GEOMImpl_Types.hxx" +#include //================================================================================= // class : GenerationGUI_PipeDlg() @@ -45,40 +43,39 @@ // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -GenerationGUI_PipeDlg::GenerationGUI_PipeDlg(GeometryGUI* theGeometryGUI, QWidget* parent, - const char* name, bool modal, Qt::WindowFlags fl) - :GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) +GenerationGUI_PipeDlg::GenerationGUI_PipeDlg( GeometryGUI* theGeometryGUI, QWidget* parent, + bool modal, Qt::WindowFlags fl ) + : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ) { - QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_PIPE"))); - QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_PIPE" ) ) ); + QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); - setWindowTitle(tr("GEOM_PIPE_TITLE")); + setWindowTitle( tr( "GEOM_PIPE_TITLE" ) ); /***************************************************************/ - GroupConstructors->setTitle(tr("GEOM_PIPE")); - RadioButton1->setIcon(image0); - RadioButton2->setAttribute( Qt::WA_DeleteOnClose ); - RadioButton2->close(); - RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); - RadioButton3->close(); - - GroupPoints = new Ui::DlgRef_2Sel_QTD(); - QWidget* aGroupPointsWidget = new QWidget(this); - GroupPoints->setupUi(aGroupPointsWidget); - aGroupPointsWidget->setObjectName("GroupPoints"); - - GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); - GroupPoints->TextLabel1->setText(tr("GEOM_BASE_OBJECT")); - GroupPoints->TextLabel2->setText(tr("GEOM_PATH_OBJECT")); - GroupPoints->PushButton1->setIcon(image1); - GroupPoints->PushButton2->setIcon(image1); + mainFrame()->GroupConstructors->setTitle( tr( "GEOM_PIPE" ) ); + mainFrame()->RadioButton1->setIcon(image0); + mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose ); + mainFrame()->RadioButton2->close(); + mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); + mainFrame()->RadioButton3->close(); + + GroupPoints = new DlgRef_2Sel( centralWidget() ); + + GroupPoints->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) ); + GroupPoints->TextLabel1->setText( tr( "GEOM_BASE_OBJECT" ) ); + GroupPoints->TextLabel2->setText( tr( "GEOM_PATH_OBJECT" ) ); + GroupPoints->PushButton1->setIcon( image1 ); + GroupPoints->PushButton2->setIcon( image1 ); GroupPoints->LineEdit1->setReadOnly( true ); GroupPoints->LineEdit2->setReadOnly( true ); - gridLayout1->addWidget(aGroupPointsWidget, 2, 0); + QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); + layout->setMargin( 0 ); layout->setSpacing( 6 ); + layout->addWidget( GroupPoints ); /***************************************************************/ - setHelpFileName("pipe_creation.htm"); + setHelpFileName( "pipe_creation.htm" ); /* Initialisations */ Init(); @@ -109,19 +106,19 @@ void GenerationGUI_PipeDlg::Init() myOkBase = myOkPath = false; /* signals and slots connections */ - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); - connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - initName(tr("GEOM_PIPE").toLatin1().constData()); + initName( tr( "GEOM_PIPE" ) ); globalSelection( GEOM_ALLSHAPES ); } @@ -159,43 +156,43 @@ bool GenerationGUI_PipeDlg::ClickOnApply() void GenerationGUI_PipeDlg::SelectionIntoArgument() { erasePreview(); - myEditCurrentArgument->setText(""); + myEditCurrentArgument->setText( "" ); - if(IObjectCount() != 1) { - if(myEditCurrentArgument == GroupPoints->LineEdit1) + if ( IObjectCount() != 1 ) { + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myOkBase = false; - else if(myEditCurrentArgument == GroupPoints->LineEdit2) + else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myOkPath = false; return; } // nbSel == 1 Standard_Boolean testResult = Standard_False; - GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); + GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); - if (!testResult) + if ( !testResult ) return; TopoDS_Shape S; - if(myEditCurrentArgument == GroupPoints->LineEdit1) { + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) { myOkBase = false; - if(!GEOMBase::GetShape(aSelectedObject, S) || - S.ShapeType() == TopAbs_COMPSOLID || - S.ShapeType() == TopAbs_COMPOUND || - S.ShapeType() == TopAbs_SOLID || - S.ShapeType() == TopAbs_SHAPE) + if ( !GEOMBase::GetShape( aSelectedObject, S ) || + S.ShapeType() == TopAbs_COMPSOLID || + S.ShapeType() == TopAbs_COMPOUND || + S.ShapeType() == TopAbs_SOLID || + S.ShapeType() == TopAbs_SHAPE ) return; myBase = aSelectedObject; myOkBase = true; } - else if(myEditCurrentArgument == GroupPoints->LineEdit2) { + else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) { myOkPath = false; - if(!GEOMBase::GetShape(aSelectedObject, S) || - !(S.ShapeType() == TopAbs_WIRE || S.ShapeType() == TopAbs_EDGE) ) + if ( !GEOMBase::GetShape( aSelectedObject, S ) || + !( S.ShapeType() == TopAbs_WIRE || S.ShapeType() == TopAbs_EDGE ) ) return; myPath = aSelectedObject; @@ -215,11 +212,11 @@ void GenerationGUI_PipeDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - if(send == GroupPoints->PushButton1) { + if ( send == GroupPoints->PushButton1 ) { GroupPoints->LineEdit1->setFocus(); myEditCurrentArgument = GroupPoints->LineEdit1; } - else if(send == GroupPoints->PushButton2) { + else if ( send == GroupPoints->PushButton2 ) { GroupPoints->LineEdit2->setFocus(); myEditCurrentArgument = GroupPoints->LineEdit2; } @@ -234,12 +231,11 @@ void GenerationGUI_PipeDlg::SetEditCurrentArgument() void GenerationGUI_PipeDlg::LineEditReturnPressed() { QLineEdit* send = (QLineEdit*)sender(); - if(send == GroupPoints->LineEdit1 || - send == GroupPoints->LineEdit2) - { - myEditCurrentArgument = send; - GEOMBase_Skeleton::LineEditReturnPressed(); - } + if ( send == GroupPoints->LineEdit1 || + send == GroupPoints->LineEdit2 ) { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } } @@ -247,9 +243,9 @@ void GenerationGUI_PipeDlg::LineEditReturnPressed() // function : enterEvent() // purpose : when mouse enter onto the QWidget //================================================================================= -void GenerationGUI_PipeDlg::enterEvent(QEvent* e) +void GenerationGUI_PipeDlg::enterEvent( QEvent* ) { - if ( !GroupConstructors->isEnabled() ) + if ( !mainFrame()->GroupConstructors->isEnabled() ) ActivateThisDialog(); } @@ -262,8 +258,8 @@ void GenerationGUI_PipeDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); globalSelection( GEOM_ALLSHAPES ); - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT(SelectionIntoArgument() ) ); displayPreview(); } diff --git a/src/GenerationGUI/GenerationGUI_PipeDlg.h b/src/GenerationGUI/GenerationGUI_PipeDlg.h index 6e0c58247..ae500fda6 100644 --- a/src/GenerationGUI/GenerationGUI_PipeDlg.h +++ b/src/GenerationGUI/GenerationGUI_PipeDlg.h @@ -1,75 +1,72 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// 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 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. +// 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 +// 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 : GenerationGUI_PipeDlg.h +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // -// -// File : GenerationGUI_PipeDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -#ifndef DIALOGBOX_PIPE_H -#define DIALOGBOX_PIPE_H +#ifndef GENERATIONGUI_PIPEDLG_H +#define GENERATIONGUI_PIPEDLG_H -#include "GenerationGUI.h" +#include -#include "GEOMBase_Skeleton.h" -#include "DlgRef_2Sel_QTD.h" +class DlgRef_2Sel; //================================================================================= // class : GenerationGUI_PipeDlg // purpose : //================================================================================= -class GENERATIONGUI_EXPORT GenerationGUI_PipeDlg : public GEOMBase_Skeleton +class GenerationGUI_PipeDlg : public GEOMBase_Skeleton { - Q_OBJECT + Q_OBJECT public: - GenerationGUI_PipeDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, - const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0); - ~GenerationGUI_PipeDlg(); - + GenerationGUI_PipeDlg( GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0 ); + ~GenerationGUI_PipeDlg(); + protected: - // redefined from GEOMBase_Helper - virtual GEOM::GEOM_IOperations_ptr createOperation(); - virtual bool isValid( QString& msg ); - virtual bool execute( ObjectList& objects ); + // redefined from GEOMBase_Helper + virtual GEOM::GEOM_IOperations_ptr createOperation(); + virtual bool isValid( QString& ); + virtual bool execute( ObjectList& ); private: - void Init(); - void enterEvent(QEvent* e); - - GEOM::GEOM_Object_var myBase; /* Base shape */ - GEOM::GEOM_Object_var myPath; /* Shape, defining the path */ - bool myOkBase; - bool myOkPath; /* to check when arguments are defined */ - - Ui::DlgRef_2Sel_QTD* GroupPoints; + void Init(); + void enterEvent( QEvent* ); + +private: + GEOM::GEOM_Object_var myBase; /* Base shape */ + GEOM::GEOM_Object_var myPath; /* Shape, defining the path */ + bool myOkBase; + bool myOkPath; /* to check when arguments are defined */ + + DlgRef_2Sel* GroupPoints; private slots: - void ClickOnOk(); - bool ClickOnApply(); - void ActivateThisDialog(); - void LineEditReturnPressed(); - void SelectionIntoArgument(); - void SetEditCurrentArgument(); + void ClickOnOk(); + bool ClickOnApply(); + void ActivateThisDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); }; -#endif // DIALOGBOX_PIPE_H +#endif // GENERATIONGUI_PIPEDLG_H diff --git a/src/GenerationGUI/GenerationGUI_PrismDlg.cxx b/src/GenerationGUI/GenerationGUI_PrismDlg.cxx index 58305e14a..1de12e036 100644 --- a/src/GenerationGUI/GenerationGUI_PrismDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_PrismDlg.cxx @@ -1,44 +1,40 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// 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 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. +// 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 +// 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 : GenerationGUI_PrismDlg.cxx +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // -// -// File : GenerationGUI_PrismDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ #include "GenerationGUI_PrismDlg.h" -#include "DlgRef_2Sel1Spin2Check.h" -#include "DlgRef_SpinBox.h" -#include "GeometryGUI.h" -#include "GEOMBase.h" +#include +#include +#include -#include "SUIT_ResourceMgr.h" -#include "SUIT_Session.h" -#include "SalomeApp_Application.h" -#include "LightApp_SelectionMgr.h" +#include +#include +#include +#include -#include "GEOMImpl_Types.hxx" +#include //================================================================================= // class : GenerationGUI_PrismDlg() @@ -47,53 +43,52 @@ // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -GenerationGUI_PrismDlg::GenerationGUI_PrismDlg(GeometryGUI* theGeometryGUI, QWidget* parent, - const char* name, bool modal, Qt::WindowFlags fl) - :GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) +GenerationGUI_PrismDlg::GenerationGUI_PrismDlg( GeometryGUI* theGeometryGUI, QWidget* parent, + bool modal, Qt::WindowFlags fl ) + : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ) { - QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_PRISM"))); - QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); - QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_PRISM_2P"))); + QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_PRISM" ) ) ); + QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); + QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_PRISM_2P" ) ) ); - setWindowTitle(tr("GEOM_EXTRUSION_TITLE")); + setWindowTitle( tr( "GEOM_EXTRUSION_TITLE" ) ); /***************************************************************/ - GroupConstructors->setTitle(tr("GEOM_EXTRUSION")); - RadioButton1->setIcon(image0); - RadioButton2->setIcon(image2); - RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); - RadioButton3->close(); + mainFrame()->GroupConstructors->setTitle( tr( "GEOM_EXTRUSION" ) ); + mainFrame()->RadioButton1->setIcon( image0 ); + mainFrame()->RadioButton2->setIcon( image2 ); + mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); + mainFrame()->RadioButton3->close(); - GroupPoints = new DlgRef_2Sel1Spin2Check(this, "GroupPoints"); + GroupPoints = new DlgRef_2Sel1Spin2Check( centralWidget() ); GroupPoints->CheckButton1->hide(); - GroupPoints->GroupBox1->setTitle(tr("GEOM_EXTRUSION_BSV")); - GroupPoints->TextLabel1->setText(tr("GEOM_BASE")); - GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR")); - GroupPoints->TextLabel3->setText(tr("GEOM_HEIGHT")); - GroupPoints->PushButton1->setIcon(image1); - GroupPoints->PushButton2->setIcon(image1); + GroupPoints->GroupBox1->setTitle( tr( "GEOM_EXTRUSION_BSV" ) ); + GroupPoints->TextLabel1->setText( tr( "GEOM_BASE" ) ); + GroupPoints->TextLabel2->setText( tr( "GEOM_VECTOR" ) ); + GroupPoints->TextLabel3->setText( tr( "GEOM_HEIGHT" ) ); + GroupPoints->PushButton1->setIcon( image1 ); + GroupPoints->PushButton2->setIcon( image1 ); GroupPoints->LineEdit1->setReadOnly( true ); GroupPoints->LineEdit2->setReadOnly( true ); - GroupPoints->CheckButton2->setText(tr("GEOM_REVERSE")); - - GroupPoints2 = new Ui::DlgRef_3Sel_QTD(); - QWidget* aGroupPoints2Widget = new QWidget(this); - GroupPoints2->setupUi(aGroupPoints2Widget); - aGroupPoints2Widget->setObjectName("GroupPoints2"); - - GroupPoints2->GroupBox1->setTitle(tr("GEOM_EXTRUSION_BSV_2P")); - GroupPoints2->TextLabel1->setText(tr("GEOM_BASE")); - GroupPoints2->TextLabel2->setText(tr("GEOM_POINT_I").arg("1")); - GroupPoints2->TextLabel3->setText(tr("GEOM_POINT_I").arg("2")); - GroupPoints2->PushButton1->setIcon(image1); - GroupPoints2->PushButton2->setIcon(image1); - GroupPoints2->PushButton3->setIcon(image1); - - gridLayout1->addWidget(GroupPoints, 2, 0); - gridLayout1->addWidget(aGroupPoints2Widget, 2, 0); + GroupPoints->CheckButton2->setText( tr( "GEOM_REVERSE" ) ); + + GroupPoints2 = new DlgRef_3Sel( centralWidget() ); + + GroupPoints2->GroupBox1->setTitle( tr( "GEOM_EXTRUSION_BSV_2P" ) ); + GroupPoints2->TextLabel1->setText( tr( "GEOM_BASE" ) ); + GroupPoints2->TextLabel2->setText( tr( "GEOM_POINT_I" ).arg( 1 ) ); + GroupPoints2->TextLabel3->setText( tr( "GEOM_POINT_I" ).arg( 2 ) ); + GroupPoints2->PushButton1->setIcon( image1 ); + GroupPoints2->PushButton2->setIcon( image1 ); + GroupPoints2->PushButton3->setIcon( image1 ); + + QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); + layout->setMargin( 0 ); layout->setSpacing( 6 ); + layout->addWidget( GroupPoints ); + layout->addWidget( GroupPoints2 ); /***************************************************************/ - setHelpFileName("extrusion.htm"); + setHelpFileName( "extrusion.htm" ); /* Initialisations */ Init(); @@ -130,46 +125,47 @@ void GenerationGUI_PrismDlg::Init() /* Get setting of step value from file configuration */ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); - double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); + double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100 ); /* min, max, step and decimals for spin boxes & initial values */ - GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - GroupPoints->SpinBox_DX->SetValue(100.0); + initSpinBox( GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, step, 3 ); + GroupPoints->SpinBox_DX->setValue( 100.0 ); /* signals and slots connections */ - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); - - connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); + connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); - connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) ); - connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); + connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect(GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(onReverse())); + connect( GroupPoints->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) ); + // VSR: TODO ->> + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupPoints->SpinBox_DX, SLOT( SetStep( double ) ) ); + // <<- + connect( GroupPoints->CheckButton2, SIGNAL( toggled( bool ) ), this, SLOT( onReverse() ) ); - connect(GroupPoints2->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPoints2->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPoints2->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect( GroupPoints2->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( GroupPoints2->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( GroupPoints2->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect(GroupPoints2->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupPoints2->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupPoints2->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect( GroupPoints2->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( GroupPoints2->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( GroupPoints2->LineEdit3, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - initName(tr("GEOM_EXTRUSION").toLatin1().constData()); + initName( tr( "GEOM_EXTRUSION" ) ); globalSelection( GEOM_ALLSHAPES ); - ConstructorsClicked(0); + ConstructorsClicked( 0 ); } @@ -177,53 +173,54 @@ void GenerationGUI_PrismDlg::Init() // function : ConstructorsClicked() // purpose : Radio button management //================================================================================= -void GenerationGUI_PrismDlg::ConstructorsClicked(int constructorId) +void GenerationGUI_PrismDlg::ConstructorsClicked( int constructorId ) { - disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); + disconnect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), 0, this, 0 ); - switch (constructorId) + switch ( constructorId ) { + case 0: { - case 0: - { - globalSelection( GEOM_POINT ); - - ::qobject_cast( GroupPoints2->gridLayout->parent() )->hide(); - resize(0, 0); - GroupPoints->show(); - - //GroupPoints->LineEdit1->setFocus(); - //myEditCurrentArgument = GroupPoints->LineEdit1; - //displayPreview(); - - myEditCurrentArgument = GroupPoints->LineEdit1; - GroupPoints->LineEdit1->setText(""); - GroupPoints->LineEdit2->setText(""); - GroupPoints2->LineEdit1->setText(""); - GroupPoints2->LineEdit2->setText(""); - GroupPoints2->LineEdit3->setText(""); - myPoint1 = myPoint2 = myBase = myVec = GEOM::GEOM_Object::_nil(); - myOkBase = myOkVec = myOkPnt1 = myOkPnt2 = false; - - break; - } - case 1: - { - GroupPoints->hide(); - resize(0, 0); - ::qobject_cast( GroupPoints2->gridLayout->parent() )->show(); - - myEditCurrentArgument = GroupPoints2->LineEdit1; - GroupPoints2->LineEdit1->setText(""); - GroupPoints2->LineEdit2->setText(""); - GroupPoints2->LineEdit3->setText(""); - myPoint1 = myPoint2 = myBase = myVec = GEOM::GEOM_Object::_nil(); - myOkBase = myOkVec = myOkPnt1 = myOkPnt2 = false; - GroupPoints->LineEdit1->setText(""); - GroupPoints->LineEdit2->setText(""); - - break; - } + globalSelection( GEOM_POINT ); + GroupPoints2->hide(); + GroupPoints->show(); + + //GroupPoints->LineEdit1->setFocus(); + //myEditCurrentArgument = GroupPoints->LineEdit1; + //displayPreview(); + + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->setText( "" ); + GroupPoints->LineEdit2->setText( "" ); + GroupPoints2->LineEdit1->setText( "" ); + GroupPoints2->LineEdit2->setText( "" ); + GroupPoints2->LineEdit3->setText( "" ); + myPoint1 = myPoint2 = myBase = myVec = GEOM::GEOM_Object::_nil(); + myOkBase = myOkVec = myOkPnt1 = myOkPnt2 = false; + + break; } + case 1: + { + GroupPoints->hide(); + GroupPoints2->show(); + + myEditCurrentArgument = GroupPoints2->LineEdit1; + GroupPoints2->LineEdit1->setText( "" ); + GroupPoints2->LineEdit2->setText( "" ); + GroupPoints2->LineEdit3->setText( "" ); + myPoint1 = myPoint2 = myBase = myVec = GEOM::GEOM_Object::_nil(); + myOkBase = myOkVec = myOkPnt1 = myOkPnt2 = false; + GroupPoints->LineEdit1->setText(""); + GroupPoints->LineEdit2->setText(""); + + break; + } + } + + qApp->processEvents(); + updateGeometry(); + resize( minimumSize() ); + displayPreview(); } @@ -260,14 +257,14 @@ bool GenerationGUI_PrismDlg::ClickOnApply() void GenerationGUI_PrismDlg::SelectionIntoArgument() { erasePreview(); - myEditCurrentArgument->setText(""); + myEditCurrentArgument->setText( "" ); - if ( getConstructorId()==0 ) { + if ( getConstructorId() == 0 ) { - if (IObjectCount() != 1) { - if (myEditCurrentArgument == GroupPoints->LineEdit1) + if ( IObjectCount() != 1 ) { + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myOkBase = false; - else if (myEditCurrentArgument == GroupPoints->LineEdit2) + else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myOkVec = false; return; } @@ -277,14 +274,14 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument() GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); - if (!testResult) + if ( !testResult ) return; - if (myEditCurrentArgument == GroupPoints->LineEdit1) { + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) { myBase = aSelectedObject; myOkBase = true; } - else if (myEditCurrentArgument == GroupPoints->LineEdit2) { + else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) { myVec = aSelectedObject; myOkVec = true; } @@ -295,14 +292,14 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument() else { // getConstructorId()==1 - extrusion using 2 points - if (IObjectCount() != 1) { - if (myEditCurrentArgument == GroupPoints2->LineEdit1) + if ( IObjectCount() != 1 ) { + if ( myEditCurrentArgument == GroupPoints2->LineEdit1 ) myOkBase = false; - else if (myEditCurrentArgument == GroupPoints2->LineEdit2) { + else if ( myEditCurrentArgument == GroupPoints2->LineEdit2 ) { myPoint1 = GEOM::GEOM_Object::_nil(); myOkPnt1 = false; } - else if (myEditCurrentArgument == GroupPoints2->LineEdit3) { + else if ( myEditCurrentArgument == GroupPoints2->LineEdit3 ) { myPoint2 = GEOM::GEOM_Object::_nil(); myOkPnt2 = false; } @@ -312,20 +309,20 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument() // nbSel == 1 Standard_Boolean testResult = Standard_False; GEOM::GEOM_Object_var aSelectedObject = - GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); + GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); - if (!testResult || CORBA::is_nil( aSelectedObject )) + if ( !testResult || CORBA::is_nil( aSelectedObject ) ) return; - if (myEditCurrentArgument == GroupPoints2->LineEdit1) { + if ( myEditCurrentArgument == GroupPoints2->LineEdit1 ) { myBase = aSelectedObject; myOkBase = true; } - else if (myEditCurrentArgument == GroupPoints2->LineEdit2) { + else if ( myEditCurrentArgument == GroupPoints2->LineEdit2 ) { myPoint1 = aSelectedObject; myOkPnt1 = true; } - else if (myEditCurrentArgument == GroupPoints2->LineEdit3) { + else if ( myEditCurrentArgument == GroupPoints2->LineEdit3 ) { myPoint2 = aSelectedObject; myOkPnt2 = true; } @@ -346,25 +343,25 @@ void GenerationGUI_PrismDlg::SetEditCurrentArgument() QPushButton* send = (QPushButton*)sender(); globalSelection( GEOM_ALLSHAPES ); - if(send == GroupPoints->PushButton1) { + if ( send == GroupPoints->PushButton1 ) { GroupPoints->LineEdit1->setFocus(); myEditCurrentArgument = GroupPoints->LineEdit1; } - else if(send == GroupPoints->PushButton2) { + else if ( send == GroupPoints->PushButton2 ) { GroupPoints->LineEdit2->setFocus(); myEditCurrentArgument = GroupPoints->LineEdit2; globalSelection( GEOM_LINE ); } - else if(send == GroupPoints2->PushButton1) { + else if ( send == GroupPoints2->PushButton1 ) { GroupPoints2->LineEdit1->setFocus(); myEditCurrentArgument = GroupPoints2->LineEdit1; } - else if(send == GroupPoints2->PushButton2) { + else if ( send == GroupPoints2->PushButton2 ) { GroupPoints2->LineEdit2->setFocus(); myEditCurrentArgument = GroupPoints2->LineEdit2; globalSelection( GEOM_POINT ); } - else if(send == GroupPoints2->PushButton3) { + else if ( send == GroupPoints2->PushButton3 ) { GroupPoints2->LineEdit3->setFocus(); myEditCurrentArgument = GroupPoints2->LineEdit3; globalSelection( GEOM_POINT ); @@ -380,24 +377,23 @@ void GenerationGUI_PrismDlg::SetEditCurrentArgument() void GenerationGUI_PrismDlg::LineEditReturnPressed() { QLineEdit* send = (QLineEdit*)sender(); - if(send == GroupPoints->LineEdit1 || - send == GroupPoints->LineEdit2 || - send == GroupPoints2->LineEdit1 || - send == GroupPoints2->LineEdit2 || - send == GroupPoints2->LineEdit3 ) - { - myEditCurrentArgument = send; - GEOMBase_Skeleton::LineEditReturnPressed(); - } + if ( send == GroupPoints->LineEdit1 || + send == GroupPoints->LineEdit2 || + send == GroupPoints2->LineEdit1 || + send == GroupPoints2->LineEdit2 || + send == GroupPoints2->LineEdit3 ) { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } } //================================================================================= // function : enterEvent() // purpose : when mouse enter onto the QWidget //================================================================================= -void GenerationGUI_PrismDlg::enterEvent(QEvent * e) +void GenerationGUI_PrismDlg::enterEvent( QEvent* ) { - if ( !GroupConstructors->isEnabled() ) + if ( !mainFrame()->GroupConstructors->isEnabled() ) ActivateThisDialog(); } @@ -410,8 +406,8 @@ void GenerationGUI_PrismDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); globalSelection( GEOM_ALLSHAPES ); - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); //GroupPoints->LineEdit1->setFocus(); //myEditCurrentArgument = GroupPoints->LineEdit1; //displayPreview(); @@ -435,7 +431,7 @@ void GenerationGUI_PrismDlg::ValueChangedInSpinBox() //================================================================================= double GenerationGUI_PrismDlg::getHeight() const { - return GroupPoints->SpinBox_DX->GetValue(); + return GroupPoints->SpinBox_DX->value(); } //================================================================================= @@ -464,20 +460,15 @@ bool GenerationGUI_PrismDlg::execute( ObjectList& objects ) { GEOM::GEOM_Object_var anObj; - switch ( getConstructorId() ) - { + switch ( getConstructorId() ) { case 0 : - { - anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> - MakePrismVecH(myBase, myVec, getHeight()); - break; - } + anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )-> + MakePrismVecH( myBase, myVec, getHeight() ); + break; case 1 : - { - anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> - MakePrismTwoPnt(myBase, myPoint1, myPoint2); - break; - } + anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )-> + MakePrismTwoPnt( myBase, myPoint1, myPoint2 ); + break; } if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); @@ -492,6 +483,6 @@ bool GenerationGUI_PrismDlg::execute( ObjectList& objects ) //================================================================================= void GenerationGUI_PrismDlg::onReverse() { - double anOldValue = GroupPoints->SpinBox_DX->GetValue(); - GroupPoints->SpinBox_DX->SetValue( -anOldValue ); + double anOldValue = GroupPoints->SpinBox_DX->value(); + GroupPoints->SpinBox_DX->setValue( -anOldValue ); } diff --git a/src/GenerationGUI/GenerationGUI_PrismDlg.h b/src/GenerationGUI/GenerationGUI_PrismDlg.h index bb6849849..5beda3900 100644 --- a/src/GenerationGUI/GenerationGUI_PrismDlg.h +++ b/src/GenerationGUI/GenerationGUI_PrismDlg.h @@ -1,86 +1,82 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// 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 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. +// 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 +// 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 : GenerationGUI_PrismDlg.h +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // -// -// File : GenerationGUI_PrismDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM - -#ifndef DIALOGBOX_PRISM_H -#define DIALOGBOX_PRISM_H -#include "GenerationGUI.h" +#ifndef GENERATIONGUI_PRISMDLG_H +#define GENERATIONGUI_PRISMDLG_H -#include "GEOMBase_Skeleton.h" -#include "DlgRef_3Sel_QTD.h" +#include +class DlgRef_3Sel; class DlgRef_2Sel1Spin2Check; //================================================================================= // class : GenerationGUI_PrismDlg // purpose : //================================================================================= -class GENERATIONGUI_EXPORT GenerationGUI_PrismDlg : public GEOMBase_Skeleton +class GenerationGUI_PrismDlg : public GEOMBase_Skeleton { - Q_OBJECT + Q_OBJECT public: - GenerationGUI_PrismDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, - const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0); - ~GenerationGUI_PrismDlg(); - + GenerationGUI_PrismDlg( GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0 ); + ~GenerationGUI_PrismDlg(); + protected: - // redefined from GEOMBase_Helper - virtual GEOM::GEOM_IOperations_ptr createOperation(); - virtual bool isValid( QString& msg ); - virtual bool execute( ObjectList& objects ); + // redefined from GEOMBase_Helper + virtual GEOM::GEOM_IOperations_ptr createOperation(); + virtual bool isValid( QString& ); + virtual bool execute( ObjectList& ); -private : - void Init(); - void enterEvent(QEvent* e); - double getHeight() const; - - GEOM::GEOM_Object_var myBase; /* Base shape */ - GEOM::GEOM_Object_var myVec; /* Vector, defining the direction */ - GEOM::GEOM_Object_var myPoint1, myPoint2; /* Points for extrusion */ +private: + void Init(); + void enterEvent( QEvent* ); + double getHeight() const; - bool myOkBase; - bool myOkVec; - bool myOkPnt1; - bool myOkPnt2; - - DlgRef_2Sel1Spin2Check* GroupPoints; - Ui::DlgRef_3Sel_QTD* GroupPoints2; // for second layout for extrusion using 2 points - +private: + GEOM::GEOM_Object_var myBase; /* Base shape */ + GEOM::GEOM_Object_var myVec; /* Vector, defining the direction */ + GEOM::GEOM_Object_var myPoint1, myPoint2; /* Points for extrusion */ + + bool myOkBase; + bool myOkVec; + bool myOkPnt1; + bool myOkPnt2; + + DlgRef_2Sel1Spin2Check* GroupPoints; + DlgRef_3Sel* GroupPoints2; // for second layout for extrusion using 2 points + private slots: - void ClickOnOk(); - bool ClickOnApply(); - void ActivateThisDialog(); - void LineEditReturnPressed(); - void SelectionIntoArgument(); - void SetEditCurrentArgument(); - void ConstructorsClicked(int); - void ValueChangedInSpinBox(); - void onReverse(); + void ClickOnOk(); + bool ClickOnApply(); + void ActivateThisDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ConstructorsClicked( int ); + void ValueChangedInSpinBox(); + void onReverse(); }; -#endif // DIALOGBOX_PRISM_H +#endif // GENERATIONGUI_PRISMDLG_H diff --git a/src/GenerationGUI/GenerationGUI_RevolDlg.cxx b/src/GenerationGUI/GenerationGUI_RevolDlg.cxx index cc59892fb..f68fdefb4 100644 --- a/src/GenerationGUI/GenerationGUI_RevolDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_RevolDlg.cxx @@ -1,45 +1,41 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// 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 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. +// 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 +// 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 : GenerationGUI_RevolDlg.cxx +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // -// -// File : GenerationGUI_RevolDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ #include "GenerationGUI_RevolDlg.h" -#include "DlgRef_2Sel1Spin2Check.h" -#include "DlgRef_SpinBox.h" -#include "GeometryGUI.h" -#include "GEOMBase.h" +#include +#include +#include -#include "SUIT_ResourceMgr.h" -#include "SUIT_Session.h" -#include "SalomeApp_Application.h" -#include "LightApp_SelectionMgr.h" +#include +#include +#include +#include #include -#include "GEOMImpl_Types.hxx" +#include //================================================================================= // class : GenerationGUI_RevolDlg() @@ -48,39 +44,41 @@ // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -GenerationGUI_RevolDlg::GenerationGUI_RevolDlg(GeometryGUI* theGeometryGUI, QWidget* parent, - const char* name, bool modal, Qt::WindowFlags fl) - :GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) +GenerationGUI_RevolDlg::GenerationGUI_RevolDlg( GeometryGUI* theGeometryGUI, QWidget* parent, + bool modal, Qt::WindowFlags fl ) + : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ) { - QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_REVOL"))); - QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_REVOL" ) ) ); + QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); - setWindowTitle(tr("GEOM_REVOLUTION_TITLE")); + setWindowTitle( tr( "GEOM_REVOLUTION_TITLE" ) ); /***************************************************************/ - GroupConstructors->setTitle(tr("GEOM_REVOLUTION")); - RadioButton1->setIcon(image0); - RadioButton2->setAttribute( Qt::WA_DeleteOnClose ); - RadioButton2->close(); - RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); - RadioButton3->close(); - - GroupPoints = new DlgRef_2Sel1Spin2Check(this, "GroupPoints"); + mainFrame()->GroupConstructors->setTitle( tr( "GEOM_REVOLUTION" ) ); + mainFrame()->RadioButton1->setIcon( image0 ); + mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose ); + mainFrame()->RadioButton2->close(); + mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); + mainFrame()->RadioButton3->close(); + + GroupPoints = new DlgRef_2Sel1Spin2Check( centralWidget() ); GroupPoints->CheckButton1->hide(); - GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); - GroupPoints->TextLabel1->setText(tr("GEOM_OBJECT")); - GroupPoints->TextLabel2->setText(tr("GEOM_AXIS")); - GroupPoints->TextLabel3->setText(tr("GEOM_ANGLE")); - GroupPoints->PushButton1->setIcon(image1); - GroupPoints->PushButton2->setIcon(image1); + GroupPoints->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) ); + GroupPoints->TextLabel1->setText( tr( "GEOM_OBJECT" ) ); + GroupPoints->TextLabel2->setText( tr( "GEOM_AXIS" ) ); + GroupPoints->TextLabel3->setText( tr( "GEOM_ANGLE" ) ); + GroupPoints->PushButton1->setIcon( image1 ); + GroupPoints->PushButton2->setIcon( image1 ); GroupPoints->LineEdit1->setReadOnly( true ); GroupPoints->LineEdit2->setReadOnly( true ); - GroupPoints->CheckButton2->setText(tr("GEOM_REVERSE")); + GroupPoints->CheckButton2->setText( tr( "GEOM_REVERSE" ) ); - gridLayout1->addWidget(GroupPoints, 2, 0); + QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); + layout->setMargin( 0 ); layout->setSpacing( 6 ); + layout->addWidget( GroupPoints ); /***************************************************************/ - setHelpFileName("revolution.htm"); + setHelpFileName( "revolution.htm" ); /* Initialisations */ Init(); @@ -112,28 +110,30 @@ void GenerationGUI_RevolDlg::Init() double SpecificStep = 5; /* min, max, step and decimals for spin boxes & initial values */ - GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, SpecificStep, 3); - GroupPoints->SpinBox_DX->SetValue(45.0); + initSpinBox( GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, SpecificStep, 3 ); + GroupPoints->SpinBox_DX->setValue( 45.0 ); /* signals and slots connections */ - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); - connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); - connect(GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(onReverse())); + connect( GroupPoints->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) ); + connect( GroupPoints->CheckButton2, SIGNAL( toggled( bool ) ), this, SLOT( onReverse() ) ); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); + // VSR: TODO ->> + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupPoints->SpinBox_DX, SLOT( SetStep( double ) ) ); + // <<- - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - initName(tr("GEOM_REVOLUTION").toLatin1().constData()); + initName( tr( "GEOM_REVOLUTION" ) ); globalSelection( GEOM_ALLSHAPES ); } @@ -168,7 +168,7 @@ bool GenerationGUI_RevolDlg::ClickOnApply() //purpose : return true if theBase can be used as algo argument //======================================================================= -static bool isAcceptableBase(const TopoDS_Shape& theBase) +static bool isAcceptableBase( const TopoDS_Shape& theBase ) { switch ( theBase.ShapeType() ) { case TopAbs_VERTEX: @@ -181,7 +181,7 @@ static bool isAcceptableBase(const TopoDS_Shape& theBase) case TopAbs_COMPSOLID: return false; case TopAbs_COMPOUND: { - TopExp_Explorer exp( theBase, TopAbs_SOLID); + TopExp_Explorer exp( theBase, TopAbs_SOLID ); return !exp.More(); } default: @@ -197,12 +197,12 @@ static bool isAcceptableBase(const TopoDS_Shape& theBase) void GenerationGUI_RevolDlg::SelectionIntoArgument() { erasePreview(); - myEditCurrentArgument->setText(""); + myEditCurrentArgument->setText( "" ); - if(IObjectCount() != 1) { - if(myEditCurrentArgument == GroupPoints->LineEdit1) + if ( IObjectCount() != 1 ) { + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myOkBase = false; - else if(myEditCurrentArgument == GroupPoints->LineEdit2) + else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myOkAxis = false; return; } @@ -211,10 +211,10 @@ void GenerationGUI_RevolDlg::SelectionIntoArgument() Standard_Boolean testResult = Standard_False; GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); - if (!testResult) + if ( !testResult ) return; - if(myEditCurrentArgument == GroupPoints->LineEdit1) { + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) { TopoDS_Shape S; myOkBase = false; @@ -224,7 +224,7 @@ void GenerationGUI_RevolDlg::SelectionIntoArgument() myBase = aSelectedObject; myOkBase = true; } - else if(myEditCurrentArgument == GroupPoints->LineEdit2) { + else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) { myAxis = aSelectedObject; myOkAxis = true; } @@ -243,11 +243,11 @@ void GenerationGUI_RevolDlg::SetEditCurrentArgument() QPushButton* send = (QPushButton*)sender(); globalSelection( GEOM_ALLSHAPES ); - if(send == GroupPoints->PushButton1) { + if ( send == GroupPoints->PushButton1 ) { GroupPoints->LineEdit1->setFocus(); myEditCurrentArgument = GroupPoints->LineEdit1; } - else if(send == GroupPoints->PushButton2) { + else if ( send == GroupPoints->PushButton2 ) { GroupPoints->LineEdit2->setFocus(); myEditCurrentArgument = GroupPoints->LineEdit2; globalSelection( GEOM_LINE ); @@ -263,12 +263,11 @@ void GenerationGUI_RevolDlg::SetEditCurrentArgument() void GenerationGUI_RevolDlg::LineEditReturnPressed() { QLineEdit* send = (QLineEdit*)sender(); - if(send == GroupPoints->LineEdit1 || - send == GroupPoints->LineEdit2) - { - myEditCurrentArgument = send; - GEOMBase_Skeleton::LineEditReturnPressed(); - } + if ( send == GroupPoints->LineEdit1 || + send == GroupPoints->LineEdit2 ) { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } } @@ -280,7 +279,7 @@ void GenerationGUI_RevolDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); globalSelection( GEOM_ALLSHAPES ); - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT( SelectionIntoArgument() ) ); GroupPoints->LineEdit1->setFocus(); myEditCurrentArgument = GroupPoints->LineEdit1; displayPreview(); @@ -291,9 +290,9 @@ void GenerationGUI_RevolDlg::ActivateThisDialog() // function : enterEvent() // purpose : //================================================================================= -void GenerationGUI_RevolDlg::enterEvent(QEvent* e) +void GenerationGUI_RevolDlg::enterEvent( QEvent* ) { - if ( !GroupConstructors->isEnabled() ) + if ( !mainFrame()->GroupConstructors->isEnabled() ) ActivateThisDialog(); } @@ -314,7 +313,7 @@ void GenerationGUI_RevolDlg::ValueChangedInSpinBox() //================================================================================= double GenerationGUI_RevolDlg::getAngle() const { - return GroupPoints->SpinBox_DX->GetValue(); + return GroupPoints->SpinBox_DX->value(); } //================================================================================= @@ -359,6 +358,6 @@ bool GenerationGUI_RevolDlg::execute( ObjectList& objects ) //================================================================================= void GenerationGUI_RevolDlg::onReverse() { - double anOldValue = GroupPoints->SpinBox_DX->GetValue(); - GroupPoints->SpinBox_DX->SetValue( -anOldValue ); + double anOldValue = GroupPoints->SpinBox_DX->value(); + GroupPoints->SpinBox_DX->setValue( -anOldValue ); } diff --git a/src/GenerationGUI/GenerationGUI_RevolDlg.h b/src/GenerationGUI/GenerationGUI_RevolDlg.h index cbbbfc54a..e37e3fe66 100644 --- a/src/GenerationGUI/GenerationGUI_RevolDlg.h +++ b/src/GenerationGUI/GenerationGUI_RevolDlg.h @@ -1,36 +1,32 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// 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 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. +// 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 +// 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 : GenerationGUI_RevolDlg.h +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // -// -// File : GenerationGUI_RevolDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM - -#ifndef DIALOGBOX_REVOLUTION_H -#define DIALOGBOX_REVOLUTION_H -#include "GenerationGUI.h" +#ifndef GENERATIONGUI_REVOLUTIONDLG_H +#define GENERATIONGUI_REVOLUTIONDLG_H -#include "GEOMBase_Skeleton.h" +#include class DlgRef_2Sel1Spin2Check; @@ -38,42 +34,42 @@ class DlgRef_2Sel1Spin2Check; // class : GenerationGUI_RevolDlg // purpose : //================================================================================= -class GENERATIONGUI_EXPORT GenerationGUI_RevolDlg : public GEOMBase_Skeleton +class GenerationGUI_RevolDlg : public GEOMBase_Skeleton { - Q_OBJECT + Q_OBJECT public: - GenerationGUI_RevolDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, - const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0); - ~GenerationGUI_RevolDlg(); + GenerationGUI_RevolDlg( GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0 ); + ~GenerationGUI_RevolDlg(); protected: - // redefined from GEOMBase_Helper - virtual GEOM::GEOM_IOperations_ptr createOperation(); - virtual bool isValid( QString& msg ); - virtual bool execute( ObjectList& objects ); - -private : - void Init(); - void enterEvent(QEvent* e); - double getAngle() const; - - GEOM::GEOM_Object_var myBase; /* Base shape */ - GEOM::GEOM_Object_var myAxis; /* Axis of the revolution */ - bool myOkBase; - bool myOkAxis; - - DlgRef_2Sel1Spin2Check* GroupPoints; + // redefined from GEOMBase_Helper + virtual GEOM::GEOM_IOperations_ptr createOperation(); + virtual bool isValid( QString& ); + virtual bool execute( ObjectList& ); +private: + void Init(); + void enterEvent( QEvent* ); + double getAngle() const; + +private: + GEOM::GEOM_Object_var myBase; /* Base shape */ + GEOM::GEOM_Object_var myAxis; /* Axis of the revolution */ + bool myOkBase; + bool myOkAxis; + + DlgRef_2Sel1Spin2Check* GroupPoints; + private slots: - void ClickOnOk(); - bool ClickOnApply(); - void ActivateThisDialog(); - void LineEditReturnPressed(); - void SelectionIntoArgument(); - void SetEditCurrentArgument(); - void ValueChangedInSpinBox(); - void onReverse(); + void ClickOnOk(); + bool ClickOnApply(); + void ActivateThisDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ValueChangedInSpinBox(); + void onReverse(); }; -#endif // DIALOGBOX_REVOLUTION_H +#endif // GENERATIONGUI_REVOLUTIONDLG_H diff --git a/src/GenerationGUI/Makefile.am b/src/GenerationGUI/Makefile.am index d7885317f..ffb186a43 100644 --- a/src/GenerationGUI/Makefile.am +++ b/src/GenerationGUI/Makefile.am @@ -1,31 +1,28 @@ -# GEOM GENERATIONGUI : +# GEOM GENERATIONGUI : # -# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# 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 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. +# 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 +# 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 : Makefile.am +# Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com) +# Package : GenerationGUI # -# -# File : Makefile.in -# Author : Damien COQUERET (OCC) -# Modified by : Alexander BORODIN (OCN) - autotools usage -# Module : GEOM -# $Header: include $(top_srcdir)/adm_local/unix/make_common_starter.am @@ -35,20 +32,26 @@ lib_LTLIBRARIES = libGenerationGUI.la # header files salomeinclude_HEADERS = -dist_libGenerationGUI_la_SOURCES = \ - GenerationGUI.cxx \ - GenerationGUI_PrismDlg.cxx \ - GenerationGUI_RevolDlg.cxx \ - GenerationGUI_FillingDlg.cxx \ +dist_libGenerationGUI_la_SOURCES = \ + GenerationGUI.h \ + GenerationGUI_PrismDlg.h \ + GenerationGUI_RevolDlg.h \ + GenerationGUI_FillingDlg.h \ + GenerationGUI_PipeDlg.h \ + \ + GenerationGUI.cxx \ + GenerationGUI_PrismDlg.cxx \ + GenerationGUI_RevolDlg.cxx \ + GenerationGUI_FillingDlg.cxx \ GenerationGUI_PipeDlg.cxx -MOC_FILES = \ - GenerationGUI_PrismDlg_moc.cxx \ - GenerationGUI_RevolDlg_moc.cxx \ - GenerationGUI_FillingDlg_moc.cxx \ +MOC_FILES = \ + GenerationGUI_PrismDlg_moc.cxx \ + GenerationGUI_RevolDlg_moc.cxx \ + GenerationGUI_FillingDlg_moc.cxx \ GenerationGUI_PipeDlg_moc.cxx -nodist_libGenerationGUI_la_SOURCES= \ +nodist_libGenerationGUI_la_SOURCES = \ $(MOC_FILES) #LIB_CLIENT_IDL = SALOME_GenericObj.idl SALOME_Component.idl SALOME_Exception.idl @@ -57,27 +60,28 @@ nodist_libGenerationGUI_la_SOURCES= \ # additionnal information to compil and link file -libGenerationGUI_la_CPPFLAGS = \ - $(QT_INCLUDES) \ - $(VTK_INCLUDES) \ - $(CAS_CPPFLAGS) \ - $(PYTHON_INCLUDES) \ - $(BOOST_CPPFLAGS) \ - $(KERNEL_CXXFLAGS) \ - $(GUI_CXXFLAGS) \ - $(CORBA_CXXFLAGS) \ - $(CORBA_INCLUDES) \ - -I$(srcdir)/../GEOMGUI \ - -I$(srcdir)/../DlgRef \ - -I$(srcdir)/../GEOMBase \ - -I$(srcdir)/../OBJECT \ - -I$(srcdir)/../GEOMClient \ - -I$(srcdir)/../GEOMImpl \ - -I$(srcdir)/../GEOMFiltersSelection \ - -I$(top_builddir)/idl \ +libGenerationGUI_la_CPPFLAGS = \ + $(QT_INCLUDES) \ + $(VTK_INCLUDES) \ + $(CAS_CPPFLAGS) \ + $(PYTHON_INCLUDES) \ + $(BOOST_CPPFLAGS) \ + $(KERNEL_CXXFLAGS) \ + $(GUI_CXXFLAGS) \ + $(CORBA_CXXFLAGS) \ + $(CORBA_INCLUDES) \ + -I$(srcdir)/../GEOMGUI \ + -I$(srcdir)/../DlgRef \ + -I$(srcdir)/../GEOMBase \ + -I$(srcdir)/../OBJECT \ + -I$(srcdir)/../GEOMClient \ + -I$(srcdir)/../GEOMImpl \ + -I$(srcdir)/../GEOMFiltersSelection \ + -I$(top_builddir)/src/DlgRef \ + -I$(top_builddir)/idl \ -I$(top_builddir)/salome_adm/unix -libGenerationGUI_la_LDFLAGS = \ - ../GEOMFiltersSelection/libGEOMFiltersSelection.la \ - ../GEOMBase/libGEOMBase.la \ +libGenerationGUI_la_LDFLAGS = \ + ../GEOMFiltersSelection/libGEOMFiltersSelection.la \ + ../GEOMBase/libGEOMBase.la \ $(CAS_LDPATH) -lTKOffset diff --git a/src/PrimitiveGUI/Makefile.am b/src/PrimitiveGUI/Makefile.am index 4ca0d8793..896585a6a 100644 --- a/src/PrimitiveGUI/Makefile.am +++ b/src/PrimitiveGUI/Makefile.am @@ -1,31 +1,27 @@ -# GEOM PRIMITIVEGUI : -# -# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# 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 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. +# 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 +# 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 : Makefile.am +# Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com) +# Package : PrimitiveGUI # -# -# File : Makefile.in -# Author : Damien COQUERET (OCC) -# Modified by : Alexander BORODIN (OCN) - autotools usage -# Module : GEOM -# $Header: + include $(top_srcdir)/adm_local/unix/make_common_starter.am # header files @@ -34,22 +30,29 @@ salomeinclude_HEADERS = # Libraries targets lib_LTLIBRARIES = libPrimitiveGUI.la -dist_libPrimitiveGUI_la_SOURCES = \ - PrimitiveGUI.cxx \ - PrimitiveGUI_BoxDlg.cxx \ - PrimitiveGUI_CylinderDlg.cxx \ - PrimitiveGUI_SphereDlg.cxx \ - PrimitiveGUI_TorusDlg.cxx \ +dist_libPrimitiveGUI_la_SOURCES = \ + PrimitiveGUI.h \ + PrimitiveGUI_BoxDlg.h \ + PrimitiveGUI_ConeDlg.h \ + PrimitiveGUI_CylinderDlg.h \ + PrimitiveGUI_SphereDlg.h \ + PrimitiveGUI_TorusDlg.h \ + \ + PrimitiveGUI.cxx \ + PrimitiveGUI_BoxDlg.cxx \ + PrimitiveGUI_CylinderDlg.cxx \ + PrimitiveGUI_SphereDlg.cxx \ + PrimitiveGUI_TorusDlg.cxx \ PrimitiveGUI_ConeDlg.cxx -MOC_FILES = \ - PrimitiveGUI_BoxDlg_moc.cxx \ - PrimitiveGUI_CylinderDlg_moc.cxx \ - PrimitiveGUI_SphereDlg_moc.cxx \ - PrimitiveGUI_TorusDlg_moc.cxx \ +MOC_FILES = \ + PrimitiveGUI_BoxDlg_moc.cxx \ + PrimitiveGUI_CylinderDlg_moc.cxx \ + PrimitiveGUI_SphereDlg_moc.cxx \ + PrimitiveGUI_TorusDlg_moc.cxx \ PrimitiveGUI_ConeDlg_moc.cxx -nodist_libPrimitiveGUI_la_SOURCES= \ +nodist_libPrimitiveGUI_la_SOURCES = \ $(MOC_FILES) #LIB_CLIENT_IDL = SALOME_GenericObj.idl SALOME_Component.idl SALOME_Exception.idl @@ -58,26 +61,27 @@ nodist_libPrimitiveGUI_la_SOURCES= \ # additionnal information to compil and link file -libPrimitiveGUI_la_CPPFLAGS = \ - $(QT_INCLUDES) \ - $(VTK_INCLUDES) \ - $(CAS_CPPFLAGS) \ - $(PYTHON_INCLUDES) \ - $(BOOST_CPPFLAGS) \ - $(KERNEL_CXXFLAGS) \ - $(GUI_CXXFLAGS) \ - $(CORBA_CXXFLAGS) \ - $(CORBA_INCLUDES) \ - -I$(srcdir)/../GEOMGUI \ - -I$(srcdir)/../DlgRef \ - -I$(srcdir)/../GEOMBase \ - -I$(srcdir)/../OBJECT \ - -I$(srcdir)/../GEOMClient \ - -I$(srcdir)/../GEOMImpl \ - -I$(srcdir)/../GEOMFiltersSelection \ - -I$(top_builddir)/idl \ +libPrimitiveGUI_la_CPPFLAGS = \ + $(QT_INCLUDES) \ + $(VTK_INCLUDES) \ + $(CAS_CPPFLAGS) \ + $(PYTHON_INCLUDES) \ + $(BOOST_CPPFLAGS) \ + $(KERNEL_CXXFLAGS) \ + $(GUI_CXXFLAGS) \ + $(CORBA_CXXFLAGS) \ + $(CORBA_INCLUDES) \ + -I$(srcdir)/../GEOMGUI \ + -I$(srcdir)/../DlgRef \ + -I$(srcdir)/../GEOMBase \ + -I$(srcdir)/../OBJECT \ + -I$(srcdir)/../GEOMClient \ + -I$(srcdir)/../GEOMImpl \ + -I$(srcdir)/../GEOMFiltersSelection \ + -I$(top_builddir)/src/DlgRef \ + -I$(top_builddir)/idl \ -I$(top_builddir)/salome_adm/unix -libPrimitiveGUI_la_LDFLAGS = \ - ../GEOMFiltersSelection/libGEOMFiltersSelection.la \ +libPrimitiveGUI_la_LDFLAGS = \ + ../GEOMFiltersSelection/libGEOMFiltersSelection.la \ ../GEOMBase/libGEOMBase.la diff --git a/src/PrimitiveGUI/PrimitiveGUI.cxx b/src/PrimitiveGUI/PrimitiveGUI.cxx index 34d7038a2..6a4c6d42f 100644 --- a/src/PrimitiveGUI/PrimitiveGUI.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI.cxx @@ -1,38 +1,34 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : PrimitiveGUI.cxx +// Author : Damien COQUERET, Open CASCADE S.A.S. // -// -// File : PrimitiveGUI.cxx -// Author : Damien COQUERET -// Module : GEOM -// $Header$ - #include "PrimitiveGUI.h" -#include "GeometryGUI.h" -#include "SUIT_Desktop.h" +#include -#include "SalomeApp_Application.h" +#include +#include #include "PrimitiveGUI_BoxDlg.h" // Method BOX #include "PrimitiveGUI_CylinderDlg.h" // Method CYLINDER @@ -40,13 +36,11 @@ #include "PrimitiveGUI_TorusDlg.h" // Method TORUS #include "PrimitiveGUI_ConeDlg.h" // Method CONE -using namespace std; - //======================================================================= // function : PrimitiveGUI() // purpose : Constructor //======================================================================= -PrimitiveGUI::PrimitiveGUI(GeometryGUI* parent) : GEOMGUI(parent) +PrimitiveGUI::PrimitiveGUI( GeometryGUI* parent ) : GEOMGUI( parent ) { } @@ -58,56 +52,53 @@ PrimitiveGUI::~PrimitiveGUI() { } - //======================================================================= // function : OnGUIEvent() // purpose : //======================================================================= -bool PrimitiveGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent) +bool PrimitiveGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) { SalomeApp_Application* app = getGeometryGUI()->getApp(); - if (!app) return false; + if ( !app ) return false; getGeometryGUI()->EmitSignalDeactivateDialog(); QDialog* aDlg = NULL; - switch (theCommandID) - { - case 4021: // BOX - aDlg = new PrimitiveGUI_BoxDlg(getGeometryGUI(), parent, ""); - break; - case 4022: // CYLINDER - aDlg = new PrimitiveGUI_CylinderDlg(getGeometryGUI(), parent, ""); - break; - case 4023: // SPHERE - aDlg = new PrimitiveGUI_SphereDlg(getGeometryGUI(), parent, ""); - break; - case 4024: // TORUS - aDlg = new PrimitiveGUI_TorusDlg(getGeometryGUI(), parent, ""); - break; - case 4025: // CONE - aDlg = new PrimitiveGUI_ConeDlg(getGeometryGUI(), parent, ""); - break; - default: - app->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); - break; - } + switch ( theCommandID ) { + case 4021: // BOX + aDlg = new PrimitiveGUI_BoxDlg( getGeometryGUI(), parent ); + break; + case 4022: // CYLINDER + aDlg = new PrimitiveGUI_CylinderDlg( getGeometryGUI(), parent ); + break; + case 4023: // SPHERE + aDlg = new PrimitiveGUI_SphereDlg( getGeometryGUI(), parent ); + break; + case 4024: // TORUS + aDlg = new PrimitiveGUI_TorusDlg( getGeometryGUI(), parent ); + break; + case 4025: // CONE + aDlg = new PrimitiveGUI_ConeDlg( getGeometryGUI(), parent, "" ); + break; + default: + app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) ); + break; + } - if (aDlg != NULL) + if ( aDlg != NULL ) aDlg->show(); return true; } - //===================================================================================== // EXPORTED METHODS //===================================================================================== extern "C" { -#ifdef WNT - __declspec( dllexport ) +#ifdef WIN32 + __declspec( dllexport ) #endif GEOMGUI* GetLibGUI( GeometryGUI* parent ) { diff --git a/src/PrimitiveGUI/PrimitiveGUI.h b/src/PrimitiveGUI/PrimitiveGUI.h index ff2267323..0b93fbd03 100644 --- a/src/PrimitiveGUI/PrimitiveGUI.h +++ b/src/PrimitiveGUI/PrimitiveGUI.h @@ -1,35 +1,32 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : PrimitiveGUI.h +// Author : Damien COQUERET, Open CASCADE S.A.S. // -// -// File : PrimitiveGUI.h -// Author : Damien COQUERET -// Module : GEOM #ifndef PRIMITIVEGUI_H #define PRIMITIVEGUI_H -#include "GEOMGUI.h" - +#include //================================================================================= // class : PrimitiveGUI @@ -38,10 +35,10 @@ class PrimitiveGUI : public GEOMGUI { public: - PrimitiveGUI(GeometryGUI* parent); + PrimitiveGUI( GeometryGUI* ); ~PrimitiveGUI(); - bool OnGUIEvent(int theCommandID, SUIT_Desktop* parent); + bool OnGUIEvent( int, SUIT_Desktop* ); }; #endif diff --git a/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx index 6d0bbd896..33be3b870 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx @@ -1,47 +1,40 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// 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 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. +// 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 +// 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 : PrimitiveGUI_BoxDlg.cxx +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // -// -// File : PrimitiveGUI_BoxDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ #include "PrimitiveGUI_BoxDlg.h" -#include "DlgRef_3Spin.h" -#include "DlgRef_SpinBox.h" - -#include "GeometryGUI.h" -#include "GEOMBase.h" - -#include "SUIT_ResourceMgr.h" -#include "SUIT_Session.h" -#include "SalomeApp_Application.h" -#include "LightApp_SelectionMgr.h" -#include "GEOMImpl_Types.hxx" +#include +#include +#include -using namespace std; +#include +#include +#include +#include +#include //================================================================================= // class : PrimitiveGUI_BoxDlg() @@ -50,45 +43,43 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -PrimitiveGUI_BoxDlg::PrimitiveGUI_BoxDlg(GeometryGUI* theGeometryGUI, QWidget* parent, - const char* name, bool modal, Qt::WindowFlags fl) - :GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) +PrimitiveGUI_BoxDlg::PrimitiveGUI_BoxDlg( GeometryGUI* theGeometryGUI, QWidget* parent, + bool modal, Qt::WindowFlags fl ) + : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ) { - QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_BOX_2P"))); - QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_BOX_DXYZ"))); - QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT"))); + QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_BOX_2P" ) ) ); + QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_BOX_DXYZ" ) )); + QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); - setWindowTitle(tr("GEOM_BOX_TITLE")); + setWindowTitle( tr( "GEOM_BOX_TITLE" ) ); /***************************************************************/ - GroupConstructors->setTitle(tr("GEOM_BOX")); - RadioButton1->setIcon(image0); - RadioButton2->setIcon(image1); - RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); - RadioButton3->close(); - - GroupPoints = new Ui::DlgRef_2Sel_QTD(); - QWidget* aGroupPointsWidget = new QWidget(this); - GroupPoints->setupUi(aGroupPointsWidget); - aGroupPointsWidget->setObjectName("GroupPoints"); - - GroupPoints->GroupBox1->setTitle(tr("GEOM_DIAGONAL_POINTS")); - GroupPoints->TextLabel1->setText(tr("GEOM_POINT_I").arg("1")); - GroupPoints->TextLabel2->setText(tr("GEOM_POINT_I").arg("2")); - GroupPoints->PushButton1->setIcon(image2); - GroupPoints->PushButton2->setIcon(image2); - - GroupDimensions = new DlgRef_3Spin(this, "GroupDimensions"); - GroupDimensions->GroupBox1->setTitle(tr("GEOM_BOX_OBJ")); - GroupDimensions->TextLabel1->setText(tr("GEOM_DX")); - GroupDimensions->TextLabel2->setText(tr("GEOM_DY")); - GroupDimensions->TextLabel3->setText(tr("GEOM_DZ")); - - gridLayout1->addWidget(aGroupPointsWidget, 2, 0); - gridLayout1->addWidget(GroupDimensions, 2, 0); + mainFrame()->GroupConstructors->setTitle( tr( "GEOM_BOX" ) ); + mainFrame()->RadioButton1->setIcon( image0 ); + mainFrame()->RadioButton2->setIcon( image1 ); + mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); + mainFrame()->RadioButton3->close(); + + GroupPoints = new DlgRef_2Sel( centralWidget() ); + GroupPoints->GroupBox1->setTitle( tr( "GEOM_DIAGONAL_POINTS" ) ); + GroupPoints->TextLabel1->setText( tr( "GEOM_POINT_I" ).arg( 1 ) ); + GroupPoints->TextLabel2->setText( tr( "GEOM_POINT_I" ).arg( 2 ) ); + GroupPoints->PushButton1->setIcon( image2 ); + GroupPoints->PushButton2->setIcon( image2 ); + + GroupDimensions = new DlgRef_3Spin( centralWidget() ); + GroupDimensions->GroupBox1->setTitle( tr( "GEOM_BOX_OBJ" ) ); + GroupDimensions->TextLabel1->setText( tr( "GEOM_DX" ) ); + GroupDimensions->TextLabel2->setText( tr( "GEOM_DY" ) ); + GroupDimensions->TextLabel3->setText( tr( "GEOM_DZ" ) ); + + QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); + layout->setMargin( 0 ); layout->setSpacing( 6 ); + layout->addWidget( GroupPoints ); + layout->addWidget( GroupDimensions ); /***************************************************************/ - setHelpFileName("box.htm"); + setHelpFileName( "box.htm" ); Init(); } @@ -119,43 +110,46 @@ void PrimitiveGUI_BoxDlg::Init() /* Get setting of step value from file configuration */ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); - double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); + double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100 ); /* min, max, step and decimals for spin boxes */ - GroupDimensions->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - GroupDimensions->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - GroupDimensions->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); + initSpinBox( GroupDimensions->SpinBox_DX, COORD_MIN, COORD_MAX, step, 3 ); + initSpinBox( GroupDimensions->SpinBox_DY, COORD_MIN, COORD_MAX, step, 3 ); + initSpinBox( GroupDimensions->SpinBox_DZ, COORD_MIN, COORD_MAX, step, 3 ); double initValue = 200.0; - GroupDimensions->SpinBox_DX->SetValue(initValue); - GroupDimensions->SpinBox_DY->SetValue(initValue); - GroupDimensions->SpinBox_DZ->SetValue(initValue); + GroupDimensions->SpinBox_DX->setValue( initValue ); + GroupDimensions->SpinBox_DY->setValue( initValue ); + GroupDimensions->SpinBox_DZ->setValue( initValue ); /* signals and slots connections */ - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); - connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); + connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) ); - connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect(GroupDimensions->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); - connect(GroupDimensions->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); - connect(GroupDimensions->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + connect( GroupDimensions->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) ); + connect( GroupDimensions->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) ); + connect( GroupDimensions->SpinBox_DZ, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) ); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DZ, SLOT(SetStep(double))); + // VSR: TODO ->> + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupDimensions->SpinBox_DX, SLOT( SetStep( double ) ) ); + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupDimensions->SpinBox_DY, SLOT( SetStep( double ) ) ); + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupDimensions->SpinBox_DZ, SLOT( SetStep( double ) ) ); + // <<- - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - initName( tr( "GEOM_BOX" ).toLatin1().constData() ); - ConstructorsClicked(0); + initName( tr( "GEOM_BOX" ) ); + + ConstructorsClicked( 0 ); } @@ -163,38 +157,39 @@ void PrimitiveGUI_BoxDlg::Init() // function : ConstructorsClicked() // purpose : Radio button management //================================================================================= -void PrimitiveGUI_BoxDlg::ConstructorsClicked(int constructorId) +void PrimitiveGUI_BoxDlg::ConstructorsClicked( int constructorId ) { - disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); + disconnect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication( ) ) )->selectionMgr(), 0, this, 0 ); - switch (constructorId) + switch ( constructorId ) { + case 0: { - case 0: - { - globalSelection( GEOM_POINT ); - - GroupDimensions->hide(); - resize(0, 0); - ::qobject_cast( GroupPoints->gridLayout->parent() )->show(); - - myEditCurrentArgument = GroupPoints->LineEdit1; - GroupPoints->LineEdit1->setText(""); - GroupPoints->LineEdit2->setText(""); - myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); - - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); - break; - } - case 1: - { - ::qobject_cast( GroupPoints->gridLayout->parent() )->hide(); - resize(0, 0); - GroupDimensions->show(); - - break; - } + globalSelection( GEOM_POINT ); + + GroupDimensions->hide(); + GroupPoints->show(); + + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->setText( "" ); + GroupPoints->LineEdit2->setText( "" ); + myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); + + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + break; + } + case 1: + { + GroupPoints->hide(); + GroupDimensions->show(); + break; } + } + + qApp->processEvents(); + updateGeometry(); + resize( minimumSize() ); + displayPreview(); } @@ -234,27 +229,26 @@ void PrimitiveGUI_BoxDlg::SelectionIntoArgument() if ( getConstructorId() != 0 ) return; - myEditCurrentArgument->setText(""); + myEditCurrentArgument->setText( "" ); - if (IObjectCount() != 1) - { - if (myEditCurrentArgument == GroupPoints->LineEdit1) - myPoint1 = GEOM::GEOM_Object::_nil(); - else if ( myEditCurrentArgument == GroupPoints->LineEdit2) - myPoint2 = GEOM::GEOM_Object::_nil(); - return; - } + if ( IObjectCount() != 1 ) { + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) + myPoint1 = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) + myPoint2 = GEOM::GEOM_Object::_nil(); + return; + } // nbSel == 1 Standard_Boolean testResult = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); - if(!testResult || CORBA::is_nil( aSelectedObject )) + if ( !testResult || CORBA::is_nil( aSelectedObject ) ) return; - if(myEditCurrentArgument == GroupPoints->LineEdit1) + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint1 = aSelectedObject; - else if(myEditCurrentArgument == GroupPoints->LineEdit2) + else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myPoint2 = aSelectedObject; myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); @@ -271,9 +265,9 @@ void PrimitiveGUI_BoxDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - if(send == GroupPoints->PushButton1) + if ( send == GroupPoints->PushButton1 ) myEditCurrentArgument = GroupPoints->LineEdit1; - else if(send == GroupPoints->PushButton2) + else if ( send == GroupPoints->PushButton2 ) myEditCurrentArgument = GroupPoints->LineEdit2; globalSelection( GEOM_POINT ); @@ -290,11 +284,10 @@ void PrimitiveGUI_BoxDlg::SetEditCurrentArgument() void PrimitiveGUI_BoxDlg::LineEditReturnPressed() { QLineEdit* send = (QLineEdit*)sender(); - if(send == GroupPoints->LineEdit1 || send == GroupPoints->LineEdit2) - { - myEditCurrentArgument = send; - GEOMBase_Skeleton::LineEditReturnPressed(); - } + if ( send == GroupPoints->LineEdit1 || send == GroupPoints->LineEdit2 ) { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } } @@ -305,8 +298,8 @@ void PrimitiveGUI_BoxDlg::LineEditReturnPressed() void PrimitiveGUI_BoxDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); ConstructorsClicked( getConstructorId() ); } @@ -316,9 +309,9 @@ void PrimitiveGUI_BoxDlg::ActivateThisDialog() // function : enterEvent [REDEFINED] // purpose : //================================================================================= -void PrimitiveGUI_BoxDlg::enterEvent(QEvent* e) +void PrimitiveGUI_BoxDlg::enterEvent( QEvent* ) { - if ( !GroupConstructors->isEnabled() ) + if ( !mainFrame()->GroupConstructors->isEnabled() ) ActivateThisDialog(); } @@ -349,7 +342,7 @@ GEOM::GEOM_IOperations_ptr PrimitiveGUI_BoxDlg::createOperation() //================================================================================= bool PrimitiveGUI_BoxDlg::isValid( QString& msg ) { - return getConstructorId() == 0 ? !(myPoint1->_is_nil() || myPoint2->_is_nil()) : true; + return getConstructorId() == 0 ? !( myPoint1->_is_nil() || myPoint2->_is_nil() ) : true; } @@ -363,8 +356,7 @@ bool PrimitiveGUI_BoxDlg::execute( ObjectList& objects ) GEOM::GEOM_Object_var anObj; - switch ( getConstructorId() ) - { + switch ( getConstructorId() ) { case 0 : { if ( !CORBA::is_nil( myPoint1 ) && !CORBA::is_nil( myPoint2 ) ) { @@ -376,9 +368,9 @@ bool PrimitiveGUI_BoxDlg::execute( ObjectList& objects ) } case 1 : { - double x = GroupDimensions->SpinBox_DX->GetValue(); - double y = GroupDimensions->SpinBox_DY->GetValue(); - double z = GroupDimensions->SpinBox_DZ->GetValue(); + double x = GroupDimensions->SpinBox_DX->value(); + double y = GroupDimensions->SpinBox_DY->value(); + double z = GroupDimensions->SpinBox_DZ->value(); anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeBoxDXDYDZ( x, y, z ); res = true; @@ -396,7 +388,7 @@ bool PrimitiveGUI_BoxDlg::execute( ObjectList& objects ) // function : closeEvent // purpose : //================================================================================= -void PrimitiveGUI_BoxDlg::closeEvent( QCloseEvent* e ) +void PrimitiveGUI_BoxDlg::closeEvent( QCloseEvent* e ) { GEOMBase_Skeleton::closeEvent( e ); } diff --git a/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.h b/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.h index e2dc27c49..0387d7ec9 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.h +++ b/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.h @@ -1,38 +1,34 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// 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 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. +// 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 +// 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 : PrimitiveGUI_BoxDlg.h +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // -// -// File : PrimitiveGUI_BoxDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM - -#ifndef DIALOGBOX_BOX_H -#define DIALOGBOX_BOX_H -#include "GEOMBase_Skeleton.h" -#include "DlgRef_2Sel_QTD.h" +#ifndef PRIMITIVEGUI_BOXDLG_H +#define PRIMITIVEGUI_BOXDLG_H -using namespace std; +#include +class DlgRef_2Sel; class DlgRef_3Spin; //================================================================================= @@ -41,39 +37,39 @@ class DlgRef_3Spin; //================================================================================= class PrimitiveGUI_BoxDlg : public GEOMBase_Skeleton { - Q_OBJECT + Q_OBJECT public: - PrimitiveGUI_BoxDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, - const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0); - ~PrimitiveGUI_BoxDlg(); - + PrimitiveGUI_BoxDlg( GeometryGUI*, QWidget* = 0, bool modal = false, Qt::WindowFlags = 0 ); + ~PrimitiveGUI_BoxDlg(); + protected: - // redefined from GEOMBase_Helper - virtual GEOM::GEOM_IOperations_ptr createOperation(); - virtual bool isValid( QString& ); - virtual bool execute( ObjectList& objects ); - - virtual void closeEvent( QCloseEvent* e ); + // redefined from GEOMBase_Helper + virtual GEOM::GEOM_IOperations_ptr createOperation(); + virtual bool isValid( QString& ); + virtual bool execute( ObjectList& ); + + virtual void closeEvent( QCloseEvent* ); -private : - void Init(); - void enterEvent(QEvent* e); +private: + void Init(); + void enterEvent( QEvent* ); - GEOM::GEOM_Object_var myPoint1, myPoint2; /* Points containing the vector */ - - Ui::DlgRef_2Sel_QTD* GroupPoints; - DlgRef_3Spin* GroupDimensions; +private: + GEOM::GEOM_Object_var myPoint1, myPoint2; /* Points containing the vector */ + + DlgRef_2Sel* GroupPoints; + DlgRef_3Spin* GroupDimensions; private slots: - void ClickOnOk(); - bool ClickOnApply(); - void ActivateThisDialog(); - void LineEditReturnPressed(); - void SelectionIntoArgument(); - void SetEditCurrentArgument(); - void ConstructorsClicked(int); - void ValueChangedInSpinBox(); + void ClickOnOk(); + bool ClickOnApply(); + void ActivateThisDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ConstructorsClicked( int ); + void ValueChangedInSpinBox(); }; -#endif // DIALOGBOX_BOX_H +#endif // PRIMITIVEGUI_BOXDLG_H diff --git a/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx index 9ed6a2e62..56c875601 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx @@ -1,47 +1,40 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// 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 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. +// 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 +// 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 : PrimitiveGUI_ConeDlg.cxx +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // -// -// File : PrimitiveGUI_ConeDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ #include "PrimitiveGUI_ConeDlg.h" -#include "DlgRef_2Sel3Spin.h" -#include "DlgRef_3Spin.h" -#include "DlgRef_SpinBox.h" - -#include "GeometryGUI.h" -#include "GEOMBase.h" -#include "SUIT_ResourceMgr.h" -#include "SUIT_Session.h" -#include "SalomeApp_Application.h" -#include "LightApp_SelectionMgr.h" +#include +#include +#include -#include "GEOMImpl_Types.hxx" +#include +#include +#include +#include -using namespace std; +#include //================================================================================= // class : PrimitiveGUI_ConeDlg() @@ -50,41 +43,43 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -PrimitiveGUI_ConeDlg::PrimitiveGUI_ConeDlg(GeometryGUI* theGeometryGUI, QWidget* parent, - const char* name, bool modal, Qt::WindowFlags fl) - :GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) +PrimitiveGUI_ConeDlg::PrimitiveGUI_ConeDlg( GeometryGUI* theGeometryGUI, QWidget* parent, + bool modal, Qt::WindowFlags fl ) + : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ) { - QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CONE_PV"))); - QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CONE_DXYZ"))); - QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_CONE_PV" ) ) ); + QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_CONE_DXYZ" ) ) ); + QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); - setWindowTitle(tr("GEOM_CONE_TITLE")); + setWindowTitle( tr( "GEOM_CONE_TITLE" ) ); /***************************************************************/ - GroupConstructors->setTitle(tr("GEOM_CONE")); - RadioButton1->setIcon(image0); - RadioButton2->setIcon(image1); - RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); - RadioButton3->close(); - - GroupPoints = new DlgRef_2Sel3Spin(this, "GroupPoints"); - GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); - GroupPoints->TextLabel1->setText(tr("GEOM_BASE_POINT")); - GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR")); - GroupPoints->TextLabel3->setText(tr("GEOM_RADIUS_I").arg("1")); - GroupPoints->TextLabel4->setText(tr("GEOM_RADIUS_I").arg("2")); - GroupPoints->TextLabel5->setText(tr("GEOM_HEIGHT")); - GroupPoints->PushButton1->setIcon(image2); - GroupPoints->PushButton2->setIcon(image2); - - GroupDimensions = new DlgRef_3Spin(this, "GroupDimensions"); - GroupDimensions->GroupBox1->setTitle(tr("GEOM_BOX_OBJ")); - GroupDimensions->TextLabel1->setText(tr("GEOM_RADIUS_I").arg("1")); - GroupDimensions->TextLabel2->setText(tr("GEOM_RADIUS_I").arg("2")); - GroupDimensions->TextLabel3->setText(tr("GEOM_HEIGHT")); - - gridLayout1->addWidget(GroupPoints, 2, 0); - gridLayout1->addWidget(GroupDimensions, 2, 0); + mainFrame()->GroupConstructors->setTitle( tr( "GEOM_CONE" ) ); + mainFrame()->RadioButton1->setIcon( image0 ); + mainFrame()->RadioButton2->setIcon( image1 ); + mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); + mainFrame()->RadioButton3->close(); + + GroupPoints = new DlgRef_2Sel3Spin( centralWidget() ); + GroupPoints->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) ); + GroupPoints->TextLabel1->setText( tr( "GEOM_BASE_POINT" ) ); + GroupPoints->TextLabel2->setText( tr( "GEOM_VECTOR" ) ); + GroupPoints->TextLabel3->setText( tr( "GEOM_RADIUS_I" ).arg( 1 ) ); + GroupPoints->TextLabel4->setText( tr( "GEOM_RADIUS_I" ).arg( 2 ) ); + GroupPoints->TextLabel5->setText( tr( "GEOM_HEIGHT" ) ); + GroupPoints->PushButton1->setIcon( image2 ); + GroupPoints->PushButton2->setIcon( image2 ); + + GroupDimensions = new DlgRef_3Spin( centralWidget() ); + GroupDimensions->GroupBox1->setTitle( tr( "GEOM_BOX_OBJ" ) ); + GroupDimensions->TextLabel1->setText( tr( "GEOM_RADIUS_I" ).arg( 1 ) ); + GroupDimensions->TextLabel2->setText( tr( "GEOM_RADIUS_I" ).arg( 2 ) ); + GroupDimensions->TextLabel3->setText( tr( "GEOM_HEIGHT" ) ); + + QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); + layout->setMargin( 0 ); layout->setSpacing( 6 ); + layout->addWidget( GroupPoints ); + layout->addWidget( GroupDimensions ); /***************************************************************/ setHelpFileName( "cone.htm" ); @@ -99,7 +94,7 @@ PrimitiveGUI_ConeDlg::PrimitiveGUI_ConeDlg(GeometryGUI* theGeometryGUI, QWidget* //================================================================================= PrimitiveGUI_ConeDlg::~PrimitiveGUI_ConeDlg() { - // no need to delete child widgets, Qt does it all for us + // no need to delete child widgets, Qt does it all for us } @@ -118,54 +113,58 @@ void PrimitiveGUI_ConeDlg::Init() /* Get setting of step value from file configuration */ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); - double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); + double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100 ); /* min, max, step and decimals for spin boxes & initial values */ - GroupPoints->SpinBox_DX->RangeStepAndValidator(0.000, COORD_MAX, step, 3); - GroupPoints->SpinBox_DY->RangeStepAndValidator(0.000, COORD_MAX, step, 3); - GroupPoints->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - GroupDimensions->SpinBox_DX->RangeStepAndValidator(0.000, COORD_MAX, step, 3); - GroupDimensions->SpinBox_DY->RangeStepAndValidator(0.000, COORD_MAX, step, 3); - GroupDimensions->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - - double aRadius1(100.0), aRadius2(0.0), aHeight(300.0); - GroupPoints->SpinBox_DX->SetValue(aRadius1); - GroupPoints->SpinBox_DY->SetValue(aRadius2); - GroupPoints->SpinBox_DZ->SetValue(aHeight); - GroupDimensions->SpinBox_DX->SetValue(aRadius1); - GroupDimensions->SpinBox_DY->SetValue(aRadius2); - GroupDimensions->SpinBox_DZ->SetValue(aHeight); + initSpinBox( GroupPoints->SpinBox_DX, 0.000, COORD_MAX, step, 3 ); + initSpinBox( GroupPoints->SpinBox_DY, 0.000, COORD_MAX, step, 3 ); + initSpinBox( GroupPoints->SpinBox_DZ, COORD_MIN, COORD_MAX, step, 3 ); + initSpinBox( GroupDimensions->SpinBox_DX, 0.000, COORD_MAX, step, 3 ); + initSpinBox( GroupDimensions->SpinBox_DY, 0.000, COORD_MAX, step, 3 ); + initSpinBox( GroupDimensions->SpinBox_DZ, COORD_MIN, COORD_MAX, step, 3 ); + + double aRadius1( 100.0 ), aRadius2( 0.0 ), aHeight( 300.0 ); + GroupPoints->SpinBox_DX->setValue( aRadius1 ); + GroupPoints->SpinBox_DY->setValue( aRadius2 ); + GroupPoints->SpinBox_DZ->setValue( aHeight ); + GroupDimensions->SpinBox_DX->setValue( aRadius1 ); + GroupDimensions->SpinBox_DY->setValue( aRadius2 ); + GroupDimensions->SpinBox_DZ->setValue( aHeight ); /* signals and slots connections */ - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); - connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); - - connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - - connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - - connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); - connect(GroupPoints->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); - connect(GroupPoints->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); - connect(GroupDimensions->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); - connect(GroupDimensions->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); - connect(GroupDimensions->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); - - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DY, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DZ, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DZ, SLOT(SetStep(double))); + connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); + + connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) ); + + connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + + connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + + connect( GroupPoints->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) ); + connect( GroupPoints->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) ); + connect( GroupPoints->SpinBox_DZ, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) ); + connect( GroupDimensions->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) ); + connect( GroupDimensions->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) ); + connect( GroupDimensions->SpinBox_DZ, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) ); + + // VSR: TODO ->> + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupPoints->SpinBox_DX, SLOT( SetStep( double ) ) ); + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupPoints->SpinBox_DY, SLOT( SetStep( double ) ) ); + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupPoints->SpinBox_DZ, SLOT( SetStep( double ) ) ); + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupDimensions->SpinBox_DX, SLOT( SetStep( double ) ) ); + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupDimensions->SpinBox_DY, SLOT( SetStep( double ) ) ); + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupDimensions->SpinBox_DZ, SLOT( SetStep( double ) ) ); + // <<- - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - initName( tr( "GEOM_CONE" ).toLatin1().constData() ); - ConstructorsClicked(0); + initName( tr( "GEOM_CONE" ) ); + + ConstructorsClicked( 0 ); } @@ -173,37 +172,39 @@ void PrimitiveGUI_ConeDlg::Init() // function : ConstructorsClicked() // purpose : Radio button management //================================================================================= -void PrimitiveGUI_ConeDlg::ConstructorsClicked(int constructorId) +void PrimitiveGUI_ConeDlg::ConstructorsClicked( int constructorId ) { - disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); + disconnect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), 0, this, 0 ); - switch(constructorId) + switch( constructorId ) { + case 0 : + { + globalSelection( GEOM_POINT ); + GroupDimensions->hide(); + GroupPoints->show(); + + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->setText( "" ); + GroupPoints->LineEdit2->setText( "" ); + myPoint = myDir = GEOM::GEOM_Object::_nil(); + + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + break; + } + case 1 : { - case 0 : - { - globalSelection( GEOM_POINT ); - GroupDimensions->hide(); - resize(0, 0); - GroupPoints->show(); - - myEditCurrentArgument = GroupPoints->LineEdit1; - GroupPoints->LineEdit1->setText(tr("")); - GroupPoints->LineEdit2->setText(tr("")); - myPoint = myDir = GEOM::GEOM_Object::_nil(); - - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); - break; - } - case 1 : - { - GroupPoints->hide(); - resize( 0, 0 ); - GroupDimensions->show(); - - break; - } + GroupPoints->hide(); + GroupDimensions->show(); + + break; } + } + + qApp->processEvents(); + updateGeometry(); + resize( minimumSize() ); + displayPreview(); } @@ -234,16 +235,6 @@ bool PrimitiveGUI_ConeDlg::ClickOnApply() } -//======================================================================= -// function : ClickOnCancel() -// purpose : -//======================================================================= -void PrimitiveGUI_ConeDlg::ClickOnCancel() -{ - GEOMBase_Skeleton::ClickOnCancel(); -} - - //================================================================================= // function : SelectionIntoArgument() // purpose : Called when selection as changed or other case @@ -253,25 +244,24 @@ void PrimitiveGUI_ConeDlg::SelectionIntoArgument() if ( getConstructorId() != 0 ) return; - if(IObjectCount() != 1) - { - if(myEditCurrentArgument == GroupPoints->LineEdit1) - myPoint = GEOM::GEOM_Object::_nil(); - else if (myEditCurrentArgument == GroupPoints->LineEdit2) - myDir = GEOM::GEOM_Object::_nil(); - return; - } + if ( IObjectCount() != 1 ) { + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) + myPoint = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) + myDir = GEOM::GEOM_Object::_nil(); + return; + } /* nbSel == 1 */ Standard_Boolean testResult = Standard_False; GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); - if(!testResult || CORBA::is_nil( aSelectedObject )) + if ( !testResult || CORBA::is_nil( aSelectedObject ) ) return; - if (myEditCurrentArgument == GroupPoints->LineEdit1) + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint = aSelectedObject; - else if (myEditCurrentArgument == GroupPoints->LineEdit2) + else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myDir = aSelectedObject; @@ -288,11 +278,11 @@ void PrimitiveGUI_ConeDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - if(send == GroupPoints->PushButton1) { + if ( send == GroupPoints->PushButton1 ) { myEditCurrentArgument = GroupPoints->LineEdit1; globalSelection( GEOM_POINT ); } - else if(send == GroupPoints->PushButton2) { + else if ( send == GroupPoints->PushButton2 ) { myEditCurrentArgument = GroupPoints->LineEdit2; globalSelection( GEOM_LINE ); } @@ -309,12 +299,11 @@ void PrimitiveGUI_ConeDlg::SetEditCurrentArgument() void PrimitiveGUI_ConeDlg::LineEditReturnPressed() { QLineEdit* send = (QLineEdit*)sender(); - if(send == GroupPoints->LineEdit1 || - send == GroupPoints->LineEdit2) - { - myEditCurrentArgument = send; - GEOMBase_Skeleton::LineEditReturnPressed(); - } + if ( send == GroupPoints->LineEdit1 || + send == GroupPoints->LineEdit2 ) { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } } @@ -325,8 +314,8 @@ void PrimitiveGUI_ConeDlg::LineEditReturnPressed() void PrimitiveGUI_ConeDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); ConstructorsClicked( getConstructorId() ); } @@ -346,9 +335,9 @@ void PrimitiveGUI_ConeDlg::DeactivateActiveDialog() // function : enterEvent() // purpose : //================================================================================= -void PrimitiveGUI_ConeDlg::enterEvent(QEvent* e) +void PrimitiveGUI_ConeDlg::enterEvent( QEvent* ) { - if ( !GroupConstructors->isEnabled() ) + if ( !mainFrame()->GroupConstructors->isEnabled() ) ActivateThisDialog(); } @@ -391,28 +380,23 @@ bool PrimitiveGUI_ConeDlg::execute( ObjectList& objects ) GEOM::GEOM_Object_var anObj; - switch ( getConstructorId() ) - { + switch ( getConstructorId() ) { case 0 : - { - if ( !CORBA::is_nil( myPoint ) && !CORBA::is_nil( myDir ) ){ + if ( !CORBA::is_nil( myPoint ) && !CORBA::is_nil( myDir ) ) { anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeConePntVecR1R2H( myPoint, myDir, getRadius1(), getRadius2(), - getHeight()); + getHeight() ); res = true; } break; - } case 1 : - { - anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeConeR1R2H( getRadius1(), - getRadius2(), - getHeight()); - res = true; - break; - } + anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeConeR1R2H( getRadius1(), + getRadius2(), + getHeight() ); + res = true; + break; } if ( !anObj->_is_nil() ) @@ -439,10 +423,10 @@ void PrimitiveGUI_ConeDlg::closeEvent( QCloseEvent* e ) double PrimitiveGUI_ConeDlg::getRadius1() const { int aConstructorId = getConstructorId(); - if (aConstructorId == 0) - return GroupPoints->SpinBox_DX->GetValue(); - else if (aConstructorId == 1) - return GroupDimensions->SpinBox_DX->GetValue(); + if ( aConstructorId == 0 ) + return GroupPoints->SpinBox_DX->value(); + else if ( aConstructorId == 1 ) + return GroupDimensions->SpinBox_DX->value(); return 0; } @@ -454,10 +438,10 @@ double PrimitiveGUI_ConeDlg::getRadius1() const double PrimitiveGUI_ConeDlg::getRadius2() const { int aConstructorId = getConstructorId(); - if (aConstructorId == 0) - return GroupPoints->SpinBox_DY->GetValue(); - else if (aConstructorId == 1) - return GroupDimensions->SpinBox_DY->GetValue(); + if ( aConstructorId == 0 ) + return GroupPoints->SpinBox_DY->value(); + else if ( aConstructorId == 1 ) + return GroupDimensions->SpinBox_DY->value(); return 0; } @@ -469,9 +453,9 @@ double PrimitiveGUI_ConeDlg::getRadius2() const double PrimitiveGUI_ConeDlg::getHeight() const { int aConstructorId = getConstructorId(); - if (aConstructorId == 0) - return GroupPoints->SpinBox_DZ->GetValue(); - else if (aConstructorId == 1) - return GroupDimensions->SpinBox_DZ->GetValue(); + if ( aConstructorId == 0 ) + return GroupPoints->SpinBox_DZ->value(); + else if ( aConstructorId == 1 ) + return GroupDimensions->SpinBox_DZ->value(); return 0; } diff --git a/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.h b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.h index 3e8f7b650..0895bc4a2 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.h +++ b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.h @@ -1,34 +1,32 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// 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 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. +// 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 +// 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 : PrimitiveGUI_ConeDlg.h +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // -// -// File : PrimitiveGUI_ConeDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -#ifndef DIALOGBOX_CONE_H -#define DIALOGBOX_CONE_H +#ifndef PRIMITIVEGUI_CONEDLG_H +#define PRIMITIVEGUI_CONEDLG_H -#include "GEOMBase_Skeleton.h" +#include class DlgRef_2Sel3Spin; class DlgRef_3Spin; @@ -39,44 +37,43 @@ class DlgRef_3Spin; //================================================================================= class PrimitiveGUI_ConeDlg : public GEOMBase_Skeleton { - Q_OBJECT + Q_OBJECT public: - PrimitiveGUI_ConeDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, - const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0); - ~PrimitiveGUI_ConeDlg(); - + PrimitiveGUI_ConeDlg( GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0 ); + ~PrimitiveGUI_ConeDlg(); + protected: - // redefined from GEOMBase_Helper - virtual GEOM::GEOM_IOperations_ptr createOperation(); - virtual bool isValid( QString& ); - virtual bool execute( ObjectList& objects ); - - virtual void closeEvent( QCloseEvent* e ); + // redefined from GEOMBase_Helper + virtual GEOM::GEOM_IOperations_ptr createOperation(); + virtual bool isValid( QString& ); + virtual bool execute( ObjectList& ); + + virtual void closeEvent( QCloseEvent* ); private: - void Init(); - void enterEvent(QEvent* e); - double getRadius1() const; - double getRadius2() const; - double getHeight() const; + void Init(); + void enterEvent( QEvent* ); + double getRadius1() const; + double getRadius2() const; + double getHeight() const; - GEOM::GEOM_Object_var myPoint, myDir; - - DlgRef_2Sel3Spin* GroupPoints; - DlgRef_3Spin* GroupDimensions; +private: + GEOM::GEOM_Object_var myPoint, myDir; + + DlgRef_2Sel3Spin* GroupPoints; + DlgRef_3Spin* GroupDimensions; private slots: - void ClickOnOk(); - bool ClickOnApply(); - void ClickOnCancel(); - void ActivateThisDialog(); - void DeactivateActiveDialog(); - void LineEditReturnPressed(); - void SelectionIntoArgument(); - void SetEditCurrentArgument(); - void ConstructorsClicked(int); - void ValueChangedInSpinBox(); + void ClickOnOk(); + bool ClickOnApply(); + void ActivateThisDialog(); + void DeactivateActiveDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ConstructorsClicked( int ); + void ValueChangedInSpinBox(); }; -#endif // DIALOGBOX_CONE_H +#endif // PRIMITIVEGUI_CONEDLG_H diff --git a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx index ec511ef40..6f988aef2 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx @@ -1,47 +1,41 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// 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 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. +// 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 +// 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 : PrimitiveGUI_CylinderDlg.cxx +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // -// -// File : PrimitiveGUI_CylinderDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ #include "PrimitiveGUI_CylinderDlg.h" -#include "DlgRef_2Sel2Spin.h" -#include "DlgRef_2Spin.h" -#include "DlgRef_SpinBox.h" -#include "GeometryGUI.h" -#include "GEOMBase.h" +#include -#include "SUIT_ResourceMgr.h" -#include "SUIT_Session.h" -#include "SalomeApp_Application.h" -#include "LightApp_SelectionMgr.h" +#include +#include -#include "GEOMImpl_Types.hxx" +#include +#include +#include +#include -using namespace std; +#include //================================================================================= // class : PrimitiveGUI_CylinderDlg() @@ -50,42 +44,44 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -PrimitiveGUI_CylinderDlg::PrimitiveGUI_CylinderDlg(GeometryGUI* theGeometryGUI, QWidget* parent, - const char* name, bool modal, Qt::WindowFlags fl) - :GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) +PrimitiveGUI_CylinderDlg::PrimitiveGUI_CylinderDlg( GeometryGUI* theGeometryGUI, QWidget* parent, + bool modal, Qt::WindowFlags fl ) + : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ) { - QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CYLINDER_PV"))); - QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CYLINDER_DXYZ"))); - QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_CYLINDER_PV" ) ) ); + QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_CYLINDER_DXYZ" ) ) ); + QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); - setWindowTitle(tr("GEOM_CYLINDER_TITLE")); + setWindowTitle( tr( "GEOM_CYLINDER_TITLE" ) ); /***************************************************************/ - GroupConstructors->setTitle(tr("GEOM_CYLINDER")); - RadioButton1->setIcon(image0); - RadioButton2->setIcon(image1); - RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); - RadioButton3->close(); - - GroupPoints = new DlgRef_2Sel2Spin(this, "GroupPoints"); - GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); - GroupPoints->TextLabel1->setText(tr("GEOM_BASE_POINT")); - GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR")); - GroupPoints->TextLabel3->setText(tr("GEOM_RADIUS")); - GroupPoints->TextLabel4->setText(tr("GEOM_HEIGHT")); - GroupPoints->PushButton1->setIcon(image2); - GroupPoints->PushButton2->setIcon(image2); - - GroupDimensions = new DlgRef_2Spin(this, "GroupDimensions"); - GroupDimensions->GroupBox1->setTitle(tr("GEOM_BOX_OBJ")); - GroupDimensions->TextLabel1->setText(tr("GEOM_RADIUS")); - GroupDimensions->TextLabel2->setText(tr("GEOM_HEIGHT")); - - gridLayout1->addWidget(GroupPoints, 2, 0); - gridLayout1->addWidget(GroupDimensions, 2, 0); + mainFrame()->GroupConstructors->setTitle( tr( "GEOM_CYLINDER" ) ); + mainFrame()->RadioButton1->setIcon( image0 ); + mainFrame()->RadioButton2->setIcon( image1 ); + mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); + mainFrame()->RadioButton3->close(); + + GroupPoints = new DlgRef_2Sel2Spin( centralWidget() ); + GroupPoints->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) ); + GroupPoints->TextLabel1->setText( tr( "GEOM_BASE_POINT" ) ); + GroupPoints->TextLabel2->setText( tr( "GEOM_VECTOR" ) ); + GroupPoints->TextLabel3->setText( tr( "GEOM_RADIUS" ) ); + GroupPoints->TextLabel4->setText( tr( "GEOM_HEIGHT" ) ); + GroupPoints->PushButton1->setIcon( image2 ); + GroupPoints->PushButton2->setIcon( image2 ); + + GroupDimensions = new DlgRef_2Spin( centralWidget() ); + GroupDimensions->GroupBox1->setTitle( tr( "GEOM_BOX_OBJ" ) ); + GroupDimensions->TextLabel1->setText( tr( "GEOM_RADIUS" ) ); + GroupDimensions->TextLabel2->setText( tr( "GEOM_HEIGHT" ) ); + + QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); + layout->setMargin( 0 ); layout->setSpacing( 6 ); + layout->addWidget( GroupPoints ); + layout->addWidget( GroupDimensions ); /***************************************************************/ - setHelpFileName("cylinder.htm"); + setHelpFileName( "cylinder.htm" ); Init(); } @@ -97,7 +93,7 @@ PrimitiveGUI_CylinderDlg::PrimitiveGUI_CylinderDlg(GeometryGUI* theGeometryGUI, //================================================================================= PrimitiveGUI_CylinderDlg::~PrimitiveGUI_CylinderDlg() { - // no need to delete child widgets, Qt does it all for us + // no need to delete child widgets, Qt does it all for us } @@ -116,49 +112,52 @@ void PrimitiveGUI_CylinderDlg::Init() /* Get setting of step value from file configuration */ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); - double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); + double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100 ); /* min, max, step and decimals for spin boxes & initial values */ /* First constructor : radius */ - GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, step, 3); + initSpinBox( GroupPoints->SpinBox_DX, 0.001, COORD_MAX, step, 3 ); /* First constructor : algebric height */ - GroupPoints->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); + initSpinBox( GroupPoints->SpinBox_DY, COORD_MIN, COORD_MAX, step, 3 ); /* Second constructor : radius */ - GroupDimensions->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, step, 3); + initSpinBox( GroupDimensions->SpinBox_DX, 0.001, COORD_MAX, step, 3 ); /* Second constructor : algebric height */ - GroupDimensions->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); + initSpinBox( GroupDimensions->SpinBox_DY, COORD_MIN, COORD_MAX, step, 3 ); - GroupPoints->SpinBox_DX->SetValue(100.0); - GroupPoints->SpinBox_DY->SetValue(300.0); - GroupDimensions->SpinBox_DX->SetValue(100.0); - GroupDimensions->SpinBox_DY->SetValue(300.0); + GroupPoints->SpinBox_DX->setValue( 100.0 ); + GroupPoints->SpinBox_DY->setValue( 300.0 ); + GroupDimensions->SpinBox_DX->setValue( 100.0 ); + GroupDimensions->SpinBox_DY->setValue( 300.0 ); /* signals and slots connections */ - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); - connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); + connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); + + connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) ); - connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); - connect(GroupPoints->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); - connect(GroupDimensions->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); - connect(GroupDimensions->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + connect( GroupPoints->SpinBox_DX, SIGNAL(valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) ); + connect( GroupPoints->SpinBox_DY, SIGNAL(valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) ); + connect( GroupDimensions->SpinBox_DX, SIGNAL(valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) ); + connect( GroupDimensions->SpinBox_DY, SIGNAL(valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) ); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DY, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY, SLOT(SetStep(double))); + // VSR: TODO ->> + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupPoints->SpinBox_DX, SLOT( SetStep( double ) ) ); + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupPoints->SpinBox_DY, SLOT( SetStep( double ) ) ); + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupDimensions->SpinBox_DX, SLOT( SetStep( double ) ) ); + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupDimensions->SpinBox_DY, SLOT( SetStep( double ) ) ); + // <<- - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - initName( tr( "GEOM_CYLINDER" ).toLatin1().constData() ); - ConstructorsClicked(0); + initName( tr( "GEOM_CYLINDER" ) ); + ConstructorsClicked( 0 ); } @@ -166,38 +165,39 @@ void PrimitiveGUI_CylinderDlg::Init() // function : ConstructorsClicked() // purpose : Radio button management //================================================================================= -void PrimitiveGUI_CylinderDlg::ConstructorsClicked(int constructorId) +void PrimitiveGUI_CylinderDlg::ConstructorsClicked( int constructorId ) { - disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); + disconnect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), 0, this, 0 ); - switch(constructorId) + switch( constructorId ) { + case 0 : + { + globalSelection( GEOM_POINT ); + + GroupDimensions->hide(); + GroupPoints->show(); + + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->setText( "" ); + GroupPoints->LineEdit2->setText( "" ); + myPoint = myDir = GEOM::GEOM_Object::_nil(); + + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + break; + } + case 1 : { - case 0 : - { - globalSelection( GEOM_POINT ); - - GroupDimensions->hide(); - resize(0, 0); - GroupPoints->show(); - - myEditCurrentArgument = GroupPoints->LineEdit1; - GroupPoints->LineEdit1->setText(tr("")); - GroupPoints->LineEdit2->setText(tr("")); - myPoint = myDir = GEOM::GEOM_Object::_nil(); - - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); - break; - } - case 1 : - { - GroupPoints->hide(); - resize( 0, 0 ); - GroupDimensions->show(); - - break; - } + GroupPoints->hide(); + GroupDimensions->show(); + break; } + } + + qApp->processEvents(); + updateGeometry(); + resize( minimumSize() ); + displayPreview(); } @@ -228,16 +228,6 @@ bool PrimitiveGUI_CylinderDlg::ClickOnApply() } -//======================================================================= -// function : ClickOnCancel() -// purpose : -//======================================================================= -void PrimitiveGUI_CylinderDlg::ClickOnCancel() -{ - GEOMBase_Skeleton::ClickOnCancel(); -} - - //================================================================================= // function : SelectionIntoArgument() // purpose : Called when selection as changed or other case @@ -247,27 +237,26 @@ void PrimitiveGUI_CylinderDlg::SelectionIntoArgument() if ( getConstructorId() != 0 ) return; - myEditCurrentArgument->setText(""); + myEditCurrentArgument->setText( "" ); - if(IObjectCount() != 1) - { - if(myEditCurrentArgument == GroupPoints->LineEdit1) - myPoint = GEOM::GEOM_Object::_nil(); - else if (myEditCurrentArgument == GroupPoints->LineEdit2) - myDir = GEOM::GEOM_Object::_nil(); - return; - } + if ( IObjectCount() != 1 ) { + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) + myPoint = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) + myDir = GEOM::GEOM_Object::_nil(); + return; + } /* nbSel == 1 */ Standard_Boolean testResult = Standard_False; GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); - if(!testResult || CORBA::is_nil( aSelectedObject )) + if ( !testResult || CORBA::is_nil( aSelectedObject ) ) return; - if (myEditCurrentArgument == GroupPoints->LineEdit1) + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint = aSelectedObject; - else if (myEditCurrentArgument == GroupPoints->LineEdit2) + else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myDir = aSelectedObject; myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); @@ -284,11 +273,11 @@ void PrimitiveGUI_CylinderDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - if(send == GroupPoints->PushButton1) { + if ( send == GroupPoints->PushButton1 ) { myEditCurrentArgument = GroupPoints->LineEdit1; globalSelection( GEOM_POINT ); } - else if(send == GroupPoints->PushButton2) { + else if ( send == GroupPoints->PushButton2 ) { myEditCurrentArgument = GroupPoints->LineEdit2; globalSelection( GEOM_LINE ); } @@ -305,12 +294,11 @@ void PrimitiveGUI_CylinderDlg::SetEditCurrentArgument() void PrimitiveGUI_CylinderDlg::LineEditReturnPressed() { QLineEdit* send = (QLineEdit*)sender(); - if(send == GroupPoints->LineEdit1 || - send == GroupPoints->LineEdit2) - { - myEditCurrentArgument = send; - GEOMBase_Skeleton::LineEditReturnPressed(); - } + if ( send == GroupPoints->LineEdit1 || + send == GroupPoints->LineEdit2 ) { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } } @@ -321,8 +309,8 @@ void PrimitiveGUI_CylinderDlg::LineEditReturnPressed() void PrimitiveGUI_CylinderDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); ConstructorsClicked( getConstructorId() ); } @@ -332,9 +320,9 @@ void PrimitiveGUI_CylinderDlg::ActivateThisDialog() // function : enterEvent() // purpose : //================================================================================= -void PrimitiveGUI_CylinderDlg::enterEvent(QEvent* e) +void PrimitiveGUI_CylinderDlg::enterEvent( QEvent* ) { - if ( !GroupConstructors->isEnabled() ) + if ( !mainFrame()->GroupConstructors->isEnabled() ) ActivateThisDialog(); } @@ -382,30 +370,25 @@ bool PrimitiveGUI_CylinderDlg::isValid( QString& msg ) // function : execute // purpose : //================================================================================= -bool PrimitiveGUI_CylinderDlg::execute( ObjectList& objects ) +bool PrimitiveGUI_CylinderDlg::execute( ObjectList& objects ) { bool res = false; GEOM::GEOM_Object_var anObj; - switch ( getConstructorId() ) - { - case 0 : - { - if ( !CORBA::is_nil( myPoint ) && !CORBA::is_nil( myDir )) { - anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeCylinderPntVecRH(myPoint, myDir, getRadius(), getHeight()); - res = true; - } - break; - } - case 1 : - { - anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeCylinderRH(getRadius(), getHeight()); - res = true; - - break; - } + switch ( getConstructorId() ) { + case 0 : + if ( !CORBA::is_nil( myPoint ) && !CORBA::is_nil( myDir ) ) { + anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeCylinderPntVecRH( myPoint, myDir, getRadius(), getHeight() ); + res = true; } + break; + case 1 : + anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeCylinderRH( getRadius(), getHeight() ); + res = true; + + break; + } if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); @@ -430,10 +413,10 @@ void PrimitiveGUI_CylinderDlg::closeEvent( QCloseEvent* e ) double PrimitiveGUI_CylinderDlg::getRadius() const { int aConstructorId = getConstructorId(); - if (aConstructorId == 0) - return GroupPoints->SpinBox_DX->GetValue(); - else if (aConstructorId == 1) - return GroupDimensions->SpinBox_DX->GetValue(); + if ( aConstructorId == 0 ) + return GroupPoints->SpinBox_DX->value(); + else if ( aConstructorId == 1 ) + return GroupDimensions->SpinBox_DX->value(); return 0; } @@ -445,9 +428,9 @@ double PrimitiveGUI_CylinderDlg::getRadius() const double PrimitiveGUI_CylinderDlg::getHeight() const { int aConstructorId = getConstructorId(); - if (aConstructorId == 0) - return GroupPoints->SpinBox_DY->GetValue(); - else if (aConstructorId == 1) - return GroupDimensions->SpinBox_DY->GetValue(); + if ( aConstructorId == 0 ) + return GroupPoints->SpinBox_DY->value(); + else if ( aConstructorId == 1 ) + return GroupDimensions->SpinBox_DY->value(); return 0; } diff --git a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.h b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.h index ae55f1952..caf9b204e 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.h +++ b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.h @@ -1,82 +1,78 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// 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 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. +// 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 +// 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 : PrimitiveGUI_CylinderDlg.h +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // -// -// File : PrimitiveGUI_CylinderDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -#ifndef DIALOGBOX_CYLINDER_H -#define DIALOGBOX_CYLINDER_H +#ifndef PRIMITIVEGUI_CYLINDERDLG_H +#define PRIMITIVEGUI_CYLINDERDLG_H -#include "GEOMBase_Skeleton.h" +#include class DlgRef_2Sel2Spin; class DlgRef_2Spin; - //================================================================================= // class : PrimitiveGUI_CylinderDlg // purpose : //================================================================================= class PrimitiveGUI_CylinderDlg : public GEOMBase_Skeleton { - Q_OBJECT + Q_OBJECT public: - PrimitiveGUI_CylinderDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, - const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0); - ~PrimitiveGUI_CylinderDlg(); + PrimitiveGUI_CylinderDlg( GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0 ); + ~PrimitiveGUI_CylinderDlg(); protected: - // redefined from GEOMBase_Helper - virtual GEOM::GEOM_IOperations_ptr createOperation(); - virtual bool isValid( QString& ); - virtual bool execute( ObjectList& objects ); - - virtual void closeEvent( QCloseEvent* e ); + // redefined from GEOMBase_Helper + virtual GEOM::GEOM_IOperations_ptr createOperation(); + virtual bool isValid( QString& ); + virtual bool execute( ObjectList& ); + + virtual void closeEvent( QCloseEvent* ); private: - void Init(); - void enterEvent(QEvent* e); - double getRadius() const; - double getHeight() const; - - GEOM::GEOM_Object_var myPoint, myDir; - - DlgRef_2Sel2Spin* GroupPoints; - DlgRef_2Spin* GroupDimensions; + void Init(); + void enterEvent( QEvent* ); + double getRadius() const; + double getHeight() const; + +private: + GEOM::GEOM_Object_var myPoint, myDir; + + DlgRef_2Sel2Spin* GroupPoints; + DlgRef_2Spin* GroupDimensions; private slots: - void ClickOnOk(); - bool ClickOnApply(); - void ClickOnCancel(); - void ActivateThisDialog(); - void DeactivateActiveDialog(); - void LineEditReturnPressed(); - void SelectionIntoArgument(); - void SetEditCurrentArgument(); - void ConstructorsClicked(int); - void ValueChangedInSpinBox(); + void ClickOnOk(); + bool ClickOnApply(); + void ActivateThisDialog(); + void DeactivateActiveDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ConstructorsClicked( int ); + void ValueChangedInSpinBox(); }; -#endif // DIALOGBOX_CYLINDER_H +#endif // PRIMITIVEGUI_CYLINDERDLG_H diff --git a/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx index 8ba5158f1..92d7859c4 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx @@ -1,47 +1,40 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// 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 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. +// 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 +// 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 : PrimitiveGUI_SphereDlg.cxx +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // -// -// File : PrimitiveGUI_SphereDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ #include "PrimitiveGUI_SphereDlg.h" -#include "DlgRef_1Sel1Spin.h" -#include "DlgRef_1Spin.h" -#include "DlgRef_SpinBox.h" - -#include "GeometryGUI.h" -#include "GEOMBase.h" -#include "SUIT_ResourceMgr.h" -#include "SUIT_Session.h" -#include "SalomeApp_Application.h" -#include "LightApp_SelectionMgr.h" +#include +#include +#include -#include "GEOMImpl_Types.hxx" +#include +#include +#include +#include -using namespace std; +#include //================================================================================= // class : PrimitiveGUI_SphereDlg() @@ -50,38 +43,40 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -PrimitiveGUI_SphereDlg::PrimitiveGUI_SphereDlg(GeometryGUI* theGeometryGUI, QWidget* parent, - const char* name, bool modal, Qt::WindowFlags fl) - :GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) +PrimitiveGUI_SphereDlg::PrimitiveGUI_SphereDlg( GeometryGUI* theGeometryGUI, QWidget* parent, + bool modal, Qt::WindowFlags fl ) + :GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl ) { - QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_SPHERE_P"))); - QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_SPHERE_DXYZ"))); - QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_SPHERE_P" ) ) ); + QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_SPHERE_DXYZ" ) ) ); + QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); - setWindowTitle(tr("GEOM_SPHERE_TITLE")); + setWindowTitle( tr( "GEOM_SPHERE_TITLE" ) ); /***************************************************************/ - GroupConstructors->setTitle(tr("GEOM_SPHERE")); - RadioButton1->setIcon(image0); - RadioButton2->setIcon(image1); - RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); - RadioButton3->close(); - - GroupPoints = new DlgRef_1Sel1Spin(this, "GroupPoints"); - GroupPoints->GroupBox1->setTitle(tr("GEOM_SPHERE_CR")); - GroupPoints->TextLabel1->setText(tr("GEOM_CENTER")); - GroupPoints->TextLabel2->setText(tr("GEOM_RADIUS")); - GroupPoints->PushButton1->setIcon(image2); - - GroupDimensions = new DlgRef_1Spin(this, "GroupDimensions"); - GroupDimensions->GroupBox1->setTitle(tr("GEOM_SPHERE_RO")); - GroupDimensions->TextLabel1->setText(tr("GEOM_RADIUS")); - - gridLayout1->addWidget(GroupPoints, 2, 0); - gridLayout1->addWidget(GroupDimensions, 2, 0); + mainFrame()->GroupConstructors->setTitle( tr( "GEOM_SPHERE" ) ); + mainFrame()->RadioButton1->setIcon( image0 ); + mainFrame()->RadioButton2->setIcon( image1 ); + mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); + mainFrame()->RadioButton3->close(); + + GroupPoints = new DlgRef_1Sel1Spin( centralWidget() ); + GroupPoints->GroupBox1->setTitle( tr( "GEOM_SPHERE_CR" ) ); + GroupPoints->TextLabel1->setText( tr( "GEOM_CENTER" ) ); + GroupPoints->TextLabel2->setText( tr( "GEOM_RADIUS" ) ); + GroupPoints->PushButton1->setIcon( image2 ); + + GroupDimensions = new DlgRef_1Spin( centralWidget() ); + GroupDimensions->GroupBox1->setTitle( tr( "GEOM_SPHERE_RO" ) ); + GroupDimensions->TextLabel1->setText( tr( "GEOM_RADIUS" ) ); + + QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); + layout->setMargin( 0 ); layout->setSpacing( 6 ); + layout->addWidget( GroupPoints ); + layout->addWidget( GroupDimensions ); /***************************************************************/ - setHelpFileName("sphere.htm"); + setHelpFileName( "sphere.htm" ); Init(); } @@ -111,33 +106,37 @@ void PrimitiveGUI_SphereDlg::Init() /* Get setting of step value from file configuration */ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); - double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); + double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100 ); /* min, max, step and decimals for spin boxes */ - GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, step, 3); - GroupDimensions->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, step, 3); - GroupPoints->SpinBox_DX->SetValue(100.0); - GroupDimensions->SpinBox_DX->SetValue(100.0); + initSpinBox( GroupPoints->SpinBox_DX, 0.001, COORD_MAX, step, 3 ); + initSpinBox( GroupDimensions->SpinBox_DX, 0.001, COORD_MAX, step, 3 ); + GroupPoints->SpinBox_DX->setValue( 100.0 ); + GroupDimensions->SpinBox_DX->setValue( 100.0 ); /* signals and slots connections */ - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); - connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); + connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); + + connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) ); + + connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect( GroupDimensions->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) ); + connect( GroupPoints->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) ); - connect(GroupDimensions->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); - connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + // VSR: TODO ->> + connect(myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupPoints->SpinBox_DX, SLOT( SetStep( double ) ) ); + connect(myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupDimensions->SpinBox_DX, SLOT( SetStep( double ) ) ); + // <<- - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX, SLOT(SetStep(double))); + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + initName( tr( "GEOM_SPHERE" ) ); - initName(tr("GEOM_SPHERE").toLatin1().constData()); - ConstructorsClicked(0); + ConstructorsClicked( 0 ); } @@ -145,36 +144,38 @@ void PrimitiveGUI_SphereDlg::Init() // function : ConstructorsClicked() // purpose : Radio button management //================================================================================= -void PrimitiveGUI_SphereDlg::ConstructorsClicked(int constructorId) +void PrimitiveGUI_SphereDlg::ConstructorsClicked( int constructorId ) { - disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); + disconnect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), 0, this, 0 ); - switch (constructorId) + switch ( constructorId ) { + case 0: { - case 0: - { - globalSelection( GEOM_POINT ); - GroupDimensions->hide(); - resize(0, 0); - GroupPoints->show(); - - myEditCurrentArgument = GroupPoints->LineEdit1; - GroupPoints->LineEdit1->setText(""); - myPoint = GEOM::GEOM_Object::_nil(); - - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); - break; - } - case 1: - { - GroupPoints->hide(); - resize(0, 0); - GroupDimensions->show(); - - break; - } + globalSelection( GEOM_POINT ); + GroupDimensions->hide(); + GroupPoints->show(); + + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->setText( "" ); + myPoint = GEOM::GEOM_Object::_nil(); + + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + break; + } + case 1: + { + GroupPoints->hide(); + GroupDimensions->show(); + + break; } + } + + qApp->processEvents(); + updateGeometry(); + resize( minimumSize() ); + displayPreview(); } @@ -205,17 +206,6 @@ bool PrimitiveGUI_SphereDlg::ClickOnApply() } - -//======================================================================= -// function : ClickOnCancel() -// purpose : -//======================================================================= -void PrimitiveGUI_SphereDlg::ClickOnCancel() -{ - GEOMBase_Skeleton::ClickOnCancel(); -} - - //================================================================================= // function : SelectionIntoArgument() // purpose : Called when selection as changed or other case @@ -225,19 +215,18 @@ void PrimitiveGUI_SphereDlg::SelectionIntoArgument() if ( getConstructorId() != 0 ) return; - myEditCurrentArgument->setText(""); + myEditCurrentArgument->setText( "" ); - if(IObjectCount() != 1) - { - myPoint = GEOM::GEOM_Object::_nil(); - return; - } + if ( IObjectCount() != 1 ) { + myPoint = GEOM::GEOM_Object::_nil(); + return; + } /* nbSel == 1 ! */ Standard_Boolean testResult = Standard_False; GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); - if (!testResult || CORBA::is_nil( aSelectedObject )) + if ( !testResult || CORBA::is_nil( aSelectedObject ) ) return; myPoint = aSelectedObject; @@ -254,11 +243,10 @@ void PrimitiveGUI_SphereDlg::SelectionIntoArgument() void PrimitiveGUI_SphereDlg::LineEditReturnPressed() { QLineEdit* send = (QLineEdit*)sender(); - if(send == GroupPoints->LineEdit1) - { - myEditCurrentArgument = send; - GEOMBase_Skeleton::LineEditReturnPressed(); - } + if ( send == GroupPoints->LineEdit1 ) { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } } @@ -270,7 +258,7 @@ void PrimitiveGUI_SphereDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - if(send == GroupPoints->PushButton1) { + if ( send == GroupPoints->PushButton1 ) { GroupPoints->LineEdit1->setFocus(); myEditCurrentArgument = GroupPoints->LineEdit1; globalSelection( GEOM_POINT ); @@ -286,8 +274,8 @@ void PrimitiveGUI_SphereDlg::SetEditCurrentArgument() void PrimitiveGUI_SphereDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); ConstructorsClicked( getConstructorId() ); } @@ -307,9 +295,9 @@ void PrimitiveGUI_SphereDlg::DeactivateActiveDialog() // function : enterEvent() // purpose : //================================================================================= -void PrimitiveGUI_SphereDlg::enterEvent(QEvent* e) +void PrimitiveGUI_SphereDlg::enterEvent( QEvent* ) { - if ( !GroupConstructors->isEnabled() ) + if ( !mainFrame()->GroupConstructors->isEnabled() ) ActivateThisDialog(); } @@ -347,14 +335,13 @@ bool PrimitiveGUI_SphereDlg::isValid( QString& msg ) // function : execute // purpose : //================================================================================= -bool PrimitiveGUI_SphereDlg::execute( ObjectList& objects ) +bool PrimitiveGUI_SphereDlg::execute( ObjectList& objects ) { bool res = false; GEOM::GEOM_Object_var anObj; - switch ( getConstructorId() ) - { + switch ( getConstructorId() ) { case 0 : { if ( !CORBA::is_nil( myPoint ) ) { @@ -396,9 +383,9 @@ void PrimitiveGUI_SphereDlg::closeEvent( QCloseEvent* e ) double PrimitiveGUI_SphereDlg::getRadius() const { int aConstructorId = getConstructorId(); - if (aConstructorId == 0) - return GroupPoints->SpinBox_DX->GetValue(); - else if (aConstructorId == 1) - return GroupDimensions->SpinBox_DX->GetValue(); + if ( aConstructorId == 0 ) + return GroupPoints->SpinBox_DX->value(); + else if ( aConstructorId == 1 ) + return GroupDimensions->SpinBox_DX->value(); return 0; } diff --git a/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.h b/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.h index a7801ff6d..fd1aa2ae8 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.h +++ b/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.h @@ -1,81 +1,77 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// 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 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. +// 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 +// 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 : PrimitiveGUI_SphereDlg.h +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // -// -// File : PrimitiveGUI_SphereDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -#ifndef DIALOGBOX_SPHERE_H -#define DIALOGBOX_SPHERE_H +#ifndef PRIMITIVEGUI_SPHEREDLG_H +#define PRIMITIVEGUI_SPHEREDLG_H -#include "GEOMBase_Skeleton.h" +#include class DlgRef_1Sel1Spin; class DlgRef_1Spin; - //================================================================================= // class : PrimitiveGUI_SphereDlg // purpose : //================================================================================= class PrimitiveGUI_SphereDlg : public GEOMBase_Skeleton { - Q_OBJECT + Q_OBJECT public: - PrimitiveGUI_SphereDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, - const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0); - ~PrimitiveGUI_SphereDlg(); + PrimitiveGUI_SphereDlg( GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0 ); + ~PrimitiveGUI_SphereDlg(); protected: - // redefined from GEOMBase_Helper - virtual GEOM::GEOM_IOperations_ptr createOperation(); - virtual bool isValid( QString& ); - virtual bool execute( ObjectList& objects ); - - virtual void closeEvent( QCloseEvent* e ); + // redefined from GEOMBase_Helper + virtual GEOM::GEOM_IOperations_ptr createOperation(); + virtual bool isValid( QString& ); + virtual bool execute( ObjectList& ); + + virtual void closeEvent( QCloseEvent* ); private: - void Init(); - void enterEvent(QEvent* e); - double getRadius() const; - - GEOM::GEOM_Object_var myPoint; /* Center point */ - - DlgRef_1Sel1Spin* GroupPoints; - DlgRef_1Spin* GroupDimensions; + void Init(); + void enterEvent( QEvent* ); + double getRadius() const; + +private: + GEOM::GEOM_Object_var myPoint; /* Center point */ + + DlgRef_1Sel1Spin* GroupPoints; + DlgRef_1Spin* GroupDimensions; private slots: - void ClickOnOk(); - bool ClickOnApply(); - void ClickOnCancel(); - void ActivateThisDialog(); - void DeactivateActiveDialog(); - void LineEditReturnPressed(); - void SelectionIntoArgument(); - void SetEditCurrentArgument(); - void ConstructorsClicked(int); - void ValueChangedInSpinBox(); + void ClickOnOk(); + bool ClickOnApply(); + void ActivateThisDialog(); + void DeactivateActiveDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ConstructorsClicked( int ); + void ValueChangedInSpinBox(); }; #endif // DIALOGBOX_SPHERE_H diff --git a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx index df973503a..f897a6554 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx @@ -1,47 +1,40 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// 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 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. +// 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 +// 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 : PrimitiveGUI_TorusDlg.cxx +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // -// -// File : PrimitiveGUI_TorusDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ #include "PrimitiveGUI_TorusDlg.h" -#include "DlgRef_2Sel2Spin.h" -#include "DlgRef_2Spin.h" -#include "DlgRef_SpinBox.h" - -#include "GeometryGUI.h" -#include "GEOMBase.h" -#include "SUIT_ResourceMgr.h" -#include "SUIT_Session.h" -#include "SalomeApp_Application.h" -#include "LightApp_SelectionMgr.h" +#include +#include +#include -#include "GEOMImpl_Types.hxx" +#include +#include +#include +#include -using namespace std; +#include //================================================================================= // class : PrimitiveGUI_TorusDlg() @@ -50,42 +43,44 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -PrimitiveGUI_TorusDlg::PrimitiveGUI_TorusDlg(GeometryGUI* theGeometryGUI, QWidget* parent, - const char* name, bool modal, Qt::WindowFlags fl) - :GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) +PrimitiveGUI_TorusDlg::PrimitiveGUI_TorusDlg( GeometryGUI* theGeometryGUI, QWidget* parent, + bool modal, Qt::WindowFlags fl ) + : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ) { - QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_TORUS_PV"))); - QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_TORUS_DXYZ"))); - QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_TORUS_PV" ) ) ); + QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_TORUS_DXYZ" ) ) ); + QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); - setWindowTitle(tr("GEOM_TORUS_TITLE")); + setWindowTitle( tr( "GEOM_TORUS_TITLE" ) ); /***************************************************************/ - GroupConstructors->setTitle(tr("GEOM_TORUS")); - RadioButton1->setIcon(image0); - RadioButton2->setIcon(image1); - RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); - RadioButton3->close(); - - GroupPoints = new DlgRef_2Sel2Spin(this, "GroupPoints"); - GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); - GroupPoints->TextLabel1->setText(tr("GEOM_BASE_POINT")); - GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR")); - GroupPoints->TextLabel3->setText(tr("GEOM_RADIUS_I").arg("1")); - GroupPoints->TextLabel4->setText(tr("GEOM_RADIUS_I").arg("2")); - GroupPoints->PushButton1->setIcon(image2); - GroupPoints->PushButton2->setIcon(image2); - - GroupDimensions = new DlgRef_2Spin(this, "GroupDimensions"); - GroupDimensions->GroupBox1->setTitle(tr("GEOM_BOX_OBJ")); - GroupDimensions->TextLabel1->setText(tr("GEOM_RADIUS_I").arg("1")); - GroupDimensions->TextLabel2->setText(tr("GEOM_RADIUS_I").arg("2")); - - gridLayout1->addWidget(GroupPoints, 2, 0); - gridLayout1->addWidget(GroupDimensions, 2, 0); + mainFrame()->GroupConstructors->setTitle( tr( "GEOM_TORUS" ) ); + mainFrame()->RadioButton1->setIcon( image0 ); + mainFrame()->RadioButton2->setIcon( image1 ); + mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); + mainFrame()->RadioButton3->close(); + + GroupPoints = new DlgRef_2Sel2Spin( centralWidget() ); + GroupPoints->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) ); + GroupPoints->TextLabel1->setText( tr( "GEOM_BASE_POINT" ) ); + GroupPoints->TextLabel2->setText( tr( "GEOM_VECTOR" ) ); + GroupPoints->TextLabel3->setText( tr( "GEOM_RADIUS_I" ).arg( 1 ) ); + GroupPoints->TextLabel4->setText( tr( "GEOM_RADIUS_I" ).arg( 2 ) ); + GroupPoints->PushButton1->setIcon( image2 ); + GroupPoints->PushButton2->setIcon( image2 ); + + GroupDimensions = new DlgRef_2Spin( centralWidget() ); + GroupDimensions->GroupBox1->setTitle( tr( "GEOM_BOX_OBJ" ) ); + GroupDimensions->TextLabel1->setText( tr( "GEOM_RADIUS_I" ).arg( 1 ) ); + GroupDimensions->TextLabel2->setText( tr( "GEOM_RADIUS_I" ).arg( 2 ) ); + + QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); + layout->setMargin( 0 ); layout->setSpacing( 6 ); + layout->addWidget( GroupPoints ); + layout->addWidget( GroupDimensions ); /***************************************************************/ - setHelpFileName("turus.htm"); + setHelpFileName( "turus.htm" ); Init(); } @@ -97,7 +92,7 @@ PrimitiveGUI_TorusDlg::PrimitiveGUI_TorusDlg(GeometryGUI* theGeometryGUI, QWidge //================================================================================= PrimitiveGUI_TorusDlg::~PrimitiveGUI_TorusDlg() { - // no need to delete child widgets, Qt does it all for us + // no need to delete child widgets, Qt does it all for us } @@ -116,45 +111,48 @@ void PrimitiveGUI_TorusDlg::Init() /* Get setting of step value from file configuration */ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); - double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); + double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100 ); /* min, max, step and decimals for spin boxes & initial values */ - GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, step, 3); - GroupPoints->SpinBox_DY->RangeStepAndValidator(0.001, COORD_MAX, step, 3); - GroupDimensions->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, step, 3); - GroupDimensions->SpinBox_DY->RangeStepAndValidator(0.001, COORD_MAX, step, 3); + initSpinBox( GroupPoints->SpinBox_DX, 0.001, COORD_MAX, step, 3 ); + initSpinBox( GroupPoints->SpinBox_DY, 0.001, COORD_MAX, step, 3 ); + initSpinBox( GroupDimensions->SpinBox_DX, 0.001, COORD_MAX, step, 3 ); + initSpinBox( GroupDimensions->SpinBox_DY, 0.001, COORD_MAX, step, 3 ); - GroupPoints->SpinBox_DX->SetValue(300.0); - GroupPoints->SpinBox_DY->SetValue(100.0); - GroupDimensions->SpinBox_DX->SetValue(300.0); - GroupDimensions->SpinBox_DY->SetValue(100.0); + GroupPoints->SpinBox_DX->setValue( 300.0 ); + GroupPoints->SpinBox_DY->setValue( 100.0 ); + GroupDimensions->SpinBox_DX->setValue( 300.0 ); + GroupDimensions->SpinBox_DY->setValue( 100.0 ); /* signals and slots connections */ - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); - connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); + connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); - connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) ); - connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); - connect(GroupPoints->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); - connect(GroupDimensions->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); - connect(GroupDimensions->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DY, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY, SLOT(SetStep(double))); + connect( GroupPoints->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) ); + connect( GroupPoints->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) ); + connect( GroupDimensions->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) ); + connect( GroupDimensions->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) ); + + // VSR: TODO ->> + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupPoints->SpinBox_DX, SLOT( SetStep( double ) ) ); + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupPoints->SpinBox_DY, SLOT( SetStep( double ) ) ); + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupDimensions->SpinBox_DX, SLOT( SetStep( double ) ) ); + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupDimensions->SpinBox_DY, SLOT( SetStep( double ) ) ); - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - initName( tr( "GEOM_TORUS" ).toLatin1().constData() ); - ConstructorsClicked(0); + initName( tr( "GEOM_TORUS" ) ); + + ConstructorsClicked( 0 ); } @@ -162,38 +160,40 @@ void PrimitiveGUI_TorusDlg::Init() // function : ConstructorsClicked() // purpose : Radio button management //================================================================================= -void PrimitiveGUI_TorusDlg::ConstructorsClicked(int constructorId) +void PrimitiveGUI_TorusDlg::ConstructorsClicked( int constructorId ) { - disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); + disconnect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), 0, this, 0 ); - switch(constructorId) - { - case 0 : - { - globalSelection( GEOM_LINE ); - - GroupDimensions->hide(); - resize(0, 0); - GroupPoints->show(); - - myEditCurrentArgument = GroupPoints->LineEdit1; - GroupPoints->LineEdit1->setText(tr("")); - GroupPoints->LineEdit2->setText(tr("")); - myPoint = myDir = GEOM::GEOM_Object::_nil(); - - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); - break ; - } - case 1 : - { - GroupPoints->hide(); - resize( 0, 0 ); - GroupDimensions->show(); - - break ; - } + switch( constructorId ) { + case 0 : + { + globalSelection( GEOM_LINE ); + + GroupDimensions->hide(); + GroupPoints->show(); + + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->setText( "" ); + GroupPoints->LineEdit2->setText( "" ); + myPoint = myDir = GEOM::GEOM_Object::_nil(); + + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + break; + } + case 1: + { + GroupPoints->hide(); + GroupDimensions->show(); + + break ; } + } + + qApp->processEvents(); + updateGeometry(); + resize( minimumSize() ); + displayPreview(); } @@ -224,16 +224,6 @@ bool PrimitiveGUI_TorusDlg::ClickOnApply() } -//======================================================================= -// function : ClickOnCancel() -// purpose : -//======================================================================= -void PrimitiveGUI_TorusDlg::ClickOnCancel() -{ - GEOMBase_Skeleton::ClickOnCancel(); -} - - //================================================================================= // function : SelectionIntoArgument() // purpose : Called when selection as changed or other case @@ -243,28 +233,26 @@ void PrimitiveGUI_TorusDlg::SelectionIntoArgument() if ( getConstructorId() != 0 ) return; - myEditCurrentArgument->setText(""); - - if(IObjectCount() != 1) - { - if(myEditCurrentArgument == GroupPoints->LineEdit1) - myPoint = GEOM::GEOM_Object::_nil(); - else if(myEditCurrentArgument == GroupPoints->LineEdit2) - myDir = GEOM::GEOM_Object::_nil(); - return; - } + myEditCurrentArgument->setText( "" ); + if ( IObjectCount() != 1 ) { + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) + myPoint = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) + myDir = GEOM::GEOM_Object::_nil(); + return; + } /* nbSel == 1 */ Standard_Boolean testResult = Standard_False; GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); - if(!testResult || CORBA::is_nil( aSelectedObject )) + if ( !testResult || CORBA::is_nil( aSelectedObject ) ) return; - if(myEditCurrentArgument == GroupPoints->LineEdit1) + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint = aSelectedObject; - else if(myEditCurrentArgument == GroupPoints->LineEdit2) + else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myDir = aSelectedObject; myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); @@ -280,11 +268,11 @@ void PrimitiveGUI_TorusDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - if(send == GroupPoints->PushButton1) { + if ( send == GroupPoints->PushButton1 ) { myEditCurrentArgument = GroupPoints->LineEdit1; globalSelection( GEOM_POINT ); } - else if(send == GroupPoints->PushButton2) { + else if ( send == GroupPoints->PushButton2 ) { myEditCurrentArgument = GroupPoints->LineEdit2; globalSelection( GEOM_LINE ); } @@ -301,12 +289,11 @@ void PrimitiveGUI_TorusDlg::SetEditCurrentArgument() void PrimitiveGUI_TorusDlg::LineEditReturnPressed() { QLineEdit* send = (QLineEdit*)sender(); - if(send == GroupPoints->LineEdit1 || - send == GroupPoints->LineEdit2) - { - myEditCurrentArgument = send; - GEOMBase_Skeleton::LineEditReturnPressed(); - } + if ( send == GroupPoints->LineEdit1 || + send == GroupPoints->LineEdit2 ) { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } } @@ -317,8 +304,8 @@ void PrimitiveGUI_TorusDlg::LineEditReturnPressed() void PrimitiveGUI_TorusDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); ConstructorsClicked( getConstructorId() ); } @@ -328,9 +315,9 @@ void PrimitiveGUI_TorusDlg::ActivateThisDialog() // function : enterEvent() // purpose : //================================================================================= -void PrimitiveGUI_TorusDlg::enterEvent(QEvent* e) +void PrimitiveGUI_TorusDlg::enterEvent( QEvent* ) { - if ( !GroupConstructors->isEnabled() ) + if ( !mainFrame()->GroupConstructors->isEnabled() ) ActivateThisDialog(); } @@ -385,22 +372,17 @@ bool PrimitiveGUI_TorusDlg::execute( ObjectList& objects ) GEOM::GEOM_Object_var anObj; - switch ( getConstructorId() ) - { + switch ( getConstructorId() ) { case 0 : - { if (!CORBA::is_nil( myPoint ) && !CORBA::is_nil( myDir )){ - anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeTorusPntVecRR(myPoint, myDir, getRadius1(), getRadius2()); + anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeTorusPntVecRR( myPoint, myDir, getRadius1(), getRadius2() ); res = true; } break; - } case 1 : - { - anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeTorusRR(getRadius1(), getRadius2()); - res = true; - break; - } + anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeTorusRR( getRadius1(), getRadius2() ); + res = true; + break; } if ( !anObj->_is_nil() ) @@ -427,10 +409,10 @@ void PrimitiveGUI_TorusDlg::closeEvent( QCloseEvent* e ) double PrimitiveGUI_TorusDlg::getRadius1() const { int aConstructorId = getConstructorId(); - if (aConstructorId == 0) - return GroupPoints->SpinBox_DX->GetValue(); - else if (aConstructorId == 1) - return GroupDimensions->SpinBox_DX->GetValue(); + if ( aConstructorId == 0 ) + return GroupPoints->SpinBox_DX->value(); + else if ( aConstructorId == 1 ) + return GroupDimensions->SpinBox_DX->value(); return 0; } @@ -442,9 +424,9 @@ double PrimitiveGUI_TorusDlg::getRadius1() const double PrimitiveGUI_TorusDlg::getRadius2() const { int aConstructorId = getConstructorId(); - if (aConstructorId == 0) - return GroupPoints->SpinBox_DY->GetValue(); - else if (aConstructorId == 1) - return GroupDimensions->SpinBox_DY->GetValue(); + if ( aConstructorId == 0 ) + return GroupPoints->SpinBox_DY->value(); + else if ( aConstructorId == 1 ) + return GroupDimensions->SpinBox_DY->value(); return 0; } diff --git a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.h b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.h index c386679b7..e9e6c7a1f 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.h +++ b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.h @@ -1,82 +1,77 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// 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 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. +// 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 +// 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 : PrimitiveGUI_TorusDlg.h +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // -// -// File : PrimitiveGUI_TorusDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -#ifndef DIALOGBOX_TORUS_H -#define DIALOGBOX_TORUS_H +#ifndef PRIMITIVEGUI_TORUSDLG_H +#define PRIMITIVEGUI_TORUSDLG_H -#include "GEOMBase_Skeleton.h" +#include class DlgRef_2Sel2Spin; class DlgRef_2Spin; - //================================================================================= // class : PrimitiveGUI_TorusDlg // purpose : //================================================================================= class PrimitiveGUI_TorusDlg : public GEOMBase_Skeleton { - Q_OBJECT + Q_OBJECT public: - PrimitiveGUI_TorusDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, - const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0); - ~PrimitiveGUI_TorusDlg(); - + PrimitiveGUI_TorusDlg( GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0 ); + ~PrimitiveGUI_TorusDlg(); + protected: - // redefined from GEOMBase_Helper - virtual GEOM::GEOM_IOperations_ptr createOperation(); - virtual bool isValid( QString& ); - virtual bool execute( ObjectList& objects ); - - virtual void closeEvent( QCloseEvent* e ); + // redefined from GEOMBase_Helper + virtual GEOM::GEOM_IOperations_ptr createOperation(); + virtual bool isValid( QString& ); + virtual bool execute( ObjectList& ); + + virtual void closeEvent( QCloseEvent* ); private: - void Init(); - void enterEvent(QEvent* e); - double getRadius1() const; - double getRadius2() const; - - GEOM::GEOM_Object_var myPoint, myDir; - - DlgRef_2Sel2Spin* GroupPoints; - DlgRef_2Spin* GroupDimensions; - - private slots: - void ClickOnOk(); - bool ClickOnApply(); - void ClickOnCancel(); - void ActivateThisDialog(); - void DeactivateActiveDialog(); - void LineEditReturnPressed(); - void SelectionIntoArgument(); - void SetEditCurrentArgument(); - void ConstructorsClicked(int); - void ValueChangedInSpinBox(); + void Init(); + void enterEvent( QEvent* ); + double getRadius1() const; + double getRadius2() const; + + GEOM::GEOM_Object_var myPoint, myDir; + + DlgRef_2Sel2Spin* GroupPoints; + DlgRef_2Spin* GroupDimensions; + +private slots: + void ClickOnOk(); + bool ClickOnApply(); + void ActivateThisDialog(); + void DeactivateActiveDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ConstructorsClicked( int ); + void ValueChangedInSpinBox(); }; -#endif // DIALOGBOX_TORUS_H +#endif // PRIMITIVEGUI_TORUSDLG_H