From: vsr Date: Wed, 17 Oct 2007 12:24:45 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: snapshot_171207~9 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b6cf20bd37a4642e0972ec3bc8bd92110cd58f43;p=modules%2Fgeom.git *** empty log message *** --- diff --git a/src/BasicGUI/BasicGUI_PointDlg.cxx b/src/BasicGUI/BasicGUI_PointDlg.cxx index 8bc8ade37..21455fe67 100644 --- a/src/BasicGUI/BasicGUI_PointDlg.cxx +++ b/src/BasicGUI/BasicGUI_PointDlg.cxx @@ -493,7 +493,7 @@ GEOM::GEOM_IOperations_ptr BasicGUI_PointDlg::createOperation() // function : isValid // purpose : //================================================================================= -bool BasicGUI_PointDlg::isValid( QString& msg ) +bool BasicGUI_PointDlg::isValid( QString& /*msg*/ ) { const int id = getConstructorId(); if ( id == 0 ) diff --git a/src/DlgRef/DlgRef_Skeleton_QTD.ui b/src/DlgRef/DlgRef_Skeleton_QTD.ui index 637dea079..a249ecde2 100644 --- a/src/DlgRef/DlgRef_Skeleton_QTD.ui +++ b/src/DlgRef/DlgRef_Skeleton_QTD.ui @@ -20,7 +20,7 @@ 6 - + 5 diff --git a/src/EntityGUI/EntityGUI_SketcherDlg.cxx b/src/EntityGUI/EntityGUI_SketcherDlg.cxx index 916cf0f54..92a5cc32e 100644 --- a/src/EntityGUI/EntityGUI_SketcherDlg.cxx +++ b/src/EntityGUI/EntityGUI_SketcherDlg.cxx @@ -1208,7 +1208,7 @@ bool EntityGUI_SketcherDlg::execute( ObjectList& objects ) //Last Shape QString Command1 = myCommand.join( "" ); Sketcher_Profile aProfile1( Command1.toAscii() ); - if( aProfile1.IsDone() ) + if ( aProfile1.IsDone() ) myShape1 = aProfile1.GetShape(); //Current Shape @@ -1249,7 +1249,7 @@ bool EntityGUI_SketcherDlg::execute( ObjectList& objects ) myLastX1 == myLastX2 && myLastY1 == myLastY2 ) || myIsAllAdded ) { cmd = myCommand.join( "" ); - if ( ::qobject_cast( Group1Sel->gridLayout->parent() )->isVisible() ) { + if ( Group1Sel->isVisible() ) { Group1Sel->buttonApply->setEnabled( false ); //Group1Sel->buttonApply->setFocus(); } @@ -1273,7 +1273,7 @@ bool EntityGUI_SketcherDlg::execute( ObjectList& objects ) else { cmd = myCommand.join( "" ) + GetNewCommand(); - if ( ::qobject_cast( Group1Sel->gridLayout->parent() )->isVisible() ) { + if ( Group1Sel->isVisible() ) { Group1Sel->buttonApply->setEnabled( true ); //Group1Sel->buttonApply->setFocus(); } diff --git a/src/EntityGUI/EntityGUI_SubShapeDlg.cxx b/src/EntityGUI/EntityGUI_SubShapeDlg.cxx index b5aec3f7a..3f7a75a82 100644 --- a/src/EntityGUI/EntityGUI_SubShapeDlg.cxx +++ b/src/EntityGUI/EntityGUI_SubShapeDlg.cxx @@ -199,7 +199,7 @@ void EntityGUI_SubShapeDlg::SelectionIntoArgument() QString aString = ""; /* name of selection */ int nbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aString, true ); - if( nbSel != 1 ) + if ( nbSel != 1 ) return; TopoDS_Shape S; diff --git a/src/TransformationGUI/Makefile.am b/src/TransformationGUI/Makefile.am index b980ea75a..0a4df166e 100644 --- a/src/TransformationGUI/Makefile.am +++ b/src/TransformationGUI/Makefile.am @@ -1,31 +1,28 @@ -# GEOM TRANSFORMATIONGUI : +# GEOM TRANSFORMATIONGUI : # -# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS # -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. # -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. # -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # +# File : Makefile.am +# Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com) +# Package : BooleanGUI # -# -# File : Makefile.in -# Author : Damien COQUERET (OCC) -# Modified by : Alexander BORODIN (OCN) - autotools usage -# Module : GEOM -# $Header: include $(top_srcdir)/adm_local/unix/make_common_starter.am @@ -35,28 +32,38 @@ salomeinclude_HEADERS = # Libraries targets lib_LTLIBRARIES = libTransformationGUI.la -dist_libTransformationGUI_la_SOURCES = \ - TransformationGUI.cxx \ - TransformationGUI_MultiTranslationDlg.cxx \ - TransformationGUI_MultiRotationDlg.cxx \ - TransformationGUI_TranslationDlg.cxx \ - TransformationGUI_RotationDlg.cxx \ - TransformationGUI_MirrorDlg.cxx \ - TransformationGUI_ScaleDlg.cxx \ - TransformationGUI_OffsetDlg.cxx \ +dist_libTransformationGUI_la_SOURCES = \ + TransformationGUI.h \ + TransformationGUI_MultiTranslationDlg.h \ + TransformationGUI_MultiRotationDlg.h \ + TransformationGUI_TranslationDlg.h \ + TransformationGUI_RotationDlg.h \ + TransformationGUI_MirrorDlg.h \ + TransformationGUI_ScaleDlg.h \ + TransformationGUI_OffsetDlg.h \ + TransformationGUI_PositionDlg.h \ + \ + TransformationGUI.cxx \ + TransformationGUI_MultiTranslationDlg.cxx \ + TransformationGUI_MultiRotationDlg.cxx \ + TransformationGUI_TranslationDlg.cxx \ + TransformationGUI_RotationDlg.cxx \ + TransformationGUI_MirrorDlg.cxx \ + TransformationGUI_ScaleDlg.cxx \ + TransformationGUI_OffsetDlg.cxx \ TransformationGUI_PositionDlg.cxx MOC_FILES = \ - TransformationGUI_MultiTranslationDlg_moc.cxx \ - TransformationGUI_MultiRotationDlg_moc.cxx \ - TransformationGUI_TranslationDlg_moc.cxx \ - TransformationGUI_RotationDlg_moc.cxx \ - TransformationGUI_MirrorDlg_moc.cxx \ - TransformationGUI_ScaleDlg_moc.cxx \ - TransformationGUI_OffsetDlg_moc.cxx \ + TransformationGUI_MultiTranslationDlg_moc.cxx \ + TransformationGUI_MultiRotationDlg_moc.cxx \ + TransformationGUI_TranslationDlg_moc.cxx \ + TransformationGUI_RotationDlg_moc.cxx \ + TransformationGUI_MirrorDlg_moc.cxx \ + TransformationGUI_ScaleDlg_moc.cxx \ + TransformationGUI_OffsetDlg_moc.cxx \ TransformationGUI_PositionDlg_moc.cxx -nodist_libTransformationGUI_la_SOURCES= \ +nodist_libTransformationGUI_la_SOURCES = \ $(MOC_FILES) #LIB_CLIENT_IDL = SALOME_GenericObj.idl SALOME_Component.idl SALOME_Exception.idl @@ -65,24 +72,25 @@ nodist_libTransformationGUI_la_SOURCES= \ # additionnal information to compil and link file -libTransformationGUI_la_CPPFLAGS = \ - $(QT_INCLUDES) \ - $(VTK_INCLUDES) \ - $(CAS_CPPFLAGS) \ - $(PYTHON_INCLUDES) \ - $(BOOST_CPPFLAGS) \ - $(KERNEL_CXXFLAGS) \ - $(GUI_CXXFLAGS) \ - $(CORBA_CXXFLAGS) \ - $(CORBA_INCLUDES) \ - -I$(srcdir)/../GEOMGUI \ - -I$(srcdir)/../DlgRef \ - -I$(srcdir)/../GEOMBase \ - -I$(srcdir)/../OBJECT \ - -I$(srcdir)/../GEOMClient \ - -I$(srcdir)/../GEOMImpl \ - -I$(srcdir)/../GEOMFiltersSelection \ - -I$(top_builddir)/idl \ +libTransformationGUI_la_CPPFLAGS = \ + $(QT_INCLUDES) \ + $(VTK_INCLUDES) \ + $(CAS_CPPFLAGS) \ + $(PYTHON_INCLUDES) \ + $(BOOST_CPPFLAGS) \ + $(KERNEL_CXXFLAGS) \ + $(GUI_CXXFLAGS) \ + $(CORBA_CXXFLAGS) \ + $(CORBA_INCLUDES) \ + -I$(srcdir)/../GEOMGUI \ + -I$(srcdir)/../DlgRef \ + -I$(srcdir)/../GEOMBase \ + -I$(srcdir)/../OBJECT \ + -I$(srcdir)/../GEOMClient \ + -I$(srcdir)/../GEOMImpl \ + -I$(srcdir)/../GEOMFiltersSelection \ + -I$(top_builddir)/src/DlgRef \ + -I$(top_builddir)/idl \ -I$(top_builddir)/salome_adm/unix libTransformationGUI_la_LDFLAGS = \ diff --git a/src/TransformationGUI/TransformationGUI.cxx b/src/TransformationGUI/TransformationGUI.cxx index e3d4ffc2c..917f18b75 100644 --- a/src/TransformationGUI/TransformationGUI.cxx +++ b/src/TransformationGUI/TransformationGUI.cxx @@ -1,37 +1,34 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : TransformationGUI.cxx +// Author : Damien COQUERET, Open CASCADE S.A.S. // -// -// File : TransformationGUI.cxx -// Author : Damien COQUERET -// Module : GEOM -// $Header$ #include "TransformationGUI.h" -#include "GeometryGUI.h" -#include "SUIT_Desktop.h" +#include -#include "SalomeApp_Application.h" +#include +#include #include "TransformationGUI_MultiTranslationDlg.h" // Method MULTI TRANSLATION #include "TransformationGUI_MultiRotationDlg.h" // Method MULTI ROTATION @@ -42,13 +39,12 @@ #include "TransformationGUI_OffsetDlg.h" // Method OFFSET #include "TransformationGUI_PositionDlg.h" // Method POSITION -using namespace std; - //======================================================================= // function : TransformationGUI() // purpose : Constructor //======================================================================= -TransformationGUI::TransformationGUI(GeometryGUI* parent) : GEOMGUI(parent) +TransformationGUI::TransformationGUI( GeometryGUI* parent ) + : GEOMGUI( parent ) { } @@ -65,46 +61,45 @@ TransformationGUI::~TransformationGUI() // function : OnGUIEvent() // purpose : //======================================================================= -bool TransformationGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent) +bool TransformationGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) { SalomeApp_Application* app = getGeometryGUI()->getApp(); - if (!app) return false; + if ( !app ) return false; getGeometryGUI()->EmitSignalDeactivateDialog(); QDialog* aDlg = NULL; - switch (theCommandID) - { + switch ( theCommandID ) { case 5021: // TRANSLATION - aDlg = new TransformationGUI_TranslationDlg( getGeometryGUI(), parent, "" ); + aDlg = new TransformationGUI_TranslationDlg( getGeometryGUI(), parent ); break; case 5022: // ROTATION - aDlg = new TransformationGUI_RotationDlg( getGeometryGUI(), parent, "" ); + aDlg = new TransformationGUI_RotationDlg( getGeometryGUI(), parent ); break; case 5023: // POSITION - aDlg = new TransformationGUI_PositionDlg( getGeometryGUI(), parent, "" ); + aDlg = new TransformationGUI_PositionDlg( getGeometryGUI(), parent ); break; case 5024: // MIRROR - aDlg = new TransformationGUI_MirrorDlg( getGeometryGUI(), parent, "" ); + aDlg = new TransformationGUI_MirrorDlg( getGeometryGUI(), parent ); break; case 5025: // SCALE - aDlg = new TransformationGUI_ScaleDlg( getGeometryGUI(), parent, "" ); + aDlg = new TransformationGUI_ScaleDlg( getGeometryGUI(), parent ); break; case 5026: // OFFSET - aDlg = new TransformationGUI_OffsetDlg( getGeometryGUI(), parent, "" ); + aDlg = new TransformationGUI_OffsetDlg( getGeometryGUI(), parent ); break; case 5027: // MULTI TRANSLATION - aDlg = new TransformationGUI_MultiTranslationDlg( getGeometryGUI(), parent, "" ); + aDlg = new TransformationGUI_MultiTranslationDlg( getGeometryGUI(), parent ); break; case 5028: // MULTI ROTATION - aDlg = new TransformationGUI_MultiRotationDlg( getGeometryGUI(), parent, "" ); + aDlg = new TransformationGUI_MultiRotationDlg( getGeometryGUI(), parent ); break; default: - app->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); + app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) ); break; } - if (aDlg != NULL) + if ( aDlg != NULL ) aDlg->show(); return true; @@ -117,7 +112,7 @@ bool TransformationGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent) extern "C" { #ifdef WNT - __declspec( dllexport ) + __declspec( dllexport ) #endif GEOMGUI* GetLibGUI( GeometryGUI* parent ) { diff --git a/src/TransformationGUI/TransformationGUI.h b/src/TransformationGUI/TransformationGUI.h index 87ba9b55d..e9fece14c 100644 --- a/src/TransformationGUI/TransformationGUI.h +++ b/src/TransformationGUI/TransformationGUI.h @@ -1,35 +1,32 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : TransformationGUI.h +// Author : Damien COQUERET, Open CASCADE S.A.S. // -// -// File : TransformationGUI.h -// Author : Damien COQUERET -// Module : GEOM #ifndef TRANSFORMATIONGUI_H #define TRANSFORMATIONGUI_H -#include "GEOMGUI.h" - +#include //================================================================================= // class : TransformationGUI @@ -38,10 +35,10 @@ class TransformationGUI : public GEOMGUI { public: - TransformationGUI( GeometryGUI* parent ); + TransformationGUI( GeometryGUI* ); ~TransformationGUI(); - bool OnGUIEvent(int theCommandID, SUIT_Desktop* parent); + bool OnGUIEvent( int, SUIT_Desktop* ); }; -#endif +#endif // TRANSFORMATIONGUI_H diff --git a/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx b/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx index bafcadbfa..4d346abc9 100644 --- a/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_MirrorDlg.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 : TransformationGUI_MirrorDlg.cxx +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // -// -// File : TransformationGUI_MirrorDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ #include "TransformationGUI_MirrorDlg.h" -#include "DlgRef_2Sel1Spin2Check.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 : TransformationGUI_MirrorDlg() @@ -49,38 +43,41 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -TransformationGUI_MirrorDlg::TransformationGUI_MirrorDlg(GeometryGUI* theGeometryGUI, QWidget* parent, - const char* name, bool modal, Qt::WindowFlags fl) - :GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) +TransformationGUI_MirrorDlg::TransformationGUI_MirrorDlg( GeometryGUI* theGeometryGUI, QWidget* parent, + bool modal, Qt::WindowFlags fl ) + : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ) { - QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_MIRROR_POINT"))); - QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_MIRROR_AXE"))); - QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_MIRROR_PLANE"))); - QPixmap image3(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_MIRROR_POINT" ) ) ); + QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_MIRROR_AXE" ) ) ); + QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_MIRROR_PLANE" ) ) ); + QPixmap image3( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); - setWindowTitle(tr("GEOM_MIRROR_TITLE")); + setWindowTitle( tr( "GEOM_MIRROR_TITLE" ) ); /***************************************************************/ - GroupConstructors->setTitle(tr("GEOM_MIRROR")); - RadioButton1->setIcon(image0); - RadioButton2->setIcon(image1); - RadioButton3->setIcon(image2); + mainFrame()->GroupConstructors->setTitle( tr( "GEOM_MIRROR" ) ); + mainFrame()->RadioButton1->setIcon( image0 ); + mainFrame()->RadioButton2->setIcon( image1 ); + mainFrame()->RadioButton3->setIcon( image2 ); - GroupPoints = new DlgRef_2Sel1Spin2Check(this, "GroupPoints"); + GroupPoints = new DlgRef_2Sel1Spin2Check( centralWidget() ); GroupPoints->SpinBox_DX->hide(); GroupPoints->TextLabel3->hide(); GroupPoints->CheckButton2->hide(); - GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); - GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS")); - GroupPoints->TextLabel2->setText(tr("GEOM_POINT_MIRROR")); - GroupPoints->TextLabel2->setFixedWidth(74); - GroupPoints->PushButton1->setIcon(image3); - GroupPoints->PushButton2->setIcon(image3); - GroupPoints->CheckButton1->setText(tr("GEOM_CREATE_COPY")); - gridLayout1->addWidget(GroupPoints, 2, 0); + GroupPoints->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) ); + GroupPoints->TextLabel1->setText( tr( "GEOM_OBJECTS" ) ); + GroupPoints->TextLabel2->setText( tr( "GEOM_POINT_MIRROR" ) ); + GroupPoints->TextLabel2->setFixedWidth( 74 ); + GroupPoints->PushButton1->setIcon( image3 ); + GroupPoints->PushButton2->setIcon( image3 ); + GroupPoints->CheckButton1->setText( tr( "GEOM_CREATE_COPY" ) ); + + QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); + layout->setMargin( 0 ); layout->setSpacing( 6 ); + layout->addWidget( GroupPoints ); /***************************************************************/ - setHelpFileName("mirror_image.htm"); + setHelpFileName( "mirror_image.htm" ); Init(); } @@ -104,32 +101,34 @@ void TransformationGUI_MirrorDlg::Init() { /* init variables */ myEditCurrentArgument = GroupPoints->LineEdit1; - GroupPoints->LineEdit1->setReadOnly(true); - GroupPoints->LineEdit2->setReadOnly(true); + GroupPoints->LineEdit1->setReadOnly( true ); + GroupPoints->LineEdit2->setReadOnly( true ); myArgument = GEOM::GEOM_Object::_nil(); // Activate Create a Copy mode - GroupPoints->CheckButton1->setChecked(true); - CreateCopyModeChanged(true); + GroupPoints->CheckButton1->setChecked( true ); + CreateCopyModeChanged( true ); /* signals and slots connections */ - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); - connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int))); + connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); + + connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) ); - connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool))); + connect( GroupPoints->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( CreateCopyModeChanged( bool ) ) ); - connect(myGeomGUI->getApp()->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect( myGeomGUI->getApp()->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + + initName( tr( "GEOM_MIRROR" ) ); - initName( tr( "GEOM_MIRROR" ).toLatin1().constData() ); ConstructorsClicked( 0 ); } @@ -138,7 +137,7 @@ void TransformationGUI_MirrorDlg::Init() // function : ConstructorsClicked() // purpose : Radio button management //================================================================================= -void TransformationGUI_MirrorDlg::ConstructorsClicked(int constructorId) +void TransformationGUI_MirrorDlg::ConstructorsClicked( int constructorId ) { disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 ); @@ -147,26 +146,20 @@ void TransformationGUI_MirrorDlg::ConstructorsClicked(int constructorId) GroupPoints->LineEdit2->clear(); myArgument = GEOM::GEOM_Object::_nil(); - switch (constructorId) - { - case 0: /* mirror an object by point */ - { - GroupPoints->TextLabel2->setText(tr("GEOM_POINT_MIRROR")); - break; - } - case 1: /* mirror an object by axe */ - { - GroupPoints->TextLabel2->setText(tr("GEOM_AXE_MIRROR")); - break; - } - case 2: /* mirror an object by plane */ - { - GroupPoints->TextLabel2->setText(tr("GEOM_PLANE_MIRROR")); - break; - } - } - connect(myGeomGUI->getApp()->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + switch ( constructorId ) { + case 0: /* mirror an object by point */ + GroupPoints->TextLabel2->setText( tr( "GEOM_POINT_MIRROR" ) ); + break; + case 1: /* mirror an object by axe */ + GroupPoints->TextLabel2->setText( tr( "GEOM_AXE_MIRROR" ) ); + break; + case 2: /* mirror an object by plane */ + GroupPoints->TextLabel2->setText( tr( "GEOM_PLANE_MIRROR" ) ); + break; + } + + connect( myGeomGUI->getApp()->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); } @@ -188,7 +181,7 @@ void TransformationGUI_MirrorDlg::ClickOnOk() //================================================================================= bool TransformationGUI_MirrorDlg::ClickOnApply() { - if ( !onAccept(GroupPoints->CheckButton1->isChecked()) ) + if ( !onAccept( GroupPoints->CheckButton1->isChecked() ) ) return false; initName(); @@ -203,36 +196,32 @@ bool TransformationGUI_MirrorDlg::ClickOnApply() //================================================================================= void TransformationGUI_MirrorDlg::SelectionIntoArgument() { - myEditCurrentArgument->setText(""); + myEditCurrentArgument->setText( "" ); QString aName; - if(myEditCurrentArgument == GroupPoints->LineEdit1) - { - int aNbSel = GEOMBase::GetNameOfSelectedIObjects(selectedIO(), aName); - if(aNbSel < 1) - { - myObjects.length(0); - return; - } - GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), myObjects); - if (!myObjects.length()) - return; - if(aNbSel != 1) - aName = tr("%1_objects").arg(aNbSel); + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) { + int aNbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aName ); + if ( aNbSel < 1 ) { + myObjects.length( 0 ); + return; } - else if(myEditCurrentArgument == GroupPoints->LineEdit2) - { - if(IObjectCount() != 1) - { - myArgument = GEOM::GEOM_Object::_nil(); - return; - } - Standard_Boolean testResult = Standard_False; - myArgument = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); - if(!testResult || CORBA::is_nil( myArgument )) - return; - aName = GEOMBase::GetName( myArgument ); + GEOMBase::ConvertListOfIOInListOfGO( selectedIO(), myObjects ); + if ( !myObjects.length() ) + return; + if ( aNbSel != 1 ) + aName = tr( "%1_objects" ).arg( aNbSel ); + } + else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) { + if ( IObjectCount() != 1 ) { + myArgument = GEOM::GEOM_Object::_nil(); + return; } + Standard_Boolean testResult = Standard_False; + myArgument = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); + if ( !testResult || CORBA::is_nil( myArgument ) ) + return; + aName = GEOMBase::GetName( myArgument ); + } myEditCurrentArgument->setText( aName ); displayPreview(); @@ -246,12 +235,11 @@ void TransformationGUI_MirrorDlg::SelectionIntoArgument() void TransformationGUI_MirrorDlg::LineEditReturnPressed() { QLineEdit* send = (QLineEdit*)sender(); - if(send == GroupPoints->LineEdit1 || - send == GroupPoints->LineEdit2) - { - myEditCurrentArgument = send; - GEOMBase_Skeleton::LineEditReturnPressed(); - } + if ( send == GroupPoints->LineEdit1 || + send == GroupPoints->LineEdit2 ) { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } } @@ -263,30 +251,23 @@ void TransformationGUI_MirrorDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - if(send == GroupPoints->PushButton1){ + if ( send == GroupPoints->PushButton1 ) { myEditCurrentArgument = GroupPoints->LineEdit1; globalSelection(); } - else if(send == GroupPoints->PushButton2) { + else if ( send == GroupPoints->PushButton2 ) { myEditCurrentArgument = GroupPoints->LineEdit2; - switch(getConstructorId()) - { - case 0: - { - globalSelection( GEOM_POINT ); - break; - } - case 1: - { - globalSelection( GEOM_LINE ); - break; - } - case 2: - { - globalSelection( GEOM_PLANE ); - break; - } - } + switch ( getConstructorId() ) { + case 0: + globalSelection( GEOM_POINT ); + break; + case 1: + globalSelection( GEOM_LINE ); + break; + case 2: + globalSelection( GEOM_PLANE ); + break; + } } myEditCurrentArgument->setFocus(); @@ -301,8 +282,8 @@ void TransformationGUI_MirrorDlg::SetEditCurrentArgument() void TransformationGUI_MirrorDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(myGeomGUI->getApp()->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect( myGeomGUI->getApp()->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); ConstructorsClicked( getConstructorId() ); } @@ -311,9 +292,9 @@ void TransformationGUI_MirrorDlg::ActivateThisDialog() // function : enterEvent() // purpose : when mouse enter onto the QWidget //================================================================================= -void TransformationGUI_MirrorDlg::enterEvent(QEvent * e) +void TransformationGUI_MirrorDlg::enterEvent( QEvent* ) { - if(!GroupConstructors->isEnabled()) + if ( !mainFrame()->GroupConstructors->isEnabled() ) ActivateThisDialog(); } @@ -332,9 +313,9 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_MirrorDlg::createOperation() // function : isValid // purpose : //================================================================================= -bool TransformationGUI_MirrorDlg::isValid( QString& msg ) +bool TransformationGUI_MirrorDlg::isValid( QString& /*msg*/ ) { - return !(myObjects.length() == 0 || myArgument->_is_nil()); + return !( myObjects.length() == 0 || myArgument->_is_nil() ); } @@ -349,66 +330,65 @@ bool TransformationGUI_MirrorDlg::execute( ObjectList& objects ) GEOM::GEOM_Object_var anObj; - switch ( getConstructorId() ) + switch ( getConstructorId() ) { + case 0: { - case 0 : - { - if (toCreateCopy) - for (int i = 0; i < myObjects.length(); i++) - { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorPointCopy( myObjects[i], myArgument ); - if ( !anObj->_is_nil() ) - objects.push_back( anObj._retn() ); - } - else - for (int i = 0; i < myObjects.length(); i++) - { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorPoint( myObjects[i], myArgument ); - if ( !anObj->_is_nil() ) - objects.push_back( anObj._retn() ); - } - res = true; - break; + if ( toCreateCopy ) { + for ( int i = 0; i < myObjects.length(); i++ ) { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorPointCopy( myObjects[i], myArgument ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } } - case 1 : - { - if (toCreateCopy) - for (int i = 0; i < myObjects.length(); i++) - { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorAxisCopy( myObjects[i], myArgument ); - if ( !anObj->_is_nil() ) - objects.push_back( anObj._retn() ); - } - else - for (int i = 0; i < myObjects.length(); i++) - { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorAxis( myObjects[i], myArgument ); - if ( !anObj->_is_nil() ) - objects.push_back( anObj._retn() ); - } - res = true; - break; + else { + for ( int i = 0; i < myObjects.length(); i++ ) { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorPoint( myObjects[i], myArgument ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } } - case 2: - { - if (toCreateCopy) - for (int i = 0; i < myObjects.length(); i++) - { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorPlaneCopy( myObjects[i], myArgument ); - if ( !anObj->_is_nil() ) - objects.push_back( anObj._retn() ); - } - else - for (int i = 0; i < myObjects.length(); i++) - { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorPlane( myObjects[i], myArgument ); - if ( !anObj->_is_nil() ) - objects.push_back( anObj._retn() ); - } - res = true; - break; + res = true; + break; + } + case 1: + { + if ( toCreateCopy ) { + for ( int i = 0; i < myObjects.length(); i++ ) { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorAxisCopy( myObjects[i], myArgument ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } + } + else { + for ( int i = 0; i < myObjects.length(); i++ ) { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorAxis( myObjects[i], myArgument ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } + } + res = true; + break; + } + case 2: + { + if ( toCreateCopy ) { + for ( int i = 0; i < myObjects.length(); i++ ) { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorPlaneCopy( myObjects[i], myArgument ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } } + else { + for ( int i = 0; i < myObjects.length(); i++ ) { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorPlane( myObjects[i], myArgument ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } + } + res = true; + break; } + } return res; } @@ -427,7 +407,7 @@ void TransformationGUI_MirrorDlg::closeEvent( QCloseEvent* e ) // function : CreateCopyModeChanged() // purpose : //================================================================================= -void TransformationGUI_MirrorDlg::CreateCopyModeChanged(bool isCreateCopy) +void TransformationGUI_MirrorDlg::CreateCopyModeChanged( bool isCreateCopy ) { - this->GroupBoxName->setEnabled(isCreateCopy); + mainFrame()->GroupBoxName->setEnabled( isCreateCopy ); } diff --git a/src/TransformationGUI/TransformationGUI_MirrorDlg.h b/src/TransformationGUI/TransformationGUI_MirrorDlg.h index 8764cab59..251860a06 100644 --- a/src/TransformationGUI/TransformationGUI_MirrorDlg.h +++ b/src/TransformationGUI/TransformationGUI_MirrorDlg.h @@ -1,34 +1,32 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : TransformationGUI_MirrorDlg.h +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // -// -// File : TransformationGUI_MirrorDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -#ifndef DIALOGBOX_MIRROR_H -#define DIALOGBOX_MIRROR_H +#ifndef TRANSFORMATIONGUI_MIRRORDLG_H +#define TRANSFORMATIONGUI_MIRRORDLG_H -#include "GEOMBase_Skeleton.h" +#include class DlgRef_2Sel1Spin2Check; @@ -38,39 +36,40 @@ class DlgRef_2Sel1Spin2Check; //================================================================================= class TransformationGUI_MirrorDlg : public GEOMBase_Skeleton { - Q_OBJECT + Q_OBJECT public: - TransformationGUI_MirrorDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, - const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0); - ~TransformationGUI_MirrorDlg(); + TransformationGUI_MirrorDlg( GeometryGUI*, QWidget* = 0, + bool = false, Qt::WindowFlags = 0 ); + ~TransformationGUI_MirrorDlg(); 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* e ); + virtual void closeEvent( QCloseEvent* ); private: - void Init(); - void enterEvent(QEvent* e); + void Init(); + void enterEvent( QEvent* ); - GEOM::GEOM_Object_var myArgument; - GEOM::ListOfGO myObjects; - - DlgRef_2Sel1Spin2Check* GroupPoints; +private: + GEOM::GEOM_Object_var myArgument; + GEOM::ListOfGO myObjects; + + DlgRef_2Sel1Spin2Check* GroupPoints; -private slots : - void ClickOnOk(); - bool ClickOnApply(); - void ActivateThisDialog(); - void LineEditReturnPressed(); - void SelectionIntoArgument(); - void SetEditCurrentArgument(); - void ConstructorsClicked(int constructorId); - void CreateCopyModeChanged(bool isCreateCopy); +private slots: + void ClickOnOk(); + bool ClickOnApply(); + void ActivateThisDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ConstructorsClicked( int ); + void CreateCopyModeChanged( bool ); }; -#endif // DIALOGBOX_MIRROR_H +#endif // TRANSFORMATIONGUI_MIRRORDLG_H diff --git a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx index 11c93f4e6..700553550 100644 --- a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx @@ -1,47 +1,40 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : TransformationGUI_MultiRotationDlg.cxx +// Author : Damien COQUERET, Open CASCADE S.A.S. // -// -// File : TransformationGUI_MultiRotationDlg.cxx -// Author : Damien COQUERET -// Module : GEOM -// $Header$ #include "TransformationGUI_MultiRotationDlg.h" -#include "DlgRef_2Sel4Spin1Check.h" -#include "DlgRef_2Sel1Spin.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 : TransformationGUI_MultiRotationDlg() @@ -51,52 +44,54 @@ using namespace std; // TRUE to construct a modal dialog. //================================================================================= TransformationGUI_MultiRotationDlg::TransformationGUI_MultiRotationDlg - (GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl) - :GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) +( GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl ) + : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ) { SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr(); - QPixmap image0(aResMgr->loadPixmap("GEOM",tr("ICON_DLG_MULTIROTATION_SIMPLE"))); - QPixmap image1(aResMgr->loadPixmap("GEOM",tr("ICON_DLG_MULTIROTATION_DOUBLE"))); - QPixmap image2(aResMgr->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_MULTIROTATION_SIMPLE" ) ) ); + QPixmap image1( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_MULTIROTATION_DOUBLE" ) ) ); + QPixmap image2( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); - setWindowTitle(tr("GEOM_MULTIROTATION_TITLE")); + setWindowTitle( tr( "GEOM_MULTIROTATION_TITLE" ) ); /***************************************************************/ - GroupConstructors->setTitle(tr("GEOM_MULTIROTATION")); - RadioButton1->setIcon(image0); - RadioButton2->setIcon(image1); - RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); - RadioButton3->close(); - - GroupPoints = new DlgRef_2Sel1Spin(this, "GroupPoints"); - GroupPoints->GroupBox1->setTitle(tr("GEOM_MULTIROTATION_SIMPLE")); - GroupPoints->TextLabel1->setText(tr("GEOM_MAIN_OBJECT")); - GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR")); - GroupPoints->TextLabel3->setText(tr("GEOM_NB_TIMES")); - GroupPoints->PushButton1->setIcon(image2); - GroupPoints->PushButton2->setIcon(image2); - GroupPoints->LineEdit1->setReadOnly(true); - GroupPoints->LineEdit2->setReadOnly(true); - - GroupDimensions = new DlgRef_2Sel4Spin1Check(this, "GroupDimensions"); - GroupDimensions->GroupBox1->setTitle(tr("GEOM_MULTIROTATION_DOUBLE")); - GroupDimensions->TextLabel1->setText(tr("GEOM_MAIN_OBJECT")); - GroupDimensions->TextLabel2->setText(tr("GEOM_VECTOR")); - GroupDimensions->TextLabel3->setText(tr("GEOM_ANGLE")); - GroupDimensions->TextLabel4->setText(tr("GEOM_NB_TIMES")); - GroupDimensions->TextLabel5->setText(tr("GEOM_STEP")); - GroupDimensions->TextLabel6->setText(tr("GEOM_NB_TIMES")); - GroupDimensions->CheckButton1->setText(tr("GEOM_REVERSE")); - GroupDimensions->PushButton1->setIcon(image2); - GroupDimensions->PushButton2->setIcon(image2); - GroupDimensions->LineEdit1->setReadOnly(true); - GroupDimensions->LineEdit2->setReadOnly(true); - - gridLayout1->addWidget(GroupPoints, 2, 0); - gridLayout1->addWidget(GroupDimensions, 2, 0); + mainFrame()->GroupConstructors->setTitle( tr( "GEOM_MULTIROTATION" ) ); + mainFrame()->RadioButton1->setIcon( image0 ); + mainFrame()->RadioButton2->setIcon( image1 ); + mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); + mainFrame()->RadioButton3->close(); + + GroupPoints = new DlgRef_2Sel1Spin( centralWidget() ); + GroupPoints->GroupBox1->setTitle( tr( "GEOM_MULTIROTATION_SIMPLE" ) ); + GroupPoints->TextLabel1->setText( tr( "GEOM_MAIN_OBJECT" ) ); + GroupPoints->TextLabel2->setText( tr( "GEOM_VECTOR" ) ); + GroupPoints->TextLabel3->setText( tr( "GEOM_NB_TIMES" ) ); + GroupPoints->PushButton1->setIcon( image2 ); + GroupPoints->PushButton2->setIcon( image2 ); + GroupPoints->LineEdit1->setReadOnly( true ); + GroupPoints->LineEdit2->setReadOnly( true ); + + GroupDimensions = new DlgRef_2Sel4Spin1Check( centralWidget() ); + GroupDimensions->GroupBox1->setTitle( tr( "GEOM_MULTIROTATION_DOUBLE" ) ); + GroupDimensions->TextLabel1->setText( tr( "GEOM_MAIN_OBJECT" ) ); + GroupDimensions->TextLabel2->setText( tr( "GEOM_VECTOR" ) ); + GroupDimensions->TextLabel3->setText( tr( "GEOM_ANGLE" ) ); + GroupDimensions->TextLabel4->setText( tr( "GEOM_NB_TIMES" ) ); + GroupDimensions->TextLabel5->setText( tr( "GEOM_STEP" ) ); + GroupDimensions->TextLabel6->setText( tr( "GEOM_NB_TIMES" ) ); + GroupDimensions->CheckButton1->setText( tr( "GEOM_REVERSE" ) ); + GroupDimensions->PushButton1->setIcon( image2 ); + GroupDimensions->PushButton2->setIcon( image2 ); + GroupDimensions->LineEdit1->setReadOnly( true ); + GroupDimensions->LineEdit2->setReadOnly( true ); + + QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); + layout->setMargin( 0 ); layout->setSpacing( 6 ); + layout->addWidget( GroupPoints ); + layout->addWidget( GroupDimensions ); /***************************************************************/ - setHelpFileName("multi_rotation.htm"); + setHelpFileName( "multi_rotation.htm" ); Init(); } @@ -120,56 +115,60 @@ void TransformationGUI_MultiRotationDlg::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 SpecificStep1 = 5; double SpecificStep2 = 1; /* min, max, step and decimals for spin boxes & initial values */ - GroupPoints->SpinBox_DX->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep2, 3); - GroupPoints->SpinBox_DX->SetValue(myNbTimes1); - - GroupDimensions->SpinBox_DX1->RangeStepAndValidator(COORD_MIN, COORD_MAX, SpecificStep1, 3); - GroupDimensions->SpinBox_DY1->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep2, 3); - GroupDimensions->SpinBox_DX2->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - GroupDimensions->SpinBox_DY2->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep2, 3); - GroupDimensions->SpinBox_DX1->SetValue(myAng); - GroupDimensions->SpinBox_DY1->SetValue(myNbTimes1); - GroupDimensions->SpinBox_DX2->SetValue(myStep); - GroupDimensions->SpinBox_DY2->SetValue(myNbTimes2); + initSpinBox( GroupPoints->SpinBox_DX, 1.0, MAX_NUMBER, SpecificStep2, 3 ); + GroupPoints->SpinBox_DX->setValue( myNbTimes1 ); + + initSpinBox( GroupDimensions->SpinBox_DX1, COORD_MIN, COORD_MAX, SpecificStep1, 3 ); + initSpinBox( GroupDimensions->SpinBox_DY1, 1.0, MAX_NUMBER, SpecificStep2, 3 ); + initSpinBox( GroupDimensions->SpinBox_DX2, COORD_MIN, COORD_MAX, step, 3 ); + initSpinBox( GroupDimensions->SpinBox_DY2, 1.0, MAX_NUMBER, SpecificStep2, 3 ); + GroupDimensions->SpinBox_DX1->setValue( myAng ); + GroupDimensions->SpinBox_DY1->setValue( myNbTimes1 ); + GroupDimensions->SpinBox_DX2->setValue( myStep ); + GroupDimensions->SpinBox_DY2->setValue( myNbTimes2 ); /* signals and slots connections */ - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); - connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); - - connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupDimensions->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupDimensions->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - - connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupDimensions->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupDimensions->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - - connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(GroupDimensions->SpinBox_DX1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(GroupDimensions->SpinBox_DY1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(GroupDimensions->SpinBox_DX2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(GroupDimensions->SpinBox_DY2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX1, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY1, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX2, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY2, SLOT(SetStep(double))); - - connect(GroupDimensions->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseAngle())); + connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); + + connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) ); + + connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( GroupDimensions->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( GroupDimensions->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + + connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( GroupDimensions->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( GroupDimensions->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + + connect( GroupPoints->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( GroupDimensions->SpinBox_DX1, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( GroupDimensions->SpinBox_DY1, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( GroupDimensions->SpinBox_DX2, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( GroupDimensions->SpinBox_DY2, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + + // VSR: TODO ->> + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupPoints->SpinBox_DX, SLOT( SetStep( double ) ) ); + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupDimensions->SpinBox_DX1, SLOT( SetStep( double ) ) ); + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupDimensions->SpinBox_DY1, SLOT( SetStep( double ) ) ); + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupDimensions->SpinBox_DX2, SLOT( SetStep( double ) ) ); + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupDimensions->SpinBox_DY2, SLOT( SetStep( double ) ) ); + // <<- + + connect( GroupDimensions->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( ReverseAngle() ) ); - connect(myGeomGUI->getApp()->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect( myGeomGUI->getApp()->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + + initName( tr( "GEOM_MULTIROTATION" ) ); - initName( tr( "GEOM_MULTIROTATION" ).toLatin1().constData() ); ConstructorsClicked( 0 ); } @@ -178,9 +177,9 @@ void TransformationGUI_MultiRotationDlg::Init() // function : ConstructorsClicked() // purpose : Radio button management //================================================================================= -void TransformationGUI_MultiRotationDlg::ConstructorsClicked(int constructorId) +void TransformationGUI_MultiRotationDlg::ConstructorsClicked( int constructorId ) { - disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); + disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 ); myAng = 45.0; myStep = 50.0; @@ -188,45 +187,46 @@ void TransformationGUI_MultiRotationDlg::ConstructorsClicked(int constructorId) globalSelection( GEOM_ALLSHAPES ); - switch (constructorId) + switch ( constructorId ) { + case 0: /* Rotate simple */ { - case 0: /* Rotate simple */ - { - GroupDimensions->hide(); - resize(0, 0); - GroupPoints->show(); - - myEditCurrentArgument = GroupPoints->LineEdit1; - GroupPoints->LineEdit1->setText(""); - GroupPoints->LineEdit2->setText(""); - - GroupPoints->SpinBox_DX->SetValue(myNbTimes1); - - break; - } - case 1: /* Rotate double */ - { - GroupPoints->hide(); - resize(0, 0); - GroupDimensions->show(); - - myEditCurrentArgument = GroupDimensions->LineEdit1; - GroupDimensions->LineEdit1->setText(""); - GroupDimensions->LineEdit2->setText(""); - - GroupDimensions->SpinBox_DX1->SetValue(myAng); - GroupDimensions->SpinBox_DY1->SetValue(myNbTimes1); - GroupDimensions->SpinBox_DX2->SetValue(myStep); - GroupDimensions->SpinBox_DY2->SetValue(myNbTimes2); - - break; - } + GroupDimensions->hide(); + GroupPoints->show(); + + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->setText( "" ); + GroupPoints->LineEdit2->setText( "" ); + + GroupPoints->SpinBox_DX->setValue( myNbTimes1 ); + + break; } + case 1: /* Rotate double */ + { + GroupPoints->hide(); + GroupDimensions->show(); + + myEditCurrentArgument = GroupDimensions->LineEdit1; + GroupDimensions->LineEdit1->setText( "" ); + GroupDimensions->LineEdit2->setText( "" ); + + GroupDimensions->SpinBox_DX1->setValue( myAng ); + GroupDimensions->SpinBox_DY1->setValue( myNbTimes1 ); + GroupDimensions->SpinBox_DX2->setValue( myStep ); + GroupDimensions->SpinBox_DY2->setValue( myNbTimes2 ); + + break; + } + } + + qApp->processEvents(); + updateGeometry(); + resize( minimumSize() ); myEditCurrentArgument->setFocus(); myBase = myVector = GEOM::GEOM_Object::_nil(); - connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), - this, SLOT(SelectionIntoArgument())); + connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), + this, SLOT( SelectionIntoArgument() ) ); } @@ -262,14 +262,14 @@ bool TransformationGUI_MultiRotationDlg::ClickOnApply() //================================================================================= void TransformationGUI_MultiRotationDlg::SelectionIntoArgument() { - myEditCurrentArgument->setText(""); + myEditCurrentArgument->setText( "" ); - if (IObjectCount() != 1) { - if (myEditCurrentArgument == GroupPoints->LineEdit1 || - myEditCurrentArgument == GroupDimensions->LineEdit1) + if ( IObjectCount() != 1 ) { + if ( myEditCurrentArgument == GroupPoints->LineEdit1 || + myEditCurrentArgument == GroupDimensions->LineEdit1 ) myBase = GEOM::GEOM_Object::_nil(); - else if (myEditCurrentArgument == GroupPoints->LineEdit2 || - myEditCurrentArgument == GroupDimensions->LineEdit2) + else if ( myEditCurrentArgument == GroupPoints->LineEdit2 || + myEditCurrentArgument == GroupDimensions->LineEdit2 ) myVector = GEOM::GEOM_Object::_nil(); return; } @@ -277,16 +277,16 @@ void TransformationGUI_MultiRotationDlg::SelectionIntoArgument() // nbSel == 1 Standard_Boolean testResult = Standard_False;; GEOM::GEOM_Object_var aSelectedObject = - GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); + GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); - if (!testResult || CORBA::is_nil(aSelectedObject) || !GEOMBase::IsShape(aSelectedObject)) + if ( !testResult || CORBA::is_nil( aSelectedObject) || !GEOMBase::IsShape( aSelectedObject ) ) return; - if (myEditCurrentArgument == GroupPoints->LineEdit1 || - myEditCurrentArgument == GroupDimensions->LineEdit1) + if ( myEditCurrentArgument == GroupPoints->LineEdit1 || + myEditCurrentArgument == GroupDimensions->LineEdit1 ) myBase = aSelectedObject; - else if (myEditCurrentArgument == GroupPoints->LineEdit2 || - myEditCurrentArgument == GroupDimensions->LineEdit2) + else if ( myEditCurrentArgument == GroupPoints->LineEdit2 || + myEditCurrentArgument == GroupDimensions->LineEdit2 ) myVector = aSelectedObject; myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); @@ -303,19 +303,19 @@ void TransformationGUI_MultiRotationDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - if(send == GroupPoints->PushButton1) { + if ( send == GroupPoints->PushButton1 ) { myEditCurrentArgument = GroupPoints->LineEdit1; globalSelection( GEOM_ALLSHAPES ); } - else if(send == GroupPoints->PushButton2) { + else if ( send == GroupPoints->PushButton2 ) { myEditCurrentArgument = GroupPoints->LineEdit2; globalSelection( GEOM_LINE ); } - else if(send == GroupDimensions->PushButton1) { + else if ( send == GroupDimensions->PushButton1 ) { myEditCurrentArgument = GroupDimensions->LineEdit1; globalSelection( GEOM_ALLSHAPES ); } - else if(send == GroupDimensions->PushButton2) { + else if ( send == GroupDimensions->PushButton2 ) { myEditCurrentArgument = GroupDimensions->LineEdit2; globalSelection( GEOM_LINE ); } @@ -332,12 +332,11 @@ void TransformationGUI_MultiRotationDlg::SetEditCurrentArgument() void TransformationGUI_MultiRotationDlg::LineEditReturnPressed() { QLineEdit* send = (QLineEdit*)sender(); - if(send == GroupPoints->LineEdit1 || send == GroupDimensions->LineEdit1 || - send == GroupPoints->LineEdit2 || send == GroupDimensions->LineEdit2) - { - myEditCurrentArgument = send; - GEOMBase_Skeleton::LineEditReturnPressed(); - } + if ( send == GroupPoints->LineEdit1 || send == GroupDimensions->LineEdit1 || + send == GroupPoints->LineEdit2 || send == GroupDimensions->LineEdit2 ) { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } } @@ -348,8 +347,8 @@ void TransformationGUI_MultiRotationDlg::LineEditReturnPressed() void TransformationGUI_MultiRotationDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(myGeomGUI->getApp()->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect( myGeomGUI->getApp()->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); ConstructorsClicked( getConstructorId() ); } @@ -359,9 +358,9 @@ void TransformationGUI_MultiRotationDlg::ActivateThisDialog() // function : enterEvent() // purpose : //================================================================================= -void TransformationGUI_MultiRotationDlg::enterEvent(QEvent* e) +void TransformationGUI_MultiRotationDlg::enterEvent( QEvent* ) { - if(!GroupConstructors->isEnabled()) + if( !mainFrame()->GroupConstructors->isEnabled() ) ActivateThisDialog(); } @@ -370,17 +369,17 @@ void TransformationGUI_MultiRotationDlg::enterEvent(QEvent* e) // function : ValueChangedInSpinBox() // purpose : //================================================================================= -void TransformationGUI_MultiRotationDlg::ValueChangedInSpinBox(double newValue) +void TransformationGUI_MultiRotationDlg::ValueChangedInSpinBox( double newValue ) { QObject* send = (QObject*)sender(); - if(send == GroupPoints->SpinBox_DX || send == GroupDimensions->SpinBox_DY1) + if ( send == GroupPoints->SpinBox_DX || send == GroupDimensions->SpinBox_DY1 ) myNbTimes1 = (int)newValue; - else if(send == GroupDimensions->SpinBox_DX1) + else if ( send == GroupDimensions->SpinBox_DX1 ) myAng = newValue; - else if(send == GroupDimensions->SpinBox_DX2) + else if ( send == GroupDimensions->SpinBox_DX2 ) myStep = newValue; - else if(send == GroupDimensions->SpinBox_DY2) + else if ( send == GroupDimensions->SpinBox_DY2 ) myNbTimes2 = (int)newValue; displayPreview(); @@ -397,10 +396,10 @@ void TransformationGUI_MultiRotationDlg::ReverseAngle() int aConstructorId = getConstructorId(); - if(aConstructorId == 0) - GroupPoints->SpinBox_DX->SetValue(myAng); - else if(aConstructorId == 1) - GroupDimensions->SpinBox_DX1->SetValue(myAng); + if ( aConstructorId == 0 ) + GroupPoints->SpinBox_DX->setValue( myAng ); + else if ( aConstructorId == 1 ) + GroupDimensions->SpinBox_DX1->setValue( myAng ); displayPreview(); } @@ -420,9 +419,9 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_MultiRotationDlg::createOperation() // function : isValid // purpose : //================================================================================= -bool TransformationGUI_MultiRotationDlg::isValid( QString& msg ) +bool TransformationGUI_MultiRotationDlg::isValid( QString& /*msg*/ ) { - return !(myBase->_is_nil() || myVector->_is_nil()); + return !( myBase->_is_nil() || myVector->_is_nil() ); } //================================================================================= @@ -435,28 +434,22 @@ bool TransformationGUI_MultiRotationDlg::execute( ObjectList& objects ) GEOM::GEOM_Object_var anObj; - switch ( getConstructorId() ) - { - case 0 : - { - if ( !CORBA::is_nil( myBase ) && !CORBA::is_nil( myVector ) ) { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )-> - MultiRotate1D( myBase, myVector, myNbTimes1 ); - res = true; - } - break; - } - case 1 : - { - if ( !CORBA::is_nil( myBase ) && !CORBA::is_nil( myVector ) ) - { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )-> - MultiRotate2D( myBase, myVector, myAng, myNbTimes1, myStep, myNbTimes2 ); - res = true; - } - break; - } + switch ( getConstructorId() ) { + case 0 : + if ( !CORBA::is_nil( myBase ) && !CORBA::is_nil( myVector ) ) { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )-> + MultiRotate1D( myBase, myVector, myNbTimes1 ); + res = true; + } + break; + case 1 : + if ( !CORBA::is_nil( myBase ) && !CORBA::is_nil( myVector ) ) { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )-> + MultiRotate2D( myBase, myVector, myAng, myNbTimes1, myStep, myNbTimes2 ); + res = true; } + break; + } if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); @@ -469,7 +462,7 @@ bool TransformationGUI_MultiRotationDlg::execute( ObjectList& objects ) // function : closeEvent // purpose : //================================================================================= -void TransformationGUI_MultiRotationDlg::closeEvent( QCloseEvent* e ) +void TransformationGUI_MultiRotationDlg::closeEvent( QCloseEvent* e ) { // myGeomGUI->SetState( -1 ); GEOMBase_Skeleton::closeEvent( e ); diff --git a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.h b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.h index 9a61d3fd8..8f6f4f0b9 100644 --- a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.h +++ b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.h @@ -1,34 +1,32 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : TransformationGUI_MultiRotationDlg.h +// Author : Damien COQUERET, Open CASCADE S.A.S. // -// -// File : TransformationGUI_MultiRotationDlg.h -// Author : Damien COQUERET -// Module : GEOM -#ifndef DIALOGBOX_MULTIROTATION_H -#define DIALOGBOX_MULTIROTATION_H +#ifndef TRANSFORMATIONGUI_MULTIROTATIONDLG_H +#define TRANSFORMATIONGUI_MULTIROTATIONDLG_H -#include "GEOMBase_Skeleton.h" +#include class DlgRef_2Sel4Spin1Check; class DlgRef_2Sel1Spin; @@ -39,44 +37,45 @@ class DlgRef_2Sel1Spin; //================================================================================= class TransformationGUI_MultiRotationDlg : public GEOMBase_Skeleton { - Q_OBJECT + Q_OBJECT public: - TransformationGUI_MultiRotationDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, - const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0); - ~TransformationGUI_MultiRotationDlg(); - + TransformationGUI_MultiRotationDlg( GeometryGUI*, QWidget* = 0, + bool = false, Qt::WindowFlags = 0 ); + ~TransformationGUI_MultiRotationDlg(); + 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); + // redefined from GEOMBase_Helper + virtual GEOM::GEOM_IOperations_ptr createOperation(); + virtual bool isValid( QString& ); + virtual bool execute( ObjectList& ); + + virtual void closeEvent( QCloseEvent* ); - GEOM::GEOM_Object_var myBase, myVector; - int myNbTimes1; - int myNbTimes2; - Standard_Real myAng; - Standard_Real myStep; - - DlgRef_2Sel1Spin* GroupPoints; - DlgRef_2Sel4Spin1Check* GroupDimensions; +private: + void Init(); + void enterEvent( QEvent* ); + +private: + GEOM::GEOM_Object_var myBase, myVector; + int myNbTimes1; + int myNbTimes2; + Standard_Real myAng; + Standard_Real myStep; + + DlgRef_2Sel1Spin* GroupPoints; + DlgRef_2Sel4Spin1Check* GroupDimensions; private slots: - void ClickOnOk(); - bool ClickOnApply(); - void ActivateThisDialog(); - void LineEditReturnPressed(); - void SelectionIntoArgument(); - void SetEditCurrentArgument(); - void ReverseAngle(); - void ValueChangedInSpinBox(double newValue); - void ConstructorsClicked(int constructorId); + void ClickOnOk(); + bool ClickOnApply(); + void ActivateThisDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ReverseAngle(); + void ValueChangedInSpinBox( double ); + void ConstructorsClicked( int ); }; -#endif // DIALOGBOX_MULTIROTATION_H +#endif // TRANSFORMATIONGUI_MULTIROTATIONDLG_H diff --git a/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx index 74d5b742e..395a42fc7 100644 --- a/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx @@ -1,47 +1,40 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : TransformationGUI_MultiTranslationDlg.cxx +// Author : Damien COQUERET, Open CASCADE S.A.S. // -// -// File : TransformationGUI_MultiTranslationDlg.cxx -// Author : Damien COQUERET -// Module : GEOM -// $Header$ #include "TransformationGUI_MultiTranslationDlg.h" -#include "DlgRef_2Sel2Spin1Check.h" -#include "DlgRef_3Sel4Spin2Check.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 : TransformationGUI_MultiTranslationDlg() @@ -51,58 +44,60 @@ using namespace std; // TRUE to construct a modal dialog. //================================================================================= TransformationGUI_MultiTranslationDlg::TransformationGUI_MultiTranslationDlg - (GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl) - :GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) +( GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl ) + : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ) { SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr(); - QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_MULTITRANSLATION_SIMPLE"))); - QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_MULTITRANSLATION_DOUBLE"))); - QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT"))); + QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_MULTITRANSLATION_SIMPLE" ) ) ); + QPixmap image1( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_MULTITRANSLATION_DOUBLE" ) ) ); + QPixmap image2( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); - setWindowTitle(tr("GEOM_MULTITRANSLATION_TITLE")); + setWindowTitle( tr( "GEOM_MULTITRANSLATION_TITLE" ) ); /***************************************************************/ - GroupConstructors->setTitle(tr("GEOM_MULTITRANSLATION")); - RadioButton1->setIcon(image0); - RadioButton2->setIcon(image1); - RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); - RadioButton3->close(); - - GroupPoints = new DlgRef_2Sel2Spin1Check(this, "GroupPoints"); - GroupPoints->GroupBox1->setTitle(tr("GEOM_MULTITRANSLATION_SIMPLE")); - GroupPoints->TextLabel1->setText(tr("GEOM_MAIN_OBJECT")); - GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR_U")); - GroupPoints->TextLabel3->setText(tr("GEOM_STEP_U")); - GroupPoints->TextLabel4->setText(tr("GEOM_NB_TIMES_U")); - GroupPoints->CheckButton1->setText(tr("GEOM_REVERSE_U")); - GroupPoints->PushButton1->setIcon(image2); - GroupPoints->PushButton2->setIcon(image2); - GroupPoints->LineEdit1->setReadOnly(true); - GroupPoints->LineEdit2->setReadOnly(true); - - GroupDimensions = new DlgRef_3Sel4Spin2Check(this, "GroupDimensions"); - GroupDimensions->GroupBox1->setTitle(tr("GEOM_MULTITRANSLATION_DOUBLE")); - GroupDimensions->TextLabel1->setText(tr("GEOM_MAIN_OBJECT")); - GroupDimensions->TextLabel2->setText(tr("GEOM_VECTOR_U")); - GroupDimensions->TextLabel3->setText(tr("GEOM_VECTOR_V")); - GroupDimensions->TextLabel4->setText(tr("GEOM_STEP_U")); - GroupDimensions->TextLabel5->setText(tr("GEOM_NB_TIMES_U")); - GroupDimensions->TextLabel6->setText(tr("GEOM_STEP_V")); - GroupDimensions->TextLabel7->setText(tr("GEOM_NB_TIMES_V")); - GroupDimensions->CheckButton1->setText(tr("GEOM_REVERSE_U")); - GroupDimensions->CheckButton2->setText(tr("GEOM_REVERSE_V")); - GroupDimensions->PushButton1->setIcon(image2); - GroupDimensions->PushButton2->setIcon(image2); - GroupDimensions->PushButton3->setIcon(image2); - GroupDimensions->LineEdit1->setReadOnly(true); - GroupDimensions->LineEdit2->setReadOnly(true); - GroupDimensions->LineEdit3->setReadOnly(true); - - gridLayout1->addWidget(GroupPoints, 2, 0); - gridLayout1->addWidget(GroupDimensions, 2, 0); + mainFrame()->GroupConstructors->setTitle( tr( "GEOM_MULTITRANSLATION" ) ); + mainFrame()->RadioButton1->setIcon( image0 ); + mainFrame()->RadioButton2->setIcon( image1 ); + mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); + mainFrame()->RadioButton3->close(); + + GroupPoints = new DlgRef_2Sel2Spin1Check( centralWidget() ); + GroupPoints->GroupBox1->setTitle( tr( "GEOM_MULTITRANSLATION_SIMPLE" ) ); + GroupPoints->TextLabel1->setText( tr( "GEOM_MAIN_OBJECT" ) ); + GroupPoints->TextLabel2->setText( tr( "GEOM_VECTOR_U" ) ); + GroupPoints->TextLabel3->setText( tr( "GEOM_STEP_U" ) ); + GroupPoints->TextLabel4->setText( tr( "GEOM_NB_TIMES_U" ) ); + GroupPoints->CheckButton1->setText( tr( "GEOM_REVERSE_U" ) ); + GroupPoints->PushButton1->setIcon( image2 ); + GroupPoints->PushButton2->setIcon( image2 ); + GroupPoints->LineEdit1->setReadOnly( true ); + GroupPoints->LineEdit2->setReadOnly( true ); + + GroupDimensions = new DlgRef_3Sel4Spin2Check( centralWidget() ); + GroupDimensions->GroupBox1->setTitle( tr( "GEOM_MULTITRANSLATION_DOUBLE" ) ); + GroupDimensions->TextLabel1->setText( tr( "GEOM_MAIN_OBJECT" ) ); + GroupDimensions->TextLabel2->setText( tr( "GEOM_VECTOR_U" ) ); + GroupDimensions->TextLabel3->setText( tr( "GEOM_VECTOR_V" ) ); + GroupDimensions->TextLabel4->setText( tr( "GEOM_STEP_U" ) ); + GroupDimensions->TextLabel5->setText( tr( "GEOM_NB_TIMES_U" ) ); + GroupDimensions->TextLabel6->setText( tr( "GEOM_STEP_V" ) ); + GroupDimensions->TextLabel7->setText( tr( "GEOM_NB_TIMES_V" ) ); + GroupDimensions->CheckButton1->setText( tr( "GEOM_REVERSE_U" ) ); + GroupDimensions->CheckButton2->setText( tr( "GEOM_REVERSE_V" ) ); + GroupDimensions->PushButton1->setIcon( image2 ); + GroupDimensions->PushButton2->setIcon( image2 ); + GroupDimensions->PushButton3->setIcon( image2 ); + GroupDimensions->LineEdit1->setReadOnly( true ); + GroupDimensions->LineEdit2->setReadOnly( true ); + GroupDimensions->LineEdit3->setReadOnly( true ); + + QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); + layout->setMargin( 0 ); layout->setSpacing( 6 ); + layout->addWidget( GroupPoints ); + layout->addWidget( GroupDimensions ); /***************************************************************/ - setHelpFileName("multi_translation.htm"); + setHelpFileName( "multi_translation.htm" ); Init(); } @@ -126,64 +121,68 @@ void TransformationGUI_MultiTranslationDlg::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 SpecificStep = 1; /* min, max, step and decimals for spin boxes & initial values */ - GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - GroupPoints->SpinBox_DY->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep, 3); - GroupPoints->SpinBox_DX->SetValue(myStepU); - GroupPoints->SpinBox_DY->SetValue(myNbTimesU); - - GroupDimensions->SpinBox_DX1->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - GroupDimensions->SpinBox_DY1->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep, 3); - GroupDimensions->SpinBox_DX2->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - GroupDimensions->SpinBox_DY2->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep, 3); - GroupDimensions->SpinBox_DX1->SetValue(myStepU); - GroupDimensions->SpinBox_DY1->SetValue(myNbTimesU); - GroupDimensions->SpinBox_DX2->SetValue(myStepV); - GroupDimensions->SpinBox_DY2->SetValue(myNbTimesV); + initSpinBox( GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, step, 3 ); + initSpinBox( GroupPoints->SpinBox_DY, 1.0, MAX_NUMBER, SpecificStep, 3 ); + GroupPoints->SpinBox_DX->setValue( myStepU ); + GroupPoints->SpinBox_DY->setValue( myNbTimesU ); + + initSpinBox( GroupDimensions->SpinBox_DX1, COORD_MIN, COORD_MAX, step, 3 ); + initSpinBox( GroupDimensions->SpinBox_DY1, 1.0, MAX_NUMBER, SpecificStep, 3 ); + initSpinBox( GroupDimensions->SpinBox_DX2, COORD_MIN, COORD_MAX, step, 3 ); + initSpinBox( GroupDimensions->SpinBox_DY2, 1.0, MAX_NUMBER, SpecificStep, 3 ); + GroupDimensions->SpinBox_DX1->setValue( myStepU ); + GroupDimensions->SpinBox_DY1->setValue( myNbTimesU ); + GroupDimensions->SpinBox_DX2->setValue( myStepV ); + GroupDimensions->SpinBox_DY2->setValue( myNbTimesV ); /* signals and slots connections */ - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); - connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); - - connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupDimensions->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupDimensions->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupDimensions->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - - connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupDimensions->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupDimensions->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupDimensions->LineEdit3, 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(GroupDimensions->SpinBox_DX1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(GroupDimensions->SpinBox_DY1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(GroupDimensions->SpinBox_DX2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(GroupDimensions->SpinBox_DY2, 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))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX1, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY1, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX2, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY2, SLOT(SetStep(double))); - - connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseStepU())); - connect(GroupDimensions->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseStepU())); - connect(GroupDimensions->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(ReverseStepV())); + connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); + + connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) ); + + connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( GroupDimensions->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( GroupDimensions->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( GroupDimensions->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + + connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( GroupDimensions->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( GroupDimensions->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( GroupDimensions->LineEdit3, 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( GroupDimensions->SpinBox_DX1, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( GroupDimensions->SpinBox_DY1, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( GroupDimensions->SpinBox_DX2, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( GroupDimensions->SpinBox_DY2, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + + // VSR: TODO ->> + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupPoints->SpinBox_DX, SLOT( SetStep( double ) ) ); + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupPoints->SpinBox_DY, SLOT( SetStep( double ) ) ); + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupDimensions->SpinBox_DX1, SLOT( SetStep( double ) ) ); + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupDimensions->SpinBox_DY1, SLOT( SetStep( double ) ) ); + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupDimensions->SpinBox_DX2, SLOT( SetStep( double ) ) ); + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupDimensions->SpinBox_DY2, SLOT( SetStep( double ) ) ); + // <<- + + connect( GroupPoints->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( ReverseStepU() ) ); + connect( GroupDimensions->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( ReverseStepU() ) ); + connect( GroupDimensions->CheckButton2, SIGNAL( toggled( bool ) ), this, SLOT( ReverseStepV() ) ); - connect(myGeomGUI->getApp()->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect( myGeomGUI->getApp()->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - initName( tr( "GEOM_MULTITRANSLATION" ).toLatin1().constData() ); + initName( tr( "GEOM_MULTITRANSLATION" ) ); + ConstructorsClicked( 0 ); } @@ -192,57 +191,58 @@ void TransformationGUI_MultiTranslationDlg::Init() // function : ConstructorsClicked() // purpose : Radio button management //================================================================================= -void TransformationGUI_MultiTranslationDlg::ConstructorsClicked(int constructorId) +void TransformationGUI_MultiTranslationDlg::ConstructorsClicked( int constructorId ) { - disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); + disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 ); myStepU = myStepV = 50.0; myNbTimesU = myNbTimesV = 2; globalSelection( GEOM_ALLSHAPES ); - switch (constructorId) + switch ( constructorId ) { + case 0: /* Translate simple */ { - case 0: /* Translate simple */ - { - GroupDimensions->hide(); - resize(0, 0); - GroupPoints->show(); - - myEditCurrentArgument = GroupPoints->LineEdit1; - GroupPoints->LineEdit1->setText(""); - GroupPoints->LineEdit2->setText(""); - - GroupPoints->SpinBox_DX->SetValue(myStepU); - GroupPoints->SpinBox_DY->SetValue(myNbTimesU); + GroupDimensions->hide(); + GroupPoints->show(); + + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->setText( "" ); + GroupPoints->LineEdit2->setText( "" ); + + GroupPoints->SpinBox_DX->setValue( myStepU ); + GroupPoints->SpinBox_DY->setValue( myNbTimesU ); - break; - } - case 1: /* Translate double */ - { - GroupPoints->hide(); - resize(0, 0); - GroupDimensions->show(); - - myEditCurrentArgument = GroupDimensions->LineEdit1; - GroupDimensions->LineEdit1->setText(""); - GroupDimensions->LineEdit2->setText(""); - GroupDimensions->LineEdit3->setText(""); - - GroupDimensions->SpinBox_DX1->SetValue(myStepU); - GroupDimensions->SpinBox_DY1->SetValue(myNbTimesU); - GroupDimensions->SpinBox_DX2->SetValue(myStepV); - GroupDimensions->SpinBox_DY2->SetValue(myNbTimesV); + break; + } + case 1: /* Translate double */ + { + GroupPoints->hide(); + GroupDimensions->show(); + + myEditCurrentArgument = GroupDimensions->LineEdit1; + GroupDimensions->LineEdit1->setText( "" ); + GroupDimensions->LineEdit2->setText( "" ); + GroupDimensions->LineEdit3->setText( "" ); + + GroupDimensions->SpinBox_DX1->setValue( myStepU ); + GroupDimensions->SpinBox_DY1->setValue( myNbTimesU ); + GroupDimensions->SpinBox_DX2->setValue( myStepV ); + GroupDimensions->SpinBox_DY2->setValue( myNbTimesV ); - myVectorV = GEOM::GEOM_Object::_nil(); - break; - } + myVectorV = GEOM::GEOM_Object::_nil(); + break; } + } + qApp->processEvents(); + updateGeometry(); + resize( minimumSize() ); + myEditCurrentArgument->setFocus(); myBase = myVectorU = GEOM::GEOM_Object::_nil(); - connect(myGeomGUI->getApp()->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect( myGeomGUI->getApp()->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); } @@ -278,30 +278,34 @@ bool TransformationGUI_MultiTranslationDlg::ClickOnApply() //================================================================================= void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument() { - myEditCurrentArgument->setText(""); + myEditCurrentArgument->setText( "" ); - if(IObjectCount() != 1) { - if(myEditCurrentArgument == GroupPoints->LineEdit1 || myEditCurrentArgument == GroupDimensions->LineEdit1) + if ( IObjectCount() != 1 ) { + if ( myEditCurrentArgument == GroupPoints->LineEdit1 || + myEditCurrentArgument == GroupDimensions->LineEdit1 ) myBase = GEOM::GEOM_Object::_nil(); - else if(myEditCurrentArgument == GroupPoints->LineEdit2 || myEditCurrentArgument == GroupDimensions->LineEdit2) + else if ( myEditCurrentArgument == GroupPoints->LineEdit2 || + myEditCurrentArgument == GroupDimensions->LineEdit2 ) myVectorU = GEOM::GEOM_Object::_nil(); - else if(myEditCurrentArgument == GroupDimensions->LineEdit3) + else if ( myEditCurrentArgument == GroupDimensions->LineEdit3 ) myVectorV = GEOM::GEOM_Object::_nil(); return; } // nbSel == 1 Standard_Boolean testResult = Standard_False;; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); if ( !testResult || CORBA::is_nil( aSelectedObject ) || !GEOMBase::IsShape( aSelectedObject ) ) return; - if(myEditCurrentArgument == GroupPoints->LineEdit1 || myEditCurrentArgument == GroupDimensions->LineEdit1) + if ( myEditCurrentArgument == GroupPoints->LineEdit1 || + myEditCurrentArgument == GroupDimensions->LineEdit1 ) myBase = aSelectedObject; - else if(myEditCurrentArgument == GroupPoints->LineEdit2 || myEditCurrentArgument == GroupDimensions->LineEdit2) + else if ( myEditCurrentArgument == GroupPoints->LineEdit2 || + myEditCurrentArgument == GroupDimensions->LineEdit2 ) myVectorU = aSelectedObject; - else if(myEditCurrentArgument == GroupDimensions->LineEdit3) + else if ( myEditCurrentArgument == GroupDimensions->LineEdit3 ) myVectorV = aSelectedObject; myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); @@ -319,23 +323,23 @@ void TransformationGUI_MultiTranslationDlg::SetEditCurrentArgument() QPushButton* send = (QPushButton*)sender(); - if(send == GroupPoints->PushButton1) { + if ( send == GroupPoints->PushButton1 ) { myEditCurrentArgument = GroupPoints->LineEdit1; globalSelection( GEOM_ALLSHAPES ); } - else if(send == GroupPoints->PushButton2) { + else if ( send == GroupPoints->PushButton2 ) { myEditCurrentArgument = GroupPoints->LineEdit2; globalSelection( GEOM_LINE ); } - else if(send == GroupDimensions->PushButton1) { + else if ( send == GroupDimensions->PushButton1 ) { myEditCurrentArgument = GroupDimensions->LineEdit1; globalSelection( GEOM_ALLSHAPES ); } - else if(send == GroupDimensions->PushButton2) { + else if ( send == GroupDimensions->PushButton2 ) { myEditCurrentArgument = GroupDimensions->LineEdit2; globalSelection( GEOM_LINE ); } - else if(send == GroupDimensions->PushButton3) { + else if ( send == GroupDimensions->PushButton3 ) { myEditCurrentArgument = GroupDimensions->LineEdit3; globalSelection( GEOM_LINE ); } @@ -352,13 +356,12 @@ void TransformationGUI_MultiTranslationDlg::SetEditCurrentArgument() void TransformationGUI_MultiTranslationDlg::LineEditReturnPressed() { QLineEdit* send = (QLineEdit*)sender(); - if(send == GroupPoints->LineEdit1 || send == GroupDimensions->LineEdit1 || - send == GroupPoints->LineEdit2 || send == GroupDimensions->LineEdit2 || - send == GroupDimensions->LineEdit3) - { - myEditCurrentArgument = send; - GEOMBase_Skeleton::LineEditReturnPressed(); - } + if ( send == GroupPoints->LineEdit1 || send == GroupDimensions->LineEdit1 || + send == GroupPoints->LineEdit2 || send == GroupDimensions->LineEdit2 || + send == GroupDimensions->LineEdit3 ) { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } } @@ -369,8 +372,8 @@ void TransformationGUI_MultiTranslationDlg::LineEditReturnPressed() void TransformationGUI_MultiTranslationDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(myGeomGUI->getApp()->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect( myGeomGUI->getApp()->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); ConstructorsClicked( getConstructorId() ); } @@ -380,9 +383,9 @@ void TransformationGUI_MultiTranslationDlg::ActivateThisDialog() // function : enterEvent() // purpose : //================================================================================= -void TransformationGUI_MultiTranslationDlg::enterEvent(QEvent* e) +void TransformationGUI_MultiTranslationDlg::enterEvent( QEvent* ) { - if(!GroupConstructors->isEnabled()) + if( !mainFrame()->GroupConstructors->isEnabled() ) ActivateThisDialog(); } @@ -391,33 +394,28 @@ void TransformationGUI_MultiTranslationDlg::enterEvent(QEvent* e) // function : ValueChangedInSpinBox() // purpose : //================================================================================= -void TransformationGUI_MultiTranslationDlg::ValueChangedInSpinBox(double newValue) +void TransformationGUI_MultiTranslationDlg::ValueChangedInSpinBox( double newValue ) { QObject* send = (QObject*)sender(); - switch(getConstructorId()) - { - case 0 : - { - if(send == GroupPoints->SpinBox_DX) - myStepU = newValue; - else if(send == GroupPoints->SpinBox_DY) - myNbTimesU = (int)newValue; - break; - } - case 1 : - { - if(send == GroupDimensions->SpinBox_DX1) - myStepU = newValue; - else if(send == GroupDimensions->SpinBox_DY1) - myNbTimesU = (int)newValue; - else if(send == GroupDimensions->SpinBox_DX2) - myStepV = newValue; - else if(send == GroupDimensions->SpinBox_DY2) - myNbTimesV = (int)newValue; - break; - } - } + switch ( getConstructorId() ) { + case 0: + if ( send == GroupPoints->SpinBox_DX ) + myStepU = newValue; + else if ( send == GroupPoints->SpinBox_DY ) + myNbTimesU = (int)newValue; + break; + case 1 : + if ( send == GroupDimensions->SpinBox_DX1 ) + myStepU = newValue; + else if ( send == GroupDimensions->SpinBox_DY1) + myNbTimesU = (int)newValue; + else if ( send == GroupDimensions->SpinBox_DX2 ) + myStepV = newValue; + else if ( send == GroupDimensions->SpinBox_DY2 ) + myNbTimesV = (int)newValue; + break; + } displayPreview(); } @@ -433,10 +431,10 @@ void TransformationGUI_MultiTranslationDlg::ReverseStepU() int aConstructorId = getConstructorId(); - if(aConstructorId == 0) - GroupPoints->SpinBox_DX->SetValue(myStepU); - else if(aConstructorId == 1) - GroupDimensions->SpinBox_DX1->SetValue(myStepU); + if ( aConstructorId == 0 ) + GroupPoints->SpinBox_DX->setValue( myStepU ); + else if ( aConstructorId == 1 ) + GroupDimensions->SpinBox_DX1->setValue( myStepU ); displayPreview(); } @@ -450,7 +448,7 @@ void TransformationGUI_MultiTranslationDlg::ReverseStepV() { myStepV = -myStepV; - GroupDimensions->SpinBox_DX2->SetValue(myStepV); + GroupDimensions->SpinBox_DX2->setValue( myStepV ); displayPreview(); } @@ -470,14 +468,14 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_MultiTranslationDlg::createOperatio // function : isValid // purpose : //================================================================================= -bool TransformationGUI_MultiTranslationDlg::isValid( QString& msg ) +bool TransformationGUI_MultiTranslationDlg::isValid( QString& /*msg*/ ) { int aConstructorId = getConstructorId(); - if(aConstructorId == 0) - return !(myBase->_is_nil() || myVectorU->_is_nil()); - else if(aConstructorId == 1) - return !(myBase->_is_nil() || myVectorU->_is_nil() || myVectorV->_is_nil()); + if ( aConstructorId == 0 ) + return !( myBase->_is_nil() || myVectorU->_is_nil() ); + else if ( aConstructorId == 1 ) + return !( myBase->_is_nil() || myVectorU->_is_nil() || myVectorV->_is_nil() ); return 0; } @@ -491,27 +489,22 @@ bool TransformationGUI_MultiTranslationDlg::execute( ObjectList& objects ) GEOM::GEOM_Object_var anObj; - switch ( getConstructorId() ) - { - case 0 : - { - if ( !CORBA::is_nil( myBase ) && !CORBA::is_nil( myVectorU ) ) { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MultiTranslate1D( myBase, myVectorU, myStepU, myNbTimesU ); - res = true; - } - break; - } - case 1 : - { - if ( !CORBA::is_nil( myBase ) && !CORBA::is_nil( myVectorU ) && !CORBA::is_nil( myVectorV ) ) - { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MultiTranslate2D( myBase, myVectorU, myStepU, myNbTimesU, - myVectorV, myStepV, myNbTimesV ); - res = true; - } - break; - } + switch ( getConstructorId() ) { + case 0 : + if ( !CORBA::is_nil( myBase ) && !CORBA::is_nil( myVectorU ) ) { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MultiTranslate1D( myBase, myVectorU, myStepU, myNbTimesU ); + res = true; } + break; + case 1 : + if ( !CORBA::is_nil( myBase ) && !CORBA::is_nil( myVectorU ) && + !CORBA::is_nil( myVectorV ) ) { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MultiTranslate2D( myBase, myVectorU, myStepU, myNbTimesU, + myVectorV, myStepV, myNbTimesV ); + res = true; + } + break; + } if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); @@ -524,7 +517,7 @@ bool TransformationGUI_MultiTranslationDlg::execute( ObjectList& objects ) // function : closeEvent // purpose : //================================================================================= -void TransformationGUI_MultiTranslationDlg::closeEvent( QCloseEvent* e ) +void TransformationGUI_MultiTranslationDlg::closeEvent( QCloseEvent* e ) { // myGeomGUI->SetState( -1 ); GEOMBase_Skeleton::closeEvent( e ); diff --git a/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.h b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.h index ec274909d..02bde0328 100644 --- a/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.h +++ b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.h @@ -1,34 +1,32 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : TransformationGUI_MultiTranslationDlg.h +// Author : Damien COQUERET, Open CASCADE S.A.S. // -// -// File : TransformationGUI_MultiTranslationDlg.h -// Author : Damien COQUERET -// Module : GEOM -#ifndef DIALOGBOX_MULTITRANSLATION_H -#define DIALOGBOX_MULTITRANSLATION_H +#ifndef TRANSFORMATIONGUI_MULTITRANSLATIONDLG_H +#define TRANSFORMATIONGUI_MULTITRANSLATIONDLG_H -#include "GEOMBase_Skeleton.h" +#include class DlgRef_2Sel2Spin1Check; class DlgRef_3Sel4Spin2Check; @@ -39,45 +37,46 @@ class DlgRef_3Sel4Spin2Check; //================================================================================= class TransformationGUI_MultiTranslationDlg : public GEOMBase_Skeleton { - Q_OBJECT + Q_OBJECT public: - TransformationGUI_MultiTranslationDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, - const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0); - ~TransformationGUI_MultiTranslationDlg(); + TransformationGUI_MultiTranslationDlg( GeometryGUI*, QWidget* = 0, + bool = false, Qt::WindowFlags = 0 ); + ~TransformationGUI_MultiTranslationDlg(); 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 myBase, myVectorU, myVectorV ; - int myNbTimesU; - int myNbTimesV; - Standard_Real myStepU; - Standard_Real myStepV; - - DlgRef_2Sel2Spin1Check* GroupPoints; - DlgRef_3Sel4Spin2Check* GroupDimensions; + // 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 myBase, myVectorU, myVectorV; + int myNbTimesU; + int myNbTimesV; + Standard_Real myStepU; + Standard_Real myStepV; + + DlgRef_2Sel2Spin1Check* GroupPoints; + DlgRef_3Sel4Spin2Check* GroupDimensions; + private slots: - void ClickOnOk(); - bool ClickOnApply(); - void ActivateThisDialog(); - void LineEditReturnPressed(); - void SelectionIntoArgument(); - void SetEditCurrentArgument(); - void ReverseStepU(); - void ReverseStepV(); - void ValueChangedInSpinBox(double newValue); - void ConstructorsClicked(int constructorId); + void ClickOnOk(); + bool ClickOnApply(); + void ActivateThisDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ReverseStepU(); + void ReverseStepV(); + void ValueChangedInSpinBox( double ); + void ConstructorsClicked( int ); }; -#endif // DIALOGBOX_MULTITRANSLATION_H +#endif // TRANSFORMATIONGUI_MULTITRANSLATIONDLG_H diff --git a/src/TransformationGUI/TransformationGUI_OffsetDlg.cxx b/src/TransformationGUI/TransformationGUI_OffsetDlg.cxx index 0d1580a8d..4b856dc9a 100644 --- a/src/TransformationGUI/TransformationGUI_OffsetDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_OffsetDlg.cxx @@ -1,44 +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 // +// File : TransformationGUI_OffsetDlg.cxx +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // -// -// File : TransformationGUI_OffsetDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ #include "TransformationGUI_OffsetDlg.h" -#include "DlgRef_1Sel1Spin1Check.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 -using namespace std; +#include +#include +#include +#include //================================================================================= // class : TransformationGUI_OffsetDlg() @@ -47,39 +41,41 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -TransformationGUI_OffsetDlg::TransformationGUI_OffsetDlg(GeometryGUI* theGeometryGUI, QWidget* parent, - const char* name, bool modal, Qt::WindowFlags fl) - :GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) +TransformationGUI_OffsetDlg::TransformationGUI_OffsetDlg( GeometryGUI* theGeometryGUI, QWidget* parent, + bool modal, Qt::WindowFlags fl ) + : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ) { - QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_OFFSET"))); - QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_OFFSET" ) ) ); + QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); - setWindowTitle(tr("GEOM_OFFSET_TITLE")); + setWindowTitle( tr( "GEOM_OFFSET_TITLE" ) ); /***************************************************************/ - GroupConstructors->setTitle(tr("GEOM_OFFSET")); - RadioButton1->setIcon(image0); - RadioButton2->setAttribute( Qt::WA_DeleteOnClose ); - RadioButton2->close(); - RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); - RadioButton3->close(); + mainFrame()->GroupConstructors->setTitle( tr( "GEOM_OFFSET" ) ); + 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_1Sel1Spin1Check(this, "GroupPoints"); - GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); - GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS")); - GroupPoints->TextLabel2->setText(tr("GEOM_OFFSET")); - GroupPoints->CheckButton1->setText(tr("GEOM_CREATE_COPY")); + GroupPoints = new DlgRef_1Sel1Spin1Check( centralWidget() ); + GroupPoints->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) ); + GroupPoints->TextLabel1->setText( tr( "GEOM_OBJECTS" ) ); + GroupPoints->TextLabel2->setText( tr( "GEOM_OFFSET" ) ); + GroupPoints->CheckButton1->setText( tr( "GEOM_CREATE_COPY" ) ); // san -- modification of an exisitng object by offset is not allowed GroupPoints->CheckButton1->hide(); - GroupPoints->PushButton1->setIcon(image1); + GroupPoints->PushButton1->setIcon( image1 ); - gridLayout1->addWidget(GroupPoints, 2, 0); + QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); + layout->setMargin( 0 ); layout->setSpacing( 6 ); + layout->addWidget( GroupPoints ); /***************************************************************/ - setHelpFileName("offset_surface.htm"); + setHelpFileName( "offset_surface.htm" ); Init(); } @@ -109,27 +105,27 @@ void TransformationGUI_OffsetDlg::Init() double step = 1; /* min, max, step and decimals for spin boxes & initial values */ - GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - GroupPoints->SpinBox_DX->setDecimals(5); + initSpinBox( GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, step, 3 ); + GroupPoints->SpinBox_DX->setDecimals( 5 ); //@ GroupPoints->SpinBox_DX->setDblPrecision(1e-05); - GroupPoints->SpinBox_DX->SetValue(1e-05); + GroupPoints->SpinBox_DX->setValue( 1e-05 ); // Activate Create a Copy mode - GroupPoints->CheckButton1->setChecked(true); - CreateCopyModeChanged(true); + GroupPoints->CheckButton1->setChecked( true ); + CreateCopyModeChanged( true ); /* signals and slots connections */ - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); - connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(myGeomGUI->getApp()->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( myGeomGUI->getApp()->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); - connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool))); + connect( GroupPoints->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) ); + connect( GroupPoints->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( CreateCopyModeChanged( bool ) ) ); - initName( tr( "GEOM_OFFSET" ).toLatin1().constData() ); + initName( tr( "GEOM_OFFSET" ) ); globalSelection( GEOM_ALLSHAPES ); @@ -167,19 +163,18 @@ bool TransformationGUI_OffsetDlg::ClickOnApply() //================================================================================= void TransformationGUI_OffsetDlg::SelectionIntoArgument() { - myEditCurrentArgument->setText(""); + myEditCurrentArgument->setText( "" ); QString aName; - int aNbSel = GEOMBase::GetNameOfSelectedIObjects(selectedIO(), aName); - if(aNbSel < 1) - { - myObjects.length(0); - return; - } + int aNbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aName ); + if ( aNbSel < 1 ) { + myObjects.length( 0 ); + return; + } // nbSel > 0 - GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), myObjects); - if (!myObjects.length()) + GEOMBase::ConvertListOfIOInListOfGO( selectedIO(), myObjects ); + if ( !myObjects.length() ) return; myEditCurrentArgument->setText( aName ); @@ -195,8 +190,7 @@ void TransformationGUI_OffsetDlg::SelectionIntoArgument() void TransformationGUI_OffsetDlg::LineEditReturnPressed() { QLineEdit* send = (QLineEdit*)sender(); - if ( send == GroupPoints->LineEdit1 ) - { + if ( send == GroupPoints->LineEdit1 ) { myEditCurrentArgument = GroupPoints->LineEdit1; GEOMBase_Skeleton::LineEditReturnPressed(); } @@ -211,12 +205,11 @@ void TransformationGUI_OffsetDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - if(send == GroupPoints->PushButton1) - { - myEditCurrentArgument = GroupPoints->LineEdit1; - myEditCurrentArgument->setFocus(); - SelectionIntoArgument(); - } + if ( send == GroupPoints->PushButton1 ) { + myEditCurrentArgument = GroupPoints->LineEdit1; + myEditCurrentArgument->setFocus(); + SelectionIntoArgument(); + } } @@ -224,9 +217,9 @@ void TransformationGUI_OffsetDlg::SetEditCurrentArgument() // function : enterEvent() // purpose : when mouse enter onto the QWidget //================================================================================= -void TransformationGUI_OffsetDlg::enterEvent(QEvent * e) +void TransformationGUI_OffsetDlg::enterEvent( QEvent* ) { - if ( !GroupConstructors->isEnabled() ) + if ( !mainFrame()->GroupConstructors->isEnabled() ) ActivateThisDialog(); } @@ -238,8 +231,8 @@ void TransformationGUI_OffsetDlg::enterEvent(QEvent * e) void TransformationGUI_OffsetDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(myGeomGUI->getApp()->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect( myGeomGUI->getApp()->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); globalSelection( GEOM_ALLSHAPES ); myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument->setFocus(); @@ -272,14 +265,13 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_OffsetDlg::createOperation() bool TransformationGUI_OffsetDlg::isValid( QString& msg ) { //return !(myObjects.length() == 0); - if (myObjects.length() == 0) return false; + if ( myObjects.length() == 0 ) return false; - for (int i = 0; i < myObjects.length(); i++) - { + for ( int i = 0; i < myObjects.length(); i++ ) { GEOM::shape_type aType = myObjects[i]->GetShapeType(); - if( aType != GEOM::FACE && aType != GEOM::SHELL && aType != GEOM::SOLID ){ - msg = tr("ERROR_SHAPE_TYPE"); - return false; + if ( aType != GEOM::FACE && aType != GEOM::SHELL && aType != GEOM::SOLID ) { + msg = tr( "ERROR_SHAPE_TYPE" ); + return false; } } return true; @@ -296,23 +288,21 @@ bool TransformationGUI_OffsetDlg::execute( ObjectList& objects ) GEOM::GEOM_Object_var anObj; - - if (GroupPoints->CheckButton1->isChecked() || IsPreview()) - for (int i = 0; i < myObjects.length(); i++) - { - - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->OffsetShapeCopy( myObjects[i], GetOffset() ); - if ( !anObj->_is_nil() ) - objects.push_back( anObj._retn() ); - } - else - for (int i = 0; i < myObjects.length(); i++) - { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->OffsetShape( myObjects[i], GetOffset() ); - if ( !anObj->_is_nil() ) - objects.push_back( anObj._retn() ); - } - + if ( GroupPoints->CheckButton1->isChecked() || IsPreview() ) { + for ( int i = 0; i < myObjects.length(); i++ ) { + + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->OffsetShapeCopy( myObjects[i], GetOffset() ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } + } + else { + for ( int i = 0; i < myObjects.length(); i++ ) { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->OffsetShape( myObjects[i], GetOffset() ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } + } res = true; return res; @@ -335,7 +325,7 @@ void TransformationGUI_OffsetDlg::closeEvent( QCloseEvent* e ) //================================================================================= double TransformationGUI_OffsetDlg::GetOffset() const { - return GroupPoints->SpinBox_DX->GetValue(); + return GroupPoints->SpinBox_DX->value(); } @@ -343,7 +333,7 @@ double TransformationGUI_OffsetDlg::GetOffset() const // function : CreateCopyModeChanged() // purpose : //================================================================================= -void TransformationGUI_OffsetDlg::CreateCopyModeChanged(bool isCreateCopy) +void TransformationGUI_OffsetDlg::CreateCopyModeChanged( bool isCreateCopy ) { - this->GroupBoxName->setEnabled(isCreateCopy); + mainFrame()->GroupBoxName->setEnabled( isCreateCopy ); } diff --git a/src/TransformationGUI/TransformationGUI_OffsetDlg.h b/src/TransformationGUI/TransformationGUI_OffsetDlg.h index cdff5df72..4bbd833de 100644 --- a/src/TransformationGUI/TransformationGUI_OffsetDlg.h +++ b/src/TransformationGUI/TransformationGUI_OffsetDlg.h @@ -1,34 +1,32 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : TransformationGUI_OffsetDlg.h +// Author : Michael ZORIN, Open CASCADE S.A.S. (mikhail.zorin@opencascade.com) // -// -// File : TransformationGUI_OffsetDlg.h -// Author : Michael Zorin -// Module : GEOM -#ifndef DIALOGBOX_OFFSET_H -#define DIALOGBOX_OFFSET_H +#ifndef TRANSFORMATIONGUI_OFFSETDLG_H +#define TRANSFORMATIONGUI_OFFSETDLG_H -#include "GEOMBase_Skeleton.h" +#include class DlgRef_1Sel1Spin1Check; @@ -38,39 +36,40 @@ class DlgRef_1Sel1Spin1Check; //================================================================================= class TransformationGUI_OffsetDlg : public GEOMBase_Skeleton { - Q_OBJECT + Q_OBJECT public: - TransformationGUI_OffsetDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, - const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0); - ~TransformationGUI_OffsetDlg(); + TransformationGUI_OffsetDlg( GeometryGUI*, QWidget* = 0, + bool = false, Qt::WindowFlags = 0 ); + ~TransformationGUI_OffsetDlg(); 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 GetOffset() const; + void Init(); + void enterEvent( QEvent* ); + double GetOffset() const; - GEOM::ListOfGO myObjects; +private: + GEOM::ListOfGO myObjects; - DlgRef_1Sel1Spin1Check* GroupPoints; + DlgRef_1Sel1Spin1Check* GroupPoints; private slots: - void ClickOnOk(); - bool ClickOnApply(); - void ActivateThisDialog(); - void SelectionIntoArgument(); - void LineEditReturnPressed(); - void SetEditCurrentArgument(); - void ValueChangedInSpinBox(); - void CreateCopyModeChanged(bool isCreateCopy); + void ClickOnOk(); + bool ClickOnApply(); + void ActivateThisDialog(); + void SelectionIntoArgument(); + void LineEditReturnPressed(); + void SetEditCurrentArgument(); + void ValueChangedInSpinBox(); + void CreateCopyModeChanged( bool ); }; -#endif // DIALOGBOX_OFFSET_H +#endif // TRANSFORMATIONGUI_OFFSETDLG_H diff --git a/src/TransformationGUI/TransformationGUI_PositionDlg.cxx b/src/TransformationGUI/TransformationGUI_PositionDlg.cxx index bd6c53df5..be6301fc4 100644 --- a/src/TransformationGUI/TransformationGUI_PositionDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_PositionDlg.cxx @@ -1,48 +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 // +// File : TransformationGUI_PositionDlg.cxx +// Author : Damien COQUERET, Open CASCADE S.A.S. // -// -// File : TransformationGUI_PositionDlg.cxx -// Author : Damien COQUERET -// Module : GEOM -// $Header$ #include "TransformationGUI_PositionDlg.h" -#include "DlgRef_3Sel3Spin1Check.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 "TColStd_MapOfInteger.hxx" +#include +#include +#include +#include -#include "GEOMImpl_Types.hxx" +#include -using namespace std; +#include //================================================================================= // class : TransformationGUI_PositionDlg() @@ -52,44 +46,46 @@ using namespace std; // TRUE to construct a modal dialog. //================================================================================= TransformationGUI_PositionDlg::TransformationGUI_PositionDlg - (GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl) - : GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) +( GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl ) + : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ) { SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr(); - QPixmap image0(aResMgr->loadPixmap("GEOM",tr("ICON_DLG_POSITION"))); - QPixmap image1(aResMgr->loadPixmap("GEOM",tr("ICON_DLG_POSITION2"))); - QPixmap imageselect(aResMgr->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_POSITION" ) ) ); + QPixmap image1( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_POSITION2" ) ) ); + QPixmap imageselect( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT") ) ); - setWindowTitle(tr("GEOM_POSITION_TITLE")); + setWindowTitle( tr( "GEOM_POSITION_TITLE" ) ); /***************************************************************/ - GroupConstructors->setTitle(tr("GEOM_POSITION")); - RadioButton1->setIcon(image0); - RadioButton2->setIcon(image1); - RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); - RadioButton3->close(); + mainFrame()->GroupConstructors->setTitle( tr( "GEOM_POSITION" ) ); + mainFrame()->RadioButton1->setIcon( image0 ); + mainFrame()->RadioButton2->setIcon( image1 ); + mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); + mainFrame()->RadioButton3->close(); - Group1 = new DlgRef_3Sel3Spin1Check(this, "Group1"); + Group1 = new DlgRef_3Sel3Spin1Check( centralWidget() ); Group1->SpinBox1->hide(); Group1->SpinBox2->hide(); Group1->SpinBox3->hide(); Group1->TextLabel4->hide(); Group1->TextLabel5->hide(); Group1->TextLabel6->hide(); - Group1->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); - Group1->TextLabel1->setText(tr("GEOM_OBJECTS")); - Group1->TextLabel2->setText(tr("GEOM_START_LCS")); - Group1->TextLabel3->setText(tr("GEOM_END_LCS")); - Group1->PushButton1->setIcon(imageselect); - Group1->PushButton2->setIcon(imageselect); - Group1->PushButton3->setIcon(imageselect); - Group1->CheckBox1->setText(tr("GEOM_CREATE_COPY")); - - gridLayout1->addWidget(Group1, 2, 0); + Group1->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) ); + Group1->TextLabel1->setText( tr( "GEOM_OBJECTS" ) ); + Group1->TextLabel2->setText( tr( "GEOM_START_LCS" ) ); + Group1->TextLabel3->setText( tr( "GEOM_END_LCS" ) ); + Group1->PushButton1->setIcon( imageselect ); + Group1->PushButton2->setIcon( imageselect ); + Group1->PushButton3->setIcon( imageselect ); + Group1->CheckBox1->setText( tr( "GEOM_CREATE_COPY" ) ); + + QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); + layout->setMargin( 0 ); layout->setSpacing( 6 ); + layout->addWidget( Group1 ); /***************************************************************/ - setHelpFileName("modify_the_location.htm"); + setHelpFileName( "modify_the_location.htm" ); Init(); } @@ -112,36 +108,38 @@ TransformationGUI_PositionDlg::~TransformationGUI_PositionDlg() void TransformationGUI_PositionDlg::Init() { /* init variables */ - Group1->LineEdit1->setReadOnly(true); - Group1->LineEdit2->setReadOnly(true); - Group1->LineEdit3->setReadOnly(true); + Group1->LineEdit1->setReadOnly( true ); + Group1->LineEdit2->setReadOnly( true ); + Group1->LineEdit3->setReadOnly( true ); myStartLCS = GEOM::GEOM_Object::_nil(); myEndLCS = GEOM::GEOM_Object::_nil(); // Activate Create a Copy mode - Group1->CheckBox1->setChecked(true); - CreateCopyModeChanged(true); + Group1->CheckBox1->setChecked( true ); + CreateCopyModeChanged( true ); /* signals and slots connections */ - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); - connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int))); + connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); - connect(Group1->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(Group1->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(Group1->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) ); - connect(Group1->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(Group1->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(Group1->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect( Group1->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( Group1->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( Group1->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + + connect( Group1->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( Group1->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( Group1->LineEdit3, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect(Group1->CheckBox1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool))); + connect( Group1->CheckBox1, SIGNAL( toggled( bool ) ), this, SLOT( CreateCopyModeChanged( bool ) ) ); - connect(myGeomGUI->getApp()->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect( myGeomGUI->getApp()->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + + initName( tr( "GEOM_POSITION" ) ); - initName( tr( "GEOM_POSITION" ).toLatin1().constData() ); ConstructorsClicked( 0 ); } @@ -151,9 +149,9 @@ void TransformationGUI_PositionDlg::Init() // function : ConstructorsClicked() // purpose : Radio button management //================================================================================= -void TransformationGUI_PositionDlg::ConstructorsClicked(int constructorId) +void TransformationGUI_PositionDlg::ConstructorsClicked( int constructorId ) { - disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); + disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 ); globalSelection(); myEditCurrentArgument = Group1->LineEdit1; @@ -162,25 +160,25 @@ void TransformationGUI_PositionDlg::ConstructorsClicked(int constructorId) myStartLCS = GEOM::GEOM_Object::_nil(); myEndLCS = GEOM::GEOM_Object::_nil(); - switch (constructorId) - { - case 0: - { - Group1->LineEdit2->hide(); - Group1->TextLabel2->hide(); - Group1->PushButton2->hide(); - break; - } - case 1: - { - Group1->LineEdit2->show(); - Group1->TextLabel2->show(); - Group1->PushButton2->show(); - break; - } - } - connect(myGeomGUI->getApp()->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + switch ( constructorId ) { + case 0: + Group1->LineEdit2->hide(); + Group1->TextLabel2->hide(); + Group1->PushButton2->hide(); + break; + case 1: + Group1->LineEdit2->show(); + Group1->TextLabel2->show(); + Group1->PushButton2->show(); + break; + } + + qApp->processEvents(); + updateGeometry(); + resize( minimumSize() ); + + connect( myGeomGUI->getApp()->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT(SelectionIntoArgument() ) ); SelectionIntoArgument(); } @@ -202,7 +200,7 @@ void TransformationGUI_PositionDlg::ClickOnOk() //================================================================================= bool TransformationGUI_PositionDlg::ClickOnApply() { - if ( !onAccept(Group1->CheckBox1->isChecked()) ) + if ( !onAccept( Group1->CheckBox1->isChecked() ) ) return false; initName(); @@ -217,47 +215,47 @@ bool TransformationGUI_PositionDlg::ClickOnApply() //================================================================================= void TransformationGUI_PositionDlg::SelectionIntoArgument() { - myEditCurrentArgument->setText(""); + myEditCurrentArgument->setText( "" ); QString aName; - if(myEditCurrentArgument == Group1->LineEdit1) { - int aNbSel = GEOMBase::GetNameOfSelectedIObjects(selectedIO(), aName); - if(aNbSel < 1) { - myObjects.length(0); + if ( myEditCurrentArgument == Group1->LineEdit1 ) { + int aNbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aName ); + if ( aNbSel < 1 ) { + myObjects.length( 0 ); displayPreview(); return; } - GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), myObjects); - if (!myObjects.length()) { + GEOMBase::ConvertListOfIOInListOfGO( selectedIO(), myObjects ); + if ( !myObjects.length() ) { displayPreview(); return; } } - else if(myEditCurrentArgument == Group1->LineEdit2) { + else if ( myEditCurrentArgument == Group1->LineEdit2 ) { myStartLCS = GEOM::GEOM_Object::_nil(); - if(IObjectCount() != 1) { + if ( IObjectCount() != 1 ) { displayPreview(); return; } Standard_Boolean testResult = Standard_False; - myStartLCS = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); - if(!testResult || CORBA::is_nil( myStartLCS )) { + myStartLCS = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); + if ( !testResult || CORBA::is_nil( myStartLCS ) ) { displayPreview(); return; } aName = GEOMBase::GetName( myStartLCS ); } - else if(myEditCurrentArgument == Group1->LineEdit3) { + else if ( myEditCurrentArgument == Group1->LineEdit3 ) { myEndLCS = GEOM::GEOM_Object::_nil(); - if(IObjectCount() != 1) { + if ( IObjectCount() != 1 ) { displayPreview(); return; } Standard_Boolean testResult = Standard_False; - myEndLCS = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); - if(!testResult || CORBA::is_nil( myEndLCS )) { + myEndLCS = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); + if ( !testResult || CORBA::is_nil( myEndLCS ) ) { displayPreview(); return; } @@ -276,7 +274,8 @@ void TransformationGUI_PositionDlg::SelectionIntoArgument() void TransformationGUI_PositionDlg::LineEditReturnPressed() { QLineEdit* send = (QLineEdit*)sender(); - if(send == Group1->LineEdit1 || send == Group1->LineEdit2 || send == Group1->LineEdit3) { + if ( send == Group1->LineEdit1 || send == Group1->LineEdit2 || + send == Group1->LineEdit3 ) { myEditCurrentArgument = send; GEOMBase_Skeleton::LineEditReturnPressed(); } @@ -291,18 +290,18 @@ void TransformationGUI_PositionDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - if(send == Group1->PushButton1){ + if ( send == Group1->PushButton1 ) { myEditCurrentArgument = Group1->LineEdit1; globalSelection(); } - else if(send == Group1->PushButton2) { + else if ( send == Group1->PushButton2 ) { myEditCurrentArgument = Group1->LineEdit2; TColStd_MapOfInteger aMap; aMap.Add( GEOM_PLANE ); aMap.Add( GEOM_MARKER ); globalSelection( aMap ); } - else if(send == Group1->PushButton3) { + else if ( send == Group1->PushButton3 ) { myEditCurrentArgument = Group1->LineEdit3; TColStd_MapOfInteger aMap; aMap.Add( GEOM_PLANE ); @@ -322,8 +321,8 @@ void TransformationGUI_PositionDlg::SetEditCurrentArgument() void TransformationGUI_PositionDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(myGeomGUI->getApp()->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect( myGeomGUI->getApp()->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); ConstructorsClicked( getConstructorId() ); } @@ -332,9 +331,9 @@ void TransformationGUI_PositionDlg::ActivateThisDialog() // function : enterEvent() // purpose : when mouse enter onto the QWidget //================================================================================= -void TransformationGUI_PositionDlg::enterEvent(QEvent * e) +void TransformationGUI_PositionDlg::enterEvent( QEvent* ) { - if(!GroupConstructors->isEnabled()) + if ( !mainFrame()->GroupConstructors->isEnabled() ) ActivateThisDialog(); } @@ -353,13 +352,13 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_PositionDlg::createOperation() // function : isValid // purpose : //================================================================================= -bool TransformationGUI_PositionDlg::isValid( QString& msg ) +bool TransformationGUI_PositionDlg::isValid( QString& /*msg*/ ) { bool res; - if (getConstructorId() == 0) - res = !(myObjects.length() == 0 || myEndLCS->_is_nil()); + if ( getConstructorId() == 0 ) + res = !( myObjects.length() == 0 || myEndLCS->_is_nil() ); else - res = !(myObjects.length() == 0 || myStartLCS->_is_nil() || myEndLCS->_is_nil()); + res = !( myObjects.length() == 0 || myStartLCS->_is_nil() || myEndLCS->_is_nil() ); return res; } @@ -369,42 +368,41 @@ bool TransformationGUI_PositionDlg::isValid( QString& msg ) // function : execute // purpose : //================================================================================= -bool TransformationGUI_PositionDlg::execute( ObjectList& objects ) +bool TransformationGUI_PositionDlg::execute( ObjectList& objects ) { bool res = false; bool toCreateCopy = IsPreview() || Group1->CheckBox1->isChecked(); GEOM::GEOM_Object_var anObj; - switch ( getConstructorId() ) + switch ( getConstructorId() ) { + case 0: { - case 0 : - { - for (int i = 0; i < myObjects.length(); i++) { - if (toCreateCopy) - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->PositionShapeCopy( myObjects[i], myObjects[i], myEndLCS ); - else - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->PositionShape( myObjects[i], myObjects[i], myEndLCS ); - - if ( !anObj->_is_nil() ) - objects.push_back( anObj._retn() ); - } - res = true; - break; + for ( int i = 0; i < myObjects.length(); i++ ) { + if ( toCreateCopy ) + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->PositionShapeCopy( myObjects[i], myObjects[i], myEndLCS ); + else + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->PositionShape( myObjects[i], myObjects[i], myEndLCS ); + + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); } - case 1 : - { - for (int i = 0; i < myObjects.length(); i++) { - if (toCreateCopy) - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->PositionShapeCopy( myObjects[i], myStartLCS, myEndLCS ); - else - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->PositionShape( myObjects[i], myStartLCS, myEndLCS ); - if ( !anObj->_is_nil() ) - objects.push_back( anObj._retn() ); - } - res = true; - break; + res = true; + break; + } + case 1: + { + for ( int i = 0; i < myObjects.length(); i++ ) { + if ( toCreateCopy ) + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->PositionShapeCopy( myObjects[i], myStartLCS, myEndLCS ); + else + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->PositionShape( myObjects[i], myStartLCS, myEndLCS ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); } + res = true; + break; } + } return res; } @@ -423,7 +421,7 @@ void TransformationGUI_PositionDlg::closeEvent( QCloseEvent* e ) // function : CreateCopyModeChanged() // purpose : //================================================================================= -void TransformationGUI_PositionDlg::CreateCopyModeChanged(bool isCreateCopy) +void TransformationGUI_PositionDlg::CreateCopyModeChanged( bool isCreateCopy ) { - this->GroupBoxName->setEnabled(isCreateCopy); + mainFrame()->GroupBoxName->setEnabled( isCreateCopy ); } diff --git a/src/TransformationGUI/TransformationGUI_PositionDlg.h b/src/TransformationGUI/TransformationGUI_PositionDlg.h index e6f2a1934..058157b77 100644 --- a/src/TransformationGUI/TransformationGUI_PositionDlg.h +++ b/src/TransformationGUI/TransformationGUI_PositionDlg.h @@ -1,34 +1,32 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : TransformationGUI_PositionDlg.h +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // -// -// File : TransformationGUI_PositionDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -#ifndef DIALOGBOX_POSITION_H -#define DIALOGBOX_POSITION_H +#ifndef TRANSFORMATIONGUI_POSITIONDLG_H +#define TRANSFORMATIONGUI_POSITIONDLG_H -#include "GEOMBase_Skeleton.h" +#include class DlgRef_3Sel3Spin1Check; @@ -38,40 +36,41 @@ class DlgRef_3Sel3Spin1Check; //================================================================================= class TransformationGUI_PositionDlg : public GEOMBase_Skeleton { - Q_OBJECT + Q_OBJECT public: - TransformationGUI_PositionDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, - const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0); - ~TransformationGUI_PositionDlg(); - + TransformationGUI_PositionDlg( GeometryGUI*, QWidget* = 0, + bool = false, Qt::WindowFlags = 0 ); + ~TransformationGUI_PositionDlg(); + 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); + void Init(); + void enterEvent( QEvent* ); - GEOM::GEOM_Object_var myStartLCS; - GEOM::GEOM_Object_var myEndLCS; - GEOM::ListOfGO myObjects; - - DlgRef_3Sel3Spin1Check* Group1; +private: + GEOM::GEOM_Object_var myStartLCS; + GEOM::GEOM_Object_var myEndLCS; + GEOM::ListOfGO myObjects; + + DlgRef_3Sel3Spin1Check* Group1; private slots: - void ClickOnOk(); - bool ClickOnApply(); - void ActivateThisDialog(); - void LineEditReturnPressed(); - void SelectionIntoArgument(); - void SetEditCurrentArgument(); - void ConstructorsClicked(int constructorId); - void CreateCopyModeChanged(bool isCreateCopy); + void ClickOnOk(); + bool ClickOnApply(); + void ActivateThisDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ConstructorsClicked( int ); + void CreateCopyModeChanged( bool ); }; -#endif // DIALOGBOX_MIRROR_H +#endif // TRANSFORMATIONGUI_POSITIONDLG_H diff --git a/src/TransformationGUI/TransformationGUI_RotationDlg.cxx b/src/TransformationGUI/TransformationGUI_RotationDlg.cxx index 1dd779b13..8fd46dc2a 100644 --- a/src/TransformationGUI/TransformationGUI_RotationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_RotationDlg.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 : TransformationGUI_RotationDlg.cxx +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // -// -// File : TransformationGUI_RotationDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ #include "TransformationGUI_RotationDlg.h" -#include "DlgRef_4Sel1Spin2Check.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 : TransformationGUI_RotationDlg() @@ -50,75 +44,79 @@ using namespace std; // TRUE to construct a modal dialog. //================================================================================= TransformationGUI_RotationDlg::TransformationGUI_RotationDlg - (GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl) - :GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) +( GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl ) + : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ) { SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr(); - QPixmap image0 (aResMgr->loadPixmap("GEOM",tr("ICON_DLG_ROTATION"))); - QPixmap image1 (aResMgr->loadPixmap("GEOM",tr("ICON_SELECT"))); - QPixmap image2 (aResMgr->loadPixmap("GEOM",tr("ICON_DLG_ROTATION_THREE_POINTS"))); + QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_ROTATION" ) ) ); + QPixmap image1( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); + QPixmap image2( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_ROTATION_THREE_POINTS" ) ) ); - setWindowTitle(tr("GEOM_ROTATION_TITLE")); + setWindowTitle( tr( "GEOM_ROTATION_TITLE" ) ); /***************************************************************/ - GroupConstructors->setTitle(tr("GEOM_ROTATION")); - RadioButton1->setIcon(image0); - RadioButton2->setIcon(image2); - RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); - RadioButton3->close(); - - GroupPoints = new DlgRef_4Sel1Spin2Check(this, "GroupPoints"); - GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); - GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS")); - GroupPoints->TextLabel2->setText(tr("GEOM_AXIS")); - GroupPoints->TextLabel3->setText(tr("GEOM_ANGLE")); - GroupPoints->TextLabel4->setText(tr("GEOM_POINT_I").arg("1")); - GroupPoints->TextLabel5->setText(tr("GEOM_POINT_I").arg("2")); - - GroupPoints->LineEdit1->setReadOnly(true); - GroupPoints->LineEdit2->setReadOnly(true); - GroupPoints->LineEdit4->setReadOnly(true); - GroupPoints->LineEdit5->setReadOnly(true); - GroupPoints->PushButton1->setIcon(image1); - GroupPoints->PushButton2->setIcon(image1); - GroupPoints->PushButton4->setIcon(image1); - GroupPoints->PushButton5->setIcon(image1); - GroupPoints->CheckButton1->setText(tr("GEOM_CREATE_COPY")); - GroupPoints->CheckButton2->setText(tr("GEOM_REVERSE")); - - gridLayout1->addWidget(GroupPoints, 2, 0); + mainFrame()->GroupConstructors->setTitle( tr( "GEOM_ROTATION" ) ); + mainFrame()->RadioButton1->setIcon( image0 ); + mainFrame()->RadioButton2->setIcon( image2 ); + mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); + mainFrame()->RadioButton3->close(); + + GroupPoints = new DlgRef_4Sel1Spin2Check( centralWidget() ); + GroupPoints->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) ); + GroupPoints->TextLabel1->setText( tr( "GEOM_OBJECTS" ) ); + GroupPoints->TextLabel2->setText( tr( "GEOM_AXIS" ) ); + GroupPoints->TextLabel3->setText( tr( "GEOM_ANGLE" ) ); + GroupPoints->TextLabel4->setText( tr( "GEOM_POINT_I" ).arg( 1 ) ); + GroupPoints->TextLabel5->setText( tr( "GEOM_POINT_I" ).arg( 2 ) ); + + GroupPoints->LineEdit1->setReadOnly( true ); + GroupPoints->LineEdit2->setReadOnly( true ); + GroupPoints->LineEdit4->setReadOnly( true ); + GroupPoints->LineEdit5->setReadOnly( true ); + GroupPoints->PushButton1->setIcon( image1 ); + GroupPoints->PushButton2->setIcon( image1 ); + GroupPoints->PushButton4->setIcon( image1 ); + GroupPoints->PushButton5->setIcon( image1 ); + GroupPoints->CheckButton1->setText( tr( "GEOM_CREATE_COPY" ) ); + GroupPoints->CheckButton2->setText( tr( "GEOM_REVERSE" ) ); + + QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); + layout->setMargin( 0 ); layout->setSpacing( 6 ); + layout->addWidget( GroupPoints ); + /***************************************************************/ double anAngle = 0; double SpecificStep = 5; /* min, max, step and decimals for spin boxes & initial values */ - GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, SpecificStep, 3); - GroupPoints->SpinBox_DX->SetValue(anAngle); + initSpinBox( GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, SpecificStep, 3 ); + GroupPoints->SpinBox_DX->setValue( anAngle ); // Activate Create a Copy mode - GroupPoints->CheckButton1->setChecked(true); - CreateCopyModeChanged(true); + GroupPoints->CheckButton1->setChecked( true ); + CreateCopyModeChanged( true ); /* signals and slots connections */ - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); - connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int))); - - connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPoints->PushButton4, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPoints->PushButton5, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); + + connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) ); + + connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( GroupPoints->PushButton4, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( GroupPoints->PushButton5, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); - connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool))); - connect(GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(onReverse())); + connect( GroupPoints->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) ); + connect( GroupPoints->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( CreateCopyModeChanged( bool ) ) ); + connect( GroupPoints->CheckButton2, SIGNAL( toggled( bool ) ), this, SLOT( onReverse() ) ); - connect(myGeomGUI->getApp()->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + connect( myGeomGUI->getApp()->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - setHelpFileName("rotation.htm"); + setHelpFileName( "rotation.htm" ); Init(); } @@ -146,7 +144,7 @@ void TransformationGUI_RotationDlg::Init() myAxis = myCentPoint = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); - initName( tr( "GEOM_ROTATION" ).toLatin1().constData() ); + initName( tr( "GEOM_ROTATION" ) ); ConstructorsClicked( 0 ); } @@ -154,44 +152,41 @@ void TransformationGUI_RotationDlg::Init() // function : ConstructorsClicked() // purpose : Radio button management //================================================================================= -void TransformationGUI_RotationDlg::ConstructorsClicked(int constructorId) +void TransformationGUI_RotationDlg::ConstructorsClicked( int constructorId ) { - disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); + disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 ); myEditCurrentArgument = GroupPoints->LineEdit1; globalSelection(); - switch (constructorId) - { - case 0: /* rotation an object angle and axis */ - { - GroupPoints->ShowRows(2,3,false); - resize(0,0); - GroupPoints->TextLabel2->setText(tr("GEOM_AXIS")); - GroupPoints->LineEdit2->clear(); - GroupPoints->ShowRows(4,4,true); - myAxis = GEOM::GEOM_Object::_nil(); - break; - } - case 1: /* rotation an object by 3 points */ - { - GroupPoints->ShowRows(4,4,false); - resize(0,0); - GroupPoints->ShowRows(2,3,true); - GroupPoints->TextLabel2->setText(tr("GEOM_CENTRAL_POINT")); - GroupPoints->TextLabel4->setText(tr("GEOM_POINT_I").arg("1")); - GroupPoints->TextLabel5->setText(tr("GEOM_POINT_I").arg("2")); - GroupPoints->LineEdit2->clear(); - GroupPoints->LineEdit4->clear(); - GroupPoints->LineEdit5->clear(); - myCentPoint = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); - break; - } - } + switch ( constructorId ) { + case 0: /* rotation an object angle and axis */ + GroupPoints->ShowRows( 2, 3, false ); + GroupPoints->TextLabel2->setText( tr( "GEOM_AXIS" ) ); + GroupPoints->LineEdit2->clear(); + GroupPoints->ShowRows( 4, 4, true ); + myAxis = GEOM::GEOM_Object::_nil(); + break; + case 1: /* rotation an object by 3 points */ + GroupPoints->ShowRows( 4, 4, false ); + GroupPoints->ShowRows( 2, 3, true ); + GroupPoints->TextLabel2->setText( tr( "GEOM_CENTRAL_POINT" ) ); + GroupPoints->TextLabel4->setText( tr( "GEOM_POINT_I" ).arg( 1 ) ); + GroupPoints->TextLabel5->setText( tr( "GEOM_POINT_I" ).arg( 2 ) ); + GroupPoints->LineEdit2->clear(); + GroupPoints->LineEdit4->clear(); + GroupPoints->LineEdit5->clear(); + myCentPoint = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); + break; + } + qApp->processEvents(); + updateGeometry(); + resize( minimumSize() ); + myEditCurrentArgument->setFocus(); - connect(myGeomGUI->getApp()->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect( myGeomGUI->getApp()->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); } //================================================================================= @@ -211,7 +206,7 @@ void TransformationGUI_RotationDlg::ClickOnOk() //================================================================================= bool TransformationGUI_RotationDlg::ClickOnApply() { - if ( !onAccept( GroupPoints->CheckButton1->isChecked()) ) + if ( !onAccept( GroupPoints->CheckButton1->isChecked() ) ) return false; initName(); @@ -226,52 +221,48 @@ bool TransformationGUI_RotationDlg::ClickOnApply() //================================================================================= void TransformationGUI_RotationDlg::SelectionIntoArgument() { - myEditCurrentArgument->setText(""); + myEditCurrentArgument->setText( "" ); QString aName; - if(myEditCurrentArgument == GroupPoints->LineEdit1) - { - int aNbSel = GEOMBase::GetNameOfSelectedIObjects(selectedIO(), aName); - if(aNbSel < 1) - { - myObjects.length(0); - return; - } - GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), myObjects); - if (!myObjects.length()) - return; + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) { + int aNbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aName ); + if ( aNbSel < 1) { + myObjects.length( 0 ); + return; } - else - { - if(IObjectCount() != 1) - { - if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0) - myAxis = GEOM::GEOM_Object::_nil(); - else if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1) - myCentPoint = GEOM::GEOM_Object::_nil(); - else if(myEditCurrentArgument == GroupPoints->LineEdit4) - myPoint1 = GEOM::GEOM_Object::_nil(); - else if(myEditCurrentArgument == GroupPoints->LineEdit5) - myPoint2 = GEOM::GEOM_Object::_nil(); - return; - } - - Standard_Boolean testResult = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); - if(!testResult || CORBA::is_nil( aSelectedObject )) - return; - - if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0) - myAxis = aSelectedObject; - else if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1) - myCentPoint = aSelectedObject; - else if(myEditCurrentArgument == GroupPoints->LineEdit4) - myPoint1 = aSelectedObject; - else if(myEditCurrentArgument == GroupPoints->LineEdit5) - myPoint2 = aSelectedObject; - - aName = GEOMBase::GetName( aSelectedObject ); + GEOMBase::ConvertListOfIOInListOfGO( selectedIO(), myObjects ); + if ( !myObjects.length() ) + return; + } + else { + if ( IObjectCount() != 1 ) { + if ( myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0 ) + myAxis = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1 ) + myCentPoint = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == GroupPoints->LineEdit4 ) + myPoint1 = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == GroupPoints->LineEdit5 ) + myPoint2 = GEOM::GEOM_Object::_nil(); + return; } + + Standard_Boolean testResult = Standard_False; + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); + if ( !testResult || CORBA::is_nil( aSelectedObject ) ) + return; + + if ( myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0 ) + myAxis = aSelectedObject; + else if ( myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1 ) + myCentPoint = aSelectedObject; + else if ( myEditCurrentArgument == GroupPoints->LineEdit4 ) + myPoint1 = aSelectedObject; + else if ( myEditCurrentArgument == GroupPoints->LineEdit5 ) + myPoint2 = aSelectedObject; + + aName = GEOMBase::GetName( aSelectedObject ); + } myEditCurrentArgument->setText( aName ); displayPreview(); @@ -286,25 +277,23 @@ void TransformationGUI_RotationDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - if(send == GroupPoints->PushButton1) { + if ( send == GroupPoints->PushButton1 ) { myEditCurrentArgument = GroupPoints->LineEdit1; globalSelection(); } - else if(send == GroupPoints->PushButton2) { + else if ( send == GroupPoints->PushButton2 ) { myEditCurrentArgument = GroupPoints->LineEdit2; getConstructorId() == 0 ? globalSelection( GEOM_LINE ) : globalSelection( GEOM_POINT ); } - else if (send == GroupPoints->PushButton4) - { - myEditCurrentArgument = GroupPoints->LineEdit4; - globalSelection( GEOM_POINT ); - } - else if (send == GroupPoints->PushButton5) - { - myEditCurrentArgument = GroupPoints->LineEdit5; - globalSelection( GEOM_POINT ); - } + else if ( send == GroupPoints->PushButton4 ) { + myEditCurrentArgument = GroupPoints->LineEdit4; + globalSelection( GEOM_POINT ); + } + else if ( send == GroupPoints->PushButton5 ) { + myEditCurrentArgument = GroupPoints->LineEdit5; + globalSelection( GEOM_POINT ); + } myEditCurrentArgument->setFocus(); SelectionIntoArgument(); @@ -318,12 +307,11 @@ void TransformationGUI_RotationDlg::SetEditCurrentArgument() void TransformationGUI_RotationDlg::LineEditReturnPressed() { QLineEdit* send = (QLineEdit*)sender(); - if(send == GroupPoints->LineEdit1 || - send == GroupPoints->LineEdit2) - { - myEditCurrentArgument = send; - GEOMBase_Skeleton::LineEditReturnPressed(); - } + if ( send == GroupPoints->LineEdit1 || + send == GroupPoints->LineEdit2 ) { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } } @@ -334,8 +322,8 @@ void TransformationGUI_RotationDlg::LineEditReturnPressed() void TransformationGUI_RotationDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(myGeomGUI->getApp()->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect( myGeomGUI->getApp()->selectionMgr(), + SIGNAL( currentSelectionChanged() ) , this, SLOT( SelectionIntoArgument() ) ); ConstructorsClicked( getConstructorId() ); } @@ -345,9 +333,9 @@ void TransformationGUI_RotationDlg::ActivateThisDialog() // function : enterEvent() // purpose : //================================================================================= -void TransformationGUI_RotationDlg::enterEvent(QEvent* e) +void TransformationGUI_RotationDlg::enterEvent( QEvent* ) { - if (!GroupConstructors->isEnabled()) + if ( !mainFrame()->GroupConstructors->isEnabled() ) ActivateThisDialog(); } @@ -376,22 +364,18 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_RotationDlg::createOperation() // function : isValid // purpose : //================================================================================= -bool TransformationGUI_RotationDlg::isValid( QString& msg ) +bool TransformationGUI_RotationDlg::isValid( QString& /*msg*/ ) { - switch (getConstructorId()) - { - case 0: - { - return !(myObjects.length() == 0 || myAxis->_is_nil()); - break; - } - case 1: - { - return !(myObjects.length() == 0 || myCentPoint->_is_nil() || myPoint1->_is_nil() || myPoint2->_is_nil() ); - break; - } - default: return false; - } + switch ( getConstructorId() ) { + case 0: + return !( myObjects.length() == 0 || myAxis->_is_nil() ); + break; + case 1: + return !( myObjects.length() == 0 || myCentPoint->_is_nil() || myPoint1->_is_nil() || myPoint2->_is_nil() ); + break; + default: + return false; + } } @@ -406,47 +390,46 @@ bool TransformationGUI_RotationDlg::execute( ObjectList& objects ) GEOM::GEOM_Object_var anObj; - switch ( getConstructorId() ) + switch ( getConstructorId() ) { + case 0 : + { + if ( toCreateCopy ) { + for ( int i = 0; i < myObjects.length(); i++ ) { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->RotateCopy( myObjects[i], myAxis, GetAngle() * PI180 ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } + } + else { + for ( int i = 0; i < myObjects.length(); i++ ) { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->Rotate( myObjects[i], myAxis, GetAngle() * PI180 ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } + } + res = true; + break; + } + case 1 : { - case 0 : - { - if (toCreateCopy) - for (int i = 0; i < myObjects.length(); i++) - { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->RotateCopy( myObjects[i], myAxis, GetAngle() * PI180 ); - if ( !anObj->_is_nil() ) - objects.push_back( anObj._retn() ); - } - else - for (int i = 0; i < myObjects.length(); i++) - { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->Rotate( myObjects[i], myAxis, GetAngle() * PI180 ); - if ( !anObj->_is_nil() ) - objects.push_back( anObj._retn() ); - } - res = true; - break; + if ( toCreateCopy ) { + for ( int i = 0; i < myObjects.length(); i++ ) { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->RotateThreePointsCopy( myObjects[i], myCentPoint, myPoint1, myPoint2 ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } } - case 1 : - { - if (toCreateCopy) - for (int i = 0; i < myObjects.length(); i++) - { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->RotateThreePointsCopy( myObjects[i], myCentPoint, myPoint1, myPoint2 ); - if ( !anObj->_is_nil() ) - objects.push_back( anObj._retn() ); - } - else - for (int i = 0; i < myObjects.length(); i++) - { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->RotateThreePoints( myObjects[i], myCentPoint, myPoint1, myPoint2 ); - if ( !anObj->_is_nil() ) - objects.push_back( anObj._retn() ); - } - res = true; - break; + else { + for ( int i = 0; i < myObjects.length(); i++ ) { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->RotateThreePoints( myObjects[i], myCentPoint, myPoint1, myPoint2 ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } } + res = true; + break; } + } return res; } @@ -468,7 +451,7 @@ void TransformationGUI_RotationDlg::closeEvent( QCloseEvent* e ) //================================================================================= double TransformationGUI_RotationDlg::GetAngle() const { - return GroupPoints->SpinBox_DX->GetValue(); + return GroupPoints->SpinBox_DX->value(); } @@ -476,9 +459,9 @@ double TransformationGUI_RotationDlg::GetAngle() const // function : CreateCopyModeChanged() // purpose : //================================================================================= -void TransformationGUI_RotationDlg::CreateCopyModeChanged(bool isCreateCopy) +void TransformationGUI_RotationDlg::CreateCopyModeChanged( bool isCreateCopy ) { - this->GroupBoxName->setEnabled(isCreateCopy); + mainFrame()->GroupBoxName->setEnabled( isCreateCopy ); } @@ -488,6 +471,6 @@ void TransformationGUI_RotationDlg::CreateCopyModeChanged(bool isCreateCopy) //================================================================================= void TransformationGUI_RotationDlg::onReverse() { - double anOldValue = GroupPoints->SpinBox_DX->GetValue(); - GroupPoints->SpinBox_DX->SetValue( -anOldValue ); + double anOldValue = GroupPoints->SpinBox_DX->value(); + GroupPoints->SpinBox_DX->setValue( -anOldValue ); } diff --git a/src/TransformationGUI/TransformationGUI_RotationDlg.h b/src/TransformationGUI/TransformationGUI_RotationDlg.h index ef22d3d19..2509cd2b6 100644 --- a/src/TransformationGUI/TransformationGUI_RotationDlg.h +++ b/src/TransformationGUI/TransformationGUI_RotationDlg.h @@ -1,34 +1,32 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : TransformationGUI_RotationDlg.h +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // -// -// File : TransformationGUI_RotationDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -#ifndef DIALOGBOX_ROTATION_H -#define DIALOGBOX_ROTATION_H +#ifndef TRANSFORMATIONGUI_ROTATIONDLG_H +#define TRANSFORMATIONGUI_ROTATIONDLG_H -#include "GEOMBase_Skeleton.h" +#include class DlgRef_4Sel1Spin2Check; @@ -38,42 +36,43 @@ class DlgRef_4Sel1Spin2Check; //================================================================================= class TransformationGUI_RotationDlg : public GEOMBase_Skeleton { - Q_OBJECT + Q_OBJECT public: - TransformationGUI_RotationDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, - const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0); - ~TransformationGUI_RotationDlg(); + TransformationGUI_RotationDlg( GeometryGUI*, QWidget* = 0, + bool = false, Qt::WindowFlags = 0 ); + ~TransformationGUI_RotationDlg(); 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 GetAngle() const; - - GEOM::ListOfGO myObjects; - GEOM::GEOM_Object_var myAxis, myCentPoint, myPoint1, myPoint2; + void Init(); + void enterEvent( QEvent* ); + double GetAngle() const; + +private: + GEOM::ListOfGO myObjects; + GEOM::GEOM_Object_var myAxis, myCentPoint, myPoint1, myPoint2; - DlgRef_4Sel1Spin2Check* GroupPoints; + DlgRef_4Sel1Spin2Check* GroupPoints; private slots: - void ClickOnOk(); - bool ClickOnApply(); - void ActivateThisDialog(); - void LineEditReturnPressed(); - void SelectionIntoArgument(); - void SetEditCurrentArgument(); - void ValueChangedInSpinBox(); - void CreateCopyModeChanged(bool isCreateCopy); - void ConstructorsClicked(int constructorId); - void onReverse(); + void ClickOnOk(); + bool ClickOnApply(); + void ActivateThisDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ValueChangedInSpinBox(); + void CreateCopyModeChanged( bool ); + void ConstructorsClicked( int ); + void onReverse(); }; -#endif // DIALOGBOX_ROTATION_H +#endif // TRANSFORMATIONGUI_ROTATIONDLG_H diff --git a/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx b/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx index 71218b4be..aa4f154ae 100644 --- a/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx @@ -1,46 +1,39 @@ -// 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 : TransformationGUI_ScaleDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ +// File : TransformationGUI_ScaleDlg.cxx +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. #include "TransformationGUI_ScaleDlg.h" -#include "DlgRef_2Sel1Spin2Check.h" -#include "DlgRef_SpinBox.h" -#include "GeometryGUI.h" -#include "GEOMBase.h" +#include +#include +#include -#include "SUIT_ResourceMgr.h" -#include "SUIT_Session.h" -#include "SalomeApp_Application.h" -#include "LightApp_SelectionMgr.h" +#include +#include +#include +#include -#include "GEOMImpl_Types.hxx" - -using namespace std; +#include //================================================================================= // class : TransformationGUI_ScaleDlg() @@ -49,68 +42,73 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -TransformationGUI_ScaleDlg::TransformationGUI_ScaleDlg(GeometryGUI* theGeometryGUI, QWidget* parent, - const char* name, bool modal, Qt::WindowFlags fl) - :GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) +TransformationGUI_ScaleDlg::TransformationGUI_ScaleDlg( GeometryGUI* theGeometryGUI, QWidget* parent, + bool modal, Qt::WindowFlags fl ) + : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ) { - QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_SCALE"))); - QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_SCALE" ) ) ); + QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); - setWindowTitle(tr("GEOM_SCALE_TITLE")); + setWindowTitle( tr( "GEOM_SCALE_TITLE" ) ); /***************************************************************/ - GroupConstructors->setTitle(tr("GEOM_SCALE")); - RadioButton1->setIcon(image0); - RadioButton2->setAttribute( Qt::WA_DeleteOnClose ); - RadioButton2->close(); - RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); - RadioButton3->close(); - - GroupPoints = new DlgRef_2Sel1Spin2Check(this, "GroupPoints"); + mainFrame()->GroupConstructors->setTitle( tr( "GEOM_SCALE" ) ); + mainFrame()->RadioButton1->setIcon( image0 ); + mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose ); + mainFrame()->RadioButton2->close(); + mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); + mainFrame()->RadioButton3->close(); + + GroupPoints = new DlgRef_2Sel1Spin2Check( centralWidget() ); GroupPoints->CheckButton2->hide(); - GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); - GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS")); - GroupPoints->TextLabel2->setText(tr("GEOM_CENTRAL_POINT")); - GroupPoints->TextLabel3->setText(tr("GEOM_SCALE_FACTOR")); + GroupPoints->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) ); + GroupPoints->TextLabel1->setText( tr( "GEOM_OBJECTS" ) ); + GroupPoints->TextLabel2->setText( tr( "GEOM_CENTRAL_POINT" ) ); + GroupPoints->TextLabel3->setText( tr( "GEOM_SCALE_FACTOR" ) ); GroupPoints->LineEdit1->setReadOnly( true ); GroupPoints->LineEdit2->setReadOnly( true ); - GroupPoints->PushButton1->setIcon(image1); - GroupPoints->PushButton2->setIcon(image1); - GroupPoints->CheckButton1->setText(tr("GEOM_CREATE_COPY")); + GroupPoints->PushButton1->setIcon( image1 ); + GroupPoints->PushButton2->setIcon( image1 ); + GroupPoints->CheckButton1->setText( tr( "GEOM_CREATE_COPY" ) ); // san -- modification of an exisitng object by offset is not allowed GroupPoints->CheckButton1->hide(); - gridLayout1->addWidget(GroupPoints, 2, 0); + QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); + layout->setMargin( 0 ); layout->setSpacing( 6 ); + layout->addWidget( GroupPoints ); + /***************************************************************/ double aFactor = 2.0; double SpecificStep = 0.5; /* min, max, step and decimals for spin boxes & initial values */ - GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, SpecificStep, 3); - GroupPoints->SpinBox_DX->SetValue(aFactor); + initSpinBox( GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, SpecificStep, 3 ); + GroupPoints->SpinBox_DX->setValue( aFactor ); // Activate Create a Copy mode - GroupPoints->CheckButton1->setChecked(true); - CreateCopyModeChanged(true); + GroupPoints->CheckButton1->setChecked( true ); + CreateCopyModeChanged( true ); /* signals and slots connections */ - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); - connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - - connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); - connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool))); + 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() ) ); + // VSR: TODO ->> + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupPoints->SpinBox_DX, SLOT( SetStep( double ) ) ); + // <<- + connect( GroupPoints->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( CreateCopyModeChanged( bool ) ) ); - connect(myGeomGUI->getApp()->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + connect( myGeomGUI->getApp()->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - setHelpFileName("scale_transform.htm"); + setHelpFileName( "scale_transform.htm" ); Init(); } @@ -137,7 +135,7 @@ void TransformationGUI_ScaleDlg::Init() myPoint = GEOM::GEOM_Object::_nil(); - initName( tr( "GEOM_SCALE" ).toLatin1().constData() ); + initName( tr( "GEOM_SCALE" ) ); } @@ -158,7 +156,7 @@ void TransformationGUI_ScaleDlg::ClickOnOk() //================================================================================= bool TransformationGUI_ScaleDlg::ClickOnApply() { - if ( !onAccept(GroupPoints->CheckButton1->isChecked()) ) + if ( !onAccept( GroupPoints->CheckButton1->isChecked() ) ) return false; Init(); @@ -172,34 +170,30 @@ bool TransformationGUI_ScaleDlg::ClickOnApply() //================================================================================= void TransformationGUI_ScaleDlg::SelectionIntoArgument() { - myEditCurrentArgument->setText(""); + myEditCurrentArgument->setText( "" ); QString aName; - if(myEditCurrentArgument == GroupPoints->LineEdit1) - { - int aNbSel = GEOMBase::GetNameOfSelectedIObjects(selectedIO(), aName); - if(aNbSel < 1) - { - myObjects.length(0); - return; - } - GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), myObjects); - if (!myObjects.length()) - return; + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) { + int aNbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aName ); + if ( aNbSel < 1 ) { + myObjects.length( 0 ); + return; } - else if(myEditCurrentArgument == GroupPoints->LineEdit2) - { - if(IObjectCount() != 1) - { - myPoint = GEOM::GEOM_Object::_nil(); - return; - } - Standard_Boolean testResult = Standard_False; - myPoint = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); - if(!testResult || CORBA::is_nil( myPoint )) - return; - aName = GEOMBase::GetName( myPoint ); + GEOMBase::ConvertListOfIOInListOfGO( selectedIO(), myObjects ); + if ( !myObjects.length() ) + return; + } + else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) { + if ( IObjectCount() != 1 ) { + myPoint = GEOM::GEOM_Object::_nil(); + return; } + Standard_Boolean testResult = Standard_False; + myPoint = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); + if ( !testResult || CORBA::is_nil( myPoint ) ) + return; + aName = GEOMBase::GetName( myPoint ); + } myEditCurrentArgument->setText( aName ); displayPreview(); @@ -213,12 +207,11 @@ void TransformationGUI_ScaleDlg::SelectionIntoArgument() void TransformationGUI_ScaleDlg::LineEditReturnPressed() { QLineEdit* send = (QLineEdit*)sender(); - if(send == GroupPoints->LineEdit1 || - send == GroupPoints->LineEdit2) - { - myEditCurrentArgument = send; - GEOMBase_Skeleton::LineEditReturnPressed(); - } + if ( send == GroupPoints->LineEdit1 || + send == GroupPoints->LineEdit2 ) { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } } @@ -230,11 +223,11 @@ void TransformationGUI_ScaleDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - if(send == GroupPoints->PushButton1) { + if ( send == GroupPoints->PushButton1 ) { myEditCurrentArgument = GroupPoints->LineEdit1; globalSelection(); } - else if(send == GroupPoints->PushButton2) { + else if ( send == GroupPoints->PushButton2 ) { myEditCurrentArgument = GroupPoints->LineEdit2; globalSelection( GEOM_POINT ); } @@ -251,8 +244,8 @@ void TransformationGUI_ScaleDlg::SetEditCurrentArgument() void TransformationGUI_ScaleDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(myGeomGUI->getApp()->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect( myGeomGUI->getApp()->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); globalSelection(); GroupPoints->LineEdit1->setFocus(); myEditCurrentArgument = GroupPoints->LineEdit1; @@ -263,9 +256,9 @@ void TransformationGUI_ScaleDlg::ActivateThisDialog() // function : enterEvent() // purpose : //================================================================================= -void TransformationGUI_ScaleDlg::enterEvent(QEvent* e) +void TransformationGUI_ScaleDlg::enterEvent( QEvent* ) { - if( !GroupConstructors->isEnabled() ) + if( !mainFrame()->GroupConstructors->isEnabled() ) ActivateThisDialog(); } @@ -284,7 +277,7 @@ void TransformationGUI_ScaleDlg::ValueChangedInSpinBox() // function : createOperation // purpose : //================================================================================= -GEOM::GEOM_IOperations_ptr TransformationGUI_ScaleDlg::createOperation() +GEOM::GEOM_IOperations_ptr TransformationGUI_ScaleDlg::createOperation() { return myGeomGUI->GetGeomGen()->GetITransformOperations( getStudyId() ); } @@ -293,9 +286,9 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_ScaleDlg::createOperation() // function : isValid // purpose : //================================================================================= -bool TransformationGUI_ScaleDlg::isValid( QString& msg ) +bool TransformationGUI_ScaleDlg::isValid( QString& /*msg*/) { - return !(myObjects.length() == 0 || myPoint->_is_nil() || fabs(GetFactor()) <= 0.00001); + return !( myObjects.length() == 0 || myPoint->_is_nil() || fabs( GetFactor()) <= 0.00001 ); } @@ -305,27 +298,23 @@ bool TransformationGUI_ScaleDlg::isValid( QString& msg ) //================================================================================= bool TransformationGUI_ScaleDlg::execute( ObjectList& objects ) { - bool res = false; - GEOM::GEOM_Object_var anObj; - if (GroupPoints->CheckButton1->isChecked() || IsPreview()) - for (int i = 0; i < myObjects.length(); i++) - { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->ScaleShapeCopy( myObjects[i], myPoint, GetFactor() ); - if ( !anObj->_is_nil() ) - objects.push_back( anObj._retn() ); - } - else - for (int i = 0; i < myObjects.length(); i++) - { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->ScaleShape( myObjects[i], myPoint, GetFactor() ); - if ( !anObj->_is_nil() ) - objects.push_back( anObj._retn() ); - } - res = true; - - return res; + if ( GroupPoints->CheckButton1->isChecked() || IsPreview() ) { + for ( int i = 0; i < myObjects.length(); i++ ) { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->ScaleShapeCopy( myObjects[i], myPoint, GetFactor() ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } + } + else { + for ( int i = 0; i < myObjects.length(); i++ ) { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->ScaleShape( myObjects[i], myPoint, GetFactor() ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } + } + return true; } @@ -345,7 +334,7 @@ void TransformationGUI_ScaleDlg::closeEvent( QCloseEvent* e ) //================================================================================= double TransformationGUI_ScaleDlg::GetFactor() const { - return GroupPoints->SpinBox_DX->GetValue(); + return GroupPoints->SpinBox_DX->value(); } @@ -353,7 +342,7 @@ double TransformationGUI_ScaleDlg::GetFactor() const // function : CreateCopyModeChanged() // purpose : //================================================================================= -void TransformationGUI_ScaleDlg::CreateCopyModeChanged(bool isCreateCopy) +void TransformationGUI_ScaleDlg::CreateCopyModeChanged( bool isCreateCopy ) { - this->GroupBoxName->setEnabled(isCreateCopy); + mainFrame()->GroupBoxName->setEnabled(isCreateCopy); } diff --git a/src/TransformationGUI/TransformationGUI_ScaleDlg.h b/src/TransformationGUI/TransformationGUI_ScaleDlg.h index 6b834fe1c..2e49ed7e9 100644 --- a/src/TransformationGUI/TransformationGUI_ScaleDlg.h +++ b/src/TransformationGUI/TransformationGUI_ScaleDlg.h @@ -1,34 +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 : TransformationGUI_ScaleDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM +// File : TransformationGUI_ScaleDlg.h +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. +// -#ifndef DIALOGBOX_SCALE_H -#define DIALOGBOX_SCALE_H +#ifndef TRANSFORMATIONGUI_SCALEDLG_H +#define TRANSFORMATIONGUI_SCALEDLG_H -#include "GEOMBase_Skeleton.h" +#include class DlgRef_2Sel1Spin2Check; @@ -38,40 +38,41 @@ class DlgRef_2Sel1Spin2Check; //================================================================================= class TransformationGUI_ScaleDlg : public GEOMBase_Skeleton { - Q_OBJECT + Q_OBJECT public: - TransformationGUI_ScaleDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, - const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0); - ~TransformationGUI_ScaleDlg(); + TransformationGUI_ScaleDlg( GeometryGUI*, QWidget* = 0, + bool = false, Qt::WindowFlags = 0 ); + ~TransformationGUI_ScaleDlg(); 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 GetFactor() const; +private: + void Init(); + void enterEvent( QEvent* ); + double GetFactor() const; - GEOM::ListOfGO myObjects; - GEOM::GEOM_Object_var myPoint; /* Central Point */ +private: + GEOM::ListOfGO myObjects; + GEOM::GEOM_Object_var myPoint; /* Central Point */ - DlgRef_2Sel1Spin2Check* GroupPoints; + DlgRef_2Sel1Spin2Check* GroupPoints; private slots: - void ClickOnOk(); - bool ClickOnApply(); - void ActivateThisDialog(); - void LineEditReturnPressed(); - void SelectionIntoArgument(); - void SetEditCurrentArgument(); - void ValueChangedInSpinBox(); - void CreateCopyModeChanged(bool isCreateCopy); + void ClickOnOk(); + bool ClickOnApply(); + void ActivateThisDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ValueChangedInSpinBox(); + void CreateCopyModeChanged( bool ); }; -#endif // DIALOGBOX_SCALE_H +#endif // TRANSFORMATIONGUI_SCALEDLG_H diff --git a/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx b/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx index b4962ceb6..fb9fe89d0 100644 --- a/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_TranslationDlg.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 : TransformationGUI_TranslationDlg.cxx +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // -// -// File : TransformationGUI_TranslationDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ #include "TransformationGUI_TranslationDlg.h" -#include "DlgRef_3Sel3Spin1Check.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 : TransformationGUI_TranslationDlg() @@ -50,41 +44,42 @@ using namespace std; // TRUE to construct a modal dialog. //================================================================================= TransformationGUI_TranslationDlg::TransformationGUI_TranslationDlg - (GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl) - :GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) +( GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl ) + : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ) { SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr(); - QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_TRANSLATION_DXYZ"))); - QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_TRANSLATION_POINTS"))); - QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_TRANSLATION_VECTOR"))); - QPixmap image3 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT"))); + QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_TRANSLATION_DXYZ" ) ) ); + QPixmap image1( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_TRANSLATION_POINTS" ) ) ); + QPixmap image2( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_TRANSLATION_VECTOR" ) ) ); + QPixmap image3( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); - setWindowTitle(tr("GEOM_TRANSLATION_TITLE")); + setWindowTitle( tr( "GEOM_TRANSLATION_TITLE" ) ); /***************************************************************/ - GroupConstructors->setTitle(tr("GEOM_TRANSLATION")); - RadioButton1->setIcon(image0); - RadioButton2->setIcon(image1); - RadioButton3->setIcon(image2); - - RadioButton1->setChecked(true); - - GroupPoints = new DlgRef_3Sel3Spin1Check(this, "GroupPoints"); - GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); - GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS")); - GroupPoints->TextLabel3->setText(tr("GEOM_POINT_I").arg("2")); - GroupPoints->TextLabel4->setText(tr("GEOM_DX")); - GroupPoints->TextLabel5->setText(tr("GEOM_DY")); - GroupPoints->TextLabel6->setText(tr("GEOM_DZ")); - GroupPoints->PushButton1->setIcon(image3); - GroupPoints->PushButton2->setIcon(image3); - GroupPoints->PushButton3->setIcon(image3); - GroupPoints->CheckBox1->setText(tr("GEOM_CREATE_COPY")); - - gridLayout1->addWidget(GroupPoints, 2, 0); + mainFrame()->GroupConstructors->setTitle( tr( "GEOM_TRANSLATION" ) ); + mainFrame()->RadioButton1->setIcon( image0 ); + mainFrame()->RadioButton2->setIcon( image1 ); + mainFrame()->RadioButton3->setIcon( image2 ); + mainFrame()->RadioButton1->setChecked( true ); + + GroupPoints = new DlgRef_3Sel3Spin1Check( centralWidget() ); + GroupPoints->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) ); + GroupPoints->TextLabel1->setText( tr( "GEOM_OBJECTS" ) ); + GroupPoints->TextLabel3->setText( tr( "GEOM_POINT_I" ).arg( 2 ) ); + GroupPoints->TextLabel4->setText( tr( "GEOM_DX" ) ); + GroupPoints->TextLabel5->setText( tr( "GEOM_DY" ) ); + GroupPoints->TextLabel6->setText( tr( "GEOM_DZ" ) ); + GroupPoints->PushButton1->setIcon( image3 ); + GroupPoints->PushButton2->setIcon( image3 ); + GroupPoints->PushButton3->setIcon( image3 ); + GroupPoints->CheckBox1->setText( tr( "GEOM_CREATE_COPY" ) ); + + QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); + layout->setMargin( 0 ); layout->setSpacing( 6 ); + layout->addWidget( GroupPoints ); /***************************************************************/ - setHelpFileName("translation.htm"); + setHelpFileName( "translation.htm" ); Init(); } @@ -108,54 +103,58 @@ void TransformationGUI_TranslationDlg::Init() { /* init variables */ myEditCurrentArgument = GroupPoints->LineEdit1; - GroupPoints->LineEdit1->setReadOnly(true); - GroupPoints->LineEdit2->setReadOnly(true); - GroupPoints->LineEdit3->setReadOnly(true); + GroupPoints->LineEdit1->setReadOnly( true ); + GroupPoints->LineEdit2->setReadOnly( true ); + GroupPoints->LineEdit3->setReadOnly( true ); myVector = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); // Activate Create a Copy mode - GroupPoints->CheckBox1->setChecked(true); - CreateCopyModeChanged(true); + GroupPoints->CheckBox1->setChecked( true ); + CreateCopyModeChanged( true ); /* Get setting of step value from file configuration */ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); - double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); + double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100 ); /* min, max, step and decimals for spin boxes & initial values */ - GroupPoints->SpinBox1->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - GroupPoints->SpinBox2->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - GroupPoints->SpinBox3->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); + initSpinBox( GroupPoints->SpinBox1, COORD_MIN, COORD_MAX, step, 3 ); + initSpinBox( GroupPoints->SpinBox2, COORD_MIN, COORD_MAX, step, 3 ); + initSpinBox( GroupPoints->SpinBox3, COORD_MIN, COORD_MAX, step, 3 ); - GroupPoints->SpinBox1->SetValue(0.0); - GroupPoints->SpinBox2->SetValue(0.0); - GroupPoints->SpinBox3->SetValue(0.0); + GroupPoints->SpinBox1->setValue( 0.0 ); + GroupPoints->SpinBox2->setValue( 0.0 ); + GroupPoints->SpinBox3->setValue( 0.0 ); /* signals and slots connections */ - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); - connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int))); + connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); + + connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) ); - connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPoints->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( GroupPoints->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); //@ Delete ? + connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); //@ Delete ? - connect(GroupPoints->SpinBox1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); - connect(GroupPoints->SpinBox2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); - connect(GroupPoints->SpinBox3, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + connect( GroupPoints->SpinBox1, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) ); + connect( GroupPoints->SpinBox2, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) ); + connect( GroupPoints->SpinBox3, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) ); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox1, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox2, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox3, SLOT(SetStep(double))); + // VSR: TODO ->> + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupPoints->SpinBox1, SLOT( SetStep( double ) ) ); + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupPoints->SpinBox2, SLOT( SetStep( double ) ) ); + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupPoints->SpinBox3, SLOT( SetStep( double ) ) ); + // <<- - connect(GroupPoints->CheckBox1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool))); + connect( GroupPoints->CheckBox1, SIGNAL( toggled( bool ) ), this, SLOT( CreateCopyModeChanged( bool ) ) ); - connect(myGeomGUI->getApp()->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + connect( myGeomGUI->getApp()->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + + initName( tr( "GEOM_TRANSLATION" ) ); - initName( tr( "GEOM_TRANSLATION" ).toLatin1().constData() ); ConstructorsClicked( 0 ); } @@ -164,48 +163,48 @@ void TransformationGUI_TranslationDlg::Init() // function : ConstructorsClicked() // purpose : Radio button management //================================================================================= -void TransformationGUI_TranslationDlg::ConstructorsClicked(int constructorId) +void TransformationGUI_TranslationDlg::ConstructorsClicked( int constructorId ) { - disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); + disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 ); myEditCurrentArgument = GroupPoints->LineEdit1; globalSelection(); - switch (constructorId) + switch ( constructorId ) { + case 0: /* translation an object by dx, dy, dz */ + { + GroupPoints->ShowRows( 1, 2, false ); + GroupPoints->ShowRows( 3, 5, true ); + break; + } + case 1: /* translation an object by 2 points */ { - case 0: /* translation an object by dx, dy, dz */ - { - GroupPoints->ShowRows(1,2,false); - resize(0,0); - GroupPoints->ShowRows(3,5,true); - break; - } - case 1: /* translation an object by 2 points */ - { - GroupPoints->ShowRows(3,5,false); - resize(0,0); - GroupPoints->ShowRows(0,2,true); - GroupPoints->TextLabel2->setText(tr("GEOM_POINT_I").arg("1")); - GroupPoints->LineEdit2->clear(); - GroupPoints->LineEdit3->clear(); - myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); - break; - } - case 2: /* translation an object by vector */ - { - GroupPoints->ShowRows(2,5,false); - resize(0,0); - GroupPoints->ShowRows(0,1,true); - GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR")); - GroupPoints->LineEdit2->clear(); - myVector = GEOM::GEOM_Object::_nil(); - break; - } + GroupPoints->ShowRows( 3, 5, false ); + GroupPoints->ShowRows( 0, 2, true ); + GroupPoints->TextLabel2->setText( tr( "GEOM_POINT_I" ).arg( 1 ) ); + GroupPoints->LineEdit2->clear(); + GroupPoints->LineEdit3->clear(); + myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); + break; + } + case 2: /* translation an object by vector */ + { + GroupPoints->ShowRows( 2, 5, false ); + GroupPoints->ShowRows( 0, 1, true ); + GroupPoints->TextLabel2->setText( tr( "GEOM_VECTOR" ) ); + GroupPoints->LineEdit2->clear(); + myVector = GEOM::GEOM_Object::_nil(); + break; } + } + qApp->processEvents(); + updateGeometry(); + resize( minimumSize() ); + myEditCurrentArgument->setFocus(); - connect(myGeomGUI->getApp()->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect( myGeomGUI->getApp()->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); } @@ -241,49 +240,46 @@ bool TransformationGUI_TranslationDlg::ClickOnApply() //================================================================================= void TransformationGUI_TranslationDlg::SelectionIntoArgument() { - myEditCurrentArgument->setText(""); + myEditCurrentArgument->setText( "" ); QString aName; - if(myEditCurrentArgument == GroupPoints->LineEdit1) - { - int aNbSel = GEOMBase::GetNameOfSelectedIObjects(selectedIO(), aName); - - if(aNbSel < 1) - { - myObjects.length(0); + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) { + int aNbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aName ); + + if ( aNbSel < 1 ) { + myObjects.length( 0 ); return; - } - GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), myObjects); - if (!myObjects.length()) - return; } - else - { - if (IObjectCount() != 1) { - if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1) - myPoint1 = GEOM::GEOM_Object::_nil(); - else if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2) - myVector = GEOM::GEOM_Object::_nil(); - else if(myEditCurrentArgument == GroupPoints->LineEdit3) - myPoint2 = GEOM::GEOM_Object::_nil(); - return; - } - - Standard_Boolean testResult = Standard_False;; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); - - if (!testResult || CORBA::is_nil( aSelectedObject )) - return; - - if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1) - myPoint1 = aSelectedObject; - else if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2) - myVector = aSelectedObject; - else if(myEditCurrentArgument == GroupPoints->LineEdit3) - myPoint2 = aSelectedObject; - - aName = GEOMBase::GetName( aSelectedObject ); + GEOMBase::ConvertListOfIOInListOfGO( selectedIO(), myObjects ); + if ( !myObjects.length() ) + return; + } + else { + if ( IObjectCount() != 1 ) { + if ( myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1 ) + myPoint1 = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2 ) + myVector = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == GroupPoints->LineEdit3 ) + myPoint2 = GEOM::GEOM_Object::_nil(); + return; } + + Standard_Boolean testResult = Standard_False;; + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); + + if ( !testResult || CORBA::is_nil( aSelectedObject ) ) + return; + + if ( myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1 ) + myPoint1 = aSelectedObject; + else if ( myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2 ) + myVector = aSelectedObject; + else if ( myEditCurrentArgument == GroupPoints->LineEdit3 ) + myPoint2 = aSelectedObject; + + aName = GEOMBase::GetName( aSelectedObject ); + } myEditCurrentArgument->setText( aName ); @@ -298,11 +294,10 @@ void TransformationGUI_TranslationDlg::SelectionIntoArgument() void TransformationGUI_TranslationDlg::LineEditReturnPressed() { QLineEdit* send = (QLineEdit*)sender(); - if(send == GroupPoints->LineEdit1) - { - myEditCurrentArgument = send; - GEOMBase_Skeleton::LineEditReturnPressed(); - } + if ( send == GroupPoints->LineEdit1 ) { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } } @@ -314,22 +309,19 @@ void TransformationGUI_TranslationDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - if(send == GroupPoints->PushButton1) - { - myEditCurrentArgument = GroupPoints->LineEdit1; - globalSelection(); - } - else if (send == GroupPoints->PushButton2) - { - myEditCurrentArgument = GroupPoints->LineEdit2; - getConstructorId() == 1 ? globalSelection( GEOM_POINT ) : - globalSelection( GEOM_LINE ); - } - else if (send == GroupPoints->PushButton3) - { - myEditCurrentArgument = GroupPoints->LineEdit3; - globalSelection( GEOM_POINT ); - } + if ( send == GroupPoints->PushButton1 ) { + myEditCurrentArgument = GroupPoints->LineEdit1; + globalSelection(); + } + else if ( send == GroupPoints->PushButton2 ) { + myEditCurrentArgument = GroupPoints->LineEdit2; + getConstructorId() == 1 ? globalSelection( GEOM_POINT ) : + globalSelection( GEOM_LINE ); + } + else if ( send == GroupPoints->PushButton3 ) { + myEditCurrentArgument = GroupPoints->LineEdit3; + globalSelection( GEOM_POINT ); + } myEditCurrentArgument->setFocus(); SelectionIntoArgument(); @@ -343,8 +335,8 @@ void TransformationGUI_TranslationDlg::SetEditCurrentArgument() void TransformationGUI_TranslationDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(myGeomGUI->getApp()->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect( myGeomGUI->getApp()->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); ConstructorsClicked( getConstructorId() ); } @@ -354,9 +346,9 @@ void TransformationGUI_TranslationDlg::ActivateThisDialog() // function : enterEvent() // purpose : //================================================================================= -void TransformationGUI_TranslationDlg::enterEvent(QEvent* e) +void TransformationGUI_TranslationDlg::enterEvent( QEvent* ) { - if(!GroupConstructors->isEnabled()) + if( !mainFrame()->GroupConstructors->isEnabled() ) ActivateThisDialog(); } @@ -375,7 +367,7 @@ void TransformationGUI_TranslationDlg::ValueChangedInSpinBox() // function : createOperation // purpose : //================================================================================= -GEOM::GEOM_IOperations_ptr TransformationGUI_TranslationDlg::createOperation() +GEOM::GEOM_IOperations_ptr TransformationGUI_TranslationDlg::createOperation() { return myGeomGUI->GetGeomGen()->GetITransformOperations( getStudyId() ); } @@ -385,29 +377,23 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_TranslationDlg::createOperation() // function : isValid // purpose : //================================================================================= -bool TransformationGUI_TranslationDlg::isValid( QString& msg ) +bool TransformationGUI_TranslationDlg::isValid( QString& /*msg*/ ) { int aConstructorId = getConstructorId(); - switch (aConstructorId) - { - case 0: - { - return !(myObjects.length() == 0 ); - break; - } - case 1: - { - return !(myObjects.length() == 0 || myPoint1->_is_nil() || myPoint2->_is_nil() ); - break; - } - case 2: - { - return !(myObjects.length() == 0 || myVector->_is_nil()); - break; - } - default: return false; - } + switch ( aConstructorId ) { + case 0: + return !( myObjects.length() == 0 ); + break; + case 1: + return !( myObjects.length() == 0 || myPoint1->_is_nil() || myPoint2->_is_nil() ); + break; + case 2: + return !( myObjects.length() == 0 || myVector->_is_nil() ); + break; + default: + return false; + } } //================================================================================= @@ -421,70 +407,69 @@ bool TransformationGUI_TranslationDlg::execute( ObjectList& objects ) GEOM::GEOM_Object_var anObj; - switch ( getConstructorId() ) + switch ( getConstructorId() ) { + case 0: { - case 0 : - { - double dx = GroupPoints->SpinBox1->GetValue(); - double dy = GroupPoints->SpinBox2->GetValue(); - double dz = GroupPoints->SpinBox3->GetValue(); - - if (toCreateCopy) - for (int i = 0; i < myObjects.length(); i++) - { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateDXDYDZCopy( myObjects[i], dx, dy, dz ); - if ( !anObj->_is_nil() ) - objects.push_back( anObj._retn() ); - } - else - for (int i = 0; i < myObjects.length(); i++) - { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateDXDYDZ( myObjects[i], dx, dy, dz ); - if ( !anObj->_is_nil() ) - objects.push_back( anObj._retn() ); - } - res = true; - break; + double dx = GroupPoints->SpinBox1->value(); + double dy = GroupPoints->SpinBox2->value(); + double dz = GroupPoints->SpinBox3->value(); + + if ( toCreateCopy ) { + for ( int i = 0; i < myObjects.length(); i++ ) { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateDXDYDZCopy( myObjects[i], dx, dy, dz ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } } - case 1 : - { - if (toCreateCopy) - for (int i = 0; i < myObjects.length(); i++) - { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateTwoPointsCopy( myObjects[i], myPoint1, myPoint2 ); - if ( !anObj->_is_nil() ) - objects.push_back( anObj._retn() ); - } - else - for (int i = 0; i < myObjects.length(); i++) - { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateTwoPoints( myObjects[i], myPoint1, myPoint2 ); - if ( !anObj->_is_nil() ) - objects.push_back( anObj._retn() ); - } - res = true; - break; + else { + for ( int i = 0; i < myObjects.length(); i++ ) { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateDXDYDZ( myObjects[i], dx, dy, dz ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } } - case 2: - { - if (toCreateCopy) - for (int i = 0; i < myObjects.length(); i++) - { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateVectorCopy( myObjects[i], myVector ); - if ( !anObj->_is_nil() ) - objects.push_back( anObj._retn() ); - } - else - for (int i = 0; i < myObjects.length(); i++) - { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateVector( myObjects[i], myVector ); - if ( !anObj->_is_nil() ) - objects.push_back( anObj._retn() ); - } - res = true; - break; + res = true; + break; + } + case 1: + { + if ( toCreateCopy ) { + for ( int i = 0; i < myObjects.length(); i++ ) { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateTwoPointsCopy( myObjects[i], myPoint1, myPoint2 ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } + } + else { + for ( int i = 0; i < myObjects.length(); i++ ) { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateTwoPoints( myObjects[i], myPoint1, myPoint2 ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } + } + res = true; + break; + } + case 2: + { + if ( toCreateCopy ) { + for ( int i = 0; i < myObjects.length(); i++ ) { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateVectorCopy( myObjects[i], myVector ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } + } + else { + for ( int i = 0; i < myObjects.length(); i++ ) { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateVector( myObjects[i], myVector ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } } + res = true; + break; } + } return res; } @@ -505,7 +490,7 @@ void TransformationGUI_TranslationDlg::closeEvent( QCloseEvent* e ) // function : CreateCopyModeChanged() // purpose : //================================================================================= -void TransformationGUI_TranslationDlg::CreateCopyModeChanged(bool isCreateCopy) +void TransformationGUI_TranslationDlg::CreateCopyModeChanged( bool isCreateCopy ) { - GroupBoxName->setEnabled(isCreateCopy); + mainFrame()->GroupBoxName->setEnabled( isCreateCopy ); } diff --git a/src/TransformationGUI/TransformationGUI_TranslationDlg.h b/src/TransformationGUI/TransformationGUI_TranslationDlg.h index 53c696f16..823437e26 100644 --- a/src/TransformationGUI/TransformationGUI_TranslationDlg.h +++ b/src/TransformationGUI/TransformationGUI_TranslationDlg.h @@ -1,34 +1,32 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : TransformationGUI_TranslationDlg.h +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // -// -// File : TransformationGUI_TranslationDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -#ifndef DIALOGBOX_TRANSLATION_H -#define DIALOGBOX_TRANSLATION_H +#ifndef TRANSFORMATIONGUI_TRANSLATIONDLG_H +#define TRANSFORMATIONGUI_TRANSLATIONDLG_H -#include "GEOMBase_Skeleton.h" +#include class DlgRef_3Sel3Spin1Check; @@ -38,40 +36,41 @@ class DlgRef_3Sel3Spin1Check; //================================================================================= class TransformationGUI_TranslationDlg : public GEOMBase_Skeleton { - Q_OBJECT + Q_OBJECT public: - TransformationGUI_TranslationDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, - const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0); - ~TransformationGUI_TranslationDlg(); + TransformationGUI_TranslationDlg( GeometryGUI*, QWidget* = 0, + bool = false, Qt::WindowFlags = 0 ); + ~TransformationGUI_TranslationDlg(); 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 myVector, myPoint1, myPoint2; - GEOM::ListOfGO myObjects; + // redefined from GEOMBase_Helper + virtual GEOM::GEOM_IOperations_ptr createOperation(); + virtual bool isValid( QString& ); + virtual bool execute( ObjectList& ); + + virtual void closeEvent( QCloseEvent* ); - DlgRef_3Sel3Spin1Check* GroupPoints; +private: + void Init(); + void enterEvent( QEvent* ); -private slots : - void ClickOnOk(); - bool ClickOnApply(); - void ActivateThisDialog(); - void LineEditReturnPressed(); - void SelectionIntoArgument(); - void SetEditCurrentArgument(); - void ValueChangedInSpinBox(); - void ConstructorsClicked(int constructorId); - void CreateCopyModeChanged(bool isCreateCopy); +private: + GEOM::GEOM_Object_var myVector, myPoint1, myPoint2; + GEOM::ListOfGO myObjects; + + DlgRef_3Sel3Spin1Check* GroupPoints; + +private slots: + void ClickOnOk(); + bool ClickOnApply(); + void ActivateThisDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ValueChangedInSpinBox(); + void ConstructorsClicked( int ); + void CreateCopyModeChanged( bool ); }; -#endif // DIALOGBOX_TRANSLATION_H +#endif // TRANSFORMATIONGUI_TRANSLATIONDLG_H