mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Merge pull request #429 from chrox/master
add floating punctuation option for crereader
This commit is contained in:
@@ -82,9 +82,9 @@ DCREREADER_CONFIG_FONT_SIZES = {16, 20, 22, 24, 28, 32, 38, 44} -- range from 1
|
||||
|
||||
-- crereader margin sizes
|
||||
-- margin {left, top, right, bottom} in pixels
|
||||
DCREREADER_CONFIG_MARGIN_SIZES_SMALL = {6, 5, 2, 5}
|
||||
DCREREADER_CONFIG_MARGIN_SIZES_MEDIUM = {15, 10, 10, 10}
|
||||
DCREREADER_CONFIG_MARGIN_SIZES_LARGE = {25, 10, 20, 10}
|
||||
DCREREADER_CONFIG_MARGIN_SIZES_SMALL = {5, 5, 5, 5}
|
||||
DCREREADER_CONFIG_MARGIN_SIZES_MEDIUM = {15, 10, 15, 10}
|
||||
DCREREADER_CONFIG_MARGIN_SIZES_LARGE = {25, 10, 25, 10}
|
||||
|
||||
-- gesture detector defaults
|
||||
DGESDETECT_DISABLE_DOUBLE_TAP = true
|
||||
|
||||
@@ -273,6 +273,10 @@ function CreDocument:setPageMargins(left, top, right, bottom)
|
||||
self._document:setIntProperty("crengine.page.margin.bottom", bottom)
|
||||
end
|
||||
|
||||
function CreDocument:setFloatingPunctuation(enabled)
|
||||
self._document:setIntProperty("crengine.style.floating.punctuation.enabled", enabled)
|
||||
end
|
||||
|
||||
function CreDocument:setVisiblePageCount(new_count)
|
||||
self._document:setVisiblePageCount(new_count)
|
||||
end
|
||||
|
||||
@@ -32,11 +32,19 @@ function ReaderTypeset:onReadSettings(config)
|
||||
if not self.embedded_css then
|
||||
self.ui.document:setEmbeddedStyleSheet(0)
|
||||
end
|
||||
|
||||
self.floating_punctuation = config:readSetting("floating_punctuation")
|
||||
-- default to no floating punctuation
|
||||
if self.floating_punctuation == nil then
|
||||
self.floating_punctuation = 0
|
||||
end
|
||||
self.ui.document:setFloatingPunctuation(self.floating_punctuation)
|
||||
end
|
||||
|
||||
function ReaderTypeset:onSaveSettings()
|
||||
self.ui.doc_settings:saveSetting("css", self.css)
|
||||
self.ui.doc_settings:saveSetting("embedded_css", self.embedded_css)
|
||||
self.ui.doc_settings:saveSetting("floating_punctuation", self.floating_punctuation)
|
||||
end
|
||||
|
||||
function ReaderTypeset:onToggleEmbeddedStyleSheet(toggle)
|
||||
@@ -107,12 +115,22 @@ function ReaderTypeset:toggleEmbeddedStyleSheet(toggle)
|
||||
self.ui:handleEvent(Event:new("UpdatePos"))
|
||||
end
|
||||
|
||||
function ReaderTypeset:toggleFloatingPunctuation()
|
||||
self.floating_punctuation = self.floating_punctuation == 0 and 1 or 0
|
||||
self.ui.document:setFloatingPunctuation(self.floating_punctuation)
|
||||
self.ui:handleEvent(Event:new("UpdatePos"))
|
||||
end
|
||||
|
||||
function ReaderTypeset:addToMainMenu(tab_item_table)
|
||||
-- insert table to main reader menu
|
||||
table.insert(tab_item_table.typeset, {
|
||||
text = self.css_menu_title,
|
||||
sub_item_table = self:genStyleSheetMenu(),
|
||||
})
|
||||
table.insert(tab_item_table.typeset, {
|
||||
text = _("Toggle floating punctuation"),
|
||||
callback = function () self:toggleFloatingPunctuation() end,
|
||||
})
|
||||
end
|
||||
|
||||
return ReaderTypeset
|
||||
|
||||
Reference in New Issue
Block a user