[haiku-commits] haiku: hrev45443 - headers/private/app src/kits/interface src/preferences/appearance src/bin headers/os/interface

  • From: jscipione@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 6 Apr 2013 01:29:31 +0200 (CEST)

hrev45443 adds 1 changeset to branch 'master'
old head: 631624fb010bb76278e1a291a578cf802dc3eb77
new head: 9f24981a56edba10807b550b521563b0cadd12c7
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=9f24981+%5E631624f

----------------------------------------------------------------------------

9f24981: Add B_SCROLL_BAR_THUMB_COLOR constant.
  
  This allows you to change the scrollbar thumb color in Appearance preferences.
  The default color is 216, 216, 216 so the scroll bar thumb looks the same by
  default. Perhaps someday this can be updated to something a bit more colorful.

                                     [ John Scipione <jscipione@xxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev45443
Commit:      9f24981a56edba10807b550b521563b0cadd12c7
URL:         http://cgit.haiku-os.org/haiku/commit/?id=9f24981
Author:      John Scipione <jscipione@xxxxxxxxx>
Date:        Fri Apr  5 23:26:41 2013 UTC

----------------------------------------------------------------------------

6 files changed, 14 insertions(+), 6 deletions(-)
headers/os/interface/InterfaceDefs.h       |  2 ++
headers/private/app/ServerReadOnlyMemory.h | 10 +++++-----
src/bin/WindowShade.cpp                    |  1 +
src/kits/interface/InterfaceDefs.cpp       |  1 +
src/kits/interface/ScrollBar.cpp           |  4 +++-
src/preferences/appearance/ColorSet.cpp    |  2 ++

----------------------------------------------------------------------------

diff --git a/headers/os/interface/InterfaceDefs.h 
b/headers/os/interface/InterfaceDefs.h
index 51b5f6f..02b9add 100644
--- a/headers/os/interface/InterfaceDefs.h
+++ b/headers/os/interface/InterfaceDefs.h
@@ -311,6 +311,8 @@ enum color_which {
        B_LIST_ITEM_TEXT_COLOR = 30,
        B_LIST_SELECTED_ITEM_TEXT_COLOR = 31,
 
+       B_SCROLL_BAR_THUMB_COLOR = 32,
+
        B_TOOL_TIP_BACKGROUND_COLOR = 20,
        B_TOOL_TIP_TEXT_COLOR = 21,
 
diff --git a/headers/private/app/ServerReadOnlyMemory.h 
b/headers/private/app/ServerReadOnlyMemory.h
index 64b29f2..46f925e 100644
--- a/headers/private/app/ServerReadOnlyMemory.h
+++ b/headers/private/app/ServerReadOnlyMemory.h
@@ -13,7 +13,7 @@
 #include <InterfaceDefs.h>
 
 
-static const int32 kNumColors = 34;
+static const int32 kNumColors = 35;
 
 struct server_read_only_memory {
        rgb_color       colors[kNumColors];
@@ -26,10 +26,10 @@ static inline int32
 color_which_to_index(color_which which)
 {
        // NOTE: this must be kept in sync with InterfaceDefs.h color_which!
-       if (which <= B_LIST_SELECTED_ITEM_TEXT_COLOR)
+       if (which <= B_SCROLL_BAR_THUMB_COLOR)
                return which - 1;
        if (which >= B_SUCCESS_COLOR && which <= B_FAILURE_COLOR)
-               return which - B_SUCCESS_COLOR + 
B_LIST_SELECTED_ITEM_TEXT_COLOR;
+               return which - B_SUCCESS_COLOR + B_SCROLL_BAR_THUMB_COLOR;
 
        return -1;
 }
@@ -39,11 +39,11 @@ static inline color_which
 index_to_color_which(int32 index)
 {
        if (index >= 0 && index < kNumColors) {
-               if ((color_which)index < B_LIST_SELECTED_ITEM_TEXT_COLOR)
+               if ((color_which)index < B_SCROLL_BAR_THUMB_COLOR)
                        return (color_which)(index + 1);
                else {
                        return (color_which)(index + B_SUCCESS_COLOR
-                         - B_LIST_SELECTED_ITEM_TEXT_COLOR);
+                         - B_SCROLL_BAR_THUMB_COLOR);
                }
        }
 
diff --git a/src/bin/WindowShade.cpp b/src/bin/WindowShade.cpp
index 7f2f480..1d2befa 100644
--- a/src/bin/WindowShade.cpp
+++ b/src/bin/WindowShade.cpp
@@ -57,6 +57,7 @@ static struct option const kLongOptions[] = {
        I(list_selected_background_color, B_LIST_SELECTED_BACKGROUND_COLOR),
        I(list_item_text_color, B_LIST_ITEM_TEXT_COLOR),
        I(list_selected_item_text_color, B_LIST_SELECTED_ITEM_TEXT_COLOR),
+       I(scroll_bar_thumb_color, B_SCROLL_BAR_THUMB_COLOR),
        I(tooltip_background_color, B_TOOL_TIP_BACKGROUND_COLOR),
        I(tooltip_text_color, B_TOOL_TIP_TEXT_COLOR),
        I(success_color, B_SUCCESS_COLOR),
diff --git a/src/kits/interface/InterfaceDefs.cpp 
b/src/kits/interface/InterfaceDefs.cpp
index 797a872..0019676 100644
--- a/src/kits/interface/InterfaceDefs.cpp
+++ b/src/kits/interface/InterfaceDefs.cpp
@@ -101,6 +101,7 @@ static const rgb_color _kDefaultColors[kNumColors] = {
        {153, 153, 153, 255},   // B_LIST_SELECTED_BACKGROUND_COLOR
        {0, 0, 0, 255},                 // B_LIST_ITEM_TEXT_COLOR
        {0, 0, 0, 255},                 // B_LIST_SELECTED_ITEM_TEXT_COLOR
+       {216, 216, 216, 255},   // B_SCROLL_BAR_THUMB_COLOR
        // 100...
        {0, 255, 0, 255},               // B_SUCCESS_COLOR
        {255, 0, 0, 255},               // B_FAILURE_COLOR
diff --git a/src/kits/interface/ScrollBar.cpp b/src/kits/interface/ScrollBar.cpp
index 1d6fd39..faafab4 100644
--- a/src/kits/interface/ScrollBar.cpp
+++ b/src/kits/interface/ScrollBar.cpp
@@ -965,11 +965,13 @@ BScrollBar::Draw(BRect updateRect)
                        bottomOfThumb, updateRect, normal, flags, fOrientation);
        }
 
+       rgb_color thumbColor = ui_color(B_SCROLL_BAR_THUMB_COLOR);
+
        // Draw scroll thumb
        if (enabled) {
                // fill the clickable surface of the thumb
                be_control_look->DrawButtonBackground(this, rect, updateRect,
-                       normal, 0, BControlLook::B_ALL_BORDERS, fOrientation);
+                       thumbColor, 0, BControlLook::B_ALL_BORDERS, 
fOrientation);
                // TODO: Add the other thumb styles - dots and lines
        } else {
                if (fMin >= fMax || fProportion >= 1.0 || fProportion < 0.0) {
diff --git a/src/preferences/appearance/ColorSet.cpp 
b/src/preferences/appearance/ColorSet.cpp
index 8195437..ab2a167 100644
--- a/src/preferences/appearance/ColorSet.cpp
+++ b/src/preferences/appearance/ColorSet.cpp
@@ -53,6 +53,8 @@ static ColorDescription sColorDescriptionTable[] =
        { B_LIST_ITEM_TEXT_COLOR, B_TRANSLATE_MARK("List item text") },
        { B_LIST_SELECTED_ITEM_TEXT_COLOR,
                B_TRANSLATE_MARK("Selected list item text") },
+       { B_SCROLL_BAR_THUMB_COLOR,
+               B_TRANSLATE_MARK("Scroll bar thumb") },
        { B_TOOL_TIP_BACKGROUND_COLOR, B_TRANSLATE_MARK("Tooltip background") },
        { B_TOOL_TIP_TEXT_COLOR, B_TRANSLATE_MARK("Tooltip text") },
        { B_SUCCESS_COLOR, B_TRANSLATE_MARK("Success") },


Other related posts: