From: vsr Date: Mon, 15 Oct 2007 10:41:03 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: snapshot_171207~18 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=496cc5f9ba9ea7ae0e2adc8960a697839c145c20;p=modules%2Fgeom.git *** empty log message *** --- diff --git a/adm_local/unix/make_common_starter.am b/adm_local/unix/make_common_starter.am index 533941331..0980a233f 100644 --- a/adm_local/unix/make_common_starter.am +++ b/adm_local/unix/make_common_starter.am @@ -19,12 +19,12 @@ salomeidldir = $(prefix)/idl/@PACKAGE@ salomeresdir = $(prefix)/share/@PACKAGE@/resources/@MODULE_NAME@ # Directories for installing admin files -admlocaldir = $(prefix)/adm_local -admlocalunixdir = $(admlocaldir)/unix -admlocalm4dir = $(admlocaldir)/unix/config_files +admlocaldir = $(prefix)/adm_local +admlocalunixdir = $(admlocaldir)/unix +admlocalm4dir = $(admlocaldir)/unix/config_files # Shared modules installation directory -sharedpkgpythondir =$(pkgpythondir)/shared_modules +sharedpkgpythondir = $(pkgpythondir)/shared_modules # Documentation directory docdir = $(datadir)/doc/@PACKAGE@ @@ -36,14 +36,19 @@ docdir = $(datadir)/doc/@PACKAGE@ $(MOC) $< -o $@ # qm-files generation -%.qm: %.po - $(MSG2QM) $< $@ +%.qm: %.ts + $(LRELEASE) $< -qm $@ + +# uic-files generation +ui_%.h: %.ui + $(UIC) -o $@ $< EXTRA_DIST=$(MOC_FILES:%_moc.cxx=%.h) $(nodist_salomeres_DATA:%.qm=%.po) mostlyclean-local: rm -f @builddir@/*_moc.cxx rm -f @builddir@/*.qm + rm -f @builddir@/ui_*.h # tests tests: unittest diff --git a/configure.ac b/configure.ac index 70961e746..68fdc8889 100644 --- a/configure.ac +++ b/configure.ac @@ -74,7 +74,7 @@ dnl libtool macro check for CC, LD, NM, LN_S, RANLIB, STRIP + pour les librairie echo echo --------------------------------------------- -echo Coniguring production +echo Configuring production echo --------------------------------------------- echo AC_ENABLE_DEBUG(yes) @@ -234,14 +234,6 @@ echo CHECK_QT -echo -echo --------------------------------------------- -echo testing msg2qm -echo --------------------------------------------- -echo - -CHECK_MSG2QM - echo echo --------------------------------------------- echo testing VTK @@ -304,12 +296,20 @@ fi echo echo --------------------------------------------- -echo Testing Kernel +echo Testing SALOME KERNEL module echo --------------------------------------------- echo CHECK_KERNEL +echo +echo --------------------------------------------- +echo Testing SALOME GUI module +echo --------------------------------------------- +echo + +CHECK_SALOME_GUI + echo echo --------------------------------------------- echo Summary @@ -317,7 +317,7 @@ echo --------------------------------------------- echo echo Configure -variables="cc_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok omniORB_ok boost_ok occ_ok doxygen_ok graphviz_ok Kernel_ok" +variables="cc_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok omniORB_ok boost_ok occ_ok doxygen_ok graphviz_ok Kernel_ok SalomeGUI_ok" for var in $variables do @@ -330,7 +330,7 @@ echo "Default ORB : $DEFAULT_ORB" echo dnl We don t need to say when we re entering directories if we re using -dnl GNU make becuase make does it for us. +dnl GNU make because make does it for us. if test "X$GMAKE" = "Xyes"; then AC_SUBST(SETX) SETX=":" else diff --git a/src/BasicGUI/BasicGUI.cxx b/src/BasicGUI/BasicGUI.cxx index 74a894916..03787d29c 100644 --- a/src/BasicGUI/BasicGUI.cxx +++ b/src/BasicGUI/BasicGUI.cxx @@ -1,46 +1,29 @@ -// 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 : BasicGUI.cxx -// Author : Damien COQUERET -// Module : GEOM -// $Header$ +// File : BasicGUI.cxx +// Author : Damien COQUERET, Open CASCADE S.A.S. +// #include "BasicGUI.h" -#include "GeometryGUI.h" - -#include "SUIT_Session.h" -#include "SUIT_Desktop.h" -#include "SUIT_ViewWindow.h" -#include "OCCViewer_ViewWindow.h" -#include "OCCViewer_ViewModel.h" -#include "OCCViewer_ViewManager.h" -#include "OCCViewer_ViewPort3d.h" - -#include -#include -#include -#include #include "BasicGUI_PointDlg.h" // Method POINT #include "BasicGUI_LineDlg.h" // Method LINE @@ -53,16 +36,29 @@ #include "BasicGUI_WorkingPlaneDlg.h" // Method WORKING PLANE #include "BasicGUI_MarkerDlg.h" // Method REPAIR -#include +#include -using namespace std; +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include //======================================================================= // function : BasicGUI() // purpose : Constructor //======================================================================= -BasicGUI::BasicGUI( GeometryGUI* parent ) : - GEOMGUI(parent) +BasicGUI::BasicGUI( GeometryGUI* parent ) + : GEOMGUI( parent ) { } @@ -79,51 +75,50 @@ BasicGUI::~BasicGUI() // function : OnGUIEvent() // purpose : //======================================================================= -bool BasicGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent) +bool BasicGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) { getGeometryGUI()->EmitSignalDeactivateDialog(); QDialog* aDlg = NULL; - switch ( theCommandID ) - { - case 4011: // POINT - aDlg = new BasicGUI_PointDlg( getGeometryGUI(), parent, "" ); - break; - case 4012: // LINE - aDlg = new BasicGUI_LineDlg( getGeometryGUI(), parent, "" ); - break; - case 4013: // CIRCLE - aDlg = new BasicGUI_CircleDlg( getGeometryGUI(), parent, ""); - break; - case 4014: // ELLIPSE - aDlg = new BasicGUI_EllipseDlg( getGeometryGUI(), parent, "" ); - break; - case 4015: // ARC - aDlg = new BasicGUI_ArcDlg( getGeometryGUI(), parent, "" ); - break ; - case 4016: // VECTOR - aDlg = new BasicGUI_VectorDlg( getGeometryGUI(), parent, "" ); - break; - case 4017: // PLANE - aDlg = new BasicGUI_PlaneDlg( getGeometryGUI(), parent, ""); - break; - case 4018: // WORKING PLANE - aDlg = new BasicGUI_WorkingPlaneDlg( getGeometryGUI(), parent, "" ); - break; - case 4019: // CURVE - aDlg = new BasicGUI_CurveDlg( getGeometryGUI(), parent, "" ); - break; - case 4020: // REPAIR - aDlg = new BasicGUI_MarkerDlg( getGeometryGUI(), parent ); - break; - default: - SUIT_Session::session()->activeApplication()->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); - break; - } - + switch ( theCommandID ) { + case 4011: // POINT + aDlg = new BasicGUI_PointDlg( getGeometryGUI(), parent, "" ); + break; + case 4012: // LINE + aDlg = new BasicGUI_LineDlg( getGeometryGUI(), parent, "" ); + break; + case 4013: // CIRCLE + aDlg = new BasicGUI_CircleDlg( getGeometryGUI(), parent, ""); + break; + case 4014: // ELLIPSE + aDlg = new BasicGUI_EllipseDlg( getGeometryGUI(), parent, "" ); + break; + case 4015: // ARC + aDlg = new BasicGUI_ArcDlg( getGeometryGUI(), parent, "" ); + break ; + case 4016: // VECTOR + aDlg = new BasicGUI_VectorDlg( getGeometryGUI(), parent, "" ); + break; + case 4017: // PLANE + aDlg = new BasicGUI_PlaneDlg( getGeometryGUI(), parent, ""); + break; + case 4018: // WORKING PLANE + aDlg = new BasicGUI_WorkingPlaneDlg( getGeometryGUI(), parent, "" ); + break; + case 4019: // CURVE + aDlg = new BasicGUI_CurveDlg( getGeometryGUI(), parent, "" ); + break; + case 4020: // REPAIR + aDlg = new BasicGUI_MarkerDlg( getGeometryGUI(), parent ); + break; + default: + SUIT_Session::session()->activeApplication()->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) ); + break; + } + if ( aDlg != NULL ) aDlg->show(); - + return true; } @@ -137,15 +132,13 @@ bool BasicGUI::OnMousePress( QMouseEvent* pe, SUIT_Desktop* parent, SUIT_ViewWin QDialog* aDlg = getGeometryGUI()->GetActiveDialogBox(); // Create Point dialog, OCC viewer - if ( aDlg && ( QString(aDlg->metaObject()->className()).compare("BasicGUI_PointDlg") == 0) && + if ( aDlg && ( QString( aDlg->metaObject()->className() ).compare( "BasicGUI_PointDlg" ) == 0 ) && theViewWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() && - pe->modifiers() != Qt::ControlModifier ) - { + pe->modifiers() != Qt::ControlModifier ) { BasicGUI_PointDlg* aPntDlg = (BasicGUI_PointDlg*) aDlg; - if ( aPntDlg->acceptMouseEvent() ) - { + if ( aPntDlg->acceptMouseEvent() ) { OCCViewer_Viewer* anOCCViewer = - ((OCCViewer_ViewManager*)(theViewWindow->getViewManager()))->getOCCViewer(); + ( (OCCViewer_ViewManager*)( theViewWindow->getViewManager() ) )->getOCCViewer(); Handle(AIS_InteractiveContext) ic = anOCCViewer->getAISContext(); gp_Pnt aPnt; @@ -157,14 +150,12 @@ bool BasicGUI::OnMousePress( QMouseEvent* pe, SUIT_Desktop* parent, SUIT_ViewWin ic->Select(); // New selection ic->InitSelected(); - if ( ic->MoreSelected() ) - { + if ( ic->MoreSelected() ) { TopoDS_Shape aShape = ic->SelectedShape(); if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX ) aPnt = BRep_Tool::Pnt( TopoDS::Vertex( ic->SelectedShape() ) ); } - else - { + else { OCCViewer_ViewPort3d* vp = ((OCCViewer_ViewWindow*)theViewWindow)->getViewPort(); aPnt = ConvertClickToPoint( pe->x(), pe->y(), vp->getView() ); } @@ -180,25 +171,25 @@ bool BasicGUI::OnMousePress( QMouseEvent* pe, SUIT_Desktop* parent, SUIT_ViewWin // function : ConvertClickToPoint() // purpose : Returns the point clicked in 3D view //======================================================================= -gp_Pnt BasicGUI::ConvertClickToPoint( int x, int y, Handle(V3d_View) aView) +gp_Pnt BasicGUI::ConvertClickToPoint( int x, int y, Handle(V3d_View) aView ) { V3d_Coordinate XEye, YEye, ZEye, XAt, YAt, ZAt; - aView->Eye(XEye, YEye, ZEye); + aView->Eye( XEye, YEye, ZEye ); - aView->At(XAt, YAt, ZAt); - gp_Pnt EyePoint(XEye, YEye, ZEye); - gp_Pnt AtPoint(XAt, YAt, ZAt); + aView->At( XAt, YAt, ZAt ); + gp_Pnt EyePoint( XEye, YEye, ZEye ); + gp_Pnt AtPoint( XAt, YAt, ZAt ); - gp_Vec EyeVector(EyePoint, AtPoint); - gp_Dir EyeDir(EyeVector); + gp_Vec EyeVector( EyePoint, AtPoint ); + gp_Dir EyeDir( EyeVector ); - gp_Pln PlaneOfTheView = gp_Pln(AtPoint,EyeDir); + gp_Pln PlaneOfTheView = gp_Pln( AtPoint, EyeDir ); Standard_Real X, Y, Z; - aView->Convert(x, y, X, Y, Z); - gp_Pnt ConvertedPoint(X, Y, Z); + aView->Convert( x, y, X, Y, Z ); + gp_Pnt ConvertedPoint( X, Y, Z ); - gp_Pnt2d ConvertedPointOnPlane = ProjLib::Project(PlaneOfTheView, ConvertedPoint); - gp_Pnt ResultPoint = ElSLib::Value(ConvertedPointOnPlane.X(), ConvertedPointOnPlane.Y(), PlaneOfTheView); + gp_Pnt2d ConvertedPointOnPlane = ProjLib::Project( PlaneOfTheView, ConvertedPoint ); + gp_Pnt ResultPoint = ElSLib::Value( ConvertedPointOnPlane.X(), ConvertedPointOnPlane.Y(), PlaneOfTheView ); return ResultPoint; } @@ -207,7 +198,7 @@ gp_Pnt BasicGUI::ConvertClickToPoint( int x, int y, Handle(V3d_View) aView) //===================================================================================== extern "C" { -GEOM_BASICGUI_EXPORT + BASICGUI_EXPORT GEOMGUI* GetLibGUI( GeometryGUI* parent ) { return new BasicGUI( parent ); diff --git a/src/BasicGUI/BasicGUI.h b/src/BasicGUI/BasicGUI.h index 867ede745..062c00639 100644 --- a/src/BasicGUI/BasicGUI.h +++ b/src/BasicGUI/BasicGUI.h @@ -1,52 +1,50 @@ -// 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 : BasicGUI.h +// Author : Damien COQUERET, Open CASCADE S.A.S. // -// -// File : BasicGUI.h -// Author : Damien COQUERET -// Module : GEOM #ifndef BASICGUI_H #define BASICGUI_H #include "GEOM_BasicGUI.hxx" -#include "GEOMGUI.h" +#include #include //================================================================================= // class : BasicGUI // purpose : //================================================================================= -class GEOM_BASICGUI_EXPORT BasicGUI : public GEOMGUI +class BASICGUI_EXPORT BasicGUI : public GEOMGUI { public: - BasicGUI( GeometryGUI* parent ); + BasicGUI( GeometryGUI* ); ~BasicGUI(); - bool OnGUIEvent(int theCommandID, SUIT_Desktop* parent); - bool OnMousePress(QMouseEvent* pe, SUIT_Desktop* parent, SUIT_ViewWindow* theViewWindow); + bool OnGUIEvent( int, SUIT_Desktop* ); + bool OnMousePress( QMouseEvent*, SUIT_Desktop*, SUIT_ViewWindow* ); - gp_Pnt ConvertClickToPoint( int x, int y, Handle(V3d_View) aView ); + gp_Pnt ConvertClickToPoint( int, int, Handle(V3d_View) ); }; -#endif +#endif // BASICGUI_H diff --git a/src/BasicGUI/BasicGUI_ArcDlg.cxx b/src/BasicGUI/BasicGUI_ArcDlg.cxx index 0334bc5c0..4693d8524 100644 --- a/src/BasicGUI/BasicGUI_ArcDlg.cxx +++ b/src/BasicGUI/BasicGUI_ArcDlg.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 : BasicGUI_ArcDlg.cxx +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // -// -// File : BasicGUI_ArcDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ #include "BasicGUI_ArcDlg.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 : BasicGUI_ArcDlg() @@ -47,32 +43,29 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -BasicGUI_ArcDlg::BasicGUI_ArcDlg(GeometryGUI* theGeometryGUI, QWidget* parent, - const char* name, bool modal, Qt::WindowFlags fl) - : GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) +BasicGUI_ArcDlg::BasicGUI_ArcDlg( GeometryGUI* theGeometryGUI, QWidget* parent, + const char* name, bool modal, Qt::WindowFlags fl ) + : GEOMBase_Skeleton( theGeometryGUI, parent, name, 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"))); - QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + 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" ) ) ); + QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); - setWindowTitle(tr("GEOM_ARC_TITLE")); + setWindowTitle( tr( "GEOM_ARC_TITLE" ) ); /***************************************************************/ - GroupConstructors->setTitle(tr("GEOM_ARC")); - RadioButton1->setIcon(image0); - RadioButton2->setIcon(image1); - RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); - RadioButton3->close(); - - Group3Pnts = new Ui::DlgRef_3Sel_QTD(); - QWidget* aGroup3PntsWidget = new QWidget(this); - Group3Pnts->setupUi(aGroup3PntsWidget); - aGroup3PntsWidget->setObjectName("Group3Pnts"); - - Group3Pnts->GroupBox1->setTitle(tr("GEOM_POINTS")); - Group3Pnts->TextLabel1->setText(tr("GEOM_POINT_I").arg("1")); - Group3Pnts->TextLabel2->setText(tr("GEOM_POINT_I").arg("2")); - Group3Pnts->TextLabel3->setText(tr("GEOM_POINT_I").arg("3")); + mainFrame()->GroupConstructors->setTitle( tr( "GEOM_ARC" ) ); + mainFrame()->RadioButton1->setIcon( image0 ); + mainFrame()->RadioButton2->setIcon( image1 ); + mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); + mainFrame()->RadioButton3->close(); + + Group3Pnts = new DlgRef_3Sel( centralWidget() ); + + Group3Pnts->GroupBox1->setTitle( tr( "GEOM_POINTS" ) ); + Group3Pnts->TextLabel1->setText( tr( "GEOM_POINT_I" ).arg( 1 ) ); + Group3Pnts->TextLabel2->setText( tr( "GEOM_POINT_I" ).arg( 2 ) ); + Group3Pnts->TextLabel3->setText( tr( "GEOM_POINT_I" ).arg( 3 ) ); Group3Pnts->LineEdit1->setReadOnly( true ); Group3Pnts->LineEdit2->setReadOnly( true ); @@ -83,30 +76,29 @@ BasicGUI_ArcDlg::BasicGUI_ArcDlg(GeometryGUI* theGeometryGUI, QWidget* parent, Group3Pnts->PushButton3->setIcon(image2); - Group3Pnts2 = new Ui::DlgRef_3Sel1Check_QTD(); - QWidget* aGroup3Pnts2Widget = new QWidget(this); - Group3Pnts2->setupUi(aGroup3Pnts2Widget); - aGroup3Pnts2Widget->setObjectName("Group3Pnts2"); + Group3Pnts2 = new DlgRef_3Sel1Check( centralWidget() ); - Group3Pnts2->GroupBox1->setTitle(tr("GEOM_POINTS")); - Group3Pnts2->TextLabel1->setText(tr("GEOM_CENTER_POINT")); - Group3Pnts2->TextLabel2->setText(tr("GEOM_POINT_I").arg("Start")); - Group3Pnts2->TextLabel3->setText(tr("GEOM_POINT_I").arg("End")); + Group3Pnts2->GroupBox1->setTitle( tr( "GEOM_POINTS" ) ); + Group3Pnts2->TextLabel1->setText( tr( "GEOM_CENTER_POINT" ) ); + Group3Pnts2->TextLabel2->setText( tr( "GEOM_POINT_I" ).arg( "Start" ) ); + Group3Pnts2->TextLabel3->setText( tr( "GEOM_POINT_I" ).arg( "End" ) ); Group3Pnts2->LineEdit1->setReadOnly( true ); Group3Pnts2->LineEdit2->setReadOnly( true ); Group3Pnts2->LineEdit3->setReadOnly( true ); - Group3Pnts2->PushButton1->setIcon(image2); - Group3Pnts2->PushButton2->setIcon(image2); - Group3Pnts2->PushButton3->setIcon(image2); + Group3Pnts2->PushButton1->setIcon( image2 ); + Group3Pnts2->PushButton2->setIcon( image2 ); + Group3Pnts2->PushButton3->setIcon( image2 ); - Group3Pnts2->radioButton4->setText(tr("GEOM_REVERSE")); + Group3Pnts2->CheckButton1->setText( tr( "GEOM_REVERSE" ) ); - gridLayout1->addWidget( aGroup3PntsWidget, 2, 0 ); - gridLayout1->addWidget( aGroup3Pnts2Widget, 2, 0 ); + QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); + layout->setMargin( 0 ); layout->setSpacing( 6 ); + layout->addWidget( Group3Pnts ); + layout->addWidget( Group3Pnts2 ); - setHelpFileName("arc.htm"); + setHelpFileName( "arc.htm" ); Init(); } @@ -136,40 +128,40 @@ void BasicGUI_ArcDlg::Init() myEditCurrentArgument->setFocus(); myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil(); - Group3Pnts2->radioButton4->setChecked(FALSE); + Group3Pnts2->CheckButton1->setChecked( false ); /* signals and slots connections */ - connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); - connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); - connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ); + connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ); - connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); + connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) ); - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect( buttonCancel(), SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ); + connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); - connect(Group3Pnts->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(Group3Pnts->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(Group3Pnts->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect( Group3Pnts->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( Group3Pnts->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( Group3Pnts->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect(Group3Pnts->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(Group3Pnts->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(Group3Pnts->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect( Group3Pnts->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( Group3Pnts->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( Group3Pnts->LineEdit3, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect(Group3Pnts2->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(Group3Pnts2->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(Group3Pnts2->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect( Group3Pnts2->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( Group3Pnts2->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( Group3Pnts2->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect(Group3Pnts2->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(Group3Pnts2->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(Group3Pnts2->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect( Group3Pnts2->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( Group3Pnts2->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( Group3Pnts2->LineEdit3, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect(Group3Pnts2->radioButton4, SIGNAL(stateChanged(int)), this, SLOT(ReverseSense(int))); + connect( Group3Pnts2->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( ReverseSense() ) ); - 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_ARC" ).toLatin1().constData() ); + initName( tr( "GEOM_ARC" ) ); ConstructorsClicked( 0 ); @@ -214,8 +206,8 @@ bool BasicGUI_ArcDlg::ClickOnApply() Group3Pnts2->LineEdit1->setText( "" ); Group3Pnts2->LineEdit2->setText( "" ); Group3Pnts2->LineEdit3->setText( "" ); - if (getConstructorId() == 0) myEditCurrentArgument = Group3Pnts->LineEdit1; - if (getConstructorId() == 1) myEditCurrentArgument = Group3Pnts2->LineEdit1; + if ( getConstructorId() == 0 ) myEditCurrentArgument = Group3Pnts->LineEdit1; + if ( getConstructorId() == 1 ) myEditCurrentArgument = Group3Pnts2->LineEdit1; ConstructorsClicked( getConstructorId() ); return true; @@ -228,54 +220,43 @@ bool BasicGUI_ArcDlg::ClickOnApply() //================================================================================= void BasicGUI_ArcDlg::SelectionIntoArgument() { - if ((getConstructorId() != 0) && (getConstructorId() != 1)) + if ( getConstructorId() != 0 && getConstructorId() != 1 ) return; - myEditCurrentArgument->setText(""); - if ( IObjectCount() != 1 ){ - switch (getConstructorId()) - { - case 0: - { - if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = GEOM::GEOM_Object::_nil(); - else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2 = GEOM::GEOM_Object::_nil(); - else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3 = GEOM::GEOM_Object::_nil(); - return; - break; - } - case 1: - { - if ( myEditCurrentArgument == Group3Pnts2->LineEdit1 ) myPoint1 = GEOM::GEOM_Object::_nil(); - else if ( myEditCurrentArgument == Group3Pnts2->LineEdit2 ) myPoint2 = GEOM::GEOM_Object::_nil(); - else if ( myEditCurrentArgument == Group3Pnts2->LineEdit3 ) myPoint3 = GEOM::GEOM_Object::_nil(); - return; - break; - } + myEditCurrentArgument->setText( "" ); + if ( IObjectCount() != 1 ) { + switch ( getConstructorId() ) { + case 0: + if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2 = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3 = GEOM::GEOM_Object::_nil(); + return; + break; + case 1: + if ( myEditCurrentArgument == Group3Pnts2->LineEdit1 ) myPoint1 = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == Group3Pnts2->LineEdit2 ) myPoint2 = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == Group3Pnts2->LineEdit3 ) myPoint3 = GEOM::GEOM_Object::_nil(); + return; + break; } } // nbSel == 1 Standard_Boolean aRes = Standard_False; GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes ); - if ( !CORBA::is_nil( aSelectedObject ) && aRes ) - { - switch (getConstructorId()) - { - case 0: - { - myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); - if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = aSelectedObject; - else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2 = aSelectedObject; - else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3 = aSelectedObject; - break; - } - case 1: - { - myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); - if ( myEditCurrentArgument == Group3Pnts2->LineEdit1 ) myPoint1 = aSelectedObject; - else if ( myEditCurrentArgument == Group3Pnts2->LineEdit2 ) myPoint2 = aSelectedObject; - else if ( myEditCurrentArgument == Group3Pnts2->LineEdit3 ) myPoint3 = aSelectedObject; - break; - } + if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { + switch ( getConstructorId() ) { + case 0: + myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); + if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = aSelectedObject; + else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2 = aSelectedObject; + else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3 = aSelectedObject; + break; + case 1: + myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); + if ( myEditCurrentArgument == Group3Pnts2->LineEdit1 ) myPoint1 = aSelectedObject; + else if ( myEditCurrentArgument == Group3Pnts2->LineEdit2 ) myPoint2 = aSelectedObject; + else if ( myEditCurrentArgument == Group3Pnts2->LineEdit3 ) myPoint3 = aSelectedObject; + break; } } @@ -290,22 +271,17 @@ void BasicGUI_ArcDlg::SelectionIntoArgument() void BasicGUI_ArcDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - switch (getConstructorId()) - { - case 0: - { - if ( send == Group3Pnts->PushButton1 ) myEditCurrentArgument = Group3Pnts->LineEdit1; - else if ( send == Group3Pnts->PushButton2 ) myEditCurrentArgument = Group3Pnts->LineEdit2; - else if ( send == Group3Pnts->PushButton3 ) myEditCurrentArgument = Group3Pnts->LineEdit3; - break; - } - case 1: - { - if ( send == Group3Pnts2->PushButton1 ) myEditCurrentArgument = Group3Pnts2->LineEdit1; - else if ( send == Group3Pnts2->PushButton2 ) myEditCurrentArgument = Group3Pnts2->LineEdit2; - else if ( send == Group3Pnts2->PushButton3 ) myEditCurrentArgument = Group3Pnts2->LineEdit3; - break; - } + switch ( getConstructorId() ) { + case 0: + if ( send == Group3Pnts->PushButton1 ) myEditCurrentArgument = Group3Pnts->LineEdit1; + else if ( send == Group3Pnts->PushButton2 ) myEditCurrentArgument = Group3Pnts->LineEdit2; + else if ( send == Group3Pnts->PushButton3 ) myEditCurrentArgument = Group3Pnts->LineEdit3; + break; + case 1: + if ( send == Group3Pnts2->PushButton1 ) myEditCurrentArgument = Group3Pnts2->LineEdit1; + else if ( send == Group3Pnts2->PushButton2 ) myEditCurrentArgument = Group3Pnts2->LineEdit2; + else if ( send == Group3Pnts2->PushButton3 ) myEditCurrentArgument = Group3Pnts2->LineEdit3; + break; } myEditCurrentArgument->setFocus(); SelectionIntoArgument(); @@ -320,8 +296,7 @@ void BasicGUI_ArcDlg::LineEditReturnPressed() { QLineEdit* send = (QLineEdit*)sender(); if ( send == Group3Pnts->LineEdit1 || send == Group3Pnts->LineEdit2 || send == Group3Pnts->LineEdit3 || - send == Group3Pnts2->LineEdit1 || send == Group3Pnts2->LineEdit2 || send == Group3Pnts2->LineEdit3 ) - { + send == Group3Pnts2->LineEdit1 || send == Group3Pnts2->LineEdit2 || send == Group3Pnts2->LineEdit3 ) { myEditCurrentArgument = send; GEOMBase_Skeleton::LineEditReturnPressed(); } @@ -335,8 +310,8 @@ void BasicGUI_ArcDlg::LineEditReturnPressed() void BasicGUI_ArcDlg::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() ) ); // myGeomGUI->SetState( 0 ); globalSelection( GEOM_POINT ); @@ -367,9 +342,9 @@ void BasicGUI_ArcDlg::DeactivateActiveDialog() // function : enterEvent() // purpose : //================================================================================= -void BasicGUI_ArcDlg::enterEvent(QEvent* e) +void BasicGUI_ArcDlg::enterEvent( QEvent* ) { - if ( !GroupConstructors->isEnabled() ) + if ( !mainFrame()->GroupConstructors->isEnabled() ) ActivateThisDialog(); } @@ -410,28 +385,26 @@ bool BasicGUI_ArcDlg::execute( ObjectList& objects ) bool res = false; GEOM::GEOM_Object_var anObj; - switch (getConstructorId()) - { - case 0: - { - if ( !CORBA::is_nil(myPoint1) && !CORBA::is_nil(myPoint2) &&!CORBA::is_nil(myPoint3) ){ - anObj = GEOM::GEOM_ICurvesOperations::_narrow(getOperation())->MakeArc(myPoint1, myPoint2, myPoint3); - res = true; - } - break; + switch ( getConstructorId() ) { + case 0: + { + if ( !CORBA::is_nil( myPoint1 ) && !CORBA::is_nil( myPoint2 ) && !CORBA::is_nil( myPoint3 ) ) { + anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeArc( myPoint1, myPoint2, myPoint3 ); + res = true; } - case 1: + break; + } + case 1: { - bool Sense; - (Group3Pnts2->radioButton4->isChecked()) ? Sense=true : Sense = false; - if ( !CORBA::is_nil(myPoint1) && !CORBA::is_nil(myPoint2) &&!CORBA::is_nil(myPoint3) ){ - anObj = GEOM::GEOM_ICurvesOperations::_narrow(getOperation())->MakeArcCenter(myPoint1, myPoint2, myPoint3,Sense); - res = true; - } - break; + bool Sense = Group3Pnts2->CheckButton1->isChecked(); + if ( !CORBA::is_nil( myPoint1 ) && !CORBA::is_nil( myPoint2 ) && !CORBA::is_nil( myPoint3 ) ) { + anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeArcCenter( myPoint1, myPoint2, myPoint3, Sense ); + res = true; + } + break; } } - if ( !anObj->_is_nil() ){ + if ( !anObj->_is_nil() ) { objects.push_back( anObj._retn() ); } return res; @@ -452,30 +425,33 @@ void BasicGUI_ArcDlg::closeEvent( QCloseEvent* e ) //================================================================================= void BasicGUI_ArcDlg::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: + switch ( constructorId ) { + case 0: { - ::qobject_cast( Group3Pnts->gridLayout->parent() )->show(); - resize(0, 0); - ::qobject_cast( Group3Pnts2->gridLayout->parent() )->hide(); + Group3Pnts2->hide(); + Group3Pnts->show(); - 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() ) ); break; } - case 1: + case 1: { - ::qobject_cast( Group3Pnts->gridLayout->parent() )->hide(); - resize(0, 0); - ::qobject_cast( Group3Pnts2->gridLayout->parent() )->show(); - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); - + Group3Pnts->hide(); + Group3Pnts2->show(); + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + break; } } + + qApp->processEvents(); + updateGeometry(); + resize( minimumSize() ); + displayPreview(); } @@ -483,7 +459,7 @@ void BasicGUI_ArcDlg::ConstructorsClicked( int constructorId ) // function : ReverseSense() // purpose : Orientation of the arc //================================================================================= -void BasicGUI_ArcDlg::ReverseSense(int sense) +void BasicGUI_ArcDlg::ReverseSense() { displayPreview(); } diff --git a/src/BasicGUI/BasicGUI_ArcDlg.h b/src/BasicGUI/BasicGUI_ArcDlg.h index c530ad1e9..03fd39db0 100644 --- a/src/BasicGUI/BasicGUI_ArcDlg.h +++ b/src/BasicGUI/BasicGUI_ArcDlg.h @@ -1,81 +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 : BasicGUI_ArcDlg.h +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // -// -// File : BasicGUI_ArcDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -#ifndef DIALOGBOX_ARC_H -#define DIALOGBOX_ARC_H +#ifndef BASICGUI_ARCDLG_H +#define BASICGUI_ARCDLG_H + +#include "GEOM_BasicGUI.hxx" -#include "GEOM_BasicGUI.hxx" +#include -#include "GEOMBase_Skeleton.h" -#include "DlgRef_3Sel_QTD.h" -#include "DlgRef_3Sel1Check_QTD.h" +class DlgRef_3Sel; +class DlgRef_3Sel1Check; //================================================================================= // class : BasicGUI_ArcDlg // purpose : //================================================================================= -class GEOM_BASICGUI_EXPORT BasicGUI_ArcDlg : public GEOMBase_Skeleton +class BASICGUI_EXPORT BasicGUI_ArcDlg : public GEOMBase_Skeleton { - Q_OBJECT + Q_OBJECT public: - BasicGUI_ArcDlg( GeometryGUI* theGeometryGUI, QWidget* parent = 0, - const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0 ); - ~BasicGUI_ArcDlg(); + BasicGUI_ArcDlg( GeometryGUI*, QWidget* = 0, + const char* = 0, bool = false, Qt::WindowFlags = 0 ); + ~BasicGUI_ArcDlg(); protected: - // redefined from GEOMBase_Helper - virtual GEOM::GEOM_IOperations_ptr createOperation(); - virtual bool isValid( QString& ); - virtual bool execute( ObjectList& objects ); + // redefined from GEOMBase_Helper + virtual GEOM::GEOM_IOperations_ptr createOperation(); + virtual bool isValid( QString& ); + virtual bool execute( ObjectList& ); + + virtual void closeEvent( QCloseEvent* ); - virtual void closeEvent( QCloseEvent* e ); +private: + void Init(); + void enterEvent( QEvent* ); -private : - void Init(); - void enterEvent(QEvent* e); - int myConstructorId; - GEOM::GEOM_Object_var myPoint1, myPoint2, myPoint3; +private: + int myConstructorId; + GEOM::GEOM_Object_var myPoint1, myPoint2, myPoint3; - Ui::DlgRef_3Sel_QTD* Group3Pnts; - Ui::DlgRef_3Sel1Check_QTD* Group3Pnts2; + DlgRef_3Sel* Group3Pnts; + DlgRef_3Sel1Check* Group3Pnts2; private slots: - void ClickOnOk(); - void ClickOnCancel(); - bool ClickOnApply(); - - void ActivateThisDialog(); - void DeactivateActiveDialog(); - void ConstructorsClicked( int ); - void LineEditReturnPressed(); - void SelectionIntoArgument(); - void SetEditCurrentArgument(); - void ReverseSense(int); + void ClickOnOk(); + void ClickOnCancel(); + bool ClickOnApply(); + + void ActivateThisDialog(); + void DeactivateActiveDialog(); + void ConstructorsClicked( int ); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ReverseSense(); }; -#endif // DIALOGBOX_ARC_H +#endif // BASICGUI_ARCDLG_H diff --git a/src/BasicGUI/BasicGUI_CircleDlg.cxx b/src/BasicGUI/BasicGUI_CircleDlg.cxx index 40ebbf4de..cf82cb08c 100644 --- a/src/BasicGUI/BasicGUI_CircleDlg.cxx +++ b/src/BasicGUI/BasicGUI_CircleDlg.cxx @@ -1,44 +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 : BasicGUI_CircleDlg.cxx +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // -// -// File : BasicGUI_CircleDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ #include "BasicGUI_CircleDlg.h" -#include "DlgRef_2Sel1Spin.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 : BasicGUI_CircleDlg() @@ -47,57 +44,56 @@ // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -BasicGUI_CircleDlg::BasicGUI_CircleDlg(GeometryGUI* theGeometryGUI, QWidget* parent, - const char* name, bool modal, Qt::WindowFlags fl) - :GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) +BasicGUI_CircleDlg::BasicGUI_CircleDlg( GeometryGUI* theGeometryGUI, QWidget* parent, + const char* name, bool modal, Qt::WindowFlags fl ) + : GEOMBase_Skeleton( theGeometryGUI, parent, name, 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"))); - QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + 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" ) ) ); + QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); - setWindowTitle(tr("GEOM_CIRCLE_TITLE")); + setWindowTitle( tr( "GEOM_CIRCLE_TITLE" ) ); /***************************************************************/ - GroupConstructors->setTitle(tr("GEOM_CIRCLE")); - RadioButton1->setIcon(image0); - RadioButton2->setIcon(image2); - RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); - RadioButton3->close(); - - GroupPntVecR = new DlgRef_2Sel1Spin(this, "GroupPntVecR"); - GroupPntVecR->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + mainFrame()->GroupConstructors->setTitle( tr( "GEOM_CIRCLE" ) ); + mainFrame()->RadioButton1->setIcon( image0 ); + mainFrame()->RadioButton2->setIcon( image2 ); + mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); + mainFrame()->RadioButton3->close(); + + GroupPntVecR = new DlgRef_2Sel1Spin( centralWidget() ); + GroupPntVecR->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) ); - GroupPntVecR->TextLabel1->setText(tr("GEOM_CENTER_POINT")); - GroupPntVecR->TextLabel2->setText(tr("GEOM_VECTOR")); - GroupPntVecR->TextLabel3->setText(tr("GEOM_RADIUS")); - GroupPntVecR->PushButton1->setIcon(image1); - GroupPntVecR->PushButton2->setIcon(image1); + GroupPntVecR->TextLabel1->setText( tr( "GEOM_CENTER_POINT" ) ); + GroupPntVecR->TextLabel2->setText( tr( "GEOM_VECTOR" ) ); + GroupPntVecR->TextLabel3->setText( tr( "GEOM_RADIUS" ) ); + GroupPntVecR->PushButton1->setIcon( image1 ); + GroupPntVecR->PushButton2->setIcon( image1 ); GroupPntVecR->LineEdit1->setReadOnly( true ); GroupPntVecR->LineEdit2->setReadOnly( true ); - Group3Pnts = new Ui::DlgRef_3Sel_QTD(); - QWidget* aGroup3PntsWidget = new QWidget(this); - Group3Pnts->setupUi(aGroup3PntsWidget); - aGroup3PntsWidget->setObjectName("Group3Pnts"); + Group3Pnts = new DlgRef_3Sel( centralWidget() ); - Group3Pnts->GroupBox1->setTitle(tr("GEOM_3_POINTS")); - Group3Pnts->TextLabel1->setText(tr("GEOM_POINT1")); - Group3Pnts->TextLabel2->setText(tr("GEOM_POINT2")); - Group3Pnts->TextLabel3->setText(tr("GEOM_POINT3")); - Group3Pnts->PushButton1->setIcon(image1); - Group3Pnts->PushButton2->setIcon(image1); - Group3Pnts->PushButton3->setIcon(image1); + Group3Pnts->GroupBox1->setTitle( tr( "GEOM_3_POINTS" ) ); + Group3Pnts->TextLabel1->setText( tr( "GEOM_POINT1" ) ); + Group3Pnts->TextLabel2->setText( tr( "GEOM_POINT2" ) ); + Group3Pnts->TextLabel3->setText( tr( "GEOM_POINT3" ) ); + Group3Pnts->PushButton1->setIcon( image1 ); + Group3Pnts->PushButton2->setIcon( image1 ); + Group3Pnts->PushButton3->setIcon( image1 ); Group3Pnts->LineEdit1->setReadOnly( true ); Group3Pnts->LineEdit2->setReadOnly( true ); Group3Pnts->LineEdit3->setReadOnly( true ); - gridLayout1->addWidget( GroupPntVecR, 2, 0 ); - gridLayout1->addWidget( aGroup3PntsWidget, 2, 0 ); + QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); + layout->setMargin( 0 ); layout->setSpacing( 6 ); + layout->addWidget( GroupPntVecR ); + layout->addWidget( Group3Pnts ); /***************************************************************/ - setHelpFileName("circle.htm"); + setHelpFileName( "circle.htm" ); Init(); } @@ -127,39 +123,41 @@ void BasicGUI_CircleDlg::Init() /* Get setting of step value from file configuration */ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); - double aStep = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); + double aStep = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100 ); /* min, max, step and decimals for spin boxes & initial values */ - GroupPntVecR->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, aStep, 3); - GroupPntVecR->SpinBox_DX->SetValue( 100 ); + initSpinBox( GroupPntVecR->SpinBox_DX, 0.001, COORD_MAX, aStep, 3 ); + GroupPntVecR->SpinBox_DX->setValue( 100 ); /* signals and slots connections */ - connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); - connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); - connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ); + connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ); - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); - connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); + connect( buttonCancel(), SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ); + connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); - connect(GroupPntVecR->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPntVecR->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(Group3Pnts->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(Group3Pnts->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(Group3Pnts->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) ); - connect(GroupPntVecR->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupPntVecR->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect( GroupPntVecR->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( GroupPntVecR->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( Group3Pnts->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( Group3Pnts->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( Group3Pnts->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect(GroupPntVecR->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPntVecR->SpinBox_DX, SLOT(SetStep(double))); - - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + connect( GroupPntVecR->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( GroupPntVecR->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + + connect( GroupPntVecR->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT(ValueChangedInSpinBox() ) ); + // VSR: TODO ->> + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupPntVecR->SpinBox_DX, SLOT( SetStep( double ) ) ); + // <<- + + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT(SelectionIntoArgument() ) ) ; - initName( tr( "GEOM_CIRCLE" ).toLatin1().constData() ); + initName( tr( "GEOM_CIRCLE" ) ); - ::qobject_cast( Group3Pnts->gridLayout->parent() )->hide(); ConstructorsClicked( 0 ); } @@ -169,40 +167,41 @@ void BasicGUI_CircleDlg::Init() //================================================================================= void BasicGUI_CircleDlg::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 ); myPoint = myDir = myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil(); - switch ( constructorId ) - { - case 0: - { - ::qobject_cast( Group3Pnts->gridLayout->parent() )->hide(); - resize(0, 0); - GroupPntVecR->show(); - - myEditCurrentArgument = GroupPntVecR->LineEdit1; - GroupPntVecR->LineEdit1->setText(""); - GroupPntVecR->LineEdit2->setText(""); - break; - } + switch ( constructorId ) { + case 0: + { + Group3Pnts->hide(); + GroupPntVecR->show(); + + myEditCurrentArgument = GroupPntVecR->LineEdit1; + GroupPntVecR->LineEdit1->setText( "" ); + GroupPntVecR->LineEdit2->setText( "" ); + break; + } case 1: { GroupPntVecR->hide(); - resize( 0, 0 ); - ::qobject_cast( Group3Pnts->gridLayout->parent() )->show(); + Group3Pnts->show(); myEditCurrentArgument = Group3Pnts->LineEdit1; - Group3Pnts->LineEdit1->setText(""); - Group3Pnts->LineEdit2->setText(""); - Group3Pnts->LineEdit3->setText(""); + Group3Pnts->LineEdit1->setText( "" ); + Group3Pnts->LineEdit2->setText( "" ); + Group3Pnts->LineEdit3->setText( "" ); break; - } + } } + qApp->processEvents(); + updateGeometry(); + resize( minimumSize() ); + myEditCurrentArgument->setFocus(); globalSelection( GEOM_POINT ); - 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() ) ); } //================================================================================= @@ -244,10 +243,9 @@ void BasicGUI_CircleDlg::ClickOnCancel() //================================================================================= void BasicGUI_CircleDlg::SelectionIntoArgument() { - myEditCurrentArgument->setText(""); + myEditCurrentArgument->setText( "" ); - if ( IObjectCount() != 1 ) - { + if ( IObjectCount() != 1 ) { if ( myEditCurrentArgument == GroupPntVecR->LineEdit1 ) myPoint = GEOM::GEOM_Object::_nil(); else if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 ) myDir = GEOM::GEOM_Object::_nil(); else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = GEOM::GEOM_Object::_nil(); @@ -259,8 +257,7 @@ void BasicGUI_CircleDlg::SelectionIntoArgument() // nbSel == 1 Standard_Boolean aRes = Standard_False; GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes ); - if ( !CORBA::is_nil( aSelectedObject ) && aRes ) - { + if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); if ( myEditCurrentArgument == GroupPntVecR->LineEdit1 ) myPoint = aSelectedObject; else if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 ) myDir = aSelectedObject; @@ -307,8 +304,7 @@ void BasicGUI_CircleDlg::LineEditReturnPressed() send == GroupPntVecR->LineEdit2 || send == Group3Pnts->LineEdit1 || send == Group3Pnts->LineEdit2 || - send == Group3Pnts->LineEdit3 ) - { + send == Group3Pnts->LineEdit3 ) { myEditCurrentArgument = send; GEOMBase_Skeleton::LineEditReturnPressed(); } @@ -323,8 +319,8 @@ void BasicGUI_CircleDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); globalSelection( GEOM_POINT ); - 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() ) ); // myGeomGUI->SetState( 0 ); @@ -336,9 +332,9 @@ void BasicGUI_CircleDlg::ActivateThisDialog() // function : enterEvent() // purpose : //================================================================================= -void BasicGUI_CircleDlg::enterEvent(QEvent* e) +void BasicGUI_CircleDlg::enterEvent( QEvent* ) { - if ( !GroupConstructors->isEnabled() ) + if ( !mainFrame()->GroupConstructors->isEnabled() ) ActivateThisDialog(); } @@ -367,7 +363,7 @@ void BasicGUI_CircleDlg::ValueChangedInSpinBox() //================================================================================= double BasicGUI_CircleDlg::getRadius() const { - return GroupPntVecR->SpinBox_DX->GetValue(); + return GroupPntVecR->SpinBox_DX->value(); } //================================================================================= @@ -413,8 +409,7 @@ bool BasicGUI_CircleDlg::execute( ObjectList& objects ) GEOM::GEOM_Object_var anObj; - switch ( getConstructorId() ) - { + switch ( getConstructorId() ) { case 0 : anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeCirclePntVecR( myPoint, myDir, getRadius() ); res = true; @@ -439,4 +434,3 @@ void BasicGUI_CircleDlg::closeEvent( QCloseEvent* e ) { GEOMBase_Skeleton::closeEvent( e ); } - diff --git a/src/BasicGUI/BasicGUI_CircleDlg.h b/src/BasicGUI/BasicGUI_CircleDlg.h index 6d5823fe8..d6c61d395 100644 --- a/src/BasicGUI/BasicGUI_CircleDlg.h +++ b/src/BasicGUI/BasicGUI_CircleDlg.h @@ -1,85 +1,84 @@ -// 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 : BasicGUI_CircleDlg.h +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // -// -// File : BasicGUI_CircleDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -#ifndef DIALOGBOX_CIRCLE_H -#define DIALOGBOX_CIRCLE_H +#ifndef BASICGUI_CIRCLEDLG_H +#define BASICGUI_CIRCLEDLG_H #include "GEOM_BasicGUI.hxx" -#include "GEOMBase_Skeleton.h" -#include "DlgRef_3Sel_QTD.h" +#include +class DlgRef_3Sel; class DlgRef_2Sel1Spin; //================================================================================= // class : BasicGUI_CircleDlg // purpose : //================================================================================= -class GEOM_BASICGUI_EXPORT BasicGUI_CircleDlg : public GEOMBase_Skeleton +class BASICGUI_EXPORT BasicGUI_CircleDlg : public GEOMBase_Skeleton { - Q_OBJECT + Q_OBJECT public: - BasicGUI_CircleDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, - const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0); - ~BasicGUI_CircleDlg(); + BasicGUI_CircleDlg( GeometryGUI*, QWidget* = 0, + const char* = 0, bool = false, Qt::WindowFlags = 0 ); + ~BasicGUI_CircleDlg(); 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; + void Init(); + void enterEvent( QEvent* ); + double getRadius() const; - GEOM::GEOM_Object_var myPoint, myDir, myPoint1, myPoint2, myPoint3; +private: + GEOM::GEOM_Object_var myPoint, myDir, myPoint1, myPoint2, myPoint3; - DlgRef_2Sel1Spin* GroupPntVecR; - Ui::DlgRef_3Sel_QTD* Group3Pnts; + DlgRef_2Sel1Spin* GroupPntVecR; + DlgRef_3Sel* Group3Pnts; private slots: - void ClickOnOk(); - void ClickOnCancel(); - bool ClickOnApply(); + void ClickOnOk(); + void ClickOnCancel(); + bool ClickOnApply(); - void ActivateThisDialog(); - void DeactivateActiveDialog(); + void ActivateThisDialog(); + void DeactivateActiveDialog(); - void SelectionIntoArgument(); + void SelectionIntoArgument(); - void ConstructorsClicked( int ); - void LineEditReturnPressed(); - void SetEditCurrentArgument(); - void ValueChangedInSpinBox(); + void ConstructorsClicked( int ); + void LineEditReturnPressed(); + void SetEditCurrentArgument(); + void ValueChangedInSpinBox(); }; -#endif // DIALOGBOX_CIRCLE_H +#endif // BASICGUI_CIRCLEDLG_H diff --git a/src/BasicGUI/BasicGUI_CurveDlg.cxx b/src/BasicGUI/BasicGUI_CurveDlg.cxx index 9c4cc8367..515183c22 100644 --- a/src/BasicGUI/BasicGUI_CurveDlg.cxx +++ b/src/BasicGUI/BasicGUI_CurveDlg.cxx @@ -1,47 +1,42 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 OPEN CASCADE +// Copyright (C) 2003 OPEN CASCADE // -// 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 : BasicGUI_CurveDlg.cxx +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // -// -// File : BasicGUI_CurveDlg.cxx -// Author : Nicolas REJNERI -// Module : GEOM -// $Header$ #include "BasicGUI_CurveDlg.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 "SALOME_ListIteratorOfListIO.hxx" -#include "SALOME_ListIO.hxx" +#include +#include +#include +#include -#include "GEOMImpl_Types.hxx" +#include +#include -using namespace std; -#include +#include //================================================================================= // class : BasicGUI_CurveDlg() @@ -50,38 +45,36 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -BasicGUI_CurveDlg::BasicGUI_CurveDlg(GeometryGUI* theGeometryGUI, QWidget* parent, - const char* name, bool modal, Qt::WindowFlags fl) - :GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) +BasicGUI_CurveDlg::BasicGUI_CurveDlg( GeometryGUI* theGeometryGUI, QWidget* parent, + const char* name, bool modal, Qt::WindowFlags fl ) + : GEOMBase_Skeleton( theGeometryGUI, parent, name, 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"))); - QPixmap image3(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_BEZIER"))); - - QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_POLYLINE" ) ) ); + QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_SPLINE" ) ) ); + QPixmap image3( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_BEZIER" ) ) ); + QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); - setWindowTitle(tr("GEOM_CURVE_TITLE")); + setWindowTitle( tr( "GEOM_CURVE_TITLE" ) ); /***************************************************************/ - RadioButton1->setIcon( image0 ); - RadioButton2->setIcon( image3 ); - RadioButton3->setIcon( image2 ); + mainFrame()->RadioButton1->setIcon( image0 ); + mainFrame()->RadioButton2->setIcon( image3 ); + mainFrame()->RadioButton3->setIcon( image2 ); - GroupPoints = new Ui::DlgRef_1Sel_QTD(); - QWidget* aGroupPointsWidget = new QWidget(this); - GroupPoints->setupUi(aGroupPointsWidget); - aGroupPointsWidget->setObjectName("GroupPoints"); + GroupPoints = new DlgRef_1Sel( centralWidget() ); GroupPoints->GroupBox1->setTitle( tr( "GEOM_NODES" ) ); - GroupPoints->TextLabel1->setText( tr("GEOM_POINTS") ); - GroupPoints->PushButton1->setIcon(image1); + GroupPoints->TextLabel1->setText( tr( "GEOM_POINTS" ) ); + GroupPoints->PushButton1->setIcon( image1 ); GroupPoints->LineEdit1->setReadOnly( true ); - gridLayout1->addWidget(aGroupPointsWidget, 2, 0); + QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); + layout->setMargin( 0 ); layout->setSpacing( 6 ); + layout->addWidget( GroupPoints ); /***************************************************************/ - setHelpFileName("curve.htm"); + setHelpFileName( "curve.htm" ); Init(); } @@ -111,21 +104,22 @@ void BasicGUI_CurveDlg::Init() globalSelection( GEOM_POINT ); /* signals and slots connections */ - connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); - connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); - connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog( ) ) ); + connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ); - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); - connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); + connect( buttonCancel(), SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ); + 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( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) ); - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - initName( tr( "GEOM_CURVE" ).toLatin1().constData() ); + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + + initName( tr( "GEOM_CURVE" ) ); ConstructorsClicked( 0 ); } @@ -136,12 +130,12 @@ void BasicGUI_CurveDlg::Init() void BasicGUI_CurveDlg::ConstructorsClicked( int id ) { QString aTitle = tr( id == 0 ? "GEOM_POLYLINE" : id == 1 ? "GEOM_BEZIER" : "GEOM_INTERPOL" ); - GroupConstructors->setTitle( aTitle ); + mainFrame()->GroupConstructors->setTitle( aTitle ); - myPoints = new GEOM::ListOfGO(); + myPoints = new GEOM::ListOfGO(); myPoints->length( 0 ); - myEditCurrentArgument->setText(""); + myEditCurrentArgument->setText( "" ); } @@ -211,19 +205,20 @@ void BasicGUI_CurveDlg::ClickOnCancel() * \retval -1, if point not in list, else 1 in list */ //================================================================================= -static int isPointInList(list& thePoints, - GEOM::GEOM_Object_var& theObject) +static int isPointInList( list& thePoints, + GEOM::GEOM_Object_var& theObject ) { int len = thePoints.size(); - if(len<1){ + if ( len < 1 ) { return -1; } - for(list::iterator i=thePoints.begin();i!=thePoints.end();i++) - if (string((*i)->GetEntry()) == string(theObject->GetEntry())){ + for ( list::iterator i = thePoints.begin(); i != thePoints.end(); i++ ) { + if ( string( (*i)->GetEntry() ) == string( theObject->GetEntry() ) ) { return 1; } + } return -1; } @@ -235,24 +230,24 @@ static int isPointInList(list& thePoints, * \li \a theNewPoints - not ordered sequence with necessary points */ //================================================================================= -static void removeUnnecessaryPnt(list& theOldPoints, - GEOM::ListOfGO_var& theNewPoints) +static void removeUnnecessaryPnt( list& theOldPoints, + GEOM::ListOfGO_var& theNewPoints ) { list objs_to_remove; - for(list::iterator i=theOldPoints.begin();i!=theOldPoints.end();i++){ + for ( list::iterator i = theOldPoints.begin(); i != theOldPoints.end(); i++ ) { bool found = false; - for (int j=0;jlength() && !found ; j++){ - if(string((*i)->GetEntry()) == string(theNewPoints[j]->GetEntry())){ + for ( int j = 0; j < theNewPoints->length() && !found ; j++ ) { + if ( string( (*i)->GetEntry() ) == string( theNewPoints[j]->GetEntry() ) ) { found = true; } } - if(!found){ - objs_to_remove.push_back(*i); + if ( !found ) { + objs_to_remove.push_back( *i ); //cout << "removed: " << (*i)->GetEntry() << endl; } } - for(list::iterator i=objs_to_remove.begin();i!=objs_to_remove.end();i++){ - theOldPoints.remove(*i); + for ( list::iterator i = objs_to_remove.begin(); i != objs_to_remove.end(); i++ ) { + theOldPoints.remove( *i ); } } @@ -262,7 +257,7 @@ static void removeUnnecessaryPnt(list& theOldPoints, //================================================================================= void BasicGUI_CurveDlg::SelectionIntoArgument() { - myEditCurrentArgument->setText(""); + myEditCurrentArgument->setText( "" ); Standard_Boolean aRes = Standard_False; int i = 0; @@ -270,31 +265,30 @@ void BasicGUI_CurveDlg::SelectionIntoArgument() bool is_append = myPoints->length() < IOC; // if true - add point, else remove myPoints->length( IOC ); // this length may be greater than number of objects, // that will actually be put into myPoints - for ( SALOME_ListIteratorOfListIO anIt( selectedIO() ); anIt.More(); anIt.Next() ) - { - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIt.Value(), aRes ); - if ( !CORBA::is_nil( aSelectedObject ) && aRes ) - { - //TopoDS_Shape aPointShape; - //if ( myGeomBase->GetShape( aSelectedObject, aPointShape, TopAbs_VERTEX ) ) - int pos = isPointInList(myOrderedSel,aSelectedObject); - if(is_append && pos==-1) - myOrderedSel.push_back(aSelectedObject); - myPoints[i++] = aSelectedObject; - } + for ( SALOME_ListIteratorOfListIO anIt( selectedIO() ); anIt.More(); anIt.Next() ) { + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIt.Value(), aRes ); + if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { + //TopoDS_Shape aPointShape; + //if ( myGeomBase->GetShape( aSelectedObject, aPointShape, TopAbs_VERTEX ) ) + int pos = isPointInList(myOrderedSel, aSelectedObject); + if ( is_append && pos == -1 ) + myOrderedSel.push_back( aSelectedObject ); + myPoints[i++] = aSelectedObject; } - + } + myPoints->length( i ); // this is the right length, smaller of equal to the previously set - if(IOC == 0) + if ( IOC == 0 ) myOrderedSel.clear(); else - removeUnnecessaryPnt(myOrderedSel,myPoints); + removeUnnecessaryPnt( myOrderedSel, myPoints ); - if(myOrderedSel.size() == myPoints->length()){ - int k=0; - for (list::iterator j=myOrderedSel.begin();j!=myOrderedSel.end();j++) + if ( myOrderedSel.size() == myPoints->length() ) { + int k = 0; + for ( list::iterator j = myOrderedSel.begin(); j!= myOrderedSel.end(); j++ ) myPoints[k++] = *j; - } else { + } + else { //cout << "ERROR: Ordered sequence size != selection sequence size! ("<length()<<")"<activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); // myGeomGUI->SetState( 0 ); @@ -334,9 +328,9 @@ void BasicGUI_CurveDlg::DeactivateActiveDialog() // function : enterEvent() // purpose : //================================================================================= -void BasicGUI_CurveDlg::enterEvent(QEvent* e) +void BasicGUI_CurveDlg::enterEvent( QEvent* ) { - if ( !GroupConstructors->isEnabled() ) + if ( !mainFrame()->GroupConstructors->isEnabled() ) ActivateThisDialog(); } @@ -368,8 +362,7 @@ bool BasicGUI_CurveDlg::execute( ObjectList& objects ) GEOM::GEOM_Object_var anObj; - switch ( getConstructorId() ) - { + switch ( getConstructorId() ) { case 0 : anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakePolyline( myPoints ); res = true; diff --git a/src/BasicGUI/BasicGUI_CurveDlg.h b/src/BasicGUI/BasicGUI_CurveDlg.h index cd7f76575..11f10e91a 100644 --- a/src/BasicGUI/BasicGUI_CurveDlg.h +++ b/src/BasicGUI/BasicGUI_CurveDlg.h @@ -1,81 +1,80 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 OPEN CASCADE +// Copyright (C) 2003 OPEN CASCADE // -// 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 : BasicGUI_CurveDlg.h +// Author : Alexander SLADKOV, Open CASCADE S.A.S. (alexander.sladkov@opencascade.com) // -// -// File : BasicGUI_CurveDlg.h -// Author : Alexander SLADKOV -// Module : GEOM -#ifndef BASICGUI_CURVE_H -#define BASICGUI_CURVE_H +#ifndef BASICGUI_CURVEDLG_H +#define BASICGUI_CURVEDLG_H #include "GEOM_BasicGUI.hxx" -#include "GEOMBase_Skeleton.h" -#include "DlgRef_1Sel_QTD.h" +#include #include +class DlgRef_1Sel; + //================================================================================= // class : BasicGUI_CurveDlg // purpose : //================================================================================= -class GEOM_BASICGUI_EXPORT BasicGUI_CurveDlg : public GEOMBase_Skeleton +class BASICGUI_EXPORT BasicGUI_CurveDlg : public GEOMBase_Skeleton { - Q_OBJECT + Q_OBJECT public: - BasicGUI_CurveDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, - const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0); - ~BasicGUI_CurveDlg(); - + BasicGUI_CurveDlg( GeometryGUI*, QWidget* = 0, + const char* = 0, bool = false, Qt::WindowFlags = 0 ); + ~BasicGUI_CurveDlg(); + protected: - // redefined from GEOMBase_Helper - virtual GEOM::GEOM_IOperations_ptr createOperation(); - virtual bool isValid( QString& ); - virtual bool execute( ObjectList& objects ); + // redefined from GEOMBase_Helper + virtual GEOM::GEOM_IOperations_ptr createOperation(); + virtual bool isValid( QString& ); + virtual bool execute( ObjectList& ); + + virtual void closeEvent( QCloseEvent* ); - virtual void closeEvent( QCloseEvent* e ); +private: + void Init(); + void enterEvent( QEvent* ); -private : - void Init(); - void enterEvent(QEvent* e); - - Ui::DlgRef_1Sel_QTD* GroupPoints; - GEOM::ListOfGO_var myPoints; - list myOrderedSel;//!< This list used for managing orderes selection +private: + DlgRef_1Sel* GroupPoints; + GEOM::ListOfGO_var myPoints; + list myOrderedSel; //!< This list used for managing orderes selection private slots: - void ClickOnOk(); - void ClickOnCancel(); - bool ClickOnApply(); - - void ActivateThisDialog(); - void DeactivateActiveDialog(); - - void ConstructorsClicked( int ); - void LineEditReturnPressed(); - void SelectionIntoArgument(); - void SetEditCurrentArgument(); - + void ClickOnOk(); + void ClickOnCancel(); + bool ClickOnApply(); + + void ActivateThisDialog(); + void DeactivateActiveDialog(); + + void ConstructorsClicked( int ); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); }; -#endif // BASICGUI_CURVE_H +#endif // BASICGUI_CURVEDLG_H diff --git a/src/BasicGUI/BasicGUI_EllipseDlg.cxx b/src/BasicGUI/BasicGUI_EllipseDlg.cxx index e97abf429..e8609776c 100644 --- a/src/BasicGUI/BasicGUI_EllipseDlg.cxx +++ b/src/BasicGUI/BasicGUI_EllipseDlg.cxx @@ -1,45 +1,40 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 OPEN CASCADE +// Copyright (C) 2003 OPEN CASCADE // -// 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 : BasicGUI_EllipseDlg.cxx +// Author : Nicolas REJNERI, Open CASCADE S.A.S. // -// -// File : BasicGUI_EllipseDlg.cxx -// Author : Nicolas REJNERI -// Module : GEOM -// $Header$ #include "BasicGUI_EllipseDlg.h" -#include "DlgRef_2Sel2Spin.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 : BasicGUI_EllipseDlg() @@ -48,39 +43,41 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -BasicGUI_EllipseDlg::BasicGUI_EllipseDlg(GeometryGUI* theGeometryGUI, QWidget* parent, - const char* name, bool modal, Qt::WindowFlags fl) - :GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) +BasicGUI_EllipseDlg::BasicGUI_EllipseDlg( GeometryGUI* theGeometryGUI, QWidget* parent, + const char* name, bool modal, Qt::WindowFlags fl ) + : GEOMBase_Skeleton( theGeometryGUI, parent, name, 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"))); + QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_ELLIPSE_PV" ) ) ); + QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); - setWindowTitle(tr("GEOM_ELLIPSE_TITLE")); + setWindowTitle( tr( "GEOM_ELLIPSE_TITLE" ) ); /***************************************************************/ - GroupConstructors->setTitle(tr("GEOM_ELLIPSE")); - RadioButton1->setIcon(image0); - RadioButton2->setAttribute( Qt::WA_DeleteOnClose ); - RadioButton2->close(); - RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); - RadioButton3->close(); - - GroupPoints = new DlgRef_2Sel2Spin(this, "GroupPoints"); - GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); - GroupPoints->TextLabel1->setText(tr("GEOM_CENTER")); - GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR")); - GroupPoints->TextLabel3->setText(tr("GEOM_RADIUS_MAJOR")); - GroupPoints->TextLabel4->setText(tr("GEOM_RADIUS_MINOR")); - GroupPoints->PushButton1->setIcon(image1); - GroupPoints->PushButton2->setIcon(image1); + mainFrame()->GroupConstructors->setTitle( tr( "GEOM_ELLIPSE" ) ); + 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_2Sel2Spin( centralWidget() ); + GroupPoints->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) ); + GroupPoints->TextLabel1->setText( tr( "GEOM_CENTER" ) ); + GroupPoints->TextLabel2->setText( tr( "GEOM_VECTOR" ) ); + GroupPoints->TextLabel3->setText( tr( "GEOM_RADIUS_MAJOR" ) ); + GroupPoints->TextLabel4->setText( tr( "GEOM_RADIUS_MINOR" ) ); + GroupPoints->PushButton1->setIcon( image1 ); + GroupPoints->PushButton2->setIcon( image1 ); GroupPoints->LineEdit1->setReadOnly( true ); GroupPoints->LineEdit2->setReadOnly( true ); - gridLayout1->addWidget(GroupPoints, 2, 0); + QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); + layout->setMargin( 0 ); layout->setSpacing( 6 ); + layout->addWidget( GroupPoints ); /***************************************************************/ - setHelpFileName("ellipse.htm"); + setHelpFileName( "ellipse.htm" ); Init(); } @@ -111,40 +108,42 @@ void BasicGUI_EllipseDlg::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 ); double aMajorR( 200. ), aMinorR( 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 ); - GroupPoints->SpinBox_DX->SetValue( aMajorR ); - GroupPoints->SpinBox_DY->SetValue( aMinorR ); + initSpinBox( GroupPoints->SpinBox_DX, 0.001, COORD_MAX, step, 3 ); + initSpinBox( GroupPoints->SpinBox_DY, 0.001, COORD_MAX, step, 3 ); + GroupPoints->SpinBox_DX->setValue( aMajorR ); + GroupPoints->SpinBox_DY->setValue( aMinorR ); /* signals and slots connections */ - connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); - connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); - connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ); + connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ); - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect( buttonCancel(), SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ); + 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(double))); - connect(GroupPoints->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect( GroupPoints->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( GroupPoints->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->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(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; - initName( tr( "GEOM_ELLIPSE" ).toLatin1().constData() ); + initName( tr( "GEOM_ELLIPSE" ) ); } @@ -195,10 +194,9 @@ void BasicGUI_EllipseDlg::ClickOnCancel() //================================================================================= void BasicGUI_EllipseDlg::SelectionIntoArgument() { - myEditCurrentArgument->setText(""); + myEditCurrentArgument->setText( "" ); - if ( IObjectCount() != 1 ) - { + if ( IObjectCount() != 1 ) { if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint = GEOM::GEOM_Object::_nil(); else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myDir = GEOM::GEOM_Object::_nil(); return; @@ -206,8 +204,7 @@ void BasicGUI_EllipseDlg::SelectionIntoArgument() Standard_Boolean aRes = Standard_False; GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes ); - if ( !CORBA::is_nil( aSelectedObject ) && aRes ) - { + if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint = aSelectedObject; else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myDir = aSelectedObject; @@ -244,8 +241,7 @@ void BasicGUI_EllipseDlg::LineEditReturnPressed() { QLineEdit* send = (QLineEdit*)sender(); if ( send == GroupPoints->LineEdit1 || - send == GroupPoints->LineEdit2 ) - { + send == GroupPoints->LineEdit2 ) { myEditCurrentArgument = send; GEOMBase_Skeleton::LineEditReturnPressed(); } @@ -259,8 +255,8 @@ void BasicGUI_EllipseDlg::LineEditReturnPressed() void BasicGUI_EllipseDlg::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() ) ); GroupPoints->LineEdit1->setFocus(); myEditCurrentArgument = GroupPoints->LineEdit1; @@ -286,9 +282,9 @@ void BasicGUI_EllipseDlg::DeactivateActiveDialog() // function : enterEvent() // purpose : //================================================================================= -void BasicGUI_EllipseDlg::enterEvent(QEvent* e) +void BasicGUI_EllipseDlg::enterEvent( QEvent* ) { - if ( !GroupConstructors->isEnabled() ) + if ( !mainFrame()->GroupConstructors->isEnabled() ) ActivateThisDialog(); } @@ -296,7 +292,7 @@ void BasicGUI_EllipseDlg::enterEvent(QEvent* e) // function : ValueChangedInSpinBox() // purpose : //================================================================================= -void BasicGUI_EllipseDlg::ValueChangedInSpinBox(double newValue) +void BasicGUI_EllipseDlg::ValueChangedInSpinBox( double newValue ) { displayPreview(); } @@ -316,12 +312,11 @@ GEOM::GEOM_IOperations_ptr BasicGUI_EllipseDlg::createOperation() //================================================================================= bool BasicGUI_EllipseDlg::isValid( QString& msg ) { - double aMajorR = GroupPoints->SpinBox_DX->GetValue(); - double aMinorR = GroupPoints->SpinBox_DY->GetValue(); - if ( aMajorR < aMinorR ) - { - msg = tr( "GEOM_ELLIPSE_ERROR_1" ); - return false; + double aMajorR = GroupPoints->SpinBox_DX->value(); + double aMinorR = GroupPoints->SpinBox_DY->value(); + if ( aMajorR < aMinorR ) { + msg = tr( "GEOM_ELLIPSE_ERROR_1" ); + return false; } return !myPoint->_is_nil() && !myDir->_is_nil(); } @@ -332,8 +327,8 @@ bool BasicGUI_EllipseDlg::isValid( QString& msg ) //================================================================================= bool BasicGUI_EllipseDlg::execute( ObjectList& objects ) { - double aMajorR = GroupPoints->SpinBox_DX->GetValue(); - double aMinorR = GroupPoints->SpinBox_DY->GetValue(); + double aMajorR = GroupPoints->SpinBox_DX->value(); + double aMinorR = GroupPoints->SpinBox_DY->value(); GEOM::GEOM_Object_var anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeEllipse( myPoint, myDir, aMajorR, aMinorR ); if ( !anObj->_is_nil() ) @@ -350,4 +345,3 @@ void BasicGUI_EllipseDlg::closeEvent( QCloseEvent* e ) { GEOMBase_Skeleton::closeEvent( e ); } - diff --git a/src/BasicGUI/BasicGUI_EllipseDlg.h b/src/BasicGUI/BasicGUI_EllipseDlg.h index 6369a7469..688e50c7b 100644 --- a/src/BasicGUI/BasicGUI_EllipseDlg.h +++ b/src/BasicGUI/BasicGUI_EllipseDlg.h @@ -1,35 +1,33 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 OPEN CASCADE +// Copyright (C) 2003 OPEN CASCADE // -// 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 : BasicGUI_EllipseDlg.h +// Author : Nicolas REJNERI, Open CASCADE S.A.S. // -// -// File : BasicGUI_EllipseDlg.h -// Author : Nicolas REJNERI -// Module : GEOM -#ifndef BASICGUI_ELLIPSE_H -#define BASICGUI_ELLIPSE_H +#ifndef BASICGUI_ELLIPSEDLG_H +#define BASICGUI_ELLIPSEDLG_H #include "GEOM_BasicGUI.hxx" -#include "GEOMBase_Skeleton.h" +#include class DlgRef_2Sel2Spin; @@ -37,44 +35,44 @@ class DlgRef_2Sel2Spin; // class : BasicGUI_EllipseDlg // purpose : //================================================================================= -class GEOM_BASICGUI_EXPORT BasicGUI_EllipseDlg : public GEOMBase_Skeleton +class BASICGUI_EXPORT BasicGUI_EllipseDlg : public GEOMBase_Skeleton { - Q_OBJECT + Q_OBJECT public: - BasicGUI_EllipseDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, - const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0); - ~BasicGUI_EllipseDlg(); + BasicGUI_EllipseDlg( GeometryGUI*, QWidget* = 0, + const char* = 0, bool = false, Qt::WindowFlags = 0 ); + ~BasicGUI_EllipseDlg(); 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 ); - -private : - void Init(); - void enterEvent(QEvent* e); - - GEOM::GEOM_Object_var myPoint, myDir; - - DlgRef_2Sel2Spin* GroupPoints; + // 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* ); +private: + GEOM::GEOM_Object_var myPoint, myDir; + + DlgRef_2Sel2Spin* GroupPoints; + private slots: - void ClickOnOk(); - void ClickOnCancel(); - bool ClickOnApply(); - - void ActivateThisDialog(); - void DeactivateActiveDialog(); - - void LineEditReturnPressed(); - void SelectionIntoArgument(); - void SetEditCurrentArgument(); - void ValueChangedInSpinBox(double newValue); - + void ClickOnOk(); + void ClickOnCancel(); + bool ClickOnApply(); + + void ActivateThisDialog(); + void DeactivateActiveDialog(); + + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ValueChangedInSpinBox( double ); }; -#endif // BASICGUI_ELLIPSE_H +#endif // BASICGUI_ELLIPSEDLG_H diff --git a/src/BasicGUI/BasicGUI_LineDlg.cxx b/src/BasicGUI/BasicGUI_LineDlg.cxx index ed38628ce..19038a6f3 100644 --- a/src/BasicGUI/BasicGUI_LineDlg.cxx +++ b/src/BasicGUI/BasicGUI_LineDlg.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 : BasicGUI_LineDlg.cxx +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // -// -// File : BasicGUI_LineDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ #include "BasicGUI_LineDlg.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 : BasicGUI_LineDlg() @@ -47,41 +43,41 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -BasicGUI_LineDlg::BasicGUI_LineDlg(GeometryGUI* theGeometryGUI, QWidget* parent, - const char* name, bool modal, Qt::WindowFlags fl) - :GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) +BasicGUI_LineDlg::BasicGUI_LineDlg( GeometryGUI* theGeometryGUI, QWidget* parent, + const char* name, bool modal, Qt::WindowFlags fl ) + : GEOMBase_Skeleton( theGeometryGUI, parent, name, 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"))); - - setWindowTitle(tr("GEOM_LINE_TITLE")); + QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_LINE_2P" ) ) ); + QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); + setWindowTitle( tr( "GEOM_LINE_TITLE" ) ); + /***************************************************************/ - GroupConstructors->setTitle(tr("GEOM_LINE")); - 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_POINTS")); - GroupPoints->TextLabel1->setText(tr("GEOM_POINT_I").arg("1")); - GroupPoints->TextLabel2->setText(tr("GEOM_POINT_I").arg("2")); - GroupPoints->PushButton1->setIcon(image1); - GroupPoints->PushButton2->setIcon(image1); + mainFrame()->GroupConstructors->setTitle( tr( "GEOM_LINE" ) ); + 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_POINTS" ) ); + GroupPoints->TextLabel1->setText( tr( "GEOM_POINT_I" ).arg( 1 ) ); + GroupPoints->TextLabel2->setText( tr( "GEOM_POINT_I" ).arg( 2 ) ); + 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("line.htm"); + setHelpFileName( "line.htm" ); Init(); } @@ -111,23 +107,23 @@ void BasicGUI_LineDlg::Init() globalSelection( GEOM_POINT ); /* signals and slots connections */ - connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); - connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); - connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ); + connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ); - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect( buttonCancel(), SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ); + 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_LINE").toLatin1().constData() ); + initName( tr( "GEOM_LINE" ) ); } @@ -170,10 +166,9 @@ bool BasicGUI_LineDlg::ClickOnApply() //================================================================================= void BasicGUI_LineDlg::SelectionIntoArgument() { - myEditCurrentArgument->setText(""); + myEditCurrentArgument->setText( "" ); - if ( IObjectCount() != 1 ) - { + if ( IObjectCount() != 1 ) { if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint1 = GEOM::GEOM_Object::_nil(); else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myPoint2 = GEOM::GEOM_Object::_nil(); return; @@ -182,8 +177,7 @@ void BasicGUI_LineDlg::SelectionIntoArgument() // nbSel == 1 Standard_Boolean aRes = Standard_False; GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes ); - if ( !CORBA::is_nil( aSelectedObject ) && aRes ) - { + if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint1 = aSelectedObject; else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myPoint2 = aSelectedObject; @@ -228,8 +222,8 @@ void BasicGUI_LineDlg::LineEditReturnPressed() void BasicGUI_LineDlg::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() ) ); // myGeomGUI->SetState( 0 ); globalSelection( GEOM_POINT ); @@ -256,9 +250,9 @@ void BasicGUI_LineDlg::DeactivateActiveDialog() // function : enterEvent() // purpose : //================================================================================= -void BasicGUI_LineDlg::enterEvent(QEvent* e) +void BasicGUI_LineDlg::enterEvent( QEvent* ) { - if ( !GroupConstructors->isEnabled() ) + if ( !mainFrame()->GroupConstructors->isEnabled() ) ActivateThisDialog(); } diff --git a/src/BasicGUI/BasicGUI_LineDlg.h b/src/BasicGUI/BasicGUI_LineDlg.h index dfa709d7e..c51bc695a 100644 --- a/src/BasicGUI/BasicGUI_LineDlg.h +++ b/src/BasicGUI/BasicGUI_LineDlg.h @@ -1,80 +1,79 @@ -// 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 : BasicGUI_LineDlg.h +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // -// -// File : BasicGUI_LineDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -#ifndef DIALOGBOX_LINE_H -#define DIALOGBOX_LINE_H +#ifndef BASICGUI_LINEDLG_H +#define BASICGUI_LINEDLG_H #include "GEOM_BasicGUI.hxx" -#include "GEOMBase_Skeleton.h" -#include "DlgRef_2Sel_QTD.h" +#include + +class DlgRef_2Sel; //================================================================================= // class : BasicGUI_LineDlg // purpose : //================================================================================= -class GEOM_BASICGUI_EXPORT BasicGUI_LineDlg : public GEOMBase_Skeleton +class BASICGUI_EXPORT BasicGUI_LineDlg : public GEOMBase_Skeleton { - Q_OBJECT + Q_OBJECT public: - BasicGUI_LineDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, - const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0); - ~BasicGUI_LineDlg(); - + BasicGUI_LineDlg( GeometryGUI*, QWidget* = 0, + const char* = 0, bool = false, Qt::WindowFlags = 0 ); + ~BasicGUI_LineDlg(); + 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); - - GEOM::GEOM_Object_var myPoint1; - GEOM::GEOM_Object_var myPoint2; - - Ui::DlgRef_2Sel_QTD* GroupPoints; +private: + void Init(); + void enterEvent( QEvent* ); + +private: + GEOM::GEOM_Object_var myPoint1; + GEOM::GEOM_Object_var myPoint2; + + DlgRef_2Sel* GroupPoints; private slots: - void ClickOnOk(); - void ClickOnCancel(); - bool ClickOnApply(); + void ClickOnOk(); + void ClickOnCancel(); + bool ClickOnApply(); - void ActivateThisDialog(); - void DeactivateActiveDialog(); + void ActivateThisDialog(); + void DeactivateActiveDialog(); - void LineEditReturnPressed(); - void SelectionIntoArgument(); - void SetEditCurrentArgument(); - + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); }; -#endif // DIALOGBOX_LINE_H +#endif // BASICGUI_LINEDLG_H diff --git a/src/BasicGUI/BasicGUI_MarkerDlg.cxx b/src/BasicGUI/BasicGUI_MarkerDlg.cxx index ab50fb33b..ea3bd17fe 100644 --- a/src/BasicGUI/BasicGUI_MarkerDlg.cxx +++ b/src/BasicGUI/BasicGUI_MarkerDlg.cxx @@ -1,45 +1,42 @@ -// 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 : BasicGUI_MarkerDlg.cxx +// Author : Sergey LITONIN, Open CASCADE S.A.S. (sergey.litonin@opencascade.com) // -// -// File : BasicGUI_MarkerDlg.cxx -// Author : Sergey LITONIN -// Module : GEOM -// $Header$ #include "BasicGUI_MarkerDlg.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 // OCCT Includes #include @@ -59,8 +56,8 @@ // purpose : Constructor //================================================================================= BasicGUI_MarkerDlg::BasicGUI_MarkerDlg( GeometryGUI* theGeometryGUI, QWidget* theParent ) - : GEOMBase_Skeleton(theGeometryGUI, theParent, "BasicGUI_MarkerDlg", false, - Qt::WindowTitleHint | Qt::WindowSystemMenuHint) + : GEOMBase_Skeleton( theGeometryGUI, theParent, "BasicGUI_MarkerDlg", false, + Qt::WindowTitleHint | Qt::WindowSystemMenuHint ) { QPixmap iconCS1 ( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_MARKER" ) ) ); QPixmap iconCS2 ( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_MARKER2" ) ) ); @@ -69,49 +66,44 @@ BasicGUI_MarkerDlg::BasicGUI_MarkerDlg( GeometryGUI* theGeometryGUI, QWidget* th setWindowTitle( tr( "CAPTION" ) ); - GroupConstructors->setTitle( tr( "LOCALCS" ) ); - RadioButton1->setIcon( iconCS1 ); - RadioButton2->setIcon( iconCS2 ); - RadioButton3->setIcon( iconCS3 ); - - Group1 = new Ui::DlgRef_1Sel_QTD(); - QWidget* aGroup1Widget = new QWidget(this); - Group1->setupUi(aGroup1Widget); - aGroup1Widget->setObjectName("Group1"); - - Group1->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); - Group1->TextLabel1->setText(tr("GEOM_OBJECT")); - Group1->PushButton1->setIcon(iconSelect); - - Group2 = new Ui::DlgRef_3Sel_QTD(); - QWidget* aGroup2Widget = new QWidget(this); - Group2->setupUi(aGroup2Widget); - aGroup2Widget->setObjectName("Group2"); - - Group2->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); - Group2->TextLabel1->setText(tr("GEOM_POINT")); - Group2->TextLabel2->setText(tr("XDIR")); - Group2->TextLabel3->setText(tr("YDIR")); - Group2->PushButton1->setIcon(iconSelect); - Group2->PushButton2->setIcon(iconSelect); - Group2->PushButton3->setIcon(iconSelect); - - aMainGrp = new QFrame( this ); - aMainGrp->setFrameStyle( QFrame::NoFrame ); + mainFrame()->GroupConstructors->setTitle( tr( "LOCALCS" ) ); + mainFrame()->RadioButton1->setIcon( iconCS1 ); + mainFrame()->RadioButton2->setIcon( iconCS2 ); + mainFrame()->RadioButton3->setIcon( iconCS3 ); + + Group1 = new DlgRef_1Sel( centralWidget() ); + + Group1->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) ); + Group1->TextLabel1->setText( tr( "GEOM_OBJECT" ) ); + Group1->PushButton1->setIcon( iconSelect ); + + Group2 = new DlgRef_3Sel( centralWidget() ); + + Group2->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) ); + Group2->TextLabel1->setText( tr( "GEOM_POINT" ) ); + Group2->TextLabel2->setText( tr( "XDIR" ) ); + Group2->TextLabel3->setText( tr( "YDIR" ) ); + Group2->PushButton1->setIcon( iconSelect ); + Group2->PushButton2->setIcon( iconSelect ); + Group2->PushButton3->setIcon( iconSelect ); + + aMainGrp = new QFrame( centralWidget() ); + aMainGrp->setFrameStyle( QFrame::NoFrame | QFrame::Plain ); aMainGrp->setContentsMargins( 0, 0, 0, 0 ); QHBoxLayout* aMainGrpLayout = new QHBoxLayout( aMainGrp ); + aMainGrpLayout->setMargin( 0 ); QGroupBox* anOriGrp = new QGroupBox( tr( "ORIGIN" ), aMainGrp ); QVBoxLayout* anOriGrpLayout = new QVBoxLayout( anOriGrp ); anOriGrpLayout->addWidget( new QLabel( tr( "GEOM_X" ), anOriGrp ) ); - myData[ X ] = new DlgRef_SpinBox( anOriGrp ); + myData[ X ] = new QDoubleSpinBox( anOriGrp ); anOriGrpLayout->addWidget( myData[ X ] ); anOriGrpLayout->addWidget( new QLabel( tr( "GEOM_Y" ), anOriGrp ) ); - myData[ Y ] = new DlgRef_SpinBox( anOriGrp ); + myData[ Y ] = new QDoubleSpinBox( anOriGrp ); anOriGrpLayout->addWidget( myData[ Y ] ); anOriGrpLayout->addWidget( new QLabel( tr( "GEOM_Z" ), anOriGrp ) ); - myData[ Z ] = new DlgRef_SpinBox( anOriGrp ); + myData[ Z ] = new QDoubleSpinBox( anOriGrp ); anOriGrpLayout->addWidget( myData[ Z ] ); aMainGrpLayout->addWidget( anOriGrp ); @@ -120,13 +112,13 @@ BasicGUI_MarkerDlg::BasicGUI_MarkerDlg( GeometryGUI* theGeometryGUI, QWidget* th QVBoxLayout* aXAxisGrpLayout = new QVBoxLayout( aXAxisGrp ); aXAxisGrpLayout->addWidget( new QLabel( tr( "DX" ), aXAxisGrp ) ); - myData[ DX1 ] = new DlgRef_SpinBox( aXAxisGrp ); + myData[ DX1 ] = new QDoubleSpinBox( aXAxisGrp ); aXAxisGrpLayout->addWidget( myData[ DX1 ] ); aXAxisGrpLayout->addWidget( new QLabel( tr( "DY" ), aXAxisGrp ) ); - myData[ DY1 ] = new DlgRef_SpinBox( aXAxisGrp ); + myData[ DY1 ] = new QDoubleSpinBox( aXAxisGrp ); aXAxisGrpLayout->addWidget( myData[ DY1 ] ); aXAxisGrpLayout->addWidget( new QLabel( tr( "DZ" ), aXAxisGrp ) ); - myData[ DZ1 ] = new DlgRef_SpinBox( aXAxisGrp ); + myData[ DZ1 ] = new QDoubleSpinBox( aXAxisGrp ); aXAxisGrpLayout->addWidget( myData[ DZ1 ] ); aMainGrpLayout->addWidget( aXAxisGrp ); @@ -135,22 +127,24 @@ BasicGUI_MarkerDlg::BasicGUI_MarkerDlg( GeometryGUI* theGeometryGUI, QWidget* th QVBoxLayout* anYAxisGrpLayout = new QVBoxLayout( anYAxisGrp ); anYAxisGrpLayout->addWidget( new QLabel( tr( "DX" ), anYAxisGrp ) ); - myData[ DX2 ] = new DlgRef_SpinBox( anYAxisGrp ); + myData[ DX2 ] = new QDoubleSpinBox( anYAxisGrp ); anYAxisGrpLayout->addWidget( myData[ DX2 ] ); anYAxisGrpLayout->addWidget( new QLabel( tr( "DY" ), anYAxisGrp ) ); - myData[ DY2 ] = new DlgRef_SpinBox( anYAxisGrp ); + myData[ DY2 ] = new QDoubleSpinBox( anYAxisGrp ); anYAxisGrpLayout->addWidget( myData[ DY2 ] ); anYAxisGrpLayout->addWidget( new QLabel( tr( "DZ" ), anYAxisGrp ) ); - myData[ DZ2 ] = new DlgRef_SpinBox( anYAxisGrp ); + myData[ DZ2 ] = new QDoubleSpinBox( anYAxisGrp ); anYAxisGrpLayout->addWidget( myData[ DZ2 ] ); aMainGrpLayout->addWidget( anYAxisGrp ); - gridLayout1->addWidget( aMainGrp, 2, 0 ); - gridLayout1->addWidget( aGroup1Widget, 2, 0 ); - gridLayout1->addWidget( aGroup2Widget, 2, 0 ); + QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); + layout->setMargin( 0 ); layout->setSpacing( 6 ); + layout->addWidget( aMainGrp ); + layout->addWidget( Group1 ); + layout->addWidget( Group2 ); - setHelpFileName("local_coordinate_system.htm"); + setHelpFileName( "local_coordinate_system.htm" ); Init(); } @@ -179,44 +173,44 @@ void BasicGUI_MarkerDlg::Init() Group2->LineEdit2->setReadOnly( true ); Group2->LineEdit3->setReadOnly( true ); - connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); - connect(Group1->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(Group2->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(Group2->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(Group2->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) ); - connect(Group1->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(Group2->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(Group2->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(Group2->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect( Group1->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( Group2->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( Group2->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( Group2->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( onClose() ) ); - connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( onDeactivate() ) ); - connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( onClose() ) ); + connect( Group1->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( Group2->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( Group2->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( Group2->LineEdit3, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect( buttonOk, SIGNAL( clicked() ), this, SLOT( onOk() ) ); - connect( buttonApply, SIGNAL( clicked() ), this, SLOT( onApply() ) ); + connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( onDeactivate() ) ); + connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( onClose() ) ); - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + connect( buttonCancel(), SIGNAL( clicked() ), this, SLOT( onClose() ) ); + connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( onOk() ) ); + connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( onApply() ) ); + + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionDone() ) ); - initName( tr( "LCS_NAME" ).toLatin1().constData() ); + initName( tr( "LCS_NAME" ) ); SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); - double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); + double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100 ); - for ( DataMap::iterator anIter = myData.begin(); anIter != myData.end(); ++anIter ) - { - anIter.value()->RangeStepAndValidator( COORD_MIN, COORD_MAX, step, 3 ); + for ( DataMap::iterator anIter = myData.begin(); anIter != myData.end(); ++anIter ) { + initSpinBox( anIter.value(), COORD_MIN, COORD_MAX, step, 3 ); connect( anIter.value(), SIGNAL( valueChanged( double ) ), this, SLOT( onValueChanged( double ) ) ); } - + myBlockPreview = true; for ( DataMap::iterator anIter = myData.begin(); anIter != myData.end(); ++anIter ) - anIter.value()->SetValue( 0 ); - myData[ DX1 ]->SetValue( 1 ); - myData[ DY2 ]->SetValue( 1 ); + anIter.value()->setValue( 0 ); + myData[ DX1 ]->setValue( 1 ); + myData[ DY2 ]->setValue( 1 ); myBlockPreview = false; ConstructorsClicked( 0 ); @@ -246,8 +240,7 @@ void BasicGUI_MarkerDlg::Init() //================================================================================= void BasicGUI_MarkerDlg::ConstructorsClicked( int constructorId ) { - if ( myConstructorId == constructorId && myConstructorId == 0 ) - { + if ( myConstructorId == constructorId && myConstructorId == 0 ) { localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); activate( GEOM_MARKER ); displayPreview(); @@ -256,50 +249,50 @@ void BasicGUI_MarkerDlg::ConstructorsClicked( int constructorId ) myConstructorId = 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: + switch ( constructorId ) { + case 0: { - ::qobject_cast( Group1->gridLayout->parent() )->hide(); - ::qobject_cast( Group2->gridLayout->parent() )->hide(); - resize(0, 0); + Group1->hide(); + Group2->hide(); aMainGrp->show(); localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); activate( GEOM_MARKER ); break; } - case 1: - { - ::qobject_cast( Group2->gridLayout->parent() )->hide(); - aMainGrp->hide(); - //PAL6669: resize(0, 0); - ::qobject_cast( Group1->gridLayout->parent() )->show(); - - globalSelection( GEOM_ALLGEOM ); - myEditCurrentArgument = Group1->LineEdit1; - Group1->LineEdit1->setText(""); - break; - } - case 2: - { - aMainGrp->hide(); - ::qobject_cast( Group1->gridLayout->parent() )->show(); - //PAL6669: resize(0, 0); - ::qobject_cast( Group2->gridLayout->parent() )->show(); - - globalSelection( GEOM_POINT ); - myEditCurrentArgument = Group2->LineEdit1; - Group2->LineEdit1->setText(""); - Group2->LineEdit2->setText(""); - Group2->LineEdit3->setText(""); - break; - } + case 1: + { + aMainGrp->hide(); + Group2->hide(); + Group1->show(); + + globalSelection( GEOM_ALLGEOM ); + myEditCurrentArgument = Group1->LineEdit1; + Group1->LineEdit1->setText( "" ); + break; } + case 2: + { + aMainGrp->hide(); + Group1->show(); + Group2->show(); + + globalSelection( GEOM_POINT ); + myEditCurrentArgument = Group2->LineEdit1; + Group2->LineEdit1->setText( "" ); + Group2->LineEdit2->setText( "" ); + Group2->LineEdit3->setText( "" ); + break; + } + } - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionDone())); + qApp->processEvents(); + updateGeometry(); + resize( minimumSize() ); + + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionDone() ) ); onSelectionDone(); } @@ -343,52 +336,45 @@ bool BasicGUI_MarkerDlg::onApply() //================================================================================= void BasicGUI_MarkerDlg::onSelectionDone0() { - if ( IObjectCount() == 1 ) - { + if ( IObjectCount() == 1 ) { Standard_Boolean aRes = Standard_False; Handle(SALOME_InteractiveObject) anIO = firstIObject(); GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); - + LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); - if ( aRes && !aSelectedObj->_is_nil() ) - { + if ( aRes && !aSelectedObj->_is_nil() ) { TopoDS_Shape aShape; - if ( GEOMBase::GetShape( aSelectedObj, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) - { + if ( GEOMBase::GetShape( aSelectedObj, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) { // Existing LCS selected - if ( aSelectedObj->GetType() == GEOM_MARKER && aShape.ShapeType() == TopAbs_FACE ) - { + if ( aSelectedObj->GetType() == GEOM_MARKER && aShape.ShapeType() == TopAbs_FACE ) { TopoDS_Face aFace = TopoDS::Face( aShape ); Handle(Geom_Plane) aPlane = Handle(Geom_Plane)::DownCast( BRep_Tool::Surface( aFace ) ); - - if ( !aPlane.IsNull() ) - { + + if ( !aPlane.IsNull() ) { gp_Ax3 anAx3 = aPlane->Pln().Position(); gp_Pnt aLoc = anAx3.Location(); gp_Dir aXDir = anAx3.XDirection(); gp_Dir aYDir = anAx3.YDirection(); - - myData[ X ]->SetValue( aLoc.X() ); - myData[ Y ]->SetValue( aLoc.Y() ); - myData[ Z ]->SetValue( aLoc.Z() ); - - myData[ DX1 ]->SetValue( aXDir.X() ); - myData[ DY1 ]->SetValue( aXDir.Y() ); - myData[ DZ1 ]->SetValue( aXDir.Z() ); - - myData[ DX2 ]->SetValue( aYDir.X() ); - myData[ DY2 ]->SetValue( aYDir.Y() ); - myData[ DZ2 ]->SetValue( aYDir.Z() ); + + myData[ X ]->setValue( aLoc.X() ); + myData[ Y ]->setValue( aLoc.Y() ); + myData[ Z ]->setValue( aLoc.Z() ); + + myData[ DX1 ]->setValue( aXDir.X() ); + myData[ DY1 ]->setValue( aXDir.Y() ); + myData[ DZ1 ]->setValue( aXDir.Z() ); + + myData[ DX2 ]->setValue( aYDir.X() ); + myData[ DY2 ]->setValue( aYDir.Y() ); + myData[ DZ2 ]->setValue( aYDir.Z() ); aSelMgr->clearSelected(); } } - else - { + else { TColStd_IndexedMapOfInteger aMap; aSelMgr->GetIndexes( anIO, aMap ); - if ( aMap.Extent() == 1 ) - { + if ( aMap.Extent() == 1 ) { int anIndex = aMap( 1 ); TopTools_IndexedMapOfShape aShapes; TopExp::MapShapes( aShape, aShapes ); @@ -396,18 +382,17 @@ void BasicGUI_MarkerDlg::onSelectionDone0() aSelMgr->clearSelected(); } - if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX ) - { + if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX ) { gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) ); - myData[ X ]->SetValue( aPnt.X() ); - myData[ Y ]->SetValue( aPnt.Y() ); - myData[ Z ]->SetValue( aPnt.Z() ); + myData[ X ]->setValue( aPnt.X() ); + myData[ Y ]->setValue( aPnt.Y() ); + myData[ Z ]->setValue( aPnt.Z() ); } } } } } - + displayPreview(); } @@ -423,7 +408,7 @@ void BasicGUI_MarkerDlg::onSelectionDone() return; } - myEditCurrentArgument->setText(""); + myEditCurrentArgument->setText( "" ); QString aName; if ( IObjectCount() == 1 ) { @@ -433,40 +418,40 @@ void BasicGUI_MarkerDlg::onSelectionDone() if ( !CORBA::is_nil( aSelectedObj ) && aRes ) { aName = GEOMBase::GetName( aSelectedObj ); - + if ( getConstructorId() == 1 ) { // by shape position // Get shape's position - CORBA::Double Ox,Oy,Oz, Zx,Zy,Zz, Xx,Xy,Xz, Yx,Yy,Yz; + CORBA::Double Ox, Oy, Oz, Zx, Zy, Zz, Xx, Xy, Xz, Yx, Yy, Yz; Ox = Oy = Oz = Zx = Zy = Xy = Xz = Yx = Yz = 0; Zz = Xx = Yy = 1.; - + GEOM::GEOM_IMeasureOperations_ptr aMeasureOp = - myGeomGUI->GetGeomGen()->GetIMeasureOperations(getStudyId()); - aMeasureOp->GetPosition(aSelectedObj, Ox,Oy,Oz, Zx,Zy,Zz, Xx,Xy,Xz); - + myGeomGUI->GetGeomGen()->GetIMeasureOperations( getStudyId() ); + aMeasureOp->GetPosition( aSelectedObj, Ox, Oy, Oz, Zx, Zy, Zz, Xx, Xy, Xz ); + // Calculate Y direction - if (aMeasureOp->IsDone()) { - gp_Pnt aPnt (Ox,Oy,Oz); - gp_Dir aDirN (Zx,Zy,Zz); - gp_Dir aDirX (Xx,Xy,Xz); - gp_Ax3 anAx3 (aPnt, aDirN, aDirX); + if ( aMeasureOp->IsDone() ) { + gp_Pnt aPnt ( Ox, Oy, Oz ); + gp_Dir aDirN ( Zx, Zy, Zz ); + gp_Dir aDirX ( Xx, Xy, Xz ); + gp_Ax3 anAx3 ( aPnt, aDirN, aDirX ); gp_Dir aDirY = anAx3.YDirection(); aDirY.Coord(Yx,Yy,Yz); } // Set values - myData[ X ]->SetValue( Ox ); - myData[ Y ]->SetValue( Oy ); - myData[ Z ]->SetValue( Oz ); + myData[ X ]->setValue( Ox ); + myData[ Y ]->setValue( Oy ); + myData[ Z ]->setValue( Oz ); - myData[ DX1 ]->SetValue( Xx ); - myData[ DY1 ]->SetValue( Xy ); - myData[ DZ1 ]->SetValue( Xz ); + myData[ DX1 ]->setValue( Xx ); + myData[ DY1 ]->setValue( Xy ); + myData[ DZ1 ]->setValue( Xz ); - myData[ DX2 ]->SetValue( Yx ); - myData[ DY2 ]->SetValue( Yy ); - myData[ DZ2 ]->SetValue( Yz ); + myData[ DX2 ]->setValue( Yx ); + myData[ DY2 ]->setValue( Yy ); + myData[ DZ2 ]->setValue( Yz ); myEditCurrentArgument->setText( aName ); } @@ -474,7 +459,7 @@ void BasicGUI_MarkerDlg::onSelectionDone() TopoDS_Shape aShape; if ( GEOMBase::GetShape( aSelectedObj, aShape, TopAbs_SHAPE ) ) { GEOM::short_array anIndexes; - + TColStd_IndexedMapOfInteger aMap; LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); aSelMgr->GetIndexes( anIO, aMap ); @@ -486,52 +471,52 @@ void BasicGUI_MarkerDlg::onSelectionDone() aShape = aShapes.FindKey( anIndex ); } - if (myEditCurrentArgument == Group2->LineEdit1) { + if ( myEditCurrentArgument == Group2->LineEdit1 ) { if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX ) { gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) ); - myData[ X ]->SetValue( aPnt.X() ); - myData[ Y ]->SetValue( aPnt.Y() ); - myData[ Z ]->SetValue( aPnt.Z() ); + myData[ X ]->setValue( aPnt.X() ); + myData[ Y ]->setValue( aPnt.Y() ); + myData[ Z ]->setValue( aPnt.Z() ); myEditCurrentArgument->setText( aName ); } else { - myData[ X ]->SetValue( 0 ); - myData[ Y ]->SetValue( 0 ); - myData[ Z ]->SetValue( 0 ); + myData[ X ]->setValue( 0 ); + myData[ Y ]->setValue( 0 ); + myData[ Z ]->setValue( 0 ); } } else if (myEditCurrentArgument == Group2->LineEdit2) { if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_EDGE ) { - gp_Pnt aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(TopoDS::Edge(aShape))); - gp_Pnt aP2 = BRep_Tool::Pnt(TopExp::LastVertex(TopoDS::Edge(aShape))); - gp_Dir aDir(gp_Vec(aP1, aP2)); + gp_Pnt aP1 = BRep_Tool::Pnt( TopExp::FirstVertex( TopoDS::Edge( aShape ) ) ); + gp_Pnt aP2 = BRep_Tool::Pnt( TopExp::LastVertex( TopoDS::Edge( aShape ) ) ); + gp_Dir aDir( gp_Vec( aP1, aP2 ) ); - myData[ DX1 ]->SetValue( aDir.X() ); - myData[ DY1 ]->SetValue( aDir.Y() ); - myData[ DZ1 ]->SetValue( aDir.Z() ); + myData[ DX1 ]->setValue( aDir.X() ); + myData[ DY1 ]->setValue( aDir.Y() ); + myData[ DZ1 ]->setValue( aDir.Z() ); myEditCurrentArgument->setText( aName ); } else { - myData[ DX1 ]->SetValue( 0 ); - myData[ DY1 ]->SetValue( 0 ); - myData[ DZ1 ]->SetValue( 0 ); + myData[ DX1 ]->setValue( 0 ); + myData[ DY1 ]->setValue( 0 ); + myData[ DZ1 ]->setValue( 0 ); } } - else if (myEditCurrentArgument == Group2->LineEdit3) { + else if ( myEditCurrentArgument == Group2->LineEdit3 ) { if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_EDGE ) { - gp_Pnt aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(TopoDS::Edge(aShape))); - gp_Pnt aP2 = BRep_Tool::Pnt(TopExp::LastVertex(TopoDS::Edge(aShape))); - gp_Dir aDir(gp_Vec(aP1, aP2)); + gp_Pnt aP1 = BRep_Tool::Pnt( TopExp::FirstVertex( TopoDS::Edge( aShape ) ) ); + gp_Pnt aP2 = BRep_Tool::Pnt( TopExp::LastVertex( TopoDS::Edge( aShape ) ) ); + gp_Dir aDir(gp_Vec( aP1, aP2 )); - myData[ DX2 ]->SetValue( aDir.X() ); - myData[ DY2 ]->SetValue( aDir.Y() ); - myData[ DZ2 ]->SetValue( aDir.Z() ); + myData[ DX2 ]->setValue( aDir.X() ); + myData[ DY2 ]->setValue( aDir.Y() ); + myData[ DZ2 ]->setValue( aDir.Z() ); myEditCurrentArgument->setText( aName ); } else { - myData[ DX2 ]->SetValue( 0 ); - myData[ DY2 ]->SetValue( 0 ); - myData[ DZ2 ]->SetValue( 0 ); + myData[ DX2 ]->setValue( 0 ); + myData[ DY2 ]->setValue( 0 ); + myData[ DZ2 ]->setValue( 0 ); } } } @@ -540,33 +525,33 @@ void BasicGUI_MarkerDlg::onSelectionDone() } else { if ( getConstructorId() == 1 ) { - myData[ X ]->SetValue( 0 ); - myData[ Y ]->SetValue( 0 ); - myData[ Z ]->SetValue( 0 ); + myData[ X ]->setValue( 0 ); + myData[ Y ]->setValue( 0 ); + myData[ Z ]->setValue( 0 ); - myData[ DX1 ]->SetValue( 0 ); - myData[ DY1 ]->SetValue( 0 ); - myData[ DZ1 ]->SetValue( 0 ); + myData[ DX1 ]->setValue( 0 ); + myData[ DY1 ]->setValue( 0 ); + myData[ DZ1 ]->setValue( 0 ); - myData[ DX2 ]->SetValue( 0 ); - myData[ DY2 ]->SetValue( 0 ); - myData[ DZ2 ]->SetValue( 0 ); + myData[ DX2 ]->setValue( 0 ); + myData[ DY2 ]->setValue( 0 ); + myData[ DZ2 ]->setValue( 0 ); } else if ( getConstructorId() == 2 ) { - if (myEditCurrentArgument == Group2->LineEdit1) { - myData[ X ]->SetValue( 0 ); - myData[ Y ]->SetValue( 0 ); - myData[ Z ]->SetValue( 0 ); + if ( myEditCurrentArgument == Group2->LineEdit1 ) { + myData[ X ]->setValue( 0 ); + myData[ Y ]->setValue( 0 ); + myData[ Z ]->setValue( 0 ); } - else if (myEditCurrentArgument == Group2->LineEdit2) { - myData[ DX1 ]->SetValue( 0 ); - myData[ DY1 ]->SetValue( 0 ); - myData[ DZ1 ]->SetValue( 0 ); + else if ( myEditCurrentArgument == Group2->LineEdit2 ) { + myData[ DX1 ]->setValue( 0 ); + myData[ DY1 ]->setValue( 0 ); + myData[ DZ1 ]->setValue( 0 ); } - else if (myEditCurrentArgument == Group2->LineEdit3) { - myData[ DX2 ]->SetValue( 0 ); - myData[ DY2 ]->SetValue( 0 ); - myData[ DZ2 ]->SetValue( 0 ); + else if ( myEditCurrentArgument == Group2->LineEdit3 ) { + myData[ DX2 ]->setValue( 0 ); + myData[ DY2 ]->setValue( 0 ); + myData[ DZ2 ]->setValue( 0 ); } } } @@ -582,23 +567,23 @@ void BasicGUI_MarkerDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - if(send == Group1->PushButton1) { + if ( send == Group1->PushButton1 ) { myEditCurrentArgument = Group1->LineEdit1; globalSelection( GEOM_ALLGEOM ); } - else if(send == Group2->PushButton1) { + else if ( send == Group2->PushButton1 ) { myEditCurrentArgument = Group2->LineEdit1; globalSelection( GEOM_POINT ); } - else if(send == Group2->PushButton2) { + else if ( send == Group2->PushButton2 ) { myEditCurrentArgument = Group2->LineEdit2; - globalSelection( GEOM_LINE ); + globalSelection( GEOM_LINE ); } - else if(send == Group2->PushButton3) { + else if ( send == Group2->PushButton3 ) { myEditCurrentArgument = Group2->LineEdit3; globalSelection( GEOM_LINE ); } - + myEditCurrentArgument->setFocus(); onSelectionDone(); } @@ -622,7 +607,7 @@ void BasicGUI_MarkerDlg::LineEditReturnPressed() void BasicGUI_MarkerDlg::onActivate() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionDone() ) ); ConstructorsClicked( getConstructorId() ); @@ -641,9 +626,9 @@ void BasicGUI_MarkerDlg::onDeactivate() // function : enterEvent() // purpose : //================================================================================= -void BasicGUI_MarkerDlg::enterEvent(QEvent* e) +void BasicGUI_MarkerDlg::enterEvent( QEvent* ) { - if ( !GroupConstructors->isEnabled() ) + if ( !mainFrame()->GroupConstructors->isEnabled() ) onActivate(); } @@ -663,8 +648,8 @@ GEOM::GEOM_IOperations_ptr BasicGUI_MarkerDlg::createOperation() bool BasicGUI_MarkerDlg::isValid( QString& msg ) { const int id = getConstructorId(); - gp_Vec v1( myData[ DX1 ]->GetValue(), myData[ DY1 ]->GetValue(), myData[ DZ1 ]->GetValue() ), - v2( myData[ DX2 ]->GetValue(), myData[ DY2 ]->GetValue(), myData[ DZ2 ]->GetValue() ); + gp_Vec v1( myData[ DX1 ]->value(), myData[ DY1 ]->value(), myData[ DZ1 ]->value() ), + v2( myData[ DX2 ]->value(), myData[ DY2 ]->value(), myData[ DZ2 ]->value() ); bool isOk = false; // we will got exception if the magnitude of any of the 2 vectors <= gp::Resolution() @@ -675,16 +660,15 @@ bool BasicGUI_MarkerDlg::isValid( QString& msg ) msg += tr( "VEC_PARALLEL" ); } - switch ( id ) - { - case 0: - return isOk; - case 1: - return !Group1->LineEdit1->text().isEmpty() && isOk; - case 2: - return !Group2->LineEdit1->text().isEmpty() && - !Group2->LineEdit2->text().isEmpty() && - !Group2->LineEdit3->text().isEmpty() && isOk; + switch ( id ) { + case 0: + return isOk; + case 1: + return !Group1->LineEdit1->text().isEmpty() && isOk; + case 2: + return !Group2->LineEdit1->text().isEmpty() && + !Group2->LineEdit2->text().isEmpty() && + !Group2->LineEdit3->text().isEmpty() && isOk; } return false; } @@ -696,9 +680,9 @@ bool BasicGUI_MarkerDlg::isValid( QString& msg ) bool BasicGUI_MarkerDlg::execute( ObjectList& objects ) { GEOM::GEOM_Object_var anObj = GEOM::GEOM_IBasicOperations::_narrow( - getOperation() )->MakeMarker( myData[ X ]->GetValue(), myData[ Y ]->GetValue(), myData[ Z ]->GetValue(), - myData[ DX1 ]->GetValue(), myData[ DY1 ]->GetValue(), myData[ DZ1 ]->GetValue(), - myData[ DX2 ]->GetValue(), myData[ DY2 ]->GetValue(), myData[ DZ2 ]->GetValue() ); + getOperation() )->MakeMarker( myData[ X ]->value(), myData[ Y ]->value(), myData[ Z ]->value(), + myData[ DX1 ]->value(), myData[ DY1 ]->value(), myData[ DZ1 ]->value(), + myData[ DX2 ]->value(), myData[ DY2 ]->value(), myData[ DZ2 ]->value() ); if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); @@ -733,12 +717,9 @@ void BasicGUI_MarkerDlg::displayPreview ( const bool activate, const bool toRemoveFromEngine, const double lineWidth ) { - if ( !myBlockPreview ) - { + if ( !myBlockPreview ) { GEOMBase_Skeleton::displayPreview( activate, update, toRemoveFromEngine, lineWidth ); if ( myConstructorId == 0 ) - { GEOMBase_Skeleton::activate( GEOM_MARKER ); - } } } diff --git a/src/BasicGUI/BasicGUI_MarkerDlg.h b/src/BasicGUI/BasicGUI_MarkerDlg.h index 897f9e85a..5a17ce528 100644 --- a/src/BasicGUI/BasicGUI_MarkerDlg.h +++ b/src/BasicGUI/BasicGUI_MarkerDlg.h @@ -1,68 +1,67 @@ -// 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 : BasicGUI_MarkerDlg.h +// Author : Sergey LITONIN, Open CASCADE S.A.S. (sergey.litonin@opencascade.com) // -// -// File : BasicGUI_MarkerDlg.h -// Author : Sergey LITONIN -// Module : GEOM -#ifndef DIALOGBOX_Marker_H -#define DIALOGBOX_Marker_H +#ifndef BASICGUI_MARKERDLG_H +#define BASICGUI_MARKERDLG_H #include "GEOM_BasicGUI.hxx" -#include "GEOMBase_Skeleton.h" -#include "DlgRef_1Sel_QTD.h" -#include "DlgRef_3Sel_QTD.h" +#include #include -class DlgRef_SpinBox; +class DlgRef_1Sel; +class DlgRef_3Sel; +class QDoubleSpinBox; +class QFrame; -class GEOM_BASICGUI_EXPORT BasicGUI_MarkerDlg : public GEOMBase_Skeleton +class BASICGUI_EXPORT BasicGUI_MarkerDlg : public GEOMBase_Skeleton { Q_OBJECT private: enum { X, Y, Z, DX1, DY1, DZ1, DX2, DY2, DZ2 }; - typedef QMap< int, DlgRef_SpinBox* > DataMap; + typedef QMap< int, QDoubleSpinBox* > DataMap; public: - BasicGUI_MarkerDlg( GeometryGUI* theGeometryGUI, QWidget* ); + BasicGUI_MarkerDlg( GeometryGUI*, QWidget* ); virtual ~BasicGUI_MarkerDlg(); void Init(); protected: virtual GEOM::GEOM_IOperations_ptr createOperation(); virtual bool isValid( QString& ); - virtual bool execute( ObjectList& objects ); - virtual void closeEvent( QCloseEvent* e ); - virtual void displayPreview ( const bool activate = false, - const bool update = true, - const bool toRemoveFromEngine = true, - const double lineWidth = -1 ); + virtual bool execute( ObjectList& ); + virtual void closeEvent( QCloseEvent* ); + virtual void displayPreview ( const bool = false, + const bool = true, + const bool = true, + const double = -1 ); private: - void enterEvent( QEvent* e ); + void enterEvent( QEvent* ); void onSelectionDone0(); private slots: @@ -83,9 +82,8 @@ private: int myBlockPreview; QFrame* aMainGrp; - Ui::DlgRef_1Sel_QTD* Group1; - Ui::DlgRef_3Sel_QTD* Group2; - + DlgRef_1Sel* Group1; + DlgRef_3Sel* Group2; }; -#endif // DIALOGBOX_Marker_H +#endif // BASICGUI_MARKERDLG_H diff --git a/src/BasicGUI/BasicGUI_PlaneDlg.cxx b/src/BasicGUI/BasicGUI_PlaneDlg.cxx index f2b53a75e..8a2681ce3 100644 --- a/src/BasicGUI/BasicGUI_PlaneDlg.cxx +++ b/src/BasicGUI/BasicGUI_PlaneDlg.cxx @@ -1,50 +1,43 @@ -// 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 : BasicGUI_PlaneDlg.cxx +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // -// -// File : BasicGUI_PlaneDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ #include "BasicGUI_PlaneDlg.h" -#include "DlgRef_1Sel1Spin.h" -#include "DlgRef_2Sel1Spin.h" -#include "DlgRef_3Sel1Spin.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 +#include +#include +#include +#include -#include "GEOMImpl_Types.hxx" +#include -using namespace std; +#include //================================================================================= // class : BasicGUI_PlaneDlg() @@ -53,61 +46,63 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -BasicGUI_PlaneDlg::BasicGUI_PlaneDlg(GeometryGUI* theGeometryGUI, QWidget* parent, - const char* name, bool modal, Qt::WindowFlags fl) - :GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) +BasicGUI_PlaneDlg::BasicGUI_PlaneDlg( GeometryGUI* theGeometryGUI, QWidget* parent, + const char* name, bool modal, Qt::WindowFlags fl ) + : GEOMBase_Skeleton( theGeometryGUI, parent, name, 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"))); - QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_PLANE_FACE"))); - QPixmap image3(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + 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" ) ) ); + QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_PLANE_FACE" ) ) ); + QPixmap image3( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); - setWindowTitle(tr("GEOM_PLANE_TITLE")); + setWindowTitle( tr( "GEOM_PLANE_TITLE" ) ); /***************************************************************/ - GroupConstructors->setTitle(tr("GEOM_PLANE")); - RadioButton1->setIcon(image0); - RadioButton2->setIcon(image1); - RadioButton3->setIcon(image2); - - GroupPntDir = new DlgRef_2Sel1Spin(this, "GroupPointDirection"); - GroupPntDir->GroupBox1->setTitle(tr("GEOM_PLANE_PV")); - GroupPntDir->TextLabel1->setText(tr("GEOM_POINT")); - GroupPntDir->TextLabel2->setText(tr("GEOM_VECTOR")); - GroupPntDir->TextLabel3->setText(tr("GEOM_PLANE_SIZE")); - GroupPntDir->PushButton1->setIcon(image3); - GroupPntDir->PushButton2->setIcon(image3); + mainFrame()->GroupConstructors->setTitle( tr( "GEOM_PLANE" ) ); + mainFrame()->RadioButton1->setIcon( image0 ); + mainFrame()->RadioButton2->setIcon( image1 ); + mainFrame()->RadioButton3->setIcon( image2 ); + + GroupPntDir = new DlgRef_2Sel1Spin( centralWidget() ); + GroupPntDir->GroupBox1->setTitle( tr( "GEOM_PLANE_PV" ) ); + GroupPntDir->TextLabel1->setText( tr( "GEOM_POINT" ) ); + GroupPntDir->TextLabel2->setText( tr( "GEOM_VECTOR" ) ); + GroupPntDir->TextLabel3->setText( tr( "GEOM_PLANE_SIZE" ) ); + GroupPntDir->PushButton1->setIcon( image3 ); + GroupPntDir->PushButton2->setIcon( image3 ); GroupPntDir->LineEdit1->setReadOnly( true ); GroupPntDir->LineEdit2->setReadOnly( true ); - Group3Pnts = new DlgRef_3Sel1Spin(this, "Group3Pnts"); - Group3Pnts->GroupBox1->setTitle(tr("GEOM_3_POINTS")); - Group3Pnts->TextLabel1->setText(tr("GEOM_POINT1")); - Group3Pnts->TextLabel2->setText(tr("GEOM_POINT2")); - Group3Pnts->TextLabel3->setText(tr("GEOM_POINT3")); - Group3Pnts->TextLabel4->setText(tr("GEOM_PLANE_SIZE")); - Group3Pnts->PushButton1->setIcon(image3); - Group3Pnts->PushButton2->setIcon(image3); - Group3Pnts->PushButton3->setIcon(image3); + Group3Pnts = new DlgRef_3Sel1Spin( centralWidget() ); + Group3Pnts->GroupBox1->setTitle( tr( "GEOM_3_POINTS" ) ); + Group3Pnts->TextLabel1->setText( tr( "GEOM_POINT1" ) ); + Group3Pnts->TextLabel2->setText( tr( "GEOM_POINT2" ) ); + Group3Pnts->TextLabel3->setText( tr( "GEOM_POINT3" ) ); + Group3Pnts->TextLabel4->setText( tr( "GEOM_PLANE_SIZE" ) ); + Group3Pnts->PushButton1->setIcon( image3 ); + Group3Pnts->PushButton2->setIcon( image3 ); + Group3Pnts->PushButton3->setIcon( image3 ); Group3Pnts->LineEdit1->setReadOnly( true ); Group3Pnts->LineEdit2->setReadOnly( true ); Group3Pnts->LineEdit3->setReadOnly( true ); - GroupFace = new DlgRef_1Sel1Spin(this, "GroupFace"); - GroupFace->GroupBox1->setTitle(tr("GEOM_FACE_OR_LCS")); - GroupFace->TextLabel1->setText(tr("GEOM_SELECTION")); - GroupFace->TextLabel2->setText(tr("GEOM_PLANE_SIZE")); - GroupFace->PushButton1->setIcon(image3); + GroupFace = new DlgRef_1Sel1Spin( centralWidget() ); + GroupFace->GroupBox1->setTitle( tr( "GEOM_FACE_OR_LCS" ) ); + GroupFace->TextLabel1->setText( tr( "GEOM_SELECTION" ) ); + GroupFace->TextLabel2->setText( tr( "GEOM_PLANE_SIZE" ) ); + GroupFace->PushButton1->setIcon( image3 ); GroupFace->LineEdit1->setReadOnly( true ); - gridLayout1->addWidget(GroupPntDir, 2, 0); - gridLayout1->addWidget(Group3Pnts, 2, 0); - gridLayout1->addWidget(GroupFace, 2, 0); + QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); + layout->setMargin( 0 ); layout->setSpacing( 6 ); + layout->addWidget( GroupPntDir ); + layout->addWidget( Group3Pnts ); + layout->addWidget( GroupFace ); /***************************************************************/ - setHelpFileName("plane.htm"); + setHelpFileName( "plane.htm" ); Init(); } @@ -137,55 +132,56 @@ void BasicGUI_PlaneDlg::Init() /* Get setting of step value from file configuration */ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); - double aStep = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); + double aStep = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100 ); double aTrimSize = 2000.0; /* min, max, step and decimals for spin boxes */ - GroupPntDir->SpinBox_DX->RangeStepAndValidator( 0.001, COORD_MAX, aStep, 3 ); - GroupPntDir->SpinBox_DX->SetValue( aTrimSize ); - Group3Pnts->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, aStep, 3); - Group3Pnts->SpinBox_DX->SetValue( aTrimSize ); - GroupFace->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, aStep, 3); - GroupFace->SpinBox_DX->SetValue( aTrimSize ); + initSpinBox( GroupPntDir->SpinBox_DX, 0.001, COORD_MAX, aStep, 3 ); + GroupPntDir->SpinBox_DX->setValue( aTrimSize ); + initSpinBox( Group3Pnts->SpinBox_DX, 0.001, COORD_MAX, aStep, 3 ); + Group3Pnts->SpinBox_DX->setValue( aTrimSize ); + initSpinBox( GroupFace->SpinBox_DX, 0.001, COORD_MAX, aStep, 3 ); + GroupFace->SpinBox_DX->setValue( aTrimSize ); /* signals and slots connections */ - connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); - connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); - connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); - - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); - connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); - - connect(GroupPntDir->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPntDir->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(Group3Pnts->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(Group3Pnts->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(Group3Pnts->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupFace->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - - connect(GroupPntDir->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupPntDir->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(Group3Pnts->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(Group3Pnts->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(Group3Pnts->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupFace->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - - connect(GroupPntDir->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(Group3Pnts->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(GroupFace->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPntDir->SpinBox_DX, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group3Pnts->SpinBox_DX, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupFace->SpinBox_DX, SLOT(SetStep(double))); - - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); - - initName( tr( "GEOM_PLANE" ).toLatin1().constData() ); - - Group3Pnts->hide(); - GroupFace->hide(); + connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ); + connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ); + + connect( buttonCancel(), SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ); + connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); + + connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) ); + + connect( GroupPntDir->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( GroupPntDir->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( Group3Pnts->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( Group3Pnts->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( Group3Pnts->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( GroupFace->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + + connect( GroupPntDir->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( GroupPntDir->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( Group3Pnts->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( Group3Pnts->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( Group3Pnts->LineEdit3, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( GroupFace->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + + connect( GroupPntDir->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( Group3Pnts->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( GroupFace->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + + // VSR: TODO ->> + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupPntDir->SpinBox_DX, SLOT( SetStep( double ) ) ); + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), Group3Pnts->SpinBox_DX, SLOT( SetStep( double ) ) ); + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupFace->SpinBox_DX, SLOT( SetStep( double ) ) ); + // <<- + + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + + initName( tr( "GEOM_PLANE" ) ); + ConstructorsClicked( 0 ); } @@ -194,67 +190,67 @@ void BasicGUI_PlaneDlg::Init() // function : ConstructorsClicked() // purpose : Radio button management //================================================================================= -void BasicGUI_PlaneDlg::ConstructorsClicked(int constructorId) +void BasicGUI_PlaneDlg::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 ); myPoint = myDir = myPoint1 = myPoint2 = myPoint3 = myFace = GEOM::GEOM_Object::_nil(); - switch ( constructorId ) - { - case 0: /* plane from a point and a direction (vector, edge...) */ - { - Group3Pnts->hide(); - GroupFace->hide(); - resize(0, 0); - GroupPntDir->show(); - - myEditCurrentArgument = GroupPntDir->LineEdit1; - GroupPntDir->LineEdit1->setText(tr("")); - GroupPntDir->LineEdit2->setText(tr("")); - - /* for the first argument */ - globalSelection( GEOM_POINT ); - break; - } - case 1: /* plane from 3 points */ - { - GroupPntDir->hide(); - GroupFace->hide(); - resize(0, 0); - Group3Pnts->show(); - - myEditCurrentArgument = Group3Pnts->LineEdit1; - Group3Pnts->LineEdit1->setText(""); - Group3Pnts->LineEdit2->setText(""); - Group3Pnts->LineEdit3->setText(""); - - /* for the first argument */ - globalSelection( GEOM_POINT ); - break; - } - case 2: /* plane from a planar face selection */ - { - GroupPntDir->hide(); - Group3Pnts->hide(); - resize(0, 0); - GroupFace->show(); - - myEditCurrentArgument = GroupFace->LineEdit1; - GroupFace->LineEdit1->setText(tr("")); - - /* for the first argument */ - //globalSelection( GEOM_PLANE ); - TColStd_MapOfInteger aMap; - aMap.Add( GEOM_PLANE ); - aMap.Add( GEOM_MARKER ); - globalSelection( aMap ); - break; - } + switch ( constructorId ) { + case 0: /* plane from a point and a direction (vector, edge...) */ + { + Group3Pnts->hide(); + GroupFace->hide(); + GroupPntDir->show(); + + myEditCurrentArgument = GroupPntDir->LineEdit1; + GroupPntDir->LineEdit1->setText( "" ); + GroupPntDir->LineEdit2->setText( "" ); + + /* for the first argument */ + globalSelection( GEOM_POINT ); + break; + } + case 1: /* plane from 3 points */ + { + GroupPntDir->hide(); + GroupFace->hide(); + Group3Pnts->show(); + + myEditCurrentArgument = Group3Pnts->LineEdit1; + Group3Pnts->LineEdit1->setText( "" ); + Group3Pnts->LineEdit2->setText( "" ); + Group3Pnts->LineEdit3->setText( "" ); + + /* for the first argument */ + globalSelection( GEOM_POINT ); + break; + } + case 2: /* plane from a planar face selection */ + { + GroupPntDir->hide(); + Group3Pnts->hide(); + GroupFace->show(); + + myEditCurrentArgument = GroupFace->LineEdit1; + GroupFace->LineEdit1->setText( "" ); + + /* for the first argument */ + //globalSelection( GEOM_PLANE ); + TColStd_MapOfInteger aMap; + aMap.Add( GEOM_PLANE ); + aMap.Add( GEOM_MARKER ); + globalSelection( aMap ); + break; } + } + + qApp->processEvents(); + updateGeometry(); + resize( minimumSize() ); myEditCurrentArgument->setFocus(); - 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() ) ); } @@ -300,8 +296,7 @@ void BasicGUI_PlaneDlg::SelectionIntoArgument() { myEditCurrentArgument->setText(""); - if ( IObjectCount() != 1 ) - { + if ( IObjectCount() != 1 ) { if ( myEditCurrentArgument == GroupPntDir->LineEdit1 ) myPoint = GEOM::GEOM_Object::_nil(); else if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) myDir = GEOM::GEOM_Object::_nil(); else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = GEOM::GEOM_Object::_nil(); @@ -314,8 +309,7 @@ void BasicGUI_PlaneDlg::SelectionIntoArgument() // nbSel == 1 Standard_Boolean aRes = Standard_False; GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes ); - if ( !CORBA::is_nil( aSelectedObject ) && aRes ) - { + if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); if ( myEditCurrentArgument == GroupPntDir->LineEdit1 ) myPoint = aSelectedObject; else if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) myDir = aSelectedObject; @@ -374,8 +368,7 @@ void BasicGUI_PlaneDlg::LineEditReturnPressed() send == Group3Pnts->LineEdit1 || send == Group3Pnts->LineEdit2 || send == Group3Pnts->LineEdit3 || - send == GroupFace->LineEdit1 ) - { + send == GroupFace->LineEdit1 ) { myEditCurrentArgument = send; GEOMBase_Skeleton::LineEditReturnPressed(); } @@ -389,8 +382,8 @@ void BasicGUI_PlaneDlg::LineEditReturnPressed() void BasicGUI_PlaneDlg::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() ) ); // myGeomGUI->SetState( 0 ); @@ -411,9 +404,9 @@ void BasicGUI_PlaneDlg::DeactivateActiveDialog() // function : enterEvent() // purpose : //================================================================================= -void BasicGUI_PlaneDlg::enterEvent(QEvent* e) +void BasicGUI_PlaneDlg::enterEvent( QEvent* ) { - if ( !GroupConstructors->isEnabled() ) + if ( !mainFrame()->GroupConstructors->isEnabled() ) ActivateThisDialog(); } @@ -422,7 +415,7 @@ void BasicGUI_PlaneDlg::enterEvent(QEvent* e) // function : ValueChangedInSpinBox() // purpose : //================================================================================= -void BasicGUI_PlaneDlg::ValueChangedInSpinBox(double newValue) +void BasicGUI_PlaneDlg::ValueChangedInSpinBox( double newValue ) { displayPreview(); } @@ -433,11 +426,10 @@ void BasicGUI_PlaneDlg::ValueChangedInSpinBox(double newValue) //================================================================================= double BasicGUI_PlaneDlg::getSize() const { - switch ( getConstructorId() ) - { - case 0 : return GroupPntDir->SpinBox_DX->GetValue(); - case 1 : return Group3Pnts->SpinBox_DX->GetValue(); - case 2 : return GroupFace->SpinBox_DX->GetValue(); + switch ( getConstructorId() ) { + case 0 : return GroupPntDir->SpinBox_DX->value(); + case 1 : return Group3Pnts->SpinBox_DX->value(); + case 2 : return GroupFace->SpinBox_DX->value(); } return 0.; } @@ -466,20 +458,19 @@ static bool isEqual( const GEOM::GEOM_Object_var& thePnt1, const GEOM::GEOM_Obje //================================================================================= bool BasicGUI_PlaneDlg::isValid( QString& msg ) { - const int id = getConstructorId(); - if ( getSize() <= 0 ) - { - msg = QString( "Please, enter size greater than 0." ); - return false; - } - if ( id == 0 ) - return !CORBA::is_nil( myPoint ) && !CORBA::is_nil( myDir ); - else if ( id == 1 ) - return !CORBA::is_nil( myPoint1 ) && !CORBA::is_nil( myPoint2 ) && !CORBA::is_nil( myPoint3 ) && - !isEqual( myPoint1, myPoint2 ) && !isEqual( myPoint1, myPoint3 ) && !isEqual( myPoint2, myPoint3 ); - else if ( id == 2 ) - return !CORBA::is_nil( myFace ); - return false; + const int id = getConstructorId(); + if ( getSize() <= 0 ) { + msg = QString( "Please, enter size greater than 0." ); + return false; + } + if ( id == 0 ) + return !CORBA::is_nil( myPoint ) && !CORBA::is_nil( myDir ); + else if ( id == 1 ) + return !CORBA::is_nil( myPoint1 ) && !CORBA::is_nil( myPoint2 ) && !CORBA::is_nil( myPoint3 ) && + !isEqual( myPoint1, myPoint2 ) && !isEqual( myPoint1, myPoint3 ) && !isEqual( myPoint2, myPoint3 ); + else if ( id == 2 ) + return !CORBA::is_nil( myFace ); + return false; } //================================================================================= @@ -492,8 +483,7 @@ bool BasicGUI_PlaneDlg::execute( ObjectList& objects ) GEOM::GEOM_Object_var anObj; - switch ( getConstructorId() ) - { + switch ( getConstructorId() ) { case 0 : anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakePlanePntVec( myPoint, myDir, getSize() ); res = true; @@ -510,7 +500,7 @@ bool BasicGUI_PlaneDlg::execute( ObjectList& objects ) if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); - + return res; } diff --git a/src/BasicGUI/BasicGUI_PlaneDlg.h b/src/BasicGUI/BasicGUI_PlaneDlg.h index aadf477a7..f94b8500c 100644 --- a/src/BasicGUI/BasicGUI_PlaneDlg.h +++ b/src/BasicGUI/BasicGUI_PlaneDlg.h @@ -1,36 +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 : BasicGUI_PlaneDlg.h +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // -// -// File : BasicGUI_PlaneDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -#ifndef DIALOGBOX_PLANE_H -#define DIALOGBOX_PLANE_H +#ifndef BASICGUI_PLANEDLG_H +#define BASICGUI_PLANEDLG_H #include "GEOM_BasicGUI.hxx" -#include "GEOMBase_Skeleton.h" +#include class DlgRef_1Sel1Spin; class DlgRef_2Sel1Spin; @@ -40,48 +38,48 @@ class DlgRef_3Sel1Spin; // class : BasicGUI_PlaneDlg // purpose : //================================================================================= -class GEOM_BASICGUI_EXPORT BasicGUI_PlaneDlg : public GEOMBase_Skeleton +class BASICGUI_EXPORT BasicGUI_PlaneDlg : public GEOMBase_Skeleton { - Q_OBJECT + Q_OBJECT public: - BasicGUI_PlaneDlg( GeometryGUI* theGeometryGUI, QWidget* parent = 0, - const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0); - ~BasicGUI_PlaneDlg(); - + BasicGUI_PlaneDlg( GeometryGUI*, QWidget* = 0, + const char* = 0, bool = false, Qt::WindowFlags = 0 ); + ~BasicGUI_PlaneDlg(); + protected: - // redefined from GEOMBase_Helper - virtual GEOM::GEOM_IOperations_ptr createOperation(); - virtual bool isValid( QString& ); - virtual bool execute( ObjectList& objects ); + // redefined from GEOMBase_Helper + virtual GEOM::GEOM_IOperations_ptr createOperation(); + virtual bool isValid( QString& ); + virtual bool execute( ObjectList& ); + + virtual void closeEvent( QCloseEvent* ); - virtual void closeEvent( QCloseEvent* e ); +private: + void Init(); + void enterEvent( QEvent* ); + double getSize() const; -private : - void Init(); - void enterEvent(QEvent* e); - double getSize() const; +private: + GEOM::GEOM_Object_var myPoint, myDir, myPoint1, myPoint2, myPoint3, myFace; - GEOM::GEOM_Object_var myPoint, myDir, myPoint1, myPoint2, myPoint3, myFace; - - DlgRef_2Sel1Spin* GroupPntDir; - DlgRef_3Sel1Spin* Group3Pnts; - DlgRef_1Sel1Spin* GroupFace; + DlgRef_2Sel1Spin* GroupPntDir; + DlgRef_3Sel1Spin* Group3Pnts; + DlgRef_1Sel1Spin* GroupFace; private slots: - void ClickOnOk(); - void ClickOnCancel(); - bool ClickOnApply(); - - void ActivateThisDialog(); - void DeactivateActiveDialog(); - - void SelectionIntoArgument(); - void LineEditReturnPressed(); - void SetEditCurrentArgument(); - void ConstructorsClicked(int constructorId); - void ValueChangedInSpinBox(double newValue); - + void ClickOnOk(); + void ClickOnCancel(); + bool ClickOnApply(); + + void ActivateThisDialog(); + void DeactivateActiveDialog(); + + void SelectionIntoArgument(); + void LineEditReturnPressed(); + void SetEditCurrentArgument(); + void ConstructorsClicked( int ); + void ValueChangedInSpinBox( double ); }; -#endif // DIALOGBOX_PLANE_H +#endif // BASICGUI_PLANEDLG_H diff --git a/src/BasicGUI/BasicGUI_PointDlg.cxx b/src/BasicGUI/BasicGUI_PointDlg.cxx index 41ff3e7f8..73ea6e16a 100644 --- a/src/BasicGUI/BasicGUI_PointDlg.cxx +++ b/src/BasicGUI/BasicGUI_PointDlg.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 : BasicGUI_PointDlg.cxx +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // -// -// File : BasicGUI_PointDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ #include "BasicGUI_PointDlg.h" -#include "SUIT_ResourceMgr.h" -#include "SUIT_Session.h" -#include "SalomeApp_Application.h" -#include "LightApp_SelectionMgr.h" +#include +#include +#include +#include -#include "GeometryGUI.h" -#include "GEOMBase.h" +#include +#include -#include "DlgRef_SpinBox.h" -#include "DlgRef_1Sel1Spin.h" -#include "DlgRef_3Spin.h" -#include "DlgRef_1Sel3Spin.h" +#include -#include "GEOMImpl_Types.hxx" +#include #include #include @@ -55,7 +49,6 @@ #include #include -using namespace std; //================================================================================= // class : BasicGUI_PointDlg() // purpose : Constructs a BasicGUI_PointDlg which is a child of 'parent', with the @@ -63,55 +56,44 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -BasicGUI_PointDlg::BasicGUI_PointDlg(GeometryGUI* theGeometryGUI, QWidget* parent, - const char* name, bool modal, Qt::WindowFlags fl) - :GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, fl ) +BasicGUI_PointDlg::BasicGUI_PointDlg( GeometryGUI* theGeometryGUI, QWidget* parent, + const char* name, bool modal, Qt::WindowFlags fl ) + : GEOMBase_Skeleton( theGeometryGUI, parent, name, 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"))); - QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); - QPixmap image3(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_POINT_REF"))); + 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" ) ) ); + QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); + QPixmap image3( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_POINT_REF" ) ) ); - setWindowTitle(tr("GEOM_POINT_TITLE")); + setWindowTitle( tr( "GEOM_POINT_TITLE" ) ); - QFrame* aFrame = new QFrame( this ); - aFrame->setContentsMargins( 0, 0, 0, 0 ); - aFrame->setFrameStyle( QFrame::NoFrame ); - QHBoxLayout* aFrameLayout = new QHBoxLayout( aFrame ); - - /***************************************************************/ - GroupConstructors->setTitle(tr("GEOM_POINTS")); - RadioButton1->setIcon(image0); - RadioButton2->setIcon(image3); - RadioButton3->setIcon(image1); - - GroupXYZ = new DlgRef_3Spin( aFrame, "GroupXYZ" ); - GroupXYZ->GroupBox1->setTitle(tr("GEOM_COORDINATES")); - GroupXYZ->TextLabel1->setText(tr("GEOM_X")); - GroupXYZ->TextLabel2->setText(tr("GEOM_Y")); - GroupXYZ->TextLabel3->setText(tr("GEOM_Z")); - aFrameLayout->addWidget(GroupXYZ); - - GroupOnCurve = new DlgRef_1Sel1Spin( aFrame, "GroupOnCurve" ); - GroupOnCurve->GroupBox1->setTitle(tr("GEOM_PARAM_POINT")); - GroupOnCurve->TextLabel1->setText(tr("GEOM_EDGE")); - GroupOnCurve->TextLabel2->setText(tr("GEOM_PARAMETER")); - GroupOnCurve->PushButton1->setIcon(image2); - aFrameLayout->addWidget(GroupOnCurve); - - GroupRefPoint = new DlgRef_1Sel3Spin( aFrame, "GoupRefPoint" ); - GroupRefPoint->GroupBox1->setTitle(tr("GEOM_REF_POINT")); - GroupRefPoint->TextLabel1->setText(tr("GEOM_POINT")); - GroupRefPoint->PushButton1->setIcon(image2); - GroupRefPoint->TextLabel2->setText(tr("GEOM_DX")); - GroupRefPoint->TextLabel3->setText(tr("GEOM_DY")); - GroupRefPoint->TextLabel4->setText(tr("GEOM_DZ")); - aFrameLayout->addWidget(GroupRefPoint); - - gridLayout1->addWidget( aFrame, 2, 0 ); /***************************************************************/ - - myCoordGrp = new QGroupBox( tr( "GEOM_COORDINATES" ), aFrame ); + mainFrame()->GroupConstructors->setTitle( tr( "GEOM_POINTS" ) ); + mainFrame()->RadioButton1->setIcon( image0 ); + mainFrame()->RadioButton2->setIcon( image3 ); + mainFrame()->RadioButton3->setIcon( image1 ); + + GroupXYZ = new DlgRef_3Spin( centralWidget() ); + GroupXYZ->GroupBox1->setTitle( tr( "GEOM_COORDINATES" ) ); + GroupXYZ->TextLabel1->setText( tr( "GEOM_X" ) ); + GroupXYZ->TextLabel2->setText( tr( "GEOM_Y" ) ); + GroupXYZ->TextLabel3->setText( tr( "GEOM_Z" ) ); + + GroupOnCurve = new DlgRef_1Sel1Spin( centralWidget() ); + GroupOnCurve->GroupBox1->setTitle( tr( "GEOM_PARAM_POINT" ) ); + GroupOnCurve->TextLabel1->setText( tr( "GEOM_EDGE" ) ); + GroupOnCurve->TextLabel2->setText( tr( "GEOM_PARAMETER" ) ); + GroupOnCurve->PushButton1->setIcon( image2 ); + + GroupRefPoint = new DlgRef_1Sel3Spin( centralWidget() ); + GroupRefPoint->GroupBox1->setTitle( tr( "GEOM_REF_POINT" ) ); + GroupRefPoint->TextLabel1->setText( tr( "GEOM_POINT" ) ); + GroupRefPoint->PushButton1->setIcon( image2 ); + GroupRefPoint->TextLabel2->setText( tr( "GEOM_DX" ) ); + GroupRefPoint->TextLabel3->setText( tr( "GEOM_DY" ) ); + GroupRefPoint->TextLabel4->setText( tr( "GEOM_DZ" ) ); + + myCoordGrp = new QGroupBox( tr( "GEOM_COORDINATES" ), centralWidget() ); QGridLayout* myCoordGrpLayout = new QGridLayout( myCoordGrp ); myCoordGrpLayout->addWidget( new QLabel( tr( "GEOM_X" ), myCoordGrp ), 0, 0 ); myX = new QLineEdit( myCoordGrp ); @@ -123,6 +105,13 @@ BasicGUI_PointDlg::BasicGUI_PointDlg(GeometryGUI* theGeometryGUI, QWidget* paren myZ = new QLineEdit( myCoordGrp ); myCoordGrpLayout->addWidget( myZ, 2, 1 ); + QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); + layout->setMargin( 0 ); layout->setSpacing( 6 ); + layout->addWidget( GroupXYZ ); + layout->addWidget( GroupOnCurve ); + layout->addWidget( GroupRefPoint ); + layout->addWidget( myCoordGrp ); + myX->setReadOnly( true ); myY->setReadOnly( true ); myZ->setReadOnly( true ); @@ -137,7 +126,7 @@ BasicGUI_PointDlg::BasicGUI_PointDlg(GeometryGUI* theGeometryGUI, QWidget* paren myY->setPalette( aPal ); myZ->setPalette( aPal ); - setHelpFileName("point.htm"); + setHelpFileName( "point.htm" ); Init(); } @@ -168,59 +157,63 @@ void BasicGUI_PointDlg::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 */ - GroupXYZ->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - GroupXYZ->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - GroupXYZ->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - GroupXYZ->SpinBox_DX->SetValue(0.0); - GroupXYZ->SpinBox_DY->SetValue(0.0); - GroupXYZ->SpinBox_DZ->SetValue(0.0); - - GroupRefPoint->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - GroupRefPoint->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - GroupRefPoint->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - GroupRefPoint->SpinBox_DX->SetValue(0.0); - GroupRefPoint->SpinBox_DY->SetValue(0.0); - GroupRefPoint->SpinBox_DZ->SetValue(0.0); + initSpinBox( GroupXYZ->SpinBox_DX, COORD_MIN, COORD_MAX, step, 3 ); + initSpinBox( GroupXYZ->SpinBox_DY, COORD_MIN, COORD_MAX, step, 3 ); + initSpinBox( GroupXYZ->SpinBox_DZ, COORD_MIN, COORD_MAX, step, 3 ); + GroupXYZ->SpinBox_DX->setValue( 0.0 ); + GroupXYZ->SpinBox_DY->setValue( 0.0 ); + GroupXYZ->SpinBox_DZ->setValue( 0.0 ); + + initSpinBox( GroupRefPoint->SpinBox_DX, COORD_MIN, COORD_MAX, step, 3 ); + initSpinBox( GroupRefPoint->SpinBox_DY, COORD_MIN, COORD_MAX, step, 3 ); + initSpinBox( GroupRefPoint->SpinBox_DZ, COORD_MIN, COORD_MAX, step, 3 ); + GroupRefPoint->SpinBox_DX->setValue( 0.0 ); + GroupRefPoint->SpinBox_DY->setValue( 0.0 ); + GroupRefPoint->SpinBox_DZ->setValue( 0.0 ); step = 0.1; - GroupOnCurve->SpinBox_DX->RangeStepAndValidator(0., 1., step, 3); - GroupOnCurve->SpinBox_DX->SetValue( 0.5 ); + + initSpinBox( GroupOnCurve->SpinBox_DX, 0., 1., step, 3 ); + GroupOnCurve->SpinBox_DX->setValue( 0.5 ); /* signals and slots connections */ - connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); - connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); - connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); - - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); - connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); - - connect(GroupOnCurve->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupOnCurve->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - - connect(GroupOnCurve->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(GroupXYZ->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(GroupXYZ->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(GroupXYZ->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(GroupRefPoint->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(GroupRefPoint->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(GroupRefPoint->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupOnCurve->SpinBox_DX, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupXYZ->SpinBox_DX, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupXYZ->SpinBox_DY, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupXYZ->SpinBox_DZ, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupRefPoint->SpinBox_DX, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupRefPoint->SpinBox_DY, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupRefPoint->SpinBox_DZ, SLOT(SetStep(double))); - - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ); + connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ); + + connect( buttonCancel(), SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ); + connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); + + connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) ); + + connect( GroupOnCurve->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( GroupOnCurve->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + + connect( GroupOnCurve->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( GroupXYZ->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( GroupXYZ->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( GroupXYZ->SpinBox_DZ, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( GroupRefPoint->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( GroupRefPoint->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( GroupRefPoint->SpinBox_DZ, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + + // VSR: TODO ->> + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupOnCurve->SpinBox_DX, SLOT( SetStep( double ) ) ); + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupXYZ->SpinBox_DX, SLOT( SetStep( double ) ) ); + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupXYZ->SpinBox_DY, SLOT( SetStep( double ) ) ); + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupXYZ->SpinBox_DZ, SLOT( SetStep( double ) ) ); + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupRefPoint->SpinBox_DX, SLOT( SetStep( double ) ) ); + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupRefPoint->SpinBox_DY, SLOT( SetStep( double ) ) ); + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupRefPoint->SpinBox_DZ, SLOT( SetStep( double ) ) ); + // <<- + + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - initName( tr("GEOM_VERTEX").toLatin1().constData() ); + initName( tr( "GEOM_VERTEX" ) ); ConstructorsClicked( 0 ); } @@ -232,31 +225,30 @@ void BasicGUI_PointDlg::Init() //================================================================================= void BasicGUI_PointDlg::ConstructorsClicked(int constructorId) { - switch ( constructorId ) - { + switch ( constructorId ) { case 0: { localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); - + GroupRefPoint->hide(); GroupOnCurve->hide(); - GroupXYZ->show(); - myCoordGrp->hide(); + + GroupXYZ->show(); break; } case 1: { myEditCurrentArgument = GroupRefPoint->LineEdit1; - myEditCurrentArgument->setText(""); + myEditCurrentArgument->setText( "" ); myRefPoint = GEOM::GEOM_Object::_nil(); - + globalSelection( GEOM_POINT ); - + GroupXYZ->hide(); GroupOnCurve->hide(); - + GroupRefPoint->show(); myCoordGrp->show(); @@ -265,7 +257,7 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId) case 2: { myEditCurrentArgument = GroupOnCurve->LineEdit1; - myEditCurrentArgument->setText(""); + myEditCurrentArgument->setText( "" ); myEdge = GEOM::GEOM_Object::_nil(); globalSelection( GEOM_EDGE ); @@ -336,44 +328,37 @@ void BasicGUI_PointDlg::SelectionIntoArgument() { const int id = getConstructorId(); - if ( ( id == 1 || id == 2 ) && myEditCurrentArgument != 0 ) - { - myEditCurrentArgument->setText(""); + if ( ( id == 1 || id == 2 ) && myEditCurrentArgument != 0 ) { + myEditCurrentArgument->setText( "" ); myX->setText( "" ); myY->setText( "" ); myZ->setText( "" ); myRefPoint = myEdge = GEOM::GEOM_Object::_nil(); } - if ( IObjectCount() == 1 ) - { + if ( IObjectCount() == 1 ) { Standard_Boolean aRes = Standard_False; Handle(SALOME_InteractiveObject) anIO = firstIObject(); GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); - if ( !CORBA::is_nil( aSelectedObject ) && aRes ) - { - if ( id == 0 ) - { + if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { + if ( id == 0 ) { // get CORBA reference to data object - TopoDS_Shape aShape = myGeomGUI->GetShapeReader().GetShape - ( myGeomGUI->GetGeomGen(), aSelectedObject ); + TopoDS_Shape aShape = myGeomGUI->GetShapeReader().GetShape( myGeomGUI->GetGeomGen(), aSelectedObject ); if ( aShape.IsNull() ) return; - if ( aShape.ShapeType() != TopAbs_VERTEX ) - { + if ( aShape.ShapeType() != TopAbs_VERTEX ) { TColStd_IndexedMapOfInteger aMap; LightApp_Application* anApp = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); anApp->selectionMgr()->GetIndexes( anIO, aMap ); - - if ( aMap.Extent() == 1 ) - { + + if ( aMap.Extent() == 1 ) { int anIndex = aMap( 1 ); TopTools_IndexedMapOfShape aShapes; TopExp::MapShapes( aShape, aShapes ); aShape = aShapes.FindKey( anIndex ); - + if ( aShape.IsNull() || aShape.ShapeType() != TopAbs_VERTEX ) return; } @@ -382,23 +367,21 @@ void BasicGUI_PointDlg::SelectionIntoArgument() } gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) ); - GroupXYZ->SpinBox_DX->SetValue( aPnt.X() ); - GroupXYZ->SpinBox_DY->SetValue( aPnt.Y() ); - GroupXYZ->SpinBox_DZ->SetValue( aPnt.Z() ); + GroupXYZ->SpinBox_DX->setValue( aPnt.X() ); + GroupXYZ->SpinBox_DY->setValue( aPnt.Y() ); + GroupXYZ->SpinBox_DZ->setValue( aPnt.Z() ); } - else if ( id == 1 ) - { + else if ( id == 1 ) { myRefPoint = aSelectedObject; GroupRefPoint->LineEdit1->setText( GEOMBase::GetName( aSelectedObject ) ); } - else if ( id == 2 ) - { + else if ( id == 2 ) { myEdge = aSelectedObject; GroupOnCurve->LineEdit1->setText( GEOMBase::GetName( aSelectedObject ) ); } } } - + displayPreview(); } @@ -426,15 +409,13 @@ void BasicGUI_PointDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - if ( send == GroupRefPoint->PushButton1 ) - { + if ( send == GroupRefPoint->PushButton1 ) { GroupRefPoint->LineEdit1->setFocus(); myEditCurrentArgument = GroupRefPoint->LineEdit1; globalSelection( GEOM_POINT ); } - else if ( send == GroupOnCurve->PushButton1 ) - { + else if ( send == GroupOnCurve->PushButton1 ) { GroupOnCurve->LineEdit1->setFocus(); myEditCurrentArgument = GroupOnCurve->LineEdit1; @@ -447,9 +428,9 @@ void BasicGUI_PointDlg::SetEditCurrentArgument() // function : enterEvent() // purpose : to reactivate this dialog box when mouse enter onto the window //================================================================================= -void BasicGUI_PointDlg::enterEvent(QEvent* e) +void BasicGUI_PointDlg::enterEvent( QEvent* ) { - if ( !GroupConstructors->isEnabled() ) + if ( !mainFrame()->GroupConstructors->isEnabled() ) ActivateThisDialog(); } @@ -492,7 +473,7 @@ void BasicGUI_PointDlg::ValueChangedInSpinBox(double newValue) //================================================================================= double BasicGUI_PointDlg::getParameter() const { - return GroupOnCurve->SpinBox_DX->GetValue(); + return GroupOnCurve->SpinBox_DX->value(); } //================================================================================= @@ -501,11 +482,10 @@ double BasicGUI_PointDlg::getParameter() const //================================================================================= void BasicGUI_PointDlg::OnPointSelected( const gp_Pnt& thePnt ) { - if ( getConstructorId() == 0 ) - { - GroupXYZ->SpinBox_DX->SetValue( thePnt.X() ); - GroupXYZ->SpinBox_DY->SetValue( thePnt.Y() ); - GroupXYZ->SpinBox_DZ->SetValue( thePnt.Z() ); + if ( getConstructorId() == 0 ) { + GroupXYZ->SpinBox_DX->setValue( thePnt.X() ); + GroupXYZ->SpinBox_DY->setValue( thePnt.Y() ); + GroupXYZ->SpinBox_DZ->setValue( thePnt.Z() ); displayPreview(); } @@ -546,60 +526,54 @@ bool BasicGUI_PointDlg::execute( ObjectList& objects ) GEOM::GEOM_Object_var anObj; - switch ( getConstructorId() ) - { + switch ( getConstructorId() ) { case 0 : - { - double x = GroupXYZ->SpinBox_DX->GetValue(); - double y = GroupXYZ->SpinBox_DY->GetValue(); - double z = GroupXYZ->SpinBox_DZ->GetValue(); + { + double x = GroupXYZ->SpinBox_DX->value(); + double y = GroupXYZ->SpinBox_DY->value(); + double z = GroupXYZ->SpinBox_DZ->value(); - anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakePointXYZ( x,y,z ); - res = true; - break; - } + anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakePointXYZ( x, y, z ); + res = true; + break; + } case 1 : - { - double dx = GroupRefPoint->SpinBox_DX->GetValue(); - double dy = GroupRefPoint->SpinBox_DY->GetValue(); - double dz = GroupRefPoint->SpinBox_DZ->GetValue(); - - anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )-> - MakePointWithReference( myRefPoint, dx, dy, dz ); - res = true; - break; - } + { + double dx = GroupRefPoint->SpinBox_DX->value(); + double dy = GroupRefPoint->SpinBox_DY->value(); + double dz = GroupRefPoint->SpinBox_DZ->value(); + + anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )-> + MakePointWithReference( myRefPoint, dx, dy, dz ); + res = true; + break; + } case 2 : anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )-> MakePointOnCurve( myEdge, getParameter() ); res = true; break; } - - if ( getConstructorId() == 1 || getConstructorId() == 2 ) - { + + if ( getConstructorId() == 1 || getConstructorId() == 2 ) { TopoDS_Shape aShape; - if ( GEOMBase::GetShape( anObj, aShape ) && !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX ) - { + if ( GEOMBase::GetShape( anObj, aShape ) && !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX ) { gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) ); myX->setText( QString( "%1" ).arg( aPnt.X() ) ); myY->setText( QString( "%1" ).arg( aPnt.Y() ) ); myZ->setText( QString( "%1" ).arg( aPnt.Z() ) ); } - else - { + else { myX->setText( "" ); myY->setText( "" ); myZ->setText( "" ); } } - if ( !anObj->_is_nil() ) - { - //printf( "--> a valid point is created\n" ); + if ( !anObj->_is_nil() ) { objects.push_back( anObj._retn() ); } - + return res; } diff --git a/src/BasicGUI/BasicGUI_PointDlg.h b/src/BasicGUI/BasicGUI_PointDlg.h index b6dded380..8e264fa63 100644 --- a/src/BasicGUI/BasicGUI_PointDlg.h +++ b/src/BasicGUI/BasicGUI_PointDlg.h @@ -1,36 +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 : BasicGUI_PointDlg.h +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // -// -// File : BasicGUI_PointDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -#ifndef DIALOGBOX_POINT_H -#define DIALOGBOX_POINT_H +#ifndef BASICGUI_POINTDLG_H +#define BASICGUI_POINTDLG_H #include "GEOM_BasicGUI.hxx" -#include "GEOMBase_Skeleton.h" +#include class DlgRef_1Sel1Spin; class DlgRef_3Spin; @@ -45,55 +43,56 @@ class gp_Pnt; // class : BasicGUI_PointDlg // purpose : //================================================================================= -class GEOM_BASICGUI_EXPORT BasicGUI_PointDlg : public GEOMBase_Skeleton +class BASICGUI_EXPORT BasicGUI_PointDlg : public GEOMBase_Skeleton { - Q_OBJECT + Q_OBJECT public: - BasicGUI_PointDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, - const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0); + BasicGUI_PointDlg( GeometryGUI*, QWidget* = 0, + const char* = 0, bool = false, Qt::WindowFlags = 0 ); - ~BasicGUI_PointDlg(); + ~BasicGUI_PointDlg(); - bool acceptMouseEvent() const { return ( getConstructorId() == 0 ); }; - void OnPointSelected( const gp_Pnt& ); // called by BasicGUI::OnMousePress() + bool acceptMouseEvent() const { return ( getConstructorId() == 0 ); } + void OnPointSelected( const gp_Pnt& ); // called by BasicGUI::OnMousePress() 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 ); - -private : - void Init(); - void enterEvent(QEvent* e); - double getParameter() const; - - GEOM::GEOM_Object_var myEdge; - GEOM::GEOM_Object_var myRefPoint; - - DlgRef_3Spin* GroupXYZ; - DlgRef_1Sel3Spin* GroupRefPoint; - DlgRef_1Sel1Spin* GroupOnCurve; - - QGroupBox* myCoordGrp; - QLineEdit* myX; - QLineEdit* myY; - QLineEdit* myZ; - + // 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* ); + double getParameter() const; + +private: + GEOM::GEOM_Object_var myEdge; + GEOM::GEOM_Object_var myRefPoint; + + DlgRef_3Spin* GroupXYZ; + DlgRef_1Sel3Spin* GroupRefPoint; + DlgRef_1Sel1Spin* GroupOnCurve; + + QGroupBox* myCoordGrp; + QLineEdit* myX; + QLineEdit* myY; + QLineEdit* myZ; + private slots: - void ClickOnOk(); - void ClickOnCancel(); - bool ClickOnApply(); - void ActivateThisDialog(); - void DeactivateActiveDialog(); - void LineEditReturnPressed(); - void SelectionIntoArgument(); - void SetEditCurrentArgument(); - void ConstructorsClicked(int constructorId); - void ValueChangedInSpinBox(double newValue); + void ClickOnOk(); + void ClickOnCancel(); + bool ClickOnApply(); + void ActivateThisDialog(); + void DeactivateActiveDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ConstructorsClicked( int ); + void ValueChangedInSpinBox( double ); }; -#endif // DIALOGBOX_POINT_H +#endif // BASICGUI_POINTDLG_H diff --git a/src/BasicGUI/BasicGUI_VectorDlg.cxx b/src/BasicGUI/BasicGUI_VectorDlg.cxx index b47d71d82..6dd3e2784 100644 --- a/src/BasicGUI/BasicGUI_VectorDlg.cxx +++ b/src/BasicGUI/BasicGUI_VectorDlg.cxx @@ -1,46 +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 : BasicGUI_VectorDlg.cxx +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // -// -// File : BasicGUI_VectorDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ #include "BasicGUI_VectorDlg.h" -#include "DlgRef_3Spin1Check.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 : BasicGUI_VectorDlg() @@ -49,49 +43,48 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -BasicGUI_VectorDlg::BasicGUI_VectorDlg(GeometryGUI* theGeometryGUI, QWidget* parent, - const char* name, bool modal, Qt::WindowFlags fl) - :GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, fl) +BasicGUI_VectorDlg::BasicGUI_VectorDlg( GeometryGUI* theGeometryGUI, QWidget* parent, + const char* name, bool modal, Qt::WindowFlags fl ) + : GEOMBase_Skeleton( theGeometryGUI, parent, name, 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"))); - QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + 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" ) ) ); + QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); - setWindowTitle(tr("GEOM_VECTOR_TITLE")); + setWindowTitle( tr( "GEOM_VECTOR_TITLE" ) ); /***************************************************************/ - GroupConstructors->setTitle(tr("GEOM_VECTOR")); - 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_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); + mainFrame()->GroupConstructors->setTitle(tr("GEOM_VECTOR")); + 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_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 ); GroupPoints->LineEdit1->setReadOnly( true ); GroupPoints->LineEdit2->setReadOnly( true ); - GroupDimensions = new DlgRef_3Spin1Check(this, "GroupDimensions"); - GroupDimensions->GroupBox1->setTitle(tr("GEOM_COORDINATES")); - GroupDimensions->TextLabel1->setText(tr("GEOM_DX")); - GroupDimensions->TextLabel2->setText(tr("GEOM_DY")); - GroupDimensions->TextLabel3->setText(tr("GEOM_DZ")); - GroupDimensions->CheckBox1->setText(tr("GEOM_REVERSE_VECTOR")); - - gridLayout1->addWidget(aGroupPointsWidget, 2, 0); - gridLayout1->addWidget(GroupDimensions, 2, 0); + GroupDimensions = new DlgRef_3Spin1Check( centralWidget() ); + GroupDimensions->GroupBox1->setTitle( tr( "GEOM_COORDINATES" ) ); + GroupDimensions->TextLabel1->setText( tr( "GEOM_DX" ) ); + GroupDimensions->TextLabel2->setText( tr( "GEOM_DY" ) ); + GroupDimensions->TextLabel3->setText( tr( "GEOM_DZ" ) ); + GroupDimensions->CheckButton1->setText( tr( "GEOM_REVERSE_VECTOR" ) ); + + QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); + layout->setMargin( 0 ); layout->setSpacing( 6 ); + layout->addWidget( GroupPoints ); + layout->addWidget( GroupDimensions ); /***************************************************************/ - setHelpFileName("vector.htm"); + setHelpFileName( "vector.htm" ); /* Initialisations */ Init(); @@ -121,51 +114,53 @@ void BasicGUI_VectorDlg::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 dx( 0. ), dy( 0. ), dz( 200. ); - GroupDimensions->SpinBox_DX->SetValue( dx ); - GroupDimensions->SpinBox_DY->SetValue( dy ); - GroupDimensions->SpinBox_DZ->SetValue( dz ); + GroupDimensions->SpinBox_DX->setValue( dx ); + GroupDimensions->SpinBox_DY->setValue( dy ); + GroupDimensions->SpinBox_DZ->setValue( dz ); - GroupDimensions->CheckBox1->setChecked(FALSE); + GroupDimensions->CheckButton1->setChecked( false ); /* signals and slots connections */ - connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); - connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); - connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ); + connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ); - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); - connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); + connect( buttonCancel(), SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ); + 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(GroupDimensions->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(GroupDimensions->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(GroupDimensions->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - 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( GroupDimensions->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( GroupDimensions->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( GroupDimensions->SpinBox_DZ, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); - connect(GroupDimensions->CheckBox1, SIGNAL(stateChanged(int)), this, SLOT(ReverseVector(int))); + // 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( GroupDimensions->CheckButton1, SIGNAL( stateChanged( int ) ), this, SLOT( ReverseVector( int ) ) ); - initName( tr("GEOM_VECTOR").toLatin1().constData() ); + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT(SelectionIntoArgument() ) ); + + initName( tr("GEOM_VECTOR") ); - GroupDimensions->hide(); ConstructorsClicked( 0 ); } @@ -176,42 +171,43 @@ void BasicGUI_VectorDlg::Init() //================================================================================= void BasicGUI_VectorDlg::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 ); myPoint1 = GEOM::GEOM_Object::_nil(); myPoint2 = GEOM::GEOM_Object::_nil(); - switch (constructorId) + switch ( constructorId ) { + case 0: { - case 0: - { - GroupDimensions->hide(); - resize(0, 0); - ::qobject_cast( GroupPoints->gridLayout->parent() )->show(); - - myEditCurrentArgument = GroupPoints->LineEdit1; - GroupPoints->LineEdit1->setText(""); - GroupPoints->LineEdit2->setText(""); - - globalSelection( GEOM_POINT ); - 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(); - - double dx( 0. ), dy( 0. ), dz( 0. ); - GroupDimensions->SpinBox_DX->SetValue( dx ); - GroupDimensions->SpinBox_DY->SetValue( dy ); - GroupDimensions->SpinBox_DZ->SetValue( dz ); - - GroupDimensions->CheckBox1->setChecked( FALSE ); - break; - } + GroupDimensions->hide(); + GroupPoints->show(); + + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->setText( "" ); + GroupPoints->LineEdit2->setText( "" ); + + globalSelection( GEOM_POINT ); + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT(SelectionIntoArgument() ) ); + break; + } + case 1: + { + GroupPoints->hide(); + GroupDimensions->show(); + + double dx( 0. ), dy( 0. ), dz( 0. ); + GroupDimensions->SpinBox_DX->setValue( dx ); + GroupDimensions->SpinBox_DY->setValue( dy ); + GroupDimensions->SpinBox_DZ->setValue( dz ); + + GroupDimensions->CheckButton1->setChecked( false ); + break; } + } + + qApp->processEvents(); + updateGeometry(); + resize( minimumSize() ); displayPreview(); } @@ -242,7 +238,7 @@ void BasicGUI_VectorDlg::ClickOnCancel() //================================================================================= bool BasicGUI_VectorDlg::ClickOnApply() { - buttonApply->setFocus(); + buttonApply()->setFocus(); if ( !onAccept() ) return false; @@ -260,10 +256,9 @@ bool BasicGUI_VectorDlg::ClickOnApply() //================================================================================= void BasicGUI_VectorDlg::SelectionIntoArgument() { - myEditCurrentArgument->setText(""); + myEditCurrentArgument->setText( "" ); - if ( IObjectCount() != 1 ) - { + if ( IObjectCount() != 1 ) { if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint1 = GEOM::GEOM_Object::_nil(); else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) @@ -274,8 +269,7 @@ void BasicGUI_VectorDlg::SelectionIntoArgument() // nbSel == 1 Standard_Boolean aRes = Standard_False; GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes ); - if ( !CORBA::is_nil( aSelectedObject ) && aRes ) - { + if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint1 = aSelectedObject; else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myPoint2 = aSelectedObject; @@ -320,8 +314,8 @@ void BasicGUI_VectorDlg::LineEditReturnPressed() void BasicGUI_VectorDlg::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() ); } @@ -340,9 +334,9 @@ void BasicGUI_VectorDlg::DeactivateActiveDialog() // function : enterEvent() // purpose : //================================================================================= -void BasicGUI_VectorDlg::enterEvent(QEvent* e) +void BasicGUI_VectorDlg::enterEvent( QEvent* ) { - if ( !GroupConstructors->isEnabled() ) + if ( !mainFrame()->GroupConstructors->isEnabled() ) ActivateThisDialog(); } @@ -359,15 +353,15 @@ void BasicGUI_VectorDlg::ValueChangedInSpinBox( double newValue ) // function : ReverseVector() // purpose : 'state' not used here //================================================================================= -void BasicGUI_VectorDlg::ReverseVector(int state) +void BasicGUI_VectorDlg::ReverseVector( int state ) { - double dx = -GroupDimensions->SpinBox_DX->GetValue(); - double dy = -GroupDimensions->SpinBox_DY->GetValue(); - double dz = -GroupDimensions->SpinBox_DZ->GetValue(); + double dx = -GroupDimensions->SpinBox_DX->value(); + double dy = -GroupDimensions->SpinBox_DY->value(); + double dz = -GroupDimensions->SpinBox_DZ->value(); - GroupDimensions->SpinBox_DX->SetValue( dx ); - GroupDimensions->SpinBox_DY->SetValue( dy ); - GroupDimensions->SpinBox_DZ->SetValue( dz ); + GroupDimensions->SpinBox_DX->setValue( dx ); + GroupDimensions->SpinBox_DY->setValue( dy ); + GroupDimensions->SpinBox_DZ->setValue( dz ); displayPreview(); } @@ -387,7 +381,7 @@ GEOM::GEOM_IOperations_ptr BasicGUI_VectorDlg::createOperation() //================================================================================= bool BasicGUI_VectorDlg::isValid( QString& msg ) { - return getConstructorId() == 0 ? !myPoint1->_is_nil() && !myPoint2->_is_nil(): true; + return getConstructorId() == 0 ? !myPoint1->_is_nil() && !myPoint2->_is_nil() : true; } //================================================================================= @@ -402,16 +396,17 @@ bool BasicGUI_VectorDlg::execute( ObjectList& objects ) switch ( getConstructorId() ) { case 0 : - anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakeVectorTwoPnt( myPoint1, myPoint2 ); - res = true; - break; - + { + anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakeVectorTwoPnt( myPoint1, myPoint2 ); + res = true; + break; + } case 1 : { - double dx = GroupDimensions->SpinBox_DX->GetValue(); - double dy = GroupDimensions->SpinBox_DY->GetValue(); - double dz = GroupDimensions->SpinBox_DZ->GetValue(); - anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakeVectorDXDYDZ( dx,dy,dz ); + double dx = GroupDimensions->SpinBox_DX->value(); + double dy = GroupDimensions->SpinBox_DY->value(); + double dz = GroupDimensions->SpinBox_DZ->value(); + anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakeVectorDXDYDZ( dx, dy, dz ); res = true; break; } diff --git a/src/BasicGUI/BasicGUI_VectorDlg.h b/src/BasicGUI/BasicGUI_VectorDlg.h index fd444db37..8a941e832 100644 --- a/src/BasicGUI/BasicGUI_VectorDlg.h +++ b/src/BasicGUI/BasicGUI_VectorDlg.h @@ -1,84 +1,81 @@ -// 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 : BasicGUI_VectorDlg.h +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // -// -// File : BasicGUI_VectorDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -#ifndef DIALOGBOX_VECTOR_H -#define DIALOGBOX_VECTOR_H +#ifndef BASICGUI_VECTORDLG_H +#define BASICGUI_VECTORDLG_H #include "GEOM_BasicGUI.hxx" -#include "GEOMBase_Skeleton.h" -#include "DlgRef_2Sel_QTD.h" +#include +class DlgRef_2Sel; class DlgRef_3Spin1Check; //================================================================================= // class : BasicGUI_VectorDlg // purpose : //================================================================================= -class GEOM_BASICGUI_EXPORT BasicGUI_VectorDlg : public GEOMBase_Skeleton +class BASICGUI_EXPORT BasicGUI_VectorDlg : public GEOMBase_Skeleton { - Q_OBJECT + Q_OBJECT public: - BasicGUI_VectorDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, - const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0); - ~BasicGUI_VectorDlg(); - + BasicGUI_VectorDlg( GeometryGUI*, QWidget* = 0, + const char* = 0, bool = false, Qt::WindowFlags = 0 ); + ~BasicGUI_VectorDlg(); + protected: - // redefined from GEOMBase_Helper - virtual GEOM::GEOM_IOperations_ptr createOperation(); - virtual bool isValid( QString& ); - virtual bool execute( ObjectList& objects ); - -private : - void Init(); - void enterEvent(QEvent* e); + // redefined from GEOMBase_Helper + virtual GEOM::GEOM_IOperations_ptr createOperation(); + virtual bool isValid( QString& ); + virtual bool execute( ObjectList& ); - GEOM::GEOM_Object_var myPoint1; - GEOM::GEOM_Object_var myPoint2; +private: + void Init(); + void enterEvent( QEvent* ); - Ui::DlgRef_2Sel_QTD* GroupPoints; - DlgRef_3Spin1Check* GroupDimensions; + GEOM::GEOM_Object_var myPoint1; + GEOM::GEOM_Object_var myPoint2; + DlgRef_2Sel* GroupPoints; + DlgRef_3Spin1Check* GroupDimensions; + private slots: - void ClickOnOk(); - void ClickOnCancel(); - bool ClickOnApply(); + void ClickOnOk(); + void ClickOnCancel(); + bool ClickOnApply(); - void ActivateThisDialog(); - void DeactivateActiveDialog(); + void ActivateThisDialog(); + void DeactivateActiveDialog(); - void LineEditReturnPressed(); - void SelectionIntoArgument(); - void SetEditCurrentArgument(); - void ConstructorsClicked(int constructorId); - void ValueChangedInSpinBox(double newValue); - void ReverseVector(int state); - + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ConstructorsClicked( int ); + void ValueChangedInSpinBox( double ); + void ReverseVector( int ); }; -#endif // DIALOGBOX_VECTOR_H +#endif // BASICGUI_VECTORDLG_H diff --git a/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx b/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx index b0e866449..c7b8e4e30 100644 --- a/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx +++ b/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx @@ -1,39 +1,38 @@ -// 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 : BasicGUI_WorkingPlaneDlg.cxx +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // -// -// File : BasicGUI_WorkingPlaneDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM #include "BasicGUI_WorkingPlaneDlg.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 // OCCT Includes #include @@ -47,9 +46,7 @@ // QT Includes #include -#include "GEOMImpl_Types.hxx" - -using namespace std; +#include //================================================================================= // class : BasicGUI_WorkingPlaneDlg() @@ -58,74 +55,65 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -BasicGUI_WorkingPlaneDlg::BasicGUI_WorkingPlaneDlg(GeometryGUI* theGeometryGUI, QWidget* parent, - const char* name, bool modal, Qt::WindowFlags fl) - :GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) +BasicGUI_WorkingPlaneDlg::BasicGUI_WorkingPlaneDlg( GeometryGUI* theGeometryGUI, QWidget* parent, + const char* name, bool modal, Qt::WindowFlags fl ) + : GEOMBase_Skeleton( theGeometryGUI, parent, name, 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"))); - QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_WPLANE_VECTOR"))); - QPixmap image3(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_WPLANE_ORIGIN"))); + QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); + QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_WPLANE_FACE" ) ) ); + QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_WPLANE_VECTOR" ) ) ); + QPixmap image3( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_WPLANE_ORIGIN" ) ) ); - setWindowTitle(tr("GEOM_WPLANE_TITLE")); + setWindowTitle( tr( "GEOM_WPLANE_TITLE" ) ); /***************************************************************/ - GroupConstructors->setTitle(tr("GEOM_WPLANE")); - RadioButton1->setIcon(image1); - RadioButton2->setIcon(image2); - RadioButton3->setIcon(image3); - - Group1 = new Ui::DlgRef_1Sel_QTD(); - QWidget* aGroup1Widget = new QWidget(this); - Group1->setupUi(aGroup1Widget); - aGroup1Widget->setObjectName("Group1"); - - Group1->GroupBox1->setTitle(tr("GEOM_WPLANE_FACE")); - Group1->TextLabel1->setText(tr("GEOM_SELECTION")); - Group1->PushButton1->setIcon(image0); + mainFrame()->GroupConstructors->setTitle( tr( "GEOM_WPLANE" ) ); + mainFrame()->RadioButton1->setIcon( image1 ); + mainFrame()->RadioButton2->setIcon( image2 ); + mainFrame()->RadioButton3->setIcon( image3 ); + + Group1 = new DlgRef_1Sel( centralWidget() ); + + Group1->GroupBox1->setTitle( tr( "GEOM_WPLANE_FACE" ) ); + Group1->TextLabel1->setText( tr( "GEOM_SELECTION" ) ); + Group1->PushButton1->setIcon( image0 ); Group1->LineEdit1->setReadOnly( true ); - Group2 = new Ui::DlgRef_2Sel_QTD(); - QWidget* aGroup2Widget = new QWidget(this); - Group2->setupUi(aGroup2Widget); - aGroup2Widget->setObjectName("Group2"); + Group2 = new DlgRef_2Sel( centralWidget() ); - Group2->GroupBox1->setTitle(tr("GEOM_WPLANE_VECTOR")); - Group2->TextLabel1->setText(tr("GEOM_WPLANE_VX")); - Group2->TextLabel2->setText(tr("GEOM_WPLANE_VZ")); - Group2->PushButton1->setIcon(image0); - Group2->PushButton2->setIcon(image0); + Group2->GroupBox1->setTitle( tr( "GEOM_WPLANE_VECTOR" ) ); + Group2->TextLabel1->setText( tr( "GEOM_WPLANE_VX" ) ); + Group2->TextLabel2->setText( tr( "GEOM_WPLANE_VZ" ) ); + Group2->PushButton1->setIcon( image0 ); + Group2->PushButton2->setIcon( image0 ); Group2->LineEdit1->setReadOnly( true ); Group2->LineEdit2->setReadOnly( true ); - Group3 = new Ui::DlgRef_3Check_QTD(); - QWidget* aGroup3Widget = new QWidget(this); - Group3->setupUi(aGroup3Widget); - aGroup3Widget->setObjectName("Group3"); + Group3 = new DlgRef_3Check( centralWidget() ); - Group3->GroupBox1->setTitle(tr("GEOM_WPLANE_ORIGIN")); - Group3->RadioButton1->setText(tr("GEOM_WPLANE_OXY")); - Group3->RadioButton2->setText(tr("GEOM_WPLANE_OYZ")); - Group3->RadioButton3->setText(tr("GEOM_WPLANE_OZX")); + Group3->GroupBox1->setTitle( tr( "GEOM_WPLANE_ORIGIN" ) ); + Group3->RadioButton1->setText( tr( "GEOM_WPLANE_OXY" ) ); + Group3->RadioButton2->setText( tr( "GEOM_WPLANE_OYZ" ) ); + Group3->RadioButton3->setText( tr( "GEOM_WPLANE_OZX" ) ); - gridLayout1->addWidget(aGroup1Widget, 1, 0); - gridLayout1->addWidget(aGroup2Widget, 1, 0); - gridLayout1->addWidget(aGroup3Widget, 1, 0); /***************************************************************/ - QFrame* aReverseGroupBox = new QFrame(this); - aReverseGroupBox->setObjectName("aReverseGroupBox"); - aReverseGroupBox->setContentsMargins(10, 10, 10, 10); + QGroupBox* aReverseGroupBox = new QGroupBox( centralWidget() ); QHBoxLayout* aReverseGroupBoxLayout = new QHBoxLayout( aReverseGroupBox ); + aReverseGroupBoxLayout->setMargin( 9 ); + aReverseGroupBoxLayout->setSpacing( 6 ); - myReverseCB = new QCheckBox(aReverseGroupBox); - myReverseCB->setObjectName("myReverseCB"); - myReverseCB->setText(tr("GEOM_REVERSE_PLANE")); - aReverseGroupBoxLayout->addWidget(myReverseCB); + myReverseCB = new QCheckBox( aReverseGroupBox ); + myReverseCB->setText( tr( "GEOM_REVERSE_PLANE" ) ); + aReverseGroupBoxLayout->addWidget( myReverseCB ); - gridLayout1->addWidget(aReverseGroupBox, 2, 0); + QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); + layout->setMargin( 0 ); layout->setSpacing( 6 ); + layout->addWidget( Group1 ); + layout->addWidget( Group2 ); + layout->addWidget( Group3 ); + layout->addWidget( aReverseGroupBox ); - - setHelpFileName("working_plane.htm"); + setHelpFileName( "working_plane.htm" ); Init(); } @@ -150,7 +138,7 @@ void BasicGUI_WorkingPlaneDlg::Init() // myGeomGUI->SetState( 0 ); - myFace = GEOM::GEOM_Object::_nil(); + myFace = GEOM::GEOM_Object::_nil(); myVectX = GEOM::GEOM_Object::_nil(); myVectZ = GEOM::GEOM_Object::_nil(); @@ -160,96 +148,97 @@ void BasicGUI_WorkingPlaneDlg::Init() globalSelection( GEOM_PLANE ); /* signals and slots connections */ - connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); - connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); - connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); - connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); + connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ); + connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ); + + connect( buttonCancel(), SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ); + 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( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) ); - connect(Group1->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(Group1->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect( Group1->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( Group1->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( Group2->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( Group2->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( Group2->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( Group2->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect(Group2->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(Group2->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(Group2->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(Group2->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect( Group3->GroupBox1, SIGNAL( clicked( int ) ), this, SLOT( GroupClicked( int ) ) ); - connect(Group3->GroupBox1, SIGNAL(clicked(int)), this, SLOT(GroupClicked(int))); + connect( myReverseCB, SIGNAL( clicked() ), this, SLOT( onReverse() ) ); - connect(myReverseCB, SIGNAL(clicked()), this, SLOT(onReverse())); + 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_WPLANE" ) ); - initName( tr( "GEOM_WPLANE" ).toLatin1().constData() ); - ConstructorsClicked(0); + ConstructorsClicked( 0 ); } //================================================================================= // function : ConstructorsClicked() // purpose : Radio button management //================================================================================= -void BasicGUI_WorkingPlaneDlg::ConstructorsClicked(int constructorId) +void BasicGUI_WorkingPlaneDlg::ConstructorsClicked( int constructorId ) { LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); - disconnect(aSelMgr, 0, this, 0); + disconnect( aSelMgr, 0, this, 0 ); - switch (constructorId) + switch ( constructorId ) { + case 0: { - case 0: - { - //globalSelection( GEOM_PLANE ); - TColStd_MapOfInteger aMap; - aMap.Add( GEOM_PLANE ); - aMap.Add( GEOM_MARKER ); - globalSelection( aMap ); - - ::qobject_cast( Group2->gridLayout->parent() )->hide(); - ::qobject_cast( Group3->gridLayout->parent() )->hide(); - resize(0, 0); - ::qobject_cast( Group1->gridLayout->parent() )->show(); - - myEditCurrentArgument = Group1->LineEdit1; - Group1->LineEdit1->setText(""); - myFace = GEOM::GEOM_Object::_nil(); - - connect(aSelMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); - break; - } - case 1: - { - globalSelection( GEOM_LINE ); - - ::qobject_cast( Group1->gridLayout->parent() )->hide(); - ::qobject_cast( Group3->gridLayout->parent() )->hide(); - resize(0, 0); - ::qobject_cast( Group2->gridLayout->parent() )->show(); - - myEditCurrentArgument = Group2->LineEdit1; - Group2->LineEdit1->setText(""); - Group2->LineEdit2->setText(""); - myVectX = GEOM::GEOM_Object::_nil(); - myVectZ = GEOM::GEOM_Object::_nil(); - - connect(aSelMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); - break; - } - case 2: - { - ::qobject_cast( Group1->gridLayout->parent() )->hide(); - ::qobject_cast( Group2->gridLayout->parent() )->hide(); - resize(0, 0); - ::qobject_cast( Group3->gridLayout->parent() )->show(); - - Group3->RadioButton1->setChecked(true); - aOriginType = 1; - break; - } + //globalSelection( GEOM_PLANE ); + TColStd_MapOfInteger aMap; + aMap.Add( GEOM_PLANE ); + aMap.Add( GEOM_MARKER ); + globalSelection( aMap ); + + Group2->hide(); + Group3->hide(); + Group1->show(); + + myEditCurrentArgument = Group1->LineEdit1; + Group1->LineEdit1->setText( "" ); + myFace = GEOM::GEOM_Object::_nil(); + + connect( aSelMgr, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + break; + } + case 1: + { + globalSelection( GEOM_LINE ); + + Group1->hide(); + Group3->hide(); + Group2->show(); + + myEditCurrentArgument = Group2->LineEdit1; + Group2->LineEdit1->setText( "" ); + Group2->LineEdit2->setText( "" ); + myVectX = GEOM::GEOM_Object::_nil(); + myVectZ = GEOM::GEOM_Object::_nil(); + + connect( aSelMgr, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + break; + } + case 2: + { + Group1->hide(); + Group2->hide(); + Group3->show(); + + Group3->RadioButton1->setChecked( true ); + aOriginType = 1; + break; } + } + qApp->processEvents(); + updateGeometry(); + resize( minimumSize() ); + updateWPlane(); } @@ -257,7 +246,7 @@ void BasicGUI_WorkingPlaneDlg::ConstructorsClicked(int constructorId) // function : GroupClicked() // purpose : Radio button management //================================================================================= -void BasicGUI_WorkingPlaneDlg::GroupClicked(int groupId) +void BasicGUI_WorkingPlaneDlg::GroupClicked( int groupId ) { aOriginType = groupId; updateWPlane(); @@ -279,11 +268,11 @@ void BasicGUI_WorkingPlaneDlg::ClickOnOk() //================================================================================= bool BasicGUI_WorkingPlaneDlg::ClickOnApply() { - buttonApply->setFocus(); - myGeomGUI->application()->putInfo(tr("")); + buttonApply()->setFocus(); + myGeomGUI->application()->putInfo( "" ); - if (updateWPlane(false)){ - myGeomGUI->SetWorkingPlane(myWPlane); + if ( updateWPlane( false ) ) { + myGeomGUI->SetWorkingPlane( myWPlane ); myGeomGUI->ActiveWorkingPlane(); } @@ -296,16 +285,16 @@ bool BasicGUI_WorkingPlaneDlg::ClickOnApply() //================================================================================= void BasicGUI_WorkingPlaneDlg::SelectionIntoArgument() { - myEditCurrentArgument->setText(""); + myEditCurrentArgument->setText( "" ); const int id = getConstructorId(); if ( IObjectCount() != 1 ) { - if(id == 0) + if ( id == 0 ) myFace = GEOM::GEOM_Object::_nil(); - else if(id == 1) { - if (myEditCurrentArgument == Group2->LineEdit1) + else if ( id == 1 ) { + if ( myEditCurrentArgument == Group2->LineEdit1 ) myVectX = GEOM::GEOM_Object::_nil(); - else if (myEditCurrentArgument == Group2->LineEdit2) + else if ( myEditCurrentArgument == Group2->LineEdit2 ) myVectZ = GEOM::GEOM_Object::_nil(); } return; @@ -313,16 +302,16 @@ void BasicGUI_WorkingPlaneDlg::SelectionIntoArgument() // nbSel == 1 Standard_Boolean aRes = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), aRes); + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes ); - if(!aRes || CORBA::is_nil( aSelectedObject )) + if ( !aRes || CORBA::is_nil( aSelectedObject ) ) return; - if(myEditCurrentArgument == Group1->LineEdit1) + if ( myEditCurrentArgument == Group1->LineEdit1 ) myFace = aSelectedObject; - else if(myEditCurrentArgument == Group2->LineEdit1) + else if ( myEditCurrentArgument == Group2->LineEdit1 ) myVectX = aSelectedObject; - else if(myEditCurrentArgument == Group2->LineEdit2) + else if ( myEditCurrentArgument == Group2->LineEdit2 ) myVectZ = aSelectedObject; myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); @@ -339,15 +328,15 @@ void BasicGUI_WorkingPlaneDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - if(send == Group1->PushButton1) { + if ( send == Group1->PushButton1 ) { myEditCurrentArgument = Group1->LineEdit1; globalSelection( GEOM_PLANE ); } - else if(send == Group2->PushButton1) { + else if ( send == Group2->PushButton1 ) { myEditCurrentArgument = Group2->LineEdit1; globalSelection( GEOM_LINE ); } - else if(send == Group2->PushButton2) { + else if ( send == Group2->PushButton2 ) { myEditCurrentArgument = Group2->LineEdit2; globalSelection( GEOM_LINE ); } @@ -364,7 +353,7 @@ void BasicGUI_WorkingPlaneDlg::SetEditCurrentArgument() void BasicGUI_WorkingPlaneDlg::LineEditReturnPressed() { QLineEdit* send = (QLineEdit*)sender(); - if(send == Group1->LineEdit1 || send == Group2->LineEdit1 || send == Group2->LineEdit2) { + if ( send == Group1->LineEdit1 || send == Group2->LineEdit1 || send == Group2->LineEdit2 ) { myEditCurrentArgument = send; GEOMBase_Skeleton::LineEditReturnPressed(); } @@ -388,8 +377,8 @@ void BasicGUI_WorkingPlaneDlg::onReverse() void BasicGUI_WorkingPlaneDlg::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() ); } @@ -418,9 +407,9 @@ void BasicGUI_WorkingPlaneDlg::ClickOnCancel() // function : enterEvent() // purpose : //================================================================================= -void BasicGUI_WorkingPlaneDlg::enterEvent(QEvent* e) +void BasicGUI_WorkingPlaneDlg::enterEvent( QEvent* ) { - if ( !GroupConstructors->isEnabled() ) + if ( !mainFrame()->GroupConstructors->isEnabled() ) ActivateThisDialog(); } @@ -444,118 +433,119 @@ bool BasicGUI_WorkingPlaneDlg::updateWPlane( const bool showPreview ) const int id = getConstructorId(); - if (id == 0) { // by planar face selection - if (CORBA::is_nil(myFace)) { - if(!showPreview) + if ( id == 0 ) { // by planar face selection + if ( CORBA::is_nil( myFace ) ) { + if ( !showPreview ) showError( "Face has to be selected" ); return false; } // PAL12781: set center of WPL to face's center of mass // like it is done for LCS creation - CORBA::Double Ox,Oy,Oz, Zx,Zy,Zz, Xx,Xy,Xz; + CORBA::Double Ox, Oy, Oz, Zx, Zy, Zz, Xx, Xy, Xz; Ox = Oy = Oz = Zx = Zy = Xy = Xz = 0.; Zz = Xx = 1.; GEOM::GEOM_IMeasureOperations_ptr aMeasureOp = - myGeomGUI->GetGeomGen()->GetIMeasureOperations(getStudyId()); - aMeasureOp->GetPosition(myFace, Ox,Oy,Oz, Zx,Zy,Zz, Xx,Xy,Xz); - - if (aMeasureOp->IsDone()) { - gp_Pnt aPnt (Ox,Oy,Oz); - gp_Dir aDirN (Zx,Zy,Zz); - gp_Dir aDirX (Xx,Xy,Xz); - myWPlane = gp_Ax3(aPnt, aDirN, aDirX); - } else { - if(!showPreview) + myGeomGUI->GetGeomGen()->GetIMeasureOperations( getStudyId() ); + aMeasureOp->GetPosition( myFace, Ox, Oy, Oz, Zx, Zy, Zz, Xx, Xy, Xz); + + if ( aMeasureOp->IsDone() ) { + gp_Pnt aPnt ( Ox, Oy, Oz ); + gp_Dir aDirN ( Zx, Zy, Zz ); + gp_Dir aDirX ( Xx, Xy, Xz ); + myWPlane = gp_Ax3( aPnt, aDirN, aDirX ); + } + else { + if ( !showPreview ) showError( "Wrong shape selected (has to be a planar face)" ); return false; } - - } else if (id == 1) { // by two vectors (Ox & Oz) + } + else if ( id == 1 ) { // by two vectors (Ox & Oz) if ( CORBA::is_nil( myVectX ) || CORBA::is_nil( myVectZ ) ) { - if(!showPreview) + if ( !showPreview ) showError( "Two vectors have to be selected" ); return false; } - + TopoDS_Edge aVectX, aVectZ; TopoDS_Vertex VX1, VX2, VZ1, VZ2; gp_Vec aVX, aVZ; - if (!GEOMBase::GetShape( myVectX, aVectX, TopAbs_EDGE ) || - !GEOMBase::GetShape( myVectZ, aVectZ, TopAbs_EDGE )) { - if(!showPreview) + if ( !GEOMBase::GetShape( myVectX, aVectX, TopAbs_EDGE ) || + !GEOMBase::GetShape( myVectZ, aVectZ, TopAbs_EDGE ) ) { + if ( !showPreview ) showError( "Wrong shape selected (two vectors(edges) have to be selected)" ); return false; } - TopExp::Vertices(aVectX, VX1, VX2, Standard_True); - TopExp::Vertices(aVectZ, VZ1, VZ2, Standard_True); + TopExp::Vertices( aVectX, VX1, VX2, Standard_True ); + TopExp::Vertices( aVectZ, VZ1, VZ2, Standard_True ); - if (VX1.IsNull() || VX2.IsNull()) { - if(!showPreview) + if ( VX1.IsNull() || VX2.IsNull() ) { + if ( !showPreview ) showError( "Bad OX vector" ); return false; } - if (VZ1.IsNull() || VZ2.IsNull()) { - if(!showPreview) + if ( VZ1.IsNull() || VZ2.IsNull() ) { + if ( !showPreview ) showError( "Bad OZ vector" ); return false; } - aVX = gp_Vec(BRep_Tool::Pnt(VX1), BRep_Tool::Pnt(VX2)); - aVZ = gp_Vec(BRep_Tool::Pnt(VZ1), BRep_Tool::Pnt(VZ2)); + aVX = gp_Vec( BRep_Tool::Pnt( VX1 ), BRep_Tool::Pnt( VX2 ) ); + aVZ = gp_Vec( BRep_Tool::Pnt( VZ1 ), BRep_Tool::Pnt( VZ2 ) ); - if (aVX.Magnitude() < Precision::Confusion()) { - if(!showPreview) + if ( aVX.Magnitude() < Precision::Confusion() ) { + if ( !showPreview ) showError( "Bad OX vector" ); return false; } - if (aVZ.Magnitude() < Precision::Confusion()) { - if(!showPreview) + if ( aVZ.Magnitude() < Precision::Confusion() ) { + if ( !showPreview ) showError( "Bad OZ vector" ); return false; } - gp_Dir aDirX = gp_Dir(aVX.X(), aVX.Y(), aVX.Z()); - gp_Dir aDirZ = gp_Dir(aVZ.X(), aVZ.Y(), aVZ.Z()); + gp_Dir aDirX = gp_Dir( aVX.X(), aVX.Y(), aVX.Z() ); + gp_Dir aDirZ = gp_Dir( aVZ.X(), aVZ.Y(), aVZ.Z() ); - if (aDirX.IsParallel(aDirZ, Precision::Angular())) { - if(!showPreview) + if ( aDirX.IsParallel( aDirZ, Precision::Angular() ) ) { + if ( !showPreview ) showError( "Parallel vectors selected" ); return false; } - myWPlane = gp_Ax3(BRep_Tool::Pnt(VX1), aDirZ, aDirX); + myWPlane = gp_Ax3( BRep_Tool::Pnt( VX1 ), aDirZ, aDirX ); - } else if (id == 2) { // by selection from standard (OXY or OYZ, or OZX) + } + else if ( id == 2 ) { // by selection from standard (OXY or OYZ, or OZX) gp_Ax2 anAx2; - if (aOriginType == 1) anAx2 = gp::XOY(); - else if (aOriginType == 2) anAx2 = gp::YOZ(); - else if (aOriginType == 0) anAx2 = gp::ZOX(); + if ( aOriginType == 1 ) anAx2 = gp::XOY(); + else if ( aOriginType == 2 ) anAx2 = gp::YOZ(); + else if ( aOriginType == 0 ) anAx2 = gp::ZOX(); - myWPlane = gp_Ax3(anAx2); + myWPlane = gp_Ax3( anAx2 ); - } else { + } + else { return false; } - if (myReverseCB->isChecked()) - { - myWPlane.YReverse(); - myWPlane.ZReverse(); - } + if ( myReverseCB->isChecked() ) { + myWPlane.YReverse(); + myWPlane.ZReverse(); + } + + if ( showPreview ) { + GEOM::GEOM_IBasicOperations_var aBasicOp = getGeomEngine()->GetIBasicOperations( getStudyId() ); + GEOM::GEOM_Object_var anObj = aBasicOp->MakeMarker( myWPlane.Location().X(), myWPlane.Location().Y(), myWPlane.Location().Z(), + myWPlane.XDirection().X(), myWPlane.XDirection().Y(), myWPlane.XDirection().Z(), + myWPlane.YDirection().X(), myWPlane.YDirection().Y(), myWPlane.YDirection().Z() ); + displayPreview( anObj ); + } - if (showPreview) - { - GEOM::GEOM_IBasicOperations_var aBasicOp = getGeomEngine()->GetIBasicOperations( getStudyId() ); - GEOM::GEOM_Object_var anObj = aBasicOp->MakeMarker( myWPlane.Location().X(), myWPlane.Location().Y(), myWPlane.Location().Z(), - myWPlane.XDirection().X(), myWPlane.XDirection().Y(), myWPlane.XDirection().Z(), - myWPlane.YDirection().X(), myWPlane.YDirection().Y(), myWPlane.YDirection().Z() ); - displayPreview(anObj); - } - return true; } diff --git a/src/BasicGUI/BasicGUI_WorkingPlaneDlg.h b/src/BasicGUI/BasicGUI_WorkingPlaneDlg.h index da6d6ad03..823dfa7c8 100644 --- a/src/BasicGUI/BasicGUI_WorkingPlaneDlg.h +++ b/src/BasicGUI/BasicGUI_WorkingPlaneDlg.h @@ -1,93 +1,92 @@ -// 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 : BasicGUI_WorkingPlaneDlg.h +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // -// -// File : BasicGUI_WorkingPlaneDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -#ifndef DIALOGBOX_WORKINGPLANE_H -#define DIALOGBOX_WORKINGPLANE_H +#ifndef BASICGUI_WORKINGPLANEDLG_H +#define BASICGUI_WORKINGPLANEDLG_H #include "GEOM_BasicGUI.hxx" -#include "GEOMBase_Skeleton.h" -#include "DlgRef_1Sel_QTD.h" -#include "DlgRef_2Sel_QTD.h" -#include "DlgRef_3Check_QTD.h" +#include #include +class DlgRef_1Sel; +class DlgRef_2Sel; +class DlgRef_3Check; class QCheckBox; //================================================================================= // class : BasicGUI_WorkingPlaneDlg // purpose : //================================================================================= -class GEOM_BASICGUI_EXPORT BasicGUI_WorkingPlaneDlg : public GEOMBase_Skeleton +class BASICGUI_EXPORT BasicGUI_WorkingPlaneDlg : public GEOMBase_Skeleton { - Q_OBJECT + Q_OBJECT public: - BasicGUI_WorkingPlaneDlg( GeometryGUI* theGeometryGUI, QWidget* parent = 0, - const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0 ); - ~BasicGUI_WorkingPlaneDlg(); - virtual void closeEvent( QCloseEvent* e ); - -private: - void Init(); - void enterEvent(QEvent* e); - - bool updateWPlane(const bool showPreview = true); - - GEOM::GEOM_Object_var myFace; - GEOM::GEOM_Object_var myVectX; - GEOM::GEOM_Object_var myVectZ; - - int aOriginType; + BasicGUI_WorkingPlaneDlg( GeometryGUI*, QWidget* = 0, + const char* = 0, bool = false, Qt::WindowFlags = 0 ); + ~BasicGUI_WorkingPlaneDlg(); - Ui::DlgRef_1Sel_QTD* Group1; - Ui::DlgRef_2Sel_QTD* Group2; - Ui::DlgRef_3Check_QTD* Group3; - - QCheckBox* myReverseCB; - - gp_Ax3 myWPlane; +protected: + virtual void closeEvent( QCloseEvent* ); +private: + void Init(); + void enterEvent( QEvent* ); + + bool updateWPlane( const bool = true ); + + GEOM::GEOM_Object_var myFace; + GEOM::GEOM_Object_var myVectX; + GEOM::GEOM_Object_var myVectZ; + + int aOriginType; + + DlgRef_1Sel* Group1; + DlgRef_2Sel* Group2; + DlgRef_3Check* Group3; + + QCheckBox* myReverseCB; + + gp_Ax3 myWPlane; + private slots: - void ClickOnOk(); - void ClickOnCancel(); - bool ClickOnApply(); - - void ConstructorsClicked(int constructorId); - void GroupClicked(int groupId); - void SetEditCurrentArgument(); - void SelectionIntoArgument(); - void LineEditReturnPressed(); - void onReverse(); - - void ActivateThisDialog(); - void DeactivateActiveDialog(); - + void ClickOnOk(); + void ClickOnCancel(); + bool ClickOnApply(); + + void ConstructorsClicked( int ); + void GroupClicked( int ); + void SetEditCurrentArgument(); + void SelectionIntoArgument(); + void LineEditReturnPressed(); + void onReverse(); + + void ActivateThisDialog(); + void DeactivateActiveDialog(); }; -#endif // DIALOGBOX_WORKINGPLANE_H +#endif // BASICGUI_WORKINGPLANEDLG_H diff --git a/src/BasicGUI/GEOM_BasicGUI.hxx b/src/BasicGUI/GEOM_BasicGUI.hxx index ba917e55d..af2ec4216 100755 --- a/src/BasicGUI/GEOM_BasicGUI.hxx +++ b/src/BasicGUI/GEOM_BasicGUI.hxx @@ -1,47 +1,42 @@ -// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org // +// File : GEOM_BasicGUI.hxx +// Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com) // -// -// File : GEOM_BasicGUI.hxx -// Author : Alexander A. BORODIN -// Module : GEOM -#ifndef _GEOM_BasicGUI_HXX_ -#define _GEOM_BasicGUI_HXX_ +#ifndef GEOM_BASICGUI_HXX +#define GEOM_BASICGUI_HXX -#ifdef WNT - #if defined BASICGUI_EXPORTS - #if defined WIN32 - #define GEOM_BASICGUI_EXPORT __declspec( dllexport ) - #else - #define GEOM_BASICGUI_EXPORT - #endif - #else - #if defined WIN32 - #define GEOM_BASICGUI_EXPORT __declspec( dllimport ) - #else - #define GEOM_BASICGUI_EXPORT - #endif - #endif +#if defined WIN32 +# if defined BASICGUI_EXPORTS +# define BASICGUI_EXPORT __declspec( dllexport ) +# else +# define BASICGUI_EXPORT __declspec( dllimport ) +# endif #else - #define GEOM_BASICGUI_EXPORT +# define BASICGUI_EXPORT #endif -#endif +#ifndef COORD_MIN +#define COORD_MIN -1e+15 +#define COORD_MAX +1e+15 +#endif // COORD_MIN + +#endif // GEOM_BASICGUI_HXX diff --git a/src/BasicGUI/Makefile.am b/src/BasicGUI/Makefile.am index ab4659b13..1a125c113 100644 --- a/src/BasicGUI/Makefile.am +++ b/src/BasicGUI/Makefile.am @@ -1,31 +1,27 @@ -# GEOM BASICGUI : +# GEOM BASICGUI : # -# 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.in +# Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com) # -# -# 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 @@ -89,6 +85,7 @@ libBasicGUI_la_CPPFLAGS = \ -I$(srcdir)/../GEOMBase \ -I$(srcdir)/../GEOMImpl \ -I$(srcdir)/../GEOMClient \ + -I$(top_builddir)/src/DlgRef \ -I$(top_builddir)/idl \ -I$(top_builddir)/salome_adm/unix diff --git a/src/DlgRef/DlgRef_Skeleton_QTD.ui b/src/DlgRef/DlgRef_Skeleton_QTD.ui index 28e9f2d21..637dea079 100644 --- a/src/DlgRef/DlgRef_Skeleton_QTD.ui +++ b/src/DlgRef/DlgRef_Skeleton_QTD.ui @@ -1,6 +1,6 @@ DlgRef_Skeleton_QTD - + 0 @@ -9,20 +9,9 @@ 170 - - - 5 - 7 - 0 - 0 - - - - true - 9 @@ -30,8 +19,41 @@ 6 - - + + + + + 5 + 0 + 0 + 0 + + + + Result name + + + + 9 + + + 6 + + + + + Name + + + false + + + + + + + + @@ -151,49 +173,20 @@ - - - - Result name + + + + + 7 + 7 + 0 + 0 + - - - 9 - - - 6 - - - - - Name - - - false - - - - - - - - - qPixmapFromMimeSource - - RadioButton1 - RadioButton2 - RadioButton3 - RadioButton4 - ResultName - buttonOk - buttonApply - buttonCancel - buttonHelp - diff --git a/src/DlgRef/GEOM_DlgRef.cxx b/src/DlgRef/GEOM_DlgRef.cxx index 4fd80c492..d5b1aff90 100644 --- a/src/DlgRef/GEOM_DlgRef.cxx +++ b/src/DlgRef/GEOM_DlgRef.cxx @@ -522,27 +522,11 @@ DlgRef_6Sel::~DlgRef_6Sel() ////////////////////////////////////////// DlgRef_Skeleton::DlgRef_Skeleton( QWidget* parent, Qt::WindowFlags f ) -: QDialog( parent, f ) -{ - setupUi( this ); -} - -DlgRef_Skeleton::DlgRef_Skeleton( QWidget* parent, bool modal, Qt::WindowFlags f ) -: QDialog( parent, f ) +: QWidget( parent, f ) { setupUi( this ); - setModal( modal ); } DlgRef_Skeleton::~DlgRef_Skeleton() { } - -void DlgRef_Skeleton::initSpinBox( QDoubleSpinBox* spinBox, - double min, double max, - double step, int decimals ) -{ - spinBox->setRange( min, max ); - spinBox->setSingleStep( step ); - spinBox->setDecimals( decimals ); -} diff --git a/src/DlgRef/GEOM_DlgRef.h b/src/DlgRef/GEOM_DlgRef.h index 1fb97f43f..2ccf7a61c 100644 --- a/src/DlgRef/GEOM_DlgRef.h +++ b/src/DlgRef/GEOM_DlgRef.h @@ -572,17 +572,14 @@ public: #include "ui_DlgRef_Skeleton_QTD.h" -class DLGREF_EXPORT DlgRef_Skeleton : public QDialog, +class DLGREF_EXPORT DlgRef_Skeleton : public QWidget, public Ui::DlgRef_Skeleton_QTD { Q_OBJECT public: DlgRef_Skeleton( QWidget* = 0, Qt::WindowFlags = 0 ); - DlgRef_Skeleton( QWidget* = 0, bool modal = false, Qt::WindowFlags = 0 ); ~DlgRef_Skeleton(); - - void initSpinBox( QDoubleSpinBox*, double, double, double = 0.1, int = 3 ); }; #endif // GEOM_DLGREF_H diff --git a/src/DlgRef/Makefile.am b/src/DlgRef/Makefile.am index e71527c79..b9a320184 100644 --- a/src/DlgRef/Makefile.am +++ b/src/DlgRef/Makefile.am @@ -85,9 +85,8 @@ MOC_FILES = \ # DlgRef_4Sel1Spin2Check_moc.cxx # header files -salomeinclude_HEADERS = \ - GEOM_DlgRef.h - +#salomeinclude_HEADERS = \ +# GEOM_DlgRef.h # DlgRef_Skeleton_QTD.h \ # DlgRef_1Sel_QTD.h \ # DlgRef_2Sel_QTD.h \ @@ -183,8 +182,9 @@ UIC_FILES = \ BUILT_SOURCES = $(UIC_FILES) -nodist_libDlgRef_la_SOURCES = \ - $(MOC_FILES) \ +nodist_libDlgRef_la_SOURCES = \ + GEOM_DlgRef.h \ + $(MOC_FILES) \ $(UIC_FILES) # additionnal information to compile and link file diff --git a/src/GEOMBase/GEOMBase_Skeleton.cxx b/src/GEOMBase/GEOMBase_Skeleton.cxx index 3a1cd3217..1a93f1971 100644 --- a/src/GEOMBase/GEOMBase_Skeleton.cxx +++ b/src/GEOMBase/GEOMBase_Skeleton.cxx @@ -27,6 +27,7 @@ #include "GEOMBase.h" #include +#include #include #include @@ -37,6 +38,7 @@ #include #include +#include using namespace std; @@ -45,45 +47,41 @@ using namespace std; // purpose : Constructs a GEOMBase_Skeleton which is a child of 'parent', with the // name 'name' and widget flags set to 'f'. // The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. +// true to construct a modal dialog. //================================================================================= -GEOMBase_Skeleton::GEOMBase_Skeleton(GeometryGUI* theGeometryGUI, QWidget* parent, - const char* name, bool modal, Qt::WindowFlags fl) +GEOMBase_Skeleton::GEOMBase_Skeleton( GeometryGUI* theGeometryGUI, QWidget* parent, + const char* name, bool modal, Qt::WindowFlags fl ) : QDialog( parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint ), GEOMBase_Helper( dynamic_cast( parent ) ), myGeomGUI( theGeometryGUI ), myRBGroup( 0 ) { - setupUi(this); - - if (!name) - setObjectName("GEOMBase_Skeleton"); + if ( !name ) + setObjectName( "GEOMBase_Skeleton" ); else - setObjectName(name); + setObjectName( name ); - setModal( modal ); setAttribute( Qt::WA_DeleteOnClose ); - buttonCancel->setText(tr("GEOM_BUT_CLOSE")); - buttonOk->setText(tr("GEOM_BUT_OK")); - buttonApply->setText(tr("GEOM_BUT_APPLY")); - buttonHelp->setText(tr("GEOM_BUT_HELP")); - - GroupMedium->setAttribute( Qt::WA_DeleteOnClose ); - GroupMedium->close(); - resize(0, 0); - - if ( GroupConstructors != NULL ) { - myRBGroup = new QButtonGroup(GroupConstructors); - QList aRadioButtons = GroupConstructors->children(); - QListIterator it( aRadioButtons ); - int anId = 0; - while ( it.hasNext() ) - if ( QRadioButton* aRB = ::qobject_cast( it.next() ) ) { - myRBGroup->addButton( aRB, anId ); - anId++; - } - } + setModal( modal ); + + myMainFrame = new DlgRef_Skeleton( this ); + QVBoxLayout* topLayout = new QVBoxLayout( this ); + topLayout->setMargin( 0 ); topLayout->setSpacing( 0 ); + topLayout->addWidget( myMainFrame ); + + buttonCancel()->setText( tr( "GEOM_BUT_CLOSE" ) ); + buttonOk()->setText( tr( "GEOM_BUT_OK" )) ; + buttonApply()->setText( tr( "GEOM_BUT_APPLY" ) ); + buttonHelp()->setText( tr( "GEOM_BUT_HELP" ) ); + + myRBGroup = new QButtonGroup( this ); + myRBGroup->addButton( myMainFrame->RadioButton1, 0 ); + myRBGroup->addButton( myMainFrame->RadioButton2, 1 ); + myRBGroup->addButton( myMainFrame->RadioButton3, 2 ); + myRBGroup->addButton( myMainFrame->RadioButton4, 4 ); + + connect( myRBGroup, SIGNAL( buttonClicked( int ) ), this, SIGNAL( constructorsClicked( int ) ) ); Init(); } @@ -95,7 +93,7 @@ GEOMBase_Skeleton::GEOMBase_Skeleton(GeometryGUI* theGeometryGUI, QWidget* paren //================================================================================= GEOMBase_Skeleton::~GEOMBase_Skeleton() { - if (myGeomGUI) + if ( myGeomGUI ) myGeomGUI->SetActiveDialogBox( 0 ); } @@ -106,31 +104,36 @@ GEOMBase_Skeleton::~GEOMBase_Skeleton() //================================================================================= void GEOMBase_Skeleton::Init() { - SalomeApp_Application* app = (SalomeApp_Application*)(SUIT_Session::session()->activeApplication()); - if (!myGeomGUI && app) + SalomeApp_Application* app = (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ); + if ( !myGeomGUI && app ) myGeomGUI = dynamic_cast( app->module( "Geometry" ) ); /* init variables */ - myGeomGUI->SetActiveDialogBox(this); + myGeomGUI->SetActiveDialogBox( this ); /* signals and slots connections */ - connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); - if (myGeomGUI) - { - connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); - connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + connect( buttonCancel(), SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ); + if ( myGeomGUI ) { + connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ); + connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ); } // connect help button on a private slot that displays help information - connect( buttonHelp, SIGNAL( clicked() ), this, SLOT( ClickOnHelp() ) ); + connect( buttonHelp(), SIGNAL( clicked() ), this, SLOT( ClickOnHelp() ) ); /* displays Dialog */ - RadioButton1->setChecked(TRUE); - RadioButton4->hide(); - - return; + myMainFrame->RadioButton1->setChecked( true ); + myMainFrame->RadioButton4->hide(); } +void GEOMBase_Skeleton::initSpinBox( QDoubleSpinBox* spinBox, + double min, double max, + double step, int decimals ) +{ + spinBox->setRange( min, max ); + spinBox->setSingleStep( step ); + spinBox->setDecimals( decimals ); +} //================================================================================= // function : ClickOnCancel() @@ -157,10 +160,8 @@ void GEOMBase_Skeleton::LineEditReturnPressed() const QString objectUserName = myEditCurrentArgument->text(); QWidget* thisWidget = (QWidget*)this; - if(GEOMBase::SelectionByNameInDialogs(thisWidget, objectUserName, selectedIO())) - myEditCurrentArgument->setText(objectUserName); - - return; + if ( GEOMBase::SelectionByNameInDialogs( thisWidget, objectUserName, selectedIO() ) ) + myEditCurrentArgument->setText( objectUserName ); } @@ -170,12 +171,10 @@ void GEOMBase_Skeleton::LineEditReturnPressed() //================================================================================= void GEOMBase_Skeleton::DeactivateActiveDialog() { - this->setEnabled(false); + this->setEnabled( false ); globalSelection(); - disconnect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); - if (myGeomGUI) myGeomGUI->SetActiveDialogBox(0); - - return; + disconnect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), 0, this, 0 ); + if ( myGeomGUI ) myGeomGUI->SetActiveDialogBox( 0 ); } @@ -186,9 +185,9 @@ void GEOMBase_Skeleton::DeactivateActiveDialog() void GEOMBase_Skeleton::ActivateThisDialog() { /* Emit a signal to deactivate the active dialog */ - if (myGeomGUI) myGeomGUI->EmitSignalDeactivateDialog(); - this->setEnabled(true); - if (myGeomGUI) myGeomGUI->SetActiveDialogBox((QDialog*)this); + if ( myGeomGUI ) myGeomGUI->EmitSignalDeactivateDialog(); + this->setEnabled( true ); + if ( myGeomGUI ) myGeomGUI->SetActiveDialogBox( (QDialog*)this ); return; } @@ -197,11 +196,11 @@ void GEOMBase_Skeleton::ActivateThisDialog() // function : closeEvent() // purpose : same than click on cancel button //================================================================================= -void GEOMBase_Skeleton::closeEvent(QCloseEvent* e) +void GEOMBase_Skeleton::closeEvent( QCloseEvent* e ) { - SalomeApp_Application* app = (SalomeApp_Application*)(SUIT_Session::session()->activeApplication()); - if(app) { - disconnect( app->selectionMgr(), 0, this, 0); + SalomeApp_Application* app = (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ); + if( app ) { + disconnect( app->selectionMgr(), 0, this, 0 ); app->updateActions(); } QDialog::closeEvent( e ); @@ -211,11 +210,11 @@ void GEOMBase_Skeleton::closeEvent(QCloseEvent* e) // function : initName() // purpose : initialize the Name field with a string "thePrefix_X" (Vertex_3) //================================================================================= -void GEOMBase_Skeleton::initName( const char* thePrefix ) +void GEOMBase_Skeleton::initName( const QString& thePrefix ) { - if ( thePrefix ) + if ( !thePrefix.isNull() ) setPrefix( thePrefix ); - ResultName->setText( GEOMBase::GetDefaultName( getPrefix() ) ); + myMainFrame->ResultName->setText( GEOMBase::GetDefaultName( getPrefix() ) ); } //================================================================================= @@ -224,7 +223,7 @@ void GEOMBase_Skeleton::initName( const char* thePrefix ) //================================================================================= const char* GEOMBase_Skeleton::getNewObjectName() const { - return ResultName->text().toLatin1().constData(); + return myMainFrame->ResultName->text().toLatin1().constData(); } //================================================================================= @@ -248,20 +247,20 @@ int GEOMBase_Skeleton::getConstructorId() const //================================================================================= void GEOMBase_Skeleton::ClickOnHelp() { - LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); - if (app) - app->onHelpContextModule(myGeomGUI ? app->moduleName(myGeomGUI->moduleName()) : QString(""), myHelpFileName); + LightApp_Application* app = (LightApp_Application*)( SUIT_Session::session()->activeApplication() ); + if ( app ) + app->onHelpContextModule( myGeomGUI ? app->moduleName( myGeomGUI->moduleName() ) : QString(""), myHelpFileName ); else { - QString platform; + QString platform; #ifdef WIN32 - platform = "winapplication"; + platform = "winapplication"; #else - platform = "application"; + platform = "application"; #endif - SUIT_MessageBox::warning(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), - QObject::tr("BUT_OK")); + SUIT_MessageBox::warning( 0, QObject::tr( "WRN_WARNING" ), + QObject::tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ). + arg( app->resourceMgr()->stringValue( "ExternalBrowser", platform ) ).arg( myHelpFileName ), + QObject::tr( "BUT_OK" ) ); } } //================================================================================= @@ -269,9 +268,39 @@ void GEOMBase_Skeleton::ClickOnHelp() // purpose : set name for help file html //================================================================================= -void GEOMBase_Skeleton::setHelpFileName(const QString& theName) +void GEOMBase_Skeleton::setHelpFileName( const QString& theName ) +{ + myHelpFileName = theName; +} + +DlgRef_Skeleton* GEOMBase_Skeleton::mainFrame() { - myHelpFileName = theName; + return myMainFrame; +} + +QWidget* GEOMBase_Skeleton::centralWidget() +{ + return myMainFrame->GroupMedium; +} + +QPushButton* GEOMBase_Skeleton::buttonCancel() const +{ + return myMainFrame->buttonCancel; +} + +QPushButton* GEOMBase_Skeleton::buttonOk() const +{ + return myMainFrame->buttonOk; +} + +QPushButton* GEOMBase_Skeleton::buttonApply() const +{ + return myMainFrame->buttonApply; +} + +QPushButton* GEOMBase_Skeleton::buttonHelp() const +{ + return myMainFrame->buttonHelp; } //================================================================================= @@ -284,9 +313,8 @@ void GEOMBase_Skeleton::keyPressEvent( QKeyEvent* e ) if ( e->isAccepted() ) return; - if ( e->key() == Qt::Key_F1 ) - { - e->accept(); - ClickOnHelp(); - } + if ( e->key() == Qt::Key_F1 ) { + e->accept(); + ClickOnHelp(); + } } diff --git a/src/GEOMBase/GEOMBase_Skeleton.h b/src/GEOMBase/GEOMBase_Skeleton.h index 3d35bf0e1..c0bdc2f72 100644 --- a/src/GEOMBase/GEOMBase_Skeleton.h +++ b/src/GEOMBase/GEOMBase_Skeleton.h @@ -29,29 +29,35 @@ #include "GEOM_GEOMBase.hxx" #include "GEOMBase_Helper.h" -#include +#include class GeometryGUI; +class DlgRef_Skeleton; +class QDoubleSpinBox; +class QLineEdit; +class QButtonGroup; +class QPushButton; -class GEOMBASE_EXPORT GEOMBase_Skeleton : public QDialog, public Ui::DlgRef_Skeleton_QTD, public GEOMBase_Helper +class GEOMBASE_EXPORT GEOMBase_Skeleton : public QDialog, public GEOMBase_Helper { - Q_OBJECT + Q_OBJECT public: - GEOMBase_Skeleton(GeometryGUI* theGeometryGUI, QWidget* parent = 0, - const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0); + GEOMBase_Skeleton( GeometryGUI*, QWidget* = 0, const char* = 0, bool = false, Qt::WindowFlags = 0 ); ~GEOMBase_Skeleton(); private: void Init(); protected: - void closeEvent(QCloseEvent* e); - void keyPressEvent(QKeyEvent* e); + void initSpinBox( QDoubleSpinBox*, double, double, double = 0.1, int = 3 ); + + void closeEvent( QCloseEvent* ); + void keyPressEvent( QKeyEvent* ); /*! initialize "Name" field with a string "thePrefix_X" (Vertex_3) */ - void initName( const char* thePrefix = 0 ); + void initName( const QString& = QString() ); /*! returns contents of "Name" field */ @@ -59,22 +65,34 @@ protected: /*! returns id of a selected "constructor" radio button or '-1' in case of error */ - int getConstructorId() const; + int getConstructorId() const; + + void setHelpFileName( const QString& ); - void setHelpFileName( const QString& ); + DlgRef_Skeleton* mainFrame(); + QWidget* centralWidget(); + QPushButton* buttonCancel() const; + QPushButton* buttonOk() const; + QPushButton* buttonApply() const; + QPushButton* buttonHelp() const; - QLineEdit* myEditCurrentArgument; //!< Current LineEdit - GeometryGUI* myGeomGUI; //!< reference GEOM GUI - QString myHelpFileName; +protected: + QLineEdit* myEditCurrentArgument; //!< Current LineEdit + GeometryGUI* myGeomGUI; //!< reference GEOM GUI + QString myHelpFileName; //!< Associated HTML help file name - QButtonGroup* myRBGroup; + QButtonGroup* myRBGroup; //!< radio button group + DlgRef_Skeleton* myMainFrame; //!< dialog box's mainframe widgetx protected slots: - virtual void ClickOnCancel(); - void LineEditReturnPressed(); - void DeactivateActiveDialog(); - void ActivateThisDialog(); - void ClickOnHelp(); + virtual void ClickOnCancel(); + void LineEditReturnPressed(); + void DeactivateActiveDialog(); + void ActivateThisDialog(); + void ClickOnHelp(); + +signals: + void constructorsClicked( int ); }; #endif // GEOMBASE_SKELETON_H diff --git a/src/GEOMClient/Makefile.am b/src/GEOMClient/Makefile.am index 9b1cc44c9..959b3859f 100644 --- a/src/GEOMClient/Makefile.am +++ b/src/GEOMClient/Makefile.am @@ -54,7 +54,9 @@ libGEOMClient_la_LDFLAGS = \ ../../idl/libSalomeIDLGEOM.la \ ../GEOM/libGEOMbasic.la \ $(KERNEL_LDFLAGS) -lSalomeIDLKernel -lOpUtil \ - $(CAS_TKTopAlgo) \ - $(CORBA_LIBS) \ - $(STDLIB) + $(CAS_TKTopAlgo) + +# \ +# $(CORBA_LIBS) \ +# #$(STDLIB) diff --git a/src/GEOM_I/Makefile.am b/src/GEOM_I/Makefile.am index 7915c62bb..33b0aceba 100644 --- a/src/GEOM_I/Makefile.am +++ b/src/GEOM_I/Makefile.am @@ -93,6 +93,8 @@ libGEOMEngine_la_LDFLAGS = \ ../GEOM/libGEOMbasic.la \ $(KERNEL_LDFLAGS) -lSalomeNS -lSalomeContainer -lSalomeGenericObj -lTOOLSDS \ $(CAS_DATAEXCHANGE) \ - $(CAS_LDPATH) -lTKFillet -lTKOffset \ - $(STDLIB) \ - $(CORBA_LIBS) + $(CAS_LDPATH) -lTKFillet -lTKOffset + +# \ +# $(STDLIB) \ +# $(CORBA_LIBS)