From e1fb666f812928ee29a5876bf8585428633d2722 Mon Sep 17 00:00:00 2001 From: John Scipione Date: Sat, 24 Nov 2012 11:33:03 -0500 Subject: [PATCH] While I'm at it update Tracker preferences ListView. * Use be_control_look->DefaultLabelSpacing() instead of hard-coding 4px. * Use pre-generated system colors. * Indicate a pane is revertable by making the font bold instead of blue. This makes the revertable setting orthogonal with the selected setting (can be both bold and selected color). --- src/kits/tracker/TrackerSettingsWindow.cpp | 23 ++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/kits/tracker/TrackerSettingsWindow.cpp b/src/kits/tracker/TrackerSettingsWindow.cpp index 57127a09b9..2d9710d32f 100644 --- a/src/kits/tracker/TrackerSettingsWindow.cpp +++ b/src/kits/tracker/TrackerSettingsWindow.cpp @@ -35,6 +35,7 @@ All rights reserved. #include #include +#include #include #include #include @@ -311,10 +312,6 @@ SettingsItem::SettingsItem(const char* label, SettingsView* view) void SettingsItem::DrawItem(BView* owner, BRect rect, bool drawEverything) { - const rgb_color kModifiedColor = {0, 0, 255, 0}; - const rgb_color kBlack = {0, 0, 0, 0}; - const rgb_color kSelectedColor = {140, 140, 140, 0}; - if (fSettingsView) { bool isRevertable = fSettingsView->IsRevertable(); bool isSelected = IsSelected(); @@ -322,7 +319,7 @@ SettingsItem::DrawItem(BView* owner, BRect rect, bool drawEverything) if (isSelected || drawEverything) { rgb_color color; if (isSelected) - color = kSelectedColor; + color = ui_color(B_LIST_SELECTED_BACKGROUND_COLOR); else color = owner->ViewColor(); @@ -332,17 +329,23 @@ SettingsItem::DrawItem(BView* owner, BRect rect, bool drawEverything) } if (isRevertable) - owner->SetHighColor(kModifiedColor); + owner->SetFont(be_bold_font); else - owner->SetHighColor(kBlack); + owner->SetFont(be_plain_font); + + if (isSelected) + owner->SetHighColor(ui_color(B_LIST_SELECTED_ITEM_TEXT_COLOR)); + else + owner->SetHighColor(ui_color(B_LIST_ITEM_TEXT_COLOR)); font_height fheight; owner->GetFontHeight(&fheight); - owner->DrawString(Text(), BPoint(rect.left + 4, rect.top - + fheight.ascent + 2 + floorf(fheight.leading / 2))); + owner->DrawString(Text(), + BPoint(rect.left + be_control_look->DefaultLabelSpacing(), + rect.top + fheight.ascent + 2 + floorf(fheight.leading / 2))); - owner->SetHighColor(kBlack); + owner->SetHighColor(ui_color(B_LIST_ITEM_TEXT_COLOR)); owner->SetLowColor(owner->ViewColor()); } }