mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
copt deduplicate: font_size, visible_pages (#10882)
This commit is contained in:
@@ -73,10 +73,6 @@ function ReaderCoptListener:onConfigChange(option_name, option_value)
|
||||
return true
|
||||
end
|
||||
|
||||
function ReaderCoptListener:onSetFontSize(font_size)
|
||||
self.document.configurable.font_size = font_size
|
||||
end
|
||||
|
||||
function ReaderCoptListener:onCharging()
|
||||
self:headerRefresh()
|
||||
end
|
||||
|
||||
@@ -23,7 +23,6 @@ local optionsutil = require("ui/data/optionsutil")
|
||||
|
||||
local ReaderFont = InputContainer:extend{
|
||||
font_face = nil,
|
||||
font_size = nil,
|
||||
font_menu_title = _("Font"),
|
||||
face_table = nil,
|
||||
-- default gamma from crengine's lvfntman.cpp
|
||||
@@ -179,11 +178,7 @@ function ReaderFont:onReadSettings(config)
|
||||
or self.ui.document.header_font
|
||||
self.ui.document:setHeaderFont(self.header_font_face)
|
||||
|
||||
self.font_size = config:readSetting("font_size")
|
||||
or G_reader_settings:readSetting("copt_font_size")
|
||||
or G_defaults:readSetting("DCREREADER_CONFIG_DEFAULT_FONT_SIZE")
|
||||
or 22
|
||||
self.ui.document:setFontSize(Screen:scaleBySize(self.font_size))
|
||||
self.ui.document:setFontSize(Screen:scaleBySize(self.configurable.font_size))
|
||||
|
||||
self.font_base_weight = config:readSetting("font_base_weight")
|
||||
or G_reader_settings:readSetting("copt_font_base_weight")
|
||||
@@ -266,19 +261,16 @@ end
|
||||
UpdatePos event is used to tell ReaderRolling to update pos.
|
||||
--]]
|
||||
function ReaderFont:onChangeSize(delta)
|
||||
self.font_size = self.font_size + delta
|
||||
self.ui:handleEvent(Event:new("SetFontSize", self.font_size))
|
||||
self:onSetFontSize(self.configurable.font_size + delta)
|
||||
return true
|
||||
end
|
||||
|
||||
function ReaderFont:onSetFontSize(new_size)
|
||||
if new_size > 255 then new_size = 255 end
|
||||
if new_size < 12 then new_size = 12 end
|
||||
|
||||
self.font_size = new_size
|
||||
self.ui.document:setFontSize(Screen:scaleBySize(new_size))
|
||||
function ReaderFont:onSetFontSize(size)
|
||||
size = math.max(12, math.min(size, 255))
|
||||
self.configurable.font_size = size
|
||||
self.ui.document:setFontSize(Screen:scaleBySize(size))
|
||||
self.ui:handleEvent(Event:new("UpdatePos"))
|
||||
Notification:notify(T(_("Font size set to: %1."), self.font_size))
|
||||
Notification:notify(T(_("Font size set to: %1."), size))
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -351,7 +343,6 @@ end
|
||||
function ReaderFont:onSaveSettings()
|
||||
self.ui.doc_settings:saveSetting("font_face", self.font_face)
|
||||
self.ui.doc_settings:saveSetting("header_font_face", self.header_font_face)
|
||||
self.ui.doc_settings:saveSetting("font_size", self.font_size)
|
||||
self.ui.doc_settings:saveSetting("font_base_weight", self.font_base_weight)
|
||||
self.ui.doc_settings:saveSetting("font_hinting", self.font_hinting)
|
||||
self.ui.doc_settings:saveSetting("font_kerning", self.font_kerning)
|
||||
|
||||
@@ -122,7 +122,7 @@ function ReaderLink:init()
|
||||
end)
|
||||
end
|
||||
-- For relative local file links
|
||||
local directory, filename = util.splitFilePathName(self.ui.document.file) -- luacheck: no unused
|
||||
local directory, filename = util.splitFilePathName(self.document.file) -- luacheck: no unused
|
||||
self.document_dir = directory
|
||||
-- Migrate these old settings to the new common one
|
||||
if G_reader_settings:isTrue("tap_link_footnote_popup")
|
||||
@@ -401,7 +401,7 @@ If any of the other Swipe to follow link options is enabled, this will work only
|
||||
-- less visual feedback on PDF document of what is a link, or that we just
|
||||
-- followed a link, than on EPUB, it's safer to not use them on PDF documents
|
||||
-- even if the user enabled these features for EPUB documents).
|
||||
if not self.ui.document.info.has_pages then
|
||||
if self.ui.rolling then
|
||||
-- Tap section
|
||||
table.insert(menu_items.follow_links.sub_item_table, 2, {
|
||||
text = _("Allow larger tap area around links"),
|
||||
@@ -481,7 +481,7 @@ From the footnote popup, you can jump to the footnote location in the book by sw
|
||||
spin_widget = SpinWidget:new{
|
||||
width = math.floor(Screen:getWidth() * 0.75),
|
||||
value = G_reader_settings:readSetting("footnote_popup_absolute_font_size")
|
||||
or Screen:scaleBySize(self.ui.font.font_size),
|
||||
or Screen:scaleBySize(self.document.configurable.font_size),
|
||||
value_min = 12,
|
||||
value_max = 255,
|
||||
precision = "%d",
|
||||
@@ -542,16 +542,16 @@ end
|
||||
--- Check if a xpointer to <a> node really points to itself
|
||||
function ReaderLink:isXpointerCoherent(a_xpointer)
|
||||
-- Get screen coordinates of xpointer
|
||||
local screen_y, screen_x = self.ui.document:getScreenPositionFromXPointer(a_xpointer)
|
||||
local screen_y, screen_x = self.document:getScreenPositionFromXPointer(a_xpointer)
|
||||
-- Get again link and a_xpointer from this position
|
||||
local re_link_xpointer, re_a_xpointer = self.ui.document:getLinkFromPosition({x = screen_x, y = screen_y}) -- luacheck: no unused
|
||||
local re_link_xpointer, re_a_xpointer = self.document:getLinkFromPosition({x = screen_x, y = screen_y}) -- luacheck: no unused
|
||||
-- We should get the same a_xpointer. If not, crengine has messed up
|
||||
-- and we should not trust this xpointer to get back to this link.
|
||||
if re_a_xpointer ~= a_xpointer then
|
||||
-- Try it again with screen_x+1 (in the rare cases where screen_x
|
||||
-- fails, screen_x+1 usually works - probably something in crengine,
|
||||
-- but easier to workaround here that way)
|
||||
re_link_xpointer, re_a_xpointer = self.ui.document:getLinkFromPosition({x = screen_x+1, y = screen_y}) -- luacheck: no unused
|
||||
re_link_xpointer, re_a_xpointer = self.document:getLinkFromPosition({x = screen_x+1, y = screen_y}) -- luacheck: no unused
|
||||
if re_a_xpointer ~= a_xpointer then
|
||||
logger.info("noncoherent a_xpointer:", a_xpointer)
|
||||
return false
|
||||
@@ -564,11 +564,11 @@ end
|
||||
-- `Document:getLinkFromPosition()` behaves differently depending on
|
||||
-- document type, so this function provides a wrapper.
|
||||
function ReaderLink:getLinkFromGes(ges)
|
||||
if self.ui.document.info.has_pages then
|
||||
if self.ui.paging then
|
||||
local pos = self.view:screenToPageTransform(ges.pos)
|
||||
if pos then
|
||||
-- link box in native page
|
||||
local link, lbox = self.ui.document:getLinkFromPosition(pos.page, pos)
|
||||
local link, lbox = self.document:getLinkFromPosition(pos.page, pos)
|
||||
if link and lbox then
|
||||
return {
|
||||
link = link,
|
||||
@@ -578,7 +578,7 @@ function ReaderLink:getLinkFromGes(ges)
|
||||
end
|
||||
end
|
||||
else
|
||||
local link_xpointer, a_xpointer = self.ui.document:getLinkFromPosition(ges.pos)
|
||||
local link_xpointer, a_xpointer = self.document:getLinkFromPosition(ges.pos)
|
||||
logger.dbg("ReaderLink:getLinkFromPosition @", ges.pos.x, ges.pos.y, "from a_xpointer:", a_xpointer, "to link_xpointer:", link_xpointer)
|
||||
|
||||
-- On some documents, crengine may sometimes give a wrong a_xpointer
|
||||
@@ -616,7 +616,7 @@ function ReaderLink:showLinkBox(link, allow_footnote_popup)
|
||||
if link and link.lbox then -- pdfdocument
|
||||
-- screen box that holds the link
|
||||
local sbox = self.view:pageToScreenTransform(link.pos.page,
|
||||
self.ui.document:nativeToPageRectTransform(link.pos.page, link.lbox))
|
||||
self.document:nativeToPageRectTransform(link.pos.page, link.lbox))
|
||||
if sbox then
|
||||
UIManager:show(LinkBox:new{
|
||||
box = sbox,
|
||||
@@ -634,9 +634,8 @@ end
|
||||
|
||||
function ReaderLink:onTap(_, ges)
|
||||
if not isTapToFollowLinksOn() then return end
|
||||
if self.ui.document.info.has_pages then
|
||||
-- (footnote popup and larger tap area are for not
|
||||
-- not supported with non-CreDocuments)
|
||||
if self.ui.paging then
|
||||
-- (footnote popup and larger tap area are not supported with non-CreDocuments)
|
||||
local link = self:getLinkFromGes(ges)
|
||||
if link then
|
||||
if link.link and link.link.uri and isTapIgnoreExternalLinksEnabled() then
|
||||
@@ -679,13 +678,8 @@ function ReaderLink:onTap(_, ges)
|
||||
end
|
||||
|
||||
function ReaderLink:getCurrentLocation()
|
||||
local location
|
||||
if self.ui.document.info.has_pages then
|
||||
location = self.ui.paging:getBookLocation()
|
||||
else
|
||||
location = {xpointer = self.ui.rolling:getBookLocation(),}
|
||||
end
|
||||
return location
|
||||
return self.ui.paging and self.ui.paging:getBookLocation()
|
||||
or {xpointer = self.ui.rolling:getBookLocation()}
|
||||
end
|
||||
|
||||
-- Returns true, current_location if the current location is the same as the
|
||||
@@ -737,7 +731,7 @@ function ReaderLink:getPreviousLocationPages()
|
||||
if #self.location_stack > 0 then
|
||||
for num, location in ipairs(self.location_stack) do
|
||||
if self.ui.rolling and location.xpointer then
|
||||
previous_locations[self.ui.document:getPageFromXPointer(location.xpointer)] = num
|
||||
previous_locations[self.document:getPageFromXPointer(location.xpointer)] = num
|
||||
end
|
||||
if self.ui.paging and location[1] and location[1].page then
|
||||
previous_locations[location[1].page] = num
|
||||
@@ -752,7 +746,7 @@ end
|
||||
-- they should not provide allow_footnote_popup=true)
|
||||
function ReaderLink:onGotoLink(link, neglect_current_location, allow_footnote_popup)
|
||||
local link_url
|
||||
if self.ui.document.info.has_pages then
|
||||
if self.ui.paging then
|
||||
-- internal pdf links have a "page" attribute, while external ones have an "uri" attribute
|
||||
if link.page then -- Internal link
|
||||
logger.dbg("ReaderLink:onGotoLink: Internal link:", link)
|
||||
@@ -770,7 +764,7 @@ function ReaderLink:onGotoLink(link, neglect_current_location, allow_footnote_po
|
||||
-- If the XPointer does not exist (or is a full url), we will jump to page 1
|
||||
-- Best to check that this link exists in document with the following,
|
||||
-- which accepts both of the above legitimate xpointer as input.
|
||||
if self.ui.document:isXPointerInDocument(link.xpointer) then
|
||||
if self.document:isXPointerInDocument(link.xpointer) then
|
||||
logger.dbg("ReaderLink:onGotoLink: Internal link:", link)
|
||||
if allow_footnote_popup then
|
||||
if self:showAsFootnotePopup(link, neglect_current_location) then
|
||||
@@ -964,12 +958,12 @@ function ReaderLink:onGoToPageLink(ges, internal_links_only, max_distance)
|
||||
local selected_link, selected_distance2
|
||||
-- We use squared distances throughout the computations,
|
||||
-- no need to math.sqrt() anything for comparisons.
|
||||
if self.ui.document.info.has_pages then
|
||||
if self.ui.paging then
|
||||
local pos = self.view:screenToPageTransform(ges.pos)
|
||||
if not pos then
|
||||
return
|
||||
end
|
||||
local links = self.ui.document:getPageLinks(pos.page)
|
||||
local links = self.document:getPageLinks(pos.page)
|
||||
if not links or #links == 0 then
|
||||
return
|
||||
end
|
||||
@@ -1011,7 +1005,7 @@ function ReaderLink:onGoToPageLink(ges, internal_links_only, max_distance)
|
||||
-- getPageLinks goes through the CRe call cache, so at least repeat calls are cheaper.
|
||||
-- If we only care about internal links, we only request those.
|
||||
-- That expensive segments work is always skipped on external links.
|
||||
local links = self.ui.document:getPageLinks(internal_links_only)
|
||||
local links = self.document:getPageLinks(internal_links_only)
|
||||
if not links or #links == 0 then
|
||||
return
|
||||
end
|
||||
@@ -1169,14 +1163,14 @@ function ReaderLink:onSelectPrevPageLink()
|
||||
end
|
||||
|
||||
function ReaderLink:selectRelPageLink(rel)
|
||||
if self.ui.document.info.has_pages then
|
||||
if self.ui.paging then
|
||||
-- not implemented for now (see at doing like in showLinkBox()
|
||||
-- to highlight the link before jumping to it)
|
||||
return
|
||||
end
|
||||
-- Follow swipe_ignore_external_links setting to allow
|
||||
-- skipping external links when using keys
|
||||
local links = self.ui.document:getPageLinks(isSwipeIgnoreExternalLinksEnabled())
|
||||
local links = self.document:getPageLinks(isSwipeIgnoreExternalLinksEnabled())
|
||||
if not links or #links == 0 then
|
||||
return
|
||||
end
|
||||
@@ -1198,7 +1192,7 @@ function ReaderLink:selectRelPageLink(rel)
|
||||
end
|
||||
if not self.cur_selected_page_link_num then
|
||||
self.cur_selected_link = nil
|
||||
self.ui.document:highlightXPointer()
|
||||
self.document:highlightXPointer()
|
||||
UIManager:setDirty(self.dialog, "ui")
|
||||
return
|
||||
end
|
||||
@@ -1227,8 +1221,8 @@ function ReaderLink:selectRelPageLink(rel)
|
||||
-- a bit more time if it was hidden by the footnote popup
|
||||
link_y = link_y,
|
||||
}
|
||||
self.ui.document:highlightXPointer() -- clear any previous one
|
||||
self.ui.document:highlightXPointer(self.cur_selected_link.from_xpointer)
|
||||
self.document:highlightXPointer() -- clear any previous one
|
||||
self.document:highlightXPointer(self.cur_selected_link.from_xpointer)
|
||||
UIManager:setDirty(self.dialog, "ui")
|
||||
return true
|
||||
end
|
||||
@@ -1241,7 +1235,7 @@ end
|
||||
|
||||
function ReaderLink:onPageUpdate()
|
||||
if self.cur_selected_link then
|
||||
self.ui.document:highlightXPointer()
|
||||
self.document:highlightXPointer()
|
||||
self.cur_selected_page_link_num = nil
|
||||
self.cur_selected_link = nil
|
||||
end
|
||||
@@ -1249,7 +1243,7 @@ end
|
||||
|
||||
function ReaderLink:onPosUpdate()
|
||||
if self.cur_selected_link then
|
||||
self.ui.document:highlightXPointer()
|
||||
self.document:highlightXPointer()
|
||||
self.cur_selected_page_link_num = nil
|
||||
self.cur_selected_link = nil
|
||||
end
|
||||
@@ -1258,7 +1252,7 @@ end
|
||||
function ReaderLink:onGoToLatestBookmark(ges)
|
||||
local latest_bookmark = self.ui.bookmark:getLatestBookmark()
|
||||
if latest_bookmark then
|
||||
if self.ui.document.info.has_pages then
|
||||
if self.ui.paging then
|
||||
-- self:onGotoLink() needs something with a page attribute.
|
||||
-- we need to substract 1 to bookmark page, as links start from 0
|
||||
-- and onGotoLink will add 1 - we need a fake_link (with a single
|
||||
@@ -1285,7 +1279,7 @@ function ReaderLink:onGoToLatestBookmark(ges)
|
||||
end
|
||||
|
||||
function ReaderLink:showAsFootnotePopup(link, neglect_current_location)
|
||||
if self.ui.document.info.has_pages then
|
||||
if self.ui.paging then
|
||||
return false -- not supported
|
||||
end
|
||||
|
||||
@@ -1376,7 +1370,7 @@ function ReaderLink:showAsFootnotePopup(link, neglect_current_location)
|
||||
|
||||
logger.dbg("Checking if link is to a footnote:", flags, source_xpointer, target_xpointer)
|
||||
local is_footnote, reason, extStopReason, extStartXP, extEndXP =
|
||||
self.ui.document:isLinkToFootnote(source_xpointer, target_xpointer, flags, max_text_size)
|
||||
self.document:isLinkToFootnote(source_xpointer, target_xpointer, flags, max_text_size)
|
||||
if not is_footnote then
|
||||
logger.dbg("not a footnote:", reason)
|
||||
return false
|
||||
@@ -1404,9 +1398,9 @@ function ReaderLink:showAsFootnotePopup(link, neglect_current_location)
|
||||
-- from parent nodes
|
||||
local html
|
||||
if extStartXP and extEndXP then
|
||||
html = self.ui.document:getHTMLFromXPointers(extStartXP, extEndXP, 0x1001)
|
||||
html = self.document:getHTMLFromXPointers(extStartXP, extEndXP, 0x1001)
|
||||
else
|
||||
html = self.ui.document:getHTMLFromXPointer(target_xpointer, 0x1001, true)
|
||||
html = self.document:getHTMLFromXPointer(target_xpointer, 0x1001, true)
|
||||
-- from_final_parent = true to get a possibly more complete footnote
|
||||
end
|
||||
if not html then
|
||||
@@ -1423,20 +1417,20 @@ function ReaderLink:showAsFootnotePopup(link, neglect_current_location)
|
||||
-- (which might not be seen when covered by FootnoteWidget)
|
||||
local close_callback = nil
|
||||
if link.from_xpointer then -- coherent xpointer
|
||||
self.ui.document:highlightXPointer() -- clear any previous one
|
||||
self.ui.document:highlightXPointer(link.from_xpointer)
|
||||
self.document:highlightXPointer() -- clear any previous one
|
||||
self.document:highlightXPointer(link.from_xpointer)
|
||||
-- Don't let a previous footnote popup clear our highlight
|
||||
self._footnote_popup_discard_previous_close_callback = true
|
||||
UIManager:setDirty(self.dialog, "ui")
|
||||
close_callback = function(footnote_height)
|
||||
-- remove this highlight (actually all) on close
|
||||
local highlight_page = self.ui.document:getCurrentPage()
|
||||
local highlight_page = self.document:getCurrentPage()
|
||||
local clear_highlight = function()
|
||||
self.ui.document:highlightXPointer()
|
||||
self.document:highlightXPointer()
|
||||
-- Only refresh if we stayed on the same page, otherwise
|
||||
-- this could remove too early a marker on the target page
|
||||
-- after this footnote is followed
|
||||
if self.ui.document:getCurrentPage() == highlight_page then
|
||||
if self.document:getCurrentPage() == highlight_page then
|
||||
UIManager:setDirty(self.dialog, "ui")
|
||||
end
|
||||
end
|
||||
@@ -1465,8 +1459,8 @@ function ReaderLink:showAsFootnotePopup(link, neglect_current_location)
|
||||
popup = FootnoteWidget:new{
|
||||
html = html,
|
||||
doc_font_name = self.ui.font.font_face,
|
||||
doc_font_size = Screen:scaleBySize(self.ui.font.font_size),
|
||||
doc_margins = self.ui.document:getPageMargins(),
|
||||
doc_font_size = Screen:scaleBySize(self.document.configurable.font_size),
|
||||
doc_margins = self.document:getPageMargins(),
|
||||
close_callback = close_callback,
|
||||
follow_callback = function() -- follow the link on swipe west
|
||||
UIManager:close(popup)
|
||||
|
||||
@@ -61,7 +61,6 @@ local ReaderRolling = InputContainer:extend{
|
||||
xpointer = nil,
|
||||
panning_steps = ReaderPanning.panning_steps,
|
||||
cre_top_bar_enabled = false,
|
||||
visible_pages = 1,
|
||||
-- With visible_pages=2, in 2-pages mode, ensure the first
|
||||
-- page is always odd or even (odd is logical to avoid a
|
||||
-- same page when turning first 2-pages set of document)
|
||||
@@ -78,7 +77,7 @@ local ReaderRolling = InputContainer:extend{
|
||||
FULL_RENDERING_READY = 3,
|
||||
RELOADING_DOCUMENT = 4,
|
||||
DO_RELOAD_DOCUMENT = 5,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
function ReaderRolling:init()
|
||||
@@ -274,15 +273,13 @@ function ReaderRolling:onReadSettings(config)
|
||||
end
|
||||
end
|
||||
|
||||
-- This self.visible_pages may not be the current nb of visible pages
|
||||
-- self.configurable.visible_pages may not be the current nb of visible pages
|
||||
-- as crengine may decide to not ensure that in some conditions.
|
||||
-- It's the one we got from settings, the one the user has decided on
|
||||
-- with config toggle, and the one that we will save for next load.
|
||||
-- Use self.ui.document:getVisiblePageCount() to get the current
|
||||
-- crengine used value.
|
||||
self.visible_pages = config:readSetting("visible_pages") or
|
||||
G_reader_settings:readSetting("copt_visible_pages") or 1
|
||||
self.ui.document:setVisiblePageCount(self.visible_pages)
|
||||
self.ui.document:setVisiblePageCount(self.configurable.visible_pages)
|
||||
|
||||
if config:has("hide_nonlinear_flows") then
|
||||
self.hide_nonlinear_flows = config:isTrue("hide_nonlinear_flows")
|
||||
@@ -373,7 +370,6 @@ function ReaderRolling:onSaveSettings()
|
||||
if self.ui.document then
|
||||
self.ui.doc_settings:saveSetting("percent_finished", self:getLastPercent())
|
||||
end
|
||||
self.ui.doc_settings:saveSetting("visible_pages", self.visible_pages)
|
||||
self.ui.doc_settings:saveSetting("hide_nonlinear_flows", self.hide_nonlinear_flows)
|
||||
self.ui.doc_settings:saveSetting("partial_rerendering", self.partial_rerendering)
|
||||
end
|
||||
@@ -835,7 +831,7 @@ function ReaderRolling:onGotoXPointer(xp, marker_xp)
|
||||
-- where xpointer target is (and remove if after 1s)
|
||||
local screen_y, screen_x = self.ui.document:getScreenPositionFromXPointer(marker_xp)
|
||||
local doc_margins = self.ui.document:getPageMargins()
|
||||
local marker_h = Screen:scaleBySize(self.ui.font.font_size * 1.1 * self.configurable.line_spacing * (1/100))
|
||||
local marker_h = Screen:scaleBySize(self.configurable.font_size * 1.1 * self.configurable.line_spacing * (1/100))
|
||||
-- Make it 4/5 of left margin wide (and bigger when huge margin)
|
||||
local marker_w = math.floor(math.max(doc_margins["left"] - Screen:scaleBySize(5), doc_margins["left"] * 4/5))
|
||||
|
||||
@@ -933,7 +929,7 @@ function ReaderRolling:onGotoViewRel(diff)
|
||||
local pan_diff = diff * page_visible_height
|
||||
if self.view.page_overlap_enable then
|
||||
local overlap_lines = G_reader_settings:readSetting("copt_overlap_lines") or 1
|
||||
local overlap_h = Screen:scaleBySize(self.ui.font.font_size * 1.1 * self.configurable.line_spacing * (1/100)) * overlap_lines
|
||||
local overlap_h = Screen:scaleBySize(self.configurable.font_size * 1.1 * self.configurable.line_spacing * (1/100)) * overlap_lines
|
||||
if pan_diff > overlap_h then
|
||||
pan_diff = pan_diff - overlap_h
|
||||
elseif pan_diff < -overlap_h then
|
||||
@@ -1100,7 +1096,7 @@ function ReaderRolling:onChangeViewMode()
|
||||
self.current_header_height = self.view.view_mode == "page" and self.ui.document:getHeaderHeight() or 0
|
||||
-- Restore current position when switching page/scroll mode
|
||||
if self.xpointer then
|
||||
if self.visible_pages == 2 then
|
||||
if self.configurable.visible_pages == 2 then
|
||||
-- Switching from 2-pages page mode to scroll mode has crengine switch to 1-page,
|
||||
-- and we need to notice this re-rendering and keep things sane
|
||||
self:onUpdatePos()
|
||||
@@ -1258,7 +1254,7 @@ function ReaderRolling:onSetVisiblePages(visible_pages)
|
||||
-- We nevertheless update the setting (that will be saved) with what
|
||||
-- the user has requested - and not what crengine has enforced, and
|
||||
-- always query crengine for if it ends up ensuring it or not.
|
||||
self.visible_pages = visible_pages
|
||||
self.configurable.visible_pages = visible_pages
|
||||
local prev_visible_pages = self.ui.document:getVisiblePageCount()
|
||||
self.ui.document:setVisiblePageCount(visible_pages)
|
||||
local cur_visible_pages = self.ui.document:getVisiblePageCount()
|
||||
@@ -1560,10 +1556,9 @@ function ReaderRolling:checkXPointersAndProposeDOMVersionUpgrade()
|
||||
g_block_rendering_mode = 3 -- default in ReaderTypeset:onReadSettings()
|
||||
end
|
||||
if g_block_rendering_mode ~= 0 then -- default is not "legacy"
|
||||
-- This setting is actually saved by self.ui.document.configurable
|
||||
local block_rendering_mode = self.ui.document.configurable.block_rendering_mode
|
||||
local block_rendering_mode = self.configurable.block_rendering_mode
|
||||
if block_rendering_mode == 0 then
|
||||
self.ui.document.configurable.block_rendering_mode = g_block_rendering_mode
|
||||
self.configurable.block_rendering_mode = g_block_rendering_mode
|
||||
logger.info(" block_rendering_mode switched to", g_block_rendering_mode)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -20,11 +20,11 @@ return {--do NOT change this line
|
||||
["inverse_reading_order"] = true
|
||||
},
|
||||
["/mnt/onboard/smalltext"] = {
|
||||
["font_size"] = 34,
|
||||
["copt_font_size"] = 34,
|
||||
["copt_line_spacing"] = 130,
|
||||
},
|
||||
["/sdcard/Books/smalltext"] = {
|
||||
["font_size"] = 34,
|
||||
["copt_font_size"] = 34,
|
||||
["copt_line_spacing"] = 130,
|
||||
},
|
||||
--]]
|
||||
|
||||
Reference in New Issue
Block a user