From: nds Date: Mon, 16 Feb 2015 09:03:15 +0000 (+0300) Subject: Issue #394 Undo-ing a Sketch element X-Git-Tag: V_1.1.0~182 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9fa8dcb9d89271c45d6e563bdac5d66f8c7978ff;p=modules%2Fshaper.git Issue #394 Undo-ing a Sketch element Do not hide the constraint distance presentation if editor widget currently is active. --- diff --git a/src/PartSet/PartSet_SketcherMgr.cpp b/src/PartSet/PartSet_SketcherMgr.cpp index e6042a946..226205b7c 100644 --- a/src/PartSet/PartSet_SketcherMgr.cpp +++ b/src/PartSet/PartSet_SketcherMgr.cpp @@ -10,6 +10,8 @@ #include "PartSet_WidgetPoint2dDistance.h" #include "PartSet_Tools.h" +#include + #include #include #include @@ -179,7 +181,9 @@ void PartSet_SketcherMgr::onLeaveViewPort() // hides the presentation of the current operation feature myIsPropertyPanelValueChanged = false; - visualizeFeature(aOperation, false); + // the feature is to be erased here, but it is correct to call canDisplayObject because + // there can be additional check (e.g. editor widget in distance constraint) + visualizeFeature(aOperation, canDisplayObject()); } void PartSet_SketcherMgr::onValuesChangedInPropertyPanel() @@ -190,7 +194,9 @@ void PartSet_SketcherMgr::onValuesChangedInPropertyPanel() // visualize the current operation feature myIsPropertyPanelValueChanged = true; ModuleBase_Operation* aOperation = getCurrentOperation(); - visualizeFeature(aOperation, true); + // the feature is to be erased here, but it is correct to call canDisplayObject because + // there can be additional check (e.g. editor widget in distance constraint) + visualizeFeature(aOperation, canDisplayObject()); } void PartSet_SketcherMgr::onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent) @@ -334,7 +340,9 @@ void PartSet_SketcherMgr::onMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEve if (aDistanceWdg) { aDistanceWdg->onMouseMove(theWnd, theEvent); } - visualizeFeature(aOperation, true); + // the feature is to be erased here, but it is correct to call canDisplayObject because + // there can be additional check (e.g. editor widget in distance constraint) + visualizeFeature(aOperation, canDisplayObject()); } myClickedPoint.clear(); @@ -681,6 +689,18 @@ bool PartSet_SketcherMgr::canDisplayObject() const if (!isNestedCreateOperation(getCurrentOperation())) return aCanDisplay; + ModuleBase_Operation* aOperation = getCurrentOperation(); + ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel(); + ModuleBase_ModelWidget* anActiveWdg = aPanel ? aPanel->activeWidget() : 0; + // the active widget editor should not influence here. The presentation should be visible always + // when this widget is active. + if (anActiveWdg) { + ModuleBase_WidgetEditor* anEditorWdg = dynamic_cast(anActiveWdg); + if (anEditorWdg) { + return aCanDisplay; + } + } + // during a nested create operation, the feature is redisplayed only if the mouse over view // of there was a value modified in the property panel after the mouse left the view aCanDisplay = myIsPropertyPanelValueChanged || myIsMouseOverWindow; @@ -841,7 +861,7 @@ bool PartSet_SketcherMgr::isNestedCreateOperation(ModuleBase_Operation* theOpera } void PartSet_SketcherMgr::visualizeFeature(ModuleBase_Operation* theOperation, - const bool isToDisplay) + const bool isToDisplay) { if (!theOperation || theOperation->isEditOperation()) return;