From 0720a82c17a50b96fdf7215cd38c0e4dbfb1172a Mon Sep 17 00:00:00 2001 From: jfa Date: Mon, 27 Jun 2005 04:55:39 +0000 Subject: [PATCH] Improve Selection dialog behaviour --- src/VISUGUI/VisuGUI_Selection.cxx | 32 ++++--------------------------- 1 file changed, 4 insertions(+), 28 deletions(-) diff --git a/src/VISUGUI/VisuGUI_Selection.cxx b/src/VISUGUI/VisuGUI_Selection.cxx index e31fe508..1f814946 100644 --- a/src/VISUGUI/VisuGUI_Selection.cxx +++ b/src/VISUGUI/VisuGUI_Selection.cxx @@ -88,7 +88,6 @@ using namespace std; -//extern VisuGUI *visuGUI; static VisuGUI_SelectionDlg* mySelectionDlg = NULL; VisuGUI_SelectionDlg::VisuGUI_SelectionDlg (QWidget* parent) @@ -96,7 +95,6 @@ VisuGUI_SelectionDlg::VisuGUI_SelectionDlg (QWidget* parent) WStyle_Title | WStyle_SysMenu | WDestructiveClose), mySelectionMgr(NULL) { - //MESSAGE("VisuGUI_SelectionDlg::VisuGUI_SelectionDlg()"); if (mySelectionDlg) mySelectionDlg->close(true); @@ -273,30 +271,25 @@ VisuGUI_SelectionDlg::VisuGUI_SelectionDlg (QWidget* parent) VisuGUI_SelectionDlg::~VisuGUI_SelectionDlg() { - //MESSAGE("VisuGUI_SelectionDlg::~VisuGUI_SelectionDlg()"); } void VisuGUI_SelectionDlg::onSelectionChange (int theId) { - //MESSAGE("VisuGUI_SelectionDlg::onSelectionChange()"); SVTK_ViewWindow* aSVTKVW = VISU::GetViewWindow(); switch (theId) { case 0: // Points myWidgetStack->raiseWidget(myPointsPane); - //mySelectionMgr->setSelectionModes(NodeSelection); aSVTKVW->SetSelectionMode(NodeSelection); onPointIdEdit(myIDValLbl->text()); break; case 1: // Cells myWidgetStack->raiseWidget(myCellsPane); - //mySelectionMgr->setSelectionModes(CellSelection); aSVTKVW->SetSelectionMode(CellSelection); onCellIdEdit(myCellIDValLbl->text()); break; case 2: // Actor myWidgetStack->raiseWidget(myActorsPane); - //mySelectionMgr->setSelectionModes(ActorSelection); aSVTKVW->SetSelectionMode(ActorSelection); onSelectionEvent(); } @@ -305,11 +298,9 @@ void VisuGUI_SelectionDlg::onSelectionChange (int theId) void VisuGUI_SelectionDlg::closeEvent (QCloseEvent* theEvent) { - //MESSAGE("VisuGUI_SelectionDlg::closeEvent()"); SVTK_ViewWindow* aSVTKVW = VISU::GetViewWindow(); mySelectionDlg = NULL; - //mySelectionMgr->setSelectionModes(ActorSelection); aSVTKVW->SetSelectionMode(ActorSelection); disconnect(mySelectionMgr,0,0,0); QDialog::closeEvent(theEvent); @@ -336,7 +327,6 @@ template QString getVector(TData* theData, int theId){ #define ABS(a) (a>=0)?a:-a void VisuGUI_SelectionDlg::onSelectionEvent() { - //MESSAGE("VisuGUI_SelectionDlg::onSelectionEvent()"); if (myFl) return; myFl = true; int aType = myWidgetStack->id(myWidgetStack->visibleWidget()); @@ -351,12 +341,9 @@ void VisuGUI_SelectionDlg::onSelectionEvent() { _PTR(SObject) aSObject; Handle(SALOME_InteractiveObject) anIO; - //SALOME_ListIO aListIO; - //mySelectionMgr->selectedObjects(aListIO, SVTK_Viewer::Type()); + SALOME_ListIO aListIO; + mySelectionMgr->selectedObjects(aListIO, SVTK_Viewer::Type()); - const SALOME_ListIO& aListIO = aSelector->StoredIObjects(); - - //MESSAGE("aListIO.Extent() = " << aListIO.Extent()); if (aListIO.Extent() == 1) { anIO = aListIO.First(); @@ -364,7 +351,6 @@ void VisuGUI_SelectionDlg::onSelectionEvent() { SalomeApp_Study* theStudy = dynamic_cast(anApp->activeStudy()); _PTR(Study) aStudy = theStudy->studyDS(); aSObject = aStudy->FindObjectID(anIO->getEntry()); - //MESSAGE("anIO->hasEntry(): " << anIO->getEntry()); if (aSObject) { CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObject); @@ -491,7 +477,6 @@ void VisuGUI_SelectionDlg::onSelectionEvent() { void VisuGUI_SelectionDlg::clearFields() { - //MESSAGE("VisuGUI_SelectionDlg::clearFields()"); int aType = myWidgetStack->id(myWidgetStack->visibleWidget()); switch (aType) { case 0: @@ -528,7 +513,6 @@ bool onIdEdit (const QString& theText, QString theValue, QLabel* theFieldName) { - //MESSAGE("onIdEdit()"); SalomeApp_Application* anApp = dynamic_cast (SUIT_Session::session()->activeApplication()); SVTK_ViewWindow* aSVTKVW = VISU::GetViewWindow(); @@ -537,10 +521,8 @@ bool onIdEdit (const QString& theText, VISU::Prs3d_i* aPrs3d = NULL; Handle(SALOME_InteractiveObject) anIO; - //SALOME_ListIO aListIO; - //theSelectionMgr->selectedObjects(aListIO, SVTK_Viewer::Type()); - - const SALOME_ListIO& aListIO = aSelector->StoredIObjects(); + SALOME_ListIO aListIO; + theSelectionMgr->selectedObjects(aListIO, SVTK_Viewer::Type()); if (aListIO.Extent() == 1) { anIO = aListIO.First(); @@ -571,10 +553,6 @@ bool onIdEdit (const QString& theText, if (anId < 0) anId = 0; if (anId >= aMaxId) anId = aMaxId - 1; - //SALOME_ListIO sel; - //sel.Append(anIO); - //theSelectionMgr->setSelectedObjects(sel); - TColStd_MapOfInteger newIndices; newIndices.Add(anId); aSelector->AddOrRemoveIndex(anIO, newIndices, false); @@ -591,7 +569,6 @@ bool onIdEdit (const QString& theText, void VisuGUI_SelectionDlg::onPointIdEdit (const QString& theText) { - //MESSAGE("onPointIdEdit()"); if (myFl) return; TDataSetMethod aMethod = &vtkDataSet::GetNumberOfPoints; bool anIsSelected = onIdEdit(theText,aMethod,false,mySelectionMgr, @@ -603,7 +580,6 @@ void VisuGUI_SelectionDlg::onPointIdEdit (const QString& theText) void VisuGUI_SelectionDlg::onCellIdEdit (const QString& theText) { - //MESSAGE("onCellIdEdit()"); if (myFl) return; TDataSetMethod aMethod = &vtkDataSet::GetNumberOfCells; bool anIsSelected = onIdEdit(theText,aMethod,true,mySelectionMgr, -- 2.39.2