X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FEntityGUI%2FEntityGUI_SubShapeDlg.cxx;h=6a3685b669522d9622fd17633d16d914dc6683e4;hb=a905ae28f68c37297d2774a4e25bf01bb0ae24a6;hp=ff6304c63a84399dbd0d83d30173c58c8ea31701;hpb=d3dd282390888d7dc091ba2c2ffe7923bd7458e6;p=modules%2Fgeom.git diff --git a/src/EntityGUI/EntityGUI_SubShapeDlg.cxx b/src/EntityGUI/EntityGUI_SubShapeDlg.cxx index ff6304c63..6a3685b66 100644 --- a/src/EntityGUI/EntityGUI_SubShapeDlg.cxx +++ b/src/EntityGUI/EntityGUI_SubShapeDlg.cxx @@ -17,7 +17,7 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -29,8 +29,11 @@ #include "EntityGUI_SubShapeDlg.h" #include "GEOM_Displayer.h" -#include "QAD_RightFrame.h" -#include "QAD_Desktop.h" +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "OCCViewer_ViewModel.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" #include "SALOME_ListIteratorOfListIO.hxx" #include @@ -39,6 +42,8 @@ #include #include +#include +#include //================================================================================= // class : EntityGUI_SubShapeDlg @@ -47,11 +52,12 @@ // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -EntityGUI_SubShapeDlg::EntityGUI_SubShapeDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, fl) +EntityGUI_SubShapeDlg::EntityGUI_SubShapeDlg(GeometryGUI* theGeometryGUI, QWidget* parent, + const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, fl) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_SUBSHAPE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_SUBSHAPE"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_SUBSHAPE_TITLE")); @@ -72,6 +78,8 @@ EntityGUI_SubShapeDlg::EntityGUI_SubShapeDlg(QWidget* parent, const char* name, Layout1->addWidget(GroupPoints, 1, 0); /***************************************************************/ + setHelpFileName("explode.htm"); + Init(); } @@ -108,13 +116,12 @@ void EntityGUI_SubShapeDlg::Init() GroupPoints->ComboBox1->insertItem("Vertex"); GroupPoints->ComboBox1->insertItem("Shape"); - if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_OCC) + if (SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() + != OCCViewer_Viewer::Type()) GroupPoints->CheckButton1->setEnabled(false); /* signals and slots connections */ - connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); - connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); @@ -124,8 +131,9 @@ void EntityGUI_SubShapeDlg::Init() connect(GroupPoints->ComboBox1, SIGNAL(activated(int)), this, SLOT(ComboTextChanged())); connect(GroupPoints->CheckButton1, SIGNAL(stateChanged(int)), this, SLOT(SubShapeToggled())); - - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; updateButtonState(); @@ -150,7 +158,7 @@ void EntityGUI_SubShapeDlg::ClickOnOk() //================================================================================= bool EntityGUI_SubShapeDlg::ClickOnApply() { - QAD_Application::getDesktop()->putInfo(tr("")); + SUIT_Session::session()->activeApplication()->putInfo(tr("")); /* Explode all sub shapes */ if( isAllSubShapes() ) { @@ -185,20 +193,20 @@ void EntityGUI_SubShapeDlg::SelectionIntoArgument() QString aString = ""; /* name of selection */ - int nbSel = GEOMBase::GetNameOfSelectedIObjects( mySelection, aString, true ); + int nbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aString, true ); if( nbSel != 1 ) return; TopoDS_Shape S; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); + Handle(SALOME_InteractiveObject) IO = firstIObject(); if ( !IO->hasEntry() ) { - QAD_Application::getDesktop()->putInfo( tr( "GEOM_PRP_SHAPE_IN_STUDY" ) ); + SUIT_Session::session()->activeApplication()->putInfo( tr( "GEOM_PRP_SHAPE_IN_STUDY" ) ); updateButtonState(); return; } - if ( !myGeomBase->GetTopoFromSelection( mySelection, S ) || + if ( !GEOMBase::GetTopoFromSelection( selectedIO(), S ) || S.IsNull() || S.ShapeType() == TopAbs_VERTEX ) { @@ -319,7 +327,7 @@ void EntityGUI_SubShapeDlg::LineEditReturnPressed() //================================================================================= void EntityGUI_SubShapeDlg::DeactivateActiveDialog() { - if(GroupConstructors->isEnabled()) { + if (GroupConstructors->isEnabled()) { GEOMBase_Skeleton::DeactivateActiveDialog(); } } @@ -332,7 +340,8 @@ void EntityGUI_SubShapeDlg::DeactivateActiveDialog() void EntityGUI_SubShapeDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; SubShapeToggled(); updateButtonState(); } @@ -344,9 +353,8 @@ void EntityGUI_SubShapeDlg::ActivateThisDialog() //================================================================================= void EntityGUI_SubShapeDlg::enterEvent(QEvent* e) { - if(GroupConstructors->isEnabled()) - return; - ActivateThisDialog(); + if (!GroupConstructors->isEnabled()) + ActivateThisDialog(); } //================================================================================= @@ -456,7 +464,7 @@ unsigned int EntityGUI_SubShapeDlg::NumberOfSubShapes (const TopoDS_Shape& S, //================================================================================= void EntityGUI_SubShapeDlg::updateButtonState() { - if ( QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_OCC || + if ( SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() != OCCViewer_Viewer::Type() || myObject->_is_nil() || shapeType() == TopAbs_SHAPE || shapeType() == TopAbs_COMPOUND ) { GroupPoints->CheckButton1->setChecked( FALSE ); GroupPoints->CheckButton1->setEnabled( FALSE ); @@ -514,14 +522,14 @@ bool EntityGUI_SubShapeDlg::isValid( QString& msg ) if ( !myObject->_is_nil() ) { if ( isAllSubShapes() ) isOk = true; - else if ( mySelection->IObjectCount() == 1 ) { + else if ( IObjectCount() == 1 ) { Standard_Boolean aResult = Standard_False; GEOM::GEOM_Object_var anObj = - GEOMBase::ConvertIOinGEOMObject( mySelection->firstIObject(), aResult ); + GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult ); if ( aResult && !anObj->_is_nil() ) { TColStd_IndexedMapOfInteger aMapIndex; - mySelection->GetIndex( mySelection->firstIObject(), aMapIndex ); + ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( firstIObject(), aMapIndex ); isOk = aMapIndex.Extent() > 0; if ( !isOk ) msg += tr( "NO_SUBSHAPES_SELECTED" ); @@ -547,14 +555,14 @@ bool EntityGUI_SubShapeDlg::execute( ObjectList& objects ) // and manual selection is active if ( !isAllSubShapes() ) { - if ( mySelection->IObjectCount() == 1 ) { + if ( IObjectCount() == 1 ) { Standard_Boolean aResult = Standard_False; GEOM::GEOM_Object_var anObj = - GEOMBase::ConvertIOinGEOMObject( mySelection->firstIObject(), aResult ); + GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult ); if ( aResult && !anObj->_is_nil() ) { TColStd_IndexedMapOfInteger aMapIndex; - mySelection->GetIndex( mySelection->firstIObject(), aMapIndex ); + ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( firstIObject(), aMapIndex ); GEOM::GEOM_ILocalOperations_var aLocOp = getGeomEngine()->GetILocalOperations( getStudyId() ); @@ -582,3 +590,7 @@ GEOM::GEOM_Object_ptr EntityGUI_SubShapeDlg::getFather( GEOM::GEOM_Object_ptr ) return myObject; } +const char* EntityGUI_SubShapeDlg::getNewObjectName() const +{ + return ""; +}