diff --git a/src/add-ons/input_server/devices/keyboard/TeamMonitorWindow.cpp b/src/add-ons/input_server/devices/keyboard/TeamMonitorWindow.cpp index 9241779d44..4ae9a25a8b 100644 --- a/src/add-ons/input_server/devices/keyboard/TeamMonitorWindow.cpp +++ b/src/add-ons/input_server/devices/keyboard/TeamMonitorWindow.cpp @@ -171,7 +171,7 @@ TeamMonitorWindow::TeamMonitorWindow() layout->SetSpacing(inset); SetLayout(layout); - layout->View()->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + layout->View()->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); fListView = new BListView("teams"); fListView->SetSelectionMessage(new BMessage(TM_SELECTED_TEAM)); @@ -606,7 +606,7 @@ TeamDescriptionView::TeamDescriptionView() BAlignment(B_ALIGN_HORIZONTAL_UNSET, B_ALIGN_VERTICAL_CENTER)); BView* teamPropertiesView = new BView("team properties", B_WILL_DRAW); - teamPropertiesView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + teamPropertiesView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); BGroupLayout* layout = new BGroupLayout(B_HORIZONTAL); teamPropertiesView->SetLayout(layout); BGroupLayoutBuilder(layout) @@ -738,7 +738,7 @@ AllShowingTextView::AllShowingTextView(const char* name) { MakeEditable(false); MakeSelectable(false); - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); } diff --git a/src/add-ons/mail_daemon/inbound_filters/match_header/ConfigView.cpp b/src/add-ons/mail_daemon/inbound_filters/match_header/ConfigView.cpp index 7e4698b989..7f3172e442 100644 --- a/src/add-ons/mail_daemon/inbound_filters/match_header/ConfigView.cpp +++ b/src/add-ons/mail_daemon/inbound_filters/match_header/ConfigView.cpp @@ -65,7 +65,7 @@ RuleFilterConfig::RuleFilterConfig(const BMailAddOnSettings& addOnSettings) BMailSettingsView("rulefilter_config"), fActionMenu(NULL) { - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); MatchHeaderSettings settings(addOnSettings); fAction = settings.Action(); diff --git a/src/add-ons/mail_daemon/inbound_filters/notifier/NotifierConfigView.cpp b/src/add-ons/mail_daemon/inbound_filters/notifier/NotifierConfigView.cpp index 2cb46d8004..c4dfb24cf3 100644 --- a/src/add-ons/mail_daemon/inbound_filters/notifier/NotifierConfigView.cpp +++ b/src/add-ons/mail_daemon/inbound_filters/notifier/NotifierConfigView.cpp @@ -32,7 +32,7 @@ NotifierConfigView::NotifierConfigView() : BMailSettingsView("notifier_config") { - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); BPopUpMenu *menu = new BPopUpMenu(B_EMPTY_STRING, false, false); diff --git a/src/add-ons/mail_daemon/inbound_filters/spam_filter/SpamFilterConfig.cpp b/src/add-ons/mail_daemon/inbound_filters/spam_filter/SpamFilterConfig.cpp index 1035c7521f..dc81c3e3a2 100644 --- a/src/add-ons/mail_daemon/inbound_filters/spam_filter/SpamFilterConfig.cpp +++ b/src/add-ons/mail_daemon/inbound_filters/spam_filter/SpamFilterConfig.cpp @@ -77,7 +77,7 @@ SpamFilterConfig::SpamFilterConfig(const BMessage* settings) if (settings->FindFloat("SpamCutoffRatio", &fSpamCutoffRatio) != B_OK) fSpamCutoffRatio = 0.99f; - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); fSubjectHintCheckBox = new BCheckBox("AddToSubject", B_TRANSLATE("Add spam rating to start of subject"), NULL); diff --git a/src/add-ons/mail_daemon/outbound_filters/fortune/ConfigView.cpp b/src/add-ons/mail_daemon/outbound_filters/fortune/ConfigView.cpp index dbabb4a404..141413c302 100644 --- a/src/add-ons/mail_daemon/outbound_filters/fortune/ConfigView.cpp +++ b/src/add-ons/mail_daemon/outbound_filters/fortune/ConfigView.cpp @@ -26,7 +26,7 @@ ConfigView::ConfigView() : BMailSettingsView("fortune_filter") { - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); fFileView = new MailFileConfigView(B_TRANSLATE("Fortune file:"), "fortune_file", false, "", B_FILE_NODE); diff --git a/src/add-ons/print/drivers/pdf/source/DocInfoWindow.cpp b/src/add-ons/print/drivers/pdf/source/DocInfoWindow.cpp index e1dd5e0720..5f9c0e7ad0 100644 --- a/src/add-ons/print/drivers/pdf/source/DocInfoWindow.cpp +++ b/src/add-ons/print/drivers/pdf/source/DocInfoWindow.cpp @@ -56,7 +56,7 @@ DocInfoWindow::DocInfoWindow(BMessage *docInfo) { BRect bounds(Bounds()); BView *background = new BView(bounds, "bachground", B_FOLLOW_ALL, B_WILL_DRAW); - background->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + background->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); AddChild(background); bounds.InsetBy(10.0, 10.0); @@ -238,7 +238,7 @@ DocInfoWindow::_SetupDocInfoView(BBox* panel) bounds.right -= B_V_SCROLL_BAR_WIDTH; bounds.InsetBy(2.0, 2.0); fTable = new BView(bounds, "table", B_FOLLOW_ALL, B_WILL_DRAW); - fTable->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + fTable->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); fTableScrollView = new BScrollView("scroll_table", fTable, B_FOLLOW_ALL, 0, false, true); diff --git a/src/add-ons/print/drivers/pdf/source/FontsWindow.cpp b/src/add-ons/print/drivers/pdf/source/FontsWindow.cpp index 8c01762521..1e4c622487 100644 --- a/src/add-ons/print/drivers/pdf/source/FontsWindow.cpp +++ b/src/add-ons/print/drivers/pdf/source/FontsWindow.cpp @@ -124,7 +124,7 @@ FontsWindow::FontsWindow(Fonts *fonts) // add a *dialog* background BView* embeddingPanel = new BView("Embedding", B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP); - embeddingPanel->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + embeddingPanel->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); // add font list #if USE_CLV @@ -166,7 +166,7 @@ FontsWindow::FontsWindow(Fonts *fonts) // add a *dialog* background BView* cjkPanel = new BView("CJK", B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP); - cjkPanel->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + cjkPanel->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); BListView* list = new DragListView(BRect(), diff --git a/src/add-ons/print/transports/hp_jetdirect/SetupWindow.cpp b/src/add-ons/print/transports/hp_jetdirect/SetupWindow.cpp index b0f831431e..84a0cf86d1 100644 --- a/src/add-ons/print/transports/hp_jetdirect/SetupWindow.cpp +++ b/src/add-ons/print/transports/hp_jetdirect/SetupWindow.cpp @@ -88,7 +88,7 @@ SetupView::SetupView(BRect frame, BDirectory* directory) : BView(frame, "", B_FOLLOW_ALL, B_WILL_DRAW), fPrinterDirectory(directory) { - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); } diff --git a/src/add-ons/print/transports/ipp/IppSetupDlg.cpp b/src/add-ons/print/transports/ipp/IppSetupDlg.cpp index 25720782b7..e59e5178bd 100644 --- a/src/add-ons/print/transports/ipp/IppSetupDlg.cpp +++ b/src/add-ons/print/transports/ipp/IppSetupDlg.cpp @@ -78,7 +78,7 @@ private: IppSetupView::IppSetupView(BRect frame, BDirectory *d) : BView(frame, "", B_FOLLOW_ALL, B_WILL_DRAW), dir(d) { - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); } void IppSetupView::AttachedToWindow() diff --git a/src/add-ons/print/transports/lpr/LprSetupDlg.cpp b/src/add-ons/print/transports/lpr/LprSetupDlg.cpp index 4fbf395f73..10339e2aa9 100644 --- a/src/add-ons/print/transports/lpr/LprSetupDlg.cpp +++ b/src/add-ons/print/transports/lpr/LprSetupDlg.cpp @@ -91,7 +91,7 @@ LprSetupView::LprSetupView(BRect frame, BDirectory *d) : BView(frame, "", B_FOLLOW_ALL, B_WILL_DRAW), fDir(d) { - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); } diff --git a/src/add-ons/screen_savers/glife/GLifeConfig.cpp b/src/add-ons/screen_savers/glife/GLifeConfig.cpp index e287f28802..8e3911ac0e 100644 --- a/src/add-ons/screen_savers/glife/GLifeConfig.cpp +++ b/src/add-ons/screen_savers/glife/GLifeConfig.cpp @@ -32,7 +32,7 @@ GLifeConfig::GLifeConfig(BRect frame, GLifeState* pglsState) m_pglsState(pglsState) { SetLayout(new BGroupLayout(B_HORIZONTAL)); - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); // Info text BStringView* name = new BStringView(frame, B_EMPTY_STRING, diff --git a/src/add-ons/screen_savers/gravity/ConfigView.cpp b/src/add-ons/screen_savers/gravity/ConfigView.cpp index ddaba2c3d3..6b68afba23 100644 --- a/src/add-ons/screen_savers/gravity/ConfigView.cpp +++ b/src/add-ons/screen_savers/gravity/ConfigView.cpp @@ -40,7 +40,7 @@ ConfigView::ConfigView(BRect frame, Gravity* parent) B_WILL_DRAW | B_NAVIGABLE)) { SetLayout(new BGroupLayout(B_HORIZONTAL)); - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); fShadeList->SetSelectionMessage(new BMessage(kMsgShade)); diff --git a/src/add-ons/screen_savers/nebula/Nebula.cpp b/src/add-ons/screen_savers/nebula/Nebula.cpp index 067c146afd..96d9c7fdb3 100644 --- a/src/add-ons/screen_savers/nebula/Nebula.cpp +++ b/src/add-ons/screen_savers/nebula/Nebula.cpp @@ -604,7 +604,7 @@ SettingsView::SettingsView(BRect frame) void SettingsView::AttachedToWindow() { - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); fWidthMenu->Menu()->SetTargetForItems(this); fColorMenu->Menu()->SetTargetForItems(this); diff --git a/src/add-ons/screen_savers/slideshowsaver/SlideShowConfigView.cpp b/src/add-ons/screen_savers/slideshowsaver/SlideShowConfigView.cpp index bbbfee70ab..060701d9c6 100644 --- a/src/add-ons/screen_savers/slideshowsaver/SlideShowConfigView.cpp +++ b/src/add-ons/screen_savers/slideshowsaver/SlideShowConfigView.cpp @@ -60,7 +60,7 @@ SlideShowConfigView::SlideShowConfigView(const BRect &frame, const char *name, { fSettings = settings; - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); BMessage *pMsg; int32 val; diff --git a/src/add-ons/screen_savers/spider/SpiderSaver.cpp b/src/add-ons/screen_savers/spider/SpiderSaver.cpp index eddc571ad5..a541542200 100644 --- a/src/add-ons/screen_savers/spider/SpiderSaver.cpp +++ b/src/add-ons/screen_savers/spider/SpiderSaver.cpp @@ -338,7 +338,7 @@ SpiderView::SpiderView(BRect frame, SpiderSaver* saver, : BView(frame, "spider view", B_FOLLOW_NONE, B_WILL_DRAW | B_PULSE_NEEDED), fSaver(saver) { - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); frame.OffsetTo(0.0, 0.0); frame.InsetBy(10.0, 5.0); diff --git a/src/apps/aboutsystem/AboutSystem.cpp b/src/apps/aboutsystem/AboutSystem.cpp index 00483dc152..d00ebbce25 100644 --- a/src/apps/aboutsystem/AboutSystem.cpp +++ b/src/apps/aboutsystem/AboutSystem.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -143,11 +144,15 @@ public: }; +class AboutView; + class AboutWindow : public BWindow { public: AboutWindow(); virtual bool QuitRequested(); + + AboutView* fAboutView; }; @@ -192,6 +197,7 @@ public: ~AboutView(); virtual void AttachedToWindow(); + virtual void AllAttached(); virtual void Pulse(); virtual void MessageReceived(BMessage* msg); @@ -207,6 +213,7 @@ public: void PickRandomHaiku(); + void _AdjustTextColors(); private: typedef std::map PackageCreditMap; @@ -220,10 +227,13 @@ private: void _AddPackageCreditEntries(); BStringView* fMemView; - BTextView* fUptimeView; + BStringView* fUptimeView; BView* fInfoView; HyperTextView* fCreditsView; + BObjectList fTextViews; + BObjectList fSubTextViews; + BBitmap* fLogo; bigtime_t fLastActionTime; @@ -267,7 +277,8 @@ AboutWindow::AboutWindow() B_TITLED_WINDOW, B_AUTO_UPDATE_SIZE_LIMITS | B_NOT_ZOOMABLE) { SetLayout(new BGroupLayout(B_VERTICAL)); - AddChild(new AboutView()); + fAboutView = new AboutView(); + AddChild(fAboutView); // Make sure we take the minimal window size into account when centering BSize size = GetLayout()->MinSize(); @@ -411,7 +422,6 @@ AboutView::AboutView() fScrollRunner(NULL) { // Begin Construction of System Information controls - system_info systemInfo; get_system_info(&systemInfo); @@ -449,10 +459,12 @@ AboutView::AboutView() } BStringView* versionView = new BStringView("ostext", string); + fSubTextViews.AddItem(versionView); versionView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_UNSET)); BStringView* abiView = new BStringView("abitext", B_HAIKU_ABI_NAME); + fSubTextViews.AddItem(abiView); abiView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_UNSET)); @@ -500,6 +512,7 @@ AboutView::AboutView() << " " << get_cpu_model_string(platform, cpuVendor, cpuModel); BStringView* cpuView = new BStringView("cputext", cpuType.String()); + fSubTextViews.AddItem(cpuView); cpuView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_UNSET)); @@ -511,16 +524,20 @@ AboutView::AboutView() clockSpeed / 1000.0f); BStringView* frequencyView = new BStringView("frequencytext", string); + fSubTextViews.AddItem(frequencyView); frequencyView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_UNSET)); // RAM BStringView *memSizeView = new BStringView("ramsizetext", MemSizeToString(string, sizeof(string), &systemInfo)); + fSubTextViews.AddItem(memSizeView); memSizeView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_UNSET)); + fMemView = new BStringView("ramtext", MemUsageToString(string, sizeof(string), &systemInfo)); + fSubTextViews.AddItem(fMemView); fMemView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_UNSET)); @@ -539,22 +556,19 @@ AboutView::AboutView() buildTimeDate.SetTo(kernelTimeDate); BStringView* kernelView = new BStringView("kerneltext", buildTimeDate); + fSubTextViews.AddItem(kernelView); kernelView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_UNSET)); // Uptime - fUptimeView = new BTextView("uptimetext"); - fUptimeView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - fUptimeView->MakeEditable(false); - fUptimeView->MakeSelectable(false); - fUptimeView->SetWordWrap(true); - + fUptimeView = new BStringView("uptimetext", "..."); + fSubTextViews.AddItem(fUptimeView); fUptimeView->SetText(UptimeToString(string, sizeof(string))); const float offset = 5; SetLayout(new BGroupLayout(B_HORIZONTAL, 0)); - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); BLayoutBuilder::Group<>((BGroupLayout*)GetLayout()) .AddGroup(B_VERTICAL, 0) @@ -608,6 +622,14 @@ AboutView::AttachedToWindow() BView::AttachedToWindow(); Window()->SetPulseRate(500000); SetEventMask(B_POINTER_EVENTS); + DoLayout(); +} + + +void +AboutView::AllAttached() +{ + _AdjustTextColors(); } @@ -647,6 +669,13 @@ void AboutView::MessageReceived(BMessage* msg) { switch (msg->what) { + case B_COLORS_UPDATED: + { + if (msg->HasColor(ui_color_name(B_PANEL_TEXT_COLOR))) + _AdjustTextColors(); + + break; + } case SCROLL_CREDITS_VIEW: { BScrollBar* scrollBar = @@ -816,6 +845,28 @@ AboutView::PickRandomHaiku() } +void +AboutView::_AdjustTextColors() +{ + rgb_color textColor = ui_color(B_PANEL_TEXT_COLOR); + rgb_color color = mix_color(ViewColor(), textColor, 192); + + BView* view = NULL; + for (int32 index = 0; index < fSubTextViews.CountItems(); ++index) { + view = fSubTextViews.ItemAt(index); + view->SetHighColor(color); + view->Invalidate(); + } + + // Labels + for (int32 index = 0; index < fTextViews.CountItems(); ++index) { + view = fTextViews.ItemAt(index); + view->SetHighColor(textColor); + view->Invalidate(); + } +} + + BView* AboutView::_CreateLabel(const char* name, const char* label) { @@ -823,6 +874,7 @@ AboutView::_CreateLabel(const char* name, const char* label) labelView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_UNSET)); labelView->SetFont(be_bold_font); + fTextViews.AddItem(labelView); return labelView; } @@ -837,7 +889,7 @@ AboutView::_CreateCreditsView() fCreditsView->MakeEditable(false); fCreditsView->SetWordWrap(true); fCreditsView->SetInsets(5, 5, 5, 5); - fCreditsView->SetViewColor(ui_color(B_DOCUMENT_BACKGROUND_COLOR)); + fCreditsView->SetViewUIColor(B_DOCUMENT_BACKGROUND_COLOR); BScrollView* creditsScroller = new BScrollView("creditsScroller", fCreditsView, B_WILL_DRAW | B_FRAME_EVENTS, false, true, diff --git a/src/apps/aboutsystem/Jamfile b/src/apps/aboutsystem/Jamfile index ca23780132..8b2354fc6c 100644 --- a/src/apps/aboutsystem/Jamfile +++ b/src/apps/aboutsystem/Jamfile @@ -1,6 +1,6 @@ SubDir HAIKU_TOP src apps aboutsystem ; -UsePrivateHeaders app libroot shared ; +UsePrivateHeaders app interface libroot shared ; Application AboutSystem : AboutSystem.cpp diff --git a/src/apps/activitymonitor/ActivityView.cpp b/src/apps/activitymonitor/ActivityView.cpp index 2e9a405092..2f8e86cacf 100644 --- a/src/apps/activitymonitor/ActivityView.cpp +++ b/src/apps/activitymonitor/ActivityView.cpp @@ -576,7 +576,7 @@ ActivityView::ActivityView(const char* name, const BMessage* settings) #endif fSourcesLock("data sources") { - SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetLowUIColor(B_PANEL_BACKGROUND_COLOR); _Init(settings); @@ -1121,7 +1121,6 @@ ActivityView::MessageReceived(BMessage* message) break; } - case kMsgUpdateResolution: { int32 resolution; @@ -1479,7 +1478,9 @@ ActivityView::Draw(BRect updateRect) // draw legend BRect legendFrame = _LegendFrame(); - SetLowColor(fLegendBackgroundColor); + if (LowUIColor() == B_NO_COLOR) + SetLowColor(fLegendBackgroundColor); + if (drawBackground) { BRect backgroundFrame(legendFrame); backgroundFrame.bottom += kDraggerSize; @@ -1520,7 +1521,7 @@ ActivityView::Draw(BRect updateRect) TruncateString(&label, B_TRUNCATE_MIDDLE, possibleLabelWidth); if (drawBackground) - SetHighColor(ui_color(B_CONTROL_TEXT_COLOR)); + SetHighColor(ui_color(B_PANEL_TEXT_COLOR)); if (be_control_look == NULL) { DrawString(label.String(), BPoint(6 + colorBox.right, y)); diff --git a/src/apps/activitymonitor/ActivityWindow.cpp b/src/apps/activitymonitor/ActivityWindow.cpp index ce5961cdb0..f72794c161 100644 --- a/src/apps/activitymonitor/ActivityWindow.cpp +++ b/src/apps/activitymonitor/ActivityWindow.cpp @@ -68,8 +68,8 @@ ActivityWindow::ActivityWindow() fLayout->SetSpacing(inset); BView* top = new BView("top", 0, fLayout); - top->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); layout->AddView(top); + top->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); BMessage viewState; int32 count = 0; @@ -99,7 +99,6 @@ ActivityWindow::ActivityWindow() topRect.top = menuBar->Bounds().bottom + 1; BView* top = new BView(topRect, "top", B_FOLLOW_ALL, 0); - top->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); layout->AddChild(top); BMessage viewState; diff --git a/src/apps/activitymonitor/SettingsWindow.cpp b/src/apps/activitymonitor/SettingsWindow.cpp index 67829b060e..57b54571aa 100644 --- a/src/apps/activitymonitor/SettingsWindow.cpp +++ b/src/apps/activitymonitor/SettingsWindow.cpp @@ -38,6 +38,7 @@ public: SetLimitLabels(min.String(), max.String()); SetHashMarks(B_HASH_MARKS_BOTTOM); SetHashMarkCount(levels); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); if (message != NULL) SetModificationMessage(new BMessage(*message)); diff --git a/src/apps/bootmanager/BootManagerWindow.cpp b/src/apps/bootmanager/BootManagerWindow.cpp index 813f9856a4..24330c3fdd 100644 --- a/src/apps/bootmanager/BootManagerWindow.cpp +++ b/src/apps/bootmanager/BootManagerWindow.cpp @@ -34,7 +34,13 @@ BootManagerWindow::BootManagerWindow() { float minWidth, maxWidth, minHeight, maxHeight; GetSizeLimits(&minWidth, &maxWidth, &minHeight, &maxHeight); - SetSizeLimits(250, maxWidth, 250, maxHeight); + + // Use font to determine necessary size of window: + const BFont* font = be_plain_font; + minWidth = 400 * (double)font->Size() / 12.0f; + minHeight = 250 * (double)font->Size() / 12.0f; + + SetSizeLimits(minWidth, maxWidth, minHeight, maxHeight); fWizardView = new WizardView("wizard"); BLayoutBuilder::Group<>(this) diff --git a/src/apps/bootmanager/WizardPageView.cpp b/src/apps/bootmanager/WizardPageView.cpp index 59fe46ef2b..25b6419256 100644 --- a/src/apps/bootmanager/WizardPageView.cpp +++ b/src/apps/bootmanager/WizardPageView.cpp @@ -21,7 +21,7 @@ WizardPageView::WizardPageView(BMessage* settings, BRect frame, BView(frame, name, resizingMode, flags), fSettings(settings) { - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); } @@ -30,7 +30,7 @@ WizardPageView::WizardPageView(BMessage* settings, const char* name) BView(name, B_WILL_DRAW), fSettings(settings) { - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); } @@ -54,9 +54,10 @@ WizardPageView::CreateDescription(BRect frame, const char* name, B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP, B_WILL_DRAW | B_PULSE_NEEDED | B_FRAME_EVENTS); view->MakeEditable(false); - view->SetViewColor(ViewColor()); + view->SetViewUIColor(ViewUIColor()); view->SetStylable(true); view->SetText(description); + return view; } @@ -67,9 +68,10 @@ WizardPageView::CreateDescription(const char* name, { BTextView* view = new BTextView("text"); view->MakeEditable(false); - view->SetViewColor(ViewColor()); + view->SetViewUIColor(ViewUIColor()); view->SetStylable(true); view->SetText(description); + return view; } @@ -84,7 +86,15 @@ WizardPageView::MakeHeading(BTextView* view) BFont font; view->GetFont(&font); font.SetFace(B_BOLD_FACE); - view->SetFontAndColor(0, indexFirstLineEnd, &font); + font.SetSize(font.Size() + 1); + rgb_color color = ui_color(B_PANEL_TEXT_COLOR); + view->SetFontAndColor(0, indexFirstLineEnd, &font, B_FONT_ALL, + &color); + + font.SetFace(B_REGULAR_FACE); + font.SetSize(font.Size() - 1); + view->SetFontAndColor(indexFirstLineEnd + 1, view->TextLength(), + &font, B_FONT_ALL, &color); } } diff --git a/src/apps/charactermap/CharacterView.cpp b/src/apps/charactermap/CharacterView.cpp index 3f311e3d41..0aee125d58 100644 --- a/src/apps/charactermap/CharacterView.cpp +++ b/src/apps/charactermap/CharacterView.cpp @@ -237,6 +237,8 @@ CharacterView::AttachedToWindow() { Window()->AddShortcut('C', B_SHIFT_KEY, new BMessage(kMsgCopyAsEscapedString), this); + SetViewColor(255, 255, 255, 255); + SetLowColor(ViewColor()); } @@ -402,6 +404,11 @@ CharacterView::Draw(BRect updateRect) BFont font; GetFont(&font); + rgb_color color = (rgb_color){0, 0, 0, 255}; + rgb_color highlight = (rgb_color){220, 220, 220, 255}; + rgb_color enclose = mix_color(highlight, + ui_color(B_CONTROL_HIGHLIGHT_COLOR), 128); + for (int32 i = _BlockAt(updateRect.LeftTop()); i < (int32)kNumUnicodeBlocks; i++) { if (!IsShowingBlock(i)) @@ -411,7 +418,7 @@ CharacterView::Draw(BRect updateRect) if (y > updateRect.bottom) break; - SetHighColor(0, 0, 0); + SetHighColor(color); DrawString(kUnicodeBlocks[i].name, BPoint(3, y + fTitleBase)); y += fTitleHeight; @@ -424,11 +431,14 @@ CharacterView::Draw(BRect updateRect) && y < updateRect.bottom) { // Stroke frame around the active character if (fHasCharacter && fCurrentCharacter == c) { - SetHighColor(tint_color(ViewColor(), 1.05f)); + SetHighColor(highlight); FillRect(BRect(x, y, x + fCharacterWidth, y + fCharacterHeight - fGap)); + SetHighColor(enclose); + StrokeRect(BRect(x, y, x + fCharacterWidth, + y + fCharacterHeight - fGap)); - SetHighColor(0, 0, 0); + SetHighColor(color); } // Draw character diff --git a/src/apps/debugger/user_interface/gui/inspector_window/InspectorWindow.cpp b/src/apps/debugger/user_interface/gui/inspector_window/InspectorWindow.cpp index 68efbeef8f..91bc8d4e0c 100644 --- a/src/apps/debugger/user_interface/gui/inspector_window/InspectorWindow.cpp +++ b/src/apps/debugger/user_interface/gui/inspector_window/InspectorWindow.cpp @@ -181,9 +181,9 @@ InspectorWindow::_Init() .End() .End(); - fHexMode->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - fEndianMode->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - fTextMode->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + fHexMode->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); + fEndianMode->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); + fTextMode->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); int32 targetEndian = fTeam->GetArchitecture()->IsBigEndian() ? EndianModeBigEndian : EndianModeLittleEndian; 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 e1cacc84af..18bb9f5709 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; @@ -689,7 +689,7 @@ MemoryView::MaxSize() void MemoryView::_Init() { - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); } diff --git a/src/apps/debugger/user_interface/gui/utility_windows/ExpressionPromptWindow.cpp b/src/apps/debugger/user_interface/gui/utility_windows/ExpressionPromptWindow.cpp index 10adc1abc3..69f55c9f8b 100644 --- a/src/apps/debugger/user_interface/gui/utility_windows/ExpressionPromptWindow.cpp +++ b/src/apps/debugger/user_interface/gui/utility_windows/ExpressionPromptWindow.cpp @@ -57,7 +57,7 @@ ExpressionPromptWindow::_Init() BLayoutItem* inputItem = fExpressionInput->CreateTextViewLayoutItem(); inputItem->SetExplicitMinSize(BSize(200.0, B_SIZE_UNSET)); inputItem->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET)); - labelItem->View()->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + labelItem->View()->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); BLayoutBuilder::Group<>(this, B_VERTICAL) .SetInsets(B_USE_DEFAULT_SPACING) diff --git a/src/apps/debugger/user_interface/gui/utility_windows/WatchPromptWindow.cpp b/src/apps/debugger/user_interface/gui/utility_windows/WatchPromptWindow.cpp index 218599ee62..2523fa5a0a 100644 --- a/src/apps/debugger/user_interface/gui/utility_windows/WatchPromptWindow.cpp +++ b/src/apps/debugger/user_interface/gui/utility_windows/WatchPromptWindow.cpp @@ -127,7 +127,7 @@ WatchPromptWindow::_Init() fTypeField = new BMenuField("Type:", typeMenu); BLayoutItem* labelItem = fTypeField->CreateLabelLayoutItem(); - labelItem->View()->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + labelItem->View()->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); BLayoutBuilder::Group<>(this, B_VERTICAL) .SetInsets(B_USE_DEFAULT_SPACING) .AddGroup(B_HORIZONTAL, 4.0f) diff --git a/src/apps/deskcalc/CalcView.cpp b/src/apps/deskcalc/CalcView.cpp index bfdd87baec..560e75d37b 100644 --- a/src/apps/deskcalc/CalcView.cpp +++ b/src/apps/deskcalc/CalcView.cpp @@ -231,6 +231,12 @@ CalcView::AttachedToWindow() void CalcView::MessageReceived(BMessage* message) { + if (message->what == B_COLORS_UPDATED + && message->HasColor(ui_color_name(B_PANEL_BACKGROUND_COLOR))) { + _Colorize(); + return; + } + if (Parent() && (Parent()->Flags() & B_DRAW_ON_CHILDREN) != 0) { // if we are embedded in desktop we need to receive these // message here since we don't have a parent BWindow @@ -504,7 +510,7 @@ CalcView::Draw(BRect updateRect) be_control_look->DrawLabel(this, key->label, frame, updateRect, fBaseColor, flags, BAlignment(B_ALIGN_HORIZONTAL_CENTER, - B_ALIGN_VERTICAL_CENTER)); + B_ALIGN_VERTICAL_CENTER), &fButtonTextColor); key++; } @@ -1288,6 +1294,8 @@ CalcView::_AudioFeedback(bool inBackGround) void CalcView::_Colorize() { + fBaseColor = ui_color(B_PANEL_BACKGROUND_COLOR); + // calculate light and dark color from base color fLightColor.red = (uint8)(fBaseColor.red * 1.25); fLightColor.green = (uint8)(fBaseColor.green * 1.25); @@ -1300,16 +1308,13 @@ CalcView::_Colorize() fDarkColor.alpha = 255; // keypad text color - uint8 lightness = (fBaseColor.red + fBaseColor.green + fBaseColor.blue) / 3; - if (lightness > 200) + if (fBaseColor.Brightness() > 100) fButtonTextColor = (rgb_color){ 0, 0, 0, 255 }; else fButtonTextColor = (rgb_color){ 255, 255, 255, 255 }; // expression text color - lightness = (fExpressionBGColor.red - + fExpressionBGColor.green + fExpressionBGColor.blue) / 3; - if (lightness > 200) + if (fExpressionBGColor.Brightness() > 100) fExpressionTextColor = (rgb_color){ 0, 0, 0, 255 }; else fExpressionTextColor = (rgb_color){ 255, 255, 255, 255 }; diff --git a/src/apps/devices/PropertyListPlain.cpp b/src/apps/devices/PropertyListPlain.cpp index 44d1d0318c..f8687d5006 100644 --- a/src/apps/devices/PropertyListPlain.cpp +++ b/src/apps/devices/PropertyListPlain.cpp @@ -26,7 +26,7 @@ PropertyListPlain::PropertyListPlain(const char* name) : BView(name, 0, NULL) { - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); SetLayout(new BGroupLayout(B_VERTICAL)); } @@ -42,10 +42,13 @@ PropertyListPlain::AddAttributes(const Attributes& attributes) { RemoveAll(); BGroupLayoutBuilder layout(B_VERTICAL); - BTextView* view = new BTextView(BRect(0, 0, 1000, 1000), - "", BRect(5, 5, 995, 995), B_FOLLOW_ALL_SIDES); - view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + BTextView* view = new BTextView(BRect(0, 0, 1000, 1000), + "attribs", BRect(5, 5, 995, 995), B_FOLLOW_ALL_SIDES); + + rgb_color textColor = ui_color(B_PANEL_TEXT_COLOR); + view->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); + view->SetFontAndColor(be_plain_font, B_FONT_ALL, &textColor); view->MakeEditable(false); for (unsigned int i = 0; i < attributes.size(); i++) { @@ -59,6 +62,7 @@ PropertyListPlain::AddAttributes(const Attributes& attributes) } layout.Add(view); + fAttributeViews.AddItem(view); AddChild(layout); } @@ -78,6 +82,22 @@ void PropertyListPlain::MessageReceived(BMessage* message) { switch (message->what) { + case B_COLORS_UPDATED: + { + rgb_color color; + if (message->FindColor(ui_color_name(B_PANEL_TEXT_COLOR), &color) + != B_OK) + break; + + BTextView* view = NULL; + int32 count = fAttributeViews.CountItems(); + for (int32 index = 0; index < count; ++index) { + view = fAttributeViews.ItemAt(index); + view->SetFontAndColor(be_plain_font, 0, &color); + } + break; + } + default: BView::MessageReceived(message); } diff --git a/src/apps/devices/PropertyListPlain.h b/src/apps/devices/PropertyListPlain.h index bbfc00fba9..19e9139952 100644 --- a/src/apps/devices/PropertyListPlain.h +++ b/src/apps/devices/PropertyListPlain.h @@ -10,6 +10,8 @@ #define PROPERTY_LIST_PLAIN_H +#include +#include #include #include "Device.h" @@ -28,6 +30,7 @@ public: virtual void DetachedFromWindow(); private: BView* rootView; + BObjectList fAttributeViews; }; #endif /* PROPERTY_LIST_PLAIN_H */ diff --git a/src/apps/devices/ResourceUsageWindow.cpp b/src/apps/devices/ResourceUsageWindow.cpp index d7c9aa1522..b9380ae6cf 100644 --- a/src/apps/devices/ResourceUsageWindow.cpp +++ b/src/apps/devices/ResourceUsageWindow.cpp @@ -220,7 +220,7 @@ void ResourceUsageWindow::InitWindow(BList &list) // Create the TabView and Tabs BTabView *tabView = new BTabView(rtab,"resource_usage_tabview"); - tabView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + tabView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); rtab = tabView->Bounds(); rtab.InsetBy(5,5); diff --git a/src/apps/diskprobe/FindWindow.cpp b/src/apps/diskprobe/FindWindow.cpp index 0ed756f9d0..eee1c1720c 100644 --- a/src/apps/diskprobe/FindWindow.cpp +++ b/src/apps/diskprobe/FindWindow.cpp @@ -492,7 +492,7 @@ FindWindow::FindWindow(BRect _rect, BMessage& previous, BMessenger& target, fTarget(target) { BView* view = new BView(Bounds(), "main", B_FOLLOW_ALL, 0); - view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + view->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); AddChild(view); int8 mode = kAsciiMode; diff --git a/src/apps/diskprobe/ProbeView.cpp b/src/apps/diskprobe/ProbeView.cpp index 863df7075a..b8683f93a0 100644 --- a/src/apps/diskprobe/ProbeView.cpp +++ b/src/apps/diskprobe/ProbeView.cpp @@ -251,7 +251,7 @@ IconView::AttachedToWindow() if (Parent() != NULL) SetViewColor(Parent()->ViewColor()); else - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); } @@ -480,7 +480,7 @@ HeaderView::HeaderView(const entry_ref *ref, DataEditor &editor) fPosition(0), fLastPosition(0) { - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); GridLayout()->SetInsets(B_USE_WINDOW_SPACING, B_USE_WINDOW_SPACING, B_USE_WINDOW_SPACING, B_USE_DEFAULT_SPACING); @@ -1102,7 +1102,7 @@ TypeView::TypeView(BRect rect, const char* name, int32 index, DataEditor& editor, int32 resizingMode) : BView(rect, name, resizingMode, B_FRAME_EVENTS) { - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); fTypeEditorView = GetTypeEditorAt(index, Frame(), editor); if (fTypeEditorView == NULL) { diff --git a/src/apps/diskprobe/TypeEditors.cpp b/src/apps/diskprobe/TypeEditors.cpp index f5708fbdcf..6cbb581280 100644 --- a/src/apps/diskprobe/TypeEditors.cpp +++ b/src/apps/diskprobe/TypeEditors.cpp @@ -205,7 +205,7 @@ TypeEditorView::TypeMatches() StringEditor::StringEditor(DataEditor& editor) : TypeEditorView(B_TRANSLATE("String editor"), 0, editor) { - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); SetLayout(new BGroupLayout(B_VERTICAL)); BStringView *stringView = new BStringView(B_EMPTY_STRING, @@ -283,7 +283,7 @@ StringEditor::MessageReceived(BMessage *message) MimeTypeEditor::MimeTypeEditor(BRect rect, DataEditor& editor) : TypeEditorView(rect, B_TRANSLATE("MIME type editor"), B_FOLLOW_LEFT_RIGHT, 0, editor) { - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); fTextControl = new BTextControl(rect.InsetByCopy(5, 5), B_EMPTY_STRING, B_TRANSLATE("MIME type:"), NULL, new BMessage(kMsgValueChanged), B_FOLLOW_ALL); @@ -374,7 +374,7 @@ MimeTypeEditor::MessageReceived(BMessage *message) NumberEditor::NumberEditor(BRect rect, DataEditor &editor) : TypeEditorView(rect, B_TRANSLATE("Number editor"), B_FOLLOW_LEFT_RIGHT, 0, editor) { - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); fTextControl = new BTextControl(rect.InsetByCopy(5, 5), B_EMPTY_STRING, _TypeLabel(), NULL, new BMessage(kMsgValueChanged), B_FOLLOW_ALL); @@ -750,7 +750,7 @@ NumberEditor::MessageReceived(BMessage *message) BooleanEditor::BooleanEditor(BRect rect, DataEditor &editor) : TypeEditorView(rect, B_TRANSLATE("Boolean editor"), B_FOLLOW_NONE, 0, editor) { - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); BPopUpMenu *menu = new BPopUpMenu("bool"); BMessage *message; @@ -906,7 +906,7 @@ ImageView::AttachedToWindow() if (Parent() != NULL) SetViewColor(Parent()->ViewColor()); else - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); fEditor.StartWatching(this); if (fScaleSlider != NULL) @@ -1119,7 +1119,7 @@ ImageView::_UpdateImage() MessageView::MessageView(BRect rect, DataEditor &editor) : TypeEditorView(rect, B_TRANSLATE("Message View"), B_FOLLOW_ALL, 0, editor) { - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); rect = Bounds().InsetByCopy(10, 10); rect.right -= B_V_SCROLL_BAR_WIDTH; @@ -1128,8 +1128,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/drivesetup/DiskView.cpp b/src/apps/drivesetup/DiskView.cpp index 8980cfe5b4..e560e5beb3 100644 --- a/src/apps/drivesetup/DiskView.cpp +++ b/src/apps/drivesetup/DiskView.cpp @@ -349,9 +349,8 @@ DiskView::DiskView(const BRect& frame, uint32 resizeMode, SetLayout(layout); SetViewColor(B_TRANSPARENT_COLOR); - rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR); - SetHighColor(tint_color(base, B_DARKEN_2_TINT)); - SetLowColor(tint_color(base, (B_DARKEN_2_TINT + B_DARKEN_1_TINT) / 2)); + SetHighUIColor(B_PANEL_BACKGROUND_COLOR, B_DARKEN_2_TINT); + SetLowUIColor(B_PANEL_BACKGROUND_COLOR, 1.221f); #ifdef HAIKU_TARGET_PLATFORM_LIBBE_TEST PartitionView* view; @@ -421,7 +420,13 @@ DiskView::Draw(BRect updateRect) (bounds.Height() - (fh.ascent + fh.descent) * 2) / 2.0); FillRoundRect(messageBounds, 4, 4, B_SOLID_LOW); - SetHighColor(tint_color(HighColor(), B_DARKEN_4_TINT)); + rgb_color color = LowColor(); + if (color.Brightness() > 100) + color = tint_color(color, B_DARKEN_4_TINT); + else + color = tint_color(color, B_LIGHTEN_2_TINT); + + SetHighColor(color); BPoint textOffset; textOffset.x = messageBounds.left + fh.ascent; textOffset.y = (messageBounds.top + messageBounds.bottom diff --git a/src/apps/expander/PasswordAlert.cpp b/src/apps/expander/PasswordAlert.cpp index 8469deb4cc..a99cd79aef 100644 --- a/src/apps/expander/PasswordAlert.cpp +++ b/src/apps/expander/PasswordAlert.cpp @@ -64,7 +64,7 @@ PasswordAlert::PasswordAlert(const char* title, const char* text) fTextControl = new BTextControl(textControlRect, "_password_", text, NULL, new BMessage('pass'), B_FOLLOW_ALL); - fTextControl->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + fTextControl->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); fTextControl->TextView()->HideTyping(true); fTextControl->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT); fTextControl->SetDivider(10 + fTextControl->StringWidth(text)); @@ -190,7 +190,7 @@ TAlertView::TAlertView(BRect frame) BView(frame, "TAlertView", B_FOLLOW_ALL_SIDES, B_WILL_DRAW), fIconBitmap(NULL) { - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); } diff --git a/src/apps/firstbootprompt/BootPromptWindow.cpp b/src/apps/firstbootprompt/BootPromptWindow.cpp index b80b2bf56a..afc350c180 100644 --- a/src/apps/firstbootprompt/BootPromptWindow.cpp +++ b/src/apps/firstbootprompt/BootPromptWindow.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -155,11 +156,22 @@ BootPromptWindow::BootPromptWindow() { SetSizeLimits(450, 16384, 350, 16384); + rgb_color textColor = ui_color(B_PANEL_TEXT_COLOR); fInfoTextView = new BTextView(""); - fInfoTextView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + fInfoTextView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); + fInfoTextView->SetFontAndColor(be_plain_font, B_FONT_ALL, &textColor); fInfoTextView->MakeEditable(false); fInfoTextView->MakeSelectable(false); + // Carefully designed to not exceed the 640x480 resolution with a 12pt font. + float width = fInfoTextView->StringWidth("Thank you for trying out Haiku," + " We hope you like it!") * 1.5; + float height = be_plain_font->Size() * 36; + + BRect newFrame(0, 0, width, height); + newFrame = newFrame & BScreen().Frame(); + ResizeTo(newFrame.Width(), newFrame.Height()); + fDesktopButton = new BButton("", new BMessage(MSG_BOOT_DESKTOP)); fDesktopButton->SetTarget(be_app); fDesktopButton->MakeDefault(true); diff --git a/src/apps/fontdemo/ControlView.cpp b/src/apps/fontdemo/ControlView.cpp index 7c15aae8ec..65f601d3da 100644 --- a/src/apps/fontdemo/ControlView.cpp +++ b/src/apps/fontdemo/ControlView.cpp @@ -48,7 +48,7 @@ ControlView::ControlView() fCycleFonts(false), fFontStyleindex(0) { - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); GroupLayout()->SetInsets(B_USE_WINDOW_SPACING); } diff --git a/src/apps/haikudepot/textview/CharacterStyle.cpp b/src/apps/haikudepot/textview/CharacterStyle.cpp index 06fbbc4264..85261bba64 100644 --- a/src/apps/haikudepot/textview/CharacterStyle.cpp +++ b/src/apps/haikudepot/textview/CharacterStyle.cpp @@ -238,6 +238,18 @@ CharacterStyle::SetForegroundColor(uint8 r, uint8 g, uint8 b, uint8 a) } +bool +CharacterStyle::SetForegroundColor(color_which which) +{ + CharacterStyleDataRef data = fStyleData->SetForegroundColor(which); + if (data == fStyleData) + return data->WhichForegroundColor() == which; + + fStyleData = data; + return true; +} + + bool CharacterStyle::SetForegroundColor(rgb_color color) { @@ -257,6 +269,13 @@ CharacterStyle::ForegroundColor() const } +color_which +CharacterStyle::WhichForegroundColor() const +{ + return fStyleData->WhichForegroundColor(); +} + + bool CharacterStyle::SetBackgroundColor(uint8 r, uint8 g, uint8 b, uint8 a) { @@ -264,6 +283,18 @@ CharacterStyle::SetBackgroundColor(uint8 r, uint8 g, uint8 b, uint8 a) } +bool +CharacterStyle::SetBackgroundColor(color_which which) +{ + CharacterStyleDataRef data = fStyleData->SetBackgroundColor(which); + if (data == fStyleData) + return data->WhichBackgroundColor() == which; + + fStyleData = data; + return true; +} + + bool CharacterStyle::SetBackgroundColor(rgb_color color) { @@ -283,6 +314,25 @@ CharacterStyle::BackgroundColor() const } +color_which +CharacterStyle::WhichBackgroundColor() const +{ + return fStyleData->WhichBackgroundColor(); +} + + +bool +CharacterStyle::SetStrikeOutColor(color_which which) +{ + CharacterStyleDataRef data = fStyleData->SetStrikeOutColor(which); + if (data == fStyleData) + return data->WhichStrikeOutColor() == which; + + fStyleData = data; + return true; +} + + bool CharacterStyle::SetStrikeOutColor(rgb_color color) { @@ -302,6 +352,25 @@ CharacterStyle::StrikeOutColor() const } +color_which +CharacterStyle::WhichStrikeOutColor() const +{ + return fStyleData->WhichStrikeOutColor(); +} + + +bool +CharacterStyle::SetUnderlineColor(color_which which) +{ + CharacterStyleDataRef data = fStyleData->SetUnderlineColor(which); + if (data == fStyleData) + return data->WhichUnderlineColor() == which; + + fStyleData = data; + return true; +} + + bool CharacterStyle::SetUnderlineColor(rgb_color color) { @@ -321,6 +390,13 @@ CharacterStyle::UnderlineColor() const } +color_which +CharacterStyle::WhichUnderlineColor() const +{ + return fStyleData->WhichUnderlineColor(); +} + + bool CharacterStyle::SetStrikeOut(uint8 strikeOut) { diff --git a/src/apps/haikudepot/textview/CharacterStyle.h b/src/apps/haikudepot/textview/CharacterStyle.h index 4a184f46a9..781964bcb2 100644 --- a/src/apps/haikudepot/textview/CharacterStyle.h +++ b/src/apps/haikudepot/textview/CharacterStyle.h @@ -44,20 +44,28 @@ public: bool SetForegroundColor( uint8 r, uint8 g, uint8 b, uint8 a = 255); + bool SetForegroundColor(color_which which); bool SetForegroundColor(rgb_color color); rgb_color ForegroundColor() const; + color_which WhichForegroundColor() const; bool SetBackgroundColor( uint8 r, uint8 g, uint8 b, uint8 a = 255); + bool SetBackgroundColor(color_which which); bool SetBackgroundColor(rgb_color color); rgb_color BackgroundColor() const; + color_which WhichBackgroundColor() const; + bool SetStrikeOutColor(color_which which); bool SetStrikeOutColor(rgb_color color); rgb_color StrikeOutColor() const; + color_which WhichStrikeOutColor() const; + bool SetUnderlineColor(color_which which); bool SetUnderlineColor(rgb_color color); rgb_color UnderlineColor() const; + color_which WhichUnderlineColor() const; bool SetStrikeOut(uint8 strikeOut); uint8 StrikeOut() const; @@ -65,7 +73,6 @@ public: bool SetUnderline(uint8 underline); uint8 Underline() const; - private: BFont _FindFontForFace(uint16 face) const; diff --git a/src/apps/haikudepot/textview/CharacterStyleData.cpp b/src/apps/haikudepot/textview/CharacterStyleData.cpp index 1103205ec8..5f9ce2cae2 100644 --- a/src/apps/haikudepot/textview/CharacterStyleData.cpp +++ b/src/apps/haikudepot/textview/CharacterStyleData.cpp @@ -18,10 +18,15 @@ CharacterStyleData::CharacterStyleData() fGlyphSpacing(0.0f), - fFgColor((rgb_color){ 0, 0, 0, 255 }), - fBgColor((rgb_color){ 255, 255, 255, 255 }), - fStrikeOutColor((rgb_color){ 0, 0, 0, 255 }), - fUnderlineColor((rgb_color){ 0, 0, 0, 255 }), + fWhichFgColor(B_PANEL_TEXT_COLOR), + fWhichBgColor(B_PANEL_BACKGROUND_COLOR), + fWhichStrikeOutColor(fWhichFgColor), + fWhichUnderlineColor(fWhichFgColor), + + fFgColor(ui_color(fWhichFgColor)), + fBgColor(ui_color(fWhichBgColor)), + fStrikeOutColor(fFgColor), + fUnderlineColor(fFgColor), fStrikeOutStyle(STRIKE_OUT_NONE), fUnderlineStyle(UNDERLINE_NONE) @@ -39,6 +44,11 @@ CharacterStyleData::CharacterStyleData(const CharacterStyleData& other) fGlyphSpacing(other.fGlyphSpacing), + fWhichFgColor(other.fWhichFgColor), + fWhichBgColor(other.fWhichBgColor), + fWhichStrikeOutColor(other.fWhichStrikeOutColor), + fWhichUnderlineColor(other.fWhichUnderlineColor), + fFgColor(other.fFgColor), fBgColor(other.fBgColor), fStrikeOutColor(other.fStrikeOutColor), @@ -63,6 +73,11 @@ CharacterStyleData::operator==(const CharacterStyleData& other) const && fGlyphSpacing == other.fGlyphSpacing + && fWhichFgColor == other.fWhichFgColor + && fWhichBgColor == other.fWhichBgColor + && fWhichStrikeOutColor == other.fWhichStrikeOutColor + && fWhichUnderlineColor == other.fWhichUnderlineColor + && fFgColor == other.fFgColor && fBgColor == other.fBgColor && fStrikeOutColor == other.fStrikeOutColor @@ -179,6 +194,21 @@ CharacterStyleData::SetGlyphSpacing(float glyphSpacing) } +CharacterStyleDataRef +CharacterStyleData::SetForegroundColor(color_which which) +{ + if (fWhichFgColor == which) + return CharacterStyleDataRef(this); + + CharacterStyleData* ret = new(std::nothrow) CharacterStyleData(*this); + if (ret == NULL) + return CharacterStyleDataRef(this); + + ret->fWhichFgColor = which; + return CharacterStyleDataRef(ret, true); +} + + CharacterStyleDataRef CharacterStyleData::SetForegroundColor(rgb_color color) { @@ -190,6 +220,22 @@ CharacterStyleData::SetForegroundColor(rgb_color color) return CharacterStyleDataRef(this); ret->fFgColor = color; + ret->fWhichFgColor = B_NO_COLOR; + return CharacterStyleDataRef(ret, true); +} + + +CharacterStyleDataRef +CharacterStyleData::SetBackgroundColor(color_which which) +{ + if (fWhichBgColor == which) + return CharacterStyleDataRef(this); + + CharacterStyleData* ret = new(std::nothrow) CharacterStyleData(*this); + if (ret == NULL) + return CharacterStyleDataRef(this); + + ret->fWhichBgColor = which; return CharacterStyleDataRef(ret, true); } @@ -205,6 +251,22 @@ CharacterStyleData::SetBackgroundColor(rgb_color color) return CharacterStyleDataRef(this); ret->fBgColor = color; + ret->fWhichBgColor = B_NO_COLOR; + return CharacterStyleDataRef(ret, true); +} + + +CharacterStyleDataRef +CharacterStyleData::SetStrikeOutColor(color_which which) +{ + if (fWhichStrikeOutColor == which) + return CharacterStyleDataRef(this); + + CharacterStyleData* ret = new(std::nothrow) CharacterStyleData(*this); + if (ret == NULL) + return CharacterStyleDataRef(this); + + ret->fWhichStrikeOutColor = which; return CharacterStyleDataRef(ret, true); } @@ -220,6 +282,22 @@ CharacterStyleData::SetStrikeOutColor(rgb_color color) return CharacterStyleDataRef(this); ret->fStrikeOutColor = color; + ret->fWhichStrikeOutColor = B_NO_COLOR; + return CharacterStyleDataRef(ret, true); +} + + +CharacterStyleDataRef +CharacterStyleData::SetUnderlineColor(color_which which) +{ + if (fWhichUnderlineColor == which) + return CharacterStyleDataRef(this); + + CharacterStyleData* ret = new(std::nothrow) CharacterStyleData(*this); + if (ret == NULL) + return CharacterStyleDataRef(this); + + ret->fWhichUnderlineColor = which; return CharacterStyleDataRef(ret, true); } @@ -235,6 +313,7 @@ CharacterStyleData::SetUnderlineColor(rgb_color color) return CharacterStyleDataRef(this); ret->fUnderlineColor = color; + ret->fWhichUnderlineColor = B_NO_COLOR; return CharacterStyleDataRef(ret, true); } diff --git a/src/apps/haikudepot/textview/CharacterStyleData.h b/src/apps/haikudepot/textview/CharacterStyleData.h index ad58241fe9..81439457f2 100644 --- a/src/apps/haikudepot/textview/CharacterStyleData.h +++ b/src/apps/haikudepot/textview/CharacterStyleData.h @@ -68,21 +68,33 @@ public: inline float GlyphSpacing() const { return fGlyphSpacing; } + CharacterStyleDataRef SetForegroundColor(color_which which); CharacterStyleDataRef SetForegroundColor(rgb_color color); inline rgb_color ForegroundColor() const { return fFgColor; } + inline color_which WhichForegroundColor() const + { return fWhichFgColor; } + CharacterStyleDataRef SetBackgroundColor(color_which which); CharacterStyleDataRef SetBackgroundColor(rgb_color color); inline rgb_color BackgroundColor() const { return fBgColor; } + inline color_which WhichBackgroundColor() const + { return fWhichBgColor; } + CharacterStyleDataRef SetStrikeOutColor(color_which which); CharacterStyleDataRef SetStrikeOutColor(rgb_color color); inline rgb_color StrikeOutColor() const { return fStrikeOutColor; } + inline color_which WhichStrikeOutColor() const + { return fWhichStrikeOutColor; } + CharacterStyleDataRef SetUnderlineColor(color_which which); CharacterStyleDataRef SetUnderlineColor(rgb_color color); inline rgb_color UnderlineColor() const { return fUnderlineColor; } + inline color_which WhichUnderlineColor() const + { return fWhichUnderlineColor; } CharacterStyleDataRef SetStrikeOut(uint8 strikeOut); inline uint8 StrikeOut() const @@ -92,6 +104,7 @@ public: inline uint8 Underline() const { return fUnderlineStyle; } + private: CharacterStyleData& operator=(const CharacterStyleData& other); @@ -112,6 +125,12 @@ private: // Additional spacing to be applied between glyphs. float fGlyphSpacing; + color_which fWhichFgColor; + color_which fWhichBgColor; + + color_which fWhichStrikeOutColor; + color_which fWhichUnderlineColor; + rgb_color fFgColor; rgb_color fBgColor; @@ -123,5 +142,4 @@ private: }; - #endif // CHARACTER_STYLE_DATA_H diff --git a/src/apps/haikudepot/textview/ParagraphLayout.cpp b/src/apps/haikudepot/textview/ParagraphLayout.cpp index 864bd16526..09341eda5f 100644 --- a/src/apps/haikudepot/textview/ParagraphLayout.cpp +++ b/src/apps/haikudepot/textview/ParagraphLayout.cpp @@ -261,7 +261,7 @@ ParagraphLayout::Draw(BView* view, const BPoint& offset) const Bullet& bullet = fParagraphStyle.Bullet(); if (bullet.Spacing() > 0.0f && bullet.String().Length() > 0) { // Draw bullet at offset - view->SetHighColor(0, 0, 0, 255); + view->SetHighUIColor(B_PANEL_TEXT_COLOR); BPoint bulletPos(offset); bulletPos.x += fParagraphStyle.FirstLineInset() + fParagraphStyle.LineInset(); @@ -934,7 +934,11 @@ ParagraphLayout::_DrawSpan(BView* view, BPoint offset, const CharacterStyle& style = span.Style(); view->SetFont(&style.Font()); - view->SetHighColor(style.ForegroundColor()); + + if (style.WhichForegroundColor() != B_NO_COLOR) + view->SetHighUIColor(style.WhichForegroundColor()); + else + view->SetHighColor(style.ForegroundColor()); // TODO: Implement other style properties diff --git a/src/apps/haikudepot/textview/TextDocumentView.cpp b/src/apps/haikudepot/textview/TextDocumentView.cpp index 1584d24cf3..7eba3e681f 100644 --- a/src/apps/haikudepot/textview/TextDocumentView.cpp +++ b/src/apps/haikudepot/textview/TextDocumentView.cpp @@ -41,8 +41,8 @@ TextDocumentView::TextDocumentView(const char* name) // Set default TextEditor SetTextEditor(TextEditorRef(new(std::nothrow) TextEditor(), true)); - SetViewColor(B_TRANSPARENT_COLOR); - SetLowColor(255, 255, 255, 255); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); + SetLowUIColor(ViewUIColor()); } diff --git a/src/apps/haikudepot/textview/TextView.cpp b/src/apps/haikudepot/textview/TextView.cpp index ee806cc08e..e4eb46c7e0 100644 --- a/src/apps/haikudepot/textview/TextView.cpp +++ b/src/apps/haikudepot/textview/TextView.cpp @@ -10,9 +10,6 @@ TextView::TextView(const char* name) : BView(name, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE | B_FRAME_EVENTS) { - SetViewColor(B_TRANSPARENT_COLOR); - SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - BFont font; GetFont(&font); @@ -41,9 +38,7 @@ TextView::Draw(BRect updateRect) void TextView::AttachedToWindow() { - BView* parent = Parent(); - if (parent != NULL) - SetLowColor(parent->ViewColor()); + AdoptParentColors(); } diff --git a/src/apps/haikudepot/ui/FeaturedPackagesView.cpp b/src/apps/haikudepot/ui/FeaturedPackagesView.cpp index fc3e33eb05..ffbb823b56 100644 --- a/src/apps/haikudepot/ui/FeaturedPackagesView.cpp +++ b/src/apps/haikudepot/ui/FeaturedPackagesView.cpp @@ -44,7 +44,8 @@ public: new(std::nothrow) OnePackageMessagePackageListener(this)), fSelected(false) { - SetViewColor(255, 255, 255); + SetViewUIColor(B_LIST_BACKGROUND_COLOR); + SetHighUIColor(B_LIST_ITEM_TEXT_COLOR); SetEventMask(B_POINTER_EVENTS); fIconView = new BitmapView("package icon view"); @@ -67,25 +68,27 @@ public: font.SetSize(std::max(9.0f, floorf(font.Size() * 0.92f))); font.SetFamilyAndStyle(family, "Italic"); fPublisherView->SetFont(&font); - fPublisherView->SetHighColor(kLightBlack); // Summary text view - fSummaryView = new MarkupTextView("package summary"); - fSummaryView->SetSelectionEnabled(false); + fSummaryView = new BTextView("package summary"); + fSummaryView->MakeSelectable(false); + fSummaryView->MakeEditable(false); + font = BFont(be_plain_font); + rgb_color color = HighColor(); + fSummaryView->SetFontAndColor(&font, B_FONT_ALL, &color); // Rating view fRatingView = new RatingView("package rating view"); fAvgRating = new BStringView("package average rating", ""); fAvgRating->SetFont(&font); - fAvgRating->SetHighColor(kLightBlack); fVoteInfo = new BStringView("package vote info", ""); // small font GetFont(&font); font.SetSize(std::max(9.0f, floorf(font.Size() * 0.85f))); fVoteInfo->SetFont(&font); - fVoteInfo->SetHighColor(kLightBlack); + fVoteInfo->SetHighUIColor(HighUIColor()); BLayoutBuilder::Group<>(this) .Add(fIconView) @@ -119,6 +122,15 @@ public: delete fPackageListener; } + virtual void AllAttached() + { + for (int32 index = 0; index < CountChildren(); ++index) { + ChildAt(index)->SetViewUIColor(ViewUIColor()); + ChildAt(index)->SetLowUIColor(ViewUIColor()); + ChildAt(index)->SetHighUIColor(HighUIColor()); + } + } + virtual void MessageReceived(BMessage* message) { switch (message->what) { @@ -129,6 +141,13 @@ public: case MSG_UPDATE_PACKAGE: SetPackage(fPackageListener->Package()); break; + + case B_COLORS_UPDATED: + { + if (message->HasColor(ui_color_name(B_LIST_ITEM_TEXT_COLOR))) + _UpdateColors(); + break; + } } } @@ -227,11 +246,18 @@ public: return; fSelected = selected; - rgb_color bgColor; - if (fSelected) - bgColor = ui_color(B_LIST_SELECTED_BACKGROUND_COLOR); - else - bgColor = (rgb_color){ 255, 255, 255, 255 }; + _UpdateColors(); + } + + void _UpdateColors() + { + color_which bgColor = B_LIST_BACKGROUND_COLOR; + color_which textColor = B_LIST_ITEM_TEXT_COLOR; + + if (fSelected) { + bgColor = B_LIST_SELECTED_BACKGROUND_COLOR; + textColor = B_LIST_SELECTED_ITEM_TEXT_COLOR; + } List views; @@ -248,10 +274,15 @@ public: for (int32 i = 0; i < views.CountItems(); i++) { BView* view = views.ItemAtFast(i); - view->SetViewColor(bgColor); - view->SetLowColor(bgColor); + view->SetViewUIColor(bgColor); + view->SetLowUIColor(bgColor); + view->SetHighUIColor(textColor); view->Invalidate(); } + + BFont font(be_plain_font); + rgb_color color = HighColor(); + fSummaryView->SetFontAndColor(&font, B_FONT_ALL, &color); } private: @@ -263,7 +294,7 @@ private: BStringView* fTitleView; BStringView* fPublisherView; - MarkupTextView* fSummaryView; + BTextView* fSummaryView; RatingView* fRatingView; BStringView* fAvgRating; @@ -286,7 +317,7 @@ FeaturedPackagesView::FeaturedPackagesView() SetLayout(layout); ScrollableGroupView* containerView = new ScrollableGroupView(); - containerView->SetViewColor(255, 255, 255); + containerView->SetViewUIColor(B_LIST_BACKGROUND_COLOR); fPackageListLayout = containerView->GroupLayout(); BScrollView* scrollView = new BScrollView( diff --git a/src/apps/haikudepot/ui/PackageInfoView.cpp b/src/apps/haikudepot/ui/PackageInfoView.cpp index aab0cf505b..4b4e86af8e 100644 --- a/src/apps/haikudepot/ui/PackageInfoView.cpp +++ b/src/apps/haikudepot/ui/PackageInfoView.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -127,9 +128,8 @@ public: BView("diagram bar view", B_WILL_DRAW), fValue(0.0f) { - SetViewColor(B_TRANSPARENT_COLOR); - SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - SetHighColor(tint_color(LowColor(), B_DARKEN_2_TINT)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR, kContentTint); + SetHighUIColor(B_CONTROL_MARK_COLOR); } virtual ~DiagramBarView() @@ -138,11 +138,6 @@ public: virtual void AttachedToWindow() { - BView* parent = Parent(); - if (parent != NULL) { - SetLowColor(parent->ViewColor()); - SetHighColor(tint_color(LowColor(), B_DARKEN_2_TINT)); - } } virtual void Draw(BRect updateRect) @@ -325,7 +320,7 @@ public: fRatingLayout = new BCardLayout(); ratingStack->SetLayout(fRatingLayout); ratingStack->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET)); - ratingStack->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + ratingStack->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); BGroupView* ratingGroup = new BGroupView(B_HORIZONTAL, B_USE_SMALL_SPACING); @@ -471,7 +466,7 @@ public: fStatusLabel(NULL), fStatusBar(NULL) { - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); SetLayout(fLayout); fLayout->AddItem(BSpaceLayoutItem::CreateGlue()); @@ -684,11 +679,10 @@ public: fEmailIcon("text/x-email"), fWebsiteIcon("text/html") { - SetViewColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), - kContentTint)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR, kContentTint); fDescriptionView = new MarkupTextView("description view"); - fDescriptionView->SetLowColor(ViewColor()); + fDescriptionView->SetViewUIColor(ViewUIColor(), kContentTint); fDescriptionView->SetInsets(be_plain_font->Size()); BScrollView* scrollView = new CustomScrollView( @@ -714,17 +708,20 @@ public: fEmailIconView = new BitmapView("email icon view"); fEmailLinkView = new LinkView("email link view", "", - new BMessage(MSG_EMAIL_PUBLISHER), kLightBlack); + new BMessage(MSG_EMAIL_PUBLISHER)); fEmailLinkView->SetFont(&smallFont); fWebsiteIconView = new BitmapView("website icon view"); fWebsiteLinkView = new LinkView("website link view", "", - new BMessage(MSG_VISIT_PUBLISHER_WEBSITE), kLightBlack); + new BMessage(MSG_VISIT_PUBLISHER_WEBSITE)); fWebsiteLinkView->SetFont(&smallFont); BGroupView* leftGroup = new BGroupView(B_VERTICAL, B_USE_DEFAULT_SPACING); - leftGroup->SetViewColor(ViewColor()); + + fScreenshotView->SetViewUIColor(ViewUIColor(), kContentTint); + fEmailLinkView->SetViewUIColor(ViewUIColor(), kContentTint); + fWebsiteLinkView->SetViewUIColor(ViewUIColor(), kContentTint); BLayoutBuilder::Group<>(this, B_HORIZONTAL, 0.0f) // .Add(BSpaceLayoutItem::CreateHorizontalStrut(32.0f)) @@ -760,6 +757,14 @@ public: fWebsiteLinkView->SetTarget(this); } + virtual void AllAttached() + { + SetViewUIColor(B_PANEL_BACKGROUND_COLOR, kContentTint); + + for (int32 index = 0; index < CountChildren(); ++index) + ChildAt(index)->AdoptParentColors(); + } + virtual void MessageReceived(BMessage* message) { switch (message->what) { @@ -867,8 +872,7 @@ public: : BGroupView(B_HORIZONTAL, 0.0f) { - SetViewColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), - kContentTint)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR, kContentTint); fAvatarView = new BitmapView("avatar view"); if (rating.User().Avatar().Get() != NULL) { @@ -878,10 +882,10 @@ public: fAvatarView->SetExplicitMinSize(BSize(16.0f, 16.0f)); fNameView = new BStringView("user name", rating.User().NickName()); + BFont nameFont(be_bold_font); nameFont.SetSize(std::max(9.0f, floorf(nameFont.Size() * 0.9f))); fNameView->SetFont(&nameFont); - fNameView->SetHighColor(kLightBlack); fNameView->SetExplicitMaxSize( BSize(nameFont.StringWidth("xxxxxxxxxxxxxxxxxxxxxx"), B_SIZE_UNSET)); @@ -900,7 +904,6 @@ public: BFont versionFont(be_plain_font); versionFont.SetSize(std::max(9.0f, floorf(versionFont.Size() * 0.85f))); fPackageVersionView->SetFont(&versionFont); - fPackageVersionView->SetHighColor(kLightBlack); // TODO: User rating IDs to identify which rating to vote up or down // BMessage* voteUpMessage = new BMessage(MSG_VOTE_UP); @@ -928,7 +931,6 @@ public: // fDownVoteCountView->SetText(voteCountLabel); fTextView = new TextView("rating text"); - fTextView->SetViewColor(ViewColor()); ParagraphStyle paragraphStyle(fTextView->ParagraphStyle()); paragraphStyle.SetJustify(true); fTextView->SetParagraphStyle(paragraphStyle); @@ -957,6 +959,21 @@ public: .End() .SetInsets(B_USE_DEFAULT_SPACING) ; + + SetFlags(Flags() | B_WILL_DRAW); + } + + void AllAttached() + { + for (int32 index = 0; index < CountChildren(); ++index) + ChildAt(index)->AdoptParentColors(); + } + + void Draw(BRect rect) + { + rgb_color color = mix_color(ViewColor(), ui_color(B_PANEL_TEXT_COLOR), 64); + SetHighColor(color); + StrokeLine(Bounds().LeftBottom(), Bounds().RightBottom()); } private: @@ -981,8 +998,8 @@ public: : BGridView("rating summary view", B_USE_HALF_ITEM_SPACING, 0.0f) { - SetViewColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), - kContentTint - 0.1)); + float tint = kContentTint - 0.1; + SetViewUIColor(B_PANEL_BACKGROUND_COLOR, tint); BLayoutBuilder::Grid<> layoutBuilder(this); @@ -995,7 +1012,7 @@ public: label.SetToFormat("%" B_PRId32, 5 - i); fLabelViews[i] = new BStringView("", label); fLabelViews[i]->SetFont(&smallFont); - fLabelViews[i]->SetHighColor(kLightBlack); + fLabelViews[i]->SetViewUIColor(ViewUIColor(), tint); layoutBuilder.Add(fLabelViews[i], 0, i); fDiagramBarViews[i] = new DiagramBarView(); @@ -1003,7 +1020,7 @@ public: fCountViews[i] = new BStringView("", ""); fCountViews[i]->SetFont(&smallFont); - fCountViews[i]->SetHighColor(kLightBlack); + fCountViews[i]->SetViewUIColor(ViewUIColor(), tint); fCountViews[i]->SetAlignment(B_ALIGN_RIGHT); layoutBuilder.Add(fCountViews[i], 2, i); } @@ -1049,14 +1066,13 @@ public: fThumbsUpIcon(BitmapRef(new SharedBitmap(502), true)), fThumbsDownIcon(BitmapRef(new SharedBitmap(503), true)) { - SetViewColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), - kContentTint)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR, kContentTint); fRatingSummaryView = new RatingSummaryView(); ScrollableGroupView* ratingsContainerView = new ScrollableGroupView(); - ratingsContainerView->SetViewColor( - tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), kContentTint)); + ratingsContainerView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR, + kContentTint); fRatingContainerLayout = ratingsContainerView->GroupLayout(); BScrollView* scrollView = new RatingsScrollView( @@ -1093,8 +1109,10 @@ public: if (count == 0) { BStringView* noRatingsView = new BStringView("no ratings", B_TRANSLATE("No user ratings available.")); + noRatingsView->SetViewUIColor(ViewUIColor(), kContentTint); noRatingsView->SetAlignment(B_ALIGN_CENTER); - noRatingsView->SetHighColor(kLightBlack); + noRatingsView->SetHighColor(disable_color(ui_color(B_PANEL_TEXT_COLOR), + ViewColor())); noRatingsView->SetExplicitMaxSize( BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED)); fRatingContainerLayout->AddView(0, noRatingsView); @@ -1178,8 +1196,7 @@ public: : BGroupView("package contents view", B_HORIZONTAL) { - SetViewColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), - kContentTint)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR, kContentTint); fPackageContents = new PackageContentsView("contents_list"); AddChild(fPackageContents); @@ -1218,11 +1235,10 @@ public: : BGroupView("package changelog view", B_HORIZONTAL) { - SetViewColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), - kContentTint)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR, kContentTint); fTextView = new MarkupTextView("changelog view"); - fTextView->SetLowColor(ViewColor()); + fTextView->SetLowUIColor(ViewUIColor()); fTextView->SetInsets(be_plain_font->Size()); BScrollView* scrollView = new CustomScrollView( diff --git a/src/apps/haikudepot/ui/PackageListView.cpp b/src/apps/haikudepot/ui/PackageListView.cpp index 3ef7c39b10..4972d56281 100644 --- a/src/apps/haikudepot/ui/PackageListView.cpp +++ b/src/apps/haikudepot/ui/PackageListView.cpp @@ -632,10 +632,9 @@ public: font.SetSize(9.0f); SetFont(&font); - SetViewColor(B_TRANSPARENT_COLOR); - SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - - SetHighColor(tint_color(LowColor(), B_DARKEN_4_TINT)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); + SetLowUIColor(ViewUIColor()); + SetHighUIColor(LowUIColor(), B_DARKEN_4_TINT); } virtual BSize MinSize() diff --git a/src/apps/haikudepot/ui_generic/BitmapView.cpp b/src/apps/haikudepot/ui_generic/BitmapView.cpp index 0bb85976ed..e00e122701 100644 --- a/src/apps/haikudepot/ui_generic/BitmapView.cpp +++ b/src/apps/haikudepot/ui_generic/BitmapView.cpp @@ -18,8 +18,6 @@ BitmapView::BitmapView(const char* name) fBitmap(NULL), fScaleBitmap(true) { - SetViewColor(B_TRANSPARENT_COLOR); - SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR)); } @@ -29,15 +27,9 @@ BitmapView::~BitmapView() void -BitmapView::AttachedToWindow() +BitmapView::AllAttached() { - BView* parent = Parent(); - if (parent != NULL) { - rgb_color color = parent->ViewColor(); - if (color == B_TRANSPARENT_COLOR) - color = parent->LowColor(); - SetLowColor(color); - } + AdoptParentColors(); } diff --git a/src/apps/haikudepot/ui_generic/BitmapView.h b/src/apps/haikudepot/ui_generic/BitmapView.h index 327f35fa14..d2a706c9fb 100644 --- a/src/apps/haikudepot/ui_generic/BitmapView.h +++ b/src/apps/haikudepot/ui_generic/BitmapView.h @@ -17,7 +17,7 @@ public: virtual ~BitmapView(); - virtual void AttachedToWindow(); + virtual void AllAttached(); virtual void Draw(BRect updateRect); virtual BSize MinSize(); diff --git a/src/apps/haikudepot/ui_generic/LinkView.cpp b/src/apps/haikudepot/ui_generic/LinkView.cpp index 5d337fce58..1196a6776f 100644 --- a/src/apps/haikudepot/ui_generic/LinkView.cpp +++ b/src/apps/haikudepot/ui_generic/LinkView.cpp @@ -10,18 +10,21 @@ #include -LinkView::LinkView(const char* name, const char* string, BMessage* message, - rgb_color color) +LinkView::LinkView(const char* name, const char* string, BMessage* message) : BStringView(name, string), BInvoker(message, NULL), - fNormalColor(color), - fHoverColor(make_color(1, 141, 211)), fEnabled(true), fMouseInside(false) { SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET)); SetExplicitMinSize(BSize(120, B_SIZE_UNSET)); +} + + +void +LinkView::AttachedToWindow() +{ _UpdateLinkColor(); } @@ -55,7 +58,7 @@ LinkView::Draw(BRect updateRect) if (Text() == NULL) return; - SetLowColor(ViewColor()); + SetDrawingMode(B_OP_ALPHA); font_height fontHeight; GetFontHeight(&fontHeight); @@ -82,18 +85,34 @@ LinkView::SetEnabled(bool enabled) } +void +LinkView::MessageReceived(BMessage* message) +{ + if (message->what == B_COLORS_UPDATED) + _UpdateLinkColor(); + + BStringView::MessageReceived(message); +} + + void LinkView::_UpdateLinkColor() { - if (fEnabled && fMouseInside) { - SetHighColor(fHoverColor); - BCursor cursor(B_CURSOR_ID_FOLLOW_LINK); - SetViewCursor(&cursor, true); - Invalidate(); - } else { - SetHighColor(fNormalColor); - BCursor cursor(B_CURSOR_SYSTEM_DEFAULT); - SetViewCursor(&cursor, true); - Invalidate(); - } + BCursorID cursorID = B_CURSOR_ID_SYSTEM_DEFAULT; + + float tint = B_DARKEN_1_TINT; + ViewUIColor(&tint); + + if (fEnabled) { + if (fMouseInside) { + cursorID = B_CURSOR_ID_FOLLOW_LINK; + SetHighUIColor(B_LINK_HOVER_COLOR, tint); + } else + SetHighUIColor(B_LINK_TEXT_COLOR, tint); + } else + SetHighColor(disable_color(ui_color(B_LINK_TEXT_COLOR), ViewColor())); + + BCursor cursor(cursorID); + SetViewCursor(&cursor, true); + Invalidate(); } diff --git a/src/apps/haikudepot/ui_generic/LinkView.h b/src/apps/haikudepot/ui_generic/LinkView.h index 059b954c7c..9e344b8db6 100644 --- a/src/apps/haikudepot/ui_generic/LinkView.h +++ b/src/apps/haikudepot/ui_generic/LinkView.h @@ -13,7 +13,9 @@ class LinkView : public BStringView, public BInvoker { public: LinkView(const char* name, const char* string, - BMessage* message, rgb_color color); + BMessage* message); + + virtual void AttachedToWindow(); virtual void MouseMoved(BPoint where, uint32 transit, const BMessage* dragMessage); @@ -21,14 +23,13 @@ public: virtual void Draw(BRect updateRect); + virtual void MessageReceived(BMessage* message); void SetEnabled(bool enabled); private: void _UpdateLinkColor(); private: - rgb_color fNormalColor; - rgb_color fHoverColor; bool fEnabled; bool fMouseInside; diff --git a/src/apps/haikudepot/ui_generic/LinkedBitmapView.cpp b/src/apps/haikudepot/ui_generic/LinkedBitmapView.cpp index 50eaccdcbe..c8ddea6ea4 100644 --- a/src/apps/haikudepot/ui_generic/LinkedBitmapView.cpp +++ b/src/apps/haikudepot/ui_generic/LinkedBitmapView.cpp @@ -19,6 +19,13 @@ LinkedBitmapView::LinkedBitmapView(const char* name, BMessage* message) } +void +LinkedBitmapView::AllAttached() +{ + // We don't want to use BitmapView's default behavior here. +} + + void LinkedBitmapView::MouseMoved(BPoint where, uint32 transit, const BMessage* dragMessage) diff --git a/src/apps/haikudepot/ui_generic/LinkedBitmapView.h b/src/apps/haikudepot/ui_generic/LinkedBitmapView.h index 5d4c62f0c5..d206eb559e 100644 --- a/src/apps/haikudepot/ui_generic/LinkedBitmapView.h +++ b/src/apps/haikudepot/ui_generic/LinkedBitmapView.h @@ -16,6 +16,8 @@ public: LinkedBitmapView(const char* name, BMessage* message); + virtual void AllAttached(); + virtual void MouseMoved(BPoint where, uint32 transit, const BMessage* dragMessage); virtual void MouseDown(BPoint where); diff --git a/src/apps/haikudepot/ui_generic/RatingView.cpp b/src/apps/haikudepot/ui_generic/RatingView.cpp index aab3174863..bd733103c0 100644 --- a/src/apps/haikudepot/ui_generic/RatingView.cpp +++ b/src/apps/haikudepot/ui_generic/RatingView.cpp @@ -17,8 +17,8 @@ RatingView::RatingView(const char* name) fStarBitmap(501), fRating(-1.0f) { - SetViewColor(B_TRANSPARENT_COLOR); - SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); + SetLowUIColor(ViewUIColor()); } @@ -30,9 +30,7 @@ RatingView::~RatingView() void RatingView::AttachedToWindow() { - BView* parent = Parent(); - if (parent != NULL) - SetLowColor(parent->ViewColor()); + AdoptParentColors(); } diff --git a/src/apps/icon-o-matic/MainWindow.cpp b/src/apps/icon-o-matic/MainWindow.cpp index 9f2dee2d22..1146a19204 100644 --- a/src/apps/icon-o-matic/MainWindow.cpp +++ b/src/apps/icon-o-matic/MainWindow.cpp @@ -967,7 +967,7 @@ MainWindow::_CreateGUI() layout->SetSpacing(0, 0); BView* rootView = new BView("root view", 0, layout); AddChild(rootView); - rootView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + rootView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); BGroupView* leftTopView = new BGroupView(B_VERTICAL, 0); layout->AddView(leftTopView, 0, 0); @@ -982,7 +982,7 @@ MainWindow::_CreateGUI() leftTopView->SetExplicitMinSize(BSize(splitWidth, B_SIZE_UNSET)); BGroupView* iconPreviews = new BGroupView(B_HORIZONTAL); - iconPreviews->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + iconPreviews->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); iconPreviews->GroupLayout()->SetSpacing(5); // icon previews @@ -1003,14 +1003,14 @@ MainWindow::_CreateGUI() BGroupView* smallPreviews = new BGroupView(B_VERTICAL); - smallPreviews->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + smallPreviews->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); smallPreviews->GroupLayout()->SetSpacing(5); smallPreviews->AddChild(fIconPreview16Folder); smallPreviews->AddChild(fIconPreview16Menu); BGroupView* mediumPreviews = new BGroupView(B_VERTICAL); - mediumPreviews->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + mediumPreviews->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); mediumPreviews->GroupLayout()->SetSpacing(5); mediumPreviews->AddChild(fIconPreview32Folder); diff --git a/src/apps/icon-o-matic/generic/gui/Group.cpp b/src/apps/icon-o-matic/generic/gui/Group.cpp index fb0d5209f2..f8c3cf368b 100644 --- a/src/apps/icon-o-matic/generic/gui/Group.cpp +++ b/src/apps/icon-o-matic/generic/gui/Group.cpp @@ -17,7 +17,7 @@ Group::Group(BRect frame, const char* name, orientation direction) fInset(4.0), fSpacing(0.0) { - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); } // destructor diff --git a/src/apps/icon-o-matic/generic/gui/panel/color_picker/ColorPickerView.cpp b/src/apps/icon-o-matic/generic/gui/panel/color_picker/ColorPickerView.cpp index 2b83786ef1..a7be54ee56 100644 --- a/src/apps/icon-o-matic/generic/gui/panel/color_picker/ColorPickerView.cpp +++ b/src/apps/icon-o-matic/generic/gui/panel/color_picker/ColorPickerView.cpp @@ -47,7 +47,7 @@ ColorPickerView::ColorPickerView(const char* name, rgb_color color, b((float)color.blue / 255.0), fRequiresUpdate(false) { - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); RGB_to_HSV(r, g, b, h, s, v); diff --git a/src/apps/icon-o-matic/gui/StyleView.cpp b/src/apps/icon-o-matic/gui/StyleView.cpp index e0229a8fc3..9aa1bb2ce0 100644 --- a/src/apps/icon-o-matic/gui/StyleView.cpp +++ b/src/apps/icon-o-matic/gui/StyleView.cpp @@ -62,7 +62,7 @@ StyleView::StyleView(BRect frame) fIgnoreControlGradientNotifications(false), fPreviousBounds(frame.OffsetToCopy(B_ORIGIN)) { - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); // style type BMenu* menu = new BPopUpMenu(B_TRANSLATE("")); diff --git a/src/apps/icon-o-matic/gui/SwatchGroup.cpp b/src/apps/icon-o-matic/gui/SwatchGroup.cpp index 6ddfaf9a80..ab444e630d 100644 --- a/src/apps/icon-o-matic/gui/SwatchGroup.cpp +++ b/src/apps/icon-o-matic/gui/SwatchGroup.cpp @@ -133,7 +133,7 @@ SwatchGroup::SwatchGroup(BRect frame) // configure self ResizeTo(width, fAlphaSlider->Frame().bottom + 4); - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); // add views AddChild(fCurrentColorSV); diff --git a/src/apps/installedpackages/UninstallView.cpp b/src/apps/installedpackages/UninstallView.cpp index f831f85519..a6c6e6d97e 100644 --- a/src/apps/installedpackages/UninstallView.cpp +++ b/src/apps/installedpackages/UninstallView.cpp @@ -270,7 +270,7 @@ UninstallView::MessageReceived(BMessage* msg) void UninstallView::_InitView() { - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); fAppList = new BListView("pkg_list", B_SINGLE_SELECTION_LIST); fAppList->SetSelectionMessage(new BMessage(P_MSG_SELECT)); @@ -284,7 +284,7 @@ UninstallView::_InitView() fDescription = new BTextView("description", B_WILL_DRAW); fDescription->MakeSelectable(false); fDescription->MakeEditable(false); - fDescription->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + fDescription->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); fDescription->SetText(fNoPackageSelectedString); fButton = new BButton("removal", B_TRANSLATE("Remove"), diff --git a/src/apps/installer/InstallerWindow.cpp b/src/apps/installer/InstallerWindow.cpp index 36564210eb..eb36bf3cce 100644 --- a/src/apps/installer/InstallerWindow.cpp +++ b/src/apps/installer/InstallerWindow.cpp @@ -173,6 +173,7 @@ InstallerWindow::InstallerWindow() fStatusView = new BTextView("statusView", be_plain_font, NULL, B_WILL_DRAW); + fStatusView->SetViewColor(255, 255, 255, 255); fStatusView->SetInsets(10, 0, 10, 0); fStatusView->MakeEditable(false); fStatusView->MakeSelectable(false); diff --git a/src/apps/login/LoginApp.cpp b/src/apps/login/LoginApp.cpp index abf2d90973..d3a5dcc33e 100644 --- a/src/apps/login/LoginApp.cpp +++ b/src/apps/login/LoginApp.cpp @@ -61,7 +61,8 @@ LoginApp::ReadyToRun() alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(NULL); } else { - BRect frame(0, 0, 450, 150); + float sizeDelta = (float)be_plain_font->Size()/12.0f; + BRect frame(0, 0, 450 * sizeDelta, 150 * sizeDelta); frame.OffsetBySelf(screen.Frame().Width()/2 - frame.Width()/2, screen.Frame().Height()/2 - frame.Height()/2); fLoginWindow = new LoginWindow(frame); diff --git a/src/apps/login/LoginView.cpp b/src/apps/login/LoginView.cpp index d91fd76379..b053f3d6ff 100644 --- a/src/apps/login/LoginView.cpp +++ b/src/apps/login/LoginView.cpp @@ -48,8 +48,8 @@ LoginView::LoginView(BRect frame) { // TODO: when I don't need to test in BeOS anymore, // rewrite to use layout engine. - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - SetLowColor(ViewColor()); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); + SetLowUIColor(ViewUIColor()); BRect r; r.Set(CSEP, CSEP, LW, Bounds().Height() - 3 * CSEP - BH); fUserList = new BListView(r, "users"); @@ -85,20 +85,24 @@ LoginView::LoginView(BRect frame) fHaltButton = new BButton(buttonRect, "halt", B_TRANSLATE("Halt"), new BMessage(kHaltAction)); + fHaltButton->ResizeToPreferred(); AddChild(fHaltButton); - buttonRect.OffsetBySelf(CSEP + buttonWidth, 0); + buttonRect.OffsetBySelf(CSEP + fHaltButton->Frame().Width(), 0); fRebootButton = new BButton(buttonRect, "reboot", B_TRANSLATE("Reboot"), new BMessage(kRebootAction)); + + fRebootButton->ResizeToPreferred(); AddChild(fRebootButton); BRect infoRect(buttonRect); - infoRect.OffsetBySelf(buttonWidth + CSEP, 0); + infoRect.OffsetBySelf(fRebootButton->Frame().Width() + CSEP, 0); buttonRect.OffsetToSelf(Bounds().Width() - CSEP - buttonWidth, Bounds().Height() - CSEP - BH); fLoginButton = new BButton(buttonRect, "ok", B_TRANSLATE("OK"), new BMessage(kAttemptLogin)); + fLoginButton->ResizeToPreferred(); AddChild(fLoginButton); infoRect.right = buttonRect.left - CSEP + 5; @@ -128,6 +132,19 @@ LoginView::AttachedToWindow() fUserList->MakeFocus(); // populate user list BMessenger(this).SendMessage(kAddNextUser); + + // size window relative to buttons + BRect bounds = Window()->Bounds(); + float spacing = fHaltButton->Frame().left; + bounds.bottom = fLoginButton->Frame().bottom + spacing; + bounds.right = fLoginButton->Frame().right + spacing; + Window()->ResizeTo(bounds.Width(), bounds.Height()); + + // Center info view + BPoint leftTop = fInfoView->Frame().LeftTop(); + leftTop.y += fHaltButton->Frame().Height() / 2; + leftTop.y -= fInfoView->Bounds().Height() / 2; + fInfoView->MoveTo(leftTop); } diff --git a/src/apps/magnify/Magnify.cpp b/src/apps/magnify/Magnify.cpp index 28e5a56c16..f5bab51628 100644 --- a/src/apps/magnify/Magnify.cpp +++ b/src/apps/magnify/Magnify.cpp @@ -808,7 +808,7 @@ void TInfoView::AttachedToWindow() { BBox::AttachedToWindow(); - + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); dynamic_cast(Window())->PixelCount(&fHPixelCount, &fVPixelCount); fPixelSize = dynamic_cast(Window())->PixelSize(); @@ -1050,7 +1050,6 @@ TMagnify::TMagnify(BRect r, TWindow* parent) fParent(parent), fStickCoordinates(false) { - SetViewColor(B_TRANSPARENT_32_BIT); } @@ -1073,6 +1072,7 @@ TMagnify::AttachedToWindow() resume_thread(fThread); + SetViewColor(B_TRANSPARENT_32_BIT); MakeFocus(); } diff --git a/src/apps/mail/AddressTextControl.cpp b/src/apps/mail/AddressTextControl.cpp index 0ebe84b8b5..b3805b11a5 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/mail/Content.cpp b/src/apps/mail/Content.cpp index 07ae30d63a..e03647573f 100644 --- a/src/apps/mail/Content.cpp +++ b/src/apps/mail/Content.cpp @@ -646,7 +646,7 @@ TContentView::TContentView(bool incoming, BFont* font, fFocus(false), fIncoming(incoming) { - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); BGroupLayout* layout = new BGroupLayout(B_VERTICAL, 0); SetLayout(layout); diff --git a/src/apps/mail/Enclosures.cpp b/src/apps/mail/Enclosures.cpp index f6ea5d0df9..25f5a492ec 100644 --- a/src/apps/mail/Enclosures.cpp +++ b/src/apps/mail/Enclosures.cpp @@ -154,7 +154,7 @@ TEnclosuresView::TEnclosuresView(BRect rect, BRect windowRect) B_WILL_DRAW), fFocus(false) { - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); BFont font(be_plain_font); font.SetSize(font.Size() * kPlainFontSizeScale); diff --git a/src/apps/mail/FindWindow.cpp b/src/apps/mail/FindWindow.cpp index d7b78b9405..fe60214f86 100644 --- a/src/apps/mail/FindWindow.cpp +++ b/src/apps/mail/FindWindow.cpp @@ -136,7 +136,7 @@ FindPanel::~FindPanel() void FindPanel::AttachedToWindow() { BView::AttachedToWindow(); - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); Window()->SetDefaultButton(fFindButton); fFindButton->SetTarget(this); diff --git a/src/apps/mail/Status.cpp b/src/apps/mail/Status.cpp index 7acee481a2..6911efddcc 100644 --- a/src/apps/mail/Status.cpp +++ b/src/apps/mail/Status.cpp @@ -87,7 +87,7 @@ TStatusWindow::TStatusWindow(BRect rect, BMessenger target, const char* status) fTarget(target) { BView* view = new BView(Bounds(), "", B_FOLLOW_ALL, B_WILL_DRAW); - view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + view->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); AddChild(view); BRect r(STATUS_FIELD_H, STATUS_FIELD_V, diff --git a/src/apps/mediaplayer/InfoWin.cpp b/src/apps/mediaplayer/InfoWin.cpp index eea4e9189e..12f9e64b7d 100644 --- a/src/apps/mediaplayer/InfoWin.cpp +++ b/src/apps/mediaplayer/InfoWin.cpp @@ -153,7 +153,7 @@ IconView::AttachedToWindow() if (Parent() != NULL) SetViewColor(Parent()->ViewColor()); else - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); } diff --git a/src/apps/mediaplayer/interface/DurationView.cpp b/src/apps/mediaplayer/interface/DurationView.cpp index d5befd62dc..08c15f0287 100644 --- a/src/apps/mediaplayer/interface/DurationView.cpp +++ b/src/apps/mediaplayer/interface/DurationView.cpp @@ -31,7 +31,7 @@ void DurationView::AttachedToWindow() { BStringView::AttachedToWindow(); - SetHighColor(tint_color(ViewColor(), B_DARKEN_4_TINT)); + _UpdateTextColor(); } @@ -46,6 +46,17 @@ DurationView::MouseDown(BPoint where) } +void +DurationView::MessageReceived(BMessage* message) +{ + if (message->what == B_COLORS_UPDATED + && message->HasColor(ui_color_name(B_PANEL_TEXT_COLOR))) + _UpdateTextColor(); + + BStringView::MessageReceived(message); +} + + BSize DurationView::MinSize() { @@ -128,6 +139,13 @@ DurationView::_Update() } +void +DurationView::_UpdateTextColor() +{ + SetHighColor(mix_color(ViewColor(), ui_color(B_PANEL_TEXT_COLOR), 128)); +} + + void DurationView::_GenerateString(bigtime_t duration) { diff --git a/src/apps/mediaplayer/interface/DurationView.h b/src/apps/mediaplayer/interface/DurationView.h index 2e0ae69b2e..63e40bd497 100644 --- a/src/apps/mediaplayer/interface/DurationView.h +++ b/src/apps/mediaplayer/interface/DurationView.h @@ -17,6 +17,7 @@ public: // BStringView interface virtual void AttachedToWindow(); virtual void MouseDown(BPoint where); + virtual void MessageReceived(BMessage* message); virtual BSize MinSize(); virtual BSize MaxSize(); @@ -39,6 +40,7 @@ public: private: void _Update(); + void _UpdateTextColor(); void _GenerateString(bigtime_t duration); private: diff --git a/src/apps/networkstatus/NetworkStatusView.cpp b/src/apps/networkstatus/NetworkStatusView.cpp index c678fd48b0..2495f3b9d9 100644 --- a/src/apps/networkstatus/NetworkStatusView.cpp +++ b/src/apps/networkstatus/NetworkStatusView.cpp @@ -236,11 +236,14 @@ NetworkStatusView::AttachedToWindow() if ((Parent()->Flags() & B_DRAW_ON_CHILDREN) != 0) SetViewColor(B_TRANSPARENT_COLOR); else - SetViewColor(Parent()->ViewColor()); + AdoptParentColors(); } else - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); - SetLowColor(ViewColor()); + if (ViewUIColor() != B_NO_COLOR) + SetLowUIColor(ViewUIColor()); + else + SetLowColor(ViewColor()); start_watching_network( B_WATCH_NETWORK_INTERFACE_CHANGES | B_WATCH_NETWORK_LINK_CHANGES, this); diff --git a/src/apps/networkstatus/NetworkStatusWindow.cpp b/src/apps/networkstatus/NetworkStatusWindow.cpp index 3420b21f0a..2e4df6c01f 100644 --- a/src/apps/networkstatus/NetworkStatusWindow.cpp +++ b/src/apps/networkstatus/NetworkStatusWindow.cpp @@ -24,7 +24,7 @@ NetworkStatusWindow::NetworkStatusWindow() B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS) { 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); SetSizeLimits(25, 265, 25, 265); diff --git a/src/apps/networkstatus/RadioView.cpp b/src/apps/networkstatus/RadioView.cpp index 972773a757..d3aa6af4da 100644 --- a/src/apps/networkstatus/RadioView.cpp +++ b/src/apps/networkstatus/RadioView.cpp @@ -118,7 +118,7 @@ RadioView::AttachedToWindow() if (Parent() != NULL) SetViewColor(Parent()->ViewColor()); else - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); } diff --git a/src/apps/overlayimage/Jamfile b/src/apps/overlayimage/Jamfile index 3e295013d6..bcbcd3438a 100644 --- a/src/apps/overlayimage/Jamfile +++ b/src/apps/overlayimage/Jamfile @@ -1,5 +1,7 @@ SubDir HAIKU_TOP src apps overlayimage ; +UsePrivateHeaders interface ; + Application OverlayImage : OverlayApp.cpp OverlayView.cpp diff --git a/src/apps/overlayimage/OverlayView.cpp b/src/apps/overlayimage/OverlayView.cpp index 8bc37bcddd..0e7c33d77b 100644 --- a/src/apps/overlayimage/OverlayView.cpp +++ b/src/apps/overlayimage/OverlayView.cpp @@ -19,6 +19,7 @@ #include #include + #undef B_TRANSLATION_CONTEXT #define B_TRANSLATION_CONTEXT "Main view" @@ -40,7 +41,9 @@ OverlayView::OverlayView(BRect frame) SetViewColor(B_TRANSPARENT_COLOR); fText = new BTextView(Bounds(), "bgView", Bounds(), B_FOLLOW_ALL, B_WILL_DRAW); - fText->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + fText->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); + rgb_color color = ui_color(B_PANEL_TEXT_COLOR); + fText->SetFontAndColor(be_plain_font, B_FONT_ALL, &color); AddChild(fText); BString text; text << B_TRANSLATE( @@ -117,7 +120,14 @@ OverlayView::MessageReceived(BMessage *msg) case B_ABOUT_REQUESTED: OverlayAboutRequested(); break; - + case B_COLORS_UPDATED: + { + rgb_color color; + if (msg->FindColor(ui_color_name(B_PANEL_TEXT_COLOR), &color) + == B_OK) + fText->SetFontAndColor(be_plain_font, B_FONT_ALL, &color); + break; + } default: BView::MessageReceived(msg); break; diff --git a/src/apps/overlayimage/OverlayWindow.cpp b/src/apps/overlayimage/OverlayWindow.cpp index ade428d5df..0b05a5ab90 100644 --- a/src/apps/overlayimage/OverlayWindow.cpp +++ b/src/apps/overlayimage/OverlayWindow.cpp @@ -32,7 +32,7 @@ OverlayWindow::OverlayWindow() AddChild(replView); BView *bgView = new BView(Bounds(), "bgView", B_FOLLOW_ALL, B_WILL_DRAW); - bgView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + bgView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); AddChild(bgView); } diff --git a/src/apps/packageinstaller/PackageView.cpp b/src/apps/packageinstaller/PackageView.cpp index f4c3bfb6c0..dfe5b06ddf 100644 --- a/src/apps/packageinstaller/PackageView.cpp +++ b/src/apps/packageinstaller/PackageView.cpp @@ -471,16 +471,19 @@ private: void PackageView::_InitView() { - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); float fontHeight = be_plain_font->Size(); + rgb_color textColor = ui_color(B_PANEL_TEXT_COLOR); BTextView* packageDescriptionView = new DescriptionTextView( "package description", fontHeight * 13); - packageDescriptionView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + packageDescriptionView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); packageDescriptionView->SetText(fInfo.GetDescription()); packageDescriptionView->MakeEditable(false); packageDescriptionView->MakeSelectable(false); + packageDescriptionView->SetFontAndColor(be_plain_font, B_FONT_ALL, + &textColor); BScrollView* descriptionScrollView = new BScrollView( "package description scroll view", packageDescriptionView, @@ -500,11 +503,11 @@ PackageView::_InitView() // Left inset needs to match BMenuField text offset fInstallTypeDescriptionView->SetText( B_TRANSLATE("No installation type selected")); - fInstallTypeDescriptionView->SetViewColor( - ui_color(B_PANEL_BACKGROUND_COLOR)); + fInstallTypeDescriptionView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); BFont font(be_plain_font); font.SetSize(ceilf(font.Size() * 0.85)); - fInstallTypeDescriptionView->SetFontAndColor(&font); + fInstallTypeDescriptionView->SetFontAndColor(&font, B_FONT_ALL, + &textColor); BScrollView* installTypeScrollView = new BScrollView( "install type description scroll view", fInstallTypeDescriptionView, diff --git a/src/apps/pairs/PairsView.cpp b/src/apps/pairs/PairsView.cpp index 273eb08166..47534704ea 100644 --- a/src/apps/pairs/PairsView.cpp +++ b/src/apps/pairs/PairsView.cpp @@ -54,7 +54,7 @@ PairsView::PairsView(BRect frame, const char* name, uint8 rows, uint8 cols, fPositionX(new int32[fButtonsCount]), fPositionY(new int32[fButtonsCount]) { - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); CreateGameBoard(); _SetPairsBoard(); } diff --git a/src/apps/patchbay/PatchRow.cpp b/src/apps/patchbay/PatchRow.cpp index f22a8ce9a3..193646bf87 100644 --- a/src/apps/patchbay/PatchRow.cpp +++ b/src/apps/patchbay/PatchRow.cpp @@ -164,7 +164,7 @@ void PatchRow::AttachedToWindow() { Window()->SetPulseRate(200000); - SetViewColor(Parent()->ViewColor()); + AdoptParentColors(); int32 numChildren = CountChildren(); for (int32 i = 0; i < numChildren; i++) { PatchCheckBox* box = dynamic_cast(ChildAt(i)); diff --git a/src/apps/patchbay/PatchView.cpp b/src/apps/patchbay/PatchView.cpp index f3966b406a..cf0f036ca9 100644 --- a/src/apps/patchbay/PatchView.cpp +++ b/src/apps/patchbay/PatchView.cpp @@ -37,7 +37,7 @@ PatchView::PatchView(BRect rect) BView(rect, "PatchView", B_FOLLOW_ALL, B_WILL_DRAW), fUnknownDeviceIcon(NULL) { - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); BRect iconRect(0, 0, LARGE_ICON_SIZE - 1, LARGE_ICON_SIZE - 1); fUnknownDeviceIcon = new BBitmap(iconRect, B_RGBA32); @@ -68,6 +68,7 @@ PatchView::AttachedToWindow() BMessenger msgr(this); roster->StartWatching(&msgr); + SetHighUIColor(B_PANEL_TEXT_COLOR); } diff --git a/src/apps/powerstatus/ExtendedInfoWindow.cpp b/src/apps/powerstatus/ExtendedInfoWindow.cpp index 35f9ec6f7a..543fb8731f 100644 --- a/src/apps/powerstatus/ExtendedInfoWindow.cpp +++ b/src/apps/powerstatus/ExtendedInfoWindow.cpp @@ -37,7 +37,7 @@ BatteryInfoView::BatteryInfoView() fPreferredSize(200, 200), fMaxStringSize(0, 0) { - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); } @@ -346,7 +346,7 @@ ExtendedInfoWindow::ExtendedInfoWindow(PowerStatusDriverInterface* interface) fDriverInterface->AcquireReference(); BView *view = new BView(Bounds(), "view", B_FOLLOW_ALL, 0); - view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + view->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); AddChild(view); BGroupLayout* mainLayout = new BGroupLayout(B_VERTICAL); diff --git a/src/apps/powerstatus/PowerStatusView.cpp b/src/apps/powerstatus/PowerStatusView.cpp index 2b7cc98aff..0b1b4aa3b1 100644 --- a/src/apps/powerstatus/PowerStatusView.cpp +++ b/src/apps/powerstatus/PowerStatusView.cpp @@ -118,10 +118,12 @@ void PowerStatusView::AttachedToWindow() { BView::AttachedToWindow(); - if (Parent()) - SetLowColor(Parent()->ViewColor()); + AdoptParentColors(); + + if (ViewUIColor() == B_NO_COLOR) + SetLowUIColor(B_PANEL_BACKGROUND_COLOR); else - SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetLowUIColor(ViewUIColor()); Update(); } @@ -159,7 +161,10 @@ PowerStatusView::_DrawBattery(BRect rect) float left = rect.left; rect.left += rect.Width() / 11; - SetHighColor(0, 0, 0); + if (LowColor().Brightness() > 100) + SetHighColor(0, 0, 0); + else + SetHighColor(128, 128, 128); float gap = 1; if (rect.Height() > 8) { @@ -190,7 +195,10 @@ PowerStatusView::_DrawBattery(BRect rect) if (percent > 0) { rect.InsetBy(gap, gap); - rgb_color base = {84, 84, 84, 255}; + rgb_color base = (rgb_color){84, 84, 84, 255}; + if (LowColor().Brightness() < 128) + base = (rgb_color){172, 172, 172, 255}; + if (be_control_look != NULL) { BRect empty = rect; if (fHasBattery && percent > 0) @@ -313,8 +321,7 @@ PowerStatusView::Draw(BRect updateRect) SetHighColor(ui_color(B_CONTROL_TEXT_COLOR)); else { SetDrawingMode(B_OP_OVER); - rgb_color c = Parent()->LowColor(); - if (c.red + c.green + c.blue > 128 * 3) + if (LowColor().Brightness() > 100) SetHighColor(0, 0, 0); else SetHighColor(255, 255, 255); diff --git a/src/apps/powerstatus/PowerStatusWindow.cpp b/src/apps/powerstatus/PowerStatusWindow.cpp index fe83bc432f..6333e17fab 100644 --- a/src/apps/powerstatus/PowerStatusWindow.cpp +++ b/src/apps/powerstatus/PowerStatusWindow.cpp @@ -20,7 +20,7 @@ PowerStatusWindow::PowerStatusWindow() B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS) { 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); topView->AddChild(new PowerStatusReplicant(Bounds(), B_FOLLOW_ALL)); diff --git a/src/apps/processcontroller/PCWindow.cpp b/src/apps/processcontroller/PCWindow.cpp index 05c018d160..852e179591 100644 --- a/src/apps/processcontroller/PCWindow.cpp +++ b/src/apps/processcontroller/PCWindow.cpp @@ -47,7 +47,7 @@ PCWindow::PCWindow() BRect rect = Bounds(); BView* topView = new BView(rect, NULL, B_FOLLOW_ALL, B_WILL_DRAW); - topView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + topView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); AddChild(topView); // set up a rectangle && instantiate a new view diff --git a/src/apps/pulse/ConfigView.cpp b/src/apps/pulse/ConfigView.cpp index 4b53468374..b6c2de2ccc 100644 --- a/src/apps/pulse/ConfigView.cpp +++ b/src/apps/pulse/ConfigView.cpp @@ -198,10 +198,10 @@ ConfigView::AttachedToWindow() // AttachedToWindow() gets called every time this tab is brought // to the front, but we only want this initialization to happen once if (fFirstTimeAttached) { - if (Parent() != NULL) - SetViewColor(Parent()->ViewColor()); - else - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + AdoptParentColors(); + + if (Parent() == NULL) + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); BMessenger messenger(this); fColorControl->SetTarget(messenger); diff --git a/src/apps/pulse/NormalPulseView.cpp b/src/apps/pulse/NormalPulseView.cpp index b2c2224154..14c112ea32 100644 --- a/src/apps/pulse/NormalPulseView.cpp +++ b/src/apps/pulse/NormalPulseView.cpp @@ -50,9 +50,8 @@ NormalPulseView::NormalPulseView(BRect rect) : PulseView(rect, "NormalPulseView"), fHasBrandLogo(false) { - rgb_color color = { 168, 168, 168, 0xff }; - SetViewColor(color); - SetLowColor(color); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); + SetLowUIColor(ViewUIColor()); mode1->SetLabel(B_TRANSLATE("Mini mode")); mode1->SetMessage(new BMessage(PV_MINI_MODE)); diff --git a/src/apps/pulse/PrefsWindow.cpp b/src/apps/pulse/PrefsWindow.cpp index 973e5a5a31..3521b81c48 100644 --- a/src/apps/pulse/PrefsWindow.cpp +++ b/src/apps/pulse/PrefsWindow.cpp @@ -36,7 +36,7 @@ PrefsWindow::PrefsWindow(BRect frame, const char *name, // This gives a nice look, and sets the background color correctly BRect bounds = Bounds(); BView* topView = new BView(bounds, "ParentView", B_FOLLOW_ALL, B_WILL_DRAW); - topView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + topView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); AddChild(topView); bounds.top += 10; diff --git a/src/apps/resedit/BitmapView.cpp b/src/apps/resedit/BitmapView.cpp index 165deb336d..1b781743aa 100644 --- a/src/apps/resedit/BitmapView.cpp +++ b/src/apps/resedit/BitmapView.cpp @@ -42,7 +42,7 @@ BitmapView::BitmapView(BRect frame, const char *name, BMessage *mod, BBitmap *bi const char *label, border_style borderstyle, int32 resize, int32 flags) : BView(frame, name, resize, flags) { - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); if (bitmap && bitmap->IsValid()) fBitmap = bitmap; diff --git a/src/apps/resedit/ImageEditor.cpp b/src/apps/resedit/ImageEditor.cpp index fc0b035ed6..e67ebce36d 100644 --- a/src/apps/resedit/ImageEditor.cpp +++ b/src/apps/resedit/ImageEditor.cpp @@ -31,7 +31,7 @@ ImageEditor::ImageEditor(const BRect &frame, ResourceData *data, BHandler *owner imgsize.Set(0, 0, 200, 200); BView *back = new BView(Bounds(), "back", B_FOLLOW_ALL, B_WILL_DRAW); - back->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + back->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); AddChild(back); BRect r; diff --git a/src/apps/resedit/Jamfile b/src/apps/resedit/Jamfile index 26397b09b5..31b696faf5 100644 --- a/src/apps/resedit/Jamfile +++ b/src/apps/resedit/Jamfile @@ -7,7 +7,7 @@ UsePrivateHeaders shared interface ; local columnViewSources ; if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { - columnViewSources = ColumnListView.cpp ColumnTypes.cpp ColorTools.cpp ; + columnViewSources = ColumnListView.cpp ColumnTypes.cpp ; } SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src kits interface ] ; diff --git a/src/apps/resedit/MiscEditors.cpp b/src/apps/resedit/MiscEditors.cpp index 406169a510..f33b3a25ff 100644 --- a/src/apps/resedit/MiscEditors.cpp +++ b/src/apps/resedit/MiscEditors.cpp @@ -75,7 +75,7 @@ Editor::~Editor(void) StringEditView::StringEditView(const BRect &frame) : BView(frame, "edit", B_FOLLOW_ALL, B_WILL_DRAW) { - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); BRect r; diff --git a/src/apps/resedit/ResView.cpp b/src/apps/resedit/ResView.cpp index a16ba4daec..c1152c86bf 100644 --- a/src/apps/resedit/ResView.cpp +++ b/src/apps/resedit/ResView.cpp @@ -50,7 +50,7 @@ ResView::ResView(const BRect &frame, const char *name, const int32 &resize, fOpenPanel(NULL), fSavePanel(NULL) { - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); if (ref) { fRef = new entry_ref; *fRef = *ref; diff --git a/src/apps/screenshot/ScreenshotWindow.cpp b/src/apps/screenshot/ScreenshotWindow.cpp index 75035e988e..98fd819982 100644 --- a/src/apps/screenshot/ScreenshotWindow.cpp +++ b/src/apps/screenshot/ScreenshotWindow.cpp @@ -175,13 +175,13 @@ ScreenshotWindow::ScreenshotWindow(const Utility& utility, bool silent, BMenuField* menuLocation = new BMenuField(B_TRANSLATE("Save in:"), fOutputPathMenu); - menuLocation->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + menuLocation->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); fTranslatorMenu = new BMenu(B_TRANSLATE("Please select")); _SetupTranslatorMenu(); BMenuField* menuFormat = new BMenuField(B_TRANSLATE("Save as:"), fTranslatorMenu); - menuFormat->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + menuFormat->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); BButton* showSettings = new BButton("", B_TRANSLATE("Settings" B_UTF8_ELLIPSIS), new BMessage(kSettings)); diff --git a/src/apps/showimage/ProgressWindow.cpp b/src/apps/showimage/ProgressWindow.cpp index 70df9875f8..e22fadb038 100644 --- a/src/apps/showimage/ProgressWindow.cpp +++ b/src/apps/showimage/ProgressWindow.cpp @@ -38,7 +38,7 @@ ProgressWindow::ProgressWindow() BRect rect = Bounds(); BView* view = new BView(rect, NULL, B_FOLLOW_ALL, B_WILL_DRAW); - view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + view->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); AddChild(view); rect = view->Bounds().InsetByCopy(5, 5); diff --git a/src/apps/showimage/ShowImageStatusView.cpp b/src/apps/showimage/ShowImageStatusView.cpp index 8ed52cbdfd..436e323f9c 100644 --- a/src/apps/showimage/ShowImageStatusView.cpp +++ b/src/apps/showimage/ShowImageStatusView.cpp @@ -45,15 +45,8 @@ ShowImageStatusView::AttachedToWindow() BScrollBar* scrollBar = fScrollView->ScrollBar(B_HORIZONTAL); MoveTo(0.0, scrollBar->Frame().top); - rgb_color color = B_TRANSPARENT_COLOR; - BView* parent = Parent(); - if (parent != NULL) - color = parent->ViewColor(); - if (color == B_TRANSPARENT_COLOR) - color = ui_color(B_PANEL_BACKGROUND_COLOR); - - SetViewColor(color); + AdoptParentColors(); ResizeToPreferred(); } @@ -98,7 +91,8 @@ ShowImageStatusView::Draw(BRect updateRect) } BRect bounds(Bounds()); - rgb_color highColor = HighColor(); + rgb_color highColor = ui_color(B_PANEL_TEXT_COLOR); + SetHighColor(tint_color(ViewColor(), B_DARKEN_2_TINT)); StrokeLine(bounds.LeftTop(), bounds.RightTop()); diff --git a/src/apps/showimage/ShowImageWindow.cpp b/src/apps/showimage/ShowImageWindow.cpp index 9844119dba..d7db462b2b 100644 --- a/src/apps/showimage/ShowImageWindow.cpp +++ b/src/apps/showimage/ShowImageWindow.cpp @@ -164,7 +164,7 @@ ShowImageWindow::ShowImageWindow(BRect frame, const entry_ref& ref, // visible portion without colliding with the menu bar. BView* contentView = new BView(BRect(), "content", B_FOLLOW_NONE, 0); - contentView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + contentView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); contentView->SetExplicitMinSize(BSize(250, 100)); AddChild(contentView); diff --git a/src/apps/soundrecorder/RecorderWindow.cpp b/src/apps/soundrecorder/RecorderWindow.cpp index 3868b753b2..aebfc7fda8 100644 --- a/src/apps/soundrecorder/RecorderWindow.cpp +++ b/src/apps/soundrecorder/RecorderWindow.cpp @@ -373,7 +373,7 @@ RecorderWindow::InitWindow() fSoundList = new SoundListView(r, B_TRANSLATE("Sound List"), B_FOLLOW_ALL); fSoundList->SetSelectionMessage(new BMessage(SOUND_SELECTED)); - fSoundList->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + fSoundList->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); BScrollView *scroller = new BScrollView("scroller", fSoundList, B_FOLLOW_ALL, 0, false, true, B_FANCY_BORDER); fBottomBox->AddChild(scroller); diff --git a/src/apps/stylededit/StyledEditView.cpp b/src/apps/stylededit/StyledEditView.cpp index 32d0ae4be4..c08f6ebffb 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/apps/sudoku/ProgressWindow.cpp b/src/apps/sudoku/ProgressWindow.cpp index 8bd76ed9bc..50cb6402ea 100644 --- a/src/apps/sudoku/ProgressWindow.cpp +++ b/src/apps/sudoku/ProgressWindow.cpp @@ -34,7 +34,7 @@ ProgressWindow::ProgressWindow(BWindow* referenceWindow, BRect rect = Bounds(); BView *view = new BView(rect, NULL, B_FOLLOW_ALL, B_WILL_DRAW); - view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + view->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); AddChild(view); rect = view->Bounds().InsetByCopy(8, 8); diff --git a/src/apps/switcher/GroupListView.cpp b/src/apps/switcher/GroupListView.cpp index 0bee91284e..5aa26533c9 100644 --- a/src/apps/switcher/GroupListView.cpp +++ b/src/apps/switcher/GroupListView.cpp @@ -74,7 +74,7 @@ GroupListView::GroupListView(const char* name, GroupListModel* model, fGroupRenderer(NULL), fSelectionMessage(NULL) { - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); SetModel(model); } diff --git a/src/apps/terminal/TermView.cpp b/src/apps/terminal/TermView.cpp index eb6c9b988c..dc4122860e 100644 --- a/src/apps/terminal/TermView.cpp +++ b/src/apps/terminal/TermView.cpp @@ -1451,10 +1451,12 @@ TermView::FrameResized(float width, float height) bool hasResizeView = fResizeRunner != NULL; if (!hasResizeView) { // show the current size in a view - fResizeView = new BStringView(BRect(100, 100, 300, 140), - B_TRANSLATE("size"), ""); + fResizeView = new BStringView(BRect(100, 100, 300, 140), "size", ""); fResizeView->SetAlignment(B_ALIGN_CENTER); fResizeView->SetFont(be_bold_font); + fResizeView->SetViewColor(fTextBackColor); + fResizeView->SetLowColor(fTextBackColor); + fResizeView->SetHighColor(fTextForeColor); BMessage message(MSG_REMOVE_RESIZE_VIEW_IF_NEEDED); fResizeRunner = new(std::nothrow) BMessageRunner(BMessenger(this), diff --git a/src/apps/webpositive/AuthenticationPanel.cpp b/src/apps/webpositive/AuthenticationPanel.cpp index bfcde2da89..c9e095a173 100644 --- a/src/apps/webpositive/AuthenticationPanel.cpp +++ b/src/apps/webpositive/AuthenticationPanel.cpp @@ -120,7 +120,7 @@ bool AuthenticationPanel::getAuthentication(const BString& text, BTextView* textView = new BTextView(textBounds, "text", textBounds, be_plain_font, &infoColor, B_FOLLOW_NONE, B_WILL_DRAW | B_SUPPORTS_LAYOUT); - textView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + textView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); textView->SetText(text.String()); textView->MakeEditable(false); textView->MakeSelectable(false); diff --git a/src/apps/webpositive/DownloadProgressView.cpp b/src/apps/webpositive/DownloadProgressView.cpp index f7865dcdcd..2e50c965f2 100644 --- a/src/apps/webpositive/DownloadProgressView.cpp +++ b/src/apps/webpositive/DownloadProgressView.cpp @@ -116,7 +116,7 @@ public: virtual void AttachedToWindow() { - SetViewColor(Parent()->ViewColor()); + AdoptParentColors(); } virtual void Draw(BRect updateRect) @@ -257,7 +257,8 @@ DownloadProgressView::Init(BMessage* archive) } fInfoView = new BStringView("info view", ""); - + fInfoView->SetViewColor(ViewColor()); + BSize topButtonSize = fTopButton->PreferredSize(); BSize bottomButtonSize = fBottomButton->PreferredSize(); if (bottomButtonSize.width < topButtonSize.width) @@ -275,6 +276,7 @@ DownloadProgressView::Init(BMessage* archive) ; verticalGroup->SetViewColor(ViewColor()); layout->AddView(verticalGroup); + verticalGroup = BGroupLayoutBuilder(B_VERTICAL, 3) .Add(fTopButton) .Add(fBottomButton) @@ -288,8 +290,6 @@ DownloadProgressView::Init(BMessage* archive) float fontSize = font.Size() * 0.8f; font.SetSize(max_c(8.0f, fontSize)); fInfoView->SetFont(&font, B_FONT_SIZE); - fInfoView->SetHighColor(tint_color(fInfoView->LowColor(), - B_DARKEN_4_TINT)); fInfoView->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET)); return true; @@ -340,6 +340,10 @@ DownloadProgressView::DetachedFromWindow() void DownloadProgressView::AllAttached() { + fStatusBar->SetLowColor(ViewColor()); + fInfoView->SetLowColor(ViewColor()); + fInfoView->SetHighColor(0, 0, 0, 255); + SetViewColor(B_TRANSPARENT_COLOR); SetLowColor(245, 245, 245); SetHighColor(tint_color(LowColor(), B_DARKEN_1_TINT)); diff --git a/src/apps/webpositive/support/FontSelectionView.cpp b/src/apps/webpositive/support/FontSelectionView.cpp index 859095e72f..4d1c9ed2f5 100644 --- a/src/apps/webpositive/support/FontSelectionView.cpp +++ b/src/apps/webpositive/support/FontSelectionView.cpp @@ -85,8 +85,7 @@ FontSelectionView::FontSelectionView(const char* name, const char* label, fPreviewText->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED)); - fPreviewText->SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), - 1.65)); + fPreviewText->SetHighUIColor(B_PANEL_BACKGROUND_COLOR, 1.65); fPreviewText->SetAlignment(B_ALIGN_RIGHT); _UpdateFontPreview(); } diff --git a/src/apps/webpositive/tabview/TabManager.cpp b/src/apps/webpositive/tabview/TabManager.cpp index 7938335b1a..e9e3da8468 100644 --- a/src/apps/webpositive/tabview/TabManager.cpp +++ b/src/apps/webpositive/tabview/TabManager.cpp @@ -338,7 +338,7 @@ public: { SetFlags(Flags() | B_WILL_DRAW); SetViewColor(B_TRANSPARENT_COLOR); - SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetLowUIColor(B_PANEL_BACKGROUND_COLOR); GroupLayout()->SetInsets(0, 6, 0, 0); }