[haiku-commits] haiku: hrev54595 - in src: apps/aboutsystem add-ons/input_server/devices/keyboard

  • From: Adrien Destugues <pulkomandy@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 23 Sep 2020 02:30:23 -0400 (EDT)

hrev54595 adds 2 changesets to branch 'master'
old head: 0b07cea059ff12cacf23e2e97276b21b90db24d3
new head: b8bd451e9f2f17e0441e718aa340ca394c086568
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=b8bd451e9f2f+%5E0b07cea059ff

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

4b1f514b08ec: Teammonitor: Respect system colors
  
  Change-Id: I5cc69376ade425c46bc76f8179f93bb74428da68
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/3261
  Reviewed-by: Adrien Destugues <pulkomandy@xxxxxxxxx>

b8bd451e9f2f: AboutSystem: Respect system colors
  
  Change-Id: I2fac8c2a7ab9033cc730db373710a856a8827eb8
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/3262
  Reviewed-by: John Scipione <jscipione@xxxxxxxxx>

                                     [ Pascal Abresch <nep@xxxxxxxxxxxxxx> ]

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

2 files changed, 83 insertions(+), 67 deletions(-)
.../devices/keyboard/TeamListItem.cpp            |  50 +++++-----
src/apps/aboutsystem/AboutSystem.cpp             | 100 +++++++++++--------

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

Commit:      4b1f514b08ec4ee5c082a7907358c60be537d418
URL:         https://git.haiku-os.org/haiku/commit/?id=4b1f514b08ec
Author:      Pascal Abresch <nep@xxxxxxxxxxxxxx>
Date:        Fri Sep 18 21:50:33 2020 UTC
Committer:   Adrien Destugues <pulkomandy@xxxxxxxxx>
Commit-Date: Wed Sep 23 06:30:19 2020 UTC

Teammonitor: Respect system colors

Change-Id: I5cc69376ade425c46bc76f8179f93bb74428da68
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3261
Reviewed-by: Adrien Destugues <pulkomandy@xxxxxxxxx>

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

diff --git a/src/add-ons/input_server/devices/keyboard/TeamListItem.cpp 
b/src/add-ons/input_server/devices/keyboard/TeamListItem.cpp
index 20f22648a5..52f947abb8 100644
--- a/src/add-ons/input_server/devices/keyboard/TeamListItem.cpp
+++ b/src/add-ons/input_server/devices/keyboard/TeamListItem.cpp
@@ -66,26 +66,23 @@ TeamListItem::CacheLocalizedName()
 void
 TeamListItem::DrawItem(BView* owner, BRect frame, bool complete)
 {
-       rgb_color kHighlight = { 140, 140, 140, 0 };
-       rgb_color kBlack = { 0, 0, 0, 0 };
-       rgb_color kBlue = { 0, 0, 255, 0 };
-       rgb_color kRed = { 255, 0, 0, 0 };
+       rgb_color kHighlight = ui_color(B_LIST_SELECTED_BACKGROUND_COLOR);
+       rgb_color kHighlightText = ui_color(B_LIST_SELECTED_ITEM_TEXT_COLOR);
+       rgb_color kText = ui_color(B_LIST_ITEM_TEXT_COLOR);
+
+       rgb_color kIdealRed = { 255, 0, 0, 0 };
+       rgb_color kIdealBlue = { 0, 0, 255, 0 };
+       rgb_color kRed = mix_color(kIdealRed, kText, 191);
+       rgb_color kBlue = mix_color(kIdealBlue, kText, 191);
+       rgb_color kHighlightRed = mix_color(kIdealRed, kHighlightText, 191);
+       rgb_color kHighlightBlue = mix_color(kIdealBlue, kHighlightText, 191);
 
        BRect r(frame);
 
        if (IsSelected() || complete) {
-               rgb_color color;
-               if (IsSelected())
-                       color = kHighlight;
-               else
-                       color = owner->ViewColor();
-
-               owner->SetHighColor(color);
-               owner->SetLowColor(color);
+               owner->SetHighColor(kHighlight);
+               owner->SetLowColor(kHighlight);
                owner->FillRect(r);
-               owner->SetHighColor(kBlack);
-       } else {
-               owner->SetLowColor(owner->ViewColor());
        }
 
        frame.left += 4;
@@ -99,10 +96,13 @@ TeamListItem::DrawItem(BView* owner, BRect frame, bool 
complete)
 
        frame.left += 16;
        if (fRefusingToQuit)
-               owner->SetHighColor(kRed);
-       else
-               owner->SetHighColor(IsSystemServer() ? kBlue : kBlack);
-
+               owner->SetHighColor(IsSelected() ? kHighlightRed : kRed);
+       else {
+               if (IsSystemServer())
+                       owner->SetHighColor(IsSelected() ? kHighlightBlue : 
kBlue);
+               else
+                       owner->SetHighColor(IsSelected() ? kHighlightText : 
kText);
+       }
        BFont font = be_plain_font;
        font_height     finfo;
        font.GetHeight(&finfo);
@@ -150,19 +150,19 @@ TeamListItem::IsSystemServer()
        static BPath systemServersPath;
        static BPath trackerPath;
        static BPath deskbarPath;
-       
+
        if (firstCall) {
                find_directory(B_SYSTEM_SERVERS_DIRECTORY, &systemServersPath);
 
                find_directory(B_SYSTEM_DIRECTORY, &trackerPath);
                trackerPath.Append("Tracker");
-               
+
                find_directory(B_SYSTEM_DIRECTORY, &deskbarPath);
                deskbarPath.Append("Deskbar");
-               
+
                firstCall = false;
        }
-       
+
        if (strncmp(systemServersPath.Path(), fTeamInfo.args,
                        strlen(systemServersPath.Path())) == 0)
                return true;
@@ -174,8 +174,8 @@ TeamListItem::IsSystemServer()
        if (strncmp(deskbarPath.Path(), fTeamInfo.args,
                        strlen(deskbarPath.Path())) == 0)
                return true;
-       
-       return false;           
+
+       return false;
 }
 
 

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

Revision:    hrev54595
Commit:      b8bd451e9f2f17e0441e718aa340ca394c086568
URL:         https://git.haiku-os.org/haiku/commit/?id=b8bd451e9f2f
Author:      Pascal Abresch <nep@xxxxxxxxxxxxxx>
Date:        Fri Sep 18 21:50:33 2020 UTC
Committer:   Adrien Destugues <pulkomandy@xxxxxxxxx>
Commit-Date: Wed Sep 23 06:30:19 2020 UTC

AboutSystem: Respect system colors

Change-Id: I2fac8c2a7ab9033cc730db373710a856a8827eb8
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3262
Reviewed-by: John Scipione <jscipione@xxxxxxxxx>

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

diff --git a/src/apps/aboutsystem/AboutSystem.cpp 
b/src/apps/aboutsystem/AboutSystem.cpp
index a12279e12e..5e719d667f 100644
--- a/src/apps/aboutsystem/AboutSystem.cpp
+++ b/src/apps/aboutsystem/AboutSystem.cpp
@@ -84,13 +84,11 @@ static const char* MemUsageToString(char string[], size_t 
size,
        system_info* info);
 
 
-static const rgb_color kDarkGrey = { 100, 100, 100, 255 };
-static const rgb_color kHaikuGreen = { 42, 131, 36, 255 };
-static const rgb_color kHaikuOrange = { 255, 69, 0, 255 };
-static const rgb_color kHaikuYellow = { 255, 176, 0, 255 };
-static const rgb_color kLinkBlue = { 80, 80, 200, 255 };
-static const rgb_color kBeOSBlue = { 0, 0, 200, 255 };
-static const rgb_color kBeOSRed = { 200, 0, 0, 255 };
+static const rgb_color kIdealHaikuGreen = { 42, 131, 36, 255 };
+static const rgb_color kIdealHaikuOrange = { 255, 69, 0, 255 };
+static const rgb_color kIdealHaikuYellow = { 255, 176, 0, 255 };
+static const rgb_color kIdealBeOSBlue = { 0, 0, 200, 255 };
+static const rgb_color kIdealBeOSRed = { 200, 0, 0, 255 };
 
 static const char* kBSDTwoClause = B_TRANSLATE_MARK("BSD (2-clause)");
 static const char* kBSDThreeClause = B_TRANSLATE_MARK("BSD (3-clause)");
@@ -241,6 +239,15 @@ private:
                        bigtime_t               fLastActionTime;
                        BMessageRunner* fScrollRunner;
                        PackageCreditMap fPackageCredits;
+
+private:
+                       rgb_color               fTextColor;
+                       rgb_color               fLinkColor;
+                       rgb_color               fHaikuOrangeColor;
+                       rgb_color               fHaikuGreenColor;
+                       rgb_color               fHaikuYellowColor;
+                       rgb_color               fBeOSRedColor;
+                       rgb_color               fBeOSBlueColor;
 };
 
 
@@ -423,6 +430,15 @@ AboutView::AboutView()
        fLastActionTime(system_time()),
        fScrollRunner(NULL)
 {
+       // Assign the colors, sadly this does not respect live color updates
+       fTextColor = ui_color(B_DOCUMENT_TEXT_COLOR);
+       fLinkColor = ui_color(B_LINK_TEXT_COLOR);
+       fHaikuOrangeColor = mix_color(fTextColor, kIdealHaikuOrange, 191);
+       fHaikuGreenColor = mix_color(fTextColor, kIdealHaikuGreen, 191);
+       fHaikuYellowColor = mix_color(fTextColor, kIdealHaikuYellow, 191);
+       fBeOSRedColor = mix_color(fTextColor, kIdealBeOSRed, 191);
+       fBeOSBlueColor = mix_color(fTextColor, kIdealBeOSBlue, 191);
+
        // Begin Construction of System Information controls
        system_info systemInfo;
        get_system_info(&systemInfo);
@@ -724,10 +740,10 @@ AboutView::AddCopyrightEntry(const char* name, const 
char* text,
        //font.SetSize(be_bold_font->Size());
        font.SetFace(B_BOLD_FACE | B_ITALIC_FACE);
 
-       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuYellow);
+       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &fHaikuYellowColor);
        fCreditsView->Insert(name);
        fCreditsView->Insert("\n");
-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
+       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &fTextColor);
        fCreditsView->Insert(text);
        fCreditsView->Insert("\n");
 
@@ -772,7 +788,7 @@ AboutView::AddCopyrightEntry(const char* name, const char* 
text,
                        parse_named_url(source, urlName, urlAddress);
 
                        fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL,
-                               &kLinkBlue);
+                               &fLinkColor);
                        fCreditsView->InsertHyperText(urlName,
                                new URLAction(urlAddress));
                }
@@ -786,7 +802,7 @@ AboutView::AddCopyrightEntry(const char* name, const char* 
text,
                parse_named_url(url, urlName, urlAddress);
 
                fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL,
-                       &kLinkBlue);
+                       &fLinkColor);
                fCreditsView->InsertHyperText(urlName,
                        new URLAction(urlAddress));
                fCreditsView->Insert("\n");
@@ -839,7 +855,7 @@ AboutView::PickRandomHaiku()
        font.SetFace(B_BOLD_FACE | B_ITALIC_FACE);
        fCreditsView->SelectAll();
        fCreditsView->Delete();
-       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kDarkGrey);
+       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &fTextColor);
        fCreditsView->Insert(s->String());
        fCreditsView->Insert("\n");
        while ((s = (BString*)haikuList.RemoveItem((int32)0))) {
@@ -902,7 +918,7 @@ AboutView::_CreateCreditsView()
        BFont font(be_bold_font);
        font.SetSize(font.Size() + 4);
 
-       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuGreen);
+       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &fHaikuGreenColor);
        fCreditsView->Insert("Haiku\n");
 
        char string[1024];
@@ -915,10 +931,10 @@ AboutView::_CreateCreditsView()
                B_TRANSLATE(COPYRIGHT_STRING "2001-%" B_PRId32 " The Haiku 
project. "),
                year);
 
-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
+       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &fTextColor);
        fCreditsView->Insert(string);
 
-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
+       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &fTextColor);
        fCreditsView->Insert(B_TRANSLATE("The copyright to the Haiku code is "
                "property of Haiku, Inc. or of the respective authors where 
expressly "
                "noted in the source. Haiku" B_UTF8_REGISTERED
@@ -926,7 +942,7 @@ AboutView::_CreateCreditsView()
                " are registered trademarks of Haiku, Inc."
                "\n\n"));
 
-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kLinkBlue);
+       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &fLinkColor);
        fCreditsView->InsertHyperText("https://www.haiku-os.org";,
                new URLAction("https://www.haiku-os.org";));
        fCreditsView->Insert("\n\n");
@@ -934,47 +950,47 @@ AboutView::_CreateCreditsView()
        font.SetSize(be_bold_font->Size());
        font.SetFace(B_BOLD_FACE | B_ITALIC_FACE);
 
-       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuOrange);
+       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &fHaikuOrangeColor);
        fCreditsView->Insert(B_TRANSLATE("Current maintainers:\n"));
 
-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
+       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &fTextColor);
        fCreditsView->Insert(kCurrentMaintainers);
 
-       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuOrange);
+       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &fHaikuOrangeColor);
        fCreditsView->Insert(B_TRANSLATE("Past maintainers:\n"));
 
-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
+       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &fTextColor);
        fCreditsView->Insert(kPastMaintainers);
 
-       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuOrange);
+       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &fHaikuOrangeColor);
        fCreditsView->Insert(B_TRANSLATE("Website & marketing:\n"));
 
-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
+       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &fTextColor);
        fCreditsView->Insert(kWebsiteTeam);
 
-       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuOrange);
+       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &fHaikuOrangeColor);
        fCreditsView->Insert(B_TRANSLATE("Past website & marketing:\n"));
 
-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
+       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &fTextColor);
        fCreditsView->Insert(kPastWebsiteTeam);
 
-       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuOrange);
+       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &fHaikuOrangeColor);
        fCreditsView->Insert(B_TRANSLATE("Testing and bug triaging:\n"));
 
-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
+       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &fTextColor);
        fCreditsView->Insert(kTestingTeam);
 
-       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuOrange);
+       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &fHaikuOrangeColor);
        fCreditsView->Insert(B_TRANSLATE("Contributors:\n"));
 
-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
+       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &fTextColor);
        fCreditsView->Insert(kContributors);
        fCreditsView->Insert(
                B_TRANSLATE("\n" B_UTF8_ELLIPSIS
                        "and probably some more we forgot to mention (sorry!)"
                        "\n\n"));
 
-       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuOrange);
+       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &fHaikuOrangeColor);
        fCreditsView->Insert(B_TRANSLATE("Translations:\n"));
 
        BLanguage* lang;
@@ -1002,29 +1018,29 @@ AboutView::_CreateCreditsView()
                        langName.Append(translation.languageCode);
                }
 
-               fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuGreen);
+               fCreditsView->SetFontAndColor(&font, B_FONT_ALL, 
&fHaikuGreenColor);
                fCreditsView->Insert("\n");
                fCreditsView->Insert(langName);
                fCreditsView->Insert("\n");
-               fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, 
&kDarkGrey);
+               fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, 
&fTextColor);
                fCreditsView->Insert(translation.names);
        }
 
-       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuOrange);
+       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &fHaikuOrangeColor);
        fCreditsView->Insert(B_TRANSLATE("\n\nSpecial thanks to:\n"));
 
-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
+       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &fTextColor);
        BString beosCredits(B_TRANSLATE(
                "Be Inc. and its developer team, for having created 
BeOS!\n\n"));
        int32 beosOffset = beosCredits.FindFirst("BeOS");
        fCreditsView->Insert(beosCredits.String(),
                (beosOffset < 0) ? beosCredits.Length() : beosOffset);
        if (beosOffset > -1) {
-               fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, 
&kBeOSBlue);
+               fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, 
&fBeOSBlueColor);
                fCreditsView->Insert("B");
-               fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, 
&kBeOSRed);
+               fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, 
&fBeOSRedColor);
                fCreditsView->Insert("e");
-               fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, 
&kDarkGrey);
+               fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, 
&fTextColor);
                beosCredits.Remove(0, beosOffset + 2);
                fCreditsView->Insert(beosCredits.String(), 
beosCredits.Length());
        }
@@ -1055,7 +1071,7 @@ AboutView::_CreateCreditsView()
 
        font.SetSize(be_bold_font->Size() + 4);
        font.SetFace(B_BOLD_FACE);
-       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuGreen);
+       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &fHaikuGreenColor);
        fCreditsView->Insert(B_TRANSLATE("\nCopyrights\n\n"));
 
 
@@ -1074,31 +1090,31 @@ AboutView::_CreateCreditsView()
        int32 licensePart4 = haikuLicense.FindLast(">");
        BString part;
        haikuLicense.CopyInto(part, 0, licensePart1);
-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
+       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &fTextColor);
        fCreditsView->Insert(part);
 
        part.Truncate(0);
        haikuLicense.CopyInto(part, licensePart1 + 1, licensePart2 - 1
                - licensePart1);
-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kLinkBlue);
+       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &fLinkColor);
        fCreditsView->InsertHyperText(part, new OpenFileAction(mitPath.Path()));
 
        part.Truncate(0);
        haikuLicense.CopyInto(part, licensePart2 + 1, licensePart3 - 1
                - licensePart2);
-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
+       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &fTextColor);
        fCreditsView->Insert(part);
 
        part.Truncate(0);
        haikuLicense.CopyInto(part, licensePart3 + 1, licensePart4 - 1
                - licensePart3);
-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kLinkBlue);
+       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &fLinkColor);
        fCreditsView->InsertHyperText(part, new 
OpenFileAction(lgplPath.Path()));
 
        part.Truncate(0);
        haikuLicense.CopyInto(part, licensePart4 + 1, haikuLicense.Length() - 1
                - licensePart4);
-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
+       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &fTextColor);
        fCreditsView->Insert(part);
 
        // GNU copyrights


Other related posts:

  • » [haiku-commits] haiku: hrev54595 - in src: apps/aboutsystem add-ons/input_server/devices/keyboard - Adrien Destugues