Tracker: Call AdoptSystemColors() to apply read-only tint

2 - 1.147 = 0.853

Change-Id: I260af9d07f5e43e939ce351bfd4036665ad126f4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8269
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
This commit is contained in:
John Scipione 2024-09-09 15:42:27 -04:00 committed by waddlesplash
parent 9105063938
commit 0d50dc1f3e
2 changed files with 4 additions and 5 deletions

View File

@ -456,13 +456,12 @@ BTextWidget::StartEdit(BRect bounds, BPoseView* view, BPose* pose)
textView->AddFilter(new BMessageFilter(B_KEY_DOWN, TextViewKeyDownFilter)); textView->AddFilter(new BMessageFilter(B_KEY_DOWN, TextViewKeyDownFilter));
if (view->SelectedVolumeIsReadOnly()) { if (view->SelectedVolumeIsReadOnly()) {
textView->AdoptSystemColors();
textView->MakeEditable(false); textView->MakeEditable(false);
textView->MakeSelectable(true); textView->MakeSelectable(true);
// tint text view background color to indicate not editable } else {
textView->SetViewColor(tint_color(textView->ViewColor(),
ReadOnlyTint(textView->ViewColor())));
} else
textView->AddFilter(new BMessageFilter(B_PASTE, TextViewPasteFilter)); textView->AddFilter(new BMessageFilter(B_PASTE, TextViewPasteFilter));
}
// get full text length // get full text length
rect.right = rect.left + textView->LineWidth(); rect.right = rect.left + textView->LineWidth();

View File

@ -91,7 +91,7 @@ float
ReadOnlyTint(rgb_color base) ReadOnlyTint(rgb_color base)
{ {
// darken tint if read-only (or lighten if dark) // darken tint if read-only (or lighten if dark)
return base.IsLight() ? B_DARKEN_1_TINT : 0.85; return base.IsLight() ? B_DARKEN_1_TINT : 0.853;
} }