History log of /haiku/headers/os/interface/TextView.h
Revision Date Author Comments
# 64a2e733 28-Nov-2023 John Scipione <jscipione@gmail.com>

Add _ViewWidth(), _ViewHeight(), _TextWidth(), _TextHeight()

private convenience methods to calculate the text view width and
height with insets and the text rect width and height without
insets respectively.

Also add _ViewRect() and _TextRect() methods for completeness,
but they are not currently used.

Change-Id: I0582bc93a0a3a6820bbb2262a1d726457309ab9f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7162
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>


# 7912dad9 17-Jan-2021 John Scipione <jscipione@gmail.com>

BTextView: Fix Tracker edit name

Don't resize text view in FrameResized() if resizable, this is done
in _AutoResize() instead. Set text rect width to width of max line when
word-wrap is off. Text rect width shrinks to the width of the text
matching behavior of BeOS R5 and previous Haiku. This fixes Tracker
Edit name.

Limit max width to column width in list mode or 30em in icon mode.
Filter paste messages limiting to max width in Tracker Edit name.

General BTextView fixes:

As a consequence of the text rect shrinking to fit the text, adjust
highlighting to go at least to edge of the view even if text rect width
is narrower. Extend the invalidation area beyond text rect when
redrawing to include highlighted areas.

Text views behave properly when overflow occurs i.e. when you type
text off the end of the text view. The text is nudged over as you
type/scroll so that the previous text is visible. This sorta worked
before but now works better.

Fix text rect centering by replacing switch with
BLayoutUtils::AlignOnRect().

Coalesce consecutive draw calls when inserting and deleting text to
prevent flashing for example when resizing the window. Redraw text
when the text view scrolls fixing a bug I noticed in StyledEdit.

Workaround negative height Beezer bug.

Fixes #16642, #16476

Change-Id: I2d32d6039944d2dc3218ce4de71f2966cc98c866
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3642
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# d00fc0e3 07-Apr-2021 X512 <danger_mail@list.ru>

BTextView: fix Text field scripting

Change-Id: I2048d7f01fa3694d5687447cf7058fecf03ae15d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4007
Reviewed-by: X512 <danger_mail@list.ru>
Reviewed-by: John Scipione <jscipione@gmail.com>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>


# 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>


# 22758f16 17-Aug-2020 John Scipione <jscipione@gmail.com>

Revert "IK: align BTextView text rect/fix alignment"

This reverts commit a9b301871d06c0ebe42d22b31c685abed5107acd.

hrev54496

Change-Id: Ife3c834ad98d330f04976d9adf3b1553e7aca034
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3153
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>


# a9b30187 20-Jul-2020 John Scipione <jscipione@gmail.com>

IK: align BTextView text rect/fix alignment

Preserve passed in text rect in fTextRext (unless in layout)
and create an internal version fAlignedTextRect which is used
in place of fTextRect. fAlignedTextRext is aligned to fit the
text rect bounds and grows to fit. fAlignedTextRect always grows
vertically but only grows horizontally if wrap is off.

Left-aligned text view's grow right, right-aligned ones grow left,
and center center aligned ones grow out.

Set fTextRect to bounds in _DoLayout().

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

Fixing padding also fixes right and center-aligned BTextViews.

Undo extra scrolling for non-left text views from hrev24130 fixing
a scrolling left and right with mouse bug when it shouldn't.

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.

Set text rect in BTextControl::DoLayout() and ScreenSaver
PreviewView::AddPreview().

Don't add padding if BTextView::SetInsets() is called. Set insets
to 0 in Tracker "Edit name" setting which prevents default padding
from being added. This is so that when you rename a file in Tracker
the TextView appears on top of the file name text with no padding.

80 char limit fixes.

Fixes #1651 #12608 #13796 #15189 #15688

Change-Id: I8c6106effc612f49aff374f29742471628b5df86
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3054
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# 17c9e987 10-Jul-2019 Kacper Kasper <kacperkasper@gmail.com>

TextView: add shortcuts for wordwise delete

Change-Id: Ie67f6255c3f5d9d8ccc6699ed42dd71ae593fa16
Reviewed-on: https://review.haiku-os.org/c/1573
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# d11a3231 24-Jul-2014 John Scipione <jscipione@gmail.com>

TextView: Fix FBC size breakage, take 2

Double checked BeOS R5 & Haiku R1/A4 and BTextView should be 356
bytes, somewhere since then we've added 4 bytes. So, this commit
reduces the class size from 360 back to 356 by removing 1 reserved
int32 (instead of 2).

I believe the class size changed in hrev46798 as a result of adding
2 bools (1 byte each padded out to 4 bytes).

Sorry for the noise.


# fb224a9f 24-Jul-2014 John Scipione <jscipione@gmail.com>

Revert "TextView: Fix FBC size breakage"

This reverts commit 8e268f7552ca94716995885483d34d4053cc94a2.


# 8e268f75 23-Jul-2014 John Scipione <jscipione@gmail.com>

TextView: Fix FBC size breakage

In hrev46796 I added two new private methods: _PreviousLineStart(),
and _NextLineEnd() which increased the size of the class breaking
binary compatability because I forgot to decrement the reserved array.

This commit decrements the reserved array restoring the class size
to the original size fixing the binary compat issue.

Thanks Axel for noticing.


# fef862eb 23-Jul-2014 John Scipione <jscipione@gmail.com>

TextView.h rearrage virtual methods for FBC

The order is updated so the virtual methods appear in the same order
that they did in BeOS R5 with methods new to Haiku added to the bottom.

Perform() moves up, all other methods move below GetDragParameters(),
the last virtual method in BeOS R5's TextView.h.


# 1f424632 11-Jun-2014 John Scipione <jscipione@gmail.com>

Style fixes to IK, focus on docs


# 77acb432 01-Feb-2014 John Scipione <jscipione@gmail.com>

TextView: Remove Cmd+Up and Cmd+Down Shortcuts

to go to the beginning and end of the document.


# 08751732 31-Jan-2014 John Scipione <jscipione@gmail.com>

TextView: Update nav shortcuts again

Make Cmd+Left and Cmd+Right work the same as Option+Left and
Option+Right, that is, they do word-wise navigation.

Make Option+Up go to beginning of paragraph and Option+Down go to end
of paragraph like Cmd+Left and Cmd+Right used to.

Unfortunately option shortcuts are currently eaten by S&T until #9431
gets fixed.


# eb774c29 10-Jan-2014 John Scipione <jscipione@gmail.com>

TextView: Update navigation shortcuts

* Command+Left goes to beginning of line, ignoring softwrap
* Command+Right goes to the end of line, ignoring softwrap
* Home goes to beginning of line, accounting for softwrap
* End goes to end of line, accounting for softwrap
* Option+Left goes to previous word
* Option+Right goes to next word
* Command+Home and Command+Up go to beginning of document
* Command+End and Command+Down go to end of document

Shift with any of the above also selects the text.

This is similar to how the text editor Eddie works.


# ab21cedc 16-Mar-2013 John Scipione <jscipione@gmail.com>

Remove docs and refactor style of TextView class.

* Make pointer style consistent, const char* name instead of const char *name.
* Lots of parameter renaming.
* in parameters don't get anything special, just font, or length instead of
inFont, inLength.
* out parameters get a leading _ so *outWidth becomes *_width for example.
* We don't detail private function in the Haiku book and this class has a bunch
so keep the documentation in the file but use regular comments instead.
* Normalize the parameter names between cpp file and header.
* Some minor whitespace fixes.

No functional change intended.


# dc871e32 14-Jan-2013 Przemysław Buczkowski <przemub@yahoo.pl>

TextView:Cmd/Ctrl-Home/End Shift-selection support

Fixes #6859

Signed-off-by: Siarzhuk Zharski <zharik@gmx.li>


# 402c3b2c 04-Nov-2012 Oliver Tappe <zooey@hirschkaefer.de>

BTextView uses cmd instead of ctrl for navigation

* Adjust BTextView to use B_COMMAND_KEY instead of B_CONTROL_KEY
for wordwise navigation and jumping to the top and bottom.
This requires a shortcut, which is only installed if there is
none already (for the groups B_LEFT_ARROW/B_RIGHT_ARROW and
B_HOME/B_END). As a result, wordwise navigation no longer works
in Mail, for instance.


# 9be774b5 30-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Compilation and 64-bit fixes to libbe.so sources.

Fixed the usual issues - printf format strings, uint32 instead of
addr_t, etc. One thing that isn't so nice is several places where
BList is used to store (u)int32, these require a double cast to addr_t
then void* to silence a warning on x86_64.


# 639e1855 12-Jul-2012 Rene Gollent <anevilyak@gmail.com>

Fix indentation and match parameter names with .cpp.


# 0e201201 12-Jul-2012 Rene Gollent <anevilyak@gmail.com>

Fix build, header changes were forgotten in previous commit.


# 61eb1f1d 22-Oct-2011 Alex Wilson <yourpalal2@gmail.com>

Replace remaining InvalidateLayout()'s with LayoutInvalidated(). Also do a bit of cleanup/move methods around.


# 91f0846f 27-Jan-2011 Ryan Leavengood <leavengood@gmail.com>

Add a default right click context menu to BTextView.

This fixes #7022 and is mostly based on the patch attached to that ticket, with
these changes:
- The patch was adding this to the private _TextInput_ class, not BTextView.
- The patch had a Clear menu item too. I removed that due to the different
semantics between Clear in a BTextView and in a TextInput. The former just
clears the selection where the latter clears the whole view.

We could later add a virtual callback for adding menu items to this context
menu which could be used to add Clear with the two semantics in each class
(this is mainly needed for the enabling logic...each class could handle a clear
message in its own way.) This callback could also obviously be used for other
things, like a spell-check menu or whatever an application would want to add.
Since BTextView has 10 free virtual slots it seems reasonable to add.


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


# 575625f1 11-Apr-2010 Oliver Tappe <zooey@hirschkaefer.de>

fix drawing artefacts when the caret is being clipped, which lead
to parts of the caret being inverted:
* instead of always inverting the caret rect, we now invalidate when the
caret should be hidden



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


# 5569f333 06-Nov-2009 Axel Dörfler <axeld@pinc-software.de>

* Someone obviously forgot to check in some header changes. Build fix.


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


# a85a827c 04-Nov-2009 Oliver Tappe <zooey@hirschkaefer.de>

* introduced two new private methods, _PreviousWordStart() and _NextWordStart(),
which are now being used to implement the word-wise keyboard navigation,
fixing #4785


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


# 32c8ab89 21-Oct-2009 Oliver Tappe <zooey@hirschkaefer.de>

* added _TabExpandedStyledWidth(), which makes sure to expand all tab chars
during the width calculation
* used _TabExpandedStyledWidth() at all places that need to expand tabs,
fixing #4822
* removed _StyledWidthUTF8Safe() as it didn't make sense - we now perform
the same auto-scrolling horizontally as we do vertically


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


# b18f133d 21-Oct-2009 Oliver Tappe <zooey@hirschkaefer.de>

generally overhauled non-wrapping mode of BTextView, as it was considerably broken:
* switching from wrapping to non-wrapping mode triggers a recomputation of
the text rect
* non-wrapping mode now triggers updating of the data rect for the horizontal
scrollbar as needed, fixing #4705
* corrected a couple of width computations that confused bounds and text
rect width, leading to drawing artefacts at the end of a line
* unified computation of text rect width to always take all lines into
account (not just the first one)
* some cleanup


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


# 89208c77 27-Aug-2009 Stephan Aßmus <superstippi@gmx.de>

Finished unifying the Interface Kit headers:
* Fixed copyrights (puncuation and capitalization, removed authors from
headers)
* Updated indentation style
* Unified pointer/reference style
* Re-ordered some methods for better grouping where it could be done
(abd adopted source accordingly)
* Small coding style fixes here and there

No functional change intended.

+alphabranch


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


# 9946ba71 16-Aug-2009 Oliver Tappe <zooey@hirschkaefer.de>

* reordered members of BTextView to be compatible with R5 again,
although it should have been safe before, too, since BTextView neither
has inline methods nor any friends that live outside of libbe
* added new member fLastClickOffset in order to be able to restore the
triple-click handling (linewise selection)
* renamed fClickOffset to fCaretOffset, as that is what it really is
now


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


# f287ca7d 13-May-2009 Oliver Tappe <zooey@hirschkaefer.de>

fixed behaviour of non-editable textviews:
* non-editable textviews no longer draw the caret
* the cursor keys scroll immediately, not only when the (invisible) caret
reaches the views bounds
* HOME/END work more reliably
* any selection stays active throughout keyboard navigation
Tested with AboutSystem, Mail, StyledEdit and Beam - seems to work ok


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


# 5cc8dc2f 01-May-2009 Oliver Tappe <zooey@hirschkaefer.de>

* unified application of style into a separate method _ApplyStyleRange()
in order to maintain the null-style appropriately, if required
* finally fix #3040 for real (a single style is now maintained at all times
for non-stylable textviews)
* the caret is now being drawn with the correct size, even if it is on
the empty line at the end of the buffer and a specific font size has been
requested


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


# 02359fde 27-Apr-2009 Oliver Tappe <zooey@hirschkaefer.de>

[ should have been part of last commit ]
more work concerning navigation within BTextView:
* pressing HOME on last line works again
* made public versions of LineAt() do what is required to pass back the
correct value even for the last line of the buffer (original implementation
has been moved to private _LineAt())
* PAGE_UP/PAGE_DOWN now moves the view by the bounds-height, making the
behaviour somewhat less confusing (IMHO, please shout if that's not
acceptable for you)

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


# 200da682 07-Apr-2009 Oliver Tappe <zooey@hirschkaefer.de>

* implemented wordwise navigation via control + arrow keys
* renamed _FindXXXWordBoundary() methods to _Previous/_NextWordBoundary()
since the respective per-char methods are named this way
* started to work on improving the behaviour of page-up/page-down

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


# 3f3ab162 07-Apr-2009 Oliver Tappe <zooey@hirschkaefer.de>

continued work on BTextView:
* reverted my recent change that caused Mail to always show the end
of mails 8-) and now invoke ScrollToOffset() wherever it was missing
(mostly in keyboard-related methods)
* _DoInsertText() only moves the caret if the text has been inserted
in front of the caret, not after it
* overhauled selection by char/word/line and their extension mechanism
(which now behaves as the haiku shell)
* use strnlen() instead of strlen() in those versions of Insert() which
accept a length parameter, as strlen can potentially waste a lot of
cycles skipping the whole string, when all we want is to clamp the length.
* cleanup (some of it automatic removal of trailing whitespace)

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


# 4e50f1ae 06-Apr-2009 Oliver Tappe <zooey@hirschkaefer.de>

* Instead of invoking _DrawLines out of the app-server drawing context,
we request the drawing via Invalidate() - this make use of the app-server's
potential double buffering, whenever that is active. This change reduces
flickering in VESA mode considerably.

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


# b545073f 06-Nov-2008 Stephan Aßmus <superstippi@gmx.de>

* Moved the global BPrivate::WidthBuffer from BTextView into BPrivate as
gWidthBuffer.
* Tracker PoseView now uses BPrivate::gWidthBuffer instead of it's own
instance.
* TextView.h and PoseView.h are now a little cleaner.
* InterfaceDefs.cpp now deletes gWidthBuffer in _fini_interface_kit_().
* Added binary compatibility support for NetPositive in WidthBuffer.h and .cpp.
Obviously it kind of defeats the purpose of having WidthBuffer neatly tucked
away in the BPrivate namespace, but Haiku should run NetPositive, I guess.
Fixes #2879.


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


# 9e163a7a 21-Oct-2008 Axel Dörfler <axeld@pinc-software.de>

* Made BScrollView work when using it with the layout system.
* Added a layout friendly constructor - it's not so nice to use, though, since
the original one already doesn't get a BRect (we just don't need the
resizing mode, and have to set the B_SUPPORTS_LAYOUT flag).
* Refactored size/frame computation a bit.
* Cleanup.


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


# 90b7764d 21-Sep-2008 Rene Gollent <anevilyak@gmail.com>

Move WidthBuffer and TextGapBuffer into BPrivate and use them from there in BPoseView and BTextView. This (correctly) fixes the previous gcc4 build issues.



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


# 40ca6c57 21-Sep-2008 Rene Gollent <anevilyak@gmail.com>

Declare BPoseView as a friend of BTextView. This allows it to use the private width buffer classes, and fixes the gcc4 build.


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


# 88643347 21-Sep-2008 Stephan Aßmus <superstippi@gmx.de>

* First steps towards making BTextView behave well within the layout management.
* The class calculates a minimum width now, which is based on the line height,
this may also fix the bug with the small text inputs in the Pe Find window.
* Added TODOs about implementing GetHeightForWidth(), which may be a good idea
when a BTextView is used as non-editable informative text in an interface,
and one wants to make sure that the entire text is shown.
* Replaced the call to _Refresh() in Draw(), which recalculates all the line
breaks for no reason with _DrawLines() again. The TODO mentioned that text
will be drawn without drawing the background first, but maybe this is a
relict from times where Draw() was invoked directly? At least I cannot see
any negative consequences, and this should be much more efficient.
(Other than that, this patch should hopefully have no potential negative
side effects...<crosses fingers>)


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


# e6378518 21-Sep-2008 Stephan Aßmus <superstippi@gmx.de>

Fixed typo.


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


# 6168332c 21-Sep-2008 Stephan Aßmus <superstippi@gmx.de>

Sorry, should have been part of r27660. Moved BTextView::UndoBuffer derivatives
into BTextView class as well, hopefully fixing the GCC4 build.


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


# a682d981 20-Sep-2008 Stephan Aßmus <superstippi@gmx.de>

Quite a cleanup action to avoid polluting the global namespace with private
BTextView classes:

* Declared the directly used BTextView helper classes as private BTextView
classes and changed all affected files.
* Realized that Tracker's BPoseView was (accidentally?) using what used to
be _BWidthBuffer_. It had declared it's own class with the same name and
same members/size in headers/private/tracker/TextViewSupport.h, but the
implementation was nowhere to be found. I can only explain this that
the BTextView implementation was then actually linked and used. But the big
problem was that it was used without locking (unlike in BTextView)! When
many Tracker windows opened during system startup or later and they happened
to each request characters not yet in the cache, I imagine things could have
gone bad and corrupted memory. Anyways, since I can see the usefulness of
the cache, BPoseView uses BTextView::WidthBuffer on purpose now. And I moved
the locking inside BTextView::WidthBuffer::StringWidth().
* Adjusted InterfaceDefs.cpp accordingly.
* TODO: Move subsequent classes into BTextView namespace as well, ie derived
classes that BTextView doesn't directly know about. All stuff in src/kits/
inteface/textview_support/
* Added preliminary and not yet implemented layout friendly BTextView
constructors.
* I will try to handle the insets imposed by BTextView::fTextRect a bit
differently when used inside the new layout management framework. For this,
I added BTextView::SetInsets() and GetInsets(). SetInsets() doesn't do
anything yet.

So far, everything seems to work still... ;-)


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


# 37b98743 20-Sep-2008 Stephan Aßmus <superstippi@gmx.de>

Update header indentation style.


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


# 46ea5b1e 25-Feb-2008 Stephan Aßmus <superstippi@gmx.de>

Further improvements to auto scrolling and text rect + container view resizing:
* Renaming things in Tracker list mode no longer magically grows the text view.
* ScrollToOffset() is not supposed to depend on the existence of any scroll
bars, in R5 text views simply scroll to where they need to. This fixes
renaming things in Tracker when hitting the window bounds (text widget stops
growing and starts to autoscroll) and also the Text tool in WonderBrush.
* _ScrollToOffset() is therefor no longer needed.
* The insets of the text rect are not so interesting as the original width.
In auto resizing mode, the original width is important when there is no
container view. In this setup, the text rect auto resizing is mainly needed
for auto scrolling, but it should never shrink below the original size.
* Further improved auto scrolling for right aligned and center aligned text
views, it works like R5 now. Also take the line height into account when
checking for the bounds bottom. Removed extra spacing for vertical
scrolling.


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


# b8872c02 24-Feb-2008 Stephan Aßmus <superstippi@gmx.de>

BTextControl:
* Placed _BTextInput_ into BPrivate namespace.
* Made _BTextInput_::AlignTextRect() smarter, it centers the line vertically,
for the case that the BTextControl has a larger label font. Improved insets
for asthetics.
* Used _BTextInput_::AlignTextRect() consistently in BTextControl, no more
custom calls to SetTextRect(). Account for minimum vertical inset of 2
pixels in GetPreferredSize().
* Consistendly select all text when gaining focus in _BTextInput_.
* Override MouseDown() in case the control did not have focus before, or else
BTextView::MouseDown() will deselct the text again and place the cursor.
(in line with BeOS behavior)
* Removed unused fBool member from _BTextInput_ and other cleanup.

BTextView:
* Reimplemented BTextView::_AutoResize() so that it works well with
BTextControl and autoscrolling when the alignment is not B_ALIGN_LEFT.
I needed two new members for this, fLeftInset and fRightInset which are
the original insets from the fTextRects. It might currently be broken
for renaming things in Tracker, I will have to check. _AutoResize() no
longer messes up the fTextRect insets.
* Fixed stray carrets sometimes being left over, mostly when auto scrolling,
but I observed them in other cases as well.
* Prevent negative scrolling offsets when autoscrolling. Fixes weird scrolling
offsets when navigating to the left.
* Reset scrolling to B_ORIGIN when SetText() is called. Fixes for example
starting to type in the middle of the control in Vision when entering new
text and autoscrolling was triggered before.



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


# 13ca2d94 23-Oct-2007 Axel Dörfler <axeld@pinc-software.de>

Patch by Vasilis Kaoutsis - thanks!:
* Rewrote TextView.h
* Renamed all private methods to have the underscore prefix.
And also:
* Whitespace and line width cleanup.


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


# f6e4cbb9 15-Oct-2007 Axel Dörfler <axeld@pinc-software.de>

* Rewrote BeBuild.h which had "a few" consequences (got rid of all those class
definitions).
* Minor cleanup here and there.


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


# c0441727 08-Oct-2007 Stefano Ceccherini <stefano.ceccherini@gmail.com>

I was wrong after all. InsertText() doesn't call SetRunArray() (and
hence CancelInputMethod()), but it implements part of it. To avoid code
duplication, I added a private _SetRunArray() call, which does most of
the work, except cancelling the input method, and calling Refresh().
Removed some unneeded code from CancelInputMethod(), some small changes
in HandleInputMethodChanged.
-Questa linea, e quelle sotto di essa, saranno ignorate--

M src/kits/interface/TextView.cpp
M headers/os/interface/TextView.h


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


# f2476bcc 04-Oct-2007 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Patch by Rene Gollent: TextViews now can scroll even if they aren't
attached to a BScrollView.


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


# 99584ef9 04-Jul-2007 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Added _Show/_HideCaret() and used them in place of more bug-prone code.


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


# f96bec01 30-Apr-2007 Stefano Ceccherini <stefano.ceccherini@gmail.com>

small cleanups. Moved some code into a _DrawLine() method.


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


# 25df172b 04-Jan-2007 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Implemented auto horizontal scrolling (by fixed steps for now), moved
auto scrolling to its own method, introduced a new private
StyledWidthUTF8Safe method.



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


# e3338433 03-Feb-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Added Alloc/Copy/FreeRunArray() as Axel's suggestion, and used it internally in TextView. Also fixed small memory leak

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


# d601f6e8 11-Nov-2004 shatty <shatty@nowhere.fake>

rename RecalLineBreaks to RecalculateLineBreaks ; use ceil() when computing the origins for lines


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


# bc1aaab6 03-Dec-2002 Ingo Weinhold <ingo_weinhold@gmx.de>

AutoResize() parameter was missing.


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


# d734a8ce 23-Oct-2002 beveloper <beveloper@nowhere.fake>

some header files to be R5 compatible


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


# d11a323120b7aae53f178877ca4c4cc59ab6a1d1 24-Jul-2014 John Scipione <jscipione@gmail.com>

TextView: Fix FBC size breakage, take 2

Double checked BeOS R5 & Haiku R1/A4 and BTextView should be 356
bytes, somewhere since then we've added 4 bytes. So, this commit
reduces the class size from 360 back to 356 by removing 1 reserved
int32 (instead of 2).

I believe the class size changed in hrev46798 as a result of adding
2 bools (1 byte each padded out to 4 bytes).

Sorry for the noise.


# fb224a9f14d8c3c9d05609892f832d7937ad60a6 24-Jul-2014 John Scipione <jscipione@gmail.com>

Revert "TextView: Fix FBC size breakage"

This reverts commit 8e268f7552ca94716995885483d34d4053cc94a2.


# 8e268f7552ca94716995885483d34d4053cc94a2 23-Jul-2014 John Scipione <jscipione@gmail.com>

TextView: Fix FBC size breakage

In hrev46796 I added two new private methods: _PreviousLineStart(),
and _NextLineEnd() which increased the size of the class breaking
binary compatability because I forgot to decrement the reserved array.

This commit decrements the reserved array restoring the class size
to the original size fixing the binary compat issue.

Thanks Axel for noticing.


# fef862eb200d34bc932e0775887e844a48bd2730 23-Jul-2014 John Scipione <jscipione@gmail.com>

TextView.h rearrage virtual methods for FBC

The order is updated so the virtual methods appear in the same order
that they did in BeOS R5 with methods new to Haiku added to the bottom.

Perform() moves up, all other methods move below GetDragParameters(),
the last virtual method in BeOS R5's TextView.h.


# 1f424632be5dcad5b81a23080eb205ab6471cd7b 11-Jun-2014 John Scipione <jscipione@gmail.com>

Style fixes to IK, focus on docs


# 77acb4327395b8212c8ceb9270615afcd6a5eae1 01-Feb-2014 John Scipione <jscipione@gmail.com>

TextView: Remove Cmd+Up and Cmd+Down Shortcuts

to go to the beginning and end of the document.


# 08751732464f81c837f3cff0b6ef1236ea8023ca 31-Jan-2014 John Scipione <jscipione@gmail.com>

TextView: Update nav shortcuts again

Make Cmd+Left and Cmd+Right work the same as Option+Left and
Option+Right, that is, they do word-wise navigation.

Make Option+Up go to beginning of paragraph and Option+Down go to end
of paragraph like Cmd+Left and Cmd+Right used to.

Unfortunately option shortcuts are currently eaten by S&T until #9431
gets fixed.


# eb774c294887ef01359b09183a0cc1cdea40e782 10-Jan-2014 John Scipione <jscipione@gmail.com>

TextView: Update navigation shortcuts

* Command+Left goes to beginning of line, ignoring softwrap
* Command+Right goes to the end of line, ignoring softwrap
* Home goes to beginning of line, accounting for softwrap
* End goes to end of line, accounting for softwrap
* Option+Left goes to previous word
* Option+Right goes to next word
* Command+Home and Command+Up go to beginning of document
* Command+End and Command+Down go to end of document

Shift with any of the above also selects the text.

This is similar to how the text editor Eddie works.


# ab21cedcce7774904821253a3cd6986b04c70634 16-Mar-2013 John Scipione <jscipione@gmail.com>

Remove docs and refactor style of TextView class.

* Make pointer style consistent, const char* name instead of const char *name.
* Lots of parameter renaming.
* in parameters don't get anything special, just font, or length instead of
inFont, inLength.
* out parameters get a leading _ so *outWidth becomes *_width for example.
* We don't detail private function in the Haiku book and this class has a bunch
so keep the documentation in the file but use regular comments instead.
* Normalize the parameter names between cpp file and header.
* Some minor whitespace fixes.

No functional change intended.


# dc871e324d59c1cd691fdedca8807d11e5b959d0 14-Jan-2013 Przemysław Buczkowski <przemub@yahoo.pl>

TextView:Cmd/Ctrl-Home/End Shift-selection support

Fixes #6859

Signed-off-by: Siarzhuk Zharski <zharik@gmx.li>


# 402c3b2c0980aab7b94a4f9fb2ceec530c110456 04-Nov-2012 Oliver Tappe <zooey@hirschkaefer.de>

BTextView uses cmd instead of ctrl for navigation

* Adjust BTextView to use B_COMMAND_KEY instead of B_CONTROL_KEY
for wordwise navigation and jumping to the top and bottom.
This requires a shortcut, which is only installed if there is
none already (for the groups B_LEFT_ARROW/B_RIGHT_ARROW and
B_HOME/B_END). As a result, wordwise navigation no longer works
in Mail, for instance.


# 9be774b553296a712704078314f2291ae5fc352c 30-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Compilation and 64-bit fixes to libbe.so sources.

Fixed the usual issues - printf format strings, uint32 instead of
addr_t, etc. One thing that isn't so nice is several places where
BList is used to store (u)int32, these require a double cast to addr_t
then void* to silence a warning on x86_64.


# 639e18555f1572f33cd19d94701f6eae8062cfe4 12-Jul-2012 Rene Gollent <anevilyak@gmail.com>

Fix indentation and match parameter names with .cpp.


# 0e20120117d4fa86db87a969d1f1181dd70c674f 12-Jul-2012 Rene Gollent <anevilyak@gmail.com>

Fix build, header changes were forgotten in previous commit.


# 61eb1f1d19eed26b6138b0701612e8eb31bb1d86 22-Oct-2011 Alex Wilson <yourpalal2@gmail.com>

Replace remaining InvalidateLayout()'s with LayoutInvalidated(). Also do a bit of cleanup/move methods around.


# 91f0846f8a689e0d8c4da6fc5f1c584556b2249d 27-Jan-2011 Ryan Leavengood <leavengood@gmail.com>

Add a default right click context menu to BTextView.

This fixes #7022 and is mostly based on the patch attached to that ticket, with
these changes:
- The patch was adding this to the private _TextInput_ class, not BTextView.
- The patch had a Clear menu item too. I removed that due to the different
semantics between Clear in a BTextView and in a TextInput. The former just
clears the selection where the latter clears the whole view.

We could later add a virtual callback for adding menu items to this context
menu which could be used to add Clear with the two semantics in each class
(this is mainly needed for the enabling logic...each class could handle a clear
message in its own way.) This callback could also obviously be used for other
things, like a spell-check menu or whatever an application would want to add.
Since BTextView has 10 free virtual slots it seems reasonable to add.


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


# 575625f15572f5f0d783903a568b5543cc558c22 11-Apr-2010 Oliver Tappe <zooey@hirschkaefer.de>

fix drawing artefacts when the caret is being clipped, which lead
to parts of the caret being inverted:
* instead of always inverting the caret rect, we now invalidate when the
caret should be hidden



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


# 5569f33367848cb60a62981cc84c40b4419b7a77 06-Nov-2009 Axel Dörfler <axeld@pinc-software.de>

* Someone obviously forgot to check in some header changes. Build fix.


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


# a85a827cd0df535159856c3f31d187d5f2ae952e 04-Nov-2009 Oliver Tappe <zooey@hirschkaefer.de>

* introduced two new private methods, _PreviousWordStart() and _NextWordStart(),
which are now being used to implement the word-wise keyboard navigation,
fixing #4785


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


# 32c8ab89a9e7d318dab3908eb4f3b0f452cd7457 21-Oct-2009 Oliver Tappe <zooey@hirschkaefer.de>

* added _TabExpandedStyledWidth(), which makes sure to expand all tab chars
during the width calculation
* used _TabExpandedStyledWidth() at all places that need to expand tabs,
fixing #4822
* removed _StyledWidthUTF8Safe() as it didn't make sense - we now perform
the same auto-scrolling horizontally as we do vertically


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


# b18f133db36bceee02e144e86993e1ba684b79ae 21-Oct-2009 Oliver Tappe <zooey@hirschkaefer.de>

generally overhauled non-wrapping mode of BTextView, as it was considerably broken:
* switching from wrapping to non-wrapping mode triggers a recomputation of
the text rect
* non-wrapping mode now triggers updating of the data rect for the horizontal
scrollbar as needed, fixing #4705
* corrected a couple of width computations that confused bounds and text
rect width, leading to drawing artefacts at the end of a line
* unified computation of text rect width to always take all lines into
account (not just the first one)
* some cleanup


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


# 89208c77f10235d43fda0c7b3fd6751db02cc12c 27-Aug-2009 Stephan Aßmus <superstippi@gmx.de>

Finished unifying the Interface Kit headers:
* Fixed copyrights (puncuation and capitalization, removed authors from
headers)
* Updated indentation style
* Unified pointer/reference style
* Re-ordered some methods for better grouping where it could be done
(abd adopted source accordingly)
* Small coding style fixes here and there

No functional change intended.

+alphabranch


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


# 9946ba71ad43f0916003b99a89f7c238e139b408 16-Aug-2009 Oliver Tappe <zooey@hirschkaefer.de>

* reordered members of BTextView to be compatible with R5 again,
although it should have been safe before, too, since BTextView neither
has inline methods nor any friends that live outside of libbe
* added new member fLastClickOffset in order to be able to restore the
triple-click handling (linewise selection)
* renamed fClickOffset to fCaretOffset, as that is what it really is
now


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


# f287ca7dc8ff31c2baa2a65178ca7348e4c8214e 13-May-2009 Oliver Tappe <zooey@hirschkaefer.de>

fixed behaviour of non-editable textviews:
* non-editable textviews no longer draw the caret
* the cursor keys scroll immediately, not only when the (invisible) caret
reaches the views bounds
* HOME/END work more reliably
* any selection stays active throughout keyboard navigation
Tested with AboutSystem, Mail, StyledEdit and Beam - seems to work ok


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


# 5cc8dc2fe3d270f7b101c18ec85b71d6219558e9 01-May-2009 Oliver Tappe <zooey@hirschkaefer.de>

* unified application of style into a separate method _ApplyStyleRange()
in order to maintain the null-style appropriately, if required
* finally fix #3040 for real (a single style is now maintained at all times
for non-stylable textviews)
* the caret is now being drawn with the correct size, even if it is on
the empty line at the end of the buffer and a specific font size has been
requested


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


# 02359fde690e038aa75c5d86f7a497ec8f98d188 27-Apr-2009 Oliver Tappe <zooey@hirschkaefer.de>

[ should have been part of last commit ]
more work concerning navigation within BTextView:
* pressing HOME on last line works again
* made public versions of LineAt() do what is required to pass back the
correct value even for the last line of the buffer (original implementation
has been moved to private _LineAt())
* PAGE_UP/PAGE_DOWN now moves the view by the bounds-height, making the
behaviour somewhat less confusing (IMHO, please shout if that's not
acceptable for you)

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


# 200da6828fde5c007be093a458752137ca8a5626 07-Apr-2009 Oliver Tappe <zooey@hirschkaefer.de>

* implemented wordwise navigation via control + arrow keys
* renamed _FindXXXWordBoundary() methods to _Previous/_NextWordBoundary()
since the respective per-char methods are named this way
* started to work on improving the behaviour of page-up/page-down

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


# 3f3ab1625c45e1d58ea1b5443343a91d381e1e0c 07-Apr-2009 Oliver Tappe <zooey@hirschkaefer.de>

continued work on BTextView:
* reverted my recent change that caused Mail to always show the end
of mails 8-) and now invoke ScrollToOffset() wherever it was missing
(mostly in keyboard-related methods)
* _DoInsertText() only moves the caret if the text has been inserted
in front of the caret, not after it
* overhauled selection by char/word/line and their extension mechanism
(which now behaves as the haiku shell)
* use strnlen() instead of strlen() in those versions of Insert() which
accept a length parameter, as strlen can potentially waste a lot of
cycles skipping the whole string, when all we want is to clamp the length.
* cleanup (some of it automatic removal of trailing whitespace)

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


# 4e50f1ae68edb5d53d853a28325f004d23a6811b 06-Apr-2009 Oliver Tappe <zooey@hirschkaefer.de>

* Instead of invoking _DrawLines out of the app-server drawing context,
we request the drawing via Invalidate() - this make use of the app-server's
potential double buffering, whenever that is active. This change reduces
flickering in VESA mode considerably.

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


# b545073f089282445eaf00a96e2b8f4699079c84 06-Nov-2008 Stephan Aßmus <superstippi@gmx.de>

* Moved the global BPrivate::WidthBuffer from BTextView into BPrivate as
gWidthBuffer.
* Tracker PoseView now uses BPrivate::gWidthBuffer instead of it's own
instance.
* TextView.h and PoseView.h are now a little cleaner.
* InterfaceDefs.cpp now deletes gWidthBuffer in _fini_interface_kit_().
* Added binary compatibility support for NetPositive in WidthBuffer.h and .cpp.
Obviously it kind of defeats the purpose of having WidthBuffer neatly tucked
away in the BPrivate namespace, but Haiku should run NetPositive, I guess.
Fixes #2879.


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


# 9e163a7a93c4237b659bf8411513a48351ee60d3 21-Oct-2008 Axel Dörfler <axeld@pinc-software.de>

* Made BScrollView work when using it with the layout system.
* Added a layout friendly constructor - it's not so nice to use, though, since
the original one already doesn't get a BRect (we just don't need the
resizing mode, and have to set the B_SUPPORTS_LAYOUT flag).
* Refactored size/frame computation a bit.
* Cleanup.


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


# 90b7764dc354ff1bcb01abf78dafe16faa820725 21-Sep-2008 Rene Gollent <anevilyak@gmail.com>

Move WidthBuffer and TextGapBuffer into BPrivate and use them from there in BPoseView and BTextView. This (correctly) fixes the previous gcc4 build issues.



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


# 40ca6c57eee4bc410f779211e31dc68434ba8697 21-Sep-2008 Rene Gollent <anevilyak@gmail.com>

Declare BPoseView as a friend of BTextView. This allows it to use the private width buffer classes, and fixes the gcc4 build.


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


# 8864334702e9e50713e6cf50e606d072e145c3b6 21-Sep-2008 Stephan Aßmus <superstippi@gmx.de>

* First steps towards making BTextView behave well within the layout management.
* The class calculates a minimum width now, which is based on the line height,
this may also fix the bug with the small text inputs in the Pe Find window.
* Added TODOs about implementing GetHeightForWidth(), which may be a good idea
when a BTextView is used as non-editable informative text in an interface,
and one wants to make sure that the entire text is shown.
* Replaced the call to _Refresh() in Draw(), which recalculates all the line
breaks for no reason with _DrawLines() again. The TODO mentioned that text
will be drawn without drawing the background first, but maybe this is a
relict from times where Draw() was invoked directly? At least I cannot see
any negative consequences, and this should be much more efficient.
(Other than that, this patch should hopefully have no potential negative
side effects...<crosses fingers>)


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


# e6378518c46eddcf6bf223630f3891979743aac0 21-Sep-2008 Stephan Aßmus <superstippi@gmx.de>

Fixed typo.


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


# 6168332c3507ece9ce5fac75819758fa6551d327 21-Sep-2008 Stephan Aßmus <superstippi@gmx.de>

Sorry, should have been part of r27660. Moved BTextView::UndoBuffer derivatives
into BTextView class as well, hopefully fixing the GCC4 build.


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


# a682d9819fae1e26cef1390bb33b5d5c73304642 20-Sep-2008 Stephan Aßmus <superstippi@gmx.de>

Quite a cleanup action to avoid polluting the global namespace with private
BTextView classes:

* Declared the directly used BTextView helper classes as private BTextView
classes and changed all affected files.
* Realized that Tracker's BPoseView was (accidentally?) using what used to
be _BWidthBuffer_. It had declared it's own class with the same name and
same members/size in headers/private/tracker/TextViewSupport.h, but the
implementation was nowhere to be found. I can only explain this that
the BTextView implementation was then actually linked and used. But the big
problem was that it was used without locking (unlike in BTextView)! When
many Tracker windows opened during system startup or later and they happened
to each request characters not yet in the cache, I imagine things could have
gone bad and corrupted memory. Anyways, since I can see the usefulness of
the cache, BPoseView uses BTextView::WidthBuffer on purpose now. And I moved
the locking inside BTextView::WidthBuffer::StringWidth().
* Adjusted InterfaceDefs.cpp accordingly.
* TODO: Move subsequent classes into BTextView namespace as well, ie derived
classes that BTextView doesn't directly know about. All stuff in src/kits/
inteface/textview_support/
* Added preliminary and not yet implemented layout friendly BTextView
constructors.
* I will try to handle the insets imposed by BTextView::fTextRect a bit
differently when used inside the new layout management framework. For this,
I added BTextView::SetInsets() and GetInsets(). SetInsets() doesn't do
anything yet.

So far, everything seems to work still... ;-)


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


# 37b9874302c933c7e742caa2e760486a16eca237 20-Sep-2008 Stephan Aßmus <superstippi@gmx.de>

Update header indentation style.


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


# 46ea5b1e49005fa48c79898fb3ad9f8f28476b52 25-Feb-2008 Stephan Aßmus <superstippi@gmx.de>

Further improvements to auto scrolling and text rect + container view resizing:
* Renaming things in Tracker list mode no longer magically grows the text view.
* ScrollToOffset() is not supposed to depend on the existence of any scroll
bars, in R5 text views simply scroll to where they need to. This fixes
renaming things in Tracker when hitting the window bounds (text widget stops
growing and starts to autoscroll) and also the Text tool in WonderBrush.
* _ScrollToOffset() is therefor no longer needed.
* The insets of the text rect are not so interesting as the original width.
In auto resizing mode, the original width is important when there is no
container view. In this setup, the text rect auto resizing is mainly needed
for auto scrolling, but it should never shrink below the original size.
* Further improved auto scrolling for right aligned and center aligned text
views, it works like R5 now. Also take the line height into account when
checking for the bounds bottom. Removed extra spacing for vertical
scrolling.


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


# b8872c02c1d02d892037bcdb6cbbb3dfe482b98b 24-Feb-2008 Stephan Aßmus <superstippi@gmx.de>

BTextControl:
* Placed _BTextInput_ into BPrivate namespace.
* Made _BTextInput_::AlignTextRect() smarter, it centers the line vertically,
for the case that the BTextControl has a larger label font. Improved insets
for asthetics.
* Used _BTextInput_::AlignTextRect() consistently in BTextControl, no more
custom calls to SetTextRect(). Account for minimum vertical inset of 2
pixels in GetPreferredSize().
* Consistendly select all text when gaining focus in _BTextInput_.
* Override MouseDown() in case the control did not have focus before, or else
BTextView::MouseDown() will deselct the text again and place the cursor.
(in line with BeOS behavior)
* Removed unused fBool member from _BTextInput_ and other cleanup.

BTextView:
* Reimplemented BTextView::_AutoResize() so that it works well with
BTextControl and autoscrolling when the alignment is not B_ALIGN_LEFT.
I needed two new members for this, fLeftInset and fRightInset which are
the original insets from the fTextRects. It might currently be broken
for renaming things in Tracker, I will have to check. _AutoResize() no
longer messes up the fTextRect insets.
* Fixed stray carrets sometimes being left over, mostly when auto scrolling,
but I observed them in other cases as well.
* Prevent negative scrolling offsets when autoscrolling. Fixes weird scrolling
offsets when navigating to the left.
* Reset scrolling to B_ORIGIN when SetText() is called. Fixes for example
starting to type in the middle of the control in Vision when entering new
text and autoscrolling was triggered before.



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


# 13ca2d942d44c4d9952c1fa35bd91baf640ea269 23-Oct-2007 Axel Dörfler <axeld@pinc-software.de>

Patch by Vasilis Kaoutsis - thanks!:
* Rewrote TextView.h
* Renamed all private methods to have the underscore prefix.
And also:
* Whitespace and line width cleanup.


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


# f6e4cbb95290a74b33d012600438b84742b0e572 15-Oct-2007 Axel Dörfler <axeld@pinc-software.de>

* Rewrote BeBuild.h which had "a few" consequences (got rid of all those class
definitions).
* Minor cleanup here and there.


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


# c0441727047d13b662eef26bff0f2b02786fe2ac 08-Oct-2007 Stefano Ceccherini <stefano.ceccherini@gmail.com>

I was wrong after all. InsertText() doesn't call SetRunArray() (and
hence CancelInputMethod()), but it implements part of it. To avoid code
duplication, I added a private _SetRunArray() call, which does most of
the work, except cancelling the input method, and calling Refresh().
Removed some unneeded code from CancelInputMethod(), some small changes
in HandleInputMethodChanged.
-Questa linea, e quelle sotto di essa, saranno ignorate--

M src/kits/interface/TextView.cpp
M headers/os/interface/TextView.h


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


# f2476bcc9c193632711781727a96a3222ee1df05 04-Oct-2007 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Patch by Rene Gollent: TextViews now can scroll even if they aren't
attached to a BScrollView.


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


# 99584ef9a27169930f363f873a72c9afbdb3c2af 04-Jul-2007 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Added _Show/_HideCaret() and used them in place of more bug-prone code.


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


# f96bec013d4bf86e8ed4a3906da19daf901457cc 30-Apr-2007 Stefano Ceccherini <stefano.ceccherini@gmail.com>

small cleanups. Moved some code into a _DrawLine() method.


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


# 25df172b722bb7e9c703dcdc31370499255f88c6 04-Jan-2007 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Implemented auto horizontal scrolling (by fixed steps for now), moved
auto scrolling to its own method, introduced a new private
StyledWidthUTF8Safe method.



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


# e333843348e800ae9dddeb8af5d567d172e87185 03-Feb-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Added Alloc/Copy/FreeRunArray() as Axel's suggestion, and used it internally in TextView. Also fixed small memory leak

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


# d601f6e882f8e3cd41590c31ad5ac66c1c9e1373 11-Nov-2004 shatty <shatty@nowhere.fake>

rename RecalLineBreaks to RecalculateLineBreaks ; use ceil() when computing the origins for lines


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


# bc1aaab684896b3255219c158e78f4d460580bb9 03-Dec-2002 Ingo Weinhold <ingo_weinhold@gmx.de>

AutoResize() parameter was missing.


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


# d734a8ce5a83e48e17a2d0d6635090d48c5ad161 23-Oct-2002 beveloper <beveloper@nowhere.fake>

some header files to be R5 compatible


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