hrev54749 adds 1 changeset to branch 'master'
old head: b943b993c7d76d26bf5dc361410368de96427847
new head: 30ecf636e06cee22ce3fc27173a39ced67f54f0a
overview:
https://git.haiku-os.org/haiku/log/?qt=range&q=30ecf636e06c+%5Eb943b993c7d7
----------------------------------------------------------------------------
30ecf636e06c: Tracker: Scroll text to beginning on edit name
... so that the full file name is shown.
Center the file name in the edit box a bit better, the edit box is still
off compared to the non-editable file name by a pixel sometimes.
Use be_plain_font instead of getting the font from the PoseView since
the PoseView font is set to be_plain_font.
Fixes #16476
Change-Id: Ibda9341593163cdde898a83c98bf5ccea37126be
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3399
Reviewed-by: Adrien Destugues <pulkomandy@xxxxxxxxx>
[ John Scipione <jscipione@xxxxxxxxx> ]
----------------------------------------------------------------------------
Revision: hrev54749
Commit: 30ecf636e06cee22ce3fc27173a39ced67f54f0a
URL: https://git.haiku-os.org/haiku/commit/?id=30ecf636e06c
Author: John Scipione <jscipione@xxxxxxxxx>
Date: Thu Nov 19 00:18:55 2020 UTC
Committer: Adrien Destugues <pulkomandy@xxxxxxxxx>
Commit-Date: Wed Dec 2 17:58:47 2020 UTC
Ticket: https://dev.haiku-os.org/ticket/16476
----------------------------------------------------------------------------
1 file changed, 9 insertions(+), 5 deletions(-)
src/kits/tracker/TextWidget.cpp | 14 +++++++++-----
----------------------------------------------------------------------------
diff --git a/src/kits/tracker/TextWidget.cpp b/src/kits/tracker/TextWidget.cpp
index ba8da3463d..40271522fc 100644
--- a/src/kits/tracker/TextWidget.cpp
+++ b/src/kits/tracker/TextWidget.cpp
@@ -373,12 +373,12 @@ BTextWidget::StartEdit(BRect bounds, BPoseView* view,
BPose* pose)
BRect textRect(bounds);
// label offset
- rect.OffsetBy(1, -2);
+ float hOffset = 0;
+ float vOffset = view->ViewMode() == kListMode ? -1 : -2;
+ rect.OffsetBy(hOffset, vOffset);
- BFont font;
- view->GetFont(&font);
BTextView* textView = new BTextView(rect, "WidgetTextView", textRect,
- &font, 0, B_FOLLOW_ALL, B_WILL_DRAW);
+ be_plain_font, 0, B_FOLLOW_ALL, B_WILL_DRAW);
textView->SetWordWrap(false);
textView->SetInsets(2, 2, 2, 2);
@@ -394,7 +394,7 @@ BTextWidget::StartEdit(BRect bounds, BPoseView* view,
BPose* pose)
rect.InsetBy(-2, -2);
// undo label offset
- textRect = rect.OffsetToCopy(-1, 2);
+ textRect = rect.OffsetToCopy(-hOffset, -vOffset);
textView->SetTextRect(textRect);
@@ -436,6 +436,10 @@ BTextWidget::StartEdit(BRect bounds, BPoseView* view,
BPose* pose)
// for widget
textView->SelectAll();
+ textView->ScrollToSelection();
+ // scroll to beginning so that text is visible
+ textView->ScrollBy(-1, -2);
+ // scroll in rect to center text
textView->MakeFocus();
// make this text widget invisible while we edit it