From 6b9d5077eb26984c647ebee5183b5ecbb298f827 Mon Sep 17 00:00:00 2001 From: vsv Date: Fri, 22 May 2015 12:32:03 +0300 Subject: [PATCH] Set color with low saturation for objects of deactivated document --- src/PartSet/PartSet_Module.cpp | 7 +++++++ src/XGUI/XGUI_CustomPrs.cpp | 10 ++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index d92b6af6f..0927b50ee 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -736,5 +736,12 @@ void PartSet_Module::processEvent(const std::shared_ptr& theMess } aLabel->setPalette(aPalet); aWorkshop->updateCommandStatus(); + + // Update displayed objects in order to update active color + XGUI_Displayer* aDisplayer = aWorkshop->displayer(); + QObjectPtrList aObjects = aDisplayer->displayedObjects(); + foreach(ObjectPtr aObj, aObjects) + aDisplayer->redisplay(aObj, false); + aDisplayer->updateViewer(); } } diff --git a/src/XGUI/XGUI_CustomPrs.cpp b/src/XGUI/XGUI_CustomPrs.cpp index c074a841e..171baa846 100644 --- a/src/XGUI/XGUI_CustomPrs.cpp +++ b/src/XGUI/XGUI_CustomPrs.cpp @@ -7,11 +7,13 @@ #include #include +#include #include #include #include +#include void getColor(ResultPtr theResult, std::vector& theColor) @@ -56,5 +58,13 @@ bool XGUI_CustomPrs::customisePresentation(ResultPtr theResult, AISObjectPtr the if (aColor.empty()) getDefaultColor(theResult, thePrs, aColor); + SessionPtr aMgr = ModelAPI_Session::get(); + if (aMgr->activeDocument() != theResult->document()) { + QColor aQColor(aColor[0], aColor[1], aColor[2]); + QColor aNewColor = QColor::fromHsvF(aQColor.hueF(), aQColor.saturationF()/3., aQColor.valueF()); + aColor[0] = aNewColor.red(); + aColor[1] = aNewColor.green(); + aColor[2] = aNewColor.blue(); + } return !aColor.empty() && thePrs->setColor(aColor[0], aColor[1], aColor[2]); } -- 2.39.2