History log of /haiku/src/apps/icon-o-matic/generic/gui/InputTextView.h
Revision Date Author Comments
# d9385a9d 20-Jul-2020 John Scipione <jscipione@gmail.com>

IK: align BTextView text rect/fix alignment

Recalculate line breaks in FrameResized() if word-wrap is on, otherwise
only move the text rect into position. StyledEdit was recalculating line
breaks before on resize (we have to in this mode) and the frame offset
updates for non-wrapping text views are inexpensive. This makes resizing
text view's work like StyledEdit everywhere.

Scroll to cursor when word-wrap setting changes if text view is editable.
If you are viewing a long document changing word-wrap can move the cursor
quite far, so scroll back to it.

Fix _ActualTabWidth() pen location for right and center-aligned text views
so that tabs widths are calculated correctly.

Reset fTextRect horizontal limits to bounds minus insets in
_RecalculateLineBreaks(), then grow fTextRect based on alignment when
wrap is off.

Fixing insets also fixes right and center-aligned BTextViews.
Left-aligned text view's grow right, right-aligned ones grow left,
and center-aligned ones grow out.

Make extra scrolling space for all aligned text views go the other way
from how it did in hrev24130 (and on left-aligned text view's too) so
that half the text is visible when you edit past the end or before the
beginnning of a text view instead of none of it.

Fixes #1651 #12608 #13796 #15189

Do not _RecalculateLineBreaks() if text view bounds are invalid.
In SetText() detect invalid text view bounds and resize the view to the
width and height of the first line. Then recalculate line breaks.
This fixes BAlert text view size issues.

Fixes #16481 (regression from hrev54496.)

Remove useless and heavy computation. There is no point in computing line
breaks for a 10px wide text view and it takes a long time because it needs
a lot of linebreaks. The view eventually gets laid out properly.

Fixes #5582 (which was not locale-related, after all.)

Only apply default insets if text rect is set to bounds. This ensures
that apps that manipulate the text rect can continue to do so without
the default insets interfering while apps that don't can benefit
from the defaults. If you want to set the text rect to bounds and
not use the default insets you must override the default by calling
SetInsets(). This prevent the default insets from being applied once
apps have changed the text rect fixing a bug in Icon-O-Matic where the
text rect insets were being applied incorrectly.

Fixes #16488 (regression from hrev54496.)

Reduce left and right insets inside text views from full label spacing
to half label spacing. Unify padding between BTextControl and BTextView.

Move fLayoutData->UpdateInsets() to private BTextView::_UpdateInsets()
because we need access to BTextView member variables when deciding
whether or not to add the default padding or not.

_UpdateInsets() changes:
* Don't update insets if BTextView::SetInsets() was called.
* Don't add default insets unless fTextRect is set to view Bounds().
* Do not set the right and bottom insets to left and top if negative,
set them to 0 like we do to left and top -- DeskCalc bug otherwise.

Fixes #15688

Other BTextView fixes:
* Replace max_c and min_c with std::max and std::min respectively.
* Remove scrolling from one instance of BTextView::SetText() as it
produced undesired results while editing a scrolled text view.
* Add default insets in _UpdateInsets()
* Fix scrolling when entering and deleting text so that some part of
the text is always visible. Make visible scroll width depend on font
size.
* Allow scrolling to a negative offset in x but not y. This allows you
to scroll the entire contents of right and centered-aligned text views
whose content does not fit in the box.
* Change _Refresh() to take an offset instead of a bool so that you can
scroll to any offset.
* Replace TextLength() with fText->Length() in a couple of places.

TextControl changes:
* Set text rect in BTextControl::DoLayout().
* Remove AlignTextRect() from TextInput.

Fix the following problems in apps:

ScreenSaver: Set text rect in PreviewView::AddPreview().
Tracker: Set "Edit name" text view insets to 2. Tweek text rect position
to be on top of label in icon, mini-icon, and list mode. Add a TODO that
the text rect is a pixel off from the name on some files.
Mail: Remove _AlignTextRect() and FrameResized() from AddressTextControl.
Use default insets on the text view, defaults are fine here.
DeskCalc: Set insets based on font size in ExpressionTextView
SetTextRect() instead of manipulating the text rect.
Remove _CheckTextRect() and related methods from InputTextView.
Icon-O-Matic: Remove _CheckTextRect() and related methods from InputTextView.
WebPositive: Remove _AlignTextRect() and FrameResized() from URLTextView
and call SetInsets().
StyledEdit: Word-wrap and FrameResized() changes ported to BTextView.

Fixes #16476 #16480 #16488 (regressions from hrev54496.)

Change-Id: Ifeca6077f8815ccd86d5a3880f99556298aaf0fe
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3152
Reviewed-by: John Scipione <jscipione@gmail.com>


# 28051eb0 01-Jan-2010 Stephan Aßmus <superstippi@gmx.de>

Always apply the changes to a property in the text editor when changing focus.
Fixes #2749.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34847 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 128277c9 13-Jun-2006 Stephan Aßmus <superstippi@gmx.de>

the first steps towards Icon-O-Matic
* added a framework with many classes that I think will be useful
* currently, the StateView and Manipulator interface are used to
allow editing a single VectorPath object, nothing more... the
CommandStack framework is also used to support Undo/Redo


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17822 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 28051eb04df0865d5b6b3e1ca3dc88fa7f6ed993 01-Jan-2010 Stephan Aßmus <superstippi@gmx.de>

Always apply the changes to a property in the text editor when changing focus.
Fixes #2749.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34847 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 128277c969aa806add78941cd2972754c37a1572 13-Jun-2006 Stephan Aßmus <superstippi@gmx.de>

the first steps towards Icon-O-Matic
* added a framework with many classes that I think will be useful
* currently, the StateView and Manipulator interface are used to
allow editing a single VectorPath object, nothing more... the
CommandStack framework is also used to support Undo/Redo


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17822 a95241bf-73f2-0310-859d-f6bbb57e9c96