Commit Graph

32 Commits (7210fb478d8d0c6aa5bb8e0ae3e0fc67dd730874)

Author SHA1 Message Date
NiLuJe 8189945be9
A few graphics fixes after #4541 (#4554)
* Various FocusManager related tweaks to limit its usage to devices with a DPad, and prevent initial button highlights in Dialogs on devices where it makes no sense (i.e., those without a DPad. And even on DPad devices, I'm not even sure how we'd go about making one of those pop up anyway, because no Touch ;)!).
* One mysterious fix to text-only Buttons so that the flash_ui highlight always works, and always honors `FrameContainer`'s pill shape. (Before that, an unhighlight on a text button with a callback that didn't repaint anything [say, the find first/find last buttons in the Reader's search bar when you're already on the first/last match] would do a square black highlight, and a white pill-shaped unhighlight (leaving the black corners visible)).
The workaround makes *absolutely* no sense to me (as `self[1] -> self.frame`, AFAICT), but it works, and ensures all highlights/unhighlights are pill-shaped, so at least we're not doing maths for rounded corners for nothing ;).
5 years ago
poire-z adceda15b7
TextEditor: allow scrolling by lines with Pan (#4145)
Feature of ScrollTextWidget, only used for now by TextEditor.
Pan is like Swipe, but wait a bit at end of gesture to release:
the line on which Pan was started will be moved to where Pan is
released.

May conflict with MovableContainer (so not enabled for DictQuickLookup,
where it could have been nice - but it would work only with text
dictionaries, not with HTML ones, as ScrollHtmlWidget can't really
do that).
6 years ago
poire-z 6e35e683dd
Text editor plugin, InputDialog enhancements (#4135)
This plugin mostly sets up a "Text editor>" submenu, that allows
browsing files, creating a new file, and managing a history of
previously opened file for easier re-opening.
It restore previous scroll and cursor positions on re-opening.
Additional "Check lua" syntax button is added when editing
a .lua file, and prevent saving if errors.
The text editing is mainly provided by the enhanced InputDialog.

InputDialog: added a few more options, the main one being
'save_callback', which will add a Save and Close buttons
and manage saving/discarding/exiting.
If "fullscreen" and "add_nav_bar", will add a show/hide keyboard
button to it.
Moved the preset buttons setup code in their own InputDialog
methods for clarity of the main init code.
Buttons are now enabled/disabled depending on context for feedback
(eg: Save is disabled as long as text has not been modified).

Added util.checkLuaSyntax(lua_string), might be useful elsewhere.
6 years ago
NiLuJe fea0d8dbaf
Another set of fixes (#4083)
* Make findcalibre actually useful

By setting SEARCH_LIBRARY_PATH when a Calibre tree is found, so that
book paths can properly be constructed.

Users should still very much set it themselves, but at least everything
works as intended when not, instead of mysteriously half-breaking later.

Drop the SetDefaults bits, it appeared to have been added to fix no-ops
detected by Luacheck, and it's actually non-functional, because
SetDefaults doesn't handle saving variables it did not itself assign.
So this was just causing the "Do you want to save new defaults" popup to
show up on exit, but it couldn't actually do anything useful (like, say,
save the new SEARCH_LIBRARY_PATH value).

fix #4082

* Better comments about the state of NaturalLight on the Clara, and how this might translate to the H2O²r2.

re #4015

* Make ScrolltextWidget refresh as "partial" only on actual Scroll events

Moving the cursor should stay "ui", or things gets annoying really fast
;).

re #4084

* Bump base to pickup ZMQ fixes (fix #4086)
6 years ago
poire-z 0d66ea7555
Text input fixes and enhancements (#4084)
InputText, ScrollTextWidget, TextBoxWidget:
- proper line scrolling when moving cursor or inserting/deleting text
  to behave like most text editors do
- fix cursor navigation, optimize refreshes when moving only the cursor,
  don't recreate the textwidget when moving cursor up/down
- optimize refresh areas, stick to "ui" to avoid a "partial" black
  flash every 6 appended or deleted chars

InputText:
- fix issue when toggling Show password multiple times
- new option: InputText.cursor_at_end (default: true)
- if no InputText.height provided, measure the text widget height
  that we would start with, and use a ScrollTextWidget with that
  fixed height, so widget does not overflow container if we extend
  the text and increase the number of lines
- as we are using "ui" refreshes while text editing, allows refreshing
  the InputText with a diagonal swipe on it (actually, refresh the
  whole screen, which allows refreshing the keyboard too if needed)

ScrollTextWidget:
- properly align scrollbar with its TextBoxWidget

TextBoxWidget:
- some cleanup (added new properties to avoid many method calls), added
  proxy methods for upper widgets to get them
- reordered/renamed/refactored the *CharPos* methods for easier reading
  (sorry for the diff that won't help reviewing, but that was needed)

InputDialog:
- new options:
   allow_newline = false, -- allow entering new lines
   cursor_at_end = true, -- starts with cursor at end of text, ready to append
   fullscreen = false, -- adjust to full screen minus keyboard
   condensed = false, -- true will prevent adding air and balance between elements
   add_scroll_buttons = false, -- add scroll Up/Down buttons to first row of buttons
   add_nav_bar = false, -- append a row of page navigation buttons
- find the most adequate text height, when none provided or fullscreen, to
  not overflow screen (and not be stuck with Cancel/Save buttons hidden)
- had to disable the use of a MovableContainer (many issues like becoming
  transparent when a PathChooser comes in front, Hold to paste from
  clipboard, moving the InputDialog under the keyboard and getting stuck...)

GestureRange: fix possible crash (when event processed after widget
destruction ?)

LoginDialog: fix some ui stack increase and possible crash when switching
focus many times.
6 years ago
Frode Austvik 2dc508537c [fix] Update charpos in InputText after moving the cursor up/down. (#3874) 6 years ago
Frode Austvik f36d93a8f7 [Fix] Make ScrollTextWidget:moveCursor return the new charpos. (#3808) 6 years ago
poire-z b0f0e839fb [UX] Dict: scroll back with tap: go to bottom of prev definition (#3647) 6 years ago
poire-z 43ad2cef99 TextBoxWidget: optionally display a list of images
(each one at top right of each page)
Such images can be loaded dynamically when the display of a page requires it.
Allow alternating between the image and its title with Tap on it.
Allow for viewing this image zoomed in ImageViewer with Hold on it.

DictQuickLookup: add generic support for result.images, that
could optionally be provided in Wikipedia lookup results.
6 years ago
Frans de Jonge 9eb073a524 [travis] Add protection against unscaled sizes
As pointed out by @poire-z

* [fix, UX] SkimToWidget scaling

* [fix] Button scaling

* [fix, UX] Scale ProgressWidget

* [fix, UX] Scale confirmbox

* [fix, UX] Scale just about everything
7 years ago
Hzj_jie 339e16636b Terminal plugin (#2646) 7 years ago
poire-z ebe0c08bfb dict/wiki: definitions' text justification
This can be disabled by adding ["dict_justify"] = false to settings.reader.lua
7 years ago
poire-z 5040bfe4c5 textboxwidget and scrolltextwidget enhancements (#2393)
util: made isSplitable() accept an optional next_char
for wiser decision

textboxwidget: speed up rendering, enhanced text wrapping,
allow selection of multiple words with Hold.

scrolltextwidget: allow scrolling with Tap.

Details in #2393
8 years ago
Qingping Hou 086dbdb657 scrolltextwidget(fix): add moveCursor method 8 years ago
chrox 6b43233c4a fix #2092
And fix several other bugs introduced in #2028:
1. hint messages are back instead of the "Demo hint"
2. cursor now only presents in the focused inputbox in a multiinput dialog
3. moving cursor now works in multiinput dialog
8 years ago
union2find a7f24b6eaf fix function util.splitToChars in frontend/util.lua 8 years ago
union2find f8943efdbf fix indent sytle 8 years ago
union2find 3d89b27e59 remove debug output 8 years ago
union2find 9ea56827dc resolve conflict on frontend/ui/widget/scrolltextwidget.lua 8 years ago
Qingping Hou 2bcc3671c5 scrolltextwideget(fix): listen to page fwd/bck events 8 years ago
union2find d6fcc9adf9 add cursor functionality 8 years ago
Hans-Werner Hilse 82c26b1f18 adapt widgets to new refresh/repaint API 10 years ago
Hans-Werner Hilse 22697adf20 switch from scaleByDPI() to scaleBySize() 10 years ago
NiLuJe 1ee09010c4 Make ScrollTextWidget updates regional
Because I like breaking stuff in fun & interesting ways :D
10 years ago
Hans-Werner Hilse 3066c86e38 Refactoring hardware abstraction
This is a major overhaul of the hardware abstraction layer.
A few notes:

General platform distinction happens in
  frontend/device.lua
which will delegate everything else to
  frontend/device/<platform_name>/device.lua
which should extend
  frontend/device/generic/device.lua

Screen handling is implemented in
  frontend/device/screen.lua
which includes the *functionality* to support device specifics.
Actually setting up the device specific functionality, however,
is done in the device specific setup code in the relevant
device.lua file.

The same goes for input handling.
10 years ago
Hans-Werner Hilse 5982e24d57 unify color specification
colors were a mixture of 4bpp integers (0=white, 15=black) and
fractional blackness levels (0=white, 1.0=black) before. This is
now unified to use the color specification of the Blitbuffer API.
10 years ago
Hans-Werner Hilse 7b1777e095 adapt widgets and text rendering to new font rendering
no background for text rendering anymore
10 years ago
chrox 82b458102a swipe east/west to switch dictionary in dict quick lookup window 10 years ago
chrox 92219a1f1e cleanup: expand tab to 4 spaces 10 years ago
chrox 4cfdce6105 fix several local calls of Math.round 11 years ago
HW 2154e7e852 Further refactoring
This should finish the work to make all globals to local variables.
That allows LuaJIT to properly compile things by interning the
references to the relevant parts (rather than looking up globals
all the time which stops a trace).
11 years ago
HW ef111b99c6 Refactored to use strictly locals 11 years ago