preferences: Convert to using Set*UIColor.

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
Patches 0023-0037 from looncraz, unmodified.
This commit is contained in:
looncraz 2015-12-10 12:53:56 -06:00 committed by Augustin Cavalier
parent 1a8c00c14b
commit f0650dc98f
76 changed files with 376 additions and 352 deletions

View File

@ -28,7 +28,7 @@ BMPView::BMPView(const BRect &frame, const char *name, uint32 resizeMode,
: BView(frame, name, resizeMode, flags) : BView(frame, name, resizeMode, flags)
{ {
fSettings = settings; fSettings = settings;
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
BStringView *titleView = new BStringView("title", BStringView *titleView = new BStringView("title",
B_TRANSLATE("BMP image translator")); B_TRANSLATE("BMP image translator"));

View File

@ -24,7 +24,7 @@
ConfigView::ConfigView(uint32 flags) ConfigView::ConfigView(uint32 flags)
: BView("EXRTranslator Settings", flags) : BView("EXRTranslator Settings", flags)
{ {
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
BStringView *titleView = new BStringView("title", BStringView *titleView = new BStringView("title",
B_TRANSLATE("EXR image translator")); B_TRANSLATE("EXR image translator"));

View File

@ -49,7 +49,7 @@ GIFView::GIFView(TranslatorSettings* settings)
BGroupView("GIFView", B_VERTICAL), BGroupView("GIFView", B_VERTICAL),
fSettings(settings) fSettings(settings)
{ {
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fTitle = new BStringView("Title", B_TRANSLATE("GIF image translator")); fTitle = new BStringView("Title", B_TRANSLATE("GIF image translator"));
fTitle->SetFont(be_bold_font); fTitle->SetFont(be_bold_font);

View File

@ -22,7 +22,7 @@
ConfigView::ConfigView(const BRect &frame, uint32 resize, uint32 flags) ConfigView::ConfigView(const BRect &frame, uint32 resize, uint32 flags)
: BView(frame, B_TRANSLATE("HPGSTranslator Settings"), resize, flags) : BView(frame, B_TRANSLATE("HPGSTranslator Settings"), resize, flags)
{ {
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
font_height fontHeight; font_height fontHeight;
be_bold_font->GetHeight(&fontHeight); be_bold_font->GetHeight(&fontHeight);

View File

@ -683,7 +683,7 @@ TranslatorAboutView::TranslatorAboutView(const char* name)
BTextView* infoView = new BTextView("info"); BTextView* infoView = new BTextView("info");
infoView->SetText(sTranslatorInfo); infoView->SetText(sTranslatorInfo);
infoView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); infoView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
infoView->MakeEditable(false); infoView->MakeEditable(false);
BLayoutBuilder::Group<>(this, B_VERTICAL, 0) BLayoutBuilder::Group<>(this, B_VERTICAL, 0)

View File

@ -725,7 +725,7 @@ TranslatorAboutView::TranslatorAboutView(const char* name)
BTextView* infoView = new BTextView("info"); BTextView* infoView = new BTextView("info");
infoView->SetText(sTranslatorInfo); infoView->SetText(sTranslatorInfo);
infoView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); infoView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
infoView->MakeEditable(false); infoView->MakeEditable(false);
BLayoutBuilder::Group<>(this, B_VERTICAL, 0) BLayoutBuilder::Group<>(this, B_VERTICAL, 0)

View File

@ -24,7 +24,7 @@
ConfigView::ConfigView(const BRect &frame, uint32 resize, uint32 flags) ConfigView::ConfigView(const BRect &frame, uint32 resize, uint32 flags)
: BView(frame, B_TRANSLATE("PCXTranslator Settings"), resize, flags) : BView(frame, B_TRANSLATE("PCXTranslator Settings"), resize, flags)
{ {
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
BStringView *titleView = new BStringView("title", BStringView *titleView = new BStringView("title",
B_TRANSLATE("PCX image translator")); B_TRANSLATE("PCX image translator"));

View File

@ -32,7 +32,7 @@ PNGView::PNGView(const BRect &frame, const char *name, uint32 resizeMode,
: BView(frame, name, resizeMode, flags | B_FRAME_EVENTS) : BView(frame, name, resizeMode, flags | B_FRAME_EVENTS)
{ {
fSettings = settings; fSettings = settings;
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
BStringView *titleView = new BStringView("title", BStringView *titleView = new BStringView("title",
B_TRANSLATE("PNG image translator")); B_TRANSLATE("PNG image translator"));
@ -70,7 +70,7 @@ PNGView::PNGView(const BRect &frame, const char *name, uint32 resizeMode,
menuField->ResizeToPreferred(); menuField->ResizeToPreferred();
fCopyrightView = new BTextView("PNG copyright"); fCopyrightView = new BTextView("PNG copyright");
fCopyrightView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); fCopyrightView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fCopyrightView->SetLowColor(fCopyrightView->ViewColor()); fCopyrightView->SetLowColor(fCopyrightView->ViewColor());
fCopyrightView->MakeEditable(false); fCopyrightView->MakeEditable(false);
fCopyrightView->SetWordWrap(false); fCopyrightView->SetWordWrap(false);

View File

@ -451,7 +451,7 @@ public:
uint32 flags) : uint32 flags) :
BView(name, flags) BView(name, flags)
{ {
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fTitle = new BStringView("title", fTitle = new BStringView("title",
B_TRANSLATE("PPM image translator")); B_TRANSLATE("PPM image translator"));

View File

@ -25,7 +25,7 @@ const char* kShortName2 = B_TRANSLATE_MARK("RAWTranslator Settings");
ConfigView::ConfigView(uint32 flags) ConfigView::ConfigView(uint32 flags)
: BView(kShortName2, flags) : BView(kShortName2, flags)
{ {
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
BStringView *fTitle = new BStringView("title", B_TRANSLATE("RAW image translator")); BStringView *fTitle = new BStringView("title", B_TRANSLATE("RAW image translator"));
fTitle->SetFont(be_bold_font); fTitle->SetFont(be_bold_font);

View File

@ -20,7 +20,7 @@
ConfigView::ConfigView(const BRect &frame, uint32 resize, uint32 flags) ConfigView::ConfigView(const BRect &frame, uint32 resize, uint32 flags)
: BView(frame, B_TRANSLATE("RTF-Translator Settings"), resize, flags) : BView(frame, B_TRANSLATE("RTF-Translator Settings"), resize, flags)
{ {
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
BStringView *titleView = new BStringView("title", BStringView *titleView = new BStringView("title",
B_TRANSLATE("Rich Text Format (RTF) translator")); B_TRANSLATE("Rich Text Format (RTF) translator"));

View File

@ -123,7 +123,7 @@ SGIView::SGIView(const char* name, uint32 flags, TranslatorSettings* settings)
infoView->SetWordWrap(false); infoView->SetWordWrap(false);
infoView->MakeEditable(false); infoView->MakeEditable(false);
infoView->MakeResizable(true); infoView->MakeResizable(true);
infoView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); infoView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
BLayoutBuilder::Group<>(this, B_VERTICAL, 0) BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
.SetInsets(B_USE_DEFAULT_SPACING) .SetInsets(B_USE_DEFAULT_SPACING)

View File

@ -29,7 +29,7 @@ STXTView::STXTView(const BRect &frame, const char *name, uint32 resizeMode,
: BView(frame, name, resizeMode, flags) : BView(frame, name, resizeMode, flags)
{ {
fSettings = settings; fSettings = settings;
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
BStringView *titleView = new BStringView("title", BStringView *titleView = new BStringView("title",
B_TRANSLATE("StyledEdit file translator")); B_TRANSLATE("StyledEdit file translator"));

View File

@ -47,7 +47,7 @@ TGAView::TGAView(const char *name, uint32 flags, TranslatorSettings *settings)
BView(name, flags), BView(name, flags),
fSettings(settings) fSettings(settings)
{ {
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fTitle = new BStringView("title", B_TRANSLATE("TGA image translator")); fTitle = new BStringView("title", B_TRANSLATE("TGA image translator"));
fTitle->SetFont(be_bold_font); fTitle->SetFont(be_bold_font);

View File

@ -76,8 +76,8 @@ TIFFView::TIFFView(const char* name, uint32 flags,
{ {
fSettings = settings; fSettings = settings;
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
SetLowColor(ViewColor()); SetLowUIColor(ViewUIColor());
fTitle = new BStringView("title", B_TRANSLATE("TIFF image translator")); fTitle = new BStringView("title", B_TRANSLATE("TIFF image translator"));
fTitle->SetFont(be_bold_font); fTitle->SetFont(be_bold_font);

View File

@ -55,7 +55,7 @@ ConfigView::ConfigView(TranslatorSettings* settings)
: BGroupView(B_TRANSLATE("WebPTranslator Settings"), B_VERTICAL), : BGroupView(B_TRANSLATE("WebPTranslator Settings"), B_VERTICAL),
fSettings(settings) fSettings(settings)
{ {
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
BStringView* title = new BStringView("title", BStringView* title = new BStringView("title",
B_TRANSLATE("WebP image translator")); B_TRANSLATE("WebP image translator"));

View File

@ -51,7 +51,7 @@ WonderBrushView::WonderBrushView(const BRect &frame, const char *name,
: BView(frame, name, resize, flags), : BView(frame, name, resize, flags),
fSettings(settings) fSettings(settings)
{ {
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
BStringView *titleView = new BStringView("title", BStringView *titleView = new BStringView("title",
B_TRANSLATE("WonderBrush image translator")); B_TRANSLATE("WonderBrush image translator"));

View File

@ -32,6 +32,7 @@
#include <Roster.h> #include <Roster.h>
#include <String.h> #include <String.h>
#include <StringView.h> #include <StringView.h>
#include <TextView.h>
#include <ToolTip.h> #include <ToolTip.h>
#include <ToolTipManager.h> #include <ToolTipManager.h>
@ -57,23 +58,17 @@ static const char* kReplicantName = "MediaReplicant";
static const char* kSettingsFile = "x-vnd.Haiku-desklink"; static const char* kSettingsFile = "x-vnd.Haiku-desklink";
class VolumeToolTip : public BToolTip { class VolumeToolTip : public BTextToolTip {
public: public:
VolumeToolTip(int32 which = VOLUME_USE_MIXER) VolumeToolTip(int32 which = VOLUME_USE_MIXER)
: :
BTextToolTip(""),
fWhich(which) fWhich(which)
{ {
fView = new BStringView("", "");
} }
virtual ~VolumeToolTip() virtual ~VolumeToolTip()
{ {
delete fView;
}
virtual BView* View() const
{
return fView;
} }
virtual void AttachedToWindow() virtual void AttachedToWindow()
@ -91,17 +86,18 @@ public:
if (!Lock()) if (!Lock())
return; return;
BTextView* view = (BTextView*)View();
if (fMuteMessage.Length() != 0) if (fMuteMessage.Length() != 0)
fView->SetText(fMuteMessage.String()); view->SetText(fMuteMessage.String());
else { else {
MixerControl control; MixerControl control;
control.Connect(fWhich); control.Connect(fWhich);
BString text; BString text;
text.SetToFormat(B_TRANSLATE("%g dB"), control.Volume()); text.SetToFormat(B_TRANSLATE("%g dB"), control.Volume());
fView->SetText(text.String()); view->SetText(text.String());
} }
Unlock(); Unlock();
} }
@ -111,7 +107,6 @@ public:
} }
private: private:
BStringView* fView;
int32 fWhich; int32 fWhich;
BString fMuteMessage; BString fMuteMessage;
}; };
@ -211,9 +206,7 @@ MediaReplicant::Archive(BMessage* data, bool deep) const
void void
MediaReplicant::AttachedToWindow() MediaReplicant::AttachedToWindow()
{ {
BView* parent = Parent(); AdoptParentColors();
if (parent)
SetViewColor(parent->ViewColor());
BView::AttachedToWindow(); BView::AttachedToWindow();
} }

View File

@ -176,7 +176,7 @@ DynamicScrollView::DynamicScrollView(const char *name, BView *target)
fIsDocumentScroller(false) fIsDocumentScroller(false)
{ {
fContentBounds.Set(-1, -1, -1, -1); fContentBounds.Set(-1, -1, -1, -1);
SetViewColor(fTarget->ViewColor()); AdoptViewColors(fTarget);
target->MoveTo(B_ORIGIN); target->MoveTo(B_ORIGIN);
AddChild(target); AddChild(target);
} }
@ -359,7 +359,7 @@ DynamicScrollView::UpdateBars()
GroupView::GroupView(BRect frame, const char *name) GroupView::GroupView(BRect frame, const char *name)
: BView(frame, name, B_FOLLOW_NONE, B_WILL_DRAW) : BView(frame, name, B_FOLLOW_NONE, B_WILL_DRAW)
{ {
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
} }
@ -513,8 +513,7 @@ TitleView::TitleView(BRect frame, const char *title)
: BView(frame, title, B_FOLLOW_LEFT_RIGHT, B_WILL_DRAW) : BView(frame, title, B_FOLLOW_LEFT_RIGHT, B_WILL_DRAW)
{ {
fTitle = strdup(title); fTitle = strdup(title);
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); AdoptSystemColors();
SetLowColor(ViewColor());
} }
@ -530,7 +529,7 @@ TitleView::Draw(BRect updateRect)
BRect rect(Bounds()); BRect rect(Bounds());
SetDrawingMode(B_OP_COPY); SetDrawingMode(B_OP_COPY);
SetHighColor(240, 240, 240); SetHighColor(tint_color(ViewColor(), B_LIGHTEN_2_TINT));
DrawString(fTitle, BPoint(rect.left + 1, rect.bottom - 8)); DrawString(fTitle, BPoint(rect.left + 1, rect.bottom - 8));
SetDrawingMode(B_OP_OVER); SetDrawingMode(B_OP_OVER);
@ -897,7 +896,7 @@ DefaultMediaTheme::MakeViewFor(BParameterGroup& group, const BRect* hintRect)
if (parameterView == NULL) if (parameterView == NULL)
continue; continue;
parameterView->SetViewColor(view->ViewColor()); parameterView->AdoptViewColors(view);
// ToDo: dunno why this is needed, but the controls // ToDo: dunno why this is needed, but the controls
// sometimes (!) have a white background without it // sometimes (!) have a white background without it

View File

@ -1,11 +1,12 @@
/* /*
* Copyright 2002-2013 Haiku, Inc. All rights reserved. * Copyright 2002-2015 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* DarkWyrm, darkwyrm@earthlink.net * DarkWyrm, darkwyrm@earthlink.net
* Rene Gollent, rene@gollent.com * Rene Gollent, rene@gollent.com
* John Scipione, jscipione@gmail.com * John Scipione, jscipione@gmail.com
* Joseph Groover <looncraz@looncraz.net>
*/ */
@ -27,7 +28,7 @@
#include "APRWindow.h" #include "APRWindow.h"
#include "defs.h" #include "defs.h"
#include "ColorPreview.h" #include "ColorPreview.h"
#include "ColorSet.h" #include "Colors.h"
#include "ColorWhichItem.h" #include "ColorWhichItem.h"
@ -40,10 +41,9 @@
APRView::APRView(const char* name) APRView::APRView(const char* name)
: :
BView(name, B_WILL_DRAW), BView(name, B_WILL_DRAW)
fDefaultSet(ColorSet::DefaultColorSet())
{ {
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
#if 0 #if 0
fDecorMenu = new BMenu("Window Style"); fDecorMenu = new BMenu("Window Style");
@ -77,15 +77,14 @@ APRView::APRView(const char* name)
fAttrList = new BListView("AttributeList", B_SINGLE_SELECTION_LIST); fAttrList = new BListView("AttributeList", B_SINGLE_SELECTION_LIST);
fScrollView = new BScrollView("ScrollView", fAttrList, 0, false, true); 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(); int32 count = color_description_count();
for (int32 i = 0; i < count; i++) { for (int32 i = 0; i < count; i++) {
const ColorDescription& description = *get_color_description(i); const ColorDescription& description = *get_color_description(i);
const char* text = B_TRANSLATE_NOCOLLECT(description.text); const char* text = B_TRANSLATE_NOCOLLECT(description.text);
color_which which = description.which; color_which which = description.which;
fAttrList->AddItem(new ColorWhichItem(text, which, fAttrList->AddItem(new ColorWhichItem(text, which, ui_color(which)));
fCurrentSet.GetColor(which)));
} }
BRect wellrect(0, 0, 50, 50); BRect wellrect(0, 0, 50, 50);
@ -123,6 +122,7 @@ APRView::AttachedToWindow()
fColorPreview->SetTarget(this); fColorPreview->SetTarget(this);
fAttrList->Select(0); fAttrList->Select(0);
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
} }
@ -162,7 +162,7 @@ APRView::MessageReceived(BMessage *msg)
break; break;
fWhich = item->ColorWhich(); fWhich = item->ColorWhich();
rgb_color color = fCurrentSet.GetColor(fWhich); rgb_color color = ui_color(fWhich);
_SetCurrentColor(color); _SetCurrentColor(color);
break; break;
} }
@ -177,24 +177,22 @@ APRView::MessageReceived(BMessage *msg)
void void
APRView::LoadSettings() APRView::LoadSettings()
{ {
int32 count = color_description_count(); get_default_colors(&fDefaultColors);
for (int32 i = 0; i < count; i++) { get_current_colors(&fCurrentColors);
color_which which = get_color_description(i)->which; fPrevColors = fCurrentColors;
fCurrentSet.SetColor(which, ui_color(which));
}
fPrevSet = fCurrentSet;
} }
void void
APRView::SetDefaults() APRView::SetDefaults()
{ {
fCurrentSet = ColorSet::DefaultColorSet(); _SetUIColors(fDefaultColors);
_UpdatePreviews(fDefaultColors);
_UpdateAllColors(); // Use a default color that stands out to show errors clearly
rgb_color color = fDefaultColors.GetColor(ui_color_name(fWhich),
make_color(255, 0, 255));
rgb_color color = fCurrentSet.GetColor(fWhich);
fPicker->SetValue(color); fPicker->SetValue(color);
fColorPreview->SetColor(color); fColorPreview->SetColor(color);
fColorPreview->Invalidate(); fColorPreview->Invalidate();
@ -206,11 +204,11 @@ APRView::SetDefaults()
void void
APRView::Revert() APRView::Revert()
{ {
fCurrentSet = fPrevSet; _SetUIColors(fPrevColors);
_UpdatePreviews(fPrevColors);
_UpdateAllColors(); rgb_color color = fPrevColors.GetColor(ui_color_name(fWhich),
make_color(255, 0, 255));
rgb_color color = fCurrentSet.GetColor(fWhich);
fPicker->SetValue(color); fPicker->SetValue(color);
fColorPreview->SetColor(color); fColorPreview->SetColor(color);
fColorPreview->Invalidate(); fColorPreview->Invalidate();
@ -222,34 +220,22 @@ APRView::Revert()
bool bool
APRView::IsDefaultable() APRView::IsDefaultable()
{ {
for (int32 i = color_description_count() - 1; i >= 0; i--) { return !fDefaultColors.HasSameData(fCurrentColors);
color_which which = get_color_description(i)->which;
if (fCurrentSet.GetColor(which) != fDefaultSet.GetColor(which))
return true;
}
return false;
} }
bool bool
APRView::IsRevertable() APRView::IsRevertable()
{ {
for (int32 i = color_description_count() - 1; i >= 0; i--) { return !fPrevColors.HasSameData(fCurrentColors);
color_which which = get_color_description(i)->which;
if (fCurrentSet.GetColor(which) != fPrevSet.GetColor(which))
return true;
}
return false;
} }
void void
APRView::_SetCurrentColor(rgb_color color) APRView::_SetCurrentColor(rgb_color color)
{ {
fCurrentSet.SetColor(fWhich, color);
set_ui_color(fWhich, color); set_ui_color(fWhich, color);
fCurrentColors.SetColor(ui_color_name(fWhich), color);
int32 currentIndex = fAttrList->CurrentSelection(); int32 currentIndex = fAttrList->CurrentSelection();
ColorWhichItem* item = (ColorWhichItem*)fAttrList->ItemAt(currentIndex); ColorWhichItem* item = (ColorWhichItem*)fAttrList->ItemAt(currentIndex);
@ -265,13 +251,26 @@ APRView::_SetCurrentColor(rgb_color color)
void void
APRView::_UpdateAllColors() APRView::_SetUIColors(const BMessage& colors)
{ {
set_ui_colors(&colors);
fCurrentColors = colors;
}
void
APRView::_UpdatePreviews(const BMessage& colors)
{
rgb_color color;
for (int32 i = color_description_count() - 1; i >= 0; i--) { for (int32 i = color_description_count() - 1; i >= 0; i--) {
color_which which = get_color_description(i)->which; ColorWhichItem* item = static_cast<ColorWhichItem*>(fAttrList->ItemAt(i));
rgb_color color = fCurrentSet.GetColor(which); if (item == NULL)
set_ui_color(which, color); continue;
static_cast<ColorWhichItem*>(fAttrList->ItemAt(i))->SetColor(color);
color = colors.GetColor(ui_color_name(get_color_description(i)->which),
make_color(255, 0, 255));
item->SetColor(color);
fAttrList->InvalidateItem(i); fAttrList->InvalidateItem(i);
} }
} }

View File

@ -1,11 +1,12 @@
/* /*
* Copyright 2002-2012, Haiku. All rights reserved. * Copyright 2002-2015, Haiku. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* DarkWyrm (darkwyrm@earthlink.net) * DarkWyrm (darkwyrm@earthlink.net)
* Rene Gollent (rene@gollent.com) * Rene Gollent (rene@gollent.com)
* Stephan Aßmus <superstippi@gmx.de> * Stephan Aßmus <superstippi@gmx.de>
* Joseph Groover <looncraz@looncraz.net>
*/ */
#ifndef APR_VIEW_H_ #ifndef APR_VIEW_H_
#define APR_VIEW_H_ #define APR_VIEW_H_
@ -28,8 +29,6 @@
#include <DecorInfo.h> #include <DecorInfo.h>
#include "ColorSet.h"
class APRWindow; class APRWindow;
class ColorPreview; class ColorPreview;
@ -52,7 +51,8 @@ public:
private: private:
void _SetCurrentColor(rgb_color color); void _SetCurrentColor(rgb_color color);
void _UpdateAllColors(); void _SetUIColors(const BMessage& colors);
void _UpdatePreviews(const BMessage& colors);
private: private:
BColorControl* fPicker; BColorControl* fPicker;
@ -65,9 +65,9 @@ private:
ColorPreview* fColorPreview; ColorPreview* fColorPreview;
ColorSet fCurrentSet; BMessage fPrevColors;
ColorSet fPrevSet; BMessage fDefaultColors;
ColorSet fDefaultSet; BMessage fCurrentColors;
}; };
#endif // APR_VIEW_H_ #endif // APR_VIEW_H_

View File

@ -22,7 +22,7 @@ class AntialiasingSettingsView;
class FontView; class FontView;
class LookAndFeelSettingsView; class LookAndFeelSettingsView;
#include <stdio.h>
class APRWindow : public BWindow { class APRWindow : public BWindow {
public: public:
APRWindow(BRect frame); APRWindow(BRect frame);

View File

@ -26,6 +26,7 @@
#include <String.h> #include <String.h>
#include <TextView.h> #include <TextView.h>
#include "APRWindow.h" #include "APRWindow.h"
#undef B_TRANSLATION_CONTEXT #undef B_TRANSLATION_CONTEXT
@ -115,24 +116,17 @@ AntialiasingSettingsView::AntialiasingSettingsView(const char* name)
#ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING #ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
// subpixelAntialiasingDisabledLabel // subpixelAntialiasingDisabledLabel
BFont infoFont(*be_plain_font);
infoFont.SetFace(B_ITALIC_FACE);
rgb_color infoColor = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
B_DARKEN_4_TINT);
// TODO: Replace with layout friendly constructor once available. // TODO: Replace with layout friendly constructor once available.
BRect textBounds = Bounds(); fSubpixelAntialiasingDisabledLabel
BTextView* subpixelAntialiasingDisabledLabel = new BTextView( = new BTextView("unavailable label");
textBounds, "unavailable label", textBounds, &infoFont, &infoColor, fSubpixelAntialiasingDisabledLabel->SetText(B_TRANSLATE(
B_FOLLOW_NONE, B_WILL_DRAW | B_SUPPORTS_LAYOUT);
subpixelAntialiasingDisabledLabel->SetText(B_TRANSLATE(
"Subpixel based anti-aliasing in combination with glyph hinting is not " "Subpixel based anti-aliasing in combination with glyph hinting is not "
"available in this build of Haiku to avoid possible patent issues. To " "available in this build of Haiku to avoid possible patent issues. To "
"enable this feature, you have to build Haiku yourself and enable " "enable this feature, you have to build Haiku yourself and enable "
"certain options in the libfreetype configuration header.")); "certain options in the libfreetype configuration header."));
subpixelAntialiasingDisabledLabel->SetViewColor( fSubpixelAntialiasingDisabledLabel->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
ui_color(B_PANEL_BACKGROUND_COLOR)); fSubpixelAntialiasingDisabledLabel->MakeEditable(false);
subpixelAntialiasingDisabledLabel->MakeEditable(false); fSubpixelAntialiasingDisabledLabel->MakeSelectable(false);
subpixelAntialiasingDisabledLabel->MakeSelectable(false);
#endif // !FT_CONFIG_OPTION_SUBPIXEL_RENDERING #endif // !FT_CONFIG_OPTION_SUBPIXEL_RENDERING
BLayoutBuilder::Grid<>(this, B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING) BLayoutBuilder::Grid<>(this, B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING)
@ -147,7 +141,7 @@ AntialiasingSettingsView::AntialiasingSettingsView(const char* name)
#ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING #ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
// hinting+subpixel unavailable info // hinting+subpixel unavailable info
.Add(subpixelAntialiasingDisabledLabel, 0, 3, 2) .Add(fSubpixelAntialiasingDisabledLabel, 0, 3, 2)
#else #else
.Add(BSpaceLayoutItem::CreateGlue(), 0, 3, 2) .Add(BSpaceLayoutItem::CreateGlue(), 0, 3, 2)
#endif #endif
@ -157,6 +151,7 @@ AntialiasingSettingsView::AntialiasingSettingsView(const char* name)
_SetCurrentAntialiasing(); _SetCurrentAntialiasing();
_SetCurrentHinting(); _SetCurrentHinting();
_SetCurrentAverageWeight(); _SetCurrentAverageWeight();
_UpdateColors();
} }
@ -168,10 +163,10 @@ AntialiasingSettingsView::~AntialiasingSettingsView()
void void
AntialiasingSettingsView::AttachedToWindow() AntialiasingSettingsView::AttachedToWindow()
{ {
if (Parent() != NULL) AdoptParentColors();
SetViewColor(Parent()->ViewColor());
else if (Parent() == NULL)
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fAntialiasingMenu->SetTargetForItems(this); fAntialiasingMenu->SetTargetForItems(this);
fHintingMenu->SetTargetForItems(this); fHintingMenu->SetTargetForItems(this);
@ -224,6 +219,12 @@ AntialiasingSettingsView::MessageReceived(BMessage *msg)
Window()->PostMessage(kMsgUpdate); Window()->PostMessage(kMsgUpdate);
break; break;
} }
case B_COLORS_UPDATED:
{
if (msg->HasColor(ui_color_name(B_PANEL_BACKGROUND_COLOR)))
_UpdateColors();
break;
}
default: default:
BView::MessageReceived(msg); BView::MessageReceived(msg);
} }
@ -319,6 +320,23 @@ AntialiasingSettingsView::_SetCurrentAverageWeight()
} }
void
AntialiasingSettingsView::_UpdateColors()
{
#ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
rgb_color infoColor = disable_color(ui_color(B_PANEL_BACKGROUND_COLOR),
ui_color(B_PANEL_TEXT_COLOR));
BFont font;
uint32 mode = 0;
fSubpixelAntialiasingDisabledLabel->GetFontAndColor(&font, &mode);
font.SetFace(B_ITALIC_FACE);
fSubpixelAntialiasingDisabledLabel->SetFontAndColor(&font, mode,
&infoColor);
#endif
}
void void
AntialiasingSettingsView::SetDefaults() AntialiasingSettingsView::SetDefaults()
{ {

View File

@ -12,6 +12,7 @@ class BBox;
class BMenuField; class BMenuField;
class BPopUpMenu; class BPopUpMenu;
class BSlider; class BSlider;
class BTextView;
class AntialiasingSettingsView : public BView { class AntialiasingSettingsView : public BView {
@ -33,6 +34,7 @@ private:
void _BuildHintingMenu(); void _BuildHintingMenu();
void _SetCurrentHinting(); void _SetCurrentHinting();
void _SetCurrentAverageWeight(); void _SetCurrentAverageWeight();
void _UpdateColors();
protected: protected:
float fDivider; float fDivider;
@ -42,6 +44,7 @@ protected:
BMenuField* fHintingMenuField; BMenuField* fHintingMenuField;
BPopUpMenu* fHintingMenu; BPopUpMenu* fHintingMenu;
BSlider* fAverageWeightControl; BSlider* fAverageWeightControl;
BTextView* fSubpixelAntialiasingDisabledLabel;
bool fSavedSubpixelAntialiasing; bool fSavedSubpixelAntialiasing;
bool fCurrentSubpixelAntialiasing; bool fCurrentSubpixelAntialiasing;

View File

@ -1,61 +0,0 @@
/*
* Copyright 2001-2008, Haiku.
* Distributed under the terms of the MIT License.
*
* Authors:
* DarkWyrm <bpmagic@columbus.rr.com>
* Rene Gollent <rene@gollent.com>
*/
#ifndef COLOR_SET_H
#define COLOR_SET_H
#include <InterfaceDefs.h>
#include <Locker.h>
#include <Message.h>
#include <String.h>
#include <map>
typedef struct {
color_which which;
const char* text;
} ColorDescription;
const ColorDescription* get_color_description(int32 index);
int32 color_description_count(void);
/*!
\class ColorSet ColorSet.h
\brief Encapsulates GUI system colors
*/
class ColorSet : public BLocker {
public:
ColorSet();
ColorSet(const ColorSet &cs);
ColorSet & operator=(const ColorSet &cs);
rgb_color GetColor(int32 which);
void SetColor(color_which which, rgb_color value);
static ColorSet DefaultColorSet(void);
inline bool operator==(const ColorSet &other)
{
return fColors == other.fColors;
}
inline bool operator!=(const ColorSet &other)
{
return fColors != other.fColors;
}
private:
std::map<color_which, rgb_color> fColors;
};
#endif // COLOR_SET_H

View File

@ -1,11 +1,12 @@
/* /*
* Copyright 2001-2009, Haiku. * Copyright 2001-2015, Haiku.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* DarkWyrm <bpmagic@columbus.rr.com> * DarkWyrm <bpmagic@columbus.rr.com>
* Stephan Aßmus <superstippi@gmx.de> * Stephan Aßmus <superstippi@gmx.de>
* Rene Gollent <rene@gollent.com> * Rene Gollent <rene@gollent.com>
* Joseph Groover <looncraz@looncraz.net>
*/ */
@ -20,7 +21,7 @@
#include <Message.h> #include <Message.h>
#include <ServerReadOnlyMemory.h> #include <ServerReadOnlyMemory.h>
#include <String.h> #include <String.h>
#include "ColorSet.h" #include "Colors.h"
#undef B_TRANSLATION_CONTEXT #undef B_TRANSLATION_CONTEXT
@ -41,6 +42,10 @@ static ColorDescription sColorDescriptionTable[] = {
{ B_NAVIGATION_PULSE_COLOR, B_TRANSLATE_MARK("Navigation pulse") }, { B_NAVIGATION_PULSE_COLOR, B_TRANSLATE_MARK("Navigation pulse") },
{ B_SHINE_COLOR, B_TRANSLATE_MARK("Shine") }, { B_SHINE_COLOR, B_TRANSLATE_MARK("Shine") },
{ B_SHADOW_COLOR, B_TRANSLATE_MARK("Shadow") }, { B_SHADOW_COLOR, B_TRANSLATE_MARK("Shadow") },
{ B_LINK_TEXT_COLOR, B_TRANSLATE_MARK("Link text") },
{ B_LINK_HOVER_COLOR, B_TRANSLATE_MARK("Link hover") },
{ B_LINK_VISITED_COLOR, B_TRANSLATE_MARK("Link visited") },
{ B_LINK_ACTIVE_COLOR, B_TRANSLATE_MARK("Link active") },
{ B_MENU_BACKGROUND_COLOR, B_TRANSLATE_MARK("Menu background") }, { B_MENU_BACKGROUND_COLOR, B_TRANSLATE_MARK("Menu background") },
{ B_MENU_SELECTED_BACKGROUND_COLOR, { B_MENU_SELECTED_BACKGROUND_COLOR,
B_TRANSLATE_MARK("Selected menu item background") }, B_TRANSLATE_MARK("Selected menu item background") },
@ -91,70 +96,29 @@ color_description_count(void)
} }
// #pragma mark -
ColorSet::ColorSet()
{
}
/*!
\brief Copy constructor which does a massive number of assignments
\param cs Color set to copy from
*/
ColorSet::ColorSet(const ColorSet &cs)
{
*this = cs;
}
/*!
\brief Overloaded assignment operator which does a massive number of
assignments.
\param cs Color set to copy from
\return The new values assigned to the color set
*/
ColorSet&
ColorSet::operator=(const ColorSet &cs)
{
fColors = cs.fColors;
return *this;
}
/*!
\brief Assigns the default system colors to the passed ColorSet object
\param set The ColorSet object to set to defaults
*/
ColorSet
ColorSet::DefaultColorSet(void)
{
ColorSet set;
for (int i = 0; i < sColorDescriptionCount; i++) {
color_which which = get_color_description(i)->which;
set.fColors[which] =
BPrivate::kDefaultColors[color_which_to_index(which)];
}
return set;
}
/*!
\brief Assigns a value to a named color member
\param string name of the color to receive the value
\param value An rgb_color which is the new value of the member
*/
void void
ColorSet::SetColor(color_which which, rgb_color value) get_default_colors(BMessage* message)
{ {
fColors[which] = value; if (message == NULL)
return;
for (int32 index = 0; index < kColorWhichCount; ++index) {
color_which which = index_to_color_which(index);
message->AddColor(ui_color_name(which),
BPrivate::kDefaultColors[index]);
}
} }
rgb_color void
ColorSet::GetColor(int32 which) get_current_colors(BMessage* message)
{ {
return fColors[(color_which)which]; if (message == NULL)
return;
for (int32 index = 0; index < kColorWhichCount; ++index) {
color_which which = index_to_color_which(index);
message->AddColor(ui_color_name(which), ui_color(which));
}
} }

View File

@ -0,0 +1,29 @@
/*
* Copyright 2001-2015, Haiku.
* Distributed under the terms of the MIT License.
*
* Authors:
* DarkWyrm <bpmagic@columbus.rr.com>
* Rene Gollent <rene@gollent.com>
* Joseph Groover <looncraz@looncraz.net>
*/
#ifndef COLORS_H
#define COLORS_H
#include <InterfaceDefs.h>
typedef struct {
color_which which;
const char* text;
} ColorDescription;
const ColorDescription* get_color_description(int32 index);
int32 color_description_count(void);
void get_default_colors(BMessage* storage);
void get_current_colors(BMessage* storage);
#endif // COLORS_H

View File

@ -51,7 +51,7 @@
CurView::CurView(const BRect &frame, const char *name, int32 resize, int32 flags) CurView::CurView(const BRect &frame, const char *name, int32 resize, int32 flags)
:BView(frame,name,resize,flags), settings(B_SIMPLE_DATA) :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"); 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 | scrollview=new BScrollView("ScrollView",attrlist, B_FOLLOW_LEFT |
B_FOLLOW_TOP, 0, false, true); B_FOLLOW_TOP, 0, false, true);
AddChild(scrollview); AddChild(scrollview);
scrollview->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); scrollview->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
attrlist->SetSelectionMessage(new BMessage(ATTRIBUTE_CHOSEN)); attrlist->SetSelectionMessage(new BMessage(ATTRIBUTE_CHOSEN));
@ -413,7 +413,7 @@ BitmapView::BitmapView(const BPoint &pt,BMessage *message, const BHandler *handl
{ {
SetFont(be_plain_font); SetFont(be_plain_font);
bitmap=NULL; bitmap=NULL;
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
SetDrawingMode(B_OP_ALPHA); SetDrawingMode(B_OP_ALPHA);
drawrect=Bounds().InsetByCopy(5,5); drawrect=Bounds().InsetByCopy(5,5);
} }

View File

@ -61,7 +61,6 @@
font.SetFamilyAndStyle(info.f_family, info.f_style); font.SetFamilyAndStyle(info.f_family, info.f_style);
font.SetSize(info.font_size); font.SetSize(info.font_size);
SetFont(&font); SetFont(&font);
SetViewColor(info.background_color);
InvalidateLayout(); InvalidateLayout();
// font style menus // font style menus

View File

@ -64,7 +64,7 @@ FontView::FontView(const char* name)
: :
BView(name, B_WILL_DRAW ) 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:")); fPlainView = new FontSelectionView("plain", B_TRANSLATE("Plain font:"));
fBoldView = new FontSelectionView("bold", B_TRANSLATE("Bold font:")); fBoldView = new FontSelectionView("bold", B_TRANSLATE("Bold font:"));

View File

@ -18,7 +18,7 @@ Preference Appearance :
APRView.cpp APRView.cpp
APRWindow.cpp APRWindow.cpp
ColorPreview.cpp ColorPreview.cpp
ColorSet.cpp Colors.cpp
ColorWhichItem.cpp ColorWhichItem.cpp
# These are currently disabled while everything else is being worked on # These are currently disabled while everything else is being worked on
@ -41,7 +41,7 @@ DoCatalogs Appearance :
APRView.cpp APRView.cpp
APRWindow.cpp APRWindow.cpp
ColorPreview.cpp ColorPreview.cpp
ColorSet.cpp Colors.cpp
ColorWhichItem.cpp ColorWhichItem.cpp
LookAndFeelSettingsView.cpp LookAndFeelSettingsView.cpp
FontView.cpp FontView.cpp

View File

@ -132,10 +132,10 @@ LookAndFeelSettingsView::~LookAndFeelSettingsView()
void void
LookAndFeelSettingsView::AttachedToWindow() LookAndFeelSettingsView::AttachedToWindow()
{ {
if (Parent() != NULL) AdoptParentColors();
SetViewColor(Parent()->ViewColor());
else if (Parent() == NULL)
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fDecorMenu->SetTargetForItems(this); fDecorMenu->SetTargetForItems(this);
fDecorInfoButton->SetTarget(this); fDecorInfoButton->SetTarget(this);
@ -325,6 +325,8 @@ LookAndFeelSettingsView::IsRevertable()
void void
LookAndFeelSettingsView::Revert() LookAndFeelSettingsView::Revert()
{ {
_SetDecor(fSavedDecor); if (IsRevertable()) {
_SetDoubleScrollBarArrows(fSavedDoubleArrowsValue); _SetDecor(fSavedDecor);
_SetDoubleScrollBarArrows(fSavedDoubleArrowsValue);
}
} }

View File

@ -23,7 +23,7 @@
MenuView::MenuView(BRect frame, const char *name, int32 resize, int32 flags) MenuView::MenuView(BRect frame, const char *name, int32 resize, int32 flags)
: BView(frame, name, resize, flags) : BView(frame, name, resize, flags)
{ {
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
get_menu_info(&menuinfo); get_menu_info(&menuinfo);
revertinfo = menuinfo; revertinfo = menuinfo;

View File

@ -67,7 +67,7 @@ BluetoothDeviceView::BluetoothDeviceView(BRect frame, BluetoothDevice* bDevice,
fIcon = new BView(BRect(0, 0, 32 - 1, 32 - 1), "Icon", B_FOLLOW_ALL, fIcon = new BView(BRect(0, 0, 32 - 1, 32 - 1), "Icon", B_FOLLOW_ALL,
B_WILL_DRAW); B_WILL_DRAW);
fIcon->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); fIcon->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
SetBluetoothDevice(bDevice); SetBluetoothDevice(bDevice);

View File

@ -131,7 +131,7 @@ BluetoothSettingsView::AttachedToWindow()
if (Parent() != NULL) if (Parent() != NULL)
SetViewColor(Parent()->ViewColor()); SetViewColor(Parent()->ViewColor());
else else
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fPolicyMenu->SetTargetForItems(this); fPolicyMenu->SetTargetForItems(this);
fClassMenu->SetTargetForItems(this); fClassMenu->SetTargetForItems(this);

View File

@ -111,7 +111,7 @@ InquiryPanel::InquiryPanel(BRect frame, LocalDevice* lDevice)
fLocalDevice = LocalDevice::GetLocalDevice(); fLocalDevice = LocalDevice::GetLocalDevice();
fMessage = new BTextView("description", B_WILL_DRAW); fMessage = new BTextView("description", B_WILL_DRAW);
fMessage->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); fMessage->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fMessage->SetLowColor(fMessage->ViewColor()); fMessage->SetLowColor(fMessage->ViewColor());
fMessage->MakeEditable(false); fMessage->MakeEditable(false);
fMessage->MakeSelectable(false); fMessage->MakeSelectable(false);
@ -127,7 +127,7 @@ InquiryPanel::InquiryPanel(BRect frame, LocalDevice* lDevice)
fRemoteList->SetSelectionMessage(new BMessage(kMsgSelected)); fRemoteList->SetSelectionMessage(new BMessage(kMsgSelected));
fScrollView = new BScrollView("ScrollView", fRemoteList, 0, false, true); fScrollView = new BScrollView("ScrollView", fRemoteList, 0, false, true);
fScrollView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); fScrollView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
if (fLocalDevice != NULL) { if (fLocalDevice != NULL) {
fMessage->SetText(B_TRANSLATE( fMessage->SetText(B_TRANSLATE(

View File

@ -41,7 +41,7 @@ using namespace Bluetooth;
RemoteDevicesView::RemoteDevicesView(const char* name, uint32 flags) RemoteDevicesView::RemoteDevicesView(const char* name, uint32 flags)
: BView(name, flags) : BView(name, flags)
{ {
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
addButton = new BButton("add", B_TRANSLATE("Add" B_UTF8_ELLIPSIS), addButton = new BButton("add", B_TRANSLATE("Add" B_UTF8_ELLIPSIS),
new BMessage(kMsgAddDevices)); new BMessage(kMsgAddDevices));
@ -66,7 +66,7 @@ RemoteDevicesView::RemoteDevicesView(const char* name, uint32 flags)
fDeviceList = new BListView("DeviceList", B_SINGLE_SELECTION_LIST); fDeviceList = new BListView("DeviceList", B_SINGLE_SELECTION_LIST);
fScrollView = new BScrollView("ScrollView", fDeviceList, 0, false, true); fScrollView = new BScrollView("ScrollView", fDeviceList, 0, false, true);
fScrollView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); fScrollView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
SetLayout(new BGroupLayout(B_VERTICAL)); SetLayout(new BGroupLayout(B_VERTICAL));

View File

@ -36,6 +36,7 @@
#include <TranslationDefs.h> #include <TranslationDefs.h>
#include <TranslatorRoster.h> #include <TranslatorRoster.h>
#include "DataTranslations.h" #include "DataTranslations.h"
#include "DataTranslationsSettings.h" #include "DataTranslationsSettings.h"
#include "TranslatorListView.h" #include "TranslatorListView.h"
@ -166,7 +167,7 @@ DataTranslationsWindow::_ShowConfigView(int32 id)
if (ret != B_OK) if (ret != B_OK)
return ret; return ret;
fConfigView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); fConfigView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
// force config views to all have the same color // force config views to all have the same color
fRightBox->AddChild(fConfigView); fRightBox->AddChild(fConfigView);
@ -192,17 +193,18 @@ DataTranslationsWindow::_ShowInfoView()
} }
BTextView* view = new BTextView("info text"); fInfoText = new BTextView("info text");
view->MakeEditable(false); fInfoText->MakeEditable(false);
view->MakeSelectable(false); fInfoText->MakeSelectable(false);
view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); fInfoText->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
view->SetText(B_TRANSLATE( fInfoText->SetText(B_TRANSLATE(
"Use this control panel to set default values for translators, " "Use this control panel to set default values for translators, "
"to be used when no other settings are specified by an application.")); "to be used when no other settings are specified by an application."));
rgb_color textColor = ui_color(B_PANEL_TEXT_COLOR);
fInfoText->SetFontAndColor(be_plain_font, B_FONT_ALL, &textColor);
BGroupView* group = new BGroupView(B_VERTICAL); BGroupView* group = new BGroupView(B_VERTICAL);
group->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); group->AddChild(fInfoText);
group->AddChild(view);
float spacing = be_control_look->DefaultItemSpacing(); float spacing = be_control_look->DefaultItemSpacing();
group->GroupLayout()->SetInsets(spacing, spacing, spacing, spacing); group->GroupLayout()->SetInsets(spacing, spacing, spacing, spacing);
fRightBox->AddChild(group); fRightBox->AddChild(group);
@ -213,6 +215,7 @@ DataTranslationsWindow::_ShowInfoView()
void void
DataTranslationsWindow::_SetupViews() DataTranslationsWindow::_SetupViews()
{ {
fInfoText = NULL;
fConfigView = NULL; fConfigView = NULL;
// This is NULL until a translator is // This is NULL until a translator is
// selected from the listview // selected from the listview
@ -356,6 +359,18 @@ DataTranslationsWindow::MessageReceived(BMessage* message)
break; break;
} }
case B_COLORS_UPDATED:
{
if (fInfoText == NULL
|| fInfoText->Parent() == NULL)
break;
rgb_color color;
if (message->FindColor(ui_color_name(B_PANEL_TEXT_COLOR), &color) == B_OK)
fInfoText->SetFontAndColor(be_plain_font, B_FONT_ALL, &color);
break;
}
case B_TRANSLATOR_ADDED: case B_TRANSLATOR_ADDED:
{ {
int32 index = 0, id; int32 index = 0, id;

View File

@ -22,6 +22,7 @@
class BTranslatorReleaseDelegate; class BTranslatorReleaseDelegate;
class BTextView;
class DataTranslationsWindow : public BWindow { class DataTranslationsWindow : public BWindow {
@ -48,6 +49,7 @@ private:
BView* fConfigView; BView* fConfigView;
IconView* fIconView; IconView* fIconView;
BButton* fButton; BButton* fButton;
BTextView* fInfoText;
}; };

View File

@ -2,7 +2,7 @@ SubDir HAIKU_TOP src preferences datatranslations ;
UseLibraryHeaders lp_solve linprog alm ; UseLibraryHeaders lp_solve linprog alm ;
UsePrivateHeaders shared ; UsePrivateHeaders interface shared ;
Preference DataTranslations : Preference DataTranslations :
DataTranslations.cpp DataTranslations.cpp

View File

@ -218,7 +218,7 @@ ApplicationTypesWindow::ApplicationTypesWindow(const BMessage& settings)
fDescriptionLabel = new StringView(B_TRANSLATE("Description:"), NULL); fDescriptionLabel = new StringView(B_TRANSLATE("Description:"), NULL);
fDescriptionLabel->LabelView()->SetExplicitAlignment(labelAlignment); fDescriptionLabel->LabelView()->SetExplicitAlignment(labelAlignment);
fDescriptionView = new BTextView("description"); fDescriptionView = new BTextView("description");
fDescriptionView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); fDescriptionView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fDescriptionView->SetLowColor(fDescriptionView->ViewColor()); fDescriptionView->SetLowColor(fDescriptionView->ViewColor());
fDescriptionView->MakeEditable(false); fDescriptionView->MakeEditable(false);

View File

@ -129,7 +129,7 @@ AttributeWindow::AttributeWindow(FileTypesWindow* target, BMimeType& mimeType,
typeMenuField->SetAlignment(B_ALIGN_RIGHT); typeMenuField->SetAlignment(B_ALIGN_RIGHT);
// we must set the color manually when adding a menuField directly // we must set the color manually when adding a menuField directly
// into a window. // into a window.
typeMenuField->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); typeMenuField->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
typeMenuField->SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR)); typeMenuField->SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
fVisibleCheckBox = new BCheckBox("visible", B_TRANSLATE("Visible"), fVisibleCheckBox = new BCheckBox("visible", B_TRANSLATE("Visible"),

View File

@ -544,10 +544,7 @@ IconView::~IconView()
void void
IconView::AttachedToWindow() IconView::AttachedToWindow()
{ {
if (Parent()) AdoptParentColors();
SetViewColor(Parent()->ViewColor());
else
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
fTarget = this; fTarget = this;

View File

@ -52,7 +52,7 @@ add_font_selection_view(BGridLayout* layout, FontSelectionView* view,
FontView::FontView() FontView::FontView()
: BView("Fonts", B_WILL_DRAW ) : BView("Fonts", B_WILL_DRAW )
{ {
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fPlainView = new FontSelectionView("plain", B_TRANSLATE("Plain font:")); fPlainView = new FontSelectionView("plain", B_TRANSLATE("Plain font:"));
fBoldView = new FontSelectionView("bold", B_TRANSLATE("Bold font:")); fBoldView = new FontSelectionView("bold", B_TRANSLATE("Bold font:"));

View File

@ -54,7 +54,7 @@ CalibWin::CalibWin(BRect frame,const char *title, window_look look,
fView = new BView(Bounds(),"View3", B_FOLLOW_NONE,B_WILL_DRAW); fView = new BView(Bounds(),"View3", B_FOLLOW_NONE,B_WILL_DRAW);
fView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); fView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
// Adding object // Adding object
fBox->AddChild(fStringView3); fBox->AddChild(fStringView3);

View File

@ -88,7 +88,7 @@ JoyWin::JoyWin(BRect frame, const char *title)
B_WILL_DRAW | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE, B_WILL_DRAW | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE,
B_PLAIN_BORDER); B_PLAIN_BORDER);
box->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); box->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
// Add listViews with their scrolls // Add listViews with their scrolls
box->AddChild(new BScrollView("PortScroll", fGamePortL, box->AddChild(new BScrollView("PortScroll", fGamePortL,

View File

@ -21,7 +21,7 @@ MessageWin::MessageWin(BRect parentFrame, const char *title,
: BWindow(parentFrame ,title ,look ,feel, flags, workspace) : BWindow(parentFrame ,title ,look ,feel, flags, workspace)
{ {
fBox = new BBox(Bounds(), "", B_FOLLOW_ALL, B_WILL_DRAW, B_PLAIN_BORDER); fBox = new BBox(Bounds(), "", B_FOLLOW_ALL, B_WILL_DRAW, B_PLAIN_BORDER);
fBox->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); fBox->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fBox->SetLowColor(fBox->ViewColor()); fBox->SetLowColor(fBox->ViewColor());
// Rects for the text view // Rects for the text view
@ -32,7 +32,7 @@ MessageWin::MessageWin(BRect parentFrame, const char *title,
fText = new BTextView(outside, "message", insider, B_FOLLOW_NONE, B_WILL_DRAW); fText = new BTextView(outside, "message", insider, B_FOLLOW_NONE, B_WILL_DRAW);
fText->MakeEditable(false); fText->MakeEditable(false);
fText->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); fText->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fText->SetLowColor(fText->ViewColor()); fText->SetLowColor(fText->ViewColor());
fBox->AddChild(fText); fBox->AddChild(fText);

View File

@ -765,6 +765,7 @@ KeyboardLayoutView::_DrawKey(BView* view, BRect updateRect, const Key* key,
{ {
rgb_color base = key->dark ? kDarkColor : kBrightColor; rgb_color base = key->dark ? kDarkColor : kBrightColor;
rgb_color background = ui_color(B_PANEL_BACKGROUND_COLOR); rgb_color background = ui_color(B_PANEL_BACKGROUND_COLOR);
rgb_color keyLabelColor = make_color(0, 0, 0, 255);
key_kind keyKind = kNormalKey; key_kind keyKind = kNormalKey;
int32 deadKey = 0; int32 deadKey = 0;
bool secondDeadKey = false; bool secondDeadKey = false;
@ -795,7 +796,7 @@ KeyboardLayoutView::_DrawKey(BView* view, BRect updateRect, const Key* key,
_GetAbbreviatedKeyLabelIfNeeded(view, rect, key, text, sizeof(text)); _GetAbbreviatedKeyLabelIfNeeded(view, rect, key, text, sizeof(text));
be_control_look->DrawLabel(view, text, rect, updateRect, be_control_look->DrawLabel(view, text, rect, updateRect,
base, 0, BAlignment(B_ALIGN_CENTER, B_ALIGN_MIDDLE)); base, 0, BAlignment(B_ALIGN_CENTER, B_ALIGN_MIDDLE), &keyLabelColor);
} else if (key->shape == kEnterKeyShape) { } else if (key->shape == kEnterKeyShape) {
BRect topLeft = rect; BRect topLeft = rect;
BRect topRight = rect; BRect topRight = rect;
@ -875,7 +876,7 @@ KeyboardLayoutView::_DrawKey(BView* view, BRect updateRect, const Key* key,
// draw the button label // draw the button label
be_control_look->DrawLabel(view, text, rect, updateRect, be_control_look->DrawLabel(view, text, rect, updateRect,
base, 0, BAlignment(B_ALIGN_CENTER, B_ALIGN_MIDDLE)); base, 0, BAlignment(B_ALIGN_CENTER, B_ALIGN_MIDDLE), &keyLabelColor);
// reset the clipping region // reset the clipping region
view->ConstrainClippingRegion(NULL); view->ConstrainClippingRegion(NULL);

View File

@ -227,6 +227,8 @@ FormatSettingsView::FormatSettingsView()
.Add(BSpaceLayoutItem::CreateGlue(), 2, 1) .Add(BSpaceLayoutItem::CreateGlue(), 2, 1)
.View()); .View());
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
BLayoutBuilder::Group<>(this, B_VERTICAL) BLayoutBuilder::Group<>(this, B_VERTICAL)
.Add(fUseLanguageStringsCheckBox) .Add(fUseLanguageStringsCheckBox)
.Add(fDateBox) .Add(fDateBox)

View File

@ -85,6 +85,13 @@ AutoConfigView::AutoConfigView(AutoConfig &config)
void void
AutoConfigView::AttachedToWindow() AutoConfigView::AttachedToWindow()
{ {
// Resize the view to fit the contents properly
BRect rect = Bounds();
float newHeight = fNameView->Frame().bottom + 20 + 2;
newHeight += InnerFrame().top;
ResizeTo(rect.Width(), newHeight);
AdoptParentColors();
fEmailView->SetTarget(this); fEmailView->SetTarget(this);
fEmailView->MakeFocus(true); fEmailView->MakeFocus(true);
} }
@ -275,6 +282,8 @@ ServerSettingsView::ServerSettingsView(const account_info &info)
fOutboundEncrItemStart(NULL), fOutboundEncrItemStart(NULL),
fImageID(-1) fImageID(-1)
{ {
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fInboundAccount = true; fInboundAccount = true;
fOutboundAccount = true; fOutboundAccount = true;

View File

@ -28,6 +28,9 @@
#define B_TRANSLATION_CONTEXT "AutoConfigWindow" #define B_TRANSLATION_CONTEXT "AutoConfigWindow"
const float kSpacing = 10;
AutoConfigWindow::AutoConfigWindow(BRect rect, ConfigWindow *parent) AutoConfigWindow::AutoConfigWindow(BRect rect, ConfigWindow *parent)
: :
BWindow(rect, B_TRANSLATE("Create new account"), B_TITLED_WINDOW_LOOK, BWindow(rect, B_TRANSLATE("Create new account"), B_TITLED_WINDOW_LOOK,
@ -61,6 +64,10 @@ AutoConfigWindow::AutoConfigWindow(BRect rect, ConfigWindow *parent)
.Add(fBackButton) .Add(fBackButton)
.Add(fNextButton); .Add(fNextButton);
// determine the proper height
float newHeight = fMainView->Frame().bottom + buttonHeight + kSpacing * 2;
ResizeBy(0, newHeight - Bounds().Height());
// Add a shortcut to close the window using Command-W // Add a shortcut to close the window using Command-W
AddShortcut('W', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED)); AddShortcut('W', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));
} }

View File

@ -184,7 +184,7 @@ class BitmapView : public BView {
virtual void AttachedToWindow() virtual void AttachedToWindow()
{ {
SetViewColor(Parent()->ViewColor()); AdoptParentColors();
} }
virtual void Draw(BRect updateRect) virtual void Draw(BRect updateRect)
@ -229,7 +229,7 @@ ConfigWindow::ConfigWindow()
fConfigView = new BView(NULL, 0); fConfigView = new BView(NULL, 0);
fConfigView->SetLayout(new BGroupLayout(B_VERTICAL)); fConfigView->SetLayout(new BGroupLayout(B_VERTICAL));
fConfigView->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED)); fConfigView->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED));
fConfigView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); fConfigView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
BScrollView* scroller = new BScrollView(NULL, fAccountsListView, 0, BScrollView* scroller = new BScrollView(NULL, fAccountsListView, 0,
false, true); false, true);
@ -370,26 +370,34 @@ ConfigWindow::_BuildHowToView()
} }
} }
BTextView* text = new BTextView(NULL, B_WILL_DRAW); fHowToTextView = new BTextView(NULL, B_WILL_DRAW);
text->SetAlignment(B_ALIGN_CENTER); fHowToTextView->SetAlignment(B_ALIGN_CENTER);
text->SetText(B_TRANSLATE( fHowToTextView->SetText(B_TRANSLATE(
"Create a new account with the Add button.\n\n" "Create a new account with the Add button.\n\n"
"Remove an account with the Remove button on the selected item.\n\n" "Remove an account with the Remove button on the selected item.\n\n"
"Select an item in the list to change its settings.")); "Select an item in the list to change its settings."));
text->MakeEditable(false);
text->MakeSelectable(false); fHowToTextView->MakeEditable(false);
float fontFactor = be_plain_font->Size() / 12.0f; fHowToTextView->MakeSelectable(false);
text->SetExplicitPreferredSize(BSize(300 * fontFactor,400 * fontFactor));
BFont font(be_plain_font);
float fontFactor = font.Size() / 12.0f;
fHowToTextView->SetExplicitPreferredSize(
BSize(300 * fontFactor,400 * fontFactor));
rgb_color textColor = ui_color(B_PANEL_TEXT_COLOR);
fHowToTextView->SetFontAndColor(&font, B_FONT_ALL, &textColor);
BLayoutBuilder::Group<>(groupView, B_VERTICAL) BLayoutBuilder::Group<>(groupView, B_VERTICAL)
.AddGlue() .AddGlue()
.Add(text) .Add(fHowToTextView)
.AddGlue(); .AddGlue();
if (bitmapView != NULL) if (bitmapView != NULL)
groupView->GetLayout()->AddView(1, bitmapView); groupView->GetLayout()->AddView(1, bitmapView);
text->SetViewColor(groupView->ViewColor()); fHowToTextView->AdoptSystemColors();
return groupView; return groupView;
} }
@ -517,6 +525,17 @@ ConfigWindow::MessageReceived(BMessage *msg)
AutoConfigWindow *autoConfigWindow = NULL; AutoConfigWindow *autoConfigWindow = NULL;
switch (msg->what) { switch (msg->what) {
case B_COLORS_UPDATED:
{
rgb_color textColor;
if (msg->FindColor(ui_color_name(B_PANEL_TEXT_COLOR), &textColor)
== B_OK) {
BFont font;
fHowToTextView->SetFontAndColor(&font, 0, &textColor);
}
break;
}
case kMsgAccountsRightClicked: case kMsgAccountsRightClicked:
{ {
BPoint point; BPoint point;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2004-2012, Haiku Inc. All rights reserved. * Copyright 2004-2015, Haiku Inc. All rights reserved.
* Copyright 2001, Dr. Zoidberg Enterprises. All rights reserved. * Copyright 2001, Dr. Zoidberg Enterprises. All rights reserved.
* Copyright 2011, Clemens Zeidler <haiku@clemens-zeidler.de> * Copyright 2011, Clemens Zeidler <haiku@clemens-zeidler.de>
* *
@ -23,6 +23,7 @@ class BListView;
class BButton; class BButton;
class BMenuField; class BMenuField;
class BMailSettings; class BMailSettings;
class BTextView;
class CenterContainer; class CenterContainer;
@ -90,6 +91,7 @@ private:
BCheckBox* fCheckMailCheckBox; BCheckBox* fCheckMailCheckBox;
BTextControl* fIntervalControl; BTextControl* fIntervalControl;
BMenuField* fStatusModeField; BMenuField* fStatusModeField;
BTextView* fHowToTextView;
bool fSaveSettings; bool fSaveSettings;
BObjectList<BMailAccountSettings> fAccounts; BObjectList<BMailAccountSettings> fAccounts;

View File

@ -1,7 +1,7 @@
SubDir HAIKU_TOP src preferences mail ; SubDir HAIKU_TOP src preferences mail ;
UsePublicHeaders [ FDirName add-ons mail_daemon ] ; UsePublicHeaders [ FDirName add-ons mail_daemon ] ;
UsePrivateHeaders mail ; UsePrivateHeaders interface mail ;
SubDirHdrs [ FDirName $(HAIKU_TOP) headers os add-ons mail_daemon ] ; SubDirHdrs [ FDirName $(HAIKU_TOP) headers os add-ons mail_daemon ] ;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2012, Haiku, Inc. * Copyright 2003-2015, Haiku, Inc.
* Distributed under the terms of the MIT license. * Distributed under the terms of the MIT license.
* *
* Authors: * Authors:
@ -397,7 +397,7 @@ MediaWindow::_InitWindow()
fContentLayout = new BCardLayout(); fContentLayout = new BCardLayout();
new BView("content view", 0, fContentLayout); new BView("content view", 0, fContentLayout);
fContentLayout->Owner()->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); fContentLayout->Owner()->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fContentLayout->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET)); fContentLayout->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET));
fAudioView = new AudioSettingsView(); fAudioView = new AudioSettingsView();

View File

@ -141,10 +141,7 @@ MouseView::GetPreferredSize(float* _width, float* _height)
void void
MouseView::AttachedToWindow() MouseView::AttachedToWindow()
{ {
if (Parent() != NULL) AdoptParentColors();
SetViewColor(Parent()->ViewColor());
else
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
UpdateFromSettings(); UpdateFromSettings();
_CreateButtonsPicture(); _CreateButtonsPicture();

View File

@ -115,7 +115,7 @@ DialUpView::DialUpView(BRect frame)
{ {
BRect bounds = Bounds(); BRect bounds = Bounds();
// for caching // for caching
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
// add messenger to us so add-ons can contact us // add messenger to us so add-ons can contact us
BMessenger messenger(this); BMessenger messenger(this);

View File

@ -431,7 +431,7 @@ GeneralView::GeneralView(GeneralAddon *addon, BRect frame)
// B_FOLLOW_NONE, 0); // B_FOLLOW_NONE, 0);
// BControl automatically sets the view color when attached (we want that) // BControl automatically sets the view color when attached (we want that)
fAuthenticationView = new BView(rect, "authenticationView", B_FOLLOW_NONE, 0); fAuthenticationView = new BView(rect, "authenticationView", B_FOLLOW_NONE, 0);
fAuthenticationView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); fAuthenticationView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
rect = fAuthenticationView->Bounds(); rect = fAuthenticationView->Bounds();
rect.bottom = rect.top + 20; rect.bottom = rect.top + 20;
fUsername = new BTextControl(rect, "username", kLabelName, NULL, NULL); fUsername = new BTextControl(rect, "username", kLabelName, NULL, NULL);

View File

@ -50,7 +50,7 @@ TextRequestDialog::TextRequestDialog(const char *title, const char *information,
{ {
BRect rect = Bounds(); BRect rect = Bounds();
BView *backgroundView = new BView(rect, "background", B_FOLLOW_ALL_SIDES, 0); BView *backgroundView = new BView(rect, "background", B_FOLLOW_ALL_SIDES, 0);
backgroundView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); backgroundView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
rect.InsetBy(5, 5); rect.InsetBy(5, 5);
rect.bottom = rect.top; rect.bottom = rect.top;
// init // init
@ -60,7 +60,7 @@ TextRequestDialog::TextRequestDialog(const char *title, const char *information,
textRect.OffsetTo(0, 0); textRect.OffsetTo(0, 0);
fTextView = new BTextView(rect, "TextView", textRect, B_FOLLOW_NONE, fTextView = new BTextView(rect, "TextView", textRect, B_FOLLOW_NONE,
B_WILL_DRAW); B_WILL_DRAW);
fTextView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); fTextView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fTextView->MakeSelectable(false); fTextView->MakeSelectable(false);
fTextView->MakeEditable(false); fTextView->MakeEditable(false);
fTextView->SetText(information); fTextView->SetText(information);

View File

@ -130,7 +130,7 @@ NetworkWindow::NetworkWindow()
fAddOnShellView = new BView("add-on shell", 0, fAddOnShellView = new BView("add-on shell", 0,
new BGroupLayout(B_VERTICAL)); new BGroupLayout(B_VERTICAL));
fAddOnShellView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); fAddOnShellView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fInterfaceView = new InterfaceView(); fInterfaceView = new InterfaceView();

View File

@ -41,7 +41,7 @@ ServiceView::ServiceView(const char* name, const char* executable,
BTextView* descriptionView = new BTextView("description"); BTextView* descriptionView = new BTextView("description");
descriptionView->SetText(description); descriptionView->SetText(description);
descriptionView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); descriptionView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
descriptionView->MakeEditable(false); descriptionView->MakeEditable(false);
fEnableButton = new BButton("toggler", B_TRANSLATE("Enable"), fEnableButton = new BButton("toggler", B_TRANSLATE("Enable"),

View File

@ -47,10 +47,7 @@ void
MonitorView::AttachedToWindow() MonitorView::AttachedToWindow()
{ {
SetViewColor(B_TRANSPARENT_COLOR); SetViewColor(B_TRANSPARENT_COLOR);
if (Parent()) fBackgroundColor = ui_color(B_PANEL_BACKGROUND_COLOR);
fBackgroundColor = Parent()->ViewColor();
else
fBackgroundColor = ui_color(B_PANEL_BACKGROUND_COLOR);
_UpdateDPI(); _UpdateDPI();
} }
@ -156,6 +153,12 @@ void
MonitorView::MessageReceived(BMessage* message) MonitorView::MessageReceived(BMessage* message)
{ {
switch (message->what) { switch (message->what) {
case B_COLORS_UPDATED:
{
message->FindColor(ui_color_name(B_PANEL_BACKGROUND_COLOR),
&fBackgroundColor);
break;
}
case UPDATE_DESKTOP_MSG: case UPDATE_DESKTOP_MSG:
{ {
int32 width, height; int32 width, height;

View File

@ -35,7 +35,7 @@ RefreshWindow::RefreshWindow(BPoint position, float current, float min, float ma
max = floorf(max); max = floorf(max);
BView* topView = new BView(Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW); BView* topView = new BView(Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW);
topView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); topView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
AddChild(topView); AddChild(topView);
BRect rect = Bounds().InsetByCopy(8, 8); BRect rect = Bounds().InsetByCopy(8, 8);

View File

@ -21,7 +21,8 @@ static const char* kSettingsFileName = "Screen_data";
ScreenSettings::ScreenSettings() ScreenSettings::ScreenSettings()
{ {
fWindowFrame.Set(-1, -1, 450, 250); fWindowFrame.Set(0, 0, 450, 250);
BPoint offset;
BPath path; BPath path;
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) == B_OK) { if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) == B_OK) {
@ -29,8 +30,10 @@ ScreenSettings::ScreenSettings()
BFile file(path.Path(), B_READ_ONLY); BFile file(path.Path(), B_READ_ONLY);
if (file.InitCheck() == B_OK) if (file.InitCheck() == B_OK)
file.Read(&fWindowFrame, sizeof(BRect)); file.Read(&offset, sizeof(BPoint));
} }
fWindowFrame.OffsetBy(offset);
} }
@ -42,9 +45,11 @@ ScreenSettings::~ScreenSettings()
path.Append(kSettingsFileName); path.Append(kSettingsFileName);
BPoint offset = fWindowFrame.LeftTop();
BFile file(path.Path(), B_WRITE_ONLY | B_CREATE_FILE); BFile file(path.Path(), B_WRITE_ONLY | B_CREATE_FILE);
if (file.InitCheck() == B_OK) if (file.InitCheck() == B_OK)
file.Write(&fWindowFrame, sizeof(BRect)); file.Write(&offset, sizeof(BPoint));
} }

View File

@ -57,7 +57,7 @@ PasswordWindow::_Setup()
float spacing = be_control_look->DefaultItemSpacing(); float spacing = be_control_look->DefaultItemSpacing();
BView* topView = new BView("topView", B_WILL_DRAW); BView* topView = new BView("topView", B_WILL_DRAW);
topView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); topView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
topView->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED)); topView->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED));
BBox* networkBox = new BBox("networkBox"); BBox* networkBox = new BBox("networkBox");

View File

@ -61,7 +61,7 @@ PreviewView::PreviewView(const char* name)
fSaverView(NULL), fSaverView(NULL),
fNoPreview(NULL) fNoPreview(NULL)
{ {
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
BGroupLayout* layout = new BGroupLayout(B_VERTICAL); BGroupLayout* layout = new BGroupLayout(B_VERTICAL);
// We draw the "monitor" around the preview, hence the strange insets. // We draw the "monitor" around the preview, hence the strange insets.

View File

@ -35,7 +35,7 @@ ScreenCornerSelector::ScreenCornerSelector(BRect frame, const char* name,
fCurrentCorner(NO_CORNER), fCurrentCorner(NO_CORNER),
fPreviousCorner(-1) fPreviousCorner(-1)
{ {
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
} }

View File

@ -119,6 +119,7 @@ public:
void UpdateStatus(); void UpdateStatus();
private: private:
void _UpdateColors();
ScreenSaverSettings& fSettings; ScreenSaverSettings& fSettings;
uint32 fTurnOffScreenFlags; uint32 fTurnOffScreenFlags;
@ -129,6 +130,9 @@ private:
BCheckBox* fTurnOffCheckBox; BCheckBox* fTurnOffCheckBox;
TimeSlider* fTurnOffSlider; TimeSlider* fTurnOffSlider;
BTextView* fFadeNeverText;
BTextView* fFadeNowText;
BCheckBox* fPasswordCheckBox; BCheckBox* fPasswordCheckBox;
TimeSlider* fPasswordSlider; TimeSlider* fPasswordSlider;
BButton* fPasswordButton; BButton* fPasswordButton;
@ -208,7 +212,7 @@ TimeSlider::TimeSlider(const char* name, uint32 changedMessage,
BSlider(name, B_TRANSLATE("30 seconds"), new BMessage(changedMessage), BSlider(name, B_TRANSLATE("30 seconds"), new BMessage(changedMessage),
0, kTimeUnitCount - 1, B_HORIZONTAL, B_TRIANGLE_THUMB) 0, kTimeUnitCount - 1, B_HORIZONTAL, B_TRIANGLE_THUMB)
{ {
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
SetModificationMessage(new BMessage(updateMessage)); SetModificationMessage(new BMessage(updateMessage));
SetBarThickness(10); SetBarThickness(10);
} }
@ -268,7 +272,7 @@ FadeView::FadeView(const char* name, ScreenSaverSettings& settings)
BView(name, B_WILL_DRAW), BView(name, B_WILL_DRAW),
fSettings(settings) fSettings(settings)
{ {
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
font_height fontHeight; font_height fontHeight;
be_plain_font->GetHeight(&fontHeight); be_plain_font->GetHeight(&fontHeight);
@ -290,13 +294,14 @@ FadeView::FadeView(const char* name, ScreenSaverSettings& settings)
kMsgRunSliderUpdate); kMsgRunSliderUpdate);
// Turn Off // Turn Off
rgb_color textColor = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), rgb_color textColor = disable_color(ui_color(B_PANEL_TEXT_COLOR),
B_DISABLED_LABEL_TINT); ViewColor());
fTurnOffNotSupported = new BTextView("not_supported", be_plain_font, fTurnOffNotSupported = new BTextView("not_supported", be_plain_font,
&textColor, B_WILL_DRAW); &textColor, B_WILL_DRAW);
fTurnOffNotSupported->SetExplicitMinSize(BSize(B_SIZE_UNSET, fTurnOffNotSupported->SetExplicitMinSize(BSize(B_SIZE_UNSET,
3 + textHeight * 3)); 3 + textHeight * 3));
fTurnOffNotSupported->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); fTurnOffNotSupported->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fTurnOffNotSupported->MakeEditable(false); fTurnOffNotSupported->MakeEditable(false);
fTurnOffNotSupported->MakeSelectable(false); fTurnOffNotSupported->MakeSelectable(false);
fTurnOffNotSupported->SetText( fTurnOffNotSupported->SetText(
@ -331,23 +336,23 @@ FadeView::FadeView(const char* name, ScreenSaverSettings& settings)
fFadeNow = new ScreenCornerSelector(monitorRect, "FadeNow", fFadeNow = new ScreenCornerSelector(monitorRect, "FadeNow",
new BMessage(kMsgFadeCornerChanged), B_FOLLOW_NONE); new BMessage(kMsgFadeCornerChanged), B_FOLLOW_NONE);
BTextView* fadeNowText = new BTextView("FadeNowText", B_WILL_DRAW); fFadeNowText = new BTextView("FadeNowText", B_WILL_DRAW);
fadeNowText->SetExplicitMinSize(BSize(B_SIZE_UNSET, fFadeNowText->SetExplicitMinSize(BSize(B_SIZE_UNSET,
4 + textHeight * 4)); 4 + textHeight * 4));
fadeNowText->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); fFadeNowText->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fadeNowText->MakeEditable(false); fFadeNowText->MakeEditable(false);
fadeNowText->MakeSelectable(false); fFadeNowText->MakeSelectable(false);
fadeNowText->SetText(B_TRANSLATE("Fade now when mouse is here")); fFadeNowText->SetText(B_TRANSLATE("Fade now when mouse is here"));
fFadeNever = new ScreenCornerSelector(monitorRect, "FadeNever", fFadeNever = new ScreenCornerSelector(monitorRect, "FadeNever",
new BMessage(kMsgNeverFadeCornerChanged), B_FOLLOW_NONE); new BMessage(kMsgNeverFadeCornerChanged), B_FOLLOW_NONE);
BTextView* fadeNeverText = new BTextView("FadeNeverText", B_WILL_DRAW); fFadeNeverText = new BTextView("FadeNeverText", B_WILL_DRAW);
fadeNeverText->SetExplicitMinSize(BSize(B_SIZE_UNSET, fFadeNeverText->SetExplicitMinSize(BSize(B_SIZE_UNSET,
4 + textHeight * 4)); 4 + textHeight * 4));
fadeNeverText->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); fFadeNeverText->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fadeNeverText->MakeEditable(false); fFadeNeverText->MakeEditable(false);
fadeNeverText->MakeSelectable(false); fFadeNeverText->MakeSelectable(false);
fadeNeverText->SetText(B_TRANSLATE("Don't fade when mouse is here")); fFadeNeverText->SetText(B_TRANSLATE("Don't fade when mouse is here"));
box->AddChild(BLayoutBuilder::Group<>(B_VERTICAL, 0) box->AddChild(BLayoutBuilder::Group<>(B_VERTICAL, 0)
.SetInsets(B_USE_DEFAULT_SPACING, 0, B_USE_DEFAULT_SPACING, .SetInsets(B_USE_DEFAULT_SPACING, 0, B_USE_DEFAULT_SPACING,
@ -371,12 +376,12 @@ FadeView::FadeView(const char* name, ScreenSaverSettings& settings)
.AddGroup(B_HORIZONTAL) .AddGroup(B_HORIZONTAL)
.Add(fFadeNow) .Add(fFadeNow)
.AddGroup(B_VERTICAL, 0) .AddGroup(B_VERTICAL, 0)
.Add(fadeNowText) .Add(fFadeNowText)
.AddGlue() .AddGlue()
.End() .End()
.Add(fFadeNever) .Add(fFadeNever)
.AddGroup(B_VERTICAL, 0) .AddGroup(B_VERTICAL, 0)
.Add(fadeNeverText) .Add(fFadeNeverText)
.AddGlue() .AddGlue()
.End() .End()
.End() .End()
@ -388,6 +393,7 @@ FadeView::FadeView(const char* name, ScreenSaverSettings& settings)
B_USE_WINDOW_SPACING, 0) B_USE_WINDOW_SPACING, 0)
.Add(box) .Add(box)
.End(); .End();
} }
@ -412,6 +418,7 @@ FadeView::AttachedToWindow()
fPasswordCheckBox->SetValue(fSettings.LockEnable()); fPasswordCheckBox->SetValue(fSettings.LockEnable());
fPasswordSlider->SetTime(fSettings.PasswordTime()); fPasswordSlider->SetTime(fSettings.PasswordTime());
_UpdateColors();
UpdateTurnOffScreen(); UpdateTurnOffScreen();
UpdateStatus(); UpdateStatus();
} }
@ -421,6 +428,9 @@ void
FadeView::MessageReceived(BMessage *message) FadeView::MessageReceived(BMessage *message)
{ {
switch (message->what) { switch (message->what) {
case B_COLORS_UPDATED:
_UpdateColors();
break;
case kMsgRunSliderChanged: case kMsgRunSliderChanged:
case kMsgRunSliderUpdate: case kMsgRunSliderUpdate:
if (fRunSlider->Value() > fTurnOffSlider->Value()) if (fRunSlider->Value() > fTurnOffSlider->Value())
@ -530,6 +540,15 @@ FadeView::UpdateStatus()
} }
void
FadeView::_UpdateColors()
{
rgb_color color = ui_color(B_PANEL_TEXT_COLOR);
fFadeNeverText->SetFontAndColor(be_plain_font, 0, &color);
fFadeNowText->SetFontAndColor(be_plain_font, 0, &color);
}
// #pragma mark - ModulesView // #pragma mark - ModulesView
@ -546,7 +565,7 @@ ModulesView::ModulesView(const char* name, ScreenSaverSettings& settings)
fPreviewView(new PreviewView("preview")), fPreviewView(new PreviewView("preview")),
fScreenSaverTestTeam(-1) fScreenSaverTestTeam(-1)
{ {
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fScreenSaversListView->SetSelectionMessage( fScreenSaversListView->SetSelectionMessage(
new BMessage(kMsgSaverSelected)); new BMessage(kMsgSaverSelected));
@ -825,7 +844,7 @@ ModulesView::_OpenSaver()
#endif #endif
fSettingsView = new BView(rect, "SettingsView", B_FOLLOW_ALL, B_WILL_DRAW); fSettingsView = new BView(rect, "SettingsView", B_FOLLOW_ALL, B_WILL_DRAW);
fSettingsView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); fSettingsView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fSettingsBox->AddChild(fSettingsView); fSettingsBox->AddChild(fSettingsView);
BScreenSaver* saver = ScreenSaver(); BScreenSaver* saver = ScreenSaver();
@ -928,7 +947,7 @@ ScreenSaverWindow::ScreenSaverWindow()
// Create the topmost background view // Create the topmost background view
BView* topView = new BView("topView", B_WILL_DRAW); BView* topView = new BView("topView", B_WILL_DRAW);
topView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); topView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
topView->SetExplicitAlignment(BAlignment(B_ALIGN_USE_FULL_WIDTH, topView->SetExplicitAlignment(BAlignment(B_ALIGN_USE_FULL_WIDTH,
B_ALIGN_USE_FULL_HEIGHT)); B_ALIGN_USE_FULL_HEIGHT));
topView->SetExplicitMinSize(BSize(fMinWidth, fMinHeight)); topView->SetExplicitMinSize(BSize(fMinWidth, fMinHeight));

View File

@ -250,7 +250,7 @@ TAnalogClock::DrawClock()
BRect bounds = Bounds(); BRect bounds = Bounds();
// clear background // clear background
rgb_color background = ui_color(B_PANEL_BACKGROUND_COLOR); rgb_color background = ViewColor();
SetHighColor(background); SetHighColor(background);
FillRect(bounds); FillRect(bounds);

View File

@ -41,7 +41,8 @@ TTimeBaseView::Pulse()
void void
TTimeBaseView::AttachedToWindow() TTimeBaseView::AttachedToWindow()
{ {
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
SetLowUIColor(ViewUIColor());
} }

View File

@ -80,8 +80,7 @@ ClockView::~ClockView()
void void
ClockView::AttachedToWindow() ClockView::AttachedToWindow()
{ {
if (Parent()) AdoptParentColors();
SetViewColor(Parent()->ViewColor());
fShowClock->SetTarget(this); fShowClock->SetTarget(this);
fShowSeconds->SetTarget(this); fShowSeconds->SetTarget(this);

View File

@ -95,9 +95,12 @@ TTimeEdit::DrawSection(uint32 index, BRect bounds, bool hasFocus)
{ {
if (fFieldPositions == NULL || index * 2 + 1 >= (uint32)fFieldPosCount) if (fFieldPositions == NULL || index * 2 + 1 >= (uint32)fFieldPosCount)
return; return;
SetLowColor(ViewColor());
if (hasFocus) if (hasFocus)
SetLowColor(tint_color(ViewColor(), B_DARKEN_1_TINT)); SetLowColor(mix_color(ui_color(B_CONTROL_HIGHLIGHT_COLOR),
ViewColor(), 192));
else
SetLowColor(ViewColor());
BString field; BString field;
fText.CopyCharsInto(field, fFieldPositions[index * 2], fText.CopyCharsInto(field, fFieldPositions[index * 2],
@ -106,7 +109,7 @@ TTimeEdit::DrawSection(uint32 index, BRect bounds, bool hasFocus)
BPoint point(bounds.LeftBottom()); BPoint point(bounds.LeftBottom());
point.y -= bounds.Height() / 2.0 - 6.0; point.y -= bounds.Height() / 2.0 - 6.0;
point.x += (bounds.Width() - StringWidth(field)) / 2; point.x += (bounds.Width() - StringWidth(field)) / 2;
SetHighColor(0, 0, 0, 255); SetHighUIColor(B_PANEL_TEXT_COLOR);
FillRect(bounds, B_SOLID_LOW); FillRect(bounds, B_SOLID_LOW);
DrawString(field, point); DrawString(field, point);
} }
@ -125,7 +128,7 @@ TTimeEdit::DrawSeparator(uint32 index, BRect bounds)
BPoint point(bounds.LeftBottom()); BPoint point(bounds.LeftBottom());
point.y -= bounds.Height() / 2.0 - 6.0; point.y -= bounds.Height() / 2.0 - 6.0;
point.x += (bounds.Width() - StringWidth(field)) / 2; point.x += (bounds.Width() - StringWidth(field)) / 2;
SetHighColor(0, 0, 0, 255); SetHighUIColor(B_PANEL_TEXT_COLOR);
DrawString(field, point); DrawString(field, point);
} }
@ -471,9 +474,11 @@ TDateEdit::DrawSection(uint32 index, BRect bounds, bool hasFocus)
if (fFieldPositions == NULL || index * 2 + 1 >= (uint32)fFieldPosCount) if (fFieldPositions == NULL || index * 2 + 1 >= (uint32)fFieldPosCount)
return; return;
SetLowColor(ViewColor());
if (hasFocus) if (hasFocus)
SetLowColor(tint_color(ViewColor(), B_DARKEN_1_TINT)); SetLowColor(mix_color(ui_color(B_CONTROL_HIGHLIGHT_COLOR),
ViewColor(), 192));
else
SetLowColor(ViewColor());
BString field; BString field;
fText.CopyCharsInto(field, fFieldPositions[index * 2], fText.CopyCharsInto(field, fFieldPositions[index * 2],
@ -482,7 +487,7 @@ TDateEdit::DrawSection(uint32 index, BRect bounds, bool hasFocus)
BPoint point(bounds.LeftBottom()); BPoint point(bounds.LeftBottom());
point.y -= bounds.Height() / 2.0 - 6.0; point.y -= bounds.Height() / 2.0 - 6.0;
point.x += (bounds.Width() - StringWidth(field)) / 2; point.x += (bounds.Width() - StringWidth(field)) / 2;
SetHighColor(0, 0, 0, 255); SetHighUIColor(B_PANEL_TEXT_COLOR);
FillRect(bounds, B_SOLID_LOW); FillRect(bounds, B_SOLID_LOW);
DrawString(field, point); DrawString(field, point);
} }
@ -504,7 +509,7 @@ TDateEdit::DrawSeparator(uint32 index, BRect bounds)
BPoint point(bounds.LeftBottom()); BPoint point(bounds.LeftBottom());
point.y -= bounds.Height() / 2.0 - 6.0; point.y -= bounds.Height() / 2.0 - 6.0;
point.x += (bounds.Width() - StringWidth(field)) / 2; point.x += (bounds.Width() - StringWidth(field)) / 2;
SetHighColor(0, 0, 0, 255); SetHighUIColor(B_PANEL_TEXT_COLOR);
DrawString(field, point); DrawString(field, point);
} }

View File

@ -65,8 +65,7 @@ DateTimeView::~DateTimeView()
void void
DateTimeView::AttachedToWindow() DateTimeView::AttachedToWindow()
{ {
if (Parent()) AdoptParentColors();
SetViewColor(Parent()->ViewColor());
if (!fInitialized) { if (!fInitialized) {
fInitialized = true; fInitialized = true;

View File

@ -41,8 +41,7 @@ TSectionEdit::~TSectionEdit()
void void
TSectionEdit::AttachedToWindow() TSectionEdit::AttachedToWindow()
{ {
if (Parent()) AdoptParentColors();
SetViewColor(Parent()->ViewColor());
} }

View File

@ -35,8 +35,7 @@ TTZDisplay::~TTZDisplay()
void void
TTZDisplay::AttachedToWindow() TTZDisplay::AttachedToWindow()
{ {
if (Parent()) AdoptParentColors();
SetViewColor(Parent()->ViewColor());
} }

View File

@ -116,8 +116,7 @@ void
TimeZoneView::AttachedToWindow() TimeZoneView::AttachedToWindow()
{ {
BView::AttachedToWindow(); BView::AttachedToWindow();
if (Parent()) AdoptParentColors();
SetViewColor(Parent()->ViewColor());
if (!fInitialized) { if (!fInitialized) {
fInitialized = true; fInitialized = true;