[haiku-commits] BRANCH looncraz-github.setviewuicolor [8d3881fa69b7] in src: servers/app/decorator servers/app apps/aboutsystem kits/interface preferences/appearance

  • From: looncraz-github.setviewuicolor <community@xxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 27 Sep 2015 05:46:57 +0200 (CEST)

added 1 changeset to branch 'refs/remotes/looncraz-github/setviewuicolor'
old head: cf3cdb69b51014d2e4f2a59393923cad8d717e6e
new head: 8d3881fa69b79e0777c97678c4e0fa46cc8a9be1
overview: https://github.com/looncraz/haiku/compare/cf3cdb69b510...8d3881fa69b7

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

8d3881fa69b7: More Adaptations

app_server
Now sends "which" color changed.
Most work to have decorators redraw with proper colors has been
completed but the current changes lock the desktop... which is odd.

AboutSystem
Changed fUptimeView to BStringView to fix a window sizing issue.
- Not sure if there's a ticket
Now uses Set*UIColor properly.
Category labels are now tinted differently than the subtext.
- Tint values are calculated based on rgb_color brightness.
TODO: Credit view needs some love

ActivityMonitor
Now uses Set*UIColor

rgb_color
Add gamma-corrected (roughly) Brightness() method.
-Extremely useful for getting rid of the 2,000 places in the system
-where a custom algorithm is used... colors should change predictably
-if at all.

StatusBar
Default color is now derived from user settings rather than hardcoded
value.
-Had to add a new member variable: fInternalFlags
-Application-set colors are still honored (though untested :p)
-Currently uses B_CONTROL_HIGHLIGHT_COLOR... probably shouldn't

[ looncraz <looncraz@xxxxxxxxxxxx> ]

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

Commit: 8d3881fa69b79e0777c97678c4e0fa46cc8a9be1
Author: looncraz <looncraz@xxxxxxxxxxxx>
Date: Sun Sep 27 03:21:41 2015 UTC

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

41 files changed, 349 insertions(+), 99 deletions(-)
headers/os/interface/GraphicsDefs.h | 7 ++
headers/os/interface/StatusBar.h | 3 +-
src/apps/aboutsystem/AboutSystem.cpp | 67 +++++++++++++++++---
src/apps/activitymonitor/ActivityView.cpp | 9 +--
src/apps/activitymonitor/ActivityWindow.cpp | 3 +-
src/apps/activitymonitor/SettingsWindow.cpp | 2 +
src/apps/magnify/Magnify.cpp | 2 +-
src/kits/bluetooth/UI/ConnectionIncoming.cpp | 2 +-
src/kits/interface/Button.cpp | 2 -
src/kits/interface/CheckBox.cpp | 2 +-
src/kits/interface/Control.cpp | 12 ++++
src/kits/interface/ControlLook.cpp | 1 +
src/kits/interface/Menu.cpp | 1 -
src/kits/interface/StatusBar.cpp | 41 ++++++------
src/kits/interface/StringView.cpp | 1 +
src/kits/interface/TextView.cpp | 5 +-
src/preferences/appearance/APRView.cpp | 4 +-
.../appearance/AntialiasingSettingsView.cpp | 9 ++-
src/preferences/appearance/CurView.cpp | 6 +-
src/preferences/appearance/FontMenu.cpp | 2 +-
src/preferences/appearance/FontView.cpp | 2 +-
.../appearance/LookAndFeelSettingsView.cpp | 8 +--
src/preferences/appearance/MenuView.cpp | 2 +-
src/servers/app/Desktop.cpp | 41 ++++++++++++
src/servers/app/Desktop.h | 2 +
src/servers/app/DesktopSettings.cpp | 8 +--
src/servers/app/MessageLooper.cpp | 15 +++++
src/servers/app/MessageLooper.h | 6 +-
src/servers/app/ServerWindow.cpp | 6 ++
src/servers/app/Window.cpp | 21 ++++++
src/servers/app/Window.h | 2 +
src/servers/app/decorator/DecorManager.cpp | 7 +-
src/servers/app/decorator/DecorManager.h | 2 +-
src/servers/app/decorator/Decorator.cpp | 35 +++++++++-
src/servers/app/decorator/Decorator.h | 8 ++-
src/servers/app/decorator/DefaultDecorator.cpp | 4 +-
src/servers/app/decorator/DefaultDecorator.h | 2 +-
src/servers/app/decorator/TabDecorator.cpp | 32 +++++++++-
src/servers/app/decorator/TabDecorator.h | 30 +++++----
src/servers/app/stackandtile/SATDecorator.cpp | 19 +++++-
src/servers/app/stackandtile/SATDecorator.h | 15 +++--

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

diff --git a/headers/os/interface/GraphicsDefs.h
b/headers/os/interface/GraphicsDefs.h
index 5e970c0..e4b27f5 100644
--- a/headers/os/interface/GraphicsDefs.h
+++ b/headers/os/interface/GraphicsDefs.h
@@ -57,6 +57,13 @@ typedef struct rgb_color {
return *this;
}

+ inline int32
+ Brightness()
+ {
+ return (int32)sqrt(red * red * 0.16 + green * green * 0.73
+ + blue * blue * 0.11);
+ }
+
inline bool
operator==(const rgb_color& other) const
{
diff --git a/headers/os/interface/StatusBar.h b/headers/os/interface/StatusBar.h
index 789f3a9..00316b2 100644
--- a/headers/os/interface/StatusBar.h
+++ b/headers/os/interface/StatusBar.h
@@ -110,8 +110,9 @@ private:
float fTextDivider;
rgb_color fBarColor;
bool fCustomBarHeight;
+ uint32 fInternalFlags;

- uint32 _reserved[5];
+ uint32 _reserved[4];
};

#endif // _STATUS_BAR_H
diff --git a/src/apps/aboutsystem/AboutSystem.cpp
b/src/apps/aboutsystem/AboutSystem.cpp
index 00483dc..0541217 100644
--- a/src/apps/aboutsystem/AboutSystem.cpp
+++ b/src/apps/aboutsystem/AboutSystem.cpp
@@ -32,6 +32,7 @@
#include <MessageFormat.h>
#include <MessageRunner.h>
#include <Messenger.h>
+#include <ObjectList.h>
#include <OS.h>
#include <Path.h>
#include <PathFinder.h>
@@ -211,6 +212,7 @@ private:
typedef std::map<std::string, PackageCredit*> PackageCreditMap;

private:
+ void _AdjustTextColors();
BView* _CreateLabel(const char* name,
const char* label);
BView* _CreateCreditsView();
status_t _GetLicensePath(const char*
license,
@@ -220,10 +222,13 @@ private:
void _AddPackageCreditEntries();

BStringView* fMemView;
- BTextView* fUptimeView;
+ BStringView* fUptimeView;
BView* fInfoView;
HyperTextView* fCreditsView;

+ BObjectList<BView> fTextViews;
+ BObjectList<BView> fSubTextViews;
+
BBitmap* fLogo;

bigtime_t fLastActionTime;
@@ -411,7 +416,6 @@ AboutView::AboutView()
fScrollRunner(NULL)
{
// Begin Construction of System Information controls
-
system_info systemInfo;
get_system_info(&systemInfo);

@@ -449,10 +453,12 @@ AboutView::AboutView()
}

BStringView* versionView = new BStringView("ostext", string);
+ fSubTextViews.AddItem(versionView);
versionView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));

BStringView* abiView = new BStringView("abitext", B_HAIKU_ABI_NAME);
+ fSubTextViews.AddItem(abiView);
abiView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));

@@ -500,6 +506,7 @@ AboutView::AboutView()
<< " " << get_cpu_model_string(platform, cpuVendor, cpuModel);

BStringView* cpuView = new BStringView("cputext", cpuType.String());
+ fSubTextViews.AddItem(cpuView);
cpuView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));

@@ -511,16 +518,20 @@ AboutView::AboutView()
clockSpeed / 1000.0f);

BStringView* frequencyView = new BStringView("frequencytext", string);
+ fSubTextViews.AddItem(frequencyView);
frequencyView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));

// RAM
BStringView *memSizeView = new BStringView("ramsizetext",
MemSizeToString(string, sizeof(string), &systemInfo));
+ fSubTextViews.AddItem(memSizeView);
memSizeView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));
+
fMemView = new BStringView("ramtext",
MemUsageToString(string, sizeof(string), &systemInfo));
+ fSubTextViews.AddItem(fMemView);
fMemView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));

@@ -539,22 +550,19 @@ AboutView::AboutView()
buildTimeDate.SetTo(kernelTimeDate);

BStringView* kernelView = new BStringView("kerneltext", buildTimeDate);
+ fSubTextViews.AddItem(kernelView);
kernelView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));

// Uptime
- fUptimeView = new BTextView("uptimetext");
- fUptimeView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
- fUptimeView->MakeEditable(false);
- fUptimeView->MakeSelectable(false);
- fUptimeView->SetWordWrap(true);
-
+ fUptimeView = new BStringView("uptimetext", "...");
+ fSubTextViews.AddItem(fUptimeView);
fUptimeView->SetText(UptimeToString(string, sizeof(string)));

const float offset = 5;

SetLayout(new BGroupLayout(B_HORIZONTAL, 0));
- SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
+ SetViewUIColor(B_PANEL_BACKGROUND_COLOR);

BLayoutBuilder::Group<>((BGroupLayout*)GetLayout())
.AddGroup(B_VERTICAL, 0)
@@ -587,6 +595,8 @@ AboutView::AboutView()

float min = fMemView->MinSize().width * 1.1f;
fCreditsView->SetExplicitMinSize(BSize(min, min));
+
+ _AdjustTextColors();
}


@@ -608,6 +618,7 @@ AboutView::AttachedToWindow()
BView::AttachedToWindow();
Window()->SetPulseRate(500000);
SetEventMask(B_POINTER_EVENTS);
+ DoLayout();
}


@@ -647,6 +658,14 @@ void
AboutView::MessageReceived(BMessage* msg)
{
switch (msg->what) {
+ case B_COLORS_UPDATED:
+ {
+ color_which which = B_NO_COLOR;
+ msg->FindInt32("which", (int32*)&which);
+ if (which == B_PANEL_TEXT_COLOR)
+ _AdjustTextColors();
+ break;
+ }
case SCROLL_CREDITS_VIEW:
{
BScrollBar* scrollBar =
@@ -816,6 +835,33 @@ AboutView::PickRandomHaiku()
}


+void
+AboutView::_AdjustTextColors()
+{
+ // Adjust tint for strings based on panel text color
+ // The theory is that the user will use lighter panel text colors
+ // with dark background - and vice versa, so we don't need to pay
+ // attention to the background color ourselves.
+ rgb_color color = ui_color(B_PANEL_TEXT_COLOR);
+ float tintAdjust = (((float)color.Brightness()) / 510.0f);
+ float tint = 0.75 + tintAdjust;
+
+ BView* view = NULL;
+ for (int32 index = 0; index < fSubTextViews.CountItems(); ++index) {
+ view = fSubTextViews.ItemAt(index);
+ view->SetHighUIColor(B_PANEL_TEXT_COLOR, tint);
+ }
+
+ // Labels
+ tint = 1.25 - tintAdjust;
+ for (int32 index = 0; index < fTextViews.CountItems(); ++index) {
+ view = fTextViews.ItemAt(index);
+ view->SetHighUIColor(B_PANEL_TEXT_COLOR, tint);
+ }
+
+}
+
+
BView*
AboutView::_CreateLabel(const char* name, const char* label)
{
@@ -823,6 +869,7 @@ AboutView::_CreateLabel(const char* name, const char* label)
labelView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));
labelView->SetFont(be_bold_font);
+ fTextViews.AddItem(labelView);
return labelView;
}

@@ -837,7 +884,7 @@ AboutView::_CreateCreditsView()
fCreditsView->MakeEditable(false);
fCreditsView->SetWordWrap(true);
fCreditsView->SetInsets(5, 5, 5, 5);
- fCreditsView->SetViewColor(ui_color(B_DOCUMENT_BACKGROUND_COLOR));
+ fCreditsView->SetViewUIColor(B_DOCUMENT_BACKGROUND_COLOR);

BScrollView* creditsScroller = new BScrollView("creditsScroller",
fCreditsView, B_WILL_DRAW | B_FRAME_EVENTS, false, true,
diff --git a/src/apps/activitymonitor/ActivityView.cpp
b/src/apps/activitymonitor/ActivityView.cpp
index 2e9a405..2f8e86c 100644
--- a/src/apps/activitymonitor/ActivityView.cpp
+++ b/src/apps/activitymonitor/ActivityView.cpp
@@ -576,7 +576,7 @@ ActivityView::ActivityView(const char* name, const
BMessage* settings)
#endif
fSourcesLock("data sources")
{
- SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
+ SetLowUIColor(B_PANEL_BACKGROUND_COLOR);

_Init(settings);

@@ -1121,7 +1121,6 @@ ActivityView::MessageReceived(BMessage* message)

break;
}
-
case kMsgUpdateResolution:
{
int32 resolution;
@@ -1479,7 +1478,9 @@ ActivityView::Draw(BRect updateRect)

// draw legend
BRect legendFrame = _LegendFrame();
- SetLowColor(fLegendBackgroundColor);
+ if (LowUIColor() == B_NO_COLOR)
+ SetLowColor(fLegendBackgroundColor);
+
if (drawBackground) {
BRect backgroundFrame(legendFrame);
backgroundFrame.bottom += kDraggerSize;
@@ -1520,7 +1521,7 @@ ActivityView::Draw(BRect updateRect)
TruncateString(&label, B_TRUNCATE_MIDDLE, possibleLabelWidth);

if (drawBackground)
- SetHighColor(ui_color(B_CONTROL_TEXT_COLOR));
+ SetHighColor(ui_color(B_PANEL_TEXT_COLOR));

if (be_control_look == NULL) {
DrawString(label.String(), BPoint(6 + colorBox.right,
y));
diff --git a/src/apps/activitymonitor/ActivityWindow.cpp
b/src/apps/activitymonitor/ActivityWindow.cpp
index 010db6b..30b7f23 100644
--- a/src/apps/activitymonitor/ActivityWindow.cpp
+++ b/src/apps/activitymonitor/ActivityWindow.cpp
@@ -68,8 +68,8 @@ ActivityWindow::ActivityWindow()
fLayout->SetSpacing(inset);

BView* top = new BView("top", 0, fLayout);
- top->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
layout->AddView(top);
+ top->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);

BMessage viewState;
int32 count = 0;
@@ -99,7 +99,6 @@ ActivityWindow::ActivityWindow()
topRect.top = menuBar->Bounds().bottom + 1;

BView* top = new BView(topRect, "top", B_FOLLOW_ALL, 0);
- top->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
layout->AddChild(top);

BMessage viewState;
diff --git a/src/apps/activitymonitor/SettingsWindow.cpp
b/src/apps/activitymonitor/SettingsWindow.cpp
index de58263..2ce465f 100644
--- a/src/apps/activitymonitor/SettingsWindow.cpp
+++ b/src/apps/activitymonitor/SettingsWindow.cpp
@@ -38,6 +38,7 @@ public:
SetLimitLabels(min.String(), max.String());
SetHashMarks(B_HASH_MARKS_BOTTOM);
SetHashMarkCount(levels);
+ SetViewUIColor(B_PANEL_BACKGROUND_COLOR);

if (message != NULL)
SetModificationMessage(new BMessage(*message));
@@ -105,6 +106,7 @@ SettingsWindow::SettingsWindow(ActivityWindow* target)
.Add(fIntervalSlider)
.SetInsets(10, 10, 10, 10)
);
+
if (target->IsAlwaysOnTop())
SetFeel(B_MODAL_ALL_WINDOW_FEEL);
}
diff --git a/src/apps/magnify/Magnify.cpp b/src/apps/magnify/Magnify.cpp
index 4fe28d1..f5bab51 100644
--- a/src/apps/magnify/Magnify.cpp
+++ b/src/apps/magnify/Magnify.cpp
@@ -808,7 +808,7 @@ void
TInfoView::AttachedToWindow()
{
BBox::AttachedToWindow();
-
+ SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
dynamic_cast<TWindow*>(Window())->PixelCount(&fHPixelCount,
&fVPixelCount);
fPixelSize = dynamic_cast<TWindow*>(Window())->PixelSize();

diff --git a/src/kits/bluetooth/UI/ConnectionIncoming.cpp
b/src/kits/bluetooth/UI/ConnectionIncoming.cpp
index 1aced3a..6520e1b 100644
--- a/src/kits/bluetooth/UI/ConnectionIncoming.cpp
+++ b/src/kits/bluetooth/UI/ConnectionIncoming.cpp
@@ -16,7 +16,7 @@ ConnectionView::ConnectionView(BRect frame, const char
*name): BView(BRect(0, 0,

B_WILL_DRAW |
B_PULSE_NEEDED)
{

- SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
+ SetViewUIColor(B_PANEL_BACKGROUND_COLOR);

}

diff --git a/src/kits/interface/Button.cpp b/src/kits/interface/Button.cpp
index d4491fa..eea5722 100644
--- a/src/kits/interface/Button.cpp
+++ b/src/kits/interface/Button.cpp
@@ -224,12 +224,10 @@ BButton::MouseDown(BPoint where)
}
}

-
void
BButton::AttachedToWindow()
{
BControl::AttachedToWindow();
- // adopt's parent's view and low colors

// Ensure BButton's low color is the parent's VIEW color.
// We don't want to adopt the standard control lowcolor.
diff --git a/src/kits/interface/CheckBox.cpp b/src/kits/interface/CheckBox.cpp
index c8fb055..0e23e3d 100644
--- a/src/kits/interface/CheckBox.cpp
+++ b/src/kits/interface/CheckBox.cpp
@@ -111,7 +111,7 @@ BCheckBox::Draw(BRect updateRect)

BRect checkBoxRect(_CheckBoxFrame());
BRect rect(checkBoxRect);
- be_control_look->DrawCheckBox(this, rect, updateRect,base, flags);
+ be_control_look->DrawCheckBox(this, rect, updateRect, base, flags);

BRect labelRect(Bounds());
labelRect.left = checkBoxRect.right + 1
diff --git a/src/kits/interface/Control.cpp b/src/kits/interface/Control.cpp
index 9893fb3..6194bd2 100644
--- a/src/kits/interface/Control.cpp
+++ b/src/kits/interface/Control.cpp
@@ -153,6 +153,15 @@ BControl::AttachedToWindow()
{
AdoptParentColors();

+ if (Parent() != NULL) {
+ float tint = B_NO_TINT;
+ color_which which = ViewUIColor(&tint);
+ if (which != B_NO_COLOR)
+ SetLowUIColor(which, tint);
+ else
+ SetLowColor(ViewColor());
+ }
+
if (!Messenger().IsValid())
SetTarget(Window());

@@ -598,6 +607,9 @@ BControl::operator=(const BControl &)
void
BControl::InitData(BMessage* data)
{
+ SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
+ SetLowUIColor(ViewUIColor());
+
fLabel = NULL;
SetLabel(B_EMPTY_STRING);
fValue = B_CONTROL_OFF;
diff --git a/src/kits/interface/ControlLook.cpp
b/src/kits/interface/ControlLook.cpp
index 3cfad71..269c03a 100644
--- a/src/kits/interface/ControlLook.cpp
+++ b/src/kits/interface/ControlLook.cpp
@@ -2147,6 +2147,7 @@ BControlLook::_DrawButtonFrame(BView* view, BRect& rect,
drawing_mode oldMode = view->DrawingMode();

if ((flags & B_DEFAULT_BUTTON) != 0) {
+ defaultIndicatorColor = ui_color(B_CONTROL_HIGHLIGHT_COLOR);
cornerBgColor = defaultIndicatorColor;
edgeLightColor = _EdgeLightColor(defaultIndicatorColor,
contrast * ((flags & B_DISABLED) != 0 ? 0.3 : 0.8),
diff --git a/src/kits/interface/Menu.cpp b/src/kits/interface/Menu.cpp
index 64cea754..b006200 100644
--- a/src/kits/interface/Menu.cpp
+++ b/src/kits/interface/Menu.cpp
@@ -380,7 +380,6 @@ void
BMenu::AttachedToWindow()
{
BView::AttachedToWindow();
- SetLowUIColor(B_MENU_BACKGROUND_COLOR);

_GetShiftKey(sShiftKey);
_GetControlKey(sControlKey);
diff --git a/src/kits/interface/StatusBar.cpp b/src/kits/interface/StatusBar.cpp
index 0482be9..6899930 100644
--- a/src/kits/interface/StatusBar.cpp
+++ b/src/kits/interface/StatusBar.cpp
@@ -23,8 +23,9 @@

#include <binary_compatibility/Interface.h>

-
-static const rgb_color kDefaultBarColor = {50, 150, 255, 255};
+enum internalFlags {
+ kCustomBarColor = 1
+};


BStatusBar::BStatusBar(BRect frame, const char *name, const char *label,
@@ -104,7 +105,7 @@ BStatusBar::Archive(BMessage *archive, bool deep) const
if (fCustomBarHeight)
err = archive->AddFloat("_high", fBarHeight);

- if (err == B_OK && fBarColor != kDefaultBarColor)
+ if (err == B_OK && fInternalFlags & kCustomBarColor)
err = archive->AddInt32("_bcolor", (const uint32 &)fBarColor);

if (err == B_OK && fCurrent != 0)
@@ -138,22 +139,8 @@ BStatusBar::AttachedToWindow()
ResizeTo(Bounds().Width(), height);

SetViewColor(B_TRANSPARENT_COLOR);
- rgb_color lowColor = B_TRANSPARENT_COLOR;
- color_which which = B_NO_COLOR;
-
- BView* parent = Parent();
- if (parent != NULL) {
- lowColor = parent->ViewColor();
- which = parent->ViewUIColor();
- }

- if (lowColor == B_TRANSPARENT_COLOR)
- lowColor = ui_color(B_PANEL_BACKGROUND_COLOR);
-
- if (which == B_NO_COLOR)
- SetLowColor(lowColor);
- else
- SetLowUIColor(which);
+ AdoptParentColors();

fTextDivider = Bounds().Width();
}
@@ -429,6 +416,20 @@ BStatusBar::MessageReceived(BMessage *message)
break;
}

+ case B_COLORS_UPDATED:
+ {
+ // Change the bar color IF we don't have an
application-set color.
+ if (!(fInternalFlags & kCustomBarColor)) {
+ color_which which = B_NO_COLOR;
+ message->FindInt32("which", (int32*)&which);
+ if (which == B_CONTROL_HIGHLIGHT_COLOR) {
+ fBarColor =
tint_color(ui_color(B_CONTROL_HIGHLIGHT_COLOR),
+
B_DARKEN_1_TINT);
+ }
+ }
+ break;
+ }
+
default:
BView::MessageReceived(message);
break;
@@ -463,6 +464,7 @@ BStatusBar::MouseMoved(BPoint point, uint32 transit, const
BMessage *message)
void
BStatusBar::SetBarColor(rgb_color color)
{
+ fInternalFlags |= kCustomBarColor;
fBarColor = color;

Invalidate();
@@ -761,8 +763,9 @@ BStatusBar::_InitObject()
fBarHeight = -1.0;
fTextDivider = Bounds().Width();

- fBarColor = kDefaultBarColor;
+ fBarColor = ui_color(B_CONTROL_HIGHLIGHT_COLOR);
fCustomBarHeight = false;
+ fInternalFlags = 0;

SetFlags(Flags() | B_FRAME_EVENTS);
}
diff --git a/src/kits/interface/StringView.cpp
b/src/kits/interface/StringView.cpp
index 5fee265..ed272b5 100644
--- a/src/kits/interface/StringView.cpp
+++ b/src/kits/interface/StringView.cpp
@@ -84,6 +84,7 @@ BStringView::BStringView(BMessage* archive)

SetText(text);
SetFlags(Flags() | B_FULL_UPDATE_ON_RESIZE);
+ SetHighUIColor(B_PANEL_TEXT_COLOR);
}


diff --git a/src/kits/interface/TextView.cpp b/src/kits/interface/TextView.cpp
index d909168..5cac699 100644
--- a/src/kits/interface/TextView.cpp
+++ b/src/kits/interface/TextView.cpp
@@ -3050,8 +3050,10 @@ BTextView::_InitObject(BRect textRect, const BFont*
initialFont,

_NormalizeFont(&font);

+ rgb_color documentTextColor = ui_color(B_DOCUMENT_TEXT_COLOR);
+
if (initialColor == NULL)
- initialColor = &kBlackColor;
+ initialColor = &documentTextColor;

fText = new BPrivate::TextGapBuffer;
fLines = new LineBuffer;
@@ -3112,6 +3114,7 @@ BTextView::_InitObject(BRect textRect, const BFont*
initialFont,
fLastClickOffset = -1;

SetDoesUndo(true);
+ SetViewUIColor(B_DOCUMENT_BACKGROUND_COLOR);
}


diff --git a/src/preferences/appearance/APRView.cpp
b/src/preferences/appearance/APRView.cpp
index 401fa16..819c5d1 100644
--- a/src/preferences/appearance/APRView.cpp
+++ b/src/preferences/appearance/APRView.cpp
@@ -43,7 +43,7 @@ APRView::APRView(const char* name)
BView(name, B_WILL_DRAW),
fDefaultSet(ColorSet::DefaultColorSet())
{
- SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
+ SetViewUIColor(B_PANEL_BACKGROUND_COLOR);

#if 0
fDecorMenu = new BMenu("Window Style");
@@ -77,7 +77,7 @@ APRView::APRView(const char* name)
fAttrList = new BListView("AttributeList", B_SINGLE_SELECTION_LIST);

fScrollView = new BScrollView("ScrollView", fAttrList, 0, false, true);
- fScrollView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
+ fScrollView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);

int32 count = color_description_count();
for (int32 i = 0; i < count; i++) {
diff --git a/src/preferences/appearance/AntialiasingSettingsView.cpp
b/src/preferences/appearance/AntialiasingSettingsView.cpp
index ab11ac9..f22c1b1 100644
--- a/src/preferences/appearance/AntialiasingSettingsView.cpp
+++ b/src/preferences/appearance/AntialiasingSettingsView.cpp
@@ -130,8 +130,7 @@ AntialiasingSettingsView::AntialiasingSettingsView(const
char* name)
"available in this build of Haiku to avoid possible patent
issues. To "
"enable this feature, you have to build Haiku yourself and
enable "
"certain options in the libfreetype configuration header."));
- subpixelAntialiasingDisabledLabel->SetViewColor(
- ui_color(B_PANEL_BACKGROUND_COLOR));
+
subpixelAntialiasingDisabledLabel->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
subpixelAntialiasingDisabledLabel->MakeEditable(false);
subpixelAntialiasingDisabledLabel->MakeSelectable(false);
#endif // !FT_CONFIG_OPTION_SUBPIXEL_RENDERING
@@ -172,9 +171,9 @@ AntialiasingSettingsView::~AntialiasingSettingsView()
void
AntialiasingSettingsView::AttachedToWindow()
{
- if (Parent() != NULL)
- SetViewColor(Parent()->ViewColor());
- else
+ AdoptParentColors();
+
+ if (Parent() == NULL)
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

fAntialiasingMenu->SetTargetForItems(this);
diff --git a/src/preferences/appearance/CurView.cpp
b/src/preferences/appearance/CurView.cpp
index b13021c..a5dd1eb 100644
--- a/src/preferences/appearance/CurView.cpp
+++ b/src/preferences/appearance/CurView.cpp
@@ -51,7 +51,7 @@
CurView::CurView(const BRect &frame, const char *name, int32 resize, int32
flags)
:BView(frame,name,resize,flags), settings(B_SIMPLE_DATA)
{
- SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
+ SetViewUIColor(B_PANEL_BACKGROUND_COLOR);


cursorset=new CursorSet("Default");
@@ -110,7 +110,7 @@ CurView::CurView(const BRect &frame, const char *name,
int32 resize, int32 flags
scrollview=new BScrollView("ScrollView",attrlist, B_FOLLOW_LEFT |
B_FOLLOW_TOP, 0, false, true);
AddChild(scrollview);
- scrollview->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
+ scrollview->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);

attrlist->SetSelectionMessage(new BMessage(ATTRIBUTE_CHOSEN));

@@ -413,7 +413,7 @@ BitmapView::BitmapView(const BPoint &pt,BMessage *message,
const BHandler *handl
{
SetFont(be_plain_font);
bitmap=NULL;
- SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
+ SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
SetDrawingMode(B_OP_ALPHA);
drawrect=Bounds().InsetByCopy(5,5);
}
diff --git a/src/preferences/appearance/FontMenu.cpp
b/src/preferences/appearance/FontMenu.cpp
index 9ec4771..855ce59 100644
--- a/src/preferences/appearance/FontMenu.cpp
+++ b/src/preferences/appearance/FontMenu.cpp
@@ -61,7 +61,7 @@
font.SetFamilyAndStyle(info.f_family, info.f_style);
font.SetSize(info.font_size);
SetFont(&font);
- SetViewColor(info.background_color);
+// SetViewColor(info.background_color);
InvalidateLayout();

// font style menus
diff --git a/src/preferences/appearance/FontView.cpp
b/src/preferences/appearance/FontView.cpp
index 3a686e4..f7bf9aa 100644
--- a/src/preferences/appearance/FontView.cpp
+++ b/src/preferences/appearance/FontView.cpp
@@ -63,7 +63,7 @@ FontView::FontView(const char* name)
:
BView(name, B_WILL_DRAW )
{
- SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
+ SetViewUIColor(B_PANEL_BACKGROUND_COLOR);

fPlainView = new FontSelectionView("plain", B_TRANSLATE("Plain font:"));
fBoldView = new FontSelectionView("bold", B_TRANSLATE("Bold font:"));
diff --git a/src/preferences/appearance/LookAndFeelSettingsView.cpp
b/src/preferences/appearance/LookAndFeelSettingsView.cpp
index 5e7f252..6947a43 100644
--- a/src/preferences/appearance/LookAndFeelSettingsView.cpp
+++ b/src/preferences/appearance/LookAndFeelSettingsView.cpp
@@ -143,10 +143,10 @@ LookAndFeelSettingsView::~LookAndFeelSettingsView()
void
LookAndFeelSettingsView::AttachedToWindow()
{
- if (Parent() != NULL)
- SetViewColor(Parent()->ViewColor());
- else
- SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
+ AdoptParentColors();
+
+ if (Parent() == NULL)
+ SetViewUIColor(B_PANEL_BACKGROUND_COLOR);

fDecorMenu->SetTargetForItems(this);
fDecorInfoButton->SetTarget(this);
diff --git a/src/preferences/appearance/MenuView.cpp
b/src/preferences/appearance/MenuView.cpp
index c843b24..bbce4fa 100644
--- a/src/preferences/appearance/MenuView.cpp
+++ b/src/preferences/appearance/MenuView.cpp
@@ -23,7 +23,7 @@
MenuView::MenuView(BRect frame, const char *name, int32 resize, int32 flags)
: BView(frame, name, resize, flags)
{
- SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
+ SetViewUIColor(B_PANEL_BACKGROUND_COLOR);

get_menu_info(&menuinfo);
revertinfo = menuinfo;
diff --git a/src/servers/app/Desktop.cpp b/src/servers/app/Desktop.cpp
index 5e45bc9..ee257fa 100644
--- a/src/servers/app/Desktop.cpp
+++ b/src/servers/app/Desktop.cpp
@@ -584,6 +584,20 @@ Desktop::BroadcastToAllWindows(int32 code)
}


+/*! \brief Send a quick message with one int32 data to all windows.
+*/
+void
+Desktop::BroadcastToAllWindows(int32 code, int32 data)
+{
+ AutoWriteLocker _(fWindowLock);
+
+ for (Window* window = fAllWindows.FirstWindow(); window != NULL;
+ window = window->NextWindow(kAllWindowList)) {
+ window->ServerWindow()->PostMessageWithData(code, data);
+ }
+}
+
+
filter_result
Desktop::KeyEvent(uint32 what, int32 key, int32 modifiers)
{
@@ -1649,6 +1663,33 @@ Desktop::FontsChanged(Window* window)


void
+Desktop::ColorChanged(Window* window, color_which which)
+{
+ // TODO: make which valid!
+ which = B_WINDOW_TAB_COLOR;
+
+ switch (which) {
+ case B_WINDOW_TAB_COLOR:
+ case B_WINDOW_TEXT_COLOR:
+ case B_WINDOW_INACTIVE_TAB_COLOR:
+ case B_WINDOW_INACTIVE_TEXT_COLOR:
+ case B_WINDOW_BORDER_COLOR:
+ case B_WINDOW_INACTIVE_BORDER_COLOR:
+ break;
+ default:
+ return;
+ }
+
+ AutoWriteLocker _(fWindowLock);
+
+ BRegion dirty;
+ window->ColorChanged(&dirty, which);
+
+ RebuildAndRedrawAfterWindowChange(window, dirty);
+}
+
+
+void
Desktop::SetWindowLook(Window* window, window_look newLook)
{
if (window->Look() == newLook)
diff --git a/src/servers/app/Desktop.h b/src/servers/app/Desktop.h
index c9b8e61..d924597 100644
--- a/src/servers/app/Desktop.h
+++ b/src/servers/app/Desktop.h
@@ -73,6 +73,7 @@ public:

void
BroadcastToAllApps(int32 code);
void
BroadcastToAllWindows(int32 code);
+ void
BroadcastToAllWindows(int32 code, int32 data);

filter_result KeyEvent(uint32 what, int32 key,
int32
modifiers);
@@ -191,6 +192,7 @@ public:
Window*
window);

void FontsChanged(Window*
window);
+ void ColorChanged(Window*
window, color_which which);

void SetWindowLook(Window*
window, window_look look);
void SetWindowFeel(Window*
window, window_feel feel);
diff --git a/src/servers/app/DesktopSettings.cpp
b/src/servers/app/DesktopSettings.cpp
index ae074f9..5af30c2 100644
--- a/src/servers/app/DesktopSettings.cpp
+++ b/src/servers/app/DesktopSettings.cpp
@@ -989,13 +989,9 @@ LockedDesktopSettings::SetUIColor(color_which which, const
rgb_color color)
{
bool changed = false;
fSettings->SetUIColor(which, color, &changed);
- //TODO: find way to send which color was set

- // SetUIColor is called far too often, and updates are potentially
- // heavy on the client redraws, so we want to be certain we are actually
- // responding to a change and not a superfluous set operation.
- if (changed)
- fDesktop->BroadcastToAllWindows(B_COLORS_UPDATED);
+ if (changed) // only send when color changed from previous value
+ fDesktop->BroadcastToAllWindows(B_COLORS_UPDATED, (int32)which);
}


diff --git a/src/servers/app/MessageLooper.cpp
b/src/servers/app/MessageLooper.cpp
index e801712..670a02d 100644
--- a/src/servers/app/MessageLooper.cpp
+++ b/src/servers/app/MessageLooper.cpp
@@ -94,6 +94,21 @@ MessageLooper::PostMessage(int32 code, bigtime_t timeout)
}


+/*!
+ \brief Send a message to the looper with an int32 attached
+ \param code ID code of the message to post
+ \param data int32 piece of data to include
+*/
+status_t
+MessageLooper::PostMessageWithData(int32 code, int32 data, bigtime_t timeout)
+{
+ BPrivate::LinkSender link(MessagePort());
+ link.StartMessage(code);
+ link.Attach<int32>(data);
+ return link.Flush(timeout);
+}
+
+
/*static*/
status_t
MessageLooper::WaitForQuit(sem_id semaphore, bigtime_t timeout)
diff --git a/src/servers/app/MessageLooper.h b/src/servers/app/MessageLooper.h
index 9cacd30..a5b2b5d 100644
--- a/src/servers/app/MessageLooper.h
+++ b/src/servers/app/MessageLooper.h
@@ -22,7 +22,11 @@ class MessageLooper : public BLocker {
virtual bool Run();
virtual void Quit();

- status_t PostMessage(int32 code, bigtime_t
timeout = B_INFINITE_TIMEOUT);
+ status_t PostMessage(int32 code,
+ bigtime_t timeout =
B_INFINITE_TIMEOUT);
+ status_t PostMessageWithData(int32 code, int32
data,
+ bigtime_t timeout =
B_INFINITE_TIMEOUT);
+
thread_id Thread() const { return fThread; }
bool IsQuitting() const { return fQuitting; }
sem_id DeathSemaphore() const { return
fDeathSemaphore; }
diff --git a/src/servers/app/ServerWindow.cpp b/src/servers/app/ServerWindow.cpp
index c006933..48c28e3 100644
--- a/src/servers/app/ServerWindow.cpp
+++ b/src/servers/app/ServerWindow.cpp
@@ -1035,7 +1035,13 @@ ServerWindow::_DispatchMessage(int32 code,
BPrivate::LinkReceiver& link)
// which seems like more trouble than it is
worth
// considering the response to this message will
// pretty much always just be an Invalidate()
+ int32 which = 0;
+ if (link.Read<int32>(&which) != B_OK)
+ break;
+// fDesktop->ColorChanged(fWindow, (color_which)which);
+
BMessage message(code);
+ message.AddInt32("which", which);
SendMessageToClient(&message);
break;
}
diff --git a/src/servers/app/Window.cpp b/src/servers/app/Window.cpp
index 117e67a..5360d72 100644
--- a/src/servers/app/Window.cpp
+++ b/src/servers/app/Window.cpp
@@ -1243,6 +1243,27 @@ Window::FontsChanged(BRegion* updateRegion)


void
+Window::ColorChanged(BRegion* updateRegion, color_which which)
+{
+ ::Decorator* decorator = Decorator();
+ if (decorator != NULL) {
+ switch (which) {
+ case B_WINDOW_TAB_COLOR:
+ case B_WINDOW_TEXT_COLOR:
+ case B_WINDOW_INACTIVE_TAB_COLOR:
+ case B_WINDOW_INACTIVE_TEXT_COLOR:
+ case B_WINDOW_BORDER_COLOR:
+ case B_WINDOW_INACTIVE_BORDER_COLOR:
+ decorator->ColorsChanged(updateRegion);
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+
+void
Window::SetLook(window_look look, BRegion* updateRegion)
{
fLook = look;
diff --git a/src/servers/app/Window.h b/src/servers/app/Window.h
index 6817df2..f68ce7b 100644
--- a/src/servers/app/Window.h
+++ b/src/servers/app/Window.h
@@ -243,6 +243,8 @@ public:
void HighlightDecorator(bool
active);

void FontsChanged(BRegion*
updateRegion);
+ void ColorChanged(BRegion*
updateRegion,
+
color_which which);

void SetLook(window_look
look,

BRegion* updateRegion);
diff --git a/src/servers/app/decorator/DecorManager.cpp
b/src/servers/app/decorator/DecorManager.cpp
index 59e6f53..3ea6a34 100644
--- a/src/servers/app/decorator/DecorManager.cpp
+++ b/src/servers/app/decorator/DecorManager.cpp
@@ -63,7 +63,7 @@ DecorAddOn::AllocateDecorator(Desktop* desktop,
DrawingEngine* engine,

DesktopSettings settings(desktop);
Decorator* decorator;
- decorator = _AllocateDecorator(settings, rect);
+ decorator = _AllocateDecorator(settings, rect, desktop);
desktop->UnlockSingleWindow();
if (!decorator)
return NULL;
@@ -94,9 +94,10 @@ DecorAddOn::GetDesktopListeners()


Decorator*
-DecorAddOn::_AllocateDecorator(DesktopSettings& settings, BRect rect)
+DecorAddOn::_AllocateDecorator(DesktopSettings& settings, BRect rect,
+ Desktop* desktop)
{
- return new (std::nothrow)SATDecorator(settings, rect);
+ return new (std::nothrow)SATDecorator(settings, rect, desktop);
}


diff --git a/src/servers/app/decorator/DecorManager.h
b/src/servers/app/decorator/DecorManager.h
index d5826c2..eeb8864 100644
--- a/src/servers/app/decorator/DecorManager.h
+++ b/src/servers/app/decorator/DecorManager.h
@@ -53,7 +53,7 @@ public:

protected:
virtual Decorator*
_AllocateDecorator(DesktopSettings& settings,
- BRect
rect);
+ BRect
rect, Desktop* desktop);

DesktopListenerList fDesktopListeners;

diff --git a/src/servers/app/decorator/Decorator.cpp
b/src/servers/app/decorator/Decorator.cpp
index 0823257..30bb4a5 100644
--- a/src/servers/app/decorator/Decorator.cpp
+++ b/src/servers/app/decorator/Decorator.cpp
@@ -20,6 +20,8 @@

#include <Region.h>

+#include "Desktop.h"
+#include "DesktopSettings.h"
#include "DrawingEngine.h"


@@ -68,7 +70,8 @@ Decorator::Tab::Tab()
\param settings DesktopSettings pointer.
\param frame Decorator frame rectangle
*/
-Decorator::Decorator(DesktopSettings& settings, BRect frame)
+Decorator::Decorator(DesktopSettings& settings, BRect frame,
+ Desktop* desktop)
:
fDrawingEngine(NULL),
fDrawState(),
@@ -87,6 +90,7 @@ Decorator::Decorator(DesktopSettings& settings, BRect frame)

fTopTab(NULL),

+ fDesktop(desktop),
fFootprintValid(false)
{
memset(&fRegionHighlights, HIGHLIGHT_NONE, sizeof(fRegionHighlights));
@@ -239,6 +243,19 @@ Decorator::FontsChanged(DesktopSettings& settings,
BRegion* updateRegion)
}


+/*! \brief Called when a system colors change.
+*/
+void
+Decorator::ColorsChanged(BRegion* updateRegion)
+{
+ _InvalidateBitmaps();
+ _InvalidateFootprint();
+
+ if (updateRegion != NULL)
+ updateRegion->Include(&GetFootprint());
+}
+
+
/*! \brief Sets the decorator's window look
\param look New value for the look
*/
@@ -496,6 +513,16 @@ Decorator::GetFootprint()
}


+/*! \brief Returns our Desktop object pointer
+*/
+::Desktop*
+Decorator::GetDesktop()
+{
+ return fDesktop;
+}
+
+
+
/*! \brief Performs hit-testing for the decorator.

The base class provides a basic implementation, recognizing only button
and
@@ -821,9 +848,13 @@ Decorator::DrawZoom(int32 tab)
rgb_color
Decorator::UIColor(color_which which)
{
+
+ DesktopSettings settings(fDesktop);
+ return settings.UIColor(which);
+
// TODO: for now - calling ui_color() from within the app_server
// will always return the default colors (as there is no be_app)
- return ui_color(which);
+// return ui_color(which);
}


diff --git a/src/servers/app/decorator/Decorator.h
b/src/servers/app/decorator/Decorator.h
index 186bd69..6ee13c4 100644
--- a/src/servers/app/decorator/Decorator.h
+++ b/src/servers/app/decorator/Decorator.h
@@ -20,6 +20,7 @@

#include "DrawState.h"

+class Desktop;
class DesktopSettings;
class DrawingEngine;
class ServerBitmap;
@@ -98,7 +99,8 @@ public:
};


Decorator(DesktopSettings& settings,
- BRect
frame);
+
BRect frame,
+
Desktop* desktop);
virtual ~Decorator();

virtual Decorator::Tab* AddTab(DesktopSettings& settings,
@@ -123,6 +125,8 @@ public:

void
FontsChanged(DesktopSettings& settings,

BRegion* updateRegion = NULL);
+ virtual void ColorsChanged(BRegion*
updateRegion = NULL);
+
void SetLook(int32 tab,
DesktopSettings& settings,

window_look look,

BRegion* updateRegion = NULL);
@@ -160,6 +164,7 @@ public:
virtual Region RegionAt(BPoint where, int32&
tab) const;

const BRegion& GetFootprint();
+ ::Desktop* GetDesktop();

void MoveBy(float x, float
y);
void MoveBy(BPoint offset);
@@ -281,6 +286,7 @@ protected:
BObjectList<Decorator::Tab> fTabList;

private:
+ Desktop* fDesktop;
BRegion fFootprint;
bool fFootprintValid : 1;

diff --git a/src/servers/app/decorator/DefaultDecorator.cpp
b/src/servers/app/decorator/DefaultDecorator.cpp
index c12853e..2174e75 100644
--- a/src/servers/app/decorator/DefaultDecorator.cpp
+++ b/src/servers/app/decorator/DefaultDecorator.cpp
@@ -72,9 +72,9 @@ blend_color_value(uint8 a, uint8 b, float position)

// TODO: get rid of DesktopSettings here, and introduce private accessor
// methods to the Decorator base class
-DefaultDecorator::DefaultDecorator(DesktopSettings& settings, BRect rect)
+DefaultDecorator::DefaultDecorator(DesktopSettings& settings, BRect rect,
Desktop* desktop)
:
- TabDecorator(settings, rect)
+ TabDecorator(settings, rect, desktop)
{
// TODO: If the decorator was created with a frame too small, it should
// resize itself!
diff --git a/src/servers/app/decorator/DefaultDecorator.h
b/src/servers/app/decorator/DefaultDecorator.h
index e8ae5d5..191ef0b 100644
--- a/src/servers/app/decorator/DefaultDecorator.h
+++ b/src/servers/app/decorator/DefaultDecorator.h
@@ -25,7 +25,7 @@ class ServerBitmap;
class DefaultDecorator: public TabDecorator {
public:

DefaultDecorator(DesktopSettings& settings,
- BRect
frame);
+ BRect
frame, Desktop* desktop);
virtual ~DefaultDecorator();

virtual void GetComponentColors(Component
component,
diff --git a/src/servers/app/decorator/TabDecorator.cpp
b/src/servers/app/decorator/TabDecorator.cpp
index 4435206..2e3b5b1 100644
--- a/src/servers/app/decorator/TabDecorator.cpp
+++ b/src/servers/app/decorator/TabDecorator.cpp
@@ -63,9 +63,10 @@ static const float kResizeKnobSize = 18.0;

// TODO: get rid of DesktopSettings here, and introduce private accessor
// methods to the Decorator base class
-TabDecorator::TabDecorator(DesktopSettings& settings, BRect frame)
+TabDecorator::TabDecorator(DesktopSettings& settings, BRect frame,
+ Desktop* desktop)
:
- Decorator(settings, frame),
+ Decorator(settings, frame, desktop),
fOldMovingTab(0, 0, -1, -1),
// focus color constants
kFocusFrameColor(settings.UIColor(B_WINDOW_BORDER_COLOR)),
@@ -210,6 +211,33 @@ TabDecorator::SetRegionHighlight(Region region, uint8
highlight,


void
+TabDecorator::ColorsChanged(BRegion* region)
+{
+ // Desktop is write locked, so be quick about it.
+ DesktopSettings settings(GetDesktop());
+
+ kFocusFrameColor =
settings.UIColor(B_WINDOW_BORDER_COLOR);
+ kFocusTabColor = settings.UIColor(B_WINDOW_TAB_COLOR);
+ kFocusTabColorLight = tint_color(kFocusTabColor,
+
(B_LIGHTEN_MAX_TINT + B_LIGHTEN_2_TINT) / 2);
+ kFocusTabColorBevel = tint_color(kFocusTabColor, B_LIGHTEN_2_TINT);
+ kFocusTabColorShadow = tint_color(kFocusTabColor,
+
(B_DARKEN_1_TINT + B_NO_TINT) / 2);
+ kFocusTextColor = settings.UIColor(B_WINDOW_TEXT_COLOR);
+
+ kNonFocusFrameColor =
settings.UIColor(B_WINDOW_INACTIVE_BORDER_COLOR);
+ kNonFocusTabColor =
settings.UIColor(B_WINDOW_INACTIVE_TAB_COLOR);
+ kNonFocusTabColorLight = tint_color(kNonFocusTabColor,
+
(B_LIGHTEN_MAX_TINT + B_LIGHTEN_2_TINT) / 2);
+ kNonFocusTabColorBevel = tint_color(kNonFocusTabColor,
B_LIGHTEN_2_TINT);
+ kNonFocusTabColorShadow = tint_color(kNonFocusTabColor,
+
(B_DARKEN_1_TINT + B_NO_TINT) / 2);
+ kNonFocusTextColor = settings.UIColor(B_WINDOW_INACTIVE_TEXT_COLOR);
+ Decorator::ColorsChanged(region);
+}
+
+
+void
TabDecorator::_DoLayout()
{
STRACE(("TabDecorator: Do Layout\n"));
diff --git a/src/servers/app/decorator/TabDecorator.h
b/src/servers/app/decorator/TabDecorator.h
index 17fb59f..7b36b50 100644
--- a/src/servers/app/decorator/TabDecorator.h
+++ b/src/servers/app/decorator/TabDecorator.h
@@ -26,7 +26,7 @@ class Desktop;
class TabDecorator: public Decorator {
public:

TabDecorator(DesktopSettings& settings,
- BRect
frame);
+ BRect
frame, Desktop* desktop);
virtual ~TabDecorator();

protected:
@@ -71,6 +71,7 @@ public:
uint8
highlight, BRegion* dirty,
int32
tab = -1);

+ virtual void ColorsChanged(BRegion*
updateRegion);
protected:
virtual void _DoLayout();
virtual void _DoTabLayout();
@@ -132,21 +133,24 @@ protected:
BRegion fTabsRegion;
BRect fOldMovingTab;

- const rgb_color kFocusFrameColor;
+ // These are only "virtually" constant, now.
+ // Maintaining the naming convention helps them stand out...
+ // and maintains compatibility for existing decorators.
+ rgb_color kFocusFrameColor;

- const rgb_color kFocusTabColor;
- const rgb_color kFocusTabColorLight;
- const rgb_color kFocusTabColorBevel;
- const rgb_color kFocusTabColorShadow;
- const rgb_color kFocusTextColor;
+ rgb_color kFocusTabColor;
+ rgb_color kFocusTabColorLight;
+ rgb_color kFocusTabColorBevel;
+ rgb_color kFocusTabColorShadow;
+ rgb_color kFocusTextColor;

- const rgb_color kNonFocusFrameColor;
+ rgb_color kNonFocusFrameColor;

- const rgb_color kNonFocusTabColor;
- const rgb_color kNonFocusTabColorLight;
- const rgb_color kNonFocusTabColorBevel;
- const rgb_color kNonFocusTabColorShadow;
- const rgb_color kNonFocusTextColor;
+ rgb_color kNonFocusTabColor;
+ rgb_color kNonFocusTabColorLight;
+ rgb_color kNonFocusTabColorBevel;
+ rgb_color kNonFocusTabColorShadow;
+ rgb_color kNonFocusTextColor;
};


diff --git a/src/servers/app/stackandtile/SATDecorator.cpp
b/src/servers/app/stackandtile/SATDecorator.cpp
index d4c1503..ef6a9ba 100644
--- a/src/servers/app/stackandtile/SATDecorator.cpp
+++ b/src/servers/app/stackandtile/SATDecorator.cpp
@@ -46,9 +46,10 @@ static const rgb_color kHighlightFrameColors[6] = {
{ 8, 8, 8, 255 }
};

-SATDecorator::SATDecorator(DesktopSettings& settings, BRect frame)
+SATDecorator::SATDecorator(DesktopSettings& settings, BRect frame,
+ Desktop* desktop)
:
- DefaultDecorator(settings, frame),
+ DefaultDecorator(settings, frame, desktop),
kHighlightTabColor(tint_color(kFocusTabColor, B_DARKEN_2_TINT)),
kHighlightTabColorLight(tint_color(kHighlightTabColor,
(B_LIGHTEN_MAX_TINT + B_LIGHTEN_2_TINT) / 2)),
@@ -60,6 +61,20 @@ SATDecorator::SATDecorator(DesktopSettings& settings, BRect
frame)


void
+SATDecorator::ColorsChanged(BRegion* region)
+{
+ kHighlightTabColor = tint_color(kFocusTabColor,
B_DARKEN_2_TINT);
+ kHighlightTabColorLight = tint_color(kHighlightTabColor,
+
(B_LIGHTEN_MAX_TINT + B_LIGHTEN_2_TINT) / 2);
+ kHighlightTabColorBevel = tint_color(kHighlightTabColor,
B_LIGHTEN_2_TINT);
+ kHighlightTabColorShadow= tint_color(kHighlightTabColor,
+
(B_DARKEN_1_TINT + B_NO_TINT) / 2);
+
+ DefaultDecorator::ColorsChanged(region);
+}
+
+
+void
SATDecorator::GetComponentColors(Component component, uint8 highlight,
ComponentColors _colors, Decorator::Tab* _tab)
{
diff --git a/src/servers/app/stackandtile/SATDecorator.h
b/src/servers/app/stackandtile/SATDecorator.h
index 9c2bcd4..9d815ab 100644
--- a/src/servers/app/stackandtile/SATDecorator.h
+++ b/src/servers/app/stackandtile/SATDecorator.h
@@ -15,6 +15,9 @@
#include "StackAndTile.h"


+class Desktop;
+
+
class SATDecorator : public DefaultDecorator {
public:
enum {
@@ -23,7 +26,9 @@ public:

public:

SATDecorator(DesktopSettings& settings,
- BRect
frame);
+ BRect
frame, Desktop* desktop);
+
+ virtual void ColorsChanged(BRegion*
updateRegion);

protected:
virtual void GetComponentColors(Component
component,
@@ -31,10 +36,10 @@ protected:

Decorator::Tab* tab = NULL);

private:
- const rgb_color kHighlightTabColor;
- const rgb_color kHighlightTabColorLight;
- const rgb_color kHighlightTabColorBevel;
- const rgb_color kHighlightTabColorShadow;
+ rgb_color kHighlightTabColor;
+ rgb_color kHighlightTabColorLight;
+ rgb_color kHighlightTabColorBevel;
+ rgb_color
kHighlightTabColorShadow;
};




Other related posts:

  • » [haiku-commits] BRANCH looncraz-github.setviewuicolor [8d3881fa69b7] in src: servers/app/decorator servers/app apps/aboutsystem kits/interface preferences/appearance - looncraz-github . setviewuicolor