hrev48477 adds 1 changeset to branch 'master' old head: d18ae0336e14d31ab7af7e53ce5c01701d232275 new head: 04f884284c433bedf44c6279c8fa82fb620c6822 overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=04f8842+%5Ed18ae03 ---------------------------------------------------------------------------- 04f8842: Colorcontrol: show resulting colors in the slider Instead of showing plain red, green and blue color ramps, show what the color would be if you moved the sliders to each point. This is what was done on Mac OS classic and is also used in some other tools to help you targetting a particular color. It also limits the need for a color preview, which BColorControl currently doesn't include, forcing apps to implement one themselves. Fixes #3790 (the patch there didn't apply anymore, so I redid the work. Credits for the change should go to stpere). [ Adrien Destugues <pulkomandy@xxxxxxxxx> ] ---------------------------------------------------------------------------- Revision: hrev48477 Commit: 04f884284c433bedf44c6279c8fa82fb620c6822 URL: http://cgit.haiku-os.org/haiku/commit/?id=04f8842 Author: Adrien Destugues <pulkomandy@xxxxxxxxx> Date: Wed Dec 10 10:33:58 2014 UTC Ticket: https://dev.haiku-os.org/ticket/3790 ---------------------------------------------------------------------------- 1 file changed, 8 insertions(+), 17 deletions(-) src/kits/interface/ColorControl.cpp | 25 ++++++++----------------- ---------------------------------------------------------------------------- diff --git a/src/kits/interface/ColorControl.cpp b/src/kits/interface/ColorControl.cpp index 777413f..4488cec 100644 --- a/src/kits/interface/ColorControl.cpp +++ b/src/kits/interface/ColorControl.cpp @@ -19,6 +19,8 @@ #include <stdio.h> #include <stdlib.h> +#include <iostream> + #include <ControlLook.h> #include <Bitmap.h> #include <TextControl.h> @@ -280,20 +282,8 @@ BColorControl::SetValue(int32 value) Invalidate(_PaletteSelectorFrame(fSelectedPaletteColorIndex)); fPreviousSelectedPaletteColorIndex = fSelectedPaletteColorIndex; - } else { - if (c1.red != c2.red) { - _InvalidateSelector(1, c1, IsFocus() && fFocusedRamp == 1); - _InvalidateSelector(1, c2, IsFocus() && fFocusedRamp == 1); - } - if (c1.green != c2.green) { - _InvalidateSelector(2, c1, IsFocus() && fFocusedRamp == 2); - _InvalidateSelector(2, c2, IsFocus() && fFocusedRamp == 2); - } - if (c1.blue != c2.blue) { - _InvalidateSelector(3, c1, IsFocus() && fFocusedRamp == 3); - _InvalidateSelector(3, c2, IsFocus() && fFocusedRamp == 3); - } - } + } else if (c1 != c2) + Invalidate(); // Set the value here, since BTextControl will trigger // Window()->UpdateIfNeeded() which will cause us to draw the indicators @@ -472,10 +462,11 @@ BColorControl::_DrawColorArea(BView* target, BRect updateRect) } } } else { + rgb_color color = ValueAsColor(); rgb_color white = { 255, 255, 255, 255 }; - rgb_color red = { 255, 0, 0, 255 }; - rgb_color green = { 0, 255, 0, 255 }; - rgb_color blue = { 0, 0, 255, 255 }; + rgb_color red = { 255, color.green, color.blue, 255 }; + rgb_color green = { color.red, 255, color.blue, 255 }; + rgb_color blue = { color.red, color.green, 255, 255 }; rgb_color compColor = { 0, 0, 0, 255 }; if (!enabled) {