HaikuDepot: MarkupTextView SetForegroundColor to HighUIColor

Also the bullet point color
Allow Usage Conditions window to be resized
Tint disabled color instead of hardcoding

Copyright 2024 Haiku, Inc.

Fixes the other half of #19067

Change-Id: Ibf74d9dd673807b0f107e56cefb5b30916baed96
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8262
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
This commit is contained in:
John Scipione 2024-09-09 11:46:01 -04:00 committed by waddlesplash
parent cce39b3cc0
commit 13553050f9
4 changed files with 26 additions and 23 deletions

View File

@ -264,7 +264,6 @@ 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->SetHighUIColor(B_PANEL_TEXT_COLOR);
BPoint bulletPos(offset);
bulletPos.x += fParagraphStyle.FirstLineInset()
+ fParagraphStyle.LineInset();

View File

@ -1,5 +1,6 @@
/*
* Copyright 2020, Andrew Lindesay <apl@lindesay.co.nz>.
* Copyright 2024 Haiku, Inc. All rights reserved.
* All rights reserved. Distributed under the terms of the MIT License.
*/
@ -48,14 +49,12 @@ enum {
};
ToLatestUserUsageConditionsWindow::ToLatestUserUsageConditionsWindow(
BWindow* parent,
Model& model, const UserDetail& userDetail)
ToLatestUserUsageConditionsWindow::ToLatestUserUsageConditionsWindow(BWindow* parent, Model& model,
const UserDetail& userDetail)
:
BWindow(BRect(), B_TRANSLATE("Update usage conditions"),
B_FLOATING_WINDOW_LOOK, B_MODAL_SUBSET_WINDOW_FEEL,
B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS
| B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_NOT_CLOSABLE),
BWindow(BRect(), B_TRANSLATE("Update usage conditions"), B_FLOATING_WINDOW_LOOK,
B_MODAL_SUBSET_WINDOW_FEEL,
B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS | B_NOT_ZOOMABLE | B_NOT_CLOSABLE),
fModel(model),
fUserDetail(userDetail),
fWorkerThread(-1),

View File

@ -1,5 +1,6 @@
/*
* Copyright 2019-2021, Andrew Lindesay <apl@lindesay.co.nz>.
* Copyright 2024 Haiku, Inc. All rights reserved.
* All rights reserved. Distributed under the terms of the MIT License.
*/
@ -53,10 +54,8 @@
UserUsageConditionsWindow::UserUsageConditionsWindow(Model& model,
UserUsageConditions& userUsageConditions)
:
BWindow(BRect(), B_TRANSLATE("Usage conditions"),
B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS
| B_NOT_RESIZABLE | B_NOT_ZOOMABLE),
BWindow(BRect(), B_TRANSLATE("Usage conditions"), B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS | B_NOT_ZOOMABLE),
fMode(FIXED),
fModel(model),
fIntroductionTextView(NULL),
@ -94,13 +93,12 @@ UserUsageConditionsWindow::UserUsageConditionsWindow(Model& model,
_DisplayData(userDetail, userUsageConditions);
}
UserUsageConditionsWindow::UserUsageConditionsWindow(
Model& model, UserUsageConditionsSelectionMode mode)
UserUsageConditionsWindow::UserUsageConditionsWindow(Model& model,
UserUsageConditionsSelectionMode mode)
:
BWindow(BRect(), B_TRANSLATE("Usage conditions"),
B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS
| B_NOT_RESIZABLE | B_NOT_ZOOMABLE),
BWindow(BRect(), B_TRANSLATE("Usage conditions"), B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS | B_NOT_ZOOMABLE),
fMode(mode),
fModel(model),
fWorkerThread(-1)

View File

@ -1,5 +1,6 @@
/*
* Copyright 2013-2014, Stephan Aßmus <superstippi@gmx.de>.
* Copyright 2024 Haiku, Inc. All rights reserved.
* All rights reserved. Distributed under the terms of the MIT License.
*/
@ -7,9 +8,6 @@
#include "MarkupTextView.h"
static const rgb_color kLightBlack = (rgb_color){ 60, 60, 60, 255 };
MarkupTextView::MarkupTextView(const char* name)
:
TextDocumentView(name)
@ -31,7 +29,15 @@ MarkupTextView::MarkupTextView(const char* name)
void
MarkupTextView::SetText(const BString& markupText)
{
SetTextDocument(fMarkupParser.CreateDocumentFromMarkup(markupText));
TextDocumentRef document(new(std::nothrow) TextDocument(), true);
CharacterStyle regularStyle(fMarkupParser.NormalCharacterStyle());
regularStyle.SetForegroundColor(HighUIColor());
fMarkupParser.SetStyles(regularStyle, fMarkupParser.NormalParagraphStyle());
fMarkupParser.AppendMarkup(document, markupText);
SetTextDocument(document);
}
@ -60,7 +66,8 @@ MarkupTextView::SetDisabledText(const BString& text)
paragraphStyle.SetAlignment(ALIGN_CENTER);
CharacterStyle disabledStyle(fMarkupParser.NormalCharacterStyle());
disabledStyle.SetForegroundColor(kLightBlack);
rgb_color disabled = tint_color(HighColor(), HighColor().IsLight() ? B_DARKEN_1_TINT : 0.853);
disabledStyle.SetForegroundColor(disabled);
Paragraph paragraph(paragraphStyle);
paragraph.Append(TextSpan(text, disabledStyle));