[haiku-commits] BRANCH looncraz-github.setviewuicolor [871a76d9a84e] in src: kits/shared servers/mail apps/diskprobe apps/stylededit apps/deskbar

  • From: looncraz-github.setviewuicolor <community@xxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 2 Oct 2015 20:02:26 +0200 (CEST)

added 2 changesets to branch 'refs/remotes/looncraz-github/setviewuicolor'
old head: d848a035e31404fcd646223668233347ad82527d
new head: 871a76d9a84e489f90a3d886f2af222b56e49993
overview: https://github.com/looncraz/haiku/compare/d848a035e314...871a76d9a84e

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

ab119dd78e72: (Mostly) Automated Replacement 2

Replace SetLowColor(ViewColor()) with SetLowUIColor(ViewUIColor()).

With the exception of when you want to force specific colors, of course.

Also, incidentally, this pulls in a couple AdoptParentColors() replacements
as I saw the need.

871a76d9a84e: IconButton

Use AdoptParentColors() and SetLowUIColor() with IconButton.

Tested with WebPositive.

[ looncraz <looncraz@xxxxxxxxxxxx> ]

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

14 files changed, 27 insertions(+), 33 deletions(-)
src/add-ons/translators/tiff/TIFFView.cpp | 2 +-
.../gui/inspector_window/MemoryView.cpp | 2 +-
src/apps/deskbar/TimeView.cpp | 4 ++--
src/apps/diskprobe/TypeEditors.cpp | 4 ++--
src/apps/login/LoginView.cpp | 2 +-
src/apps/mail/AddressTextControl.cpp | 4 ++--
src/apps/stylededit/StyledEditView.cpp | 4 ++--
src/kits/shared/CalendarView.cpp | 2 +-
src/kits/shared/IconButton.cpp | 15 ++++++---------
src/servers/bluetooth/DeskbarReplicant.cpp | 5 +----
src/servers/mail/DeskbarView.cpp | 10 +++++-----
.../balert/alert_manual_test/AlertTestWindow.cpp | 2 +-
src/tests/servers/app/copy_bits/main.cpp | 2 +-
src/tests/servers/app/scrolling/main.cpp | 2 +-

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

Commit: ab119dd78e728a5530f7f7ba627bedd14d91d7db
Author: looncraz <looncraz@xxxxxxxxxxxx>
Date: Fri Oct 2 18:43:15 2015 UTC

(Mostly) Automated Replacement 2

Replace SetLowColor(ViewColor()) with SetLowUIColor(ViewUIColor()).

With the exception of when you want to force specific colors, of course.

Also, incidentally, this pulls in a couple AdoptParentColors() replacements
as I saw the need.

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

diff --git a/src/add-ons/translators/tiff/TIFFView.cpp
b/src/add-ons/translators/tiff/TIFFView.cpp
index 3bdc74f..925cc72 100644
--- a/src/add-ons/translators/tiff/TIFFView.cpp
+++ b/src/add-ons/translators/tiff/TIFFView.cpp
@@ -77,7 +77,7 @@ TIFFView::TIFFView(const char* name, uint32 flags,
fSettings = settings;

SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
- SetLowColor(ViewColor());
+ SetLowUIColor(ViewUIColor());

fTitle = new BStringView("title", B_TRANSLATE("TIFF image translator"));
fTitle->SetFont(be_bold_font);
diff --git
a/src/apps/debugger/user_interface/gui/inspector_window/MemoryView.cpp
b/src/apps/debugger/user_interface/gui/inspector_window/MemoryView.cpp
index aa418c0..18bb9f5 100644
--- a/src/apps/debugger/user_interface/gui/inspector_window/MemoryView.cpp
+++ b/src/apps/debugger/user_interface/gui/inspector_window/MemoryView.cpp
@@ -149,7 +149,7 @@ void
MemoryView::AttachedToWindow()
{
BView::AttachedToWindow();
- SetViewColor(ui_color(B_DOCUMENT_BACKGROUND_COLOR));
+ SetViewUIColor(B_DOCUMENT_BACKGROUND_COLOR);
SetFont(be_fixed_font);
fCharWidth = be_fixed_font->StringWidth("a");
font_height fontHeight;
diff --git a/src/apps/deskbar/TimeView.cpp b/src/apps/deskbar/TimeView.cpp
index 2ec3f91..98fafb4 100644
--- a/src/apps/deskbar/TimeView.cpp
+++ b/src/apps/deskbar/TimeView.cpp
@@ -154,9 +154,9 @@ TTimeView::Draw(BRect /*updateRect*/)
PushState();

SetHighColor(ViewColor());
- SetLowColor(ViewColor());
+ SetLowUIColor(ViewUIColor());
FillRect(Bounds());
- SetHighColor(ui_color(B_MENU_ITEM_TEXT_COLOR));
+ SetHighUIColor(B_MENU_ITEM_TEXT_COLOR);

DrawString(fCurrentTimeStr, fTimeLocation);

diff --git a/src/apps/diskprobe/TypeEditors.cpp
b/src/apps/diskprobe/TypeEditors.cpp
index a1d954c..78d8781 100644
--- a/src/apps/diskprobe/TypeEditors.cpp
+++ b/src/apps/diskprobe/TypeEditors.cpp
@@ -1131,8 +1131,8 @@ MessageView::MessageView(BRect rect, DataEditor &editor)
fTextView = new BTextView(rect, B_EMPTY_STRING,
rect.OffsetToCopy(B_ORIGIN).InsetByCopy(5, 5),
B_FOLLOW_ALL, B_WILL_DRAW);
- fTextView->SetViewColor(ViewColor());
- fTextView->SetLowColor(ViewColor());
+ fTextView->SetViewUIColor(ViewUIColor());
+ fTextView->SetLowUIColor(ViewUIColor());

BScrollView *scrollView = new BScrollView("scroller", fTextView,
B_FOLLOW_ALL, B_WILL_DRAW, true, true);
diff --git a/src/apps/login/LoginView.cpp b/src/apps/login/LoginView.cpp
index 502ea25..01f1628 100644
--- a/src/apps/login/LoginView.cpp
+++ b/src/apps/login/LoginView.cpp
@@ -49,7 +49,7 @@ LoginView::LoginView(BRect frame)
// TODO: when I don't need to test in BeOS anymore,
// rewrite to use layout engine.
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
- SetLowColor(ViewColor());
+ SetLowUIColor(ViewUIColor());
BRect r;
r.Set(CSEP, CSEP, LW, Bounds().Height() - 3 * CSEP - BH);
fUserList = new BListView(r, "users");
diff --git a/src/apps/mail/AddressTextControl.cpp
b/src/apps/mail/AddressTextControl.cpp
index dd60999..b7450bb 100644
--- a/src/apps/mail/AddressTextControl.cpp
+++ b/src/apps/mail/AddressTextControl.cpp
@@ -656,8 +656,8 @@ AddressTextControl::AddressTextControl(const char* name,
BMessage* message)
.Add(fPopUpButton);

SetFlags(Flags() | B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE);
- SetLowColor(ViewColor());
- SetViewColor(fTextView->ViewColor());
+ SetLowUIColor(ViewUIColor());
+ SetViewUIColor(fTextView->ViewUIColor());

SetExplicitAlignment(BAlignment(B_ALIGN_USE_FULL_WIDTH,
B_ALIGN_VERTICAL_CENTER));
diff --git a/src/apps/stylededit/StyledEditView.cpp
b/src/apps/stylededit/StyledEditView.cpp
index 32d0ae4..c08f6eb 100644
--- a/src/apps/stylededit/StyledEditView.cpp
+++ b/src/apps/stylededit/StyledEditView.cpp
@@ -37,8 +37,8 @@ StyledEditView::StyledEditView(BRect viewFrame, BRect
textBounds,
&(fInitialColor = ui_color(B_DOCUMENT_TEXT_COLOR)),
B_FOLLOW_ALL, B_FRAME_EVENTS | B_WILL_DRAW)
{
- SetViewColor(ui_color(B_DOCUMENT_BACKGROUND_COLOR));
- SetLowColor(ViewColor());
+ SetViewUIColor(B_DOCUMENT_BACKGROUND_COLOR);
+ SetLowUIColor(ViewUIColor());

fMessenger = new BMessenger(handler);
fSuppressChanges = false;
diff --git a/src/kits/shared/CalendarView.cpp b/src/kits/shared/CalendarView.cpp
index c3d09d8..58c7fe2 100644
--- a/src/kits/shared/CalendarView.cpp
+++ b/src/kits/shared/CalendarView.cpp
@@ -158,7 +158,7 @@ BCalendarView::AttachedToWindow()
if (!Messenger().IsValid())
SetTarget(Window(), NULL);

- SetViewColor(ui_color(B_LIST_BACKGROUND_COLOR));
+ SetViewUIColor(B_LIST_BACKGROUND_COLOR);
}


diff --git a/src/servers/bluetooth/DeskbarReplicant.cpp
b/src/servers/bluetooth/DeskbarReplicant.cpp
index e31cd50..bb10d7a 100644
--- a/src/servers/bluetooth/DeskbarReplicant.cpp
+++ b/src/servers/bluetooth/DeskbarReplicant.cpp
@@ -117,10 +117,7 @@ void
DeskbarReplicant::AttachedToWindow()
{
BView::AttachedToWindow();
- if (Parent())
- SetViewColor(Parent()->ViewColor());
- else
- SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
+ AdoptParentColors();

SetLowColor(ViewColor());
}
diff --git a/src/servers/mail/DeskbarView.cpp b/src/servers/mail/DeskbarView.cpp
index 1ab393f..d4d9f65 100644
--- a/src/servers/mail/DeskbarView.cpp
+++ b/src/servers/mail/DeskbarView.cpp
@@ -125,12 +125,12 @@ DeskbarView::~DeskbarView()
void DeskbarView::AttachedToWindow()
{
BView::AttachedToWindow();
- if (Parent())
- SetViewColor(Parent()->ViewColor());
- else
- SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
+ AdoptParentColors();

- SetLowColor(ViewColor());
+ if (ViewUIColor() == B_NO_COLOR)
+ SetLowColor(ViewColor());
+ else
+ SetLowUIColor(ViewUIColor());

if (be_roster->IsRunning(B_MAIL_DAEMON_SIGNATURE)) {
_RefreshMailQuery();
diff --git
a/src/tests/kits/interface/balert/alert_manual_test/AlertTestWindow.cpp
b/src/tests/kits/interface/balert/alert_manual_test/AlertTestWindow.cpp
index 74b0212..ca214f0 100644
--- a/src/tests/kits/interface/balert/alert_manual_test/AlertTestWindow.cpp
+++ b/src/tests/kits/interface/balert/alert_manual_test/AlertTestWindow.cpp
@@ -96,7 +96,7 @@ AlertTestWindow::Test()
);
if (fAlertType == 'H') {
BView *master = pAlert->ChildAt(0);
- master->SetViewColor(ui_color(B_MENU_BACKGROUND_COLOR));
+ master->SetViewUIColor(B_MENU_BACKGROUND_COLOR);
}

BPoint pt;
diff --git a/src/tests/servers/app/copy_bits/main.cpp
b/src/tests/servers/app/copy_bits/main.cpp
index d9fd267..7fdc845 100644
--- a/src/tests/servers/app/copy_bits/main.cpp
+++ b/src/tests/servers/app/copy_bits/main.cpp
@@ -35,7 +35,7 @@ class TestView : public BView {
fDestRect.InsetBy(10.0, 10.0);


SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
- SetLowColor(ViewColor());
+ SetLowUIColor(ViewUIColor());
}

virtual void MessageReceived(BMessage* message);
diff --git a/src/tests/servers/app/scrolling/main.cpp
b/src/tests/servers/app/scrolling/main.cpp
index fd03c3f..8b80e23 100644
--- a/src/tests/servers/app/scrolling/main.cpp
+++ b/src/tests/servers/app/scrolling/main.cpp
@@ -22,7 +22,7 @@ class TestView : public BView {
fLastMousePos(0.0, 0.0)
{

SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
- SetLowColor(ViewColor());
+ SetLowUIColor(ViewUIColor());
}

virtual void MessageReceived(BMessage* message);

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

Commit: 871a76d9a84e489f90a3d886f2af222b56e49993
Author: looncraz <looncraz@xxxxxxxxxxxx>
Date: Fri Oct 2 18:48:10 2015 UTC

IconButton

Use AdoptParentColors() and SetLowUIColor() with IconButton.

Tested with WebPositive.

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

diff --git a/src/kits/shared/IconButton.cpp b/src/kits/shared/IconButton.cpp
index 2bf8ea5..6e69385 100644
--- a/src/kits/shared/IconButton.cpp
+++ b/src/kits/shared/IconButton.cpp
@@ -79,15 +79,12 @@ BIconButton::MessageReceived(BMessage* message)
void
BIconButton::AttachedToWindow()
{
- rgb_color background = B_TRANSPARENT_COLOR;
- if (BView* parent = Parent()) {
- background = parent->ViewColor();
- if (background == B_TRANSPARENT_COLOR)
- background = parent->LowColor();
- }
- if (background == B_TRANSPARENT_COLOR)
- background = ui_color(B_PANEL_BACKGROUND_COLOR);
- SetLowColor(background);
+ AdoptParentColors();
+
+ if (ViewUIColor() != B_NO_COLOR)
+ SetLowUIColor(ViewUIColor());
+ else
+ SetLowUIColor(B_PANEL_BACKGROUND_COLOR);

SetTarget(fTargetCache);
if (!Target())


Other related posts:

  • » [haiku-commits] BRANCH looncraz-github.setviewuicolor [871a76d9a84e] in src: kits/shared servers/mail apps/diskprobe apps/stylededit apps/deskbar - looncraz-github . setviewuicolor