buggins / coolreader

Official site of CoolReader project. Sourceforge repository is obsolete.
GNU General Public License v2.0
387 stars 101 forks source link

top+bottom margins ignored in scroll view #326

Open teleshoes opened 2 years ago

teleshoes commented 2 years ago

top+bottom margin works in page-view-mode only. the values have no effect in scroll-view-mode. left+right margins work in both page-view and scroll-view.

teleshoes commented 2 years ago

use cases: 1) i set bottom margin = 150px to not paint words underneath the android nav bar <| o [] (pops up annoyingly on waydroid) 2) its also comfortable to hold my phone in such a way that my thumb covers the bottom 100px of my phone, especially in auto-scroll mode 3) separate issue, but this would ALSO provide a decent workaround for the problem of tts-readaloud toolbar covering the bottom 400px of the screen

teleshoes commented 2 years ago

i would also REALLY love to have the topbar with the clock+battery displayed in scroll-view-mode..

teleshoes commented 2 years ago

@plotn do you have any idea how this could be done? does knownreader by any chance have this feature?

plotn commented 2 years ago

@teleshoes, the scroll mode is seldom used (by community), as far as I know (but some people like). I even did (in KR) the ability "not to switch (internally) in scroll mode while TTS is active". Anyway, you can open issue in KR's repo - I will see if it could be done "not so expensive", but I dont promise the speed (And I have plans to redesign TTS toolbar too, but it is also a big work (I want to make it similar to "common" toolbar). Nowadays I am working to support external USB / SD card in modern androids, then to evolve offline dics (Lingvo DSL, StarDict, MDict), integrate Calibre Library and so on... )

PS: regardless all issues in KR repo are in russian you can freely create your own in english, of course.

teleshoes commented 2 years ago

ok, im trying that out right now, thanks! i assumed that TTS wouldnt work in page mode

edit: hooray! works great. only problem is that it is more reluctant to turn a page than it is to scroll a little, so the current sentence goes off the end of the page every time instead of half the time. i gotta look into the impl of moveSelection()

plotn commented 2 years ago

I've caught your idea, but, be ready - it quite comlex "underneath" )

teleshoes commented 2 years ago

yea, i still see more words of the current selection in scroll-mode, even with the horrible tts toolbar covering 400px of my screen and the android nav-panel refusing to disappear in TTS mode.

my next idea is that i can tweak onSelectionCommand() to do SetPos() if the current selection enters the part of the screen that the toolbar covers

EDIT: yea, this worked great:

    int h = m_pageRects[0].height() - m_pageMargins.top
            - m_pageMargins.bottom - getPageHeaderHeight() - 400;
teleshoes commented 2 years ago

it SEEMS like it should be easy to add top+bottom margins to scroll-mode, but i havent been able to do it, and the ui-related code in crengine is scary..

plotn commented 2 years ago

Why ever you need to see the text, while you are listening to it? In KR you can set transparent tts panel and transparent buttons onto it, thus almost everything become visible, maybe it is enough for you?

teleshoes commented 2 years ago

TTS mispronounces many words, especially foreign loan words and proper nouns, and it doesnt pause properly for parentheticals/etc, and the voice gets the wrong inflection for sentences when the usage may be ambiguous. i use TTS somewhere between a regular audiobook and an enhanced auto-scroll.

sometimes i am listening to TTS mostly like an audiobook, and only glance at the screen when the robot lady mangles a name (for example, while working or taking a walk). other times, i am mostly reading along, and look away shortly when i need to (for example, to rinse the shampoo out of my hair).

either way, its useful to be able to alternate seamlessly between eyes and ears.

==== i set the bgcolor of the TTS toolbar and all buttons to alpha=0 in coolreader already, but the sliders and buttons still block a word or two. also, now the words make it hard to see the toolbar sliders. in my opinion, it is simply bad design to have a transparent/translucent toolbar overlay over words. the alpha channel just makes both UIs worse.

=> the TTS toolbar should be MUCH smaller, with an optional additional toolbar with volume+speed, and it should be opaque, and it should subtract from the screen height.

better yet, the toolbar could have a button to hide it completely. tapping anywhere, instead of ending TTS, would pause TTS, and show the toolbar.

plotn commented 2 years ago

I finally have such idea:

  1. Clicking outside TTS toolbar will not stop reading;
  2. While reading the first two buttons on the toolbar (if visible) and in the menu (usually center tap) will become "show reading toolbar", "stop tts reading". I think this will be enough.
teleshoes commented 2 years ago

if i understood you, that sounds strictly worse than simply showing the toolbar on tap-anywhere

A) if you want to stop (or pause), you STILL need to click twice B) if you want to change volume/etc, you need to click THREE times instead of only twice

there is no workflow that will have FEWER clicks in your model.

plotn commented 2 years ago

Okay, need more time to think.

what if:

  1. Click outside TTS panel will hide/show the panel, but not stop the reading;
  2. Click on "stop" - will stop completly, hiding tts panel.

???