mirror of
https://github.com/koreader/koreader
synced 2024-11-10 01:10:34 +00:00
Reorganize bottom menu config panels (#6131)
Mostly for the PDF bottom menu. - Reorganize by topic, trying to limit the number of widgets per panel to 4. - Re-order some toggles from low to high ('off' then 'on'). - Show font size as number instead of a list of "Aa". - PDF: add more font size values, and increase usable contrast values. - Add help_text to most PDF toggle titles. - CRE line spacing: increase fine tuning min and max. Also avoid zoom advice messages on book load.
This commit is contained in:
parent
46221985a6
commit
8991540462
@ -119,7 +119,7 @@ function ReaderZooming:onReadSettings(config)
|
||||
local zoom_mode = config:readSetting("zoom_mode") or
|
||||
G_reader_settings:readSetting("zoom_mode") or
|
||||
self.DEFAULT_ZOOM_MODE
|
||||
self:setZoomMode(zoom_mode)
|
||||
self:setZoomMode(zoom_mode, true) -- avoid informative message on load
|
||||
end
|
||||
|
||||
function ReaderZooming:onSaveSettings()
|
||||
@ -340,8 +340,8 @@ function ReaderZooming:genSetZoomModeCallBack(mode)
|
||||
end
|
||||
end
|
||||
|
||||
function ReaderZooming:setZoomMode(mode)
|
||||
if self.ui.view.page_scroll and self.paged_modes[mode] then
|
||||
function ReaderZooming:setZoomMode(mode, no_warning)
|
||||
if not no_warning and self.ui.view.page_scroll and self.paged_modes[mode] then
|
||||
UIManager:show(InfoMessage:new{
|
||||
text = T(_([[
|
||||
%1
|
||||
|
@ -3,16 +3,15 @@ local S = require("ui/data/strings")
|
||||
local optionsutil = require("ui/data/optionsutil")
|
||||
local _ = require("gettext")
|
||||
|
||||
-- add multiply operator to Aa dict
|
||||
local Aa = setmetatable({"Aa"}, {
|
||||
__mul = function(t, mul)
|
||||
local new = {}
|
||||
for i = 1, mul do
|
||||
for _, v in ipairs(t) do table.insert(new, v) end
|
||||
end
|
||||
return new
|
||||
-- Get font size numbers as a table of strings
|
||||
local tableOfNumbersToTableOfStrings = function(numbers)
|
||||
local t = {}
|
||||
for i, v in ipairs(numbers) do
|
||||
-- We turn 17.5 into 17<sup>5</sup>
|
||||
table.insert(t, tostring(v%1==0 and v or (v-v%1).."⁵"))
|
||||
end
|
||||
})
|
||||
return t
|
||||
end
|
||||
|
||||
local CreOptions = {
|
||||
prefix = 'copt',
|
||||
@ -185,15 +184,15 @@ In the top menu → Settings → Status bar, you can choose whether the bottom m
|
||||
{
|
||||
name = "view_mode",
|
||||
name_text = S.VIEW_MODE,
|
||||
toggle = {S.VIEW_SCROLL, S.VIEW_PAGE},
|
||||
values = {1, 0},
|
||||
toggle = {S.VIEW_PAGE, S.VIEW_SCROLL},
|
||||
values = {0, 1},
|
||||
default_value = 0,
|
||||
args = {"scroll", "page"},
|
||||
args = {"page", "scroll"},
|
||||
default_arg = "page",
|
||||
event = "SetViewMode",
|
||||
name_text_hold_callback = optionsutil.showValues,
|
||||
help_text = _([[- 'scroll' mode allows you to scroll the text like you would in a web browser (the 'Page Overlap' setting is only available in this mode).
|
||||
- 'page' mode splits the text into pages, at the most acceptable places (page numbers and the number of pages may change when you change fonts, margins, styles, etc.).]]),
|
||||
help_text = _([[- 'page' mode splits the text into pages, at the most acceptable places (page numbers and the number of pages may change when you change fonts, margins, styles, etc.).
|
||||
- 'continuous' mode allows you to scroll the text like you would in a web browser (the 'Page Overlap' setting is only available in this mode).]]),
|
||||
},
|
||||
{
|
||||
name = "block_rendering_mode",
|
||||
@ -254,8 +253,8 @@ Note that your selected font size is not affected by this setting.]]),
|
||||
default_value = DCREREADER_CONFIG_LINE_SPACE_PERCENT_MEDIUM,
|
||||
more_options = true,
|
||||
more_options_param = {
|
||||
value_min = 70,
|
||||
value_max = 130,
|
||||
value_min = 50,
|
||||
value_max = 300,
|
||||
value_step = 1,
|
||||
value_hold_step = 5,
|
||||
},
|
||||
@ -289,7 +288,7 @@ Note that your selected font size is not affected by this setting.]]),
|
||||
options = {
|
||||
{
|
||||
name = "font_size",
|
||||
item_text = Aa * #DCREREADER_CONFIG_FONT_SIZES,
|
||||
item_text = tableOfNumbersToTableOfStrings(DCREREADER_CONFIG_FONT_SIZES),
|
||||
item_align_center = 1.0,
|
||||
spacing = 15,
|
||||
item_font_size = DCREREADER_CONFIG_FONT_SIZES,
|
||||
@ -359,7 +358,7 @@ Note that your selected font size is not affected by this setting.]]),
|
||||
value_step = 1,
|
||||
value_hold_step = 4,
|
||||
name = "word_expansion",
|
||||
name_text = _("Allowed word expansion (%)"),
|
||||
name_text = _("Max word expansion %"),
|
||||
event = "SetWordExpansion",
|
||||
},
|
||||
toggle = {S.NONE, S.SOME, S.MORE},
|
||||
@ -463,24 +462,25 @@ Note that your selected font size is not affected by this setting.]]),
|
||||
options = {
|
||||
{
|
||||
name = "status_line",
|
||||
name_text = S.PROGRESS_BAR,
|
||||
toggle = {S.FULL, S.MINI},
|
||||
values = {0, 1},
|
||||
default_value = 1,
|
||||
args = {0, 1},
|
||||
name_text = S.ALT_STATUS_BAR,
|
||||
toggle = {S.OFF, S.ON},
|
||||
values = {1, 0},
|
||||
default_value = 1, -- Note that 1 means KOReader (bottom) status bar only
|
||||
args = {1, 0},
|
||||
default_arg = 1,
|
||||
event = "SetStatusLine",
|
||||
name_text_hold_callback = optionsutil.showValues,
|
||||
help_text = _([[- 'full' displays a status bar at the top of the screen (this status bar can't be customized).
|
||||
- 'mini' displays a status bar at the bottom of the screen, which can be toggled by tapping. The items displayed can be customized via the main menu.]]),
|
||||
help_text = _([[Enable or disable the rendering engine alternative status bar at the top of the screen (this status bar can't be customized).
|
||||
|
||||
Whether enabled or disabled, KOReader's own status bar at the bottom of the screen can be toggled by tapping. The items displayed can be customized via the main menu.]]),
|
||||
},
|
||||
{
|
||||
name = "embedded_css",
|
||||
name_text = S.EMBEDDED_STYLE,
|
||||
toggle = {S.ON, S.OFF},
|
||||
values = {1, 0},
|
||||
toggle = {S.OFF, S.ON},
|
||||
values = {0, 1},
|
||||
default_value = 1,
|
||||
args = {true, false},
|
||||
args = {false, true},
|
||||
default_arg = nil,
|
||||
event = "ToggleEmbeddedStyleSheet",
|
||||
name_text_hold_callback = optionsutil.showValues,
|
||||
@ -490,10 +490,10 @@ Note that your selected font size is not affected by this setting.]]),
|
||||
{
|
||||
name = "embedded_fonts",
|
||||
name_text = S.EMBEDDED_FONTS,
|
||||
toggle = {S.ON, S.OFF},
|
||||
values = {1, 0},
|
||||
toggle = {S.OFF, S.ON},
|
||||
values = {0, 1},
|
||||
default_value = 1,
|
||||
args = {true, false},
|
||||
args = {false, true},
|
||||
default_arg = nil,
|
||||
event = "ToggleEmbeddedFonts",
|
||||
enabled_func = function(configurable)
|
||||
|
@ -5,6 +5,20 @@ local optionsutil = require("ui/data/optionsutil")
|
||||
local _ = require("gettext")
|
||||
local Screen = Device.screen
|
||||
|
||||
-- The values used for Font Size are not actually font sizes, but kopt zoom levels.
|
||||
local FONT_SCALE_FACTORS = {0.2, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.3, 1.6, 2.0}
|
||||
-- Font sizes used for the font size widget only
|
||||
local FONT_SCALE_DISPLAY_SIZE = {12, 14, 15, 16, 17, 18, 19, 20, 22, 25, 30, 35}
|
||||
|
||||
-- Get font scale numbers as a table of strings
|
||||
local tableOfNumbersToTableOfStrings = function(numbers)
|
||||
local t = {}
|
||||
for i, v in ipairs(numbers) do
|
||||
table.insert(t, string.format("%0.1f", v))
|
||||
end
|
||||
return t
|
||||
end
|
||||
|
||||
local KoptOptions = {
|
||||
prefix = 'kopt',
|
||||
needs_redraw_on_change = true,
|
||||
@ -30,40 +44,24 @@ local KoptOptions = {
|
||||
{
|
||||
name = "trim_page",
|
||||
name_text = S.PAGE_CROP,
|
||||
toggle = {S.MANUAL, S.AUTO, S.SEMIAUTO, S.NONE},
|
||||
-- manual=0, auto=1, semi-auto=2, none=3
|
||||
-- ordered from least to max cropping done or possible
|
||||
toggle = {S.NONE, S.AUTO, S.SEMIAUTO, S.MANUAL},
|
||||
alternate = false,
|
||||
values = {0, 1, 2, 3},
|
||||
values = {3, 1, 2, 0},
|
||||
default_value = DKOPTREADER_CONFIG_TRIM_PAGE,
|
||||
enabled_func = Device.isTouchDevice,
|
||||
event = "PageCrop",
|
||||
args = {"manual", "auto", "semi-auto", "none"},
|
||||
name_text_hold_callback = optionsutil.showValues,
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
icon = "resources/icons/appbar.column.two.large.png",
|
||||
options = {
|
||||
{
|
||||
name = "page_scroll",
|
||||
name_text = S.VIEW_MODE,
|
||||
toggle = {S.VIEW_SCROLL, S.VIEW_PAGE},
|
||||
values = {1, 0},
|
||||
default_value = 1,
|
||||
event = "SetScrollMode",
|
||||
args = {true, false},
|
||||
name_text_hold_callback = optionsutil.showValues,
|
||||
},
|
||||
{
|
||||
name = "full_screen",
|
||||
name_text = S.PROGRESS_BAR,
|
||||
toggle = {S.OFF, S.ON},
|
||||
values = {1, 0},
|
||||
default_value = 1,
|
||||
event = "SetFullScreen",
|
||||
args = {true, false},
|
||||
show = false,
|
||||
args = {"none", "auto", "semi-auto", "manual"},
|
||||
name_text_hold_callback = optionsutil.showValues,
|
||||
help_text = _([[Allows cropping blank page margins in the original document.
|
||||
This might be needed on scanned documents, that may have speckles or fingerprints in the margins, to be able to use zoom to fit content width.
|
||||
- 'none' does not cut the original document margins.
|
||||
- 'auto' finds content area automatically.
|
||||
- 'semi-auto" finds content area automatically, inside some larger area defined manually.
|
||||
- 'manual" uses the area defined manually as-is.
|
||||
|
||||
In 'semi-auto' and 'manual' modes, you may need to define areas once on an odd page number, and once on an even page number (these areas will then be used for all odd, or even, page numbers).]]),
|
||||
},
|
||||
{
|
||||
name = "page_margin",
|
||||
@ -73,15 +71,24 @@ local KoptOptions = {
|
||||
default_value = DKOPTREADER_CONFIG_PAGE_MARGIN,
|
||||
event = "MarginUpdate",
|
||||
name_text_hold_callback = optionsutil.showValues,
|
||||
help_text = _([[Set margins to be applied after page-crop and zoom modes are applied.]]),
|
||||
},
|
||||
}
|
||||
},
|
||||
{
|
||||
icon = "resources/icons/appbar.column.two.large.png",
|
||||
options = {
|
||||
{
|
||||
name = "line_spacing",
|
||||
name_text = S.LINE_SPACING,
|
||||
toggle = {S.SMALL, S.MEDIUM, S.LARGE},
|
||||
values = {1.0, 1.2, 1.4},
|
||||
default_value = DKOPTREADER_CONFIG_LINE_SPACING,
|
||||
advanced = true,
|
||||
name = "page_scroll",
|
||||
name_text = S.VIEW_MODE,
|
||||
toggle = {S.VIEW_PAGE, S.VIEW_SCROLL},
|
||||
values = {0, 1},
|
||||
default_value = 1,
|
||||
event = "SetScrollMode",
|
||||
args = {false, true},
|
||||
name_text_hold_callback = optionsutil.showValues,
|
||||
help_text = _([[- 'page' mode shows only one page of the document at a time.
|
||||
- 'continuous' mode allows you to scroll the pages like you would in a web browser.]]),
|
||||
},
|
||||
{
|
||||
name = "page_gap_height",
|
||||
@ -95,21 +102,32 @@ local KoptOptions = {
|
||||
return optionsutil.enableIfEquals(configurable, "page_scroll", 1)
|
||||
end,
|
||||
name_text_hold_callback = optionsutil.showValues,
|
||||
help_text = _([[In continuous view mode, sets the thickness of the separator between document pages.]]),
|
||||
},
|
||||
{
|
||||
name = "max_columns",
|
||||
name_text = S.COLUMNS,
|
||||
item_icons = {
|
||||
"resources/icons/appbar.column.one.png",
|
||||
"resources/icons/appbar.column.two.png",
|
||||
"resources/icons/appbar.column.three.png",
|
||||
},
|
||||
values = {1,2,3},
|
||||
default_value = DKOPTREADER_CONFIG_MAX_COLUMNS,
|
||||
name = "full_screen",
|
||||
name_text = S.PROGRESS_BAR,
|
||||
toggle = {S.OFF, S.ON},
|
||||
values = {1, 0},
|
||||
default_value = 1,
|
||||
event = "SetFullScreen",
|
||||
args = {true, false},
|
||||
show = false, -- toggling bottom status can be done via tap
|
||||
name_text_hold_callback = optionsutil.showValues,
|
||||
},
|
||||
{
|
||||
name = "line_spacing",
|
||||
name_text = S.LINE_SPACING,
|
||||
toggle = {S.SMALL, S.MEDIUM, S.LARGE},
|
||||
values = {1.0, 1.2, 1.4},
|
||||
default_value = DKOPTREADER_CONFIG_LINE_SPACING,
|
||||
advanced = true,
|
||||
enabled_func = function(configurable)
|
||||
-- seems to only work in reflow mode
|
||||
return optionsutil.enableIfEquals(configurable, "text_wrap", 1)
|
||||
end,
|
||||
name_text_hold_callback = optionsutil.showValues,
|
||||
help_text = _([[In reflow mode, sets the spacing between lines.]]),
|
||||
},
|
||||
{
|
||||
name = "justification",
|
||||
@ -129,6 +147,8 @@ local KoptOptions = {
|
||||
end,
|
||||
labels = {S.AUTO, S.LEFT, S.CENTER, S.RIGHT, S.JUSTIFY},
|
||||
name_text_hold_callback = optionsutil.showValues,
|
||||
help_text = _([[In reflow mode, sets the text alignment.
|
||||
The first option ("auto") tries to automatically align reflowed text as it is in the original document.]]),
|
||||
},
|
||||
}
|
||||
},
|
||||
@ -137,13 +157,13 @@ local KoptOptions = {
|
||||
options = {
|
||||
{
|
||||
name = "font_size",
|
||||
item_text = {"Aa","Aa","Aa","Aa","Aa","Aa","Aa","Aa"},
|
||||
item_text = tableOfNumbersToTableOfStrings(FONT_SCALE_FACTORS),
|
||||
item_align_center = 1.0,
|
||||
spacing = 15,
|
||||
height = 60,
|
||||
item_font_size = {24,28,32,34,36,38,42,46},
|
||||
args = {0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.6, 2.0},
|
||||
values = {0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.6, 2.0},
|
||||
item_font_size = FONT_SCALE_DISPLAY_SIZE,
|
||||
args = FONT_SCALE_FACTORS,
|
||||
values = FONT_SCALE_FACTORS,
|
||||
default_value = DKOPTREADER_CONFIG_FONT_SIZE,
|
||||
event = "FontSizeUpdate",
|
||||
enabled_func = function(configurable, document)
|
||||
@ -153,7 +173,7 @@ local KoptOptions = {
|
||||
},
|
||||
{
|
||||
name = "font_fine_tune",
|
||||
name_text = S.FONTSIZE_FINE_TUNING,
|
||||
name_text = S.FONT_SIZE,
|
||||
toggle = Device:isTouchDevice() and {S.DECREASE, S.INCREASE} or nil,
|
||||
item_text = not Device:isTouchDevice() and {S.DECREASE, S.INCREASE} or nil,
|
||||
values = {-0.05, 0.05},
|
||||
@ -169,37 +189,28 @@ local KoptOptions = {
|
||||
local opt = {
|
||||
name = "font_size",
|
||||
name_text = _("Font Size"),
|
||||
help_text = _([[In reflow mode, sets a font scaling factor that is applied to the original document font sizes.]]),
|
||||
}
|
||||
optionsutil.showValues(configurable, opt, prefix)
|
||||
end
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
icon = "resources/icons/appbar.grade.b.large.png",
|
||||
options = {
|
||||
end,
|
||||
},
|
||||
{
|
||||
name = "contrast",
|
||||
name_text = S.CONTRAST,
|
||||
buttonprogress = true,
|
||||
values = {1/0.8, 1/1.0, 1/1.5, 1/2.0, 1/3.0, 1/4.0, 1/6.0, 1/9.0},
|
||||
default_pos = 2,
|
||||
default_value = DKOPTREADER_CONFIG_CONTRAST,
|
||||
event = "GammaUpdate",
|
||||
args = {0.8, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0, 9.0},
|
||||
labels = {0.8, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0, 9.0},
|
||||
name = "word_spacing",
|
||||
name_text = S.WORD_GAP,
|
||||
toggle = {S.SMALL, S.AUTO, S.LARGE},
|
||||
values = DKOPTREADER_CONFIG_WORD_SPACINGS,
|
||||
default_value = DKOPTREADER_CONFIG_DEFAULT_WORD_SPACING,
|
||||
enabled_func = function(configurable)
|
||||
return optionsutil.enableIfEquals(configurable, "text_wrap", 1)
|
||||
end,
|
||||
name_text_hold_callback = optionsutil.showValues,
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
icon = "resources/icons/appbar.settings.large.png",
|
||||
options = {
|
||||
help_text = _([[In reflow mode, sets the spacing between words.]]),
|
||||
},
|
||||
{
|
||||
name = "text_wrap",
|
||||
name_text = S.REFLOW,
|
||||
toggle = {S.ON, S.OFF},
|
||||
values = {1, 0},
|
||||
toggle = {S.OFF, S.ON},
|
||||
values = {0, 1},
|
||||
default_value = DKOPTREADER_CONFIG_TEXT_WRAP,
|
||||
events = {
|
||||
{
|
||||
@ -213,49 +224,49 @@ local KoptOptions = {
|
||||
},
|
||||
},
|
||||
name_text_hold_callback = optionsutil.showValues,
|
||||
help_text = _([[Reflow mode extracts text and images from the original document, possibly discarding some formatting, and reflows it on the screen for easier reading.
|
||||
Some of the other settings are only available when reflow mode is enabled.]]),
|
||||
},
|
||||
}
|
||||
},
|
||||
{
|
||||
icon = "resources/icons/appbar.grade.b.large.png",
|
||||
options = {
|
||||
{
|
||||
name = "contrast",
|
||||
name_text = S.CONTRAST,
|
||||
buttonprogress = true,
|
||||
-- See https://github.com/koreader/koreader/issues/1299#issuecomment-65183895
|
||||
-- For pdf reflowing mode (kopt_contrast):
|
||||
values = {1/0.8, 1/1.0, 1/1.5, 1/2.0, 1/4.0, 1/6.0, 1/10.0, 1/50.0},
|
||||
default_pos = 2,
|
||||
default_value = DKOPTREADER_CONFIG_CONTRAST,
|
||||
event = "GammaUpdate",
|
||||
-- For pdf non-reflowing mode (mupdf):
|
||||
args = {0.8, 1.0, 1.5, 2.0, 4.0, 6.0, 10.0, 50.0},
|
||||
labels = {0.8, 1.0, 1.5, 2.0, 4.0, 6.0, 10.0, 50.0},
|
||||
name_text_hold_callback = optionsutil.showValues,
|
||||
},
|
||||
{
|
||||
name = "page_opt",
|
||||
name_text = S.DEWATERMARK,
|
||||
toggle = {S.ON, S.OFF},
|
||||
values = {1, 0},
|
||||
toggle = {S.OFF, S.ON},
|
||||
values = {0, 1},
|
||||
default_value = 0,
|
||||
name_text_hold_callback = optionsutil.showValues,
|
||||
help_text = _([[Remove watermarks from the rendered document.
|
||||
This can also be used to remove some gray background or to convert a grayscale or color document to black & white and get more contrast for easier reading.]]),
|
||||
},
|
||||
{
|
||||
name="doc_language",
|
||||
name_text = S.DOC_LANG,
|
||||
toggle = DKOPTREADER_CONFIG_DOC_LANGS_TEXT,
|
||||
values = DKOPTREADER_CONFIG_DOC_LANGS_CODE,
|
||||
default_value = DKOPTREADER_CONFIG_DOC_DEFAULT_LANG_CODE,
|
||||
event = "DocLangUpdate",
|
||||
args = DKOPTREADER_CONFIG_DOC_LANGS_CODE,
|
||||
name_text_hold_callback = optionsutil.showValues,
|
||||
help_text = _([[(Used by the OCR engine.)]]),
|
||||
},
|
||||
{
|
||||
name = "word_spacing",
|
||||
name_text = S.WORD_GAP,
|
||||
toggle = {S.SMALL, S.AUTO, S.LARGE},
|
||||
values = DKOPTREADER_CONFIG_WORD_SPACINGS,
|
||||
default_value = DKOPTREADER_CONFIG_DEFAULT_WORD_SPACING,
|
||||
enabled_func = function(configurable)
|
||||
return optionsutil.enableIfEquals(configurable, "text_wrap", 1)
|
||||
end,
|
||||
name_text_hold_callback = optionsutil.showValues,
|
||||
},
|
||||
{
|
||||
name = "writing_direction",
|
||||
name_text = S.WRITING_DIR,
|
||||
toggle = {S.LTR, S.RTL, S.TBRTL},
|
||||
values = {0, 1, 2},
|
||||
name = "hw_dithering",
|
||||
name_text = S.HW_DITHERING,
|
||||
toggle = {S.OFF, S.ON},
|
||||
values = {0, 1},
|
||||
default_value = 0,
|
||||
enabled_func = function(configurable)
|
||||
return optionsutil.enableIfEquals(configurable, "text_wrap", 1)
|
||||
end,
|
||||
advanced = true,
|
||||
show = Device:hasEinkScreen() and Device:canHWDither(),
|
||||
name_text_hold_callback = optionsutil.showValues,
|
||||
help_text = _([[Enable Hardware dithering.]]),
|
||||
},
|
||||
{
|
||||
name = "quality",
|
||||
@ -268,25 +279,45 @@ This can also be used to remove some gray background or to convert a grayscale o
|
||||
return optionsutil.enableIfEquals(configurable, "text_wrap", 1)
|
||||
end,
|
||||
name_text_hold_callback = optionsutil.showValues,
|
||||
help_text = _([[In reflow mode, sets the quality of the text and image extraction processing and output.]]),
|
||||
},
|
||||
}
|
||||
},
|
||||
{
|
||||
icon = "resources/icons/appbar.settings.large.png",
|
||||
options = {
|
||||
{
|
||||
name = "hw_dithering",
|
||||
name_text = S.HW_DITHERING,
|
||||
toggle = {S.ON, S.OFF},
|
||||
values = {1, 0},
|
||||
default_value = 0,
|
||||
advanced = true,
|
||||
show = Device:hasEinkScreen() and Device:canHWDither(),
|
||||
name="doc_language",
|
||||
name_text = S.DOC_LANG,
|
||||
toggle = DKOPTREADER_CONFIG_DOC_LANGS_TEXT,
|
||||
values = DKOPTREADER_CONFIG_DOC_LANGS_CODE,
|
||||
default_value = DKOPTREADER_CONFIG_DOC_DEFAULT_LANG_CODE,
|
||||
event = "DocLangUpdate",
|
||||
args = DKOPTREADER_CONFIG_DOC_LANGS_CODE,
|
||||
name_text_hold_callback = optionsutil.showValues,
|
||||
help_text = _([[Set the language to be used by the OCR engine.]]),
|
||||
},
|
||||
{
|
||||
name = "forced_ocr",
|
||||
name_text = S.FORCED_OCR,
|
||||
toggle = {S.ON, S.OFF},
|
||||
values = {1, 0},
|
||||
toggle = {S.OFF, S.ON},
|
||||
values = {0, 1},
|
||||
default_value = 0,
|
||||
advanced = true,
|
||||
name_text_hold_callback = optionsutil.showValues,
|
||||
help_text = _([[Force the use of OCR for text selection, even if the document has a text layer.]]),
|
||||
},
|
||||
{
|
||||
name = "writing_direction",
|
||||
name_text = S.WRITING_DIR,
|
||||
toggle = {S.LTR, S.RTL, S.TBRTL},
|
||||
values = {0, 1, 2},
|
||||
default_value = 0,
|
||||
enabled_func = function(configurable)
|
||||
return optionsutil.enableIfEquals(configurable, "text_wrap", 1)
|
||||
end,
|
||||
name_text_hold_callback = optionsutil.showValues,
|
||||
help_text = _([[In reflow mode, sets the original text direction. This needs to be set to RTL to correctly extract and reflow RTL languages like Arabic or Hebrew.]]),
|
||||
},
|
||||
{
|
||||
name = "defect_size",
|
||||
@ -295,7 +326,7 @@ This can also be used to remove some gray background or to convert a grayscale o
|
||||
values = {1.0, 3.0, 5.0},
|
||||
default_value = DKOPTREADER_CONFIG_DEFECT_SIZE,
|
||||
event = "DefectSizeUpdate",
|
||||
show = false,
|
||||
show = false, -- might work somehow, but larger values than 1.0 might easily eat content
|
||||
enabled_func = function(configurable)
|
||||
return optionsutil.enableIfEquals(configurable, "text_wrap", 1)
|
||||
end,
|
||||
@ -307,7 +338,7 @@ This can also be used to remove some gray background or to convert a grayscale o
|
||||
toggle = {S.ZERO_DEG, S.FIVE_DEG, S.TEN_DEG},
|
||||
values = {0, 5, 10},
|
||||
default_value = DKOPTREADER_CONFIG_AUTO_STRAIGHTEN,
|
||||
show = false,
|
||||
show = false, -- does not work (and slows rendering)
|
||||
enabled_func = function(configurable)
|
||||
return optionsutil.enableIfEquals(configurable, "text_wrap", 1)
|
||||
end,
|
||||
@ -316,15 +347,32 @@ This can also be used to remove some gray background or to convert a grayscale o
|
||||
{
|
||||
name = "detect_indent",
|
||||
name_text = S.INDENTATION,
|
||||
toggle = {S.ON, S.OFF},
|
||||
values = {1, 0},
|
||||
toggle = {S.OFF, S.ON},
|
||||
values = {0, 1},
|
||||
default_value = DKOPTREADER_CONFIG_DETECT_INDENT,
|
||||
show = false,
|
||||
show = false, -- does not work
|
||||
enabled_func = function(configurable)
|
||||
return optionsutil.enableIfEquals(configurable, "text_wrap", 1)
|
||||
end,
|
||||
name_text_hold_callback = optionsutil.showValues,
|
||||
},
|
||||
{
|
||||
name = "max_columns",
|
||||
name_text = S.DOCUMENT_COLUMNS,
|
||||
item_icons = {
|
||||
"resources/icons/appbar.column.one.png",
|
||||
"resources/icons/appbar.column.two.png",
|
||||
"resources/icons/appbar.column.three.png",
|
||||
},
|
||||
values = {1,2,3},
|
||||
default_value = DKOPTREADER_CONFIG_MAX_COLUMNS,
|
||||
enabled_func = function(configurable)
|
||||
return optionsutil.enableIfEquals(configurable, "text_wrap", 1)
|
||||
end,
|
||||
name_text_hold_callback = optionsutil.showValues,
|
||||
help_text = _([[In reflow mode, sets the max number of columns to try to detect in the original document.
|
||||
You might need to set it to 1 column if, in a full width document, text is incorrectly detected as multiple columns because of unlucky word spacing.]]),
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
@ -334,7 +382,7 @@ if BD.mirroredUILayout() then
|
||||
-- be mirrored - but that's not enough: we need to swap LEFT and RIGHT,
|
||||
-- so they appear in a more expected and balanced order to RTL users:
|
||||
-- {JUSTIFY, LEFT, CENTER, RIGHT, AUTO}
|
||||
local j = KoptOptions[3].options[7]
|
||||
local j = KoptOptions[3].options[5]
|
||||
assert(j.name == "justification")
|
||||
j.item_icons[2], j.item_icons[4] = j.item_icons[4], j.item_icons[2]
|
||||
j.values[2], j.values[4] = j.values[4], j.values[2]
|
||||
|
@ -13,10 +13,9 @@ S.T_PAGE_MARGIN = _("Top Margin")
|
||||
S.B_PAGE_MARGIN = _("Bottom Margin")
|
||||
S.SYNC_T_B_PAGE_MARGINS = _("Sync T/B Margins")
|
||||
S.LINE_SPACING = _("Line Spacing")
|
||||
S.COLUMNS = _("Columns")
|
||||
S.DOCUMENT_COLUMNS = _("Document Columns")
|
||||
-- @translators Text alignment. Options given as icons: left, right, center, justify.
|
||||
S.TEXT_ALIGN = _("Alignment")
|
||||
S.FONTSIZE_FINE_TUNING = _("Fine Tuning")
|
||||
S.FONT_SIZE = _("Font Size")
|
||||
S.CONTRAST = _("Contrast")
|
||||
-- @translators Reflow text.
|
||||
@ -42,6 +41,7 @@ S.EMBEDDED_FONTS = _("Embedded Fonts")
|
||||
S.BLOCK_RENDERING_MODE = _("Render Mode")
|
||||
S.WRITING_DIR = _("Writing Direction")
|
||||
S.PROGRESS_BAR = _("Progress Bar")
|
||||
S.ALT_STATUS_BAR = _("Alt Status Bar")
|
||||
-- @translators If OCR is unclear, please see https://en.wikipedia.org/wiki/Optical_character_recognition
|
||||
S.FORCED_OCR = _("Forced OCR")
|
||||
S.HW_DITHERING = _("Dithering")
|
||||
@ -91,8 +91,6 @@ S.RTL = _("RTL")
|
||||
S.TBRTL = _("TBRTL")
|
||||
-- @translators TBLTR is top-to-bottom-left-to-right, which is a traditional Chinese/Japanese writing direction.
|
||||
S.TBLTR = _("TBLTR")
|
||||
S.FULL = _("full")
|
||||
S.MINI = _("mini")
|
||||
S.LEFT = _("left")
|
||||
S.CENTER = _("center")
|
||||
S.RIGHT = _("right")
|
||||
|
@ -37,6 +37,7 @@ local Button = InputContainer:new{
|
||||
preselect = false,
|
||||
callback = nil,
|
||||
enabled = true,
|
||||
allow_hold_when_disabled = false,
|
||||
margin = 0,
|
||||
bordersize = Size.border.button,
|
||||
background = Blitbuffer.COLOR_WHITE,
|
||||
@ -261,7 +262,7 @@ function Button:onTapSelectButton()
|
||||
end
|
||||
|
||||
function Button:onHoldSelectButton()
|
||||
if self.enabled and self.hold_callback then
|
||||
if self.hold_callback and (self.enabled or self.allow_hold_when_disabled) then
|
||||
self.hold_callback()
|
||||
elseif self.hold_input then
|
||||
self:onInput(self.hold_input, true)
|
||||
@ -277,7 +278,7 @@ function Button:onHoldReleaseSelectButton()
|
||||
-- Safe-guard for when used inside a MovableContainer,
|
||||
-- which would handle HoldRelease and process it like
|
||||
-- a Hold if we wouldn't return true here
|
||||
if self.enabled and self.hold_callback then
|
||||
if self.hold_callback and (self.enabled or self.allow_hold_when_disabled) then
|
||||
return true
|
||||
elseif self.hold_input or type(self.hold_input_func) == "function" then
|
||||
return true
|
||||
|
@ -280,6 +280,7 @@ function ConfigOption:init()
|
||||
bordersize = 0,
|
||||
face = face,
|
||||
enabled = enabled,
|
||||
allow_hold_when_disabled = self.options[c].name_text_hold_callback ~= nil,
|
||||
padding = padding_small,
|
||||
text_font_face = name_font_face,
|
||||
text_font_size = name_font_size,
|
||||
@ -870,7 +871,9 @@ function ConfigDialog:onShowConfigPanel(index)
|
||||
-- NOTE: And we also only need to repaint what's behind us when switching to a smaller dialog...
|
||||
-- This is trickier than in touchmenu, because dimen appear to fluctuate before/after painting...
|
||||
-- So we've settled instead for the amount of lines in the panel, as line-height is constant.
|
||||
local keep_bg = old_layout_h and #self.layout >= old_layout_h
|
||||
-- NOTE: line/widget-height is actually not constant (e.g. the font size widget on the emulator),
|
||||
-- so do it only when the new nb of widgets is strictly greater than the previous one.
|
||||
local keep_bg = old_layout_h and #self.layout > old_layout_h
|
||||
UIManager:setDirty((self.is_fresh or keep_bg) and self or "all", function()
|
||||
local refresh_dimen =
|
||||
old_dimen and old_dimen:combine(self.dialog_frame.dimen)
|
||||
|
Loading…
Reference in New Issue
Block a user