X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FBooleanGUI%2FBooleanGUI_Dialog.cxx;h=fea37ab7cd7da36ece9157e2ac016c11bd93e77b;hb=3a9cdb56a2d91b232f007b499a691a5cc9bd781b;hp=68bd77be8e211befdff4c62df1d9a827f7fceac6;hpb=d3dd282390888d7dc091ba2c2ffe7923bd7458e6;p=modules%2Fgeom.git diff --git a/src/BooleanGUI/BooleanGUI_Dialog.cxx b/src/BooleanGUI/BooleanGUI_Dialog.cxx index 68bd77be8..fea37ab7c 100644 --- a/src/BooleanGUI/BooleanGUI_Dialog.cxx +++ b/src/BooleanGUI/BooleanGUI_Dialog.cxx @@ -1,37 +1,42 @@ -// GEOM GEOMGUI : GUI for Geometry component +// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 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. // -// 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 +// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// GEOM GEOMGUI : GUI for Geometry component // File : BooleanGUI_Dialog.cxx // Author : Lucien PIGNOLONI // Module : GEOM // $Header$ - -using namespace std; +// #include "BooleanGUI_Dialog.h" #include "BooleanGUI.h" #include "DlgRef_2Sel_QTD.h" -#include "QAD_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" + +#include +#include + +using namespace std; //================================================================================= // class : BooleanGUI_Dialog() @@ -40,36 +45,41 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -BooleanGUI_Dialog::BooleanGUI_Dialog( const int theOperation, QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, fl), +BooleanGUI_Dialog::BooleanGUI_Dialog( const int theOperation, GeometryGUI* theGeometryGUI, + QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, fl), myOperation( theOperation ) { QPixmap image0; QString aTitle, aCaption; switch ( myOperation ) { - case BooleanGUI::COMMON: - image0 = QPixmap( QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_COMMON"))); - aTitle = tr("GEOM_COMMON"); - aCaption = tr("GEOM_COMMON_TITLE"); - break; - case BooleanGUI::CUT: - image0 = QPixmap( QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_CUT"))); - aTitle = tr("GEOM_CUT"); - aCaption = tr("GEOM_CUT_TITLE"); - break; - case BooleanGUI::FUSE: - image0 = QPixmap( QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_FUSE"))); - aTitle = tr("GEOM_FUSE"); - aCaption = tr("GEOM_FUSE_TITLE"); - break; - case BooleanGUI::SECTION: - image0 = QPixmap( QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_SECTION"))); - aTitle = tr("GEOM_SECTION"); - aCaption = tr("GEOM_SECTION_TITLE"); - break; - } - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + case BooleanGUI::COMMON: + image0 = QPixmap( SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_COMMON"))); + aTitle = tr("GEOM_COMMON"); + aCaption = tr("GEOM_COMMON_TITLE"); + setHelpFileName("common_operation_page.html"); + break; + case BooleanGUI::CUT: + image0 = QPixmap( SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CUT"))); + aTitle = tr("GEOM_CUT"); + aCaption = tr("GEOM_CUT_TITLE"); + setHelpFileName("cut_operation_page.html"); + break; + case BooleanGUI::FUSE: + image0 = QPixmap( SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_FUSE"))); + aTitle = tr("GEOM_FUSE"); + aCaption = tr("GEOM_FUSE_TITLE"); + setHelpFileName("fuse_operation_page.html"); + break; + case BooleanGUI::SECTION: + image0 = QPixmap( SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_SECTION"))); + aTitle = tr("GEOM_SECTION"); + aCaption = tr("GEOM_SECTION_TITLE"); + setHelpFileName("section_opeartion_page.html"); + break; + } + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption( aCaption ); @@ -114,13 +124,14 @@ BooleanGUI_Dialog::~BooleanGUI_Dialog() } - //================================================================================= // function : Init() // purpose : //================================================================================= void BooleanGUI_Dialog::Init() { + GroupBoxPublish->show(); + /* init variables */ myEditCurrentArgument = myGroup->LineEdit1; @@ -134,10 +145,21 @@ void BooleanGUI_Dialog::Init() connect(myGroup->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(myGroup->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; initName( GroupConstructors->title() ); + setTabOrder (RadioButton1, ResultName ); + setTabOrder (ResultName, myGroup->PushButton1); + setTabOrder (myGroup->PushButton1, myGroup->PushButton2); + setTabOrder (myGroup->PushButton2, buttonOk); + setTabOrder (buttonOk, buttonApply); + setTabOrder (buttonApply, buttonCancel); + setTabOrder (buttonCancel, buttonHelp); + + RadioButton1->setFocus(); + globalSelection( GEOM_ALLSHAPES ); } @@ -175,7 +197,7 @@ void BooleanGUI_Dialog::SelectionIntoArgument() { myEditCurrentArgument->setText( "" ); - if ( mySelection->IObjectCount() != 1 ) + if ( IObjectCount() != 1 ) { if ( myEditCurrentArgument == myGroup->LineEdit1 ) myObject1 = GEOM::GEOM_Object::_nil(); else if ( myEditCurrentArgument == myGroup->LineEdit2 ) myObject2 = GEOM::GEOM_Object::_nil(); @@ -184,7 +206,7 @@ void BooleanGUI_Dialog::SelectionIntoArgument() // nbSel == 1 Standard_Boolean aRes = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( mySelection->firstIObject(), aRes ); + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes ); if ( !CORBA::is_nil( aSelectedObject ) && aRes && GEOMBase::IsShape( aSelectedObject ) ) { myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); @@ -210,7 +232,6 @@ void BooleanGUI_Dialog::SetEditCurrentArgument() } - //================================================================================= // function : LineEditReturnPressed() // purpose : @@ -234,7 +255,8 @@ void BooleanGUI_Dialog::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); globalSelection( GEOM_ALLSHAPES ); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; } @@ -263,6 +285,12 @@ GEOM::GEOM_IOperations_ptr BooleanGUI_Dialog::createOperation() //================================================================================= bool BooleanGUI_Dialog::isValid( QString& msg ) { + Handle(SALOME_InteractiveObject) IO = firstIObject(); + Standard_Boolean testResult; + GEOM::GEOM_Object_var anObject = GEOMBase::ConvertIOinGEOMObject( IO, testResult ); + if ( !testResult || anObject->_is_nil() ) + return false; + return !CORBA::is_nil( myObject1 ) && !CORBA::is_nil( myObject2 ); } @@ -274,9 +302,25 @@ bool BooleanGUI_Dialog::execute( ObjectList& objects ) { GEOM::GEOM_Object_var anObj; - anObj = GEOM::GEOM_IBooleanOperations::_narrow( getOperation() )->MakeBoolean( myObject1, myObject2, myOperation ); + anObj = GEOM::GEOM_IBooleanOperations::_narrow( getOperation() )-> + MakeBoolean( myObject1, myObject2, myOperation ); if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); return true; } + +//================================================================================= +// function : restoreSubShapes +// purpose : +//================================================================================= +void BooleanGUI_Dialog::restoreSubShapes (SALOMEDS::Study_ptr theStudy, + SALOMEDS::SObject_ptr theSObject) +{ + if (CheckBoxRestoreSS->isChecked()) { + // empty list of arguments means that all arguments should be restored + getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, GEOM::ListOfGO(), + /*theFindMethod=*/GEOM::FSM_GetInPlace, // ? GEOM::FSM_GetSame + /*theInheritFirstArg=*/myOperation==BooleanGUI::CUT); // ? false + } +}