Option to change page gap in continuous mode#5705
Conversation
page_gap setting on opening a book if it does not exist defaults to 8 -adds page_gap selector to koptoptions.lua, user can select 0, 8, 16, 32 via footer settings -adds :onPageGapUpdate event handler to ReaderView
Frenzie
left a comment
There was a problem hiding this comment.
Reviewable status: 0 of 3 files reviewed, 1 unresolved discussion (waiting on @mustafa-001)
frontend/apps/reader/modules/readerview.lua, line 850 at r1 (raw file):
end function ReaderView:onPageGapUpdate(page_gap)
Shouldn't there be some kind of event emitted after changing these page gap variables?
-explanation on long tap
|
koreader/frontend/ui/data/koptoptions.lua Lines 8 to 11 in bfe9cd8 Changes on this settings forces screen wide refresh, and ReaderView:painttto() draws everything again. Also I didn't quite figure out what to do other than full screen refresh thats already queued :). Any suggestions on proper way of doing this are welcomed. |
|
Yeah, IIRC, kopt settings can force repaints without any specific event because... reasons? :D. |
|
It probably mostly makes sense to just redraw everything after changing a setting… a bit wasteful depending on what it is perhaps but I doubt it's bothersome. So if that's not an issue, it seems fine to me. |
|
Aww, when trying to separate landscape and portrait page gap I just realized they are both calculated from So I'm removing width, moving height to :onreadSettings(), leaving page_gap.color only. koreader/frontend/apps/reader/modules/readerview.lua Lines 52 to 60 in 7fb2db8 |
-page_gap.height defined in :onReadSettings -use Screen:scaleBySize() instead of direct number
| -- properties of the gap drawn between each page in scroll mode: | ||
| page_gap = { | ||
| -- width in pixels (when scrolling horizontally) | ||
| width = Screen:scaleBySize(G_reader_settings:readSetting("page_gap_width") or 8), |
There was a problem hiding this comment.
if you are getting rid of this you should also clean up
koreader/frontend/apps/reader/modules/readerview.lua
Lines 392 to 396 in 7fb2db8
and
does anyone know what scroll_mode is used for, and if it is ever set to horizontal?
There was a problem hiding this comment.
I renamed scroll mode to continuous in the GUI.
There was a problem hiding this comment.
page_scroll is a boolean that holds True in continuous mode, False in page mode. scroll_mode set vertical in ReaderView creation and doesn't change.
There was a problem hiding this comment.
That's part of the same thing, perhaps separated specifically for that vertical vs horizontal thing. I don't know the specific plan behind 63e5e7e
-read kopt_page_gap_height from settings.lua if not exists in docsettings
|
lgtm besides for the typo |
koreader/frontend/ui/widget/configdialog.lua Lines 909 to 913 in c3a0bd4 Part of #4793, with some long discussion trying to understand how that works, that I'd rather not re-read :) I guess that some options are only used by the kopt code, and there's no (or no need for) Lua code to handle some event, as there's no real action - except having kopt do its stuff with the updated settings. For this one (page_gap.height), that's our Lua code that draws the gray line, so it looks allright to have an event and an handler (or we could just re-read the setting each time we draw a page, but no need to bother changing what's here I guess). |
|
frontend/ui/data/koptoptions.lua, line 88 at r6 (raw file):
I'd just use the string here instead of adding it to that strings.lua file. For some reason those strings were globals back in 2013 but separating them from their surroundings just makes translation harder. |
Frenzie
left a comment
There was a problem hiding this comment.
Reviewed 1 of 3 files at r1, 1 of 2 files at r3.
Reviewable status: 2 of 3 files reviewed, 5 unresolved discussions (waiting on @mustafa-001)
|
Is this ready to merge? |
|
If you have no further comments, sure. I haven't tested it. |
Neither did I, but that's what users are for :) I guess the Circle CI build (repeatedly) fails because of the transiflex>weblate move, and this PR base commit is not adapted to the CircleCI updated tests? |
|
Sort of, a minor accident on my part caused the submodule reference to become invalid. My plan was simple, to update Weblate with the latest from Transifex when the time came, the end. I did that, but it turned out Weblate had already attracted a few dozen new translations. So instead of overwriting I had to redo it by merging the two translations, and I semi-accidentally rebased that one commit. I wasn't fully cognizant of the fact that it'd change the commit hash if I just kept it in there. tl;dr Now older commits referencing the submodule as it was can't find their reference. |
The input value should go through Screen:scaleBySize, as in onReadSettings Otherwise, choosing an option from ConfigDialog leads to different results than on document open, as one is scaled, but not the other. Issue extant since the inception of page gap configration, way back in koreader#5705 (The intended and correct behavior if of course to scale this, e.g., the setting is a "koreader flex pixel", not an absolute actual px value ;).
The input value should go through Screen:scaleBySize(), as in onReadSettings Otherwise, choosing an option from ConfigDialog leads to different results than on document open, as one is scaled, but not the other. Issue extant since the inception of page gap configuration, way back in koreader#5705 (The intended and correct behavior if of course to scale this, e.g., the setting is a "koreader flex pixel", not an absolute actual px value ;).
The input value should go through Screen:scaleBySize(), as in onReadSettings Otherwise, choosing an option from ConfigDialog leads to different results than on document open, as one is scaled, but not the other. Issue extant since the inception of page gap configuration, way back in koreader#5705 (The intended and correct behavior if of course to scale this, e.g., the setting is a "koreader flex pixel", not an absolute actual px value ;).
The input value should go through Screen:scaleBySize(), as in onReadSettings Otherwise, choosing an option from ConfigDialog leads to different results than on document open, as one is scaled, but not the other. Issue extant since the inception of page gap configuration, way back in #5705 (The intended and correct behavior if of course to scale this, e.g., the setting is a "koreader flex pixel", not an absolute actual px value ;).
The input value should go through Screen:scaleBySize(), as in onReadSettings Otherwise, choosing an option from ConfigDialog leads to different results than on document open, as one is scaled, but not the other. Issue extant since the inception of page gap configuration, way back in koreader#5705 (The intended and correct behavior if of course to scale this, e.g., the setting is a "koreader flex pixel", not an absolute actual px value ;).
for request see #5656
Adds an option to select page gap in continuous mode. Option only shows up on documents that have numbered pages (.pdf, .cbz) because i think there is not much use to this option when reading arbitrarily paged documents. If seen necessary same logic can be duplicated for .epub files.
koptoptions.lua handles user selection and saving that selection
ReaderView:readSettings() handles reading previously selected option when opening book
ReaderVİew:onPageGapUpdate() renders changes when selection made
Page gap is same in both landscape and portrait modes, I think adding different settings for both is little unnecessary.
The options for gap is 0, 8, 16 and 32, default one before was 8.
commit log
This change is