From 4ebd749901bb521858b109a5b46e85c5c472ffc9 Mon Sep 17 00:00:00 2001 From: nds Date: Mon, 26 Dec 2016 16:46:11 +0300 Subject: [PATCH] Selection in Sketch with SHIFT pressed. Chain: processing mouse press, after by mouse release ShiftSelect happens in viewer. So, we should not change selected objects in the viewer until ShiftSelect. In previous version restoreSelection changed it. onAfterValuesChangedInPropertyPanel, onBeforeValuesChangedInPropertyPanel are obsolete as values in Property Panel are not modifiable. --- src/PartSet/PartSet_SketcherMgr.cpp | 15 +++++---------- src/PartSet/PartSet_SketcherMgr.h | 4 ++-- src/XGUI/XGUI_SelectionMgr.cpp | 5 ----- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/src/PartSet/PartSet_SketcherMgr.cpp b/src/PartSet/PartSet_SketcherMgr.cpp index ff779fa9f..81945bbd4 100755 --- a/src/PartSet/PartSet_SketcherMgr.cpp +++ b/src/PartSet/PartSet_SketcherMgr.cpp @@ -266,6 +266,8 @@ void PartSet_SketcherMgr::onLeaveViewPort() aDisplayer->enableUpdateViewer(isEnableUpdateViewer); } +/* +//Temporary commented as we do not modify values in property panel void PartSet_SketcherMgr::onBeforeValuesChangedInPropertyPanel() { if (!isNestedEditOperation(getCurrentOperation(), myModule->sketchMgr()->activeSketch()) || @@ -299,9 +301,8 @@ void PartSet_SketcherMgr::onAfterValuesChangedInPropertyPanel() XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer(); aDisplayer->enableUpdateViewer(myPreviousUpdateViewerEnabled); aDisplayer->updateViewer(); - - } +*/ void PartSet_SketcherMgr::onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent) { @@ -375,9 +376,6 @@ void PartSet_SketcherMgr::onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseE myDragDone = false; myPreviousDrawModeEnabled = aViewer->enableDrawMode(false); - // selection should be restored before edit operation start to process the - // selected entities, e.g. selection of point(attribute on a line) should edit the point - restoreSelection(); launchEditing(); if (aFeature.get() != NULL) { std::shared_ptr aSPFeature = @@ -406,9 +404,6 @@ void PartSet_SketcherMgr::onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseE myDragDone = false; myPreviousDrawModeEnabled = aViewer->enableDrawMode(false); - // selection should be restored before edit operation start to process the - // selected entities, e.g. selection of point(attribute on a line) should edit the point - restoreSelection(); launchEditing(); myIsEditLaunching = aPrevLaunchingState; if (aFeature.get() != NULL) { @@ -424,7 +419,6 @@ void PartSet_SketcherMgr::onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseE aFPAttr->setValue(myCurrentPoint.myCurX, myCurrentPoint.myCurY); } } - restoreSelection(); } } } @@ -1537,6 +1531,7 @@ void PartSet_SketcherMgr::getSelectionOwners(const FeaturePtr& theFeature, void PartSet_SketcherMgr::connectToPropertyPanel(ModuleBase_ModelWidget* theWidget, const bool isToConnect) { + /*Temporary commented as we do not modify values in property panel if (isToConnect) { connect(theWidget, SIGNAL(beforeValuesChanged()), this, SLOT(onBeforeValuesChangedInPropertyPanel())); @@ -1548,7 +1543,7 @@ void PartSet_SketcherMgr::connectToPropertyPanel(ModuleBase_ModelWidget* theWidg this, SLOT(onBeforeValuesChangedInPropertyPanel())); disconnect(theWidget, SIGNAL(afterValuesChanged()), this, SLOT(onAfterValuesChangedInPropertyPanel())); - } + }*/ } void PartSet_SketcherMgr::widgetStateChanged(int thePreviousState) diff --git a/src/PartSet/PartSet_SketcherMgr.h b/src/PartSet/PartSet_SketcherMgr.h index 9ea23ef94..7e0ce1f27 100644 --- a/src/PartSet/PartSet_SketcherMgr.h +++ b/src/PartSet/PartSet_SketcherMgr.h @@ -284,10 +284,10 @@ private slots: /// a nested sketch feature, it hides the feature in the viewer void onLeaveViewPort(); /// Listens to the value changed signal and display the current operation feature - void onBeforeValuesChangedInPropertyPanel(); + //void onBeforeValuesChangedInPropertyPanel(); /// Listens to the signal about the modification of the values /// have been done in the property panel - void onAfterValuesChangedInPropertyPanel(); + //void onAfterValuesChangedInPropertyPanel(); void onMousePressed(ModuleBase_IViewWindow*, QMouseEvent*); void onMouseReleased(ModuleBase_IViewWindow*, QMouseEvent*); diff --git a/src/XGUI/XGUI_SelectionMgr.cpp b/src/XGUI/XGUI_SelectionMgr.cpp index 059f3e2a1..a442f465c 100755 --- a/src/XGUI/XGUI_SelectionMgr.cpp +++ b/src/XGUI/XGUI_SelectionMgr.cpp @@ -56,9 +56,6 @@ void XGUI_SelectionMgr::connectViewers() void XGUI_SelectionMgr::setSelectedOwners(const SelectMgr_IndexedMapOfOwner& theSelectedOwners, bool isUpdateViewer) { - SelectMgr_IndexedMapOfOwner aSelectedOwners; - selection()->selectedOwners(aSelectedOwners); - Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext(); if (!aContext.IsNull()) { /// previous selection should be cleared, else there will be decomposition of selections: @@ -67,8 +64,6 @@ void XGUI_SelectionMgr::setSelectedOwners(const SelectMgr_IndexedMapOfOwner& the for (Standard_Integer i = 1, n = theSelectedOwners.Extent(); i <= n; i++) { Handle(SelectMgr_EntityOwner) anOwner = theSelectedOwners(i); - if (aSelectedOwners.FindIndex(anOwner) > 0) - continue; aContext->AddOrRemoveSelected(anOwner, isUpdateViewer); #ifdef VINSPECTOR -- 2.39.2