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)
{
fSettings = settings;
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
BStringView *titleView = new BStringView("title",
B_TRANSLATE("BMP image translator"));

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -25,7 +25,7 @@ const char* kShortName2 = B_TRANSLATE_MARK("RAWTranslator Settings");
ConfigView::ConfigView(uint32 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"));
fTitle->SetFont(be_bold_font);

View File

@ -20,7 +20,7 @@
ConfigView::ConfigView(const BRect &frame, uint32 resize, uint32 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",
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->MakeEditable(false);
infoView->MakeResizable(true);
infoView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
infoView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
.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)
{
fSettings = settings;
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
BStringView *titleView = new BStringView("title",
B_TRANSLATE("StyledEdit file translator"));

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -176,7 +176,7 @@ DynamicScrollView::DynamicScrollView(const char *name, BView *target)
fIsDocumentScroller(false)
{
fContentBounds.Set(-1, -1, -1, -1);
SetViewColor(fTarget->ViewColor());
AdoptViewColors(fTarget);
target->MoveTo(B_ORIGIN);
AddChild(target);
}
@ -359,7 +359,7 @@ DynamicScrollView::UpdateBars()
GroupView::GroupView(BRect frame, const char *name)
: 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)
{
fTitle = strdup(title);
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetLowColor(ViewColor());
AdoptSystemColors();
}
@ -530,7 +529,7 @@ TitleView::Draw(BRect updateRect)
BRect rect(Bounds());
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));
SetDrawingMode(B_OP_OVER);
@ -897,7 +896,7 @@ DefaultMediaTheme::MakeViewFor(BParameterGroup& group, const BRect* hintRect)
if (parameterView == NULL)
continue;
parameterView->SetViewColor(view->ViewColor());
parameterView->AdoptViewColors(view);
// ToDo: dunno why this is needed, but the controls
// 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.
*
* Authors:
* DarkWyrm, darkwyrm@earthlink.net
* Rene Gollent, rene@gollent.com
* John Scipione, jscipione@gmail.com
* Joseph Groover <looncraz@looncraz.net>
*/
@ -27,7 +28,7 @@
#include "APRWindow.h"
#include "defs.h"
#include "ColorPreview.h"
#include "ColorSet.h"
#include "Colors.h"
#include "ColorWhichItem.h"
@ -40,10 +41,9 @@
APRView::APRView(const char* name)
:
BView(name, B_WILL_DRAW),
fDefaultSet(ColorSet::DefaultColorSet())
BView(name, B_WILL_DRAW)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
#if 0
fDecorMenu = new BMenu("Window Style");
@ -77,15 +77,14 @@ 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++) {
const ColorDescription& description = *get_color_description(i);
const char* text = B_TRANSLATE_NOCOLLECT(description.text);
color_which which = description.which;
fAttrList->AddItem(new ColorWhichItem(text, which,
fCurrentSet.GetColor(which)));
fAttrList->AddItem(new ColorWhichItem(text, which, ui_color(which)));
}
BRect wellrect(0, 0, 50, 50);
@ -123,6 +122,7 @@ APRView::AttachedToWindow()
fColorPreview->SetTarget(this);
fAttrList->Select(0);
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
}
@ -162,7 +162,7 @@ APRView::MessageReceived(BMessage *msg)
break;
fWhich = item->ColorWhich();
rgb_color color = fCurrentSet.GetColor(fWhich);
rgb_color color = ui_color(fWhich);
_SetCurrentColor(color);
break;
}
@ -177,24 +177,22 @@ APRView::MessageReceived(BMessage *msg)
void
APRView::LoadSettings()
{
int32 count = color_description_count();
for (int32 i = 0; i < count; i++) {
color_which which = get_color_description(i)->which;
fCurrentSet.SetColor(which, ui_color(which));
}
fPrevSet = fCurrentSet;
get_default_colors(&fDefaultColors);
get_current_colors(&fCurrentColors);
fPrevColors = fCurrentColors;
}
void
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);
fColorPreview->SetColor(color);
fColorPreview->Invalidate();
@ -206,11 +204,11 @@ APRView::SetDefaults()
void
APRView::Revert()
{
fCurrentSet = fPrevSet;
_SetUIColors(fPrevColors);
_UpdatePreviews(fPrevColors);
_UpdateAllColors();
rgb_color color = fCurrentSet.GetColor(fWhich);
rgb_color color = fPrevColors.GetColor(ui_color_name(fWhich),
make_color(255, 0, 255));
fPicker->SetValue(color);
fColorPreview->SetColor(color);
fColorPreview->Invalidate();
@ -222,34 +220,22 @@ APRView::Revert()
bool
APRView::IsDefaultable()
{
for (int32 i = color_description_count() - 1; i >= 0; i--) {
color_which which = get_color_description(i)->which;
if (fCurrentSet.GetColor(which) != fDefaultSet.GetColor(which))
return true;
}
return false;
return !fDefaultColors.HasSameData(fCurrentColors);
}
bool
APRView::IsRevertable()
{
for (int32 i = color_description_count() - 1; i >= 0; i--) {
color_which which = get_color_description(i)->which;
if (fCurrentSet.GetColor(which) != fPrevSet.GetColor(which))
return true;
}
return false;
return !fPrevColors.HasSameData(fCurrentColors);
}
void
APRView::_SetCurrentColor(rgb_color color)
{
fCurrentSet.SetColor(fWhich, color);
set_ui_color(fWhich, color);
fCurrentColors.SetColor(ui_color_name(fWhich), color);
int32 currentIndex = fAttrList->CurrentSelection();
ColorWhichItem* item = (ColorWhichItem*)fAttrList->ItemAt(currentIndex);
@ -265,13 +251,26 @@ APRView::_SetCurrentColor(rgb_color color)
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--) {
color_which which = get_color_description(i)->which;
rgb_color color = fCurrentSet.GetColor(which);
set_ui_color(which, color);
static_cast<ColorWhichItem*>(fAttrList->ItemAt(i))->SetColor(color);
ColorWhichItem* item = static_cast<ColorWhichItem*>(fAttrList->ItemAt(i));
if (item == NULL)
continue;
color = colors.GetColor(ui_color_name(get_color_description(i)->which),
make_color(255, 0, 255));
item->SetColor(color);
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.
*
* Authors:
* DarkWyrm (darkwyrm@earthlink.net)
* Rene Gollent (rene@gollent.com)
* Stephan Aßmus <superstippi@gmx.de>
* Joseph Groover <looncraz@looncraz.net>
*/
#ifndef APR_VIEW_H_
#define APR_VIEW_H_
@ -28,8 +29,6 @@
#include <DecorInfo.h>
#include "ColorSet.h"
class APRWindow;
class ColorPreview;
@ -52,7 +51,8 @@ public:
private:
void _SetCurrentColor(rgb_color color);
void _UpdateAllColors();
void _SetUIColors(const BMessage& colors);
void _UpdatePreviews(const BMessage& colors);
private:
BColorControl* fPicker;
@ -65,9 +65,9 @@ private:
ColorPreview* fColorPreview;
ColorSet fCurrentSet;
ColorSet fPrevSet;
ColorSet fDefaultSet;
BMessage fPrevColors;
BMessage fDefaultColors;
BMessage fCurrentColors;
};
#endif // APR_VIEW_H_

View File

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

View File

@ -26,6 +26,7 @@
#include <String.h>
#include <TextView.h>
#include "APRWindow.h"
#undef B_TRANSLATION_CONTEXT
@ -115,24 +116,17 @@ AntialiasingSettingsView::AntialiasingSettingsView(const char* name)
#ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
// 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.
BRect textBounds = Bounds();
BTextView* subpixelAntialiasingDisabledLabel = new BTextView(
textBounds, "unavailable label", textBounds, &infoFont, &infoColor,
B_FOLLOW_NONE, B_WILL_DRAW | B_SUPPORTS_LAYOUT);
subpixelAntialiasingDisabledLabel->SetText(B_TRANSLATE(
fSubpixelAntialiasingDisabledLabel
= new BTextView("unavailable label");
fSubpixelAntialiasingDisabledLabel->SetText(B_TRANSLATE(
"Subpixel based anti-aliasing in combination with glyph hinting is not "
"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->MakeEditable(false);
subpixelAntialiasingDisabledLabel->MakeSelectable(false);
fSubpixelAntialiasingDisabledLabel->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fSubpixelAntialiasingDisabledLabel->MakeEditable(false);
fSubpixelAntialiasingDisabledLabel->MakeSelectable(false);
#endif // !FT_CONFIG_OPTION_SUBPIXEL_RENDERING
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
// hinting+subpixel unavailable info
.Add(subpixelAntialiasingDisabledLabel, 0, 3, 2)
.Add(fSubpixelAntialiasingDisabledLabel, 0, 3, 2)
#else
.Add(BSpaceLayoutItem::CreateGlue(), 0, 3, 2)
#endif
@ -157,6 +151,7 @@ AntialiasingSettingsView::AntialiasingSettingsView(const char* name)
_SetCurrentAntialiasing();
_SetCurrentHinting();
_SetCurrentAverageWeight();
_UpdateColors();
}
@ -168,10 +163,10 @@ AntialiasingSettingsView::~AntialiasingSettingsView()
void
AntialiasingSettingsView::AttachedToWindow()
{
if (Parent() != NULL)
SetViewColor(Parent()->ViewColor());
else
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
AdoptParentColors();
if (Parent() == NULL)
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fAntialiasingMenu->SetTargetForItems(this);
fHintingMenu->SetTargetForItems(this);
@ -224,6 +219,12 @@ AntialiasingSettingsView::MessageReceived(BMessage *msg)
Window()->PostMessage(kMsgUpdate);
break;
}
case B_COLORS_UPDATED:
{
if (msg->HasColor(ui_color_name(B_PANEL_BACKGROUND_COLOR)))
_UpdateColors();
break;
}
default:
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
AntialiasingSettingsView::SetDefaults()
{

View File

@ -12,6 +12,7 @@ class BBox;
class BMenuField;
class BPopUpMenu;
class BSlider;
class BTextView;
class AntialiasingSettingsView : public BView {
@ -33,6 +34,7 @@ private:
void _BuildHintingMenu();
void _SetCurrentHinting();
void _SetCurrentAverageWeight();
void _UpdateColors();
protected:
float fDivider;
@ -42,6 +44,7 @@ protected:
BMenuField* fHintingMenuField;
BPopUpMenu* fHintingMenu;
BSlider* fAverageWeightControl;
BTextView* fSubpixelAntialiasingDisabledLabel;
bool fSavedSubpixelAntialiasing;
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.
*
* Authors:
* DarkWyrm <bpmagic@columbus.rr.com>
* Stephan Aßmus <superstippi@gmx.de>
* Rene Gollent <rene@gollent.com>
* Joseph Groover <looncraz@looncraz.net>
*/
@ -20,7 +21,7 @@
#include <Message.h>
#include <ServerReadOnlyMemory.h>
#include <String.h>
#include "ColorSet.h"
#include "Colors.h"
#undef B_TRANSLATION_CONTEXT
@ -41,6 +42,10 @@ static ColorDescription sColorDescriptionTable[] = {
{ B_NAVIGATION_PULSE_COLOR, B_TRANSLATE_MARK("Navigation pulse") },
{ B_SHINE_COLOR, B_TRANSLATE_MARK("Shine") },
{ 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_SELECTED_BACKGROUND_COLOR,
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
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
ColorSet::GetColor(int32 which)
void
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)
: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);
}

View File

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

View File

@ -64,7 +64,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:"));

View File

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

View File

@ -132,10 +132,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);
@ -325,6 +325,8 @@ LookAndFeelSettingsView::IsRevertable()
void
LookAndFeelSettingsView::Revert()
{
if (IsRevertable()) {
_SetDecor(fSavedDecor);
_SetDoubleScrollBarArrows(fSavedDoubleArrowsValue);
}
}

View File

@ -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;

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,
B_WILL_DRAW);
fIcon->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
fIcon->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
SetBluetoothDevice(bDevice);

View File

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

View File

@ -111,7 +111,7 @@ InquiryPanel::InquiryPanel(BRect frame, LocalDevice* lDevice)
fLocalDevice = LocalDevice::GetLocalDevice();
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->MakeEditable(false);
fMessage->MakeSelectable(false);
@ -127,7 +127,7 @@ InquiryPanel::InquiryPanel(BRect frame, LocalDevice* lDevice)
fRemoteList->SetSelectionMessage(new BMessage(kMsgSelected));
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) {
fMessage->SetText(B_TRANSLATE(

View File

@ -41,7 +41,7 @@ using namespace Bluetooth;
RemoteDevicesView::RemoteDevicesView(const char* name, uint32 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),
new BMessage(kMsgAddDevices));
@ -66,7 +66,7 @@ RemoteDevicesView::RemoteDevicesView(const char* name, uint32 flags)
fDeviceList = new BListView("DeviceList", B_SINGLE_SELECTION_LIST);
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));

View File

@ -36,6 +36,7 @@
#include <TranslationDefs.h>
#include <TranslatorRoster.h>
#include "DataTranslations.h"
#include "DataTranslationsSettings.h"
#include "TranslatorListView.h"
@ -166,7 +167,7 @@ DataTranslationsWindow::_ShowConfigView(int32 id)
if (ret != B_OK)
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
fRightBox->AddChild(fConfigView);
@ -192,17 +193,18 @@ DataTranslationsWindow::_ShowInfoView()
}
BTextView* view = new BTextView("info text");
view->MakeEditable(false);
view->MakeSelectable(false);
view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
view->SetText(B_TRANSLATE(
fInfoText = new BTextView("info text");
fInfoText->MakeEditable(false);
fInfoText->MakeSelectable(false);
fInfoText->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fInfoText->SetText(B_TRANSLATE(
"Use this control panel to set default values for translators, "
"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);
group->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
group->AddChild(view);
group->AddChild(fInfoText);
float spacing = be_control_look->DefaultItemSpacing();
group->GroupLayout()->SetInsets(spacing, spacing, spacing, spacing);
fRightBox->AddChild(group);
@ -213,6 +215,7 @@ DataTranslationsWindow::_ShowInfoView()
void
DataTranslationsWindow::_SetupViews()
{
fInfoText = NULL;
fConfigView = NULL;
// This is NULL until a translator is
// selected from the listview
@ -356,6 +359,18 @@ DataTranslationsWindow::MessageReceived(BMessage* message)
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:
{
int32 index = 0, id;

View File

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

View File

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

View File

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

View File

@ -129,7 +129,7 @@ AttributeWindow::AttributeWindow(FileTypesWindow* target, BMimeType& mimeType,
typeMenuField->SetAlignment(B_ALIGN_RIGHT);
// we must set the color manually when adding a menuField directly
// 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));
fVisibleCheckBox = new BCheckBox("visible", B_TRANSLATE("Visible"),

View File

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

View File

@ -52,7 +52,7 @@ add_font_selection_view(BGridLayout* layout, FontSelectionView* view,
FontView::FontView()
: 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:"));
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->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
fView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
// Adding object
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_PLAIN_BORDER);
box->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
box->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
// Add listViews with their scrolls
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)
{
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());
// 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->MakeEditable(false);
fText->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
fText->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fText->SetLowColor(fText->ViewColor());
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 background = ui_color(B_PANEL_BACKGROUND_COLOR);
rgb_color keyLabelColor = make_color(0, 0, 0, 255);
key_kind keyKind = kNormalKey;
int32 deadKey = 0;
bool secondDeadKey = false;
@ -795,7 +796,7 @@ KeyboardLayoutView::_DrawKey(BView* view, BRect updateRect, const Key* key,
_GetAbbreviatedKeyLabelIfNeeded(view, rect, key, text, sizeof(text));
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) {
BRect topLeft = rect;
BRect topRight = rect;
@ -875,7 +876,7 @@ KeyboardLayoutView::_DrawKey(BView* view, BRect updateRect, const Key* key,
// draw the button label
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
view->ConstrainClippingRegion(NULL);

View File

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

View File

@ -85,6 +85,13 @@ AutoConfigView::AutoConfigView(AutoConfig &config)
void
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->MakeFocus(true);
}
@ -275,6 +282,8 @@ ServerSettingsView::ServerSettingsView(const account_info &info)
fOutboundEncrItemStart(NULL),
fImageID(-1)
{
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fInboundAccount = true;
fOutboundAccount = true;

View File

@ -28,6 +28,9 @@
#define B_TRANSLATION_CONTEXT "AutoConfigWindow"
const float kSpacing = 10;
AutoConfigWindow::AutoConfigWindow(BRect rect, ConfigWindow *parent)
:
BWindow(rect, B_TRANSLATE("Create new account"), B_TITLED_WINDOW_LOOK,
@ -61,6 +64,10 @@ AutoConfigWindow::AutoConfigWindow(BRect rect, ConfigWindow *parent)
.Add(fBackButton)
.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
AddShortcut('W', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));
}

View File

@ -184,7 +184,7 @@ class BitmapView : public BView {
virtual void AttachedToWindow()
{
SetViewColor(Parent()->ViewColor());
AdoptParentColors();
}
virtual void Draw(BRect updateRect)
@ -229,7 +229,7 @@ ConfigWindow::ConfigWindow()
fConfigView = new BView(NULL, 0);
fConfigView->SetLayout(new BGroupLayout(B_VERTICAL));
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,
false, true);
@ -370,26 +370,34 @@ ConfigWindow::_BuildHowToView()
}
}
BTextView* text = new BTextView(NULL, B_WILL_DRAW);
text->SetAlignment(B_ALIGN_CENTER);
text->SetText(B_TRANSLATE(
fHowToTextView = new BTextView(NULL, B_WILL_DRAW);
fHowToTextView->SetAlignment(B_ALIGN_CENTER);
fHowToTextView->SetText(B_TRANSLATE(
"Create a new account with the Add button.\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."));
text->MakeEditable(false);
text->MakeSelectable(false);
float fontFactor = be_plain_font->Size() / 12.0f;
text->SetExplicitPreferredSize(BSize(300 * fontFactor,400 * fontFactor));
fHowToTextView->MakeEditable(false);
fHowToTextView->MakeSelectable(false);
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)
.AddGlue()
.Add(text)
.Add(fHowToTextView)
.AddGlue();
if (bitmapView != NULL)
groupView->GetLayout()->AddView(1, bitmapView);
text->SetViewColor(groupView->ViewColor());
fHowToTextView->AdoptSystemColors();
return groupView;
}
@ -517,6 +525,17 @@ ConfigWindow::MessageReceived(BMessage *msg)
AutoConfigWindow *autoConfigWindow = NULL;
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:
{
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 2011, Clemens Zeidler <haiku@clemens-zeidler.de>
*
@ -23,6 +23,7 @@ class BListView;
class BButton;
class BMenuField;
class BMailSettings;
class BTextView;
class CenterContainer;
@ -90,6 +91,7 @@ private:
BCheckBox* fCheckMailCheckBox;
BTextControl* fIntervalControl;
BMenuField* fStatusModeField;
BTextView* fHowToTextView;
bool fSaveSettings;
BObjectList<BMailAccountSettings> fAccounts;

View File

@ -1,7 +1,7 @@
SubDir HAIKU_TOP src preferences mail ;
UsePublicHeaders [ FDirName add-ons mail_daemon ] ;
UsePrivateHeaders mail ;
UsePrivateHeaders interface mail ;
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.
*
* Authors:
@ -397,7 +397,7 @@ MediaWindow::_InitWindow()
fContentLayout = new BCardLayout();
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));
fAudioView = new AudioSettingsView();

View File

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

View File

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

View File

@ -431,7 +431,7 @@ GeneralView::GeneralView(GeneralAddon *addon, BRect frame)
// B_FOLLOW_NONE, 0);
// BControl automatically sets the view color when attached (we want that)
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.bottom = rect.top + 20;
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();
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.bottom = rect.top;
// init
@ -60,7 +60,7 @@ TextRequestDialog::TextRequestDialog(const char *title, const char *information,
textRect.OffsetTo(0, 0);
fTextView = new BTextView(rect, "TextView", textRect, B_FOLLOW_NONE,
B_WILL_DRAW);
fTextView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
fTextView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fTextView->MakeSelectable(false);
fTextView->MakeEditable(false);
fTextView->SetText(information);

View File

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

View File

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

View File

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

View File

@ -35,7 +35,7 @@ RefreshWindow::RefreshWindow(BPoint position, float current, float min, float ma
max = floorf(max);
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);
BRect rect = Bounds().InsetByCopy(8, 8);

View File

@ -21,7 +21,8 @@ static const char* kSettingsFileName = "Screen_data";
ScreenSettings::ScreenSettings()
{
fWindowFrame.Set(-1, -1, 450, 250);
fWindowFrame.Set(0, 0, 450, 250);
BPoint offset;
BPath path;
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) == B_OK) {
@ -29,8 +30,10 @@ ScreenSettings::ScreenSettings()
BFile file(path.Path(), B_READ_ONLY);
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);
BPoint offset = fWindowFrame.LeftTop();
BFile file(path.Path(), B_WRITE_ONLY | B_CREATE_FILE);
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();
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));
BBox* networkBox = new BBox("networkBox");

View File

@ -61,7 +61,7 @@ PreviewView::PreviewView(const char* name)
fSaverView(NULL),
fNoPreview(NULL)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
BGroupLayout* layout = new BGroupLayout(B_VERTICAL);
// 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),
fPreviousCorner(-1)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
}

View File

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

View File

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

View File

@ -41,7 +41,8 @@ TTimeBaseView::Pulse()
void
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
ClockView::AttachedToWindow()
{
if (Parent())
SetViewColor(Parent()->ViewColor());
AdoptParentColors();
fShowClock->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)
return;
SetLowColor(ViewColor());
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;
fText.CopyCharsInto(field, fFieldPositions[index * 2],
@ -106,7 +109,7 @@ TTimeEdit::DrawSection(uint32 index, BRect bounds, bool hasFocus)
BPoint point(bounds.LeftBottom());
point.y -= bounds.Height() / 2.0 - 6.0;
point.x += (bounds.Width() - StringWidth(field)) / 2;
SetHighColor(0, 0, 0, 255);
SetHighUIColor(B_PANEL_TEXT_COLOR);
FillRect(bounds, B_SOLID_LOW);
DrawString(field, point);
}
@ -125,7 +128,7 @@ TTimeEdit::DrawSeparator(uint32 index, BRect bounds)
BPoint point(bounds.LeftBottom());
point.y -= bounds.Height() / 2.0 - 6.0;
point.x += (bounds.Width() - StringWidth(field)) / 2;
SetHighColor(0, 0, 0, 255);
SetHighUIColor(B_PANEL_TEXT_COLOR);
DrawString(field, point);
}
@ -471,9 +474,11 @@ TDateEdit::DrawSection(uint32 index, BRect bounds, bool hasFocus)
if (fFieldPositions == NULL || index * 2 + 1 >= (uint32)fFieldPosCount)
return;
SetLowColor(ViewColor());
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;
fText.CopyCharsInto(field, fFieldPositions[index * 2],
@ -482,7 +487,7 @@ TDateEdit::DrawSection(uint32 index, BRect bounds, bool hasFocus)
BPoint point(bounds.LeftBottom());
point.y -= bounds.Height() / 2.0 - 6.0;
point.x += (bounds.Width() - StringWidth(field)) / 2;
SetHighColor(0, 0, 0, 255);
SetHighUIColor(B_PANEL_TEXT_COLOR);
FillRect(bounds, B_SOLID_LOW);
DrawString(field, point);
}
@ -504,7 +509,7 @@ TDateEdit::DrawSeparator(uint32 index, BRect bounds)
BPoint point(bounds.LeftBottom());
point.y -= bounds.Height() / 2.0 - 6.0;
point.x += (bounds.Width() - StringWidth(field)) / 2;
SetHighColor(0, 0, 0, 255);
SetHighUIColor(B_PANEL_TEXT_COLOR);
DrawString(field, point);
}

View File

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

View File

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

View File

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

View File

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