History log of /haiku/src/preferences/screensaver/PreviewView.cpp
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>


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


# f0650dc9 09-Dec-2015 looncraz <looncraz@looncraz.net>

preferences: Convert to using Set*UIColor.

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
Patches 0023-0037 from looncraz, unmodified.


# 268e4ea2 14-Sep-2015 Axel Dörfler <axeld@pinc-software.de>

ScreenSaver: Make preview relative to font size.

* This commit got somehow eaten by git rebase :-/


# 4ddea1f8 22-Aug-2014 Adrien Destugues <pulkomandy@pulkomandy.tk>

ScreenSaver: rework some of the fixes

* Use a BTextView for the "no preview" text again, as Skipp_OSX pointed
this allows it to word wrap as needed with any font bigger than 10pt.
* Show a black screen rather than the "no preview" text for Darkness and
when a screensaver fails to load. This matches what screen_blanker will
do.


# a1d09c79 14-Aug-2014 Adrien Destugues <pulkomandy@pulkomandy.tk>

make PreviewView smaller.

The 160x120 preview size is a bad choice, because it makes XRoger crash
in an infinite recursion when trying to draw bezier arcs with custom
code (instead of using the BeAPI for that).

Use 120x90, just like BeOS, to maximise compatibility and avoid such
problems.

Fixes #10601.


# 9bac05ae 13-Aug-2014 Adrien Destugues <pulkomandy@pulkomandy.tk>

Make the "no preview" screen work in all cases

* HideNoPreview() was never called...
* Use a BCardLayout to make it easier to know which of the two screens
is shown.


# 61346881 14-Aug-2014 Adrien Destugues <pulkomandy@pulkomandy.tk>

Convert PreviewView to layout kit

* Use a BGroupLayout with insets to make space for the monitor drawing
* Don't put the "no preview available" inside the view passed to
screensavers, this could confuse them
* Have the actual preview area (not including borders) be 160x120


# 8cdefee9 26-Feb-2014 John Scipione <jscipione@gmail.com>

ScreenSaver: fix gcc4 x86 and x86_64 builds

Create a static const variable to take the address of instead of
taking the addess of a temporary.


# 58b592b3 26-Feb-2014 John Scipione <jscipione@gmail.com>

ScreenSaver: Add "No preview available" text

... when a screensaver doesn't provide a preview.

Also do a bit of refactoring in PreviewView, remove unneeded includes


# ada2a0a1 23-Feb-2014 John Scipione <jscipione@gmail.com>

Screensaver: Small style fixes to PreviewView


# be888b3a 14-Nov-2013 John Scipione <jscipione@gmail.com>

PreviewView: Add SaverView() method


# 390e3154 14-Nov-2013 John Scipione <jscipione@gmail.com>

ScreenSaver PreviewView code cleanup.

Eliminate Constants.h, set View color and low color black initially

Move AddPreview and Remove Preview to bottom


# 28a2faa3 04-Sep-2013 John Scipione <jscipione@gmail.com>

ScreenSaver: use ceilf instead of ceil

... to restrict to single float precision. This is a little pedantic and silly
but bare with me for the sake of consistency.


# 58aaae82 02-Sep-2013 John Scipione <jscipione@gmail.com>

ScreenSaver: Correct typo

Should be Copyright 2013 not 20013


# 709172a0 02-Sep-2013 John Scipione <jscipione@gmail.com>

ScreenSaver: Convert to layout APIs

This allows the ScreenSaver window grow and shrink based on your
font size and translations.

Minimum is 446 px x 325 px so that there is enough space to accommodate
screen savers designed for BeOS.

Should fix #7369 and help #7332 a bit.

Margins go right to the edge now which prevents the tab view from looking
as liney.

Password window has also been converted to use the layout APIs, also,
the window now pops up in the center of the main ScreenSaver window.

The fade translations will have to be redone unfortunately, but it should be
easy as it is the concatenation of the previous strings.


# 23ca081a 02-Sep-2013 John Scipione <jscipione@gmail.com>

ScreenSaver: Style fixes

Update Copyright year and fix authors adding myself.
Mostly spacing and indentation fixes.


# 7269cc8a 06-Jun-2010 Jérôme Duval <korli@users.berlios.de>

* sets fSaverView in RemovePreview() to NULL, thus avoiding a crash in ModulesView::_CloseSaver().


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


# 9bf8dbc8 06-Jun-2006 Axel Dörfler <axeld@pinc-software.de>

* First baby steps to a font sensitive GUI. The window now adapts its size
to the demands of the screen saver settings.
* At least temporarily, the window is also resizable; we'll see how well
that turns out.
* The PreviewView did not have a black border around the preview.
* You can now switch again from Blackness to another saver directly...
* The turn off screen timeout is stored relative to the blanking time.
* The list now scrolls to the selection whenever the tab is shown.


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


# 7cae4a1e 06-Jun-2006 Axel Dörfler <axeld@pinc-software.de>

* Big time cleanup of the screen saver stuff, not yet finished yet, though.
Renamed lots of things, like ScreenSaverThread to ScreenSaverRunner,
refactored code, etc. Much cleaner interfaces and code.
* Fixed a couple of bugs and in the add-on handling, especially some settings
related bugs (ie. testing a screen saver will now use its latest settings,
etc.).
* Correctly implemented DPMS support in ScreenSaverPrefs and the ScreenSaver
preferences application - screen_blanker still ignores them, though.
* It's not yet font sensitive either.
* Changed the input_server add-on to not switch to the screen blanker immediately
when it's in the "blank corner" - doesn't seem to work yet, though (only tested
under Qemu).
* Correctly implemented the "preview" function (before, a screen saver would
never know it rendered a preview).
* Evaluates the return value of BScreenSaver::StartSaver().
* The screen saver thread is no longer killed without notice - it's now
always shut down properly.
* Made the code more robust against failure.
* Introduced some new bugs as well (the screen saver list view doesn't jump to
the selection anymore, for some reason), those will be fixed later (as the
remaining issues).
* Probably some more I forgot about.


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


# 12e1daa3 24-Aug-2005 Jérôme Duval <korli@users.berlios.de>

copyright update


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


# 1437c09c 31-Jul-2005 Jérôme Duval <korli@users.berlios.de>

screen_blanker signature is at one place
modules tab selection makes the right module selected


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


# 66dee31a 26-Jul-2005 Jérôme Duval <korli@users.berlios.de>

clean up, style change, unused files are removed
added ScreenSaver.cpp to ScreenSaver preferences to have Matrix working


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


# a10cf76e 24-Jun-2005 Axel Dörfler <axeld@pinc-software.de>

Renamed src/prefs to "preferences", as the directory is usually called in BeOS.


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


# 268e4ea27d3a8dfbdf34252c50cc1af59840fa4b 14-Sep-2015 Axel Dörfler <axeld@pinc-software.de>

ScreenSaver: Make preview relative to font size.

* This commit got somehow eaten by git rebase :-/


# 4ddea1f86264f27062a11f3f08473d2bceb3c23e 22-Aug-2014 Adrien Destugues <pulkomandy@pulkomandy.tk>

ScreenSaver: rework some of the fixes

* Use a BTextView for the "no preview" text again, as Skipp_OSX pointed
this allows it to word wrap as needed with any font bigger than 10pt.
* Show a black screen rather than the "no preview" text for Darkness and
when a screensaver fails to load. This matches what screen_blanker will
do.


# a1d09c7936462276dfb9218197e9a0747476507a 14-Aug-2014 Adrien Destugues <pulkomandy@pulkomandy.tk>

make PreviewView smaller.

The 160x120 preview size is a bad choice, because it makes XRoger crash
in an infinite recursion when trying to draw bezier arcs with custom
code (instead of using the BeAPI for that).

Use 120x90, just like BeOS, to maximise compatibility and avoid such
problems.

Fixes #10601.


# 9bac05ae6cce56d06edcdc28036bf104af7ca2a3 13-Aug-2014 Adrien Destugues <pulkomandy@pulkomandy.tk>

Make the "no preview" screen work in all cases

* HideNoPreview() was never called...
* Use a BCardLayout to make it easier to know which of the two screens
is shown.


# 613468813b53f9dbc0d8b7b41276f517789f07ee 14-Aug-2014 Adrien Destugues <pulkomandy@pulkomandy.tk>

Convert PreviewView to layout kit

* Use a BGroupLayout with insets to make space for the monitor drawing
* Don't put the "no preview available" inside the view passed to
screensavers, this could confuse them
* Have the actual preview area (not including borders) be 160x120


# 8cdefee93f28b56f2a7790464eeea52cc246988c 26-Feb-2014 John Scipione <jscipione@gmail.com>

ScreenSaver: fix gcc4 x86 and x86_64 builds

Create a static const variable to take the address of instead of
taking the addess of a temporary.


# 58b592b3b5dd2e4031f12279867cb0a20855d377 26-Feb-2014 John Scipione <jscipione@gmail.com>

ScreenSaver: Add "No preview available" text

... when a screensaver doesn't provide a preview.

Also do a bit of refactoring in PreviewView, remove unneeded includes


# ada2a0a1eff67cac1a6f98d72a51ef4433d72d3b 23-Feb-2014 John Scipione <jscipione@gmail.com>

Screensaver: Small style fixes to PreviewView


# be888b3a49cc68f4a0c7e38251ba6514d48a7fc1 14-Nov-2013 John Scipione <jscipione@gmail.com>

PreviewView: Add SaverView() method


# 390e3154c2056d9458a4a0c231f2ca961f2ddb39 14-Nov-2013 John Scipione <jscipione@gmail.com>

ScreenSaver PreviewView code cleanup.

Eliminate Constants.h, set View color and low color black initially

Move AddPreview and Remove Preview to bottom


# 28a2faa30af39fd8ea31870d71f690cae8998f18 04-Sep-2013 John Scipione <jscipione@gmail.com>

ScreenSaver: use ceilf instead of ceil

... to restrict to single float precision. This is a little pedantic and silly
but bare with me for the sake of consistency.


# 58aaae827b974a64221da3c2eca331600fa60c18 02-Sep-2013 John Scipione <jscipione@gmail.com>

ScreenSaver: Correct typo

Should be Copyright 2013 not 20013


# 709172a02dc508c50435ab891ed4d11c7323fe47 02-Sep-2013 John Scipione <jscipione@gmail.com>

ScreenSaver: Convert to layout APIs

This allows the ScreenSaver window grow and shrink based on your
font size and translations.

Minimum is 446 px x 325 px so that there is enough space to accommodate
screen savers designed for BeOS.

Should fix #7369 and help #7332 a bit.

Margins go right to the edge now which prevents the tab view from looking
as liney.

Password window has also been converted to use the layout APIs, also,
the window now pops up in the center of the main ScreenSaver window.

The fade translations will have to be redone unfortunately, but it should be
easy as it is the concatenation of the previous strings.


# 23ca081a2fdb4375b4a60e7dd28d1e07029aae5c 02-Sep-2013 John Scipione <jscipione@gmail.com>

ScreenSaver: Style fixes

Update Copyright year and fix authors adding myself.
Mostly spacing and indentation fixes.


# 7269cc8afd5ccaa5383e3908a9c87b935b038d06 06-Jun-2010 Jérôme Duval <korli@users.berlios.de>

* sets fSaverView in RemovePreview() to NULL, thus avoiding a crash in ModulesView::_CloseSaver().


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


# 9bf8dbc8290a520b6f7c09ec2c93e4f9a746ab8a 06-Jun-2006 Axel Dörfler <axeld@pinc-software.de>

* First baby steps to a font sensitive GUI. The window now adapts its size
to the demands of the screen saver settings.
* At least temporarily, the window is also resizable; we'll see how well
that turns out.
* The PreviewView did not have a black border around the preview.
* You can now switch again from Blackness to another saver directly...
* The turn off screen timeout is stored relative to the blanking time.
* The list now scrolls to the selection whenever the tab is shown.


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


# 7cae4a1ee0a7e8f1214e6fa410efe9f5a0c7cecb 06-Jun-2006 Axel Dörfler <axeld@pinc-software.de>

* Big time cleanup of the screen saver stuff, not yet finished yet, though.
Renamed lots of things, like ScreenSaverThread to ScreenSaverRunner,
refactored code, etc. Much cleaner interfaces and code.
* Fixed a couple of bugs and in the add-on handling, especially some settings
related bugs (ie. testing a screen saver will now use its latest settings,
etc.).
* Correctly implemented DPMS support in ScreenSaverPrefs and the ScreenSaver
preferences application - screen_blanker still ignores them, though.
* It's not yet font sensitive either.
* Changed the input_server add-on to not switch to the screen blanker immediately
when it's in the "blank corner" - doesn't seem to work yet, though (only tested
under Qemu).
* Correctly implemented the "preview" function (before, a screen saver would
never know it rendered a preview).
* Evaluates the return value of BScreenSaver::StartSaver().
* The screen saver thread is no longer killed without notice - it's now
always shut down properly.
* Made the code more robust against failure.
* Introduced some new bugs as well (the screen saver list view doesn't jump to
the selection anymore, for some reason), those will be fixed later (as the
remaining issues).
* Probably some more I forgot about.


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


# 12e1daa3ccb72c770d1da51d9b4eb765b4c7d143 24-Aug-2005 Jérôme Duval <korli@users.berlios.de>

copyright update


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


# 1437c09cb727368f7808a087b35fc0454d6ae5e4 31-Jul-2005 Jérôme Duval <korli@users.berlios.de>

screen_blanker signature is at one place
modules tab selection makes the right module selected


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


# 66dee31a87a5ff18862fa2ae1ba17544585c5dad 26-Jul-2005 Jérôme Duval <korli@users.berlios.de>

clean up, style change, unused files are removed
added ScreenSaver.cpp to ScreenSaver preferences to have Matrix working


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


# a10cf76ef5b9e8c726ebc47183abd6943023cf8f 24-Jun-2005 Axel Dörfler <axeld@pinc-software.de>

Renamed src/prefs to "preferences", as the directory is usually called in BeOS.


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