[haiku-commits] BRANCH looncraz-github.setviewuicolor [90a7534a00ed] in src: preferences/mail preferences/screen kits/interface kits/media preferences/mouse

  • From: looncraz-github.setviewuicolor <community@xxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 30 Oct 2015 04:47:00 +0100 (CET)

added 7 changesets to branch 'refs/remotes/looncraz-github/setviewuicolor'
old head: d5c3a4ff746b49512af6ee131332b5fe31e21165
new head: 90a7534a00ed0c5b2d7e26486165248641e38614
overview: https://github.com/looncraz/haiku/compare/d5c3a4ff746b...90a7534a00ed

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

5b7d3848ba00: BSlider colors

Not sure how this ever managed to work before...

bce8ce3148bb: AdoptParentColors()

Fixes issue where background of mouse did not update with system color
changes.

92666744dfcb: Correct DefaultMediaTheme Colors

7561cf9cb5c5: Fix Screen Resizing on Start, Monitor BG Color

By storing and resetting the entire window frame the window would
get resized larger and larger by, I'm assuming, a layout. By only
storing the position, we avoid this problem entirely.

d7e6f4c89d6c: ColumnListView Color Updates

ef8cbb182fe0: IconView colors

90a7534a00ed: E-mail Preflet Color Updates

[ looncraz <looncraz@xxxxxxxxxxxx> ]

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

10 files changed, 88 insertions(+), 56 deletions(-)
headers/private/interface/ColumnListView.h | 1 +
src/kits/interface/ColumnListView.cpp | 65 +++++++++++++++-----------
src/kits/interface/Slider.cpp | 5 +-
src/kits/media/DefaultMediaTheme.cpp | 9 ++--
src/preferences/filetypes/IconView.cpp | 5 +-
src/preferences/mail/ConfigWindow.cpp | 29 ++++++++----
src/preferences/mail/ConfigWindow.h | 2 +
src/preferences/mouse/MouseView.cpp | 5 +-
src/preferences/screen/MonitorView.cpp | 12 +++--
src/preferences/screen/ScreenSettings.cpp | 11 +++--

############################################################################

Commit: 5b7d3848ba00b7bd22dcb458908d59686c425509
Author: looncraz <looncraz@xxxxxxxxxxxx>
Date: Thu Oct 29 03:09:59 2015 UTC

BSlider colors

Not sure how this ever managed to work before...

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

diff --git a/src/kits/interface/Slider.cpp b/src/kits/interface/Slider.cpp
index 33e269a..d8f1473 100644
--- a/src/kits/interface/Slider.cpp
+++ b/src/kits/interface/Slider.cpp
@@ -394,7 +394,10 @@ BSlider::AttachedToWindow()
BView* view = OffscreenView();
if (view && view->LockLooper()) {
view->SetViewColor(B_TRANSPARENT_COLOR);
- view->SetLowColor(LowColor());
+ if (LowUIColor() != B_NO_COLOR)
+ view->SetLowUIColor(LowUIColor());
+ else
+ view->SetLowColor(LowColor());
view->UnlockLooper();
}


############################################################################

Commit: bce8ce3148bb9ed59dce6f90b4343f9066dcd4d9
Author: looncraz <looncraz@xxxxxxxxxxxx>
Date: Fri Oct 30 02:23:09 2015 UTC

AdoptParentColors()

Fixes issue where background of mouse did not update with system color
changes.

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

diff --git a/src/preferences/mouse/MouseView.cpp
b/src/preferences/mouse/MouseView.cpp
index f4c8f0f..4a28bf5 100644
--- a/src/preferences/mouse/MouseView.cpp
+++ b/src/preferences/mouse/MouseView.cpp
@@ -141,10 +141,7 @@ MouseView::GetPreferredSize(float* _width, float* _height)
void
MouseView::AttachedToWindow()
{
- if (Parent() != NULL)
- SetViewColor(Parent()->ViewColor());
- else
- SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
+ AdoptParentColors();

UpdateFromSettings();
_CreateButtonsPicture();

############################################################################

Commit: 92666744dfcb653214d3a365c924581da80caf0c
Author: looncraz <looncraz@xxxxxxxxxxxx>
Date: Fri Oct 30 02:50:20 2015 UTC

Correct DefaultMediaTheme Colors

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

diff --git a/src/kits/media/DefaultMediaTheme.cpp
b/src/kits/media/DefaultMediaTheme.cpp
index 2aa36ab..529be6c 100644
--- a/src/kits/media/DefaultMediaTheme.cpp
+++ b/src/kits/media/DefaultMediaTheme.cpp
@@ -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);
}
@@ -513,8 +513,7 @@ TitleView::TitleView(BRect frame, const char *title)
: BView(frame, title, B_FOLLOW_LEFT_RIGHT, B_WILL_DRAW)
{
fTitle = strdup(title);
- SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
- SetLowUIColor(ViewUIColor());
+ 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


############################################################################

Commit: 7561cf9cb5c5b32898953f7d540adf2ed16b5543
Author: looncraz <looncraz@xxxxxxxxxxxx>
Date: Fri Oct 30 03:16:02 2015 UTC

Fix Screen Resizing on Start, Monitor BG Color

By storing and resetting the entire window frame the window would
get resized larger and larger by, I'm assuming, a layout. By only
storing the position, we avoid this problem entirely.

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

diff --git a/src/preferences/screen/MonitorView.cpp
b/src/preferences/screen/MonitorView.cpp
index bf15d9f..c58b56b 100644
--- a/src/preferences/screen/MonitorView.cpp
+++ b/src/preferences/screen/MonitorView.cpp
@@ -15,6 +15,7 @@
#include <stdio.h>

#include <Catalog.h>
+#include <ColorMap.h>
#include <Locale.h>
#include <Roster.h>
#include <Screen.h>
@@ -47,10 +48,7 @@ void
MonitorView::AttachedToWindow()
{
SetViewColor(B_TRANSPARENT_COLOR);
- if (Parent())
- fBackgroundColor = Parent()->ViewColor();
- else
- fBackgroundColor = ui_color(B_PANEL_BACKGROUND_COLOR);
+ fBackgroundColor = ui_color(B_PANEL_BACKGROUND_COLOR);

_UpdateDPI();
}
@@ -156,6 +154,12 @@ void
MonitorView::MessageReceived(BMessage* message)
{
switch (message->what) {
+ case B_COLORS_UPDATED:
+ {
+ BColorMap::Get(message, B_PANEL_BACKGROUND_COLOR,
+ &fBackgroundColor);
+ break;
+ }
case UPDATE_DESKTOP_MSG:
{
int32 width, height;
diff --git a/src/preferences/screen/ScreenSettings.cpp
b/src/preferences/screen/ScreenSettings.cpp
index 5e2e97f..9f776c0 100644
--- a/src/preferences/screen/ScreenSettings.cpp
+++ b/src/preferences/screen/ScreenSettings.cpp
@@ -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));
}



############################################################################

Commit: d7e6f4c89d6c42bfca6df5c851ce8e78cc18813d
Author: looncraz <looncraz@xxxxxxxxxxxx>
Date: Fri Oct 30 03:25:03 2015 UTC

ColumnListView Color Updates

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

diff --git a/headers/private/interface/ColumnListView.h
b/headers/private/interface/ColumnListView.h
index 76fd0bc..3e12300 100644
--- a/headers/private/interface/ColumnListView.h
+++ b/headers/private/interface/ColumnListView.h
@@ -396,6 +396,7 @@ protected:

private:
void _Init();
+ void _UpdateColors();
void
_GetChildViewRects(const BRect& bounds,
BRect&
titleRect, BRect& outlineRect,
BRect&
vScrollBarRect,
diff --git a/src/kits/interface/ColumnListView.cpp
b/src/kits/interface/ColumnListView.cpp
index 9cb8b3e..c008c72 100644
--- a/src/kits/interface/ColumnListView.cpp
+++ b/src/kits/interface/ColumnListView.cpp
@@ -1661,6 +1661,12 @@ BColumnListView::MessageReceived(BMessage* message)
fOutlineView->MessageReceived(message);
return;
}
+ } else if (message->what == B_COLORS_UPDATED) {
+ // TODO: This is inefficient, it would be more efficient to
+ // go through the colors in the colormap message and update only
+ // the colors that changed using the value already provided in
+ // the message.
+ _UpdateColors();
}

BView::MessageReceived(message);
@@ -2044,32 +2050,7 @@ BColumnListView::_Init()
if (bounds.Height() <= 0)
bounds.bottom = 100;

- fColorList[B_COLOR_BACKGROUND] = ui_color(B_LIST_BACKGROUND_COLOR);
- fColorList[B_COLOR_TEXT] = ui_color(B_LIST_ITEM_TEXT_COLOR);
- fColorList[B_COLOR_ROW_DIVIDER] = tint_color(
- ui_color(B_LIST_SELECTED_BACKGROUND_COLOR), B_DARKEN_2_TINT);
- fColorList[B_COLOR_SELECTION] =
ui_color(B_LIST_SELECTED_BACKGROUND_COLOR);
- fColorList[B_COLOR_SELECTION_TEXT] =
- ui_color(B_LIST_SELECTED_ITEM_TEXT_COLOR);
-
- // For non focus selection uses the selection color as BListView
- fColorList[B_COLOR_NON_FOCUS_SELECTION] =
- ui_color(B_LIST_SELECTED_BACKGROUND_COLOR);
-
- // edit mode doesn't work very well
- fColorList[B_COLOR_EDIT_BACKGROUND] = tint_color(
- ui_color(B_LIST_SELECTED_BACKGROUND_COLOR), B_DARKEN_1_TINT);
- fColorList[B_COLOR_EDIT_BACKGROUND].alpha = 180;
-
- // Unused color
- fColorList[B_COLOR_EDIT_TEXT] =
ui_color(B_LIST_SELECTED_ITEM_TEXT_COLOR);
-
- fColorList[B_COLOR_HEADER_BACKGROUND] =
ui_color(B_PANEL_BACKGROUND_COLOR);
- fColorList[B_COLOR_HEADER_TEXT] = ui_color(B_PANEL_TEXT_COLOR);
-
- // Unused colors
- fColorList[B_COLOR_SEPARATOR_LINE] = ui_color(B_LIST_ITEM_TEXT_COLOR);
- fColorList[B_COLOR_SEPARATOR_BORDER] = ui_color(B_LIST_ITEM_TEXT_COLOR);
+ _UpdateColors();

BRect titleRect;
BRect outlineRect;
@@ -2102,6 +2083,38 @@ BColumnListView::_Init()


void
+BColumnListView::_UpdateColors()
+{
+ fColorList[B_COLOR_BACKGROUND] = ui_color(B_LIST_BACKGROUND_COLOR);
+ fColorList[B_COLOR_TEXT] = ui_color(B_LIST_ITEM_TEXT_COLOR);
+ fColorList[B_COLOR_ROW_DIVIDER] = tint_color(
+ ui_color(B_LIST_SELECTED_BACKGROUND_COLOR), B_DARKEN_2_TINT);
+ fColorList[B_COLOR_SELECTION] =
ui_color(B_LIST_SELECTED_BACKGROUND_COLOR);
+ fColorList[B_COLOR_SELECTION_TEXT] =
+ ui_color(B_LIST_SELECTED_ITEM_TEXT_COLOR);
+
+ // For non focus selection uses the selection color as BListView
+ fColorList[B_COLOR_NON_FOCUS_SELECTION] =
+ ui_color(B_LIST_SELECTED_BACKGROUND_COLOR);
+
+ // edit mode doesn't work very well
+ fColorList[B_COLOR_EDIT_BACKGROUND] = tint_color(
+ ui_color(B_LIST_SELECTED_BACKGROUND_COLOR), B_DARKEN_1_TINT);
+ fColorList[B_COLOR_EDIT_BACKGROUND].alpha = 180;
+
+ // Unused color
+ fColorList[B_COLOR_EDIT_TEXT] =
ui_color(B_LIST_SELECTED_ITEM_TEXT_COLOR);
+
+ fColorList[B_COLOR_HEADER_BACKGROUND] =
ui_color(B_PANEL_BACKGROUND_COLOR);
+ fColorList[B_COLOR_HEADER_TEXT] = ui_color(B_PANEL_TEXT_COLOR);
+
+ // Unused colors
+ fColorList[B_COLOR_SEPARATOR_LINE] = ui_color(B_LIST_ITEM_TEXT_COLOR);
+ fColorList[B_COLOR_SEPARATOR_BORDER] =
ui_color(B_LIST_ITEM_TEXT_COLOR);
+}
+
+
+void
BColumnListView::_GetChildViewRects(const BRect& bounds, BRect& titleRect,
BRect& outlineRect, BRect& vScrollBarRect, BRect& hScrollBarRect)
{

############################################################################

Commit: ef8cbb182fe0dd30832919d6927dfd4487ae806e
Author: looncraz <looncraz@xxxxxxxxxxxx>
Date: Fri Oct 30 03:34:09 2015 UTC

IconView colors

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

diff --git a/src/preferences/filetypes/IconView.cpp
b/src/preferences/filetypes/IconView.cpp
index 131fd8a..12bf32e 100644
--- a/src/preferences/filetypes/IconView.cpp
+++ b/src/preferences/filetypes/IconView.cpp
@@ -544,10 +544,7 @@ IconView::~IconView()
void
IconView::AttachedToWindow()
{
- if (Parent())
- SetViewColor(Parent()->ViewColor());
- else
- SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
+ AdoptParentColors();

fTarget = this;


############################################################################

Commit: 90a7534a00ed0c5b2d7e26486165248641e38614
Author: looncraz <looncraz@xxxxxxxxxxxx>
Date: Fri Oct 30 03:41:53 2015 UTC

E-mail Preflet Color Updates

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

diff --git a/src/preferences/mail/ConfigWindow.cpp
b/src/preferences/mail/ConfigWindow.cpp
index 0e1408b..22c4e7b 100644
--- a/src/preferences/mail/ConfigWindow.cpp
+++ b/src/preferences/mail/ConfigWindow.cpp
@@ -23,6 +23,7 @@
#include <Button.h>
#include <Catalog.h>
#include <CheckBox.h>
+#include <ColorMap.h>
#include <ControlLook.h>
#include <Directory.h>
#include <Entry.h>
@@ -183,7 +184,7 @@ class BitmapView : public BView {

virtual void AttachedToWindow()
{
- SetViewColor(Parent()->ViewColor());
+ AdoptParentColors();
}

virtual void Draw(BRect updateRect)
@@ -359,28 +360,28 @@ 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);
+ fHowToTextView->MakeEditable(false);
+ fHowToTextView->MakeSelectable(false);

BFont font(be_plain_font);
rgb_color textColor = ui_color(B_PANEL_TEXT_COLOR);
- text->SetFontAndColor(&font, B_FONT_ALL, &textColor);
+ 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;
}
@@ -509,6 +510,16 @@ ConfigWindow::MessageReceived(BMessage *msg)

AutoConfigWindow *autoConfigWindow = NULL;
switch (msg->what) {
+ case B_COLORS_UPDATED:
+ {
+ rgb_color textColor;
+ if (BColorMap::Get(msg, B_PANEL_TEXT_COLOR, &textColor)
== B_OK) {
+ BFont font;
+ fHowToTextView->SetFontAndColor(&font, 0,
&textColor);
+ }
+ break;
+ }
+
case kMsgAccountsRightClicked:
{
BPoint point;
diff --git a/src/preferences/mail/ConfigWindow.h
b/src/preferences/mail/ConfigWindow.h
index 84336e0..31c8593 100644
--- a/src/preferences/mail/ConfigWindow.h
+++ b/src/preferences/mail/ConfigWindow.h
@@ -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;


Other related posts:

  • » [haiku-commits] BRANCH looncraz-github.setviewuicolor [90a7534a00ed] in src: preferences/mail preferences/screen kits/interface kits/media preferences/mouse - looncraz-github . setviewuicolor