From: vsv Date: Fri, 22 May 2015 09:32:03 +0000 (+0300) Subject: Set color with low saturation for objects of deactivated document X-Git-Tag: V_1.2.0~114 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6b9d5077eb26984c647ebee5183b5ecbb298f827;p=modules%2Fshaper.git Set color with low saturation for objects of deactivated document --- 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]); }