From: vsr Date: Tue, 23 Oct 2007 14:08:53 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: snapshot_171207~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=652535d4666120e80c3d1a452fd6067b02a793a1;p=modules%2Fgeom.git *** empty log message *** --- diff --git a/src/BlocksGUI/BlocksGUI.cxx b/src/BlocksGUI/BlocksGUI.cxx index 2ab3c1db0..24a22d280 100644 --- a/src/BlocksGUI/BlocksGUI.cxx +++ b/src/BlocksGUI/BlocksGUI.cxx @@ -1,29 +1,26 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 CEA +// Copyright (C) 2003 CEA // -// 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 : BooleanGUI.cxx +// Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com) // -// -// File : BooleanGUI.cxx -// Author : Julia DOOVSKIKH -// Module : GEOM -// $Header$ #include "BlocksGUI.h" @@ -33,20 +30,19 @@ #include "BlocksGUI_ExplodeDlg.h" #include "BlocksGUI_PropagateDlg.h" -#include "GeometryGUI.h" - -#include "SUIT_Desktop.h" -#include "SUIT_MessageBox.h" -#include "SUIT_Session.h" +#include -#include "SalomeApp_Application.h" +#include +#include +#include +#include //======================================================================= // function : BlocksGUI() // purpose : Constructor //======================================================================= BlocksGUI::BlocksGUI( GeometryGUI* parent ) - : GEOMGUI( parent ) + : GEOMGUI( parent ) { } @@ -66,22 +62,24 @@ bool BlocksGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) { getGeometryGUI()->EmitSignalDeactivateDialog(); - QDialog* aDlg = NULL; + QDialog* aDlg = 0; - switch (theCommandID) - { - case 9999: aDlg = new BlocksGUI_BlockDlg (getGeometryGUI(), parent); break; - case 9998: aDlg = new BlocksGUI_TrsfDlg (getGeometryGUI(), parent); break; - case 9997: aDlg = new BlocksGUI_QuadFaceDlg (getGeometryGUI(), parent); break; - case 9995: aDlg = new BlocksGUI_ExplodeDlg (getGeometryGUI(), parent); break; - case 99991: aDlg = new BlocksGUI_PropagateDlg (getGeometryGUI(), parent); break; - default: - getGeometryGUI()->getApp()->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); - break; + switch ( theCommandID ) { + case 9999: aDlg = new BlocksGUI_BlockDlg ( getGeometryGUI(), parent ); break; + case 9998: aDlg = new BlocksGUI_TrsfDlg ( getGeometryGUI(), parent ); break; + case 9997: aDlg = new BlocksGUI_QuadFaceDlg ( getGeometryGUI(), parent ); break; + case 9995: aDlg = new BlocksGUI_ExplodeDlg ( getGeometryGUI(), parent ); break; + case 99991: aDlg = new BlocksGUI_PropagateDlg( getGeometryGUI(), parent ); break; + default: + getGeometryGUI()->getApp()->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) ); + break; } - if (aDlg != NULL) + if ( aDlg ) { + aDlg->updateGeometry(); + aDlg->resize( aDlg->minimumSize() ); aDlg->show(); + } return true; } @@ -91,7 +89,9 @@ bool BlocksGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) //===================================================================================== extern "C" { - GEOM_BLOCKSGUI_EXPORT +#ifdef WIN32 + __declspec( dllexport ) +#endif GEOMGUI* GetLibGUI( GeometryGUI* parent ) { return new BlocksGUI( parent ); diff --git a/src/BlocksGUI/BlocksGUI.h b/src/BlocksGUI/BlocksGUI.h index 9d546a298..6b95f8398 100644 --- a/src/BlocksGUI/BlocksGUI.h +++ b/src/BlocksGUI/BlocksGUI.h @@ -1,47 +1,43 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 CEA +// Copyright (C) 2003 CEA // -// 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 : BuildGUI.h +// Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com) // -// -// File : BuildGUI.h -// Author : Julia DOROVSKIKH -// Module : GEOM #ifndef BLOCKSGUI_H #define BLOCKSGUI_H -#include "GEOM_BlocksGUI.hxx" - -#include "GEOMGUI.h" +#include //================================================================================= // class : BlocksGUI // purpose : //================================================================================= -class GEOM_BLOCKSGUI_EXPORT BlocksGUI : public GEOMGUI +class BlocksGUI : public GEOMGUI { - public: - BlocksGUI( GeometryGUI* parent ); +public: + BlocksGUI( GeometryGUI* ); ~BlocksGUI(); - bool OnGUIEvent (int theCommandID, SUIT_Desktop* parent); + bool OnGUIEvent( int, SUIT_Desktop* ); }; -#endif +#endif // BLOCKSGUI_H diff --git a/src/BlocksGUI/BlocksGUI_BlockDlg.cxx b/src/BlocksGUI/BlocksGUI_BlockDlg.cxx index cc7876a36..54ba3f90f 100644 --- a/src/BlocksGUI/BlocksGUI_BlockDlg.cxx +++ b/src/BlocksGUI/BlocksGUI_BlockDlg.cxx @@ -1,93 +1,93 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 CEA +// Copyright (C) 2003 CEA // -// 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 : BlocksGUI_BlockDlg.cxx +// Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com) // -// -// File : BlocksGUI_BlockDlg.cxx -// Author : Julia DOROVSKIKH -// Module : GEOM -// $Header$ #include "BlocksGUI_BlockDlg.h" -#include "SUIT_Session.h" -#include "SalomeApp_Application.h" -#include "LightApp_SelectionMgr.h" - -#include "GEOMImpl_Types.hxx" +#include +#include +#include -using namespace std; +#include +#include +#include +#include -#include +#include //================================================================================= // class : BlocksGUI_BlockDlg() // purpose : Constructs a BlocksGUI_BlockDlg which is a child of 'parent'. //================================================================================= -BlocksGUI_BlockDlg::BlocksGUI_BlockDlg (GeometryGUI* theGeometryGUI, QWidget* parent, bool modal) - : GEOMBase_Skeleton(theGeometryGUI, parent, "BlockDlg", modal, - WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +BlocksGUI_BlockDlg::BlocksGUI_BlockDlg( GeometryGUI* theGeometryGUI, QWidget* parent ) + : GEOMBase_Skeleton( theGeometryGUI, parent ) { - QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_BLOCK_2F"))); - QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_BLOCK_6F"))); - QPixmap imageS (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT"))); + QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_BLOCK_2F" ) ) ); + QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_BLOCK_6F" ) ) ); + QPixmap imageS( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); - setCaption(tr("GEOM_BLOCK_TITLE")); + setWindowTitle( tr( "GEOM_BLOCK_TITLE" ) ); /***************************************************************/ - GroupConstructors->setTitle(tr("GEOM_BLOCK")); + mainFrame()->GroupConstructors->setTitle( tr( "GEOM_BLOCK" ) ); - RadioButton1->setPixmap(image0); - RadioButton2->setPixmap(image1); - RadioButton3->close(TRUE); + mainFrame()->RadioButton1->setIcon( image0 ); + mainFrame()->RadioButton2->setIcon( image1 ); + mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); + mainFrame()->RadioButton3->close(); // Create first group - Group2F = new DlgRef_2Sel_QTD(this, "Group2F"); - Group2F->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); - Group2F->TextLabel1->setText(tr("FACE_1")); - Group2F->TextLabel2->setText(tr("FACE_2")); - Group2F->PushButton1->setPixmap(imageS); - Group2F->PushButton2->setPixmap(imageS); + Group2F = new DlgRef_2Sel( centralWidget() ); + Group2F->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) ); + Group2F->TextLabel1->setText( tr( "FACE_1" ) ); + Group2F->TextLabel2->setText( tr( "FACE_2" ) ); + Group2F->PushButton1->setIcon( imageS ); + Group2F->PushButton2->setIcon( imageS ); // Create second group - Group6F = new DlgRef_6Sel_QTD(this, "Group2F"); - Group6F->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); - Group6F->TextLabel1->setText(tr("FACE_1")); - Group6F->TextLabel2->setText(tr("FACE_2")); - Group6F->TextLabel3->setText(tr("FACE_3")); - Group6F->TextLabel4->setText(tr("FACE_4")); - Group6F->TextLabel5->setText(tr("FACE_5")); - Group6F->TextLabel6->setText(tr("FACE_6")); - Group6F->PushButton1->setPixmap(imageS); - Group6F->PushButton2->setPixmap(imageS); - Group6F->PushButton3->setPixmap(imageS); - Group6F->PushButton4->setPixmap(imageS); - Group6F->PushButton5->setPixmap(imageS); - Group6F->PushButton6->setPixmap(imageS); + Group6F = new DlgRef_6Sel( centralWidget() ); + Group6F->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) ); + Group6F->TextLabel1->setText( tr( "FACE_1" ) ); + Group6F->TextLabel2->setText( tr( "FACE_2" ) ); + Group6F->TextLabel3->setText( tr( "FACE_3" ) ); + Group6F->TextLabel4->setText( tr( "FACE_4" ) ); + Group6F->TextLabel5->setText( tr( "FACE_5" ) ); + Group6F->TextLabel6->setText( tr( "FACE_6" ) ); + Group6F->PushButton1->setIcon( imageS ); + Group6F->PushButton2->setIcon( imageS ); + Group6F->PushButton3->setIcon( imageS ); + Group6F->PushButton4->setIcon( imageS ); + Group6F->PushButton5->setIcon( imageS ); + Group6F->PushButton6->setIcon( imageS ); // Add groups to layout - Layout1->addWidget(Group2F, 2, 0); - Layout1->addWidget(Group6F, 2, 0); + QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); + layout->setMargin( 0 ); layout->setSpacing( 6 ); + layout->addWidget( Group2F ); + layout->addWidget( Group6F ); /***************************************************************/ - setHelpFileName("newentity_blocks.htm#HexahedralSolid"); + setHelpFileName( "newentity_blocks.htm#HexahedralSolid" ); Init(); } @@ -108,74 +108,74 @@ BlocksGUI_BlockDlg::~BlocksGUI_BlockDlg() void BlocksGUI_BlockDlg::Init() { // init variables - Group2F->LineEdit1->setReadOnly(true); - Group2F->LineEdit2->setReadOnly(true); + Group2F->LineEdit1->setReadOnly( true ); + Group2F->LineEdit2->setReadOnly( true ); - Group6F->LineEdit1->setReadOnly(true); - Group6F->LineEdit2->setReadOnly(true); - Group6F->LineEdit3->setReadOnly(true); - Group6F->LineEdit4->setReadOnly(true); - Group6F->LineEdit5->setReadOnly(true); - Group6F->LineEdit6->setReadOnly(true); + Group6F->LineEdit1->setReadOnly( true ); + Group6F->LineEdit2->setReadOnly( true ); + Group6F->LineEdit3->setReadOnly( true ); + Group6F->LineEdit4->setReadOnly( true ); + Group6F->LineEdit5->setReadOnly( true ); + Group6F->LineEdit6->setReadOnly( true ); // signals and slots connections - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); - connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); + connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); + + connect( this, SIGNAL( constructorsClicked( int ) ), + this, SLOT( ConstructorsClicked( int ) ) ); - connect(Group2F->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(Group2F->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect( Group2F->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( Group2F->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect(Group6F->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(Group6F->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(Group6F->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(Group6F->PushButton4, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(Group6F->PushButton5, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(Group6F->PushButton6, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect( Group6F->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( Group6F->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( Group6F->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( Group6F->PushButton4, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( Group6F->PushButton5, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( Group6F->PushButton6, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); // init controls and fields - initName(tr("GEOM_BLOCK")); + initName( tr( "GEOM_BLOCK" ) ); myConstructorId = -1; - ConstructorsClicked(0); + ConstructorsClicked( 0 ); } //================================================================================= // function : ConstructorsClicked() // purpose : Radio button management //================================================================================= -void BlocksGUI_BlockDlg::ConstructorsClicked (int constructorId) +void BlocksGUI_BlockDlg::ConstructorsClicked( int constructorId ) { - if (myConstructorId == constructorId) + if ( myConstructorId == constructorId ) return; myConstructorId = constructorId; - switch (constructorId) { + switch ( constructorId ) { case 0: Group6F->hide(); - resize(0, 0); Group2F->show(); myEditCurrentArgument = Group2F->LineEdit1; - Group2F->LineEdit1->setText(tr("")); - Group2F->LineEdit2->setText(tr("")); + Group2F->LineEdit1->setText( tr( "" ) ); + Group2F->LineEdit2->setText( tr( "" ) ); break; case 1: Group2F->hide(); - resize(0, 0); Group6F->show(); myEditCurrentArgument = Group6F->LineEdit1; - Group6F->LineEdit1->setText(tr("")); - Group6F->LineEdit2->setText(tr("")); - Group6F->LineEdit3->setText(tr("")); - Group6F->LineEdit4->setText(tr("")); - Group6F->LineEdit5->setText(tr("")); - Group6F->LineEdit6->setText(tr("")); + Group6F->LineEdit1->setText( tr( "" ) ); + Group6F->LineEdit2->setText( tr( "" ) ); + Group6F->LineEdit3->setText( tr( "" ) ); + Group6F->LineEdit4->setText( tr( "" ) ); + Group6F->LineEdit5->setText( tr( "" ) ); + Group6F->LineEdit6->setText( tr( "" ) ); break; default: break; @@ -185,10 +185,14 @@ void BlocksGUI_BlockDlg::ConstructorsClicked (int constructorId) myFace1 = myFace2 = GEOM::GEOM_Object::_nil(); myFace3 = myFace4 = myFace5 = myFace6 = myFace1; - globalSelection(GEOM_FACE); + qApp->processEvents(); + updateGeometry(); + resize( minimumSize() ); + + globalSelection( GEOM_FACE ); SelectionIntoArgument(); - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); } //================================================================================= @@ -197,7 +201,7 @@ void BlocksGUI_BlockDlg::ConstructorsClicked (int constructorId) //================================================================================= void BlocksGUI_BlockDlg::ClickOnOk() { - if (ClickOnApply()) + if ( ClickOnApply() ) ClickOnCancel(); } @@ -207,7 +211,7 @@ void BlocksGUI_BlockDlg::ClickOnOk() //================================================================================= bool BlocksGUI_BlockDlg::ClickOnApply() { - if (!onAccept()) + if ( !onAccept() ) return false; initName(); @@ -221,23 +225,22 @@ bool BlocksGUI_BlockDlg::ClickOnApply() void BlocksGUI_BlockDlg::SelectionIntoArgument() { erasePreview(); - myEditCurrentArgument->setText(""); + myEditCurrentArgument->setText( "" ); - if (IObjectCount() != 1) - { - if (myEditCurrentArgument == Group2F->LineEdit1 || - myEditCurrentArgument == Group6F->LineEdit1) + if ( IObjectCount() != 1 ) { + if ( myEditCurrentArgument == Group2F->LineEdit1 || + myEditCurrentArgument == Group6F->LineEdit1 ) myFace1 = GEOM::GEOM_Object::_nil(); - else if (myEditCurrentArgument == Group2F->LineEdit2 || - myEditCurrentArgument == Group6F->LineEdit2) + else if ( myEditCurrentArgument == Group2F->LineEdit2 || + myEditCurrentArgument == Group6F->LineEdit2 ) myFace2 = GEOM::GEOM_Object::_nil(); - else if (myEditCurrentArgument == Group6F->LineEdit3) + else if ( myEditCurrentArgument == Group6F->LineEdit3 ) myFace3 = GEOM::GEOM_Object::_nil(); - else if (myEditCurrentArgument == Group6F->LineEdit4) + else if ( myEditCurrentArgument == Group6F->LineEdit4 ) myFace4 = GEOM::GEOM_Object::_nil(); - else if (myEditCurrentArgument == Group6F->LineEdit5) + else if ( myEditCurrentArgument == Group6F->LineEdit5 ) myFace5 = GEOM::GEOM_Object::_nil(); - else if (myEditCurrentArgument == Group6F->LineEdit6) + else if ( myEditCurrentArgument == Group6F->LineEdit6 ) myFace6 = GEOM::GEOM_Object::_nil(); return; } @@ -247,22 +250,22 @@ void BlocksGUI_BlockDlg::SelectionIntoArgument() GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); - if (!testResult || CORBA::is_nil( aSelectedObject )) + if ( !testResult || CORBA::is_nil( aSelectedObject ) ) return; - if (myEditCurrentArgument == Group2F->LineEdit1 || - myEditCurrentArgument == Group6F->LineEdit1) + if ( myEditCurrentArgument == Group2F->LineEdit1 || + myEditCurrentArgument == Group6F->LineEdit1 ) myFace1 = aSelectedObject; - else if (myEditCurrentArgument == Group2F->LineEdit2 || - myEditCurrentArgument == Group6F->LineEdit2) + else if ( myEditCurrentArgument == Group2F->LineEdit2 || + myEditCurrentArgument == Group6F->LineEdit2 ) myFace2 = aSelectedObject; - else if (myEditCurrentArgument == Group6F->LineEdit3) + else if ( myEditCurrentArgument == Group6F->LineEdit3 ) myFace3 = aSelectedObject; - else if (myEditCurrentArgument == Group6F->LineEdit4) + else if ( myEditCurrentArgument == Group6F->LineEdit4 ) myFace4 = aSelectedObject; - else if (myEditCurrentArgument == Group6F->LineEdit5) + else if ( myEditCurrentArgument == Group6F->LineEdit5 ) myFace5 = aSelectedObject; - else if (myEditCurrentArgument == Group6F->LineEdit6) + else if ( myEditCurrentArgument == Group6F->LineEdit6 ) myFace6 = aSelectedObject; myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); @@ -278,26 +281,32 @@ void BlocksGUI_BlockDlg::SetEditCurrentArgument() { QPushButton* aSender = (QPushButton*)sender(); - if (aSender == Group2F->PushButton1) { + if ( aSender == Group2F->PushButton1 ) { myEditCurrentArgument = Group2F->LineEdit1; - } else if (aSender == Group2F->PushButton2) { + } + else if ( aSender == Group2F->PushButton2 ) { myEditCurrentArgument = Group2F->LineEdit2; - - } else if (aSender == Group6F->PushButton1) { + } + else if ( aSender == Group6F->PushButton1 ) { myEditCurrentArgument = Group6F->LineEdit1; - } else if (aSender == Group6F->PushButton2) { + } + else if ( aSender == Group6F->PushButton2 ) { myEditCurrentArgument = Group6F->LineEdit2; - } else if (aSender == Group6F->PushButton3) { + } + else if ( aSender == Group6F->PushButton3 ) { myEditCurrentArgument = Group6F->LineEdit3; - } else if (aSender == Group6F->PushButton4) { + } + else if ( aSender == Group6F->PushButton4 ) { myEditCurrentArgument = Group6F->LineEdit4; - } else if (aSender == Group6F->PushButton5) { + } + else if ( aSender == Group6F->PushButton5 ) { myEditCurrentArgument = Group6F->LineEdit5; - } else if (aSender == Group6F->PushButton6) { + } + else if ( aSender == Group6F->PushButton6 ) { myEditCurrentArgument = Group6F->LineEdit6; } - globalSelection(GEOM_FACE); + globalSelection( GEOM_FACE ); myEditCurrentArgument->setFocus(); SelectionIntoArgument(); @@ -310,10 +319,10 @@ void BlocksGUI_BlockDlg::SetEditCurrentArgument() void BlocksGUI_BlockDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - globalSelection(GEOM_FACE); + globalSelection( GEOM_FACE ); SelectionIntoArgument(); } @@ -322,9 +331,9 @@ void BlocksGUI_BlockDlg::ActivateThisDialog() // function : enterEvent() // purpose : //================================================================================= -void BlocksGUI_BlockDlg::enterEvent (QEvent* e) +void BlocksGUI_BlockDlg::enterEvent( QEvent* ) { - if (!GroupConstructors->isEnabled()) + if ( !mainFrame()->GroupConstructors->isEnabled() ) ActivateThisDialog(); } @@ -334,7 +343,7 @@ void BlocksGUI_BlockDlg::enterEvent (QEvent* e) //================================================================================= GEOM::GEOM_IOperations_ptr BlocksGUI_BlockDlg::createOperation() { - return getGeomEngine()->GetIBlocksOperations(getStudyId()); + return getGeomEngine()->GetIBlocksOperations( getStudyId() ); } //================================================================================= @@ -343,50 +352,53 @@ GEOM::GEOM_IOperations_ptr BlocksGUI_BlockDlg::createOperation() //================================================================================= bool BlocksGUI_BlockDlg::isValid (QString&) { - switch (getConstructorId()) { - case 0: - return !(myFace1->_is_nil() || myFace2->_is_nil()); - case 1: - return !(myFace1->_is_nil() || myFace2->_is_nil() || - myFace3->_is_nil() || myFace4->_is_nil() || - myFace5->_is_nil() || myFace6->_is_nil()); - default: - return false; + bool ok = false; + switch ( getConstructorId() ) { + case 0: + ok = !( myFace1->_is_nil() || myFace2->_is_nil() ); + break; + case 1: + ok = !( myFace1->_is_nil() || myFace2->_is_nil() || + myFace3->_is_nil() || myFace4->_is_nil() || + myFace5->_is_nil() || myFace6->_is_nil() ); + break; + default: + break; } - return false; + return ok; } //================================================================================= // function : execute // purpose : //================================================================================= -bool BlocksGUI_BlockDlg::execute (ObjectList& objects) +bool BlocksGUI_BlockDlg::execute( ObjectList& objects ) { bool res = false; GEOM::GEOM_Object_var anObj; - switch (getConstructorId()) { - case 0: - if (!CORBA::is_nil(myFace1) && !CORBA::is_nil(myFace2)) { - anObj = GEOM::GEOM_IBlocksOperations::_narrow(getOperation())-> - MakeHexa2Faces(myFace1, myFace2); - res = true; - } - break; - case 1: - if (!CORBA::is_nil(myFace1) && !CORBA::is_nil(myFace2) && - !CORBA::is_nil(myFace3) && !CORBA::is_nil(myFace4) && - !CORBA::is_nil(myFace5) && !CORBA::is_nil(myFace6)) { - anObj = GEOM::GEOM_IBlocksOperations::_narrow(getOperation())-> - MakeHexa(myFace1, myFace2, myFace3, myFace4, myFace5, myFace6); + switch ( getConstructorId() ) { + case 0: + if ( !CORBA::is_nil( myFace1 ) && !CORBA::is_nil( myFace2 ) ) { + anObj = GEOM::GEOM_IBlocksOperations::_narrow( getOperation() )-> + MakeHexa2Faces( myFace1, myFace2 ); + res = true; + } + break; + case 1: + if ( !CORBA::is_nil( myFace1 ) && !CORBA::is_nil( myFace2 ) && + !CORBA::is_nil(myFace3 ) && !CORBA::is_nil( myFace4 ) && + !CORBA::is_nil( myFace5 ) && !CORBA::is_nil( myFace6 ) ) { + anObj = GEOM::GEOM_IBlocksOperations::_narrow( getOperation() )-> + MakeHexa( myFace1, myFace2, myFace3, myFace4, myFace5, myFace6 ); res = true; - } - break; + } + break; } - if (!anObj->_is_nil()) - objects.push_back(anObj._retn()); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); return res; } diff --git a/src/BlocksGUI/BlocksGUI_BlockDlg.h b/src/BlocksGUI/BlocksGUI_BlockDlg.h index 92801ac05..643ad5ca3 100644 --- a/src/BlocksGUI/BlocksGUI_BlockDlg.h +++ b/src/BlocksGUI/BlocksGUI_BlockDlg.h @@ -1,79 +1,74 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 CEA +// Copyright (C) 2003 CEA // -// 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 : BlocksGUI_BlockDlg.h +// Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com) // -// -// File : BlocksGUI_BlockDlg.h -// Author : Julia DOROVSKIKH -// Module : GEOM - -#ifndef DIALOGBOX_BLOCK_H -#define DIALOGBOX_BLOCK_H -#include "GEOM_BlocksGUI.hxx" +#ifndef BLOCKSGUI_BLOCKDLG_H +#define BLOCKSGUI_BLOCKDLG_H -#include "GEOMBase_Skeleton.h" -#include "DlgRef_2Sel_QTD.h" -#include "DlgRef_6Sel_QTD.h" +#include +class DlgRef_2Sel; +class DlgRef_6Sel; //================================================================================= // class : BlocksGUI_BlockDlg // purpose : //================================================================================= -class GEOM_BLOCKSGUI_EXPORT BlocksGUI_BlockDlg : public GEOMBase_Skeleton +class BlocksGUI_BlockDlg : public GEOMBase_Skeleton { Q_OBJECT public: - BlocksGUI_BlockDlg (GeometryGUI* theGeometryGUI, QWidget* parent, - bool modal = FALSE); + BlocksGUI_BlockDlg( GeometryGUI*, QWidget* ); ~BlocksGUI_BlockDlg(); protected: // redefined from GEOMBase_Helper virtual GEOM::GEOM_IOperations_ptr createOperation(); - virtual bool isValid (QString&); - virtual bool execute (ObjectList& objects); + virtual bool isValid( QString& ); + virtual bool execute( ObjectList&); private: - void Init(); - void enterEvent (QEvent* e); + void Init(); + void enterEvent( QEvent* ); private: - int myConstructorId; + int myConstructorId; - GEOM::GEOM_Object_var myFace1, myFace2; - GEOM::GEOM_Object_var myFace3, myFace4, myFace5, myFace6; + GEOM::GEOM_Object_var myFace1, myFace2; + GEOM::GEOM_Object_var myFace3, myFace4, myFace5, myFace6; - DlgRef_2Sel_QTD* Group2F; - DlgRef_6Sel_QTD* Group6F; + DlgRef_2Sel* Group2F; + DlgRef_6Sel* Group6F; private slots: - void ClickOnOk(); - bool ClickOnApply(); - void ActivateThisDialog(); - void ConstructorsClicked (int constructorId); + void ClickOnOk(); + bool ClickOnApply(); + void ActivateThisDialog(); + void ConstructorsClicked( int ); - void SelectionIntoArgument(); - void SetEditCurrentArgument(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); }; -#endif // DIALOGBOX_BLOCK_H +#endif // BLOCKSGUI_BLOCKDLG_H diff --git a/src/BlocksGUI/BlocksGUI_ExplodeDlg.cxx b/src/BlocksGUI/BlocksGUI_ExplodeDlg.cxx index b0832eda3..66b8460eb 100644 --- a/src/BlocksGUI/BlocksGUI_ExplodeDlg.cxx +++ b/src/BlocksGUI/BlocksGUI_ExplodeDlg.cxx @@ -1,113 +1,82 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 CEA +// Copyright (C) 2003 CEA // -// 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 : BlocksGUI_ExplodeDlg.cxx +// Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com) // -// -// File : BlocksGUI_ExplodeDlg.cxx -// Author : Julia DOROVSKIKH -// Module : GEOM -// $Header$ #include "BlocksGUI_ExplodeDlg.h" -#include "DlgRef_SpinBox.h" - -#include "GEOM_Displayer.h" - -#include "SUIT_Session.h" -#include "SalomeApp_Application.h" -#include "LightApp_SelectionMgr.h" -#include "OCCViewer_ViewModel.h" -#include "SALOME_ListIteratorOfListIO.hxx" +#include +#include +#include -#include "utilities.h" - -#include - -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include //================================================================================= // class : BlocksGUI_ExplodeDlg() // purpose : Constructs a BlocksGUI_ExplodeDlg which is a child of 'parent'. //================================================================================= -BlocksGUI_ExplodeDlg::BlocksGUI_ExplodeDlg (GeometryGUI* theGeometryGUI, QWidget* parent, bool modal) - : GEOMBase_Skeleton(theGeometryGUI, parent, "ExplodeDlg", modal, - WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +BlocksGUI_ExplodeDlg::BlocksGUI_ExplodeDlg( GeometryGUI* theGeometryGUI, QWidget* parent ) + : GEOMBase_Skeleton( theGeometryGUI, parent ) { - QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_BLOCK_EXPLODE"))); - QPixmap imageS (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_BLOCK_EXPLODE" ) ) ); + QPixmap imageS( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); - setCaption(tr("GEOM_BLOCK_EXPLODE_TITLE")); + setWindowTitle( tr( "GEOM_BLOCK_EXPLODE_TITLE" ) ); /***************************************************************/ - GroupConstructors->setTitle(tr("GEOM_BLOCK_EXPLODE")); + mainFrame()->GroupConstructors->setTitle( tr( "GEOM_BLOCK_EXPLODE" ) ); - RadioButton1->setPixmap(image1); - RadioButton2->close(TRUE); - RadioButton3->close(TRUE); + mainFrame()->RadioButton1->setIcon( image1 ); + mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose ); + mainFrame()->RadioButton2->close(); + mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); + mainFrame()->RadioButton3->close(); // Create first group - myGrp1 = new QGroupBox(1, Qt::Horizontal, tr("GEOM_ARGUMENTS"), this); - - QGroupBox* aSelGrp = new QGroupBox(3, Qt::Horizontal, myGrp1); - aSelGrp->setFrameStyle(QFrame::NoFrame); - aSelGrp->setInsideMargin(0); - - new QLabel(tr("GEOM_MAIN_OBJECT"), aSelGrp); - mySelBtn = new QPushButton(aSelGrp); - mySelBtn->setPixmap(imageS); - mySelName = new QLineEdit(aSelGrp); - mySelName->setReadOnly(true); - - QGroupBox* aSpinGrp = new QGroupBox(2, Qt::Horizontal, myGrp1); - aSpinGrp->setFrameStyle(QFrame::NoFrame); - aSpinGrp->setInsideMargin(0); - - new QLabel(tr("NB_FACES_MIN"), aSpinGrp); - mySpinBoxMin = new DlgRef_SpinBox(aSpinGrp); - - new QLabel(tr("NB_FACES_MAX"), aSpinGrp); - mySpinBoxMax = new DlgRef_SpinBox(aSpinGrp); - - QGroupBox* anInfoGrp = new QGroupBox(2, Qt::Horizontal, myGrp1); - anInfoGrp->setFrameStyle(QFrame::NoFrame); - anInfoGrp->setInsideMargin(0); - - myBlocksNb = new QTextEdit(anInfoGrp); - myBlocksNb->setReadOnly(true); - - QGroupBox* aCheckGrp = new QGroupBox(3, Qt::Horizontal, myGrp1); - aCheckGrp->setFrameStyle(QFrame::NoFrame); - aCheckGrp->setInsideMargin(0); - - myCheckBtn = new QCheckBox(aCheckGrp, "CheckButton1"); - myCheckBtn->setText(tr("GEOM_SUBSHAPE_SELECT")); + myGrp1 = new DlgRef_1Sel2Spin1View1Check( centralWidget() ); + myGrp1->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) ); + myGrp1->TextLabel1->setText( tr( "GEOM_MAIN_OBJECT" ) ); + myGrp1->PushButton1->setIcon( imageS ); + myGrp1->LineEdit1->setReadOnly( true ); + myGrp1->TextLabel2->setText( tr( "NB_FACES_MIN" ) ); + myGrp1->TextLabel3->setText( tr( "NB_FACES_MAX" ) ); + myGrp1->CheckBox1->setText( tr( "GEOM_SUBSHAPE_SELECT" ) ); // Add groups to layout - Layout1->addWidget(myGrp1, 1, 0); + QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); + layout->setMargin( 0 ); layout->setSpacing( 6 ); + layout->addWidget( myGrp1 ); /***************************************************************/ - setHelpFileName("explode_on_blocks.htm"); + setHelpFileName( "explode_on_blocks.htm" ); Init(); } @@ -129,56 +98,56 @@ BlocksGUI_ExplodeDlg::~BlocksGUI_ExplodeDlg() void BlocksGUI_ExplodeDlg::Init() { // Set range of spinboxes - double SpecificStep = 1.0; - mySpinBoxMin->RangeStepAndValidator(0.0, 999.0, SpecificStep, 3); - mySpinBoxMax->RangeStepAndValidator(0.0, 999.0, SpecificStep, 3); + int SpecificStep = 1; + initSpinBox( myGrp1->SpinBox1, 0, 999, SpecificStep ); + initSpinBox( myGrp1->SpinBox2, 0, 999, SpecificStep ); - if (SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() - != OCCViewer_Viewer::Type()) - myCheckBtn->setEnabled(false); + if ( SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() + != OCCViewer_Viewer::Type() ) + myGrp1->CheckBox1->setEnabled( false ); // signals and slots connections - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); - connect(mySelBtn, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect( myGrp1->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect(mySpinBoxMin, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(mySpinBoxMax, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect( myGrp1->SpinBox1, SIGNAL( valueChanged( int ) ), this, SLOT( ValueChangedInSpinBox( int ) ) ); + connect( myGrp1->SpinBox2, SIGNAL( valueChanged( int ) ), this, SLOT( ValueChangedInSpinBox( int ) ) ); - connect(myCheckBtn, SIGNAL(stateChanged(int)), this, SLOT(SubShapeToggled())); + connect( myGrp1->CheckBox1, SIGNAL( stateChanged( int ) ), this, SLOT( SubShapeToggled() ) ); - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); myConstructorId = -1; - ConstructorsClicked(0); + ConstructorsClicked( 0 ); } //================================================================================= // function : ConstructorsClicked() // purpose : Radio button management //================================================================================= -void BlocksGUI_ExplodeDlg::ConstructorsClicked (int constructorId) +void BlocksGUI_ExplodeDlg::ConstructorsClicked( int constructorId ) { - if (myConstructorId == constructorId) + if ( myConstructorId == constructorId ) return; myConstructorId = constructorId; - switch (constructorId) { + switch ( constructorId ) { case 0: myGrp1->show(); - mySpinBoxMin->SetValue(6.0); - mySpinBoxMax->SetValue(6.0); - myCheckBtn->setChecked(FALSE); + myGrp1->SpinBox1->setValue( 6 ); + myGrp1->SpinBox2->setValue( 6 ); + myGrp1->CheckBox1->setChecked( false ); break; default: break; } // init fields - myEditCurrentArgument = mySelName; + myEditCurrentArgument = myGrp1->LineEdit1; myObject = GEOM::GEOM_Object::_nil(); activateSelection(); @@ -190,7 +159,7 @@ void BlocksGUI_ExplodeDlg::ConstructorsClicked (int constructorId) //================================================================================= void BlocksGUI_ExplodeDlg::ClickOnOk() { - if (ClickOnApply()) + if ( ClickOnApply() ) ClickOnCancel(); } @@ -200,23 +169,22 @@ void BlocksGUI_ExplodeDlg::ClickOnOk() //================================================================================= bool BlocksGUI_ExplodeDlg::ClickOnApply() { - SUIT_Session::session()->activeApplication()->putInfo(tr("")); + SUIT_Session::session()->activeApplication()->putInfo( tr( "" ) ); // Explode all sub shapes - if (isAllSubShapes()) { + if ( isAllSubShapes() ) { // More than 30 subshapes : ask confirmation - if (myNbBlocks > 30) { - const QString caption = tr("GEOM_CONFIRM"); - const QString text = tr("GEOM_CONFIRM_INFO").arg(myNbBlocks); - const QString button0 = tr("GEOM_BUT_EXPLODE"); - const QString button1 = tr("GEOM_BUT_CANCEL"); - - if (QMessageBox::warning(this, caption, text, button0, button1) != 0) + if ( myNbBlocks > 30 ) { + if ( SUIT_MessageBox::warning( this, + tr( "GEOM_CONFIRM" ), + tr( "GEOM_CONFIRM_INFO" ).arg( myNbBlocks ), + tr( "GEOM_BUT_EXPLODE" ), + tr( "GEOM_BUT_CANCEL" ) ) != 0 ) return false; /* aborted */ } } - if (!onAccept()) + if ( !onAccept() ) return false; activateSelection(); @@ -230,20 +198,20 @@ bool BlocksGUI_ExplodeDlg::ClickOnApply() //================================================================================= void BlocksGUI_ExplodeDlg::SelectionIntoArgument() { - if (!isAllSubShapes()) + if ( !isAllSubShapes() ) return; myObject = GEOM::GEOM_Object::_nil(); - mySelName->setText(""); + myGrp1->LineEdit1->setText( "" ); - if (IObjectCount() == 1) { + if ( IObjectCount() == 1 ) { Standard_Boolean aResult = Standard_False; GEOM::GEOM_Object_var anObj = - GEOMBase::ConvertIOinGEOMObject(firstIObject(), aResult); + GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult ); if ( aResult && !anObj->_is_nil() && GEOMBase::IsShape( anObj ) ) { myObject = anObj; - mySelName->setText(GEOMBase::GetName(anObj)); + myGrp1->LineEdit1->setText( GEOMBase::GetName( anObj ) ); } } @@ -258,10 +226,10 @@ void BlocksGUI_ExplodeDlg::SetEditCurrentArgument() { QPushButton* aSender = (QPushButton*)sender(); - if (mySelBtn == aSender) { - mySelName->setFocus(); - myEditCurrentArgument = mySelName; - myCheckBtn->setChecked(FALSE); + if ( myGrp1->PushButton1 == aSender ) { + myGrp1->LineEdit1->setFocus(); + myEditCurrentArgument = myGrp1->LineEdit1; + myGrp1->CheckBox1->setChecked( false ); } activateSelection(); @@ -274,8 +242,8 @@ void BlocksGUI_ExplodeDlg::SetEditCurrentArgument() void BlocksGUI_ExplodeDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); activateSelection(); } @@ -284,9 +252,9 @@ void BlocksGUI_ExplodeDlg::ActivateThisDialog() // function : enterEvent() // purpose : //================================================================================= -void BlocksGUI_ExplodeDlg::enterEvent (QEvent* e) +void BlocksGUI_ExplodeDlg::enterEvent( QEvent* ) { - if (!GroupConstructors->isEnabled()) + if ( !mainFrame()->GroupConstructors->isEnabled() ) this->ActivateThisDialog(); } @@ -294,9 +262,9 @@ void BlocksGUI_ExplodeDlg::enterEvent (QEvent* e) // function : ValueChangedInSpinBox() // purpose : //================================================================================= -void BlocksGUI_ExplodeDlg::ValueChangedInSpinBox (double newValue) +void BlocksGUI_ExplodeDlg::ValueChangedInSpinBox() { - if (!isAllSubShapes()) + if ( !isAllSubShapes() ) activateSelection(); else updateButtonState(); @@ -305,7 +273,7 @@ void BlocksGUI_ExplodeDlg::ValueChangedInSpinBox (double newValue) //================================================================================= // function : SubShapeToggled() // purpose : Allow user selection of all or only selected sub shapes -// : Called when 'myCheckBtn' state change +// : Called when 'myGrp1->CheckBox1' state change //================================================================================= void BlocksGUI_ExplodeDlg::SubShapeToggled() { @@ -319,20 +287,21 @@ void BlocksGUI_ExplodeDlg::SubShapeToggled() void BlocksGUI_ExplodeDlg::activateSelection() { clearTemporary(); - erasePreview(true); + erasePreview( true ); - if (isAllSubShapes()) { // Sub-shapes selection disabled - disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + if ( isAllSubShapes() ) { // Sub-shapes selection disabled + disconnect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); globalSelection( GEOM_ALLSHAPES ); - if (myObject->_is_nil()) { + if ( myObject->_is_nil() ) { SelectionIntoArgument(); } - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; - } else { - displayPreview(true, true, false); - globalSelection(GEOM_PREVIEW); + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + } + else { + displayPreview( true, true, false ); + globalSelection( GEOM_PREVIEW ); } } @@ -342,28 +311,30 @@ void BlocksGUI_ExplodeDlg::activateSelection() //================================================================================= void BlocksGUI_ExplodeDlg::updateButtonState() { - if (SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() - != OCCViewer_Viewer::Type() || myObject->_is_nil()) { - myCheckBtn->setChecked(FALSE); - myCheckBtn->setEnabled(FALSE); - } else { - myCheckBtn->setEnabled(TRUE); + if ( SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() + != OCCViewer_Viewer::Type() || myObject->_is_nil() ) { + myGrp1->CheckBox1->setChecked( false ); + myGrp1->CheckBox1->setEnabled( false ); + } + else { + myGrp1->CheckBox1->setEnabled( true ); } myNbBlocks = 0; - if (myObject->_is_nil()) { - myBlocksNb->setText(""); - } else { + if ( myObject->_is_nil() ) { + myGrp1->TextBrowser1->setText( "" ); + } + else { bool isOnlyBlocks = GEOM::GEOM_IBlocksOperations::_narrow - (getOperation())->IsCompoundOfBlocks(myObject, - (int)mySpinBoxMin->GetValue(), - (int)mySpinBoxMax->GetValue(), - myNbBlocks); - if (isOnlyBlocks) - myBlocksNb->setText(tr("GEOM_NB_BLOCKS_NO_OTHERS").arg(myNbBlocks)); + ( getOperation() )->IsCompoundOfBlocks( myObject, + myGrp1->SpinBox1->value(), + myGrp1->SpinBox2->value(), + myNbBlocks ); + if ( isOnlyBlocks ) + myGrp1->TextBrowser1->setText( tr( "GEOM_NB_BLOCKS_NO_OTHERS" ).arg( myNbBlocks ) ); else - myBlocksNb->setText(tr("GEOM_NB_BLOCKS_SOME_OTHERS").arg(myNbBlocks)); + myGrp1->TextBrowser1->setText( tr( "GEOM_NB_BLOCKS_SOME_OTHERS" ).arg( myNbBlocks ) ); } } @@ -373,7 +344,7 @@ void BlocksGUI_ExplodeDlg::updateButtonState() //================================================================================= bool BlocksGUI_ExplodeDlg::isAllSubShapes() const { - return !myCheckBtn->isChecked() || !myCheckBtn->isEnabled(); + return !myGrp1->CheckBox1->isChecked() || !myGrp1->CheckBox1->isEnabled(); } //================================================================================= @@ -382,23 +353,25 @@ bool BlocksGUI_ExplodeDlg::isAllSubShapes() const //================================================================================= GEOM::GEOM_IOperations_ptr BlocksGUI_ExplodeDlg::createOperation() { - return getGeomEngine()->GetIBlocksOperations(getStudyId()); + return getGeomEngine()->GetIBlocksOperations( getStudyId() ); } //================================================================================= // function : isValid() // purpose : Verify validity of input data //================================================================================= -bool BlocksGUI_ExplodeDlg::isValid (QString&) +bool BlocksGUI_ExplodeDlg::isValid( QString& ) { - switch (getConstructorId()) { + bool ok = false; + switch ( getConstructorId() ) { case 0: - if (IsPreview()) - return !myObject->_is_nil(); + if ( IsPreview() ) + ok = !myObject->_is_nil(); else - return !myObject->_is_nil() && (isAllSubShapes() || IObjectCount()); + ok = !myObject->_is_nil() && ( isAllSubShapes() || IObjectCount() ); + break; default: - return false; + break; } return false; @@ -408,67 +381,67 @@ bool BlocksGUI_ExplodeDlg::isValid (QString&) // function : execute // purpose : //================================================================================= -bool BlocksGUI_ExplodeDlg::execute (ObjectList& objects) +bool BlocksGUI_ExplodeDlg::execute( ObjectList& objects ) { GEOM::ListOfGO_var aList; - switch (getConstructorId()) { - case 0: - aList = GEOM::GEOM_IBlocksOperations::_narrow(getOperation())->ExplodeCompoundOfBlocks - (myObject, - (int)mySpinBoxMin->GetValue(), - (int)mySpinBoxMax->GetValue()); - break; + switch ( getConstructorId() ) { + case 0: + aList = GEOM::GEOM_IBlocksOperations::_narrow( getOperation() )->ExplodeCompoundOfBlocks + ( myObject, + myGrp1->SpinBox1->value(), + myGrp1->SpinBox2->value() ); + break; } - - if (!aList->length()) + + if ( !aList->length() ) return false; - if (IsPreview()) { + if ( IsPreview() ) { clearTemporary(); - + // Store objects. They will be put in study when "Apply" is pressed - for (int i = 0, n = aList->length(); i < n; i++) { - objects.push_back(GEOM::GEOM_Object::_duplicate(aList[i])); - myTmpObjs.push_back(GEOM::GEOM_Object::_duplicate(aList[i])); + for ( int i = 0, n = aList->length(); i < n; i++ ) { + objects.push_back( GEOM::GEOM_Object::_duplicate( aList[i] ) ); + myTmpObjs.push_back( GEOM::GEOM_Object::_duplicate( aList[i] ) ); } - return objects.size() ? true : false; + return objects.size() > 0; } // Throw away sub-shapes not selected by user if not in preview mode // and manual selection is active - if (!isAllSubShapes()) - { + if ( !isAllSubShapes() ) { QMap selected; // Get names of selected objects - SALOME_ListIteratorOfListIO it (selectedIO()); - for (; it.More(); it.Next()) { - selected.insert(it.Value()->getName(), 0); + SALOME_ListIteratorOfListIO it ( selectedIO() ); + for ( ; it.More(); it.Next() ) { + selected.insert( it.Value()->getName(), 0 ); } // Iterate through result and select objects with names from selection ObjectList toRemoveFromEnggine; ObjectList::iterator anIter; - for (anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter) { - CORBA::String_var objStr = myGeomGUI->getApp()->orb()->object_to_string(*anIter); - if (selected.contains(QString(objStr.in()))) - objects.push_back(*anIter); + for ( anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter ) { + CORBA::String_var objStr = myGeomGUI->getApp()->orb()->object_to_string( *anIter ); + if ( selected.contains( QString( objStr.in() ) ) ) + objects.push_back( *anIter ); else - toRemoveFromEnggine.push_back(*anIter); + toRemoveFromEnggine.push_back( *anIter ); } // Remove from engine useless objects ObjectList::iterator anIter2 = toRemoveFromEnggine.begin(); - for (; anIter2 != toRemoveFromEnggine.end(); ++anIter2) - getGeomEngine()->RemoveObject(*anIter2); + for ( ; anIter2 != toRemoveFromEnggine.end(); ++anIter2 ) + getGeomEngine()->RemoveObject( *anIter2 ); myTmpObjs.clear(); - } else { - for (int i = 0, n = aList->length(); i < n; i++) - objects.push_back(GEOM::GEOM_Object::_duplicate(aList[i])); + } + else { + for ( int i = 0, n = aList->length(); i < n; i++ ) + objects.push_back( GEOM::GEOM_Object::_duplicate( aList[i] ) ); } return objects.size(); @@ -481,8 +454,8 @@ bool BlocksGUI_ExplodeDlg::execute (ObjectList& objects) void BlocksGUI_ExplodeDlg::clearTemporary() { ObjectList::iterator anIter; - for (anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter) - getGeomEngine()->RemoveObject(*anIter); + for ( anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter ) + getGeomEngine()->RemoveObject( *anIter ); myTmpObjs.clear(); } @@ -492,7 +465,7 @@ void BlocksGUI_ExplodeDlg::clearTemporary() // Purpose : Get father object for object to be added in study // ( called with addInStudy method ) //================================================================ -GEOM::GEOM_Object_ptr BlocksGUI_ExplodeDlg::getFather (GEOM::GEOM_Object_ptr) +GEOM::GEOM_Object_ptr BlocksGUI_ExplodeDlg::getFather( GEOM::GEOM_Object_ptr ) { return myObject; } diff --git a/src/BlocksGUI/BlocksGUI_ExplodeDlg.h b/src/BlocksGUI/BlocksGUI_ExplodeDlg.h index 8e309ecfd..05cbb3345 100644 --- a/src/BlocksGUI/BlocksGUI_ExplodeDlg.h +++ b/src/BlocksGUI/BlocksGUI_ExplodeDlg.h @@ -1,105 +1,89 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 CEA +// Copyright (C) 2003 CEA // -// 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 : BlocksGUI_ExplodeDlg.h +// Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com) // -// -// File : BlocksGUI_ExplodeDlg.h -// Author : Julia DOROVSKIKH -// Module : GEOM - -#ifndef DIALOGBOX_BLOCK_EXPLODE_H -#define DIALOGBOX_BLOCK_EXPLODE_H -#include "GEOM_BlocksGUI.hxx" +#ifndef BLOCKSGUI_EXPLODEDLG_H +#define BLOCKSGUI_EXPLODEDLG_H -#include "GEOMBase_Skeleton.h" +#include -class DlgRef_SpinBox; -class QTextEdit; -class QCheckBox; +class DlgRef_1Sel2Spin1View1Check; //================================================================================= // class : BlocksGUI_ExplodeDlg // purpose : //================================================================================= -class GEOM_BLOCKSGUI_EXPORT BlocksGUI_ExplodeDlg : public GEOMBase_Skeleton +class BlocksGUI_ExplodeDlg : public GEOMBase_Skeleton { Q_OBJECT public: - BlocksGUI_ExplodeDlg (GeometryGUI*, QWidget* parent, bool modal = FALSE); + BlocksGUI_ExplodeDlg( GeometryGUI*, QWidget* ); ~BlocksGUI_ExplodeDlg(); protected: // redefined from GEOMBase_Helper virtual GEOM::GEOM_IOperations_ptr createOperation(); - virtual bool isValid (QString& msg); - virtual bool execute (ObjectList& objects); - virtual GEOM::GEOM_Object_ptr getFather(GEOM::GEOM_Object_ptr theObj); + virtual bool isValid( QString& ); + virtual bool execute( ObjectList& ); + virtual GEOM::GEOM_Object_ptr getFather( GEOM::GEOM_Object_ptr ); virtual const char* getNewObjectName() const; private: - void Init(); - void enterEvent (QEvent* e); + void Init(); + void enterEvent( QEvent* ); - void activateSelection(); + void activateSelection(); - void updateButtonState(); - bool isAllSubShapes() const; - int shapeType() const; + void updateButtonState(); + bool isAllSubShapes() const; + int shapeType() const; - void clearTemporary(); + void clearTemporary(); private: - int myConstructorId; - - CORBA::Long myNbBlocks; - GEOM::GEOM_Object_var myObject; - - ObjectList myTmpObjs; - - QFrame* myGrp1; - - QPushButton* mySelBtn; - QLineEdit* mySelName; + int myConstructorId; - DlgRef_SpinBox* mySpinBoxMin; - DlgRef_SpinBox* mySpinBoxMax; + CORBA::Long myNbBlocks; + GEOM::GEOM_Object_var myObject; - QTextEdit* myBlocksNb; + ObjectList myTmpObjs; - QCheckBox* myCheckBtn; + DlgRef_1Sel2Spin1View1Check* myGrp1; private slots: - void ClickOnOk(); - bool ClickOnApply(); - void ActivateThisDialog(); - void ConstructorsClicked (int constructorId); + void ClickOnOk(); + bool ClickOnApply(); + void ActivateThisDialog(); + void ConstructorsClicked( int ); - void SelectionIntoArgument(); - void SetEditCurrentArgument(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); - void SubShapeToggled(); + void SubShapeToggled(); - void ValueChangedInSpinBox (double newValue); + void ValueChangedInSpinBox(); }; -#endif // DIALOGBOX_BLOCK_EXPLODE_H +#endif // BLOCKSGUI_EXPLODEDLG_H diff --git a/src/BlocksGUI/BlocksGUI_PropagateDlg.cxx b/src/BlocksGUI/BlocksGUI_PropagateDlg.cxx index e126dcf05..aa7be7842 100644 --- a/src/BlocksGUI/BlocksGUI_PropagateDlg.cxx +++ b/src/BlocksGUI/BlocksGUI_PropagateDlg.cxx @@ -1,43 +1,41 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : BlocksGUI_PropagateDlg.cxx +// Author : Vladimir KLYACHIN, Open CASCADE S.A.S. (vladimir.klyachin@opencascade.com) // -// -// File : BlocksGUI_PropagateDlg.cxx -// Author : VKN -// Module : GEOM -// $Header$ #include "BlocksGUI_PropagateDlg.h" -#include "GEOMImpl_Types.hxx" - -#include "SUIT_Session.h" -#include "SalomeApp_Application.h" -#include "LightApp_SelectionMgr.h" -#include +#include +#include +#include +#include -#include +#include +#include +#include +#include -using namespace std; +#include //================================================================================= // class : BlocksGUI_PropagateDlg() @@ -46,38 +44,35 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -BlocksGUI_PropagateDlg::BlocksGUI_PropagateDlg(GeometryGUI* theGeometryGUI, QWidget* parent, - const char* name, bool modal, WFlags fl) - :GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize | - WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +BlocksGUI_PropagateDlg::BlocksGUI_PropagateDlg( GeometryGUI* theGeometryGUI, QWidget* parent ) + : GEOMBase_Skeleton( theGeometryGUI, parent ) { - QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_PROPAGATE"))); - QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_PROPAGATE" ) ) ); + QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); - setCaption(tr("GEOM_PROPAGATE_TITLE")); + setWindowTitle( tr( "GEOM_PROPAGATE_TITLE" ) ); /***************************************************************/ - GroupConstructors->setTitle(tr("GEOM_PROPAGATE_TITLE")); - RadioButton1->setPixmap(image0); - RadioButton2->close(TRUE); - RadioButton3->close(TRUE); - - QGroupBox* aMainGrp = new QGroupBox( 1, Qt::Horizontal, tr( "GEOM_SELECTED_SHAPE" ), this ); - QGroupBox* aSelGrp = new QGroupBox(3, Qt::Horizontal, aMainGrp); - aSelGrp->setFrameStyle(QFrame::NoFrame); - aSelGrp->setInsideMargin(0); - - new QLabel(tr("GEOM_OBJECT"), aSelGrp); - mySelBtn = new QPushButton(aSelGrp); - mySelBtn->setPixmap(image1); - mySelName = new QLineEdit(aSelGrp); - mySelName->setReadOnly(true); - - Layout1->addWidget(aMainGrp, 1, 0); + mainFrame()->GroupConstructors->setTitle( tr( "GEOM_PROPAGATE_TITLE" ) ); + mainFrame()->RadioButton1->setIcon( image0 ); + mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose ); + mainFrame()->RadioButton2->close(); + mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); + mainFrame()->RadioButton3->close(); + + myGrp = new DlgRef_1Sel( centralWidget() ); + myGrp->GroupBox1->setTitle( tr( "GEOM_SELECTED_SHAPE" ) ); + myGrp->TextLabel1->setText( tr( "GEOM_OBJECT" ) ); + myGrp->PushButton1->setIcon( image1 ); + myGrp->LineEdit1->setReadOnly( true ); + + QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); + layout->setMargin( 0 ); layout->setSpacing( 6 ); + layout->addWidget( myGrp ); /***************************************************************/ - setHelpFileName("propagate.htm"); + setHelpFileName( "propagate.htm" ); Init(); } @@ -99,16 +94,16 @@ void BlocksGUI_PropagateDlg::Init() /* init variables */ myObject = GEOM::GEOM_Object::_nil(); - ResultName->setText( "" ); + mainFrame()->ResultName->setText( "" ); //myGeomGUI->SetState( 0 ); /* signals and slots connections */ - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); - connect(mySelBtn, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(mySelName, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect( myGrp->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( myGrp->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); activateSelection(); } @@ -135,7 +130,7 @@ bool BlocksGUI_PropagateDlg::ClickOnApply() initName(); - mySelName->setText(""); + myGrp->LineEdit1->setText( "" ); myObject = GEOM::GEOM_Object::_nil(); activateSelection(); @@ -150,7 +145,7 @@ bool BlocksGUI_PropagateDlg::ClickOnApply() //================================================================================= void BlocksGUI_PropagateDlg::SelectionIntoArgument() { - mySelName->setText(""); + myGrp->LineEdit1->setText( "" ); myObject = GEOM::GEOM_Object::_nil(); if ( IObjectCount() == 1 ) { @@ -158,7 +153,7 @@ void BlocksGUI_PropagateDlg::SelectionIntoArgument() Standard_Boolean aRes; myObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); if ( aRes ) - mySelName->setText( GEOMBase::GetName( myObject ) ); + myGrp->LineEdit1->setText( GEOMBase::GetName( myObject ) ); } } @@ -169,8 +164,8 @@ void BlocksGUI_PropagateDlg::SelectionIntoArgument() void BlocksGUI_PropagateDlg::SetEditCurrentArgument() { const QObject* send = sender(); - if ( send == mySelBtn ) { - mySelName->setFocus(); + if ( send == myGrp->PushButton1 ) { + myGrp->LineEdit1->setFocus(); } activateSelection(); } @@ -183,7 +178,7 @@ void BlocksGUI_PropagateDlg::SetEditCurrentArgument() void BlocksGUI_PropagateDlg::LineEditReturnPressed() { const QObject* send = sender(); - if( send == mySelName ) { + if ( send == myGrp->LineEdit1 ) { GEOMBase_Skeleton::LineEditReturnPressed(); } } @@ -197,7 +192,7 @@ void BlocksGUI_PropagateDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - mySelName->setText(""); + myGrp->LineEdit1->setText( "" ); myObject = GEOM::GEOM_Object::_nil(); //myGeomGUI->SetState( 0 ); @@ -209,9 +204,9 @@ void BlocksGUI_PropagateDlg::ActivateThisDialog() // function : enterEvent() // purpose : Mouse enter onto the dialog to activate it //================================================================================= -void BlocksGUI_PropagateDlg::enterEvent(QEvent* e) +void BlocksGUI_PropagateDlg::enterEvent( QEvent* ) { - if ( !GroupConstructors->isEnabled() ) + if ( !mainFrame()->GroupConstructors->isEnabled() ) ActivateThisDialog(); } @@ -220,7 +215,7 @@ void BlocksGUI_PropagateDlg::enterEvent(QEvent* e) // function : closeEvent() // purpose : //================================================================================= -void BlocksGUI_PropagateDlg::closeEvent(QCloseEvent* e) +void BlocksGUI_PropagateDlg::closeEvent( QCloseEvent* e ) { //myGeomGUI->SetState( -1 ); GEOMBase_Skeleton::closeEvent( e ); @@ -239,7 +234,7 @@ GEOM::GEOM_IOperations_ptr BlocksGUI_PropagateDlg::createOperation() // function : isValid // purpose : //================================================================================= -bool BlocksGUI_PropagateDlg::isValid( QString& msg ) +bool BlocksGUI_PropagateDlg::isValid( QString& ) { return !myObject->_is_nil() ; } @@ -250,19 +245,17 @@ bool BlocksGUI_PropagateDlg::isValid( QString& msg ) //================================================================================= bool BlocksGUI_PropagateDlg::execute( ObjectList& objects ) { - GEOM::ListOfGO_var aList = GEOM::GEOM_IBlocksOperations::_narrow( getOperation() )->Propagate( myObject ); - ResultName->setText( "" ); + mainFrame()->ResultName->setText( "" ); if ( !aList->length() ) return false; - for ( int i = 0, n = aList->length(); i < n; i++ ) - { - objects.push_back(aList[i]._retn()); + for ( int i = 0, n = aList->length(); i < n; i++ ) { + objects.push_back( aList[i]._retn() ); } - return objects.size() ? true : false; + return objects.size() > 0; } //================================================================================= @@ -275,11 +268,11 @@ void BlocksGUI_PropagateDlg::activateSelection() aMap.Add( GEOM_SOLID ); aMap.Add( GEOM_COMPOUND ); globalSelection( aMap ); - if (myObject->_is_nil()) { + if ( myObject->_is_nil() ) { SelectionIntoArgument(); } - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); } //================================================================ @@ -287,7 +280,7 @@ void BlocksGUI_PropagateDlg::activateSelection() // Purpose : Get father object for object to be added in study // ( called with addInStudy method ) //================================================================ -GEOM::GEOM_Object_ptr BlocksGUI_PropagateDlg::getFather (GEOM::GEOM_Object_ptr) +GEOM::GEOM_Object_ptr BlocksGUI_PropagateDlg::getFather( GEOM::GEOM_Object_ptr ) { return myObject; } diff --git a/src/BlocksGUI/BlocksGUI_PropagateDlg.h b/src/BlocksGUI/BlocksGUI_PropagateDlg.h index e6236d632..0abab70c3 100644 --- a/src/BlocksGUI/BlocksGUI_PropagateDlg.h +++ b/src/BlocksGUI/BlocksGUI_PropagateDlg.h @@ -1,78 +1,73 @@ -// 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 : BlocksGUI_PropagateDlg.h +// Author : Vladimir KLYACHIN, Open CASCADE S.A.S. (vladimir.klyachin@opencascade.com) // -// -// File : BlocksGUI_PropagateDlg.h -// Author : VKN -// Module : GEOM - -#ifndef DIALOGBOX_BlocksGUI_PropagateDlg_H -#define DIALOGBOX_BlocksGUI_PropagateDlg_H -#include "GEOM_BlocksGUI.hxx" +#ifndef BLOCKSGUI_PROPAGATEDLG_H +#define BLOCKSGUI_PROPAGATEDLG_H -#include "GEOMBase_Skeleton.h" +#include +class DlgRef_1Sel; //================================================================================= // class : BlocksGUI_PropagateDlg // purpose : //================================================================================= -class GEOM_BLOCKSGUI_EXPORT BlocksGUI_PropagateDlg : public GEOMBase_Skeleton +class BlocksGUI_PropagateDlg : public GEOMBase_Skeleton { - Q_OBJECT + Q_OBJECT public: - BlocksGUI_PropagateDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, - const char* name = "", bool modal = FALSE, WFlags fl = 0); - ~BlocksGUI_PropagateDlg(); + BlocksGUI_PropagateDlg( GeometryGUI*, QWidget* = 0 ); + ~BlocksGUI_PropagateDlg(); protected: - // redefined from GEOMBase_Helper - virtual GEOM::GEOM_IOperations_ptr createOperation(); - virtual bool isValid( QString& ); - virtual bool execute( ObjectList& objects ); - virtual GEOM::GEOM_Object_ptr getFather(GEOM::GEOM_Object_ptr theObj); + // redefined from GEOMBase_Helper + virtual GEOM::GEOM_IOperations_ptr createOperation(); + virtual bool isValid( QString& ); + virtual bool execute( ObjectList& ); + virtual GEOM::GEOM_Object_ptr getFather( GEOM::GEOM_Object_ptr ); private slots: - void ClickOnOk(); - bool ClickOnApply(); + void ClickOnOk(); + bool ClickOnApply(); - void ActivateThisDialog(); + void ActivateThisDialog(); - void LineEditReturnPressed(); - void SelectionIntoArgument(); - void SetEditCurrentArgument(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); private: - void Init(); - void enterEvent(QEvent* e); - void closeEvent(QCloseEvent* e); - void activateSelection(); + void Init(); + void enterEvent( QEvent* ); + void closeEvent( QCloseEvent* ); + void activateSelection(); private: - GEOM::GEOM_Object_var myObject; - QPushButton* mySelBtn; - QLineEdit* mySelName; + GEOM::GEOM_Object_var myObject; + DlgRef_1Sel* myGrp; }; -#endif // DIALOGBOX_BlocksGUI_PropagateDlg_H +#endif // BLOCKSGUI_PROPAGATEDLG_H diff --git a/src/BlocksGUI/BlocksGUI_QuadFaceDlg.cxx b/src/BlocksGUI/BlocksGUI_QuadFaceDlg.cxx index 0f1b9747f..d8112e676 100644 --- a/src/BlocksGUI/BlocksGUI_QuadFaceDlg.cxx +++ b/src/BlocksGUI/BlocksGUI_QuadFaceDlg.cxx @@ -1,36 +1,38 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 CEA +// Copyright (C) 2003 CEA // -// 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 : BlocksGUI_QuadFaceDlg.cxx +// Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com) // -// -// File : BlocksGUI_QuadFaceDlg.cxx -// Author : Julia DOROVSKIKH -// Module : GEOM -// $Header$ #include "BlocksGUI_QuadFaceDlg.h" -#include "GEOMImpl_Types.hxx" -#include "SUIT_Session.h" -#include "SalomeApp_Application.h" -#include "LightApp_SelectionMgr.h" +#include +#include +#include +#include + +#include +#include +#include +#include #include @@ -38,69 +40,56 @@ // class : BlocksGUI_QuadFaceDlg() // purpose : Constructs a BlocksGUI_QuadFaceDlg which is a child of 'parent'. //================================================================================= -BlocksGUI_QuadFaceDlg::BlocksGUI_QuadFaceDlg (GeometryGUI* theGeometryGUI, QWidget* parent, bool modal) - : GEOMBase_Skeleton(theGeometryGUI, parent, "QuadFaceDlg", modal, - WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +BlocksGUI_QuadFaceDlg::BlocksGUI_QuadFaceDlg( GeometryGUI* theGeometryGUI, QWidget* parent ) + : GEOMBase_Skeleton( theGeometryGUI, parent ) { SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr(); - QPixmap image1 (aResMgr->loadPixmap("GEOM",tr("ICON_DLG_QUAD_FACE_4_VERT"))); - QPixmap image2 (aResMgr->loadPixmap("GEOM",tr("ICON_DLG_QUAD_FACE_2_EDGE"))); - QPixmap image3 (aResMgr->loadPixmap("GEOM",tr("ICON_DLG_QUAD_FACE_4_EDGE"))); - QPixmap imageS (aResMgr->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image1( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_QUAD_FACE_4_VERT" ) ) ); + QPixmap image2( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_QUAD_FACE_2_EDGE" ) ) ); + QPixmap image3( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_QUAD_FACE_4_EDGE" ) ) ); + QPixmap imageS( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); - setCaption(tr("GEOM_QUAD_FACE_TITLE")); + setWindowTitle( tr( "GEOM_QUAD_FACE_TITLE" ) ); /***************************************************************/ - GroupConstructors->setTitle(tr("GEOM_QUAD_FACE")); + mainFrame()->GroupConstructors->setTitle( tr( "GEOM_QUAD_FACE" ) ); - RadioButton1->setPixmap(image1); - RadioButton2->setPixmap(image2); - RadioButton3->setPixmap(image3); + mainFrame()->RadioButton1->setIcon( image1 ); + mainFrame()->RadioButton2->setIcon( image2 ); + mainFrame()->RadioButton3->setIcon( image3 ); // Create first group - myGrp1 = new QGroupBox(1, Qt::Horizontal, tr("GEOM_ARGUMENTS"), this); - - QGroupBox* aSelGrp1 = new QGroupBox(3, Qt::Horizontal, myGrp1); - aSelGrp1->setFrameStyle(QFrame::NoFrame); - aSelGrp1->setInsideMargin(0); + myGrp1 = new QGroupBox( tr( "GEOM_ARGUMENTS" ), centralWidget() ); - createSelWg(tr("VERTEX_1"), imageS, aSelGrp1, Vertex1); - createSelWg(tr("VERTEX_2"), imageS, aSelGrp1, Vertex2); - createSelWg(tr("VERTEX_3"), imageS, aSelGrp1, Vertex3); - createSelWg(tr("VERTEX_4"), imageS, aSelGrp1, Vertex4); + createSelWg( tr( "VERTEX_1" ), imageS, myGrp1, Vertex1 ); + createSelWg( tr( "VERTEX_2" ), imageS, myGrp1, Vertex2 ); + createSelWg( tr( "VERTEX_3" ), imageS, myGrp1, Vertex3 ); + createSelWg( tr( "VERTEX_4" ), imageS, myGrp1, Vertex4 ); // Create second group - myGrp2 = new QGroupBox(1, Qt::Horizontal, tr("GEOM_ARGUMENTS"), this); + myGrp2 = new QGroupBox( tr( "GEOM_ARGUMENTS" ), centralWidget() ); - QGroupBox* aSelGrp2 = new QGroupBox(3, Qt::Horizontal, myGrp2); - aSelGrp2->setFrameStyle(QFrame::NoFrame); - aSelGrp2->setInsideMargin(0); - - createSelWg(tr("EDGE_1"), imageS, aSelGrp2, Edge12); - createSelWg(tr("EDGE_2"), imageS, aSelGrp2, Edge22); + createSelWg( tr( "EDGE_1" ), imageS, myGrp2, Edge12 ); + createSelWg( tr( "EDGE_2" ), imageS, myGrp2, Edge22 ); // Create fird group - myGrp3 = new QGroupBox(1, Qt::Horizontal, tr("GEOM_ARGUMENTS"), this); - - QGroupBox* aSelGrp3 = new QGroupBox(3, Qt::Horizontal, myGrp3); - aSelGrp3->setFrameStyle(QFrame::NoFrame); - aSelGrp3->setInsideMargin(0); + myGrp3 = new QGroupBox( tr( "GEOM_ARGUMENTS" ), centralWidget() ); - createSelWg(tr("EDGE_1"), imageS, aSelGrp3, Edge14); - createSelWg(tr("EDGE_2"), imageS, aSelGrp3, Edge24); - createSelWg(tr("EDGE_3"), imageS, aSelGrp3, Edge34); - createSelWg(tr("EDGE_4"), imageS, aSelGrp3, Edge44); - - (new QLabel(myGrp3))->setSizePolicy( - QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); + createSelWg( tr( "EDGE_1" ), imageS, myGrp3, Edge14 ); + createSelWg( tr( "EDGE_2" ), imageS, myGrp3, Edge24 ); + createSelWg( tr( "EDGE_3" ), imageS, myGrp3, Edge34 ); + createSelWg( tr( "EDGE_4" ), imageS, myGrp3, Edge44 ); // Add groups to layout - Layout1->addWidget(myGrp1, 2, 0); - Layout1->addWidget(myGrp2, 2, 0); - Layout1->addWidget(myGrp3, 2, 0); + QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); + layout->setMargin( 0 ); layout->setSpacing( 6 ); + layout->addWidget( myGrp1 ); + layout->addWidget( myGrp2 ); + layout->addWidget( myGrp3 ); + /***************************************************************/ - setHelpFileName("newentity_blocks.htm#QuadrangleFace"); + setHelpFileName( "newentity_blocks.htm#QuadrangleFace" ); Init(); } @@ -121,36 +110,38 @@ BlocksGUI_QuadFaceDlg::~BlocksGUI_QuadFaceDlg() void BlocksGUI_QuadFaceDlg::Init() { // signals and slots connections - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); - connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); + connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); + + connect( this, SIGNAL( constructorsClicked( int ) ), + this, SLOT( ConstructorsClicked( int ) ) ); QMap::iterator anIterBtn; - for (anIterBtn = mySelBtn.begin(); anIterBtn != mySelBtn.end(); ++anIterBtn) - connect(anIterBtn.data(), SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + for ( anIterBtn = mySelBtn.begin(); anIterBtn != mySelBtn.end(); ++anIterBtn ) + connect( anIterBtn.value(), SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); // init controls and fields - initName(tr("GEOM_QUAD_FACE")); + initName( tr( "GEOM_QUAD_FACE" ) ); myConstructorId = -1; - ConstructorsClicked(0); + ConstructorsClicked( 0 ); } //================================================================================= // function : ConstructorsClicked() // purpose : Radio button management //================================================================================= -void BlocksGUI_QuadFaceDlg::ConstructorsClicked (int constructorId) +void BlocksGUI_QuadFaceDlg::ConstructorsClicked( int constructorId ) { - if (myConstructorId == constructorId) + if ( myConstructorId == constructorId ) return; myConstructorId = constructorId; - switch (constructorId) { + switch ( constructorId ) { case 0: myGrp2->hide(); myGrp3->hide(); @@ -175,13 +166,17 @@ void BlocksGUI_QuadFaceDlg::ConstructorsClicked (int constructorId) // clear line edits QMap::iterator anIterLE; - for (anIterLE = mySelName.begin(); anIterLE != mySelName.end(); ++anIterLE) - anIterLE.data()->setText(""); + for ( anIterLE = mySelName.begin(); anIterLE != mySelName.end(); ++anIterLE ) + anIterLE.value()->setText( "" ); // init fields myShape1 = myShape2 = GEOM::GEOM_Object::_nil(); myShape3 = myShape4 = myShape1; + qApp->processEvents(); + updateGeometry(); + resize( minimumSize() ); + activateSelection(); } @@ -191,7 +186,7 @@ void BlocksGUI_QuadFaceDlg::ConstructorsClicked (int constructorId) //================================================================================= void BlocksGUI_QuadFaceDlg::ClickOnOk() { - if (ClickOnApply()) + if ( ClickOnApply() ) ClickOnCancel(); } @@ -201,7 +196,7 @@ void BlocksGUI_QuadFaceDlg::ClickOnOk() //================================================================================= bool BlocksGUI_QuadFaceDlg::ClickOnApply() { - if (!onAccept()) + if ( !onAccept() ) return false; initName(); @@ -215,13 +210,13 @@ bool BlocksGUI_QuadFaceDlg::ClickOnApply() void BlocksGUI_QuadFaceDlg::SelectionIntoArgument() { erasePreview(); - myEditCurrentArgument->setText(""); + myEditCurrentArgument->setText( "" ); // Get index of current selection focus int aCurrFocus = -1; QMap::iterator anIter; - for (anIter = mySelName.begin(); anIter != mySelName.end(); ++anIter) { - if (myEditCurrentArgument == anIter.data()) { + for ( anIter = mySelName.begin(); anIter != mySelName.end(); ++anIter ) { + if ( myEditCurrentArgument == anIter.value() ) { aCurrFocus = anIter.key(); break; } @@ -229,31 +224,39 @@ void BlocksGUI_QuadFaceDlg::SelectionIntoArgument() GEOM::GEOM_Object_var anObj; Standard_Boolean aResult = Standard_False; - if (IObjectCount() == 1) { - anObj = GEOMBase::ConvertIOinGEOMObject(firstIObject(), aResult); - if (aResult) { + if ( IObjectCount() == 1 ) { + anObj = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult ); + if ( aResult ) { if (anObj->_is_nil()) { aResult = Standard_False; - } else { - mySelName[aCurrFocus]->setText(GEOMBase::GetName(anObj)); + } + else { + mySelName[aCurrFocus]->setText( GEOMBase::GetName( anObj ) ); } - } else { + } + else { anObj = GEOM::GEOM_Object::_nil(); } } - if (aCurrFocus == Vertex1 || aCurrFocus == Edge12 || aCurrFocus == Edge14) { - myShape1 = anObj; - } else if (aCurrFocus == Vertex2 || aCurrFocus == Edge22 || aCurrFocus == Edge24) { - myShape2 = anObj; - } else if (aCurrFocus == Vertex3 || aCurrFocus == Edge34) { - myShape3 = anObj; - } else if (aCurrFocus == Vertex4 || aCurrFocus == Edge44) { - myShape4 = anObj; - } else { + switch ( aCurrFocus ) { + case Vertex1: + case Edge12: + case Edge14: + myShape1 = anObj; break; + case Vertex2: + case Edge22: + case Edge24: + myShape2 = anObj; break; + case Vertex3: + case Edge34: + myShape3 = anObj; break; + case Vertex4: + case Edge44: + myShape4 = anObj; break; + default: return; } - displayPreview(); } @@ -266,8 +269,8 @@ void BlocksGUI_QuadFaceDlg::SetEditCurrentArgument() QPushButton* aSender = (QPushButton*)sender(); QMap::iterator anIter; - for (anIter = mySelBtn.begin(); anIter != mySelBtn.end(); ++anIter) { - if (anIter.data() == aSender) { + for ( anIter = mySelBtn.begin(); anIter != mySelBtn.end(); ++anIter ) { + if ( anIter.value() == aSender ) { mySelName[anIter.key()]->setFocus(); myEditCurrentArgument = mySelName[anIter.key()]; } @@ -283,8 +286,8 @@ void BlocksGUI_QuadFaceDlg::SetEditCurrentArgument() void BlocksGUI_QuadFaceDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); activateSelection(); displayPreview(); @@ -294,9 +297,9 @@ void BlocksGUI_QuadFaceDlg::ActivateThisDialog() // function : enterEvent() // purpose : //================================================================================= -void BlocksGUI_QuadFaceDlg::enterEvent (QEvent* e) +void BlocksGUI_QuadFaceDlg::enterEvent( QEvent* ) { - if (!GroupConstructors->isEnabled()) + if ( !mainFrame()->GroupConstructors->isEnabled() ) this->ActivateThisDialog(); } @@ -314,16 +317,29 @@ void BlocksGUI_QuadFaceDlg::enterEvent (QEvent* e) // function : createSelWg() // purpose : //================================================================================= -void BlocksGUI_QuadFaceDlg::createSelWg (const QString& theLbl, +void BlocksGUI_QuadFaceDlg::createSelWg( const QString& theLbl, QPixmap& thePix, QWidget* theParent, - const int theId) + const int theId ) { - new QLabel(theLbl, theParent); - mySelBtn[theId] = new QPushButton(theParent); - mySelBtn[theId]->setPixmap(thePix); - mySelName[theId] = new QLineEdit(theParent); - mySelName[theId]->setReadOnly(true); + QLabel* lab = new QLabel( theLbl, theParent ); + mySelBtn[theId] = new QPushButton( theParent ); + mySelBtn[theId]->setIcon( thePix ); + mySelBtn[theId]->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); + mySelName[theId] = new QLineEdit( theParent ); + mySelName[theId]->setReadOnly( true ); + QGridLayout* l = 0; + if ( !theParent->layout() ) { + l = new QGridLayout( theParent ); + l->setMargin( 9 ); l->setSpacing( 6 ); + } + else { + l = qobject_cast( theParent->layout() ); + } + int row = l->rowCount(); + l->addWidget( lab, row, 0 ); + l->addWidget( mySelBtn[theId], row, 1 ); + l->addWidget( mySelName[theId], row, 2 ); } //================================================================================= @@ -332,15 +348,14 @@ void BlocksGUI_QuadFaceDlg::createSelWg (const QString& theLbl, //================================================================================= void BlocksGUI_QuadFaceDlg::activateSelection() { - if (myEditCurrentArgument == mySelName[Vertex1] || - myEditCurrentArgument == mySelName[Vertex2] || - myEditCurrentArgument == mySelName[Vertex3] || - myEditCurrentArgument == mySelName[Vertex4]) { - - globalSelection(GEOM_POINT); - - } else { - globalSelection(GEOM_EDGE); + if ( myEditCurrentArgument == mySelName[Vertex1] || + myEditCurrentArgument == mySelName[Vertex2] || + myEditCurrentArgument == mySelName[Vertex3] || + myEditCurrentArgument == mySelName[Vertex4] ) { + globalSelection( GEOM_POINT ); + } + else { + globalSelection( GEOM_EDGE ); } SelectionIntoArgument(); @@ -352,62 +367,66 @@ void BlocksGUI_QuadFaceDlg::activateSelection() //================================================================================= GEOM::GEOM_IOperations_ptr BlocksGUI_QuadFaceDlg::createOperation() { - return getGeomEngine()->GetIBlocksOperations(getStudyId()); + return getGeomEngine()->GetIBlocksOperations( getStudyId() ); } //================================================================================= // function : isValid // purpose : Verify validity of input data //================================================================================= -bool BlocksGUI_QuadFaceDlg::isValid (QString&) +bool BlocksGUI_QuadFaceDlg::isValid( QString& ) { - switch (getConstructorId()) { - case 0: - return (!myShape1->_is_nil() && !myShape2->_is_nil() && - !myShape3->_is_nil() && !myShape4->_is_nil()); - case 1: - return (!myShape1->_is_nil() && !myShape2->_is_nil()); - case 2: - return (!myShape1->_is_nil() && !myShape2->_is_nil() && - !myShape3->_is_nil() && !myShape4->_is_nil()); - default: - return false; + bool ok = false; + switch ( getConstructorId() ) { + case 0: + ok = ( !myShape1->_is_nil() && !myShape2->_is_nil() && + !myShape3->_is_nil() && !myShape4->_is_nil() ); + break; + case 1: + ok = ( !myShape1->_is_nil() && !myShape2->_is_nil() ); + break; + case 2: + ok = ( !myShape1->_is_nil() && !myShape2->_is_nil() && + !myShape3->_is_nil() && !myShape4->_is_nil() ); + break; + default: + break; } - return false; + return ok; } //================================================================================= // function : execute // purpose : //================================================================================= -bool BlocksGUI_QuadFaceDlg::execute (ObjectList& objects) +bool BlocksGUI_QuadFaceDlg::execute( ObjectList& objects ) { bool res = false; GEOM::GEOM_Object_var anObj; - switch (getConstructorId()) { - case 0: - anObj = GEOM::GEOM_IBlocksOperations::_narrow(getOperation())->MakeQuad4Vertices - (myShape1, myShape2, myShape3, myShape4); - res = true; - break; - case 1: - anObj = GEOM::GEOM_IBlocksOperations::_narrow(getOperation())->MakeQuad2Edges - (myShape1, myShape2); - res = true; - break; - case 2: - anObj = GEOM::GEOM_IBlocksOperations::_narrow(getOperation())->MakeQuad - (myShape1, myShape2, myShape3, myShape4); - res = true; - break; - default: - break; + switch ( getConstructorId() ) { + case 0: + anObj = GEOM::GEOM_IBlocksOperations::_narrow( getOperation() )->MakeQuad4Vertices + ( myShape1, myShape2, myShape3, myShape4 ); + res = true; + break; + case 1: + anObj = GEOM::GEOM_IBlocksOperations::_narrow( getOperation() )->MakeQuad2Edges + ( myShape1, myShape2 ); + res = true; + break; + case 2: + anObj = GEOM::GEOM_IBlocksOperations::_narrow( getOperation() )->MakeQuad + ( myShape1, myShape2, myShape3, myShape4 ); + res = true; + break; + default: + break; } - if (!anObj->_is_nil()) - objects.push_back(anObj._retn()); - + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + return res; } diff --git a/src/BlocksGUI/BlocksGUI_QuadFaceDlg.h b/src/BlocksGUI/BlocksGUI_QuadFaceDlg.h index be706bab3..906ded9a1 100644 --- a/src/BlocksGUI/BlocksGUI_QuadFaceDlg.h +++ b/src/BlocksGUI/BlocksGUI_QuadFaceDlg.h @@ -1,41 +1,43 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 CEA +// Copyright (C) 2003 CEA // -// 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 : BlocksGUI_QuadFaceDlg.h +// Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com) // -// -// File : BlocksGUI_QuadFaceDlg.h -// Author : Julia DOROVSKIKH -// Module : GEOM -#ifndef DIALOGBOX_QUAD_FACE_H -#define DIALOGBOX_QUAD_FACE_H +#ifndef BLOCKSGUI_QUADFACEDLG_H +#define BLOCKSGUI_QUADFACEDLG_H + +#include -#include "GEOM_BlocksGUI.hxx" +#include -#include "GEOMBase_Skeleton.h" +class QGroupBox; +class QPushButton; +class QLineEdit; //================================================================================= // class : BlocksGUI_QuadFaceDlg // purpose : //================================================================================= -class GEOM_BLOCKSGUI_EXPORT BlocksGUI_QuadFaceDlg : public GEOMBase_Skeleton +class BlocksGUI_QuadFaceDlg : public GEOMBase_Skeleton { Q_OBJECT @@ -44,45 +46,46 @@ class GEOM_BLOCKSGUI_EXPORT BlocksGUI_QuadFaceDlg : public GEOMBase_Skeleton Edge14, Edge24, Edge34, Edge44 }; public: - BlocksGUI_QuadFaceDlg (GeometryGUI*, QWidget* parent, bool modal = FALSE); + BlocksGUI_QuadFaceDlg( GeometryGUI*, QWidget* ); ~BlocksGUI_QuadFaceDlg(); protected: // redefined from GEOMBase_Helper virtual GEOM::GEOM_IOperations_ptr createOperation(); - virtual bool isValid (QString& msg); - virtual bool execute (ObjectList& objects); + virtual bool isValid( QString& ); + virtual bool execute( ObjectList& ); private: - void Init(); - void enterEvent (QEvent* e); + void Init(); + void enterEvent( QEvent* ); - void createSelWg (const QString&, QPixmap&, QWidget*, const int); - void activateSelection(); + void createSelWg( const QString&, QPixmap&, + QWidget*, const int ); + void activateSelection(); private: - int myConstructorId; + int myConstructorId; - GEOM::GEOM_Object_var myShape1; - GEOM::GEOM_Object_var myShape2; - GEOM::GEOM_Object_var myShape3; - GEOM::GEOM_Object_var myShape4; + GEOM::GEOM_Object_var myShape1; + GEOM::GEOM_Object_var myShape2; + GEOM::GEOM_Object_var myShape3; + GEOM::GEOM_Object_var myShape4; - QFrame* myGrp1; - QFrame* myGrp2; - QFrame* myGrp3; + QGroupBox* myGrp1; + QGroupBox* myGrp2; + QGroupBox* myGrp3; - QMap mySelBtn; - QMap mySelName; + QMap mySelBtn; + QMap mySelName; private slots: - void ClickOnOk(); - bool ClickOnApply(); - void ActivateThisDialog(); - void ConstructorsClicked( int constructorId ); + void ClickOnOk(); + bool ClickOnApply(); + void ActivateThisDialog(); + void ConstructorsClicked( int ); - void SelectionIntoArgument(); - void SetEditCurrentArgument(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); }; -#endif // DIALOGBOX_QUAD_FACE_H +#endif // BLOCKSGUI_QUADFACEDLG_H diff --git a/src/BlocksGUI/BlocksGUI_TrsfDlg.cxx b/src/BlocksGUI/BlocksGUI_TrsfDlg.cxx index 1a4c04a64..e63b4c631 100644 --- a/src/BlocksGUI/BlocksGUI_TrsfDlg.cxx +++ b/src/BlocksGUI/BlocksGUI_TrsfDlg.cxx @@ -1,125 +1,93 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 CEA +// Copyright (C) 2003 CEA // -// 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 : BlocksGUI_TrsfDlg.cxx +// Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com) // -// -// File : BlocksGUI_TrsfDlg.cxx -// Author : Julia DOROVSKIKH -// Module : GEOM -// $Header$ #include "BlocksGUI_TrsfDlg.h" -#include "DlgRef_SpinBox.h" +#include +#include +#include -#include "SUIT_Session.h" -#include "SalomeApp_Application.h" -#include "LightApp_SelectionMgr.h" -#include "OCCViewer_ViewModel.h" +#include +#include +#include +#include +#include +#include +#include +#include #include -#include - //================================================================================= // class : BlocksGUI_TrsfDlg() // purpose : Constructs a BlocksGUI_TrsfDlg which is a child of 'parent'. //================================================================================= -BlocksGUI_TrsfDlg::BlocksGUI_TrsfDlg (GeometryGUI* theGeometryGUI, QWidget* parent, bool modal) - : GEOMBase_Skeleton(theGeometryGUI, parent, "TrsfDlg", modal, - WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +BlocksGUI_TrsfDlg::BlocksGUI_TrsfDlg( GeometryGUI* theGeometryGUI, QWidget* parent ) + : GEOMBase_Skeleton( theGeometryGUI, parent ) { SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr(); - QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_BLOCK_MULTITRSF_SIMPLE"))); - QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_BLOCK_MULTITRSF_DOUBLE"))); - QPixmap imageS (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT"))); + QPixmap image1( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_BLOCK_MULTITRSF_SIMPLE" ) ) ); + QPixmap image2( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_BLOCK_MULTITRSF_DOUBLE" ) ) ); + QPixmap imageS( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); - setCaption(tr("GEOM_BLOCK_MULTITRSF_TITLE")); + setWindowTitle( tr( "GEOM_BLOCK_MULTITRSF_TITLE" ) ); /***************************************************************/ - GroupConstructors->setTitle(tr("GEOM_BLOCK_MULTITRSF")); + mainFrame()->GroupConstructors->setTitle( tr( "GEOM_BLOCK_MULTITRSF" ) ); - RadioButton1->setPixmap(image1); - RadioButton2->setPixmap(image2); - RadioButton3->close(TRUE); + mainFrame()->RadioButton1->setIcon( image1 ); + mainFrame()->RadioButton2->setIcon( image2 ); + mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); + mainFrame()->RadioButton3->close(); // Create first group - myGrp1 = new QGroupBox(1, Qt::Horizontal, tr("GEOM_BLOCK_MULTITRSF_SIMPLE"), this); - - QGroupBox* aSelGrp1 = new QGroupBox(3, Qt::Horizontal, myGrp1); - aSelGrp1->setFrameStyle(QFrame::NoFrame); - aSelGrp1->setInsideMargin(0); - - createSelWg(tr("GEOM_MAIN_OBJECT"), imageS, aSelGrp1, MainObj1); - createSelWg(tr("FACE_1"), imageS, aSelGrp1, Face1); - createSelWg(tr("FACE_2"), imageS, aSelGrp1, Face2); - - QGroupBox* aSpinGrp1 = new QGroupBox(1, Qt::Vertical, myGrp1); - aSpinGrp1->setFrameStyle(QFrame::NoFrame); - aSpinGrp1->setInsideMargin(0); + myGrp1 = new QGroupBox( tr( "GEOM_BLOCK_MULTITRSF_SIMPLE" ), centralWidget() ); - new QLabel(tr("GEOM_NB_TIMES"), aSpinGrp1); - mySpinBox[SpinBox1] = new DlgRef_SpinBox(aSpinGrp1); + createSelWg( tr( "GEOM_MAIN_OBJECT" ), imageS, myGrp1, MainObj1 ); + createSelWg( tr( "FACE_1" ), imageS, myGrp1, Face1 ); + createSelWg( tr( "FACE_2" ), imageS, myGrp1, Face2 ); + createSpinWg( tr( "GEOM_NB_TIMES" ), myGrp1, SpinBox1 ); // Create second group - myGrp2 = new QGroupBox(1, Qt::Horizontal, tr("GEOM_BLOCK_MULTITRSF_DOUBLE"), this); - - // U trsf - QGroupBox* aSelGrp2U = new QGroupBox(3, Qt::Horizontal, myGrp2); - aSelGrp2U->setFrameStyle(QFrame::NoFrame); - aSelGrp2U->setInsideMargin(0); - - createSelWg(tr("GEOM_MAIN_OBJECT"), imageS, aSelGrp2U, MainObj2); - createSelWg(tr("FACE_1U"), imageS, aSelGrp2U, Face1U); - createSelWg(tr("FACE_2U"), imageS, aSelGrp2U, Face2U); - - QGroupBox* aSpinGrp2U = new QGroupBox(1, Qt::Vertical, myGrp2); - aSpinGrp2U->setFrameStyle(QFrame::NoFrame); - aSpinGrp2U->setInsideMargin(0); - - new QLabel(tr("GEOM_NB_TIMES_U"), aSpinGrp2U); - mySpinBox[SpinBox2U] = new DlgRef_SpinBox(aSpinGrp2U); - - // V trsf - QGroupBox* aSelGrp2V = new QGroupBox(3, Qt::Horizontal, myGrp2); - aSelGrp2V->setFrameStyle(QFrame::NoFrame); - aSelGrp2V->setInsideMargin(0); + myGrp2 = new QGroupBox( tr( "GEOM_BLOCK_MULTITRSF_DOUBLE" ), centralWidget() ); - createSelWg(tr("FACE_1V"), imageS, aSelGrp2V, Face1V); - createSelWg(tr("FACE_2V"), imageS, aSelGrp2V, Face2V); - - QGroupBox* aSpinGrp2V = new QGroupBox(1, Qt::Vertical, myGrp2); - aSpinGrp2V->setFrameStyle(QFrame::NoFrame); - aSpinGrp2V->setInsideMargin(0); - - new QLabel(tr("GEOM_NB_TIMES_V"), aSpinGrp2V); - mySpinBox[SpinBox2V] = new DlgRef_SpinBox(aSpinGrp2V); - - (new QLabel(myGrp2))->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); + createSelWg( tr( "GEOM_MAIN_OBJECT"), imageS, myGrp2, MainObj2 ); + createSelWg( tr( "FACE_1U"), imageS, myGrp2, Face1U ); + createSelWg( tr( "FACE_2U"), imageS, myGrp2, Face2U ); + createSpinWg( tr( "GEOM_NB_TIMES_U" ), myGrp2, SpinBox2U ); + createSelWg( tr( "FACE_1V" ), imageS, myGrp2, Face1V ); + createSelWg( tr( "FACE_2V" ), imageS, myGrp2, Face2V ); + createSpinWg( tr( "GEOM_NB_TIMES_V" ), myGrp2, SpinBox2V ); // Add groups to layout - Layout1->addWidget( myGrp1, 2, 0 ); - Layout1->addWidget( myGrp2, 2, 0 ); + QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); + layout->setMargin( 0 ); layout->setSpacing( 6 ); + layout->addWidget( myGrp1 ); + layout->addWidget( myGrp2 ); /***************************************************************/ - setHelpFileName("multi_transformation.htm"); + setHelpFileName( "multi_transformation.htm" ); Init(); } @@ -141,51 +109,53 @@ void BlocksGUI_TrsfDlg::Init() { // Set range of spinboxes double SpecificStep = 1.0; - QMap::iterator anIter; - for (anIter = mySpinBox.begin(); anIter != mySpinBox.end(); ++anIter) { + QMap::iterator anIter; + for ( anIter = mySpinBox.begin(); anIter != mySpinBox.end(); ++anIter ) { //anIter.data()->RangeStepAndValidator(1.0, 999.999, SpecificStep, 3); - anIter.data()->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep, 3); + initSpinBox( anIter.value(), 1.0, MAX_NUMBER, SpecificStep, 3 ); } // signals and slots connections - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); - connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); + connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); + + connect( this, SIGNAL( constructorsClicked( int ) ), + this, SLOT( ConstructorsClicked( int ) ) ); QMap::iterator anIterBtn; - for (anIterBtn = mySelBtn.begin(); anIterBtn != mySelBtn.end(); ++anIterBtn) - connect(anIterBtn.data(), SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + for ( anIterBtn = mySelBtn.begin(); anIterBtn != mySelBtn.end(); ++anIterBtn ) + connect( anIterBtn.value(), SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - QMap::iterator anIterSpin; - for (anIterSpin = mySpinBox.begin(); anIterSpin != mySpinBox.end(); ++anIterSpin) - connect(anIterSpin.data(), SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + QMap::iterator anIterSpin; + for ( anIterSpin = mySpinBox.begin(); anIterSpin != mySpinBox.end(); ++anIterSpin ) + connect( anIterSpin.value(), SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ) ; // init controls and fields - initName(tr("GEOM_BLOCK_MULTITRSF")); + initName( tr( "GEOM_BLOCK_MULTITRSF" ) ); myConstructorId = -1; - ConstructorsClicked(0); + ConstructorsClicked( 0 ); } //================================================================================= // function : ConstructorsClicked() // purpose : Radio button management //================================================================================= -void BlocksGUI_TrsfDlg::ConstructorsClicked (int constructorId) +void BlocksGUI_TrsfDlg::ConstructorsClicked( int constructorId ) { - if (myConstructorId == constructorId) + if ( myConstructorId == constructorId ) return; myConstructorId = constructorId; - switch (constructorId) { + switch ( constructorId ) { case 0: myGrp2->hide(); myGrp1->show(); - mySpinBox[SpinBox1]->SetValue(2.0); + mySpinBox[SpinBox1]->setValue( 2.0 ); myEditCurrentArgument = mySelName[MainObj1]; myFaces[Face1] = -1; myFaces[Face2] = -1; @@ -193,8 +163,8 @@ void BlocksGUI_TrsfDlg::ConstructorsClicked (int constructorId) case 1: myGrp1->hide(); myGrp2->show(); - mySpinBox[SpinBox2U]->SetValue(2.0); - mySpinBox[SpinBox2V]->SetValue(2.0); + mySpinBox[SpinBox2U]->setValue( 2.0 ); + mySpinBox[SpinBox2V]->setValue( 2.0 ); myEditCurrentArgument = mySelName[MainObj2]; myFaces[Face1U] = -1; myFaces[Face2U] = -1; @@ -207,12 +177,16 @@ void BlocksGUI_TrsfDlg::ConstructorsClicked (int constructorId) // clear line edits QMap::iterator anIterLE; - for (anIterLE = mySelName.begin(); anIterLE != mySelName.end(); ++anIterLE) - anIterLE.data()->setText(""); + for ( anIterLE = mySelName.begin(); anIterLE != mySelName.end(); ++anIterLE ) + anIterLE.value()->setText( "" ); // init fields myShape = GEOM::GEOM_Object::_nil(); + qApp->processEvents(); + updateGeometry(); + resize( minimumSize() ); + activateSelection(); // enableWidgets(); // displayPreview(); @@ -224,7 +198,7 @@ void BlocksGUI_TrsfDlg::ConstructorsClicked (int constructorId) //================================================================================= void BlocksGUI_TrsfDlg::ClickOnOk() { - if (ClickOnApply()) + if ( ClickOnApply() ) ClickOnCancel(); } @@ -234,7 +208,7 @@ void BlocksGUI_TrsfDlg::ClickOnOk() //================================================================================= bool BlocksGUI_TrsfDlg::ClickOnApply() { - if (!onAccept()) + if ( !onAccept() ) return false; initName(); @@ -248,28 +222,28 @@ bool BlocksGUI_TrsfDlg::ClickOnApply() void BlocksGUI_TrsfDlg::SelectionIntoArgument() { erasePreview(); - myEditCurrentArgument->setText(""); + myEditCurrentArgument->setText( "" ); // Get index of current selection focus int aCurrFocus = -1; QMap::iterator anIter; - for (anIter = mySelName.begin(); anIter != mySelName.end(); ++anIter) { - if (myEditCurrentArgument == anIter.data()) { + for ( anIter = mySelName.begin(); anIter != mySelName.end(); ++anIter ) { + if ( myEditCurrentArgument == anIter.value() ) { aCurrFocus = anIter.key(); break; } } // If selection of main object is activated - if (aCurrFocus == MainObj1 || aCurrFocus == MainObj2) { - if (IObjectCount() == 1) { + if ( aCurrFocus == MainObj1 || aCurrFocus == MainObj2 ) { + if ( IObjectCount() == 1 ) { Standard_Boolean aResult = Standard_False; GEOM::GEOM_Object_var anObj = - GEOMBase::ConvertIOinGEOMObject(firstIObject(), aResult); + GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult ); - if (aResult && !anObj->_is_nil() && GEOMBase::IsShape( anObj ) ) { + if ( aResult && !anObj->_is_nil() && GEOMBase::IsShape( anObj ) ) { myShape = anObj; - mySelName[aCurrFocus]->setText(GEOMBase::GetName(anObj)); + mySelName[aCurrFocus]->setText( GEOMBase::GetName( anObj ) ); enableWidgets(); return; } @@ -279,22 +253,22 @@ void BlocksGUI_TrsfDlg::SelectionIntoArgument() enableWidgets(); } // If face selection is activated - else if (aCurrFocus == Face1 || aCurrFocus == Face2 || - aCurrFocus == Face1U || aCurrFocus == Face2U || - aCurrFocus == Face1V || aCurrFocus == Face2V) { - if (IObjectCount() == 1) { + else if ( aCurrFocus == Face1 || aCurrFocus == Face2 || + aCurrFocus == Face1U || aCurrFocus == Face2U || + aCurrFocus == Face1V || aCurrFocus == Face2V ) { + if ( IObjectCount() == 1 ) { Standard_Boolean aResult = Standard_False; GEOM::GEOM_Object_var anObj = - GEOMBase::ConvertIOinGEOMObject(firstIObject(), aResult); + GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult ); if ( aResult && !anObj->_is_nil() && GEOMBase::IsShape( anObj ) ) { TColStd_IndexedMapOfInteger anIndexes; - ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( firstIObject(), anIndexes ); + ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr()->GetIndexes( firstIObject(), anIndexes ); - if (anIndexes.Extent() == 1) { - int anIndex = anIndexes(1); - QString aFaceName = QString(GEOMBase::GetName(anObj)) + ":%1"; - myEditCurrentArgument->setText(aFaceName.arg(anIndex)); + if ( anIndexes.Extent() == 1 ) { + int anIndex = anIndexes( 1 ); + QString aFaceName = QString( GEOMBase::GetName( anObj ) ) + ":%1"; + myEditCurrentArgument->setText( aFaceName.arg( anIndex ) ); myFaces[aCurrFocus] = anIndex; displayPreview(); return; @@ -315,8 +289,8 @@ void BlocksGUI_TrsfDlg::SetEditCurrentArgument() QPushButton* aSender = (QPushButton*)sender(); QMap::iterator anIter; - for (anIter = mySelBtn.begin(); anIter != mySelBtn.end(); ++anIter) { - if (anIter.data() == aSender) { + for ( anIter = mySelBtn.begin(); anIter != mySelBtn.end(); ++anIter ) { + if ( anIter.value() == aSender ) { mySelName[anIter.key()]->setFocus(); myEditCurrentArgument = mySelName[anIter.key()]; break; @@ -333,8 +307,8 @@ void BlocksGUI_TrsfDlg::SetEditCurrentArgument() void BlocksGUI_TrsfDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); activateSelection(); displayPreview(); @@ -344,9 +318,9 @@ void BlocksGUI_TrsfDlg::ActivateThisDialog() // function : enterEvent() // purpose : //================================================================================= -void BlocksGUI_TrsfDlg::enterEvent (QEvent* e) +void BlocksGUI_TrsfDlg::enterEvent( QEvent* ) { - if (!GroupConstructors->isEnabled()) + if ( !mainFrame()->GroupConstructors->isEnabled() ) this->ActivateThisDialog(); } @@ -354,7 +328,7 @@ void BlocksGUI_TrsfDlg::enterEvent (QEvent* e) // function : ValueChangedInSpinBox() // purpose : //================================================================================= -void BlocksGUI_TrsfDlg::ValueChangedInSpinBox (double newValue) +void BlocksGUI_TrsfDlg::ValueChangedInSpinBox( double ) { displayPreview(); } @@ -363,16 +337,52 @@ void BlocksGUI_TrsfDlg::ValueChangedInSpinBox (double newValue) // function : createSelWg() // purpose : //================================================================================= -void BlocksGUI_TrsfDlg::createSelWg (const QString& theLbl, +void BlocksGUI_TrsfDlg::createSelWg( const QString& theLbl, QPixmap& thePix, QWidget* theParent, - const int theId) + const int theId ) { - new QLabel(theLbl, theParent); - mySelBtn[theId] = new QPushButton(theParent); - mySelBtn[theId]->setPixmap(thePix); - mySelName[theId] = new QLineEdit(theParent); - mySelName[theId]->setReadOnly(true); + QLabel* lab = new QLabel( theLbl, theParent ); + mySelBtn[theId] = new QPushButton( theParent ); + mySelBtn[theId]->setIcon( thePix ); + mySelBtn[theId]->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); + mySelName[theId] = new QLineEdit( theParent ); + mySelName[theId]->setReadOnly( true ); + QGridLayout* l = 0; + if ( !theParent->layout() ) { + l = new QGridLayout( theParent ); + l->setMargin( 9 ); l->setSpacing( 6 ); + } + else { + l = qobject_cast( theParent->layout() ); + } + int row = l->rowCount(); + l->addWidget( lab, row, 0 ); + l->addWidget( mySelBtn[theId], row, 1 ); + l->addWidget( mySelName[theId], row, 2 ); +} + +//================================================================================= +// function : createSpinWg() +// purpose : +//================================================================================= +void BlocksGUI_TrsfDlg::createSpinWg( const QString& theLbl, + QWidget* theParent, + const int theId ) +{ + QLabel* lab = new QLabel( theLbl, theParent ); + mySpinBox[theId] = new QDoubleSpinBox( theParent ); + QGridLayout* l = 0; + if ( !theParent->layout() ) { + l = new QGridLayout( theParent ); + l->setMargin( 9 ); l->setSpacing( 6 ); + } + else { + l = qobject_cast( theParent->layout() ); + } + int row = l->rowCount(); + l->addWidget( lab, row, 0 ); + l->addWidget( mySpinBox[theId], row, 2 ); } //================================================================================= @@ -381,22 +391,24 @@ void BlocksGUI_TrsfDlg::createSelWg (const QString& theLbl, //================================================================================= void BlocksGUI_TrsfDlg::activateSelection() { - if (!myShape->_is_nil() && - (myEditCurrentArgument == mySelName[ Face1 ] || - myEditCurrentArgument == mySelName[ Face2 ] || - myEditCurrentArgument == mySelName[ Face1U ] || - myEditCurrentArgument == mySelName[ Face2U ] || - myEditCurrentArgument == mySelName[ Face1V ] || - myEditCurrentArgument == mySelName[ Face2V ])) { + if ( !myShape->_is_nil() && + ( myEditCurrentArgument == mySelName[ Face1 ] || + myEditCurrentArgument == mySelName[ Face2 ] || + myEditCurrentArgument == mySelName[ Face1U ] || + myEditCurrentArgument == mySelName[ Face2U ] || + myEditCurrentArgument == mySelName[ Face1V ] || + myEditCurrentArgument == mySelName[ Face2V ] ) ) { // Local selection is available only in the OCC Viewer - if (SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() - == OCCViewer_Viewer::Type()) { - localSelection(myShape, TopAbs_FACE); - } else { + if ( SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() + == OCCViewer_Viewer::Type() ) { + localSelection( myShape, TopAbs_FACE ); + } + else { return; } - } else { + } + else { globalSelection( GEOM_ALLSHAPES ); } @@ -413,33 +425,34 @@ void BlocksGUI_TrsfDlg::enableWidgets() bool toEnable = !myShape->_is_nil(); - if (anId == 0) { - mySelName[Face1]->setEnabled(toEnable); - mySelName[Face2]->setEnabled(toEnable); - mySelBtn[Face1]->setEnabled(toEnable); - mySelBtn[Face2]->setEnabled(toEnable); + if ( anId == 0 ) { + mySelName[Face1]->setEnabled( toEnable ); + mySelName[Face2]->setEnabled( toEnable ); + mySelBtn[Face1]->setEnabled( toEnable ); + mySelBtn[Face2]->setEnabled( toEnable ); - if (!toEnable) { - mySelName[Face1]->setText(""); - mySelName[Face2]->setText(""); + if ( !toEnable) { + mySelName[Face1]->setText( "" ); + mySelName[Face2]->setText( "" ); myFaces[Face1] = -1; myFaces[Face2] = -1; } - } else if (anId == 1) { - mySelName[Face1U]->setEnabled(toEnable); - mySelName[Face2U]->setEnabled(toEnable); - mySelName[Face1V]->setEnabled(toEnable); - mySelName[Face2V]->setEnabled(toEnable); - mySelBtn[Face1U]->setEnabled(toEnable); - mySelBtn[Face2U]->setEnabled(toEnable); - mySelBtn[Face1V]->setEnabled(toEnable); - mySelBtn[Face2V]->setEnabled(toEnable); - - if (!toEnable) { - mySelName[Face1U]->setText(""); - mySelName[Face2U]->setText(""); - mySelName[Face1V]->setText(""); - mySelName[Face2V]->setText(""); + } + else if ( anId == 1 ) { + mySelName[Face1U]->setEnabled( toEnable ); + mySelName[Face2U]->setEnabled( toEnable ); + mySelName[Face1V]->setEnabled( toEnable ); + mySelName[Face2V]->setEnabled( toEnable ); + mySelBtn[Face1U]->setEnabled( toEnable ); + mySelBtn[Face2U]->setEnabled( toEnable ); + mySelBtn[Face1V]->setEnabled( toEnable ); + mySelBtn[Face2V]->setEnabled( toEnable ); + + if ( !toEnable ) { + mySelName[Face1U]->setText( "" ); + mySelName[Face2U]->setText( "" ); + mySelName[Face1V]->setText( "" ); + mySelName[Face2V]->setText( "" ); myFaces[Face1U] = -1; myFaces[Face2U] = -1; myFaces[Face1V] = -1; @@ -454,60 +467,63 @@ void BlocksGUI_TrsfDlg::enableWidgets() //================================================================================= GEOM::GEOM_IOperations_ptr BlocksGUI_TrsfDlg::createOperation() { - return getGeomEngine()->GetIBlocksOperations(getStudyId()); + return getGeomEngine()->GetIBlocksOperations( getStudyId() ); } //================================================================================= // function : ClickOnApply() // purpose : Verify validity of input data //================================================================================= -bool BlocksGUI_TrsfDlg::isValid (QString&) +bool BlocksGUI_TrsfDlg::isValid( QString& ) { - switch (getConstructorId()) { - case 0: - return !myShape->_is_nil() && myFaces[Face1] > 0; - case 1: - return !myShape->_is_nil() && myFaces[Face1U] > 0 && myFaces[Face1V] > 0; - default: - return false; + bool ok = false; + switch ( getConstructorId() ) { + case 0: + ok = !myShape->_is_nil() && myFaces[Face1] > 0; + break; + case 1: + ok = !myShape->_is_nil() && myFaces[Face1U] > 0 && myFaces[Face1V] > 0; + break; + default: + break; } - return false; + return ok; } //================================================================================= // function : execute // purpose : //================================================================================= -bool BlocksGUI_TrsfDlg::execute (ObjectList& objects) +bool BlocksGUI_TrsfDlg::execute( ObjectList& objects ) { bool res = false; GEOM::GEOM_Object_var anObj; - switch (getConstructorId()) { - case 0: - anObj = GEOM::GEOM_IBlocksOperations::_narrow(getOperation())->MakeMultiTransformation1D - (myShape, - myFaces[Face1], - myFaces[Face2], - (int)mySpinBox[SpinBox1]->GetValue()); - res = true; - break; - case 1: - anObj = GEOM::GEOM_IBlocksOperations::_narrow(getOperation())->MakeMultiTransformation2D - (myShape, - myFaces[Face1U], - myFaces[Face2U], - (int)mySpinBox[SpinBox2U]->GetValue(), - myFaces[Face1V], - myFaces[Face2V], - (int)mySpinBox[SpinBox2V]->GetValue()); - res = true; - break; + switch ( getConstructorId() ) { + case 0: + anObj = GEOM::GEOM_IBlocksOperations::_narrow( getOperation() )->MakeMultiTransformation1D + ( myShape, + myFaces[Face1], + myFaces[Face2], + (int)mySpinBox[SpinBox1]->value() ); + res = true; + break; + case 1: + anObj = GEOM::GEOM_IBlocksOperations::_narrow( getOperation() )->MakeMultiTransformation2D + ( myShape, + myFaces[Face1U], + myFaces[Face2U], + (int)mySpinBox[SpinBox2U]->value(), + myFaces[Face1V], + myFaces[Face2V], + (int)mySpinBox[SpinBox2V]->value() ); + res = true; + break; } - if (!anObj->_is_nil()) - objects.push_back(anObj._retn()); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); return res; } diff --git a/src/BlocksGUI/BlocksGUI_TrsfDlg.h b/src/BlocksGUI/BlocksGUI_TrsfDlg.h index 7508c8e48..a272956e7 100644 --- a/src/BlocksGUI/BlocksGUI_TrsfDlg.h +++ b/src/BlocksGUI/BlocksGUI_TrsfDlg.h @@ -1,43 +1,44 @@ -// GEOM GEOMGUI : GUI for Geometry component +// GEOM GEOMGUI : GUI for Geometry component // -// Copyright (C) 2003 CEA +// Copyright (C) 2003 CEA // -// 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 : BlocksGUI_TrsfDlg.h +// Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com) // -// -// File : BlocksGUI_TrsfDlg.h -// Author : Julia DOROVSKIKH -// Module : GEOM -#ifndef DIALOGBOX_BLOCK_MULTITRSF_H -#define DIALOGBOX_BLOCK_MULTITRSF_H +#ifndef BLOCKSGUI_TRSFDLG_H +#define BLOCKSGUI_TRSFDLG_H -#include "GEOM_BlocksGUI.hxx" +#include -#include "GEOMBase_Skeleton.h" +#include -class DlgRef_SpinBox; +class QDoubleSpinBox; +class QGroupBox; +class QPushButton; +class QLineEdit; //================================================================================= // class : BlocksGUI_TrsfDlg // purpose : //================================================================================= -class GEOM_BLOCKSGUI_EXPORT BlocksGUI_TrsfDlg : public GEOMBase_Skeleton +class BlocksGUI_TrsfDlg : public GEOMBase_Skeleton { Q_OBJECT @@ -45,46 +46,49 @@ class GEOM_BLOCKSGUI_EXPORT BlocksGUI_TrsfDlg : public GEOMBase_Skeleton enum { SpinBox1, SpinBox2U, SpinBox2V }; public: - BlocksGUI_TrsfDlg (GeometryGUI*, QWidget* parent, bool modal = FALSE); + BlocksGUI_TrsfDlg( GeometryGUI*, QWidget* ); ~BlocksGUI_TrsfDlg(); protected: // redefined from GEOMBase_Helper virtual GEOM::GEOM_IOperations_ptr createOperation(); - virtual bool isValid (QString& msg); - virtual bool execute (ObjectList& objects); + virtual bool isValid( QString& ); + virtual bool execute( ObjectList& ); private: - void Init(); - void enterEvent (QEvent* e); + void Init(); + void enterEvent( QEvent* ); - void createSelWg (const QString&, QPixmap&, QWidget*, const int); - void activateSelection(); - void enableWidgets(); + void createSelWg( const QString&, QPixmap&, + QWidget*, const int ); + void createSpinWg( const QString&, QWidget*, + const int ); + void activateSelection(); + void enableWidgets(); private: - int myConstructorId; + int myConstructorId; - GEOM::GEOM_Object_var myShape; - QMap myFaces; + GEOM::GEOM_Object_var myShape; + QMap myFaces; - QFrame* myGrp1; - QFrame* myGrp2; + QGroupBox* myGrp1; + QGroupBox* myGrp2; - QMap mySelBtn; - QMap mySelName; - QMap mySpinBox; + QMap mySelBtn; + QMap mySelName; + QMap mySpinBox; private slots: - void ClickOnOk(); - bool ClickOnApply(); - void ActivateThisDialog(); - void ConstructorsClicked (int constructorId); + void ClickOnOk(); + bool ClickOnApply(); + void ActivateThisDialog(); + void ConstructorsClicked( int ); - void SelectionIntoArgument(); - void SetEditCurrentArgument(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); - void ValueChangedInSpinBox (double newValue); + void ValueChangedInSpinBox( double ); }; -#endif // DIALOGBOX_BLOCK_MULTITRSF_H +#endif // BLOCKSGUI_TRSFDLG_H diff --git a/src/BlocksGUI/GEOM_BlocksGUI.hxx b/src/BlocksGUI/GEOM_BlocksGUI.hxx deleted file mode 100755 index 83f6cbc64..000000000 --- a/src/BlocksGUI/GEOM_BlocksGUI.hxx +++ /dev/null @@ -1,47 +0,0 @@ -// 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 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 -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : GEOM_BlocksGUI.hxx -// Author : Alexander A. BORODIN -// Module : GEOM - -#ifndef _GEOM_BlocksGUI_HXX_ -#define _GEOM_BlocksGUI_HXX_ - -#ifdef WNT - #if defined BLOCKSGUI_EXPORTS - #if defined WIN32 - #define GEOM_BLOCKSGUI_EXPORT __declspec( dllexport ) - #else - #define GEOM_BLOCKSGUI_EXPORT - #endif - #else - #if defined WIN32 - #define GEOM_BLOCKSGUI_EXPORT __declspec( dllimport ) - #else - #define GEOM_BLOCKSGUI_EXPORT - #endif - #endif -#else - #define GEOM_BLOCKSGUI_EXPORT -#endif - -#endif diff --git a/src/BlocksGUI/Makefile.am b/src/BlocksGUI/Makefile.am index 0c1f70470..894a52ae1 100644 --- a/src/BlocksGUI/Makefile.am +++ b/src/BlocksGUI/Makefile.am @@ -1,30 +1,27 @@ -# GEOM BUILDGUI : +# GEOM BUILDGUI : # -# Copyright (C) 2003 CEA +# Copyright (C) 2003 CEA # -# 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 : BlockGUI # -# -# File : Makefile.in -# Author : Julia DOROVSKIKH (OCC) -# Modified by : Alexander BORODIN (OCN) - autotools usage -# Module : GEOM -# $Header$ include $(top_srcdir)/adm_local/unix/make_common_starter.am @@ -34,22 +31,29 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am lib_LTLIBRARIES = libBlocksGUI.la # Sources files -dist_libBlocksGUI_la_SOURCES = \ - BlocksGUI.cxx \ - BlocksGUI_QuadFaceDlg.cxx \ - BlocksGUI_BlockDlg.cxx \ - BlocksGUI_ExplodeDlg.cxx \ - BlocksGUI_PropagateDlg.cxx \ +dist_libBlocksGUI_la_SOURCES = \ + BlocksGUI.h \ + BlocksGUI_QuadFaceDlg.h \ + BlocksGUI_BlockDlg.h \ + BlocksGUI_ExplodeDlg.h \ + BlocksGUI_PropagateDlg.h \ + BlocksGUI_TrsfDlg.h \ + \ + BlocksGUI.cxx \ + BlocksGUI_QuadFaceDlg.cxx \ + BlocksGUI_BlockDlg.cxx \ + BlocksGUI_ExplodeDlg.cxx \ + BlocksGUI_PropagateDlg.cxx \ BlocksGUI_TrsfDlg.cxx MOC_FILES = \ - BlocksGUI_QuadFaceDlg_moc.cxx \ - BlocksGUI_BlockDlg_moc.cxx \ - BlocksGUI_ExplodeDlg_moc.cxx \ - BlocksGUI_PropagateDlg_moc.cxx \ + BlocksGUI_QuadFaceDlg_moc.cxx \ + BlocksGUI_BlockDlg_moc.cxx \ + BlocksGUI_ExplodeDlg_moc.cxx \ + BlocksGUI_PropagateDlg_moc.cxx \ BlocksGUI_TrsfDlg_moc.cxx -nodist_libBlocksGUI_la_SOURCES= \ +nodist_libBlocksGUI_la_SOURCES = \ $(MOC_FILES) #LIB_CLIENT_IDL = SALOME_Exception.idl SALOME_GenericObj.idl SALOME_Component.idl @@ -59,28 +63,29 @@ nodist_libBlocksGUI_la_SOURCES= \ # additionnal information to compil and link file libBlocksGUI_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 \ + $(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 libBlocksGUI_la_LDFLAGS = \ - ../GEOMFiltersSelection/libGEOMFiltersSelection.la \ - ../DlgRef/libDlgRef.la \ - ../GEOMBase/libGEOMBase.la \ - ../GEOMGUI/libGEOM.la \ + ../GEOMFiltersSelection/libGEOMFiltersSelection.la \ + ../DlgRef/libDlgRef.la \ + ../GEOMBase/libGEOMBase.la \ + ../GEOMGUI/libGEOM.la \ $(QT_MT_LIBS)