From 25cec45acb2923f66c849516f31337c1a3c4c687 Mon Sep 17 00:00:00 2001 From: apo Date: Wed, 8 Jun 2005 06:18:53 +0000 Subject: [PATCH] Update from local sources --- src/SMESHGUI/SMESHGUI.cxx | 103 ++++++++--------- src/SMESHGUI/SMESHGUI_DeleteGroupDlg.cxx | 54 +++++---- src/SMESHGUI/SMESHGUI_DeleteGroupDlg.h | 13 ++- src/SMESHGUI/SMESHGUI_FilterDlg.cxx | 43 ++++--- src/SMESHGUI/SMESHGUI_FilterDlg.h | 10 +- src/SMESHGUI/SMESHGUI_FilterLibraryDlg.cxx | 40 +++---- src/SMESHGUI/SMESHGUI_FilterLibraryDlg.h | 7 +- src/SMESHGUI/SMESHGUI_FilterUtils.cxx | 6 +- src/SMESHGUI/SMESHGUI_GroupDlg.cxx | 125 ++++++++++++--------- src/SMESHGUI/SMESHGUI_GroupDlg.h | 2 +- src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx | 6 +- src/SMESHGUI/SMESHGUI_NodesDlg.cxx | 95 ++++++---------- src/SMESHGUI/SMESHGUI_NodesDlg.h | 17 +-- src/SMESHGUI/SMESHGUI_Selection.cxx | 53 +++++---- src/SMESHGUI/SMESHGUI_Selection.h | 11 +- 15 files changed, 292 insertions(+), 293 deletions(-) diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index 21faa6d72..30064c21b 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -307,19 +307,6 @@ namespace{ aFilename = fd->selectedFile(); aFormat = aFilterMap[fd->selectedFilter()]; delete fd; - if( !aFilename.isEmpty() - && (aMesh->NbPolygons()>0 or aMesh->NbPolyhedrons()>0) - && aFormat==SMESH::MED_V2_1){ - int aRet = SUIT_MessageBox::warn2(SMESHGUI::desktop(), - QObject::tr("SMESH_WRN_WARNING"), - QObject::tr("SMESH_EXPORT_MED_V2_1").arg(anIObject->getName()), - QObject::tr("SMESH_BUT_YES"), - QObject::tr("SMESH_BUT_NO"), - 0,1,0); - if(aRet){ - return; - } - } } if ( !aFilename.isEmpty() ) { // Check whether the file already exists and delete it if yes @@ -1235,7 +1222,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) if ( vtkwnd ) { EmitSignalDeactivateDialog(); - new SMESHGUI_NodesDlg( desktop(), "", SMESHGUI::selectionMgr() ); + new SMESHGUI_NodesDlg(this); } else { SUIT_MessageBox::warn1(desktop(), @@ -1698,7 +1685,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) EmitSignalDeactivateDialog(); - new SMESHGUI_DeleteGroupDlg( desktop(), SMESHGUI::selectionMgr() ); + new SMESHGUI_DeleteGroupDlg(this); break; } @@ -2169,7 +2156,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) aTypes.append( SMESH::FACE ); aTypes.append( SMESH::VOLUME ); } - new SMESHGUI_FilterLibraryDlg( desktop(), aTypes, SMESHGUI_FilterLibraryDlg::EDIT ); + new SMESHGUI_FilterLibraryDlg( this, SMESH::GetDesktop( this ), aTypes, SMESHGUI_FilterLibraryDlg::EDIT ); } break; @@ -2443,9 +2430,9 @@ void SMESHGUI::createPopupItem( const int id, if( !popupMgr()->contains( popupMgr()->actionId( action( id ) ) ) ) popupMgr()->insert( action( id ), parentId, 0 ); - QChar lc = popupMgr()->equality(); + QChar lc = QtxPopupMgr::Selection::defEquality(); QString rule = "(%1) and (%2) and (%3)"; - rule = rule.arg( QString( "%1>0" ).arg( popupMgr()->selCountParam() ) ); + rule = rule.arg( QString( "%1>0" ).arg( QtxPopupMgr::Selection::defSelCountParam() ) ); rule = rule.arg( QString( "%1client in {%2}" ).arg( lc ).arg( clients ) ); rule = rule.arg( QString( "%1type in {%2}" ).arg( lc ).arg( types ) ); rule += theRule; @@ -2499,19 +2486,19 @@ void SMESHGUI::initialize( CAM_Application* app ) createSMESHAction( 813, "DEL_GROUP", "ICON_DEL_GROUP" ); createSMESHAction( 900, "ADV_INFO", "ICON_ADV_INFO" ); createSMESHAction( 902, "STD_INFO", "ICON_STD_INFO" ); - createSMESHAction( 6001, "LENGTH", "ICON_LENGTH" ); - createSMESHAction( 6002, "FREE_EDGE", "ICON_FREE_EDGE" ); - createSMESHAction( 6003, "FREE_BORDER", "ICON_FREE_EDGE_2D" ); - createSMESHAction( 6004, "CONNECTION", "ICON_CONNECTION" ); - createSMESHAction( 6011, "AREA", "ICON_AREA" ); - createSMESHAction( 6012, "TAPER", "ICON_TAPER" ); - createSMESHAction( 6013, "ASPECT", "ICON_ASPECT" ); - createSMESHAction( 6014, "MIN_ANG", "ICON_ANGLE" ); - createSMESHAction( 6015, "WRAP", "ICON_WRAP" ); - createSMESHAction( 6016, "SKEW", "ICON_SKEW" ); - createSMESHAction( 6017, "ASPECT_3D", "ICON_ASPECT_3D" ); - createSMESHAction( 6018, "LENGTH_2D", "ICON_LENGTH_2D" ); - createSMESHAction( 6019, "CONNECTION_2D", "ICON_CONNECTION_2D" ); + createSMESHAction( 6001, "LENGTH", "ICON_LENGTH" , 0, true ); + createSMESHAction( 6002, "FREE_EDGE", "ICON_FREE_EDGE" , 0, true ); + createSMESHAction( 6003, "FREE_BORDER", "ICON_FREE_EDGE_2D" , 0, true ); + createSMESHAction( 6004, "CONNECTION", "ICON_CONNECTION" , 0, true ); + createSMESHAction( 6011, "AREA", "ICON_AREA" , 0, true ); + createSMESHAction( 6012, "TAPER", "ICON_TAPER" , 0, true ); + createSMESHAction( 6013, "ASPECT", "ICON_ASPECT" , 0, true ); + createSMESHAction( 6014, "MIN_ANG", "ICON_ANGLE" , 0, true ); + createSMESHAction( 6015, "WRAP", "ICON_WRAP" , 0, true ); + createSMESHAction( 6016, "SKEW", "ICON_SKEW", 0, true ); + createSMESHAction( 6017, "ASPECT_3D", "ICON_ASPECT_3D", 0, true ); + createSMESHAction( 6018, "LENGTH_2D", "ICON_LENGTH_2D", 0, true ); + createSMESHAction( 6019, "CONNECTION_2D", "ICON_CONNECTION_2D", 0, true ); createSMESHAction( 400, "NODE", "ICON_DLG_NODE" ); createSMESHAction( 401, "EDGE", "ICON_DLG_EDGE" ); createSMESHAction( 4021, "TRIANGLE", "ICON_DLG_TRIANGLE" ); @@ -2550,18 +2537,19 @@ void SMESHGUI::initialize( CAM_Application* app ) createSMESHAction( 10071, "DISP_ENT", "", 0, true ); createSMESHAction( 200, "RESET" ); createSMESHAction( 201, "SCALAR_BAR_PROP" ); - createSMESHAction( 211, "WIRE", "ICON_WIRE" ); - createSMESHAction( 212, "SHADE", "ICON_SHADE" ); - createSMESHAction( 213, "SHRINK", "ICON_SHRINK" ); + createSMESHAction( 211, "WIRE", "ICON_WIRE", 0, true ); + createSMESHAction( 212, "SHADE", "ICON_SHADE", 0, true ); + createSMESHAction( 213, "SHRINK", "ICON_SHRINK", 0, true ); createSMESHAction( 214, "UPDATE", "ICON_UPDATE" ); - createSMESHAction( 215, "NODES", "ICON_POINTS" ); - createSMESHAction( 217, "EDGES", "ICON_DLG_EDGE" ); - createSMESHAction( 218, "FACES", "ICON_DLG_TRIANGLE" ); - createSMESHAction( 219, "VOLUMES", "ICON_DLG_TETRAS" ); + createSMESHAction( 215, "NODES", "ICON_POINTS", 0, true ); + createSMESHAction( 217, "EDGES", "ICON_DLG_EDGE", 0, true ); + createSMESHAction( 218, "FACES", "ICON_DLG_TRIANGLE", 0, true ); + createSMESHAction( 219, "VOLUMES", "ICON_DLG_TETRAS", 0, true ); createSMESHAction( 220, "ALL" ); + createSMESHAction( 1100, "EDIT_HYPO" ); createSMESHAction( 1101, "RENAME" ); - createSMESHAction( 9010, "NUM_NODES" ); - createSMESHAction( 9011, "NUM_ELEMENTS" ); + createSMESHAction( 9010, "NUM_NODES", "", 0, true ); + createSMESHAction( 9011, "NUM_ELEMENTS", "", 0, true ); createSMESHAction( 1131, "DISPMODE" ); createSMESHAction( 1132, "COLORS" ); createSMESHAction( 1133, "TRANSP" ); @@ -2847,9 +2835,9 @@ void SMESHGUI::initialize( CAM_Application* app ) hasFaces("{'Face'} in elemTypes"), hasVolumes("{'Volume'} in elemTypes"); - QString aSelCount = popupMgr()->selCountParam() + "= 1"; - QString aClient = QString( popupMgr()->equality() )+ "client in {" + View + "}"; - QString aType = QString( popupMgr()->equality() ) + "type in {" + mesh_group + "}"; + QString aSelCount = QString( "%1 = 1" ).arg( QtxPopupMgr::Selection::defSelCountParam() ); + QString aClient = QString( "%1client in {%2}" ).arg( QtxPopupMgr::Selection::defEquality() ).arg( View ); + QString aType = QString( "%1type in {%2}" ).arg( QtxPopupMgr::Selection::defEquality() ).arg( mesh_group ); QString aMeshInVTK = aClient + "&&" + aType + "&&" + aSelCount; //------------------------------------------------- @@ -2951,59 +2939,59 @@ void SMESHGUI::initialize( CAM_Application* app ) popupMgr()->insert( action( 6003 ), anId, -1 ); // FREE_BORDER popupMgr()->setRule( action( 6003 ), aMeshInVtkHasEdges, true ); - popupMgr()->setRule( action( 6003 ), "&& controlMode = 'eFreeEdges'", true ); + popupMgr()->setRule( action( 6003 ), "controlMode = 'eFreeEdges'", false ); popupMgr()->insert( action( 6001 ), anId, -1 ); // LENGTH popupMgr()->setRule( action( 6001 ), aMeshInVtkHasEdges, true ); - popupMgr()->setRule( action( 6001 ), "&& controlMode = 'eLength'", true ); + popupMgr()->setRule( action( 6001 ), "controlMode = 'eLength'", false ); popupMgr()->insert( action( 6004 ), anId, -1 ); // CONNECTION popupMgr()->setRule( action( 6004 ), aMeshInVtkHasEdges, true ); - popupMgr()->setRule( action( 6004 ), "&& controlMode = 'eMultiConnection'", true ); + popupMgr()->setRule( action( 6004 ), "controlMode = 'eMultiConnection'", false ); popupMgr()->insert( separator(), anId, -1 ); popupMgr()->insert( action( 6002 ), anId, -1 ); // FREE_EDGE popupMgr()->setRule( action( 6002 ), aMeshInVtkHasFaces, true ); - popupMgr()->setRule( action( 6002 ), "&& controlMode = 'eFreeBorders'", true ); + popupMgr()->setRule( action( 6002 ), "controlMode = 'eFreeBorders'", false ); popupMgr()->insert( action( 6018 ), anId, -1 ); // LENGTH_2D popupMgr()->setRule( action( 6018 ), aMeshInVtkHasFaces, true ); - popupMgr()->setRule( action( 6018 ), "&& controlMode = 'eLength2D'", true ); + popupMgr()->setRule( action( 6018 ), "controlMode = 'eLength2D'", false ); popupMgr()->insert( action( 6019 ), anId, -1 ); // CONNECTION_2D popupMgr()->setRule( action( 6019 ), aMeshInVtkHasFaces, true ); - popupMgr()->setRule( action( 6019 ), "&& controlMode = 'eMultiConnection2D'", true ); + popupMgr()->setRule( action( 6019 ), "controlMode = 'eMultiConnection2D'", false ); popupMgr()->insert( action( 6011 ), anId, -1 ); // AREA popupMgr()->setRule( action( 6011 ), aMeshInVtkHasFaces, true ); - popupMgr()->setRule( action( 6011 ), "&& controlMode = 'eArea'", true ); + popupMgr()->setRule( action( 6011 ), "controlMode = 'eArea'", false ); popupMgr()->insert( action( 6012 ), anId, -1 ); // TAPER popupMgr()->setRule( action( 6012 ), aMeshInVtkHasFaces, true ); - popupMgr()->setRule( action( 6012 ), "&& controlMode = 'eTaper'", true ); + popupMgr()->setRule( action( 6012 ), "controlMode = 'eTaper'", false ); popupMgr()->insert( action( 6013 ), anId, -1 ); // ASPECT popupMgr()->setRule( action( 6013 ), aMeshInVtkHasFaces, true ); - popupMgr()->setRule( action( 6013 ), "&& controlMode = 'eAspectRatio'", true ); + popupMgr()->setRule( action( 6013 ), "controlMode = 'eAspectRatio'", false ); popupMgr()->insert( action( 6014 ), anId, -1 ); // MIN_ANG popupMgr()->setRule( action( 6014 ), aMeshInVtkHasFaces, true ); - popupMgr()->setRule( action( 6014 ), "&& controlMode = 'eMinimumAngle'", true ); + popupMgr()->setRule( action( 6014 ), "controlMode = 'eMinimumAngle'", false ); popupMgr()->insert( action( 6015 ), anId, -1 ); // WRAP popupMgr()->setRule( action( 6015 ), aMeshInVtkHasFaces, true ); - popupMgr()->setRule( action( 6015 ), "&& controlMode = 'eWarping'", true ); + popupMgr()->setRule( action( 6015 ), "controlMode = 'eWarping'", false ); popupMgr()->insert( action( 6016 ), anId, -1 ); // SKEW popupMgr()->setRule( action( 6016 ), aMeshInVtkHasFaces, true ); - popupMgr()->setRule( action( 6016 ), "&& controlMode = 'eSkew'", true ); + popupMgr()->setRule( action( 6016 ), "controlMode = 'eSkew'", false ); popupMgr()->insert( separator(), anId, -1 ); popupMgr()->insert( action( 6017 ), anId, -1 ); // ASPECT_3D popupMgr()->setRule( action( 6017 ), aMeshInVtkHasVolumes, true ); - popupMgr()->setRule( action( 6017 ), "&& controlMode = 'eAspectRatio3D'", true ); + popupMgr()->setRule( action( 6017 ), "controlMode = 'eAspectRatio3D'", false ); popupMgr()->insert( separator(), anId, -1 ); @@ -3073,7 +3061,8 @@ QString SMESHGUI::engineIOR() const void SMESHGUI::contextMenuPopup( const QString& client, QPopupMenu* menu, QString& /*title*/ ) { - SMESHGUI_Selection sel( client, selectionMgr() ); + SMESHGUI_Selection sel; + sel.init( client, selectionMgr() ); popupMgr()->updatePopup( menu, &sel ); } diff --git a/src/SMESHGUI/SMESHGUI_DeleteGroupDlg.cxx b/src/SMESHGUI/SMESHGUI_DeleteGroupDlg.cxx index b71866823..838f50877 100644 --- a/src/SMESHGUI/SMESHGUI_DeleteGroupDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_DeleteGroupDlg.cxx @@ -38,10 +38,12 @@ #include "SalomeApp_Study.h" #include "SalomeApp_SelectionMgr.h" -#include "SVTK_Selection.h" #include "SALOME_ListIO.hxx" #include "SALOME_ListIteratorOfListIO.hxx" +#include "SVTK_Selection.h" +#include "SVTK_ViewWindow.h" + // QT Includes #include #include @@ -68,10 +70,14 @@ // function : SMESHGUI_DeleteGroupDlg() // purpose : Constructor //================================================================================= -SMESHGUI_DeleteGroupDlg::SMESHGUI_DeleteGroupDlg (QWidget* theParent, - SalomeApp_SelectionMgr* theSelection) - : QDialog(theParent, "SMESHGUI_DeleteGroupDlg", false, - WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +SMESHGUI_DeleteGroupDlg::SMESHGUI_DeleteGroupDlg (SMESHGUI* theModule): + QDialog(SMESH::GetDesktop(theModule), + "SMESHGUI_DeleteGroupDlg", + false, + WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), + mySelectionMgr(SMESH::GetSelectionMgr(theModule)), + myViewWindow(SMESH::GetViewWindow(mySMESHGUI)), + mySMESHGUI(theModule) { setCaption(tr("CAPTION")); @@ -85,7 +91,7 @@ SMESHGUI_DeleteGroupDlg::SMESHGUI_DeleteGroupDlg (QWidget* theParent, aDlgLay->setStretchFactor(aMainFrame, 1); - Init(theSelection); + Init(); } //================================================================================= @@ -147,30 +153,24 @@ SMESHGUI_DeleteGroupDlg::~SMESHGUI_DeleteGroupDlg() // function : Init() // purpose : Init dialog fields, connect signals and slots, show dialog //================================================================================= -void SMESHGUI_DeleteGroupDlg::Init (SalomeApp_SelectionMgr* theSelection) +void SMESHGUI_DeleteGroupDlg::Init () { myBlockSelection = false; - mySelectionMgr = theSelection; - SMESHGUI* aSMESHGUI = SMESHGUI::GetSMESHGUI(); - aSMESHGUI->SetActiveDialogBox((QDialog*)this); + mySMESHGUI->SetActiveDialogBox((QDialog*)this); // selection and SMESHGUI connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone())); - connect(aSMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate())); - connect(aSMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose())); + connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate())); + connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose())); int x, y; - aSMESHGUI->DefineDlgPosition(this, x, y); + mySMESHGUI->DefineDlgPosition(this, x, y); this->move(x, y); this->show(); // set selection mode -#ifdef NEW_GUI - mySelectionMgr->setSelectionModes(ActorSelection, true); -#else - mySelectionMgr->setSelectionModes(ActorSelection); -#endif mySelectionMgr->installFilter(new SMESH_TypeFilter(GROUP)); + myViewWindow->SetSelectionMode(ActorSelection); onSelectionDone(); return; @@ -188,7 +188,7 @@ bool SMESHGUI_DeleteGroupDlg::isValid() return false; } - return !SMESHGUI::GetSMESHGUI()->isActiveStudyLocked(); + return !mySMESHGUI->isActiveStudyLocked(); } //================================================================================= @@ -213,7 +213,7 @@ bool SMESHGUI_DeleteGroupDlg::onApply() myListGrp.clear(); mySelectionMgr->clearSelected(); SMESH::UpdateView(); - SMESHGUI::GetSMESHGUI()->updateObjBrowser(true); + mySMESHGUI->updateObjBrowser(true); myBlockSelection = false; return true; @@ -235,10 +235,10 @@ void SMESHGUI_DeleteGroupDlg::onOk() //================================================================================= void SMESHGUI_DeleteGroupDlg::onClose() { - mySelectionMgr->setSelectionModes(ActorSelection); + myViewWindow->SetSelectionMode(ActorSelection); disconnect(mySelectionMgr, 0, this, 0); - disconnect(SMESHGUI::GetSMESHGUI(), 0, this, 0); - SMESHGUI::GetSMESHGUI()->ResetState(); + disconnect(mySMESHGUI, 0, this, 0); + mySMESHGUI->ResetState(); mySelectionMgr->clearFilters(); reject(); } @@ -287,13 +287,9 @@ void SMESHGUI_DeleteGroupDlg::onDeactivate() //================================================================================= void SMESHGUI_DeleteGroupDlg::enterEvent (QEvent*) { - SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog(); + mySMESHGUI->EmitSignalDeactivateDialog(); setEnabled(true); -#ifdef NEW_GUI - mySelectionMgr->setSelectionModes(ActorSelection, true); -#else - mySelectionMgr->setSelectionModes(ActorSelection); -#endif + myViewWindow->SetSelectionMode(ActorSelection); mySelectionMgr->installFilter(new SMESH_TypeFilter (GROUP)); } diff --git a/src/SMESHGUI/SMESHGUI_DeleteGroupDlg.h b/src/SMESHGUI/SMESHGUI_DeleteGroupDlg.h index 1d86778a7..01abc7e4a 100644 --- a/src/SMESHGUI/SMESHGUI_DeleteGroupDlg.h +++ b/src/SMESHGUI/SMESHGUI_DeleteGroupDlg.h @@ -36,9 +36,12 @@ class QCloseEvent; class QFrame; class QPushButton; -class SalomeApp_SelectionMgr; class QListBox; +class SMESHGUI; +class SVTK_ViewWindow; +class SalomeApp_SelectionMgr; + /*! * Class : SMESHGUI_DeleteGroupDlg * Description : Delete groups and their contents @@ -49,11 +52,10 @@ class SMESHGUI_DeleteGroupDlg : public QDialog Q_OBJECT public: - SMESHGUI_DeleteGroupDlg (QWidget*, - SalomeApp_SelectionMgr*); + SMESHGUI_DeleteGroupDlg (SMESHGUI* theModule); virtual ~SMESHGUI_DeleteGroupDlg(); - void Init (SalomeApp_SelectionMgr*); + void Init (); private: @@ -82,6 +84,9 @@ private: QPushButton* myApplyBtn; QPushButton* myCloseBtn; QListBox* myListBox; + + SMESHGUI* mySMESHGUI; + SVTK_ViewWindow* myViewWindow; SalomeApp_SelectionMgr* mySelectionMgr; QValueList myListGrp; diff --git a/src/SMESHGUI/SMESHGUI_FilterDlg.cxx b/src/SMESHGUI/SMESHGUI_FilterDlg.cxx index 873c5f688..bf2863b20 100755 --- a/src/SMESHGUI/SMESHGUI_FilterDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_FilterDlg.cxx @@ -396,7 +396,7 @@ void SMESHGUI_FilterTable::Table::insertRows (int row, int count) if (anEditRow >= 0 && anEditCol >= 0) endEdit(anEditRow, anEditCol, true, false); - QTable::insertRows(row, count); + QTable::insertRows( row, count ); } //======================================================================= @@ -427,9 +427,12 @@ QString SMESHGUI_FilterTable::Table::text (int row, int col) const // name : SMESHGUI_FilterTable::SMESHGUI_FilterTable // Purpose : Constructor //======================================================================= -SMESHGUI_FilterTable::SMESHGUI_FilterTable (QWidget* parent, +SMESHGUI_FilterTable::SMESHGUI_FilterTable( SMESHGUI* theModule, + QWidget* parent, const int type) -: QFrame(parent) +: QFrame(parent), + myIsLocked( false ), + mySMESHGUI( theModule ) { myEntityType = -1; Init(type); @@ -439,9 +442,12 @@ SMESHGUI_FilterTable::SMESHGUI_FilterTable (QWidget* parent, // name : SMESHGUI_FilterTable::SMESHGUI_FilterTable // Purpose : Constructor //======================================================================= -SMESHGUI_FilterTable::SMESHGUI_FilterTable (QWidget* parent, +SMESHGUI_FilterTable::SMESHGUI_FilterTable( SMESHGUI* theModule, + QWidget* parent, const QValueList& types) -: QFrame(parent) +: QFrame(parent), + myIsLocked( false ), + mySMESHGUI( theModule ) { myEntityType = -1; Init(types); @@ -842,7 +848,7 @@ void SMESHGUI_FilterTable::SetCriterion (const int theRow, myAddWidgets[ anItem ]->SetDouble(AdditionalWidget::Tolerance, theCriterion.Tolerance); } - emit CretarionChanged(theRow, aType); + emit CriterionChanged(theRow, aType); } @@ -1033,7 +1039,8 @@ void SMESHGUI_FilterTable::onClearBtn() //======================================================================= void SMESHGUI_FilterTable::onCurrentChanged (int theRow, int theCol) { - updateAdditionalWidget(); + if( !myIsLocked ) + updateAdditionalWidget(); emit CurrentChanged(theRow, theCol); } @@ -1087,7 +1094,7 @@ void SMESHGUI_FilterTable::onCriterionChanged (const int row, const int col, con updateAdditionalWidget(); - emit CretarionChanged(row, entityType); + emit CriterionChanged(row, entityType); } //======================================================================= @@ -1125,6 +1132,7 @@ void SMESHGUI_FilterTable::addRow (Table* theTable, const int theType, const boo int aSelectedRow = getFirstSelectedRow(); int aCurrCol = theTable->currentColumn(); + myIsLocked = true; if (toTheEnd || aSelectedRow == -1) { theTable->insertRows(theTable->numRows()); @@ -1135,6 +1143,7 @@ void SMESHGUI_FilterTable::addRow (Table* theTable, const int theType, const boo theTable->insertRows(aSelectedRow); aCurrRow = aSelectedRow; } + myIsLocked = false; // Criteria theTable->setItem(aCurrRow, 0, getCriterionItem(theTable, theType)); @@ -1490,7 +1499,7 @@ void SMESHGUI_FilterTable::onCopyFromBtn() { if (myLibDlg == 0) myLibDlg = new SMESHGUI_FilterLibraryDlg( - this, GetType(), SMESHGUI_FilterLibraryDlg::COPY_FROM); + mySMESHGUI, this, GetType(), SMESHGUI_FilterLibraryDlg::COPY_FROM); else myLibDlg->Init(GetType(), SMESHGUI_FilterLibraryDlg::COPY_FROM); @@ -1512,7 +1521,7 @@ void SMESHGUI_FilterTable::onAddToBtn() return; if (myLibDlg == 0) myLibDlg = new SMESHGUI_FilterLibraryDlg( - this, GetType(), SMESHGUI_FilterLibraryDlg::ADD_TO); + mySMESHGUI, this, GetType(), SMESHGUI_FilterLibraryDlg::ADD_TO); else myLibDlg->Init(GetType(), SMESHGUI_FilterLibraryDlg::ADD_TO); @@ -1612,10 +1621,10 @@ SMESHGUI_FilterDlg::SMESHGUI_FilterDlg( SMESHGUI* theModule, : QDialog( SMESH::GetDesktop( theModule ), theName, false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), mySMESHGUI( theModule ), - mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), - myViewWindow( SMESH::GetViewWindow( theModule ) ), - mySelector( myViewWindow->GetSelector() ) + mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) { + myViewWindow = SMESH::GetViewWindow( theModule ); + mySelector = myViewWindow->GetSelector(); QValueList aTypes; aTypes.append(theType); construct(aTypes); @@ -1656,7 +1665,7 @@ QFrame* SMESHGUI_FilterDlg::createMainFrame (QWidget* theParent) // filter frame - myTable = new SMESHGUI_FilterTable(aMainFrame, myTypes); + myTable = new SMESHGUI_FilterTable( mySMESHGUI, aMainFrame, myTypes ); myTable->SetLibsEnabled(true); QFrame* aLine = new QFrame(myTable->GetTableGrp()); @@ -1668,7 +1677,7 @@ QFrame* SMESHGUI_FilterDlg::createMainFrame (QWidget* theParent) // other controls mySourceGrp = createSourceGroup(aMainFrame); - connect(myTable, SIGNAL(CretarionChanged(const int, const int)), + connect(myTable, SIGNAL(CriterionChanged(const int, const int)), SLOT(onCriterionChanged(const int, const int))); connect(myTable, SIGNAL(CurrentChanged(int, int)), @@ -2494,7 +2503,7 @@ void SMESHGUI_FilterDlg::updateSelection() if (myTable->GetCriterionType(aRow) == FT_BelongToGeom || myTable->GetCriterionType(aRow) == FT_LyingOnGeom) { - mySelectionMgr->installFilter(new SMESH_NumberFilter("GEOM",TopAbs_SHAPE,0,allTypes)); + mySelectionMgr->installFilter(new GEOM_SelectionFilter( aStudy, true )); } else if (myTable->GetCriterionType(aRow) == FT_BelongToPlane) { mySelectionMgr->installFilter(new GEOM_FaceFilter( aStudy, StdSelect_Plane ) ); @@ -2506,7 +2515,7 @@ void SMESHGUI_FilterDlg::updateSelection() } else { if (myIsSelectionChanged) { - mySelectionMgr->installFilter(new SMESH_NumberFilter ("This filter deactivates selection",TopAbs_SHAPE,0,allTypes)); + mySelectionMgr->installFilter( new GEOM_TypeFilter( aStudy, -1 ) ); // This filter deactivates selection } } } diff --git a/src/SMESHGUI/SMESHGUI_FilterDlg.h b/src/SMESHGUI/SMESHGUI_FilterDlg.h index cbef2c66f..8cb544484 100755 --- a/src/SMESHGUI/SMESHGUI_FilterDlg.h +++ b/src/SMESHGUI/SMESHGUI_FilterDlg.h @@ -81,9 +81,11 @@ class SMESHGUI_FilterTable : public QFrame typedef QMap TableMap; public: - SMESHGUI_FilterTable (QWidget* parent, + SMESHGUI_FilterTable( SMESHGUI*, + QWidget* parent, const int type); - SMESHGUI_FilterTable (QWidget* parent, + SMESHGUI_FilterTable( SMESHGUI*, + QWidget* parent, const QValueList& type); virtual ~SMESHGUI_FilterTable(); @@ -136,7 +138,7 @@ signals: void AddToClicked(); void EntityTypeChanged (const int); void NeedValidation(); - void CretarionChanged (const int theRow, const int theEntityType); + void CriterionChanged (const int theRow, const int theEntityType); void CurrentChanged (int, int); private slots: @@ -172,6 +174,7 @@ private: const QMap& getSupportedTypes() const; private: + SMESHGUI* mySMESHGUI; QGroupBox* myTableGrp; QGroupBox* mySwitchTableGrp; @@ -187,6 +190,7 @@ private: QButtonGroup* myEntityTypeGrp; int myEntityType; int myIsValid; + bool myIsLocked; SMESHGUI_FilterLibraryDlg* myLibDlg; diff --git a/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.cxx b/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.cxx index e8fffa426..18eb314cf 100644 --- a/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.cxx @@ -79,10 +79,8 @@ SMESHGUI_FilterLibraryDlg::Dialog::~Dialog() bool SMESHGUI_FilterLibraryDlg::Dialog::acceptData() { -#ifdef NEW_GUI - if (mode() != QFileDialogP::AnyFile) - return SUIT_FileDlg::acceptData(); -#endif +// if (mode() != QFileDialogP::AnyFile) +// return SUIT_FileDlg::acceptData(); return true; } @@ -96,12 +94,14 @@ bool SMESHGUI_FilterLibraryDlg::Dialog::acceptData() // name : SMESHGUI_FilterLibraryDlg::SMESHGUI_FilterLibraryDlg // Purpose : Constructor //======================================================================= -SMESHGUI_FilterLibraryDlg::SMESHGUI_FilterLibraryDlg (QWidget* theParent, +SMESHGUI_FilterLibraryDlg::SMESHGUI_FilterLibraryDlg (SMESHGUI* theModule, + QWidget* parent, const QValueList& theTypes, const int theMode, const char* theName) - : QDialog(theParent, theName, true, WStyle_Customize | - WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) + : QDialog( parent, theName, true, WStyle_Customize | + WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ), + mySMESHGUI( theModule ) { construct(theTypes, theMode); } @@ -110,12 +110,14 @@ SMESHGUI_FilterLibraryDlg::SMESHGUI_FilterLibraryDlg (QWidget* the // name : SMESHGUI_FilterLibraryDlg::SMESHGUI_FilterLibraryDlg // Purpose : Constructor //======================================================================= -SMESHGUI_FilterLibraryDlg::SMESHGUI_FilterLibraryDlg (QWidget* theParent, +SMESHGUI_FilterLibraryDlg::SMESHGUI_FilterLibraryDlg (SMESHGUI* theModule, + QWidget* parent, const int theType, const int theMode, const char* theName) - : QDialog(theParent, theName, true, WStyle_Customize | - WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) + : QDialog( parent, theName, true, WStyle_Customize | + WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ), + mySMESHGUI( theModule ) { QValueList aTypes; aTypes.append(theType); @@ -192,7 +194,7 @@ QFrame* SMESHGUI_FilterLibraryDlg::createMainFrame (QWidget* theParent) // table - myTable = new SMESHGUI_FilterTable(aMainFrame, myTypes); + myTable = new SMESHGUI_FilterTable( mySMESHGUI, aMainFrame, myTypes); myTable->SetEditable(myMode == EDIT); myTable->SetLibsEnabled(false); @@ -312,10 +314,8 @@ void SMESHGUI_FilterLibraryDlg::Init (const QValueList& theTypes, updateControlsVisibility(); setEnabled(true); - SMESHGUI* aModeler = SMESHGUI::GetSMESHGUI(); - - connect(aModeler, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate())); - connect(aModeler, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose())); + connect( mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate())); + connect( mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose())); if (myMode == ADD_TO) { @@ -344,7 +344,7 @@ void SMESHGUI_FilterLibraryDlg::Init (const QValueList& theTypes, } int x, y; - aModeler->DefineDlgPosition(this, x, y); + mySMESHGUI->DefineDlgPosition(this, x, y); this->move(x, y); this->show(); @@ -448,8 +448,8 @@ void SMESHGUI_FilterLibraryDlg::onOk() { if (onApply()) { - disconnect(SMESHGUI::GetSMESHGUI(), 0, this, 0); - SMESHGUI::GetSMESHGUI()->ResetState(); + disconnect( mySMESHGUI, 0, this, 0); + mySMESHGUI->ResetState(); accept(); } } @@ -460,8 +460,8 @@ void SMESHGUI_FilterLibraryDlg::onOk() //======================================================================= void SMESHGUI_FilterLibraryDlg::onClose() { - disconnect(SMESHGUI::GetSMESHGUI(), 0, this, 0); - SMESHGUI::GetSMESHGUI()->ResetState(); + disconnect( mySMESHGUI, 0, this, 0); + mySMESHGUI->ResetState(); reject(); } diff --git a/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.h b/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.h index 88b52661c..8fbc6f998 100644 --- a/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.h +++ b/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.h @@ -64,12 +64,14 @@ public: public: - SMESHGUI_FilterLibraryDlg( QWidget* parent, + SMESHGUI_FilterLibraryDlg( SMESHGUI*, + QWidget*, const QValueList& types, const int mode, const char* name = 0 ); - SMESHGUI_FilterLibraryDlg( QWidget* parent, + SMESHGUI_FilterLibraryDlg( SMESHGUI*, + QWidget*, const int type, const int mode, const char* name = 0 ); @@ -141,6 +143,7 @@ private: QPushButton* myDeleteBtn; QGroupBox* myNameGrp; QLineEdit* myName; + SMESHGUI* mySMESHGUI; QValueList myTypes; int myMode; diff --git a/src/SMESHGUI/SMESHGUI_FilterUtils.cxx b/src/SMESHGUI/SMESHGUI_FilterUtils.cxx index f02434220..360d00486 100644 --- a/src/SMESHGUI/SMESHGUI_FilterUtils.cxx +++ b/src/SMESHGUI/SMESHGUI_FilterUtils.cxx @@ -26,6 +26,10 @@ namespace SMESH { SMESH::FilterManager_var GetFilterManager() { - return SMESHGUI::GetSMESHGen()->CreateFilterManager(); // DumpPython + static SMESH::FilterManager_var aFilterManager; + if (CORBA::is_nil(aFilterManager)){ + aFilterManager = SMESHGUI::GetSMESHGen()->CreateFilterManager(); + } + return aFilterManager; } } diff --git a/src/SMESHGUI/SMESHGUI_GroupDlg.cxx b/src/SMESHGUI/SMESHGUI_GroupDlg.cxx index 5f7b9da9d..5ec1935cd 100644 --- a/src/SMESHGUI/SMESHGUI_GroupDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_GroupDlg.cxx @@ -90,7 +90,8 @@ SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( SMESHGUI* theModule, const char* name, mySMESHGUI( theModule ), mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), myViewWindow( SMESH::GetViewWindow( theModule ) ), - mySelector( myViewWindow->GetSelector() ) + mySelector( myViewWindow->GetSelector() ), + myIsBusy( false ) { if (!name) setName("SMESHGUI_GroupDlg"); initDialog(true); @@ -120,7 +121,8 @@ SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( SMESHGUI* theModule, const char* name, mySMESHGUI( theModule ), mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), myViewWindow( SMESH::GetViewWindow( theModule ) ), - mySelector( myViewWindow->GetSelector() ) + mySelector( myViewWindow->GetSelector() ), + myIsBusy( false ) { if (!name) setName("SMESHGUI_GroupDlg"); initDialog(false); @@ -396,6 +398,8 @@ SMESHGUI_GroupDlg::~SMESHGUI_GroupDlg() //================================================================================= void SMESHGUI_GroupDlg::init (SMESH::SMESH_Mesh_ptr theMesh) { + mySelectionMgr->installFilter(myMeshFilter); + /* init data from current selection */ myMesh = SMESH::SMESH_Mesh::_duplicate(theMesh); myGroup = SMESH::SMESH_Group::_nil(); @@ -403,11 +407,14 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_Mesh_ptr theMesh) myActor = SMESH::FindActorByObject(myMesh); SMESH::SetPickable(myActor); - const SALOME_ListIO& aList = mySelector->StoredIObjects(); - - QString aName = aList.First()->getName(); - myMeshGroupLine->setText(aName) ; - myMeshGroupLine->home( false ); + SALOME_ListIO aList; + mySelectionMgr->selectedObjects( aList ); + if( !aList.IsEmpty() ) + { + QString aName = aList.First()->getName(); + myMeshGroupLine->setText(aName) ; + myMeshGroupLine->home( false ); + } myCurrentLineEdit = 0; @@ -675,7 +682,6 @@ void SMESHGUI_GroupDlg::onOK() onClose(); } -static bool busy = false; //================================================================================= // function : onListSelectionChanged() // purpose : Called when selection in element list is changed @@ -683,8 +689,8 @@ static bool busy = false; void SMESHGUI_GroupDlg::onListSelectionChanged() { // MESSAGE("SMESHGUI_GroupDlg::onListSelectionChanged(); myActor = " << myActor); - if (busy || !myActor) return; - busy = true; + if( myIsBusy || !myActor) return; + myIsBusy = true; if (myCurrentLineEdit == 0) { mySelectionMgr->clearSelected(); @@ -702,7 +708,7 @@ void SMESHGUI_GroupDlg::onListSelectionChanged() mySelectionMgr->setSelectedObjects(aList,false); myViewWindow->highlight( myActor->getIO(), true, true ); } - busy = false; + myIsBusy = false; } //================================================================================= @@ -711,11 +717,12 @@ void SMESHGUI_GroupDlg::onListSelectionChanged() //================================================================================= void SMESHGUI_GroupDlg::onObjectSelectionChanged() { - if (busy || !isEnabled()) return; - busy = true; - - const SALOME_ListIO& aList = mySelector->StoredIObjects(); + if ( myIsBusy || !isEnabled()) return; + myIsBusy = true; + SALOME_ListIO aList; + mySelectionMgr->selectedObjects( aList ); + int aNbSel = aList.Extent(); myElements->clearSelection(); @@ -737,10 +744,10 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged() myElements->clear(); - if (aNbSel != 1) { + if (aNbSel == 0 ) { myGroup = SMESH::SMESH_Group::_nil(); myMesh = SMESH::SMESH_Mesh::_nil(); - busy = false; + myIsBusy = false; return; } Handle(SALOME_InteractiveObject) IO = aList.First(); @@ -749,7 +756,7 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged() myMesh = SMESH::IObjectToInterface(IO); if (myMesh->_is_nil()) { - busy = false; + myIsBusy = false; return; } myGroup = SMESH::SMESH_Group::_nil(); @@ -770,25 +777,22 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged() SMESH::SMESH_Group_var aGroup = SMESH::IObjectToInterface(IO); if (aGroup->_is_nil()) { - busy = false; + myIsBusy = false; return; } - busy = false; + myIsBusy = false; myCurrentLineEdit = 0; init(aGroup); - busy = true; + myIsBusy = true; mySelectSubMesh->setEnabled(true); mySelectGroup->setEnabled(true); myGeomGroupBtn->setEnabled(true); myGeomGroupLine->setEnabled(true); } myCurrentLineEdit = 0; - busy = false; + myIsBusy = false; if (!myCreate) - { - busy = false; return; - } if (myTypeId == -1) onTypeChanged(0); @@ -797,13 +801,13 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged() setSelectionMode(myTypeId); } - busy = false; + myIsBusy = false; return; } else if (myCurrentLineEdit == myGeomGroupLine) { - if (aNbSel != 1) { + if (aNbSel == 0) { myGeomGroup = GEOM::GEOM_Object::_nil(); - busy = false; + myIsBusy = false; return; } @@ -813,7 +817,7 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged() // Check if the object is a geometry group if (!testResult || CORBA::is_nil(myGeomGroup)) { myGeomGroup = GEOM::GEOM_Object::_nil(); - busy = false; + myIsBusy = false; return; } // Check if group constructed on the same shape as a mesh or on its child @@ -835,7 +839,7 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged() _PTR(SObject) aMeshSO = SMESH::FindSObject(myMesh); if (!aMeshSO) { myGeomGroup = GEOM::GEOM_Object::_nil(); - busy = false; + myIsBusy = false; return; } _PTR(SObject) anObj, aRef; @@ -859,16 +863,16 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged() } if (!isRefOrSubShape) { myGeomGroup = GEOM::GEOM_Object::_nil(); - busy = false; + myIsBusy = false; return; } } - if (aNbSel >= 1) { - if (aNbSel > 1) { - if (myCurrentLineEdit == mySubMeshLine) + if(aNbSel >= 1) { + if(aNbSel > 1) { + if(myCurrentLineEdit == mySubMeshLine) aString = tr("SMESH_SUBMESH_SELECTED").arg(aNbSel); - else if (myCurrentLineEdit == myGroupLine || myCurrentLineEdit == myGeomGroupLine) + else if(myCurrentLineEdit == myGroupLine || myCurrentLineEdit == myGeomGroupLine) aString = tr("SMESH_GROUP_SELECTED").arg(aNbSel); } else { aString = aList.First()->getName(); @@ -907,7 +911,7 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged() myActor = SMESH::FindActorByObject(myMesh); } - busy = false; + myIsBusy = false; } //================================================================================= @@ -1070,12 +1074,14 @@ void SMESHGUI_GroupDlg::onFilterAccepted() //================================================================================= void SMESHGUI_GroupDlg::onAdd() { - const SALOME_ListIO& aList = mySelector->StoredIObjects(); + SALOME_ListIO aList; + mySelectionMgr->selectedObjects( aList ); + int aNbSel = aList.Extent(); if (aNbSel == 0 || !myActor || myMesh->_is_nil()) return; - busy = true; + myIsBusy = true; SMESH::ElementType aType = SMESH::ALL; switch(myTypeId) { @@ -1086,7 +1092,7 @@ void SMESHGUI_GroupDlg::onAdd() } if (myCurrentLineEdit == 0) { - //if (aNbSel != 1) { busy = false; return; } + //if (aNbSel != 1) { myIsBusy = false; return; } QString aListStr = ""; int aNbItems = 0; if (myTypeId == 0) { @@ -1109,7 +1115,10 @@ void SMESHGUI_GroupDlg::onAdd() } } else if (myCurrentLineEdit == mySubMeshLine) { //SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects()); - const SALOME_ListIO& aList = mySelector->StoredIObjects(); + + SALOME_ListIO aList; + mySelectionMgr->selectedObjects( aList ); + SALOME_ListIteratorOfListIO anIt (aList); for (; anIt.More(); anIt.Next()) { SMESH::SMESH_subMesh_var aSubMesh = @@ -1138,12 +1147,14 @@ void SMESHGUI_GroupDlg::onAdd() } } mySelectSubMesh->setChecked(false); - busy = false; + myIsBusy = false; onListSelectionChanged(); } else if (myCurrentLineEdit == myGroupLine) { //SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects()); - const SALOME_ListIO& aList = mySelector->StoredIObjects(); + SALOME_ListIO aList; + mySelectionMgr->selectedObjects( aList ); + SALOME_ListIteratorOfListIO anIt (aList); for (; anIt.More(); anIt.Next()) { SMESH::SMESH_Group_var aGroup = @@ -1167,7 +1178,7 @@ void SMESHGUI_GroupDlg::onAdd() } } mySelectGroup->setChecked(false); - busy = false; + myIsBusy = false; onListSelectionChanged(); } else if (myCurrentLineEdit == myGeomGroupLine && !CORBA::is_nil(myGeomGroup)) { @@ -1181,7 +1192,7 @@ void SMESHGUI_GroupDlg::onAdd() case 6: aGroupType = SMESH::EDGE; break; case 4: aGroupType = SMESH::FACE; break; case 2: aGroupType = SMESH::VOLUME; break; - default: busy = false; return; + default: myIsBusy = false; return; } if (aGroupType == aType) { @@ -1213,10 +1224,10 @@ void SMESHGUI_GroupDlg::onAdd() } //VSR: mySelectGeomGroup->setChecked(false); - busy = false; + myIsBusy = false; onListSelectionChanged(); } - busy = false; + myIsBusy = false; // mySelectionMgr->clearSelected(); updateButtons(); } @@ -1227,7 +1238,7 @@ void SMESHGUI_GroupDlg::onAdd() //================================================================================= void SMESHGUI_GroupDlg::onRemove() { - busy = true; + myIsBusy = true; if (myCurrentLineEdit == 0) { for (int i = myElements->count(); i > 0; i--) { if (myElements->isSelected(i-1)) { @@ -1235,10 +1246,12 @@ void SMESHGUI_GroupDlg::onRemove() } } } else { - const SALOME_ListIO& aList = mySelector->StoredIObjects(); + SALOME_ListIO aList; + mySelectionMgr->selectedObjects( aList ); + int aNbSel = aList.Extent(); - if (aNbSel == 0) { busy = false; return; } + if (aNbSel == 0) { myIsBusy = false; return; } SMESH::ElementType aType = SMESH::ALL; switch(myTypeId) { @@ -1250,7 +1263,9 @@ void SMESHGUI_GroupDlg::onRemove() if (myCurrentLineEdit == mySubMeshLine) { //SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects()); - const SALOME_ListIO& aList = mySelector->StoredIObjects(); + SALOME_ListIO aList; + mySelectionMgr->selectedObjects( aList ); + SALOME_ListIteratorOfListIO anIt (aList); for (; anIt.More(); anIt.Next()) { SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface(anIt.Value()); @@ -1292,7 +1307,9 @@ void SMESHGUI_GroupDlg::onRemove() else if (myCurrentLineEdit == myGroupLine) { Standard_Boolean aRes; //SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects()); - const SALOME_ListIO& aList = mySelector->StoredIObjects(); + SALOME_ListIO aList; + mySelectionMgr->selectedObjects( aList ); + SALOME_ListIteratorOfListIO anIt (aList); for (; anIt.More(); anIt.Next()) { SMESH::SMESH_Group_var aGroup = SMESH::IObjectToInterface(anIt.Value()); @@ -1311,7 +1328,7 @@ void SMESHGUI_GroupDlg::onRemove() } } } - busy = false; + myIsBusy = false; updateButtons(); } @@ -1326,7 +1343,7 @@ void SMESHGUI_GroupDlg::onSort() // myElements->update(); int i, k = myElements->count(); if (k > 0) { - busy = true; + myIsBusy = true; QStringList aSelected; std::vector anArray(k); // QMemArray anArray(k); @@ -1348,7 +1365,7 @@ void SMESHGUI_GroupDlg::onSort() anItem = myElements->findItem(*it, Qt::ExactMatch); if (anItem) myElements->setSelected(anItem, true); } - busy = false; + myIsBusy = false; } } diff --git a/src/SMESHGUI/SMESHGUI_GroupDlg.h b/src/SMESHGUI/SMESHGUI_GroupDlg.h index 797c084ca..c01482e97 100644 --- a/src/SMESHGUI/SMESHGUI_GroupDlg.h +++ b/src/SMESHGUI/SMESHGUI_GroupDlg.h @@ -161,7 +161,7 @@ private: SMESHGUI_FilterDlg* myFilterDlg; - bool myCreate; + bool myCreate, myIsBusy; }; #endif // DIALOGBOX_GROUP_H diff --git a/src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx b/src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx index fba4f187f..b719ffeab 100644 --- a/src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx @@ -270,7 +270,7 @@ void SMESHGUI_MoveNodesDlg::reset() //======================================================================= bool SMESHGUI_MoveNodesDlg::onApply() { - if (SMESHGUI::GetSMESHGUI()->isActiveStudyLocked()) + if (mySMESHGUI->isActiveStudyLocked()) return false; if (!isValid(true)) @@ -323,7 +323,7 @@ void SMESHGUI_MoveNodesDlg::onClose() { mySelectionMgr->clearSelected(); SMESH::SetPointRepresentation(false); - mySelector->SetSelectionMode(ActorSelection); + myViewWindow->SetSelectionMode(ActorSelection); disconnect(mySelectionMgr, 0, this, 0); disconnect(mySMESHGUI, 0, this, 0); mySMESHGUI->ResetState(); @@ -417,7 +417,7 @@ void SMESHGUI_MoveNodesDlg::onDeactivate() void SMESHGUI_MoveNodesDlg::enterEvent (QEvent*) { if (!isEnabled()) { - SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog(); + mySMESHGUI->EmitSignalDeactivateDialog(); // set selection mode SMESH::SetPointRepresentation(true); diff --git a/src/SMESHGUI/SMESHGUI_NodesDlg.cxx b/src/SMESHGUI/SMESHGUI_NodesDlg.cxx index a3f0966ff..69801bb65 100644 --- a/src/SMESHGUI/SMESHGUI_NodesDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_NodesDlg.cxx @@ -46,15 +46,16 @@ #include "SUIT_ViewWindow.h" #include "SUIT_ViewManager.h" #include "SUIT_MessageBox.h" +#include "SUIT_Desktop.h" #include "SalomeApp_Study.h" -#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" +#include "SVTK_Selector.h" #include "SVTK_ViewWindow.h" #include "SALOME_Actor.h" #include "SALOME_ListIO.hxx" -#include "SVTK_Selection.h" #include "utilities.h" @@ -113,23 +114,16 @@ namespace SMESH { } class TNodeSimulation { - SalomeApp_Application* myApplication; - SUIT_ViewWindow* myViewWindow; - SVTK_ViewWindow* myVTKViewWindow; + SVTK_ViewWindow* myViewWindow; SALOME_Actor *myPreviewActor; vtkDataSetMapper* myMapper; vtkPoints* myPoints; public: - TNodeSimulation (SalomeApp_Application* theApplication) + TNodeSimulation(SVTK_ViewWindow* theViewWindow): + myViewWindow(theViewWindow) { - myApplication = theApplication; - SUIT_ViewManager* mgr = theApplication->activeViewManager(); - if (!mgr) return; - myViewWindow = mgr->getActiveView(); - myVTKViewWindow = GetVtkViewWindow(myViewWindow); - vtkUnstructuredGrid* aGrid = vtkUnstructuredGrid::New(); // Create points @@ -195,7 +189,7 @@ namespace SMESH { myPreviewActor->SetProperty(aProp); aProp->Delete(); - myVTKViewWindow->AddActor(myPreviewActor); + myViewWindow->AddActor(myPreviewActor); } void SetPosition (float x, float y, float z) @@ -213,9 +207,7 @@ namespace SMESH { ~TNodeSimulation() { - if (FindVtkViewWindow(myApplication->activeViewManager(), myViewWindow)) { - myVTKViewWindow->RemoveActor(myPreviewActor); - } + myViewWindow->RemoveActor(myPreviewActor); myPreviewActor->Delete(); myMapper->RemoveAllInputs(); @@ -230,17 +222,20 @@ namespace SMESH { // class : SMESHGUI_NodesDlg() // purpose : //================================================================================= -SMESHGUI_NodesDlg::SMESHGUI_NodesDlg (QWidget* parent, +SMESHGUI_NodesDlg::SMESHGUI_NodesDlg (SMESHGUI* theModule, const char* name, - SalomeApp_SelectionMgr* Sel, bool modal, - WFlags fl) - : QDialog(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | - WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose) + WFlags fl): + QDialog(SMESH::GetDesktop(theModule), + name, + modal, + WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose), + mySelector(SMESH::GetViewWindow(theModule)->GetSelector()), + mySelectionMgr(SMESH::GetSelectionMgr(theModule)), + myViewWindow(SMESH::GetViewWindow(theModule)), + mySMESHGUI(theModule) { - SalomeApp_Application* anApp = dynamic_cast - (SUIT_Session::session()->activeApplication()); - mySimulation = new SMESH::TNodeSimulation (anApp); + mySimulation = new SMESH::TNodeSimulation(myViewWindow); QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_DLG_NODE"))); if (!name) @@ -333,7 +328,7 @@ SMESHGUI_NodesDlg::SMESHGUI_NodesDlg (QWidget* parent, SMESHGUI_NodesDlgLayout->addWidget(GroupCoordinates, 1, 0); /* Initialisation and display */ - Init(Sel); + Init(); } //======================================================================= @@ -349,7 +344,7 @@ SMESHGUI_NodesDlg::~SMESHGUI_NodesDlg() // function : Init() // purpose : //================================================================================= -void SMESHGUI_NodesDlg::Init (SalomeApp_SelectionMgr* Sel) +void SMESHGUI_NodesDlg::Init () { /* Get setting of step value from file configuration */ double step; @@ -365,9 +360,7 @@ void SMESHGUI_NodesDlg::Init (SalomeApp_SelectionMgr* Sel) SpinBox_Y->SetValue(0.0); SpinBox_Z->SetValue(0.0); - mySelectionMgr = Sel; - myMeshGUI = SMESHGUI::GetSMESHGUI(); - myMeshGUI->SetActiveDialogBox((QDialog*)this); + mySMESHGUI->SetActiveDialogBox((QDialog*)this); /* signals and slots connections */ connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); @@ -379,23 +372,19 @@ void SMESHGUI_NodesDlg::Init (SalomeApp_SelectionMgr* Sel) connect(SpinBox_Z, SIGNAL (valueChanged(double)), SLOT(ValueChangedInSpinBox(double))); connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(SelectionIntoArgument())); - connect(myMeshGUI, SIGNAL (SignalDeactivateActiveDialog()), SLOT(DeactivateActiveDialog())); + connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), SLOT(DeactivateActiveDialog())); /* to close dialog if study frame change */ - connect(myMeshGUI, SIGNAL (SignalStudyFrameChanged()), SLOT(ClickOnCancel())); + connect(mySMESHGUI, SIGNAL (SignalStudyFrameChanged()), SLOT(ClickOnCancel())); /* Move widget on the botton right corner of main widget */ int x, y; - myMeshGUI->DefineDlgPosition(this, x, y); + mySMESHGUI->DefineDlgPosition(this, x, y); this->move(x, y); this->show(); // set selection mode SMESH::SetPointRepresentation(true); -#ifdef NEW_GUI - mySelectionMgr->setSelectionModes(NodeSelection, true); -#else - mySelectionMgr->setSelectionModes(NodeSelection); -#endif + myViewWindow->SetSelectionMode(NodeSelection); SelectionIntoArgument(); } @@ -431,7 +420,7 @@ void SMESHGUI_NodesDlg::ClickOnOk() //================================================================================= bool SMESHGUI_NodesDlg::ClickOnApply() { - if (myMeshGUI->isActiveStudyLocked()) + if (mySMESHGUI->isActiveStudyLocked()) return false; if (myMesh->_is_nil()) { @@ -460,14 +449,9 @@ bool SMESHGUI_NodesDlg::ClickOnApply() if (anActor->hasIO()) { if (SMESH_MeshObj *aMeshObj = dynamic_cast(anActor->GetObject().get())) { if (myMesh->_is_equivalent(aMeshObj->GetMeshServer())) { -#ifdef NEW_GUI - mySelectionMgr->clearSelected(); - mySelectionMgr->AddIObject(anActor->getIO(), false); -#else aList.Clear(); aList.Append(anActor->getIO()); mySelectionMgr->setSelectedObjects(aList, false); -#endif break; } } @@ -485,18 +469,14 @@ bool SMESHGUI_NodesDlg::ClickOnApply() //================================================================================= void SMESHGUI_NodesDlg::ClickOnCancel() { - MESSAGE("SMESHGUI_NodesDlg::ClickOnCancel() 1"); disconnect(mySelectionMgr, 0, this, 0); - mySelectionMgr->clearSelected(); - mySelectionMgr->setSelectionModes(ActorSelection); + myViewWindow->SetSelectionMode(ActorSelection); - MESSAGE("SMESHGUI_NodesDlg::ClickOnCancel() 2"); mySimulation->SetVisibility(false); SMESH::SetPointRepresentation(false); - myMeshGUI->ResetState(); + mySMESHGUI->ResetState(); reject(); - MESSAGE("SMESHGUI_NodesDlg::ClickOnCancel() 3"); } //================================================================================= @@ -511,15 +491,14 @@ void SMESHGUI_NodesDlg::SelectionIntoArgument() mySimulation->SetVisibility(false); SMESH::SetPointRepresentation(true); - SALOME_ListIO aList; - mySelectionMgr->selectedObjects(aList); + const SALOME_ListIO& aList = mySelector->StoredIObjects(); if (aList.Extent() == 1) { Handle(SALOME_InteractiveObject) anIO = aList.First(); if (anIO->hasEntry()) { myMesh = SMESH::GetMeshByIO(anIO); if (myMesh->_is_nil()) return; QString aText; - if (SMESH::GetNameOfSelectedNodes(mySelectionMgr, aText) == 1) { + if (SMESH::GetNameOfSelectedNodes(mySelector,anIO,aText) == 1) { if (SMESH_Actor* anActor = SMESH::FindActorByObject(myMesh.in())) { if (SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh()) { if (const SMDS_MeshNode* aNode = aMesh->FindNode(aText.toInt())) { @@ -577,8 +556,8 @@ void SMESHGUI_NodesDlg::DeactivateActiveDialog() GroupCoordinates->setEnabled(false); GroupButtons->setEnabled(false); mySimulation->SetVisibility(false); - myMeshGUI->ResetState(); - myMeshGUI->SetActiveDialogBox(0); + mySMESHGUI->ResetState(); + mySMESHGUI->SetActiveDialogBox(0); } } @@ -588,17 +567,13 @@ void SMESHGUI_NodesDlg::DeactivateActiveDialog() //================================================================================= void SMESHGUI_NodesDlg::ActivateThisDialog() { - myMeshGUI->EmitSignalDeactivateDialog(); + mySMESHGUI->EmitSignalDeactivateDialog(); GroupConstructors->setEnabled(true); GroupCoordinates->setEnabled(true); GroupButtons->setEnabled(true); SMESH::SetPointRepresentation(true); -#ifdef NEW_GUI - mySelectionMgr->setSelectionModes(NodeSelection, true); -#else - mySelectionMgr->setSelectionModes(NodeSelection); -#endif + myViewWindow->SetSelectionMode(NodeSelection); SelectionIntoArgument(); } diff --git a/src/SMESHGUI/SMESHGUI_NodesDlg.h b/src/SMESHGUI/SMESHGUI_NodesDlg.h index 50e84b155..0a64f964f 100644 --- a/src/SMESHGUI/SMESHGUI_NodesDlg.h +++ b/src/SMESHGUI/SMESHGUI_NodesDlg.h @@ -29,8 +29,6 @@ #ifndef DIALOGBOX_NODES_H #define DIALOGBOX_NODES_H -#include "SalomeApp_SelectionMgr.h" - #include #include @@ -44,8 +42,12 @@ class QLabel; class QLineEdit; class QPushButton; class QRadioButton; + class SMESHGUI; +class SVTK_Selector; +class SVTK_ViewWindow; class SMESHGUI_SpinBox; +class SalomeApp_SelectionMgr; namespace SMESH{ struct TNodeSimulation; @@ -64,22 +66,23 @@ class SMESHGUI_NodesDlg : public QDialog Q_OBJECT public: - SMESHGUI_NodesDlg (QWidget* parent = 0, const char* name = 0, - SalomeApp_SelectionMgr* Sel = 0, + SMESHGUI_NodesDlg (SMESHGUI* theModule, + const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~SMESHGUI_NodesDlg(); private: - SalomeApp_SelectionMgr* mySelectionMgr; - SMESHGUI* myMeshGUI; + SVTK_ViewWindow* myViewWindow; + SVTK_Selector* mySelector; + SMESHGUI* mySMESHGUI; SMESH::SMESH_Mesh_var myMesh; SMESH::TNodeSimulation* mySimulation; - void Init (SalomeApp_SelectionMgr*); + void Init (); void enterEvent(QEvent* e); void closeEvent(QCloseEvent*); void hideEvent (QHideEvent *); /* ESC key */ diff --git a/src/SMESHGUI/SMESHGUI_Selection.cxx b/src/SMESHGUI/SMESHGUI_Selection.cxx index 73f961bea..eb48d8144 100644 --- a/src/SMESHGUI/SMESHGUI_Selection.cxx +++ b/src/SMESHGUI/SMESHGUI_Selection.cxx @@ -24,18 +24,30 @@ //function : SMESHGUI_Selection //purpose : //======================================================================= +SMESHGUI_Selection::SMESHGUI_Selection() +: SalomeApp_Selection() +{ +} + +//======================================================================= +//function : ~SMESHGUI_Selection +//purpose : +//======================================================================= +SMESHGUI_Selection::~SMESHGUI_Selection() +{ +} -SMESHGUI_Selection::SMESHGUI_Selection( const QString& client, - SalomeApp_SelectionMgr* mgr ) +//======================================================================= +//function : init +//purpose : +//======================================================================= +void SMESHGUI_Selection::init( const QString& client, SalomeApp_SelectionMgr* mgr ) { - myPopupClient = client; - - SalomeApp_Study* appStudy = dynamic_cast - (SUIT_Session::session()->activeApplication()->activeStudy()); + SalomeApp_Selection::init( client, mgr ); - if( mgr && appStudy ) + if( mgr && study() ) { - _PTR(Study) study = appStudy->studyDS(); + _PTR(Study) aStudy = study()->studyDS(); SUIT_DataOwnerPtrList sel; mgr->selected( sel, client ); @@ -47,36 +59,21 @@ SMESHGUI_Selection::SMESHGUI_Selection( const QString& client, SUIT_DataOwner* owner = ( SUIT_DataOwner* )( (*anIt ).get() ); SalomeApp_DataOwner* sowner = dynamic_cast( owner ); if( sowner ) - myTypes.append( typeName( type( sowner, study ) ) ); + myTypes.append( typeName( type( sowner, aStudy ) ) ); else myTypes.append( "Unknown" ); } } } -SMESHGUI_Selection::~SMESHGUI_Selection() -{ -} - -//======================================================================= -//function : count -//purpose : -//======================================================================= - -int SMESHGUI_Selection::count() const -{ - return myTypes.count(); -} - //======================================================================= //function : param //purpose : //======================================================================= - QtxValue SMESHGUI_Selection::param( const int ind, const QString& p ) const { QtxValue val; - if ( p=="client" ) val = QtxValue( myPopupClient ); + if ( p=="client" ) val = QtxValue( globalParam( p ) ); else if ( p=="type" ) val = QtxValue( myTypes[ind] ); else if ( p=="elemTypes" ) val = QtxValue( elemTypes( ind ) ); else if ( p=="numberOfNodes" ) val = QtxValue( numberOfNodes( ind ) ); @@ -89,9 +86,9 @@ QtxValue SMESHGUI_Selection::param( const int ind, const QString& p ) const else if ( p=="hasReference" ) val = QtxValue( hasReference( ind ) ); else if ( p=="isVisible" ) val = QtxValue( isVisible( ind ) ); - printf( "--> param() : [%s] = %s (%s)\n", p.latin1(), val.toString().latin1(), val.typeName() ); - if ( val.type() == QVariant::List ) - cout << "size: " << val.toList().count() << endl; +// printf( "--> param() : [%s] = %s (%s)\n", p.latin1(), val.toString().latin1(), val.typeName() ); +// if ( val.type() == QVariant::List ) +// cout << "size: " << val.toList().count() << endl; return val; } diff --git a/src/SMESHGUI/SMESHGUI_Selection.h b/src/SMESHGUI/SMESHGUI_Selection.h index 20e13f9bb..7137ebaef 100644 --- a/src/SMESHGUI/SMESHGUI_Selection.h +++ b/src/SMESHGUI/SMESHGUI_Selection.h @@ -29,8 +29,7 @@ #ifndef SMESHGUI_SELECTION_HeaderFile #define SMESHGUI_SELECTION_HeaderFile -#include - +#include "SalomeApp_Selection.h" #include "SALOMEDSClient_definitions.hxx" #include "SUIT_DataOwner.h" @@ -39,16 +38,15 @@ class SALOMEDSClient_Study; class SalomeApp_DataOwner; class SMESH_Actor; -class SMESHGUI_Selection : public QtxPopupMgr::Selection +class SMESHGUI_Selection : public SalomeApp_Selection { public: - SMESHGUI_Selection( const QString&, SalomeApp_SelectionMgr* ); + SMESHGUI_Selection(); virtual ~SMESHGUI_Selection(); + virtual void init( const QString&, SalomeApp_SelectionMgr* ); virtual QtxValue param( const int , const QString& paramName ) const; - virtual int count() const; - // got from object, not from actor virtual int numberOfNodes( int ind ) const; virtual QVariant isComputable( int ind ) const; @@ -69,7 +67,6 @@ public: static QString typeName( const int type); private: - QString myPopupClient; QStringList myTypes; SUIT_DataOwnerPtrList myDataOwners; }; -- 2.30.2