From dec4497227e29eb2bc728adcd197a048f7bc3287 Mon Sep 17 00:00:00 2001 From: nds Date: Thu, 29 Jan 2015 13:47:28 +0300 Subject: [PATCH] Issue #389 Undo/redo problem on sketch line creation Activate object even if it can not be shaded. A sketch line sub-feature. Undo/Redo. --- src/XGUI/XGUI_Displayer.cpp | 34 ++++++++++++++++++++++++++++++---- src/XGUI/XGUI_Displayer.h | 4 ++-- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/src/XGUI/XGUI_Displayer.cpp b/src/XGUI/XGUI_Displayer.cpp index b68482a9d..74ba0b5a3 100644 --- a/src/XGUI/XGUI_Displayer.cpp +++ b/src/XGUI/XGUI_Displayer.cpp @@ -41,7 +41,8 @@ const int MOUSE_SENSITIVITY_IN_PIXEL = 10; ///< defines the local context mouse selection sensitivity -//#ifdef DEBUG_DISPLAY +//#define DEBUG_DISPLAY +//#define DEBUG_ACTIVATE // Workaround for bug #25637 void displayedObjects(const Handle(AIS_InteractiveContext)& theAIS, AIS_ListOfInteractive& theList) @@ -168,7 +169,9 @@ void XGUI_Displayer::display(ObjectPtr theObject, AISObjectPtr theAIS, activateObjects(myActiveSelectionModes); myWorkshop->selector()->setSelectedOwners(aSelectedOwners, false); } - } + else + activateObjects(myActiveSelectionModes); + } if (isUpdateViewer) updateViewer(); } @@ -254,13 +257,30 @@ void XGUI_Displayer::deactivate(ObjectPtr theObject) } } -void XGUI_Displayer::activate(ObjectPtr theFeature) +/*void XGUI_Displayer::activate(ObjectPtr theFeature) { activate(theFeature, myActiveSelectionModes); } void XGUI_Displayer::activate(ObjectPtr theObject, const QIntList& theModes) { +#ifdef DEBUG_ACTIVATE + FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); + + if (aFeature.get() != NULL) { + QIntList aModes; + getModesOfActivation(theObject, aModes); + + + qDebug(QString("activate feature: %1, theModes: %2, myActiveSelectionModes: %3, getModesOf: %4"). + arg(aFeature->data()->name().c_str()). + arg(theModes.size()). + arg(myActiveSelectionModes.size()). + arg(aModes.size()).toStdString().c_str()); + } +#endif + + if (isVisible(theObject)) { Handle(AIS_InteractiveContext) aContext = AISContext(); if (aContext.IsNull()) @@ -281,7 +301,7 @@ void XGUI_Displayer::activate(ObjectPtr theObject, const QIntList& theModes) aContext->Activate(anAIS); } } -} +}*/ void XGUI_Displayer::getModesOfActivation(ObjectPtr theObject, QIntList& theModes) { @@ -307,6 +327,12 @@ void XGUI_Displayer::getModesOfActivation(ObjectPtr theObject, QIntList& theMode void XGUI_Displayer::activateObjects(const QIntList& theModes) { +#ifdef DEBUG_ACTIVATE + qDebug(QString("activate all features: theModes: %2, myActiveSelectionModes: %3"). + arg(theModes.size()). + arg(myActiveSelectionModes.size()). + toStdString().c_str()); +#endif // In order to avoid doblications of selection modes QIntList aNewModes; foreach (int aMode, theModes) { diff --git a/src/XGUI/XGUI_Displayer.h b/src/XGUI/XGUI_Displayer.h index b917e55eb..c1aded1fa 100644 --- a/src/XGUI/XGUI_Displayer.h +++ b/src/XGUI/XGUI_Displayer.h @@ -139,7 +139,7 @@ class XGUI_EXPORT XGUI_Displayer /// Activates the given object (it can be selected) /// \param theObject object to activate /// \param theModes - modes on which it has to be activated (can be empty) - void activate(ObjectPtr theObject, const QIntList& theModes); + //void activate(ObjectPtr theObject, const QIntList& theModes); /// Returns the modes of activation /// \param theObject the feature or NULL if it not visualized @@ -148,7 +148,7 @@ class XGUI_EXPORT XGUI_Displayer /// Activates the given object with default modes /// \param theObject object to activate - void activate(ObjectPtr theObject); + //void activate(ObjectPtr theObject); /// Returns true if the given object can be selected /// \param theObject object to check -- 2.39.2