2018-03-22 20:01:38 +00:00
|
|
|
local Device = require("device")
|
2013-10-18 20:38:07 +00:00
|
|
|
local S = require("ui/data/strings")
|
2018-05-26 17:45:37 +00:00
|
|
|
local optionsutil = require("ui/data/optionsutil")
|
2013-10-18 20:38:07 +00:00
|
|
|
local _ = require("gettext")
|
2018-03-22 20:01:38 +00:00
|
|
|
local Screen = Device.screen
|
2013-10-18 20:38:07 +00:00
|
|
|
|
|
|
|
local KoptOptions = {
|
2014-03-13 13:52:43 +00:00
|
|
|
prefix = 'kopt',
|
2019-03-14 21:23:17 +00:00
|
|
|
needs_redraw_on_change = true,
|
2014-03-13 13:52:43 +00:00
|
|
|
{
|
|
|
|
icon = "resources/icons/appbar.transform.rotate.right.large.png",
|
|
|
|
options = {
|
|
|
|
{
|
|
|
|
name = "screen_mode",
|
|
|
|
name_text = S.SCREEN_MODE,
|
|
|
|
toggle = {S.PORTRAIT, S.LANDSCAPE},
|
|
|
|
alternate = false,
|
|
|
|
args = {"portrait", "landscape"},
|
|
|
|
default_arg = "portrait",
|
|
|
|
current_func = function() return Screen:getScreenMode() end,
|
2018-12-28 03:32:42 +00:00
|
|
|
event = "SwapScreenMode",
|
2018-05-26 17:45:37 +00:00
|
|
|
name_text_hold_callback = optionsutil.showValues,
|
2014-03-13 13:52:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
icon = "resources/icons/appbar.crop.large.png",
|
|
|
|
options = {
|
|
|
|
{
|
|
|
|
name = "trim_page",
|
|
|
|
name_text = S.PAGE_CROP,
|
2019-03-03 07:57:20 +00:00
|
|
|
toggle = {S.MANUAL, S.AUTO, S.SEMIAUTO, S.NONE},
|
2014-03-13 13:52:43 +00:00
|
|
|
alternate = false,
|
2019-03-03 07:57:20 +00:00
|
|
|
values = {0, 1, 2, 3},
|
2014-03-13 13:52:43 +00:00
|
|
|
default_value = DKOPTREADER_CONFIG_TRIM_PAGE,
|
2018-03-22 20:01:38 +00:00
|
|
|
enabled_func = Device.isTouchDevice,
|
2014-03-13 13:52:43 +00:00
|
|
|
event = "PageCrop",
|
2019-03-03 07:57:20 +00:00
|
|
|
args = {"manual", "auto", "semi-auto", "none"},
|
2018-05-26 17:45:37 +00:00
|
|
|
name_text_hold_callback = optionsutil.showValues,
|
2014-03-13 13:52:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
icon = "resources/icons/appbar.column.two.large.png",
|
|
|
|
options = {
|
|
|
|
{
|
|
|
|
name = "page_scroll",
|
2019-08-02 20:43:26 +00:00
|
|
|
name_text = S.VIEW_MODE,
|
|
|
|
toggle = {S.VIEW_SCROLL, S.VIEW_PAGE},
|
2014-03-13 13:52:43 +00:00
|
|
|
values = {1, 0},
|
|
|
|
default_value = DSCROLL_MODE,
|
2016-03-27 22:39:47 +00:00
|
|
|
event = "SetScrollMode",
|
2014-03-13 13:52:43 +00:00
|
|
|
args = {true, false},
|
2018-05-26 17:45:37 +00:00
|
|
|
name_text_hold_callback = optionsutil.showValues,
|
2014-03-13 13:52:43 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name = "full_screen",
|
|
|
|
name_text = S.PROGRESS_BAR,
|
|
|
|
toggle = {S.OFF, S.ON},
|
|
|
|
values = {1, 0},
|
|
|
|
default_value = DFULL_SCREEN,
|
|
|
|
event = "SetFullScreen",
|
|
|
|
args = {true, false},
|
2014-05-19 06:23:31 +00:00
|
|
|
show = false,
|
2018-05-26 17:45:37 +00:00
|
|
|
name_text_hold_callback = optionsutil.showValues,
|
2014-03-13 13:52:43 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name = "page_margin",
|
|
|
|
name_text = S.PAGE_MARGIN,
|
|
|
|
toggle = {S.SMALL, S.MEDIUM, S.LARGE},
|
2015-03-12 09:31:33 +00:00
|
|
|
values = {0.05, 0.10, 0.25},
|
2014-03-13 13:52:43 +00:00
|
|
|
default_value = DKOPTREADER_CONFIG_PAGE_MARGIN,
|
|
|
|
event = "MarginUpdate",
|
2018-05-26 17:45:37 +00:00
|
|
|
name_text_hold_callback = optionsutil.showValues,
|
2014-03-13 13:52:43 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
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,
|
2014-08-05 04:04:17 +00:00
|
|
|
advanced = true,
|
2018-05-26 17:45:37 +00:00
|
|
|
name_text_hold_callback = optionsutil.showValues,
|
2014-03-13 13:52:43 +00:00
|
|
|
},
|
2014-05-29 12:58:25 +00:00
|
|
|
{
|
|
|
|
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,
|
2015-03-16 13:49:53 +00:00
|
|
|
enabled_func = function(configurable)
|
2018-05-26 17:45:37 +00:00
|
|
|
return optionsutil.enableIfEquals(configurable, "text_wrap", 1)
|
2015-03-16 13:49:53 +00:00
|
|
|
end,
|
2018-05-26 17:45:37 +00:00
|
|
|
name_text_hold_callback = optionsutil.showValues,
|
2014-05-29 12:58:25 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name = "justification",
|
|
|
|
name_text = S.TEXT_ALIGN,
|
|
|
|
item_icons = {
|
|
|
|
"resources/icons/appbar.align.auto.png",
|
|
|
|
"resources/icons/appbar.align.left.png",
|
|
|
|
"resources/icons/appbar.align.center.png",
|
|
|
|
"resources/icons/appbar.align.right.png",
|
|
|
|
"resources/icons/appbar.align.justify.png",
|
|
|
|
},
|
|
|
|
values = {-1,0,1,2,3},
|
|
|
|
default_value = DKOPTREADER_CONFIG_JUSTIFICATION,
|
2014-08-05 04:04:17 +00:00
|
|
|
advanced = true,
|
2015-03-16 13:49:53 +00:00
|
|
|
enabled_func = function(configurable)
|
2018-05-26 17:45:37 +00:00
|
|
|
return optionsutil.enableIfEquals(configurable, "text_wrap", 1)
|
2015-03-16 13:49:53 +00:00
|
|
|
end,
|
2018-05-26 17:45:37 +00:00
|
|
|
labels = {S.AUTO, S.LEFT, S.CENTER, S.RIGHT, S.JUSTIFY},
|
|
|
|
name_text_hold_callback = optionsutil.showValues,
|
2014-05-29 12:58:25 +00:00
|
|
|
},
|
2014-03-13 13:52:43 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
icon = "resources/icons/appbar.text.size.large.png",
|
|
|
|
options = {
|
|
|
|
{
|
|
|
|
name = "font_size",
|
2014-06-02 14:55:41 +00:00
|
|
|
item_text = {"Aa","Aa","Aa","Aa","Aa","Aa","Aa","Aa"},
|
2014-03-13 13:52:43 +00:00
|
|
|
item_align_center = 1.0,
|
|
|
|
spacing = 15,
|
|
|
|
height = 60,
|
2014-06-02 14:55:41 +00:00
|
|
|
item_font_size = {24,28,32,34,36,38,42,46},
|
|
|
|
values = {0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.6, 2.0},
|
2014-03-13 13:52:43 +00:00
|
|
|
default_value = DKOPTREADER_CONFIG_FONT_SIZE,
|
|
|
|
event = "FontSizeUpdate",
|
2015-03-16 13:49:53 +00:00
|
|
|
enabled_func = function(configurable)
|
2018-05-26 17:45:37 +00:00
|
|
|
return optionsutil.enableIfEquals(configurable, "text_wrap", 1)
|
2015-03-16 13:49:53 +00:00
|
|
|
end,
|
2014-03-13 13:52:43 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name = "font_fine_tune",
|
|
|
|
name_text = S.FONTSIZE_FINE_TUNING,
|
2018-03-22 20:01:38 +00:00
|
|
|
toggle = Device:isTouchDevice() and {S.DECREASE, S.INCREASE} or nil,
|
|
|
|
item_text = not Device:isTouchDevice() and {S.DECREASE, S.INCREASE} or nil,
|
2014-03-13 13:52:43 +00:00
|
|
|
values = {-0.05, 0.05},
|
|
|
|
default_value = 0.05,
|
|
|
|
event = "FineTuningFontSize",
|
|
|
|
args = {-0.05, 0.05},
|
|
|
|
alternate = false,
|
2015-03-16 13:49:53 +00:00
|
|
|
enabled_func = function(configurable)
|
2018-05-26 17:45:37 +00:00
|
|
|
return optionsutil.enableIfEquals(configurable, "text_wrap", 1)
|
2015-03-16 13:49:53 +00:00
|
|
|
end,
|
2018-05-26 17:45:37 +00:00
|
|
|
name_text_hold_callback = function(configurable, __, prefix)
|
|
|
|
local opt = {
|
|
|
|
name = "font_size",
|
|
|
|
name_text = _("Font Size"),
|
|
|
|
}
|
|
|
|
optionsutil.showValues(configurable, opt, prefix)
|
|
|
|
end
|
2014-03-13 13:52:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
icon = "resources/icons/appbar.grade.b.large.png",
|
|
|
|
options = {
|
|
|
|
{
|
|
|
|
name = "contrast",
|
|
|
|
name_text = S.CONTRAST,
|
2017-11-04 14:31:41 +00:00
|
|
|
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,
|
2014-03-13 13:52:43 +00:00
|
|
|
default_value = DKOPTREADER_CONFIG_CONTRAST,
|
|
|
|
event = "GammaUpdate",
|
2017-11-04 14:31:41 +00:00
|
|
|
args = {0.8, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0, 9.0},
|
2018-05-26 17:45:37 +00:00
|
|
|
labels = {0.8, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0, 9.0},
|
|
|
|
name_text_hold_callback = optionsutil.showValues,
|
2014-03-13 13:52:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
icon = "resources/icons/appbar.settings.large.png",
|
|
|
|
options = {
|
|
|
|
{
|
|
|
|
name = "text_wrap",
|
2014-04-06 16:22:47 +00:00
|
|
|
name_text = S.REFLOW,
|
2014-03-13 13:52:43 +00:00
|
|
|
toggle = {S.ON, S.OFF},
|
|
|
|
values = {1, 0},
|
|
|
|
default_value = DKOPTREADER_CONFIG_TEXT_WRAP,
|
|
|
|
events = {
|
|
|
|
{
|
|
|
|
event = "RedrawCurrentPage",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
event = "RestoreZoomMode",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
event = "InitScrollPageStates",
|
|
|
|
},
|
2018-05-26 17:45:37 +00:00
|
|
|
},
|
|
|
|
name_text_hold_callback = optionsutil.showValues,
|
2014-03-13 13:52:43 +00:00
|
|
|
},
|
2014-04-06 16:22:47 +00:00
|
|
|
{
|
|
|
|
name = "page_opt",
|
|
|
|
name_text = S.DEWATERMARK,
|
|
|
|
toggle = {S.ON, S.OFF},
|
|
|
|
values = {1, 0},
|
|
|
|
default_value = 0,
|
2018-05-26 17:45:37 +00:00
|
|
|
name_text_hold_callback = optionsutil.showValues,
|
2018-07-04 10:08:55 +00:00
|
|
|
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.]]),
|
2014-04-06 16:22:47 +00:00
|
|
|
},
|
2014-03-13 13:52:43 +00:00
|
|
|
{
|
|
|
|
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,
|
2018-05-26 17:45:37 +00:00
|
|
|
name_text_hold_callback = optionsutil.showValues,
|
2018-07-04 10:08:55 +00:00
|
|
|
help_text = _([[(Used by the OCR engine.)]]),
|
2014-03-13 13:52:43 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name = "word_spacing",
|
|
|
|
name_text = S.WORD_GAP,
|
|
|
|
toggle = {S.SMALL, S.AUTO, S.LARGE},
|
2014-08-17 19:51:16 +00:00
|
|
|
values = DKOPTREADER_CONFIG_WORD_SPACINGS,
|
|
|
|
default_value = DKOPTREADER_CONFIG_DEFAULT_WORD_SPACING,
|
2015-03-16 13:49:53 +00:00
|
|
|
enabled_func = function(configurable)
|
2018-05-26 17:45:37 +00:00
|
|
|
return optionsutil.enableIfEquals(configurable, "text_wrap", 1)
|
2015-03-16 13:49:53 +00:00
|
|
|
end,
|
2018-05-26 17:45:37 +00:00
|
|
|
name_text_hold_callback = optionsutil.showValues,
|
2014-03-13 13:52:43 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name = "writing_direction",
|
|
|
|
name_text = S.WRITING_DIR,
|
|
|
|
toggle = {S.LTR, S.RTL, S.TBRTL},
|
|
|
|
values = {0, 1, 2},
|
|
|
|
default_value = 0,
|
2015-03-16 13:49:53 +00:00
|
|
|
enabled_func = function(configurable)
|
2018-05-26 17:45:37 +00:00
|
|
|
return optionsutil.enableIfEquals(configurable, "text_wrap", 1)
|
2015-03-16 13:49:53 +00:00
|
|
|
end,
|
2018-05-26 17:45:37 +00:00
|
|
|
name_text_hold_callback = optionsutil.showValues,
|
2014-03-13 13:52:43 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name = "quality",
|
|
|
|
name_text = S.RENDER_QUALITY,
|
|
|
|
toggle = {S.LOW, S.DEFAULT, S.HIGH},
|
|
|
|
values={0.5, 1.0, 1.5},
|
|
|
|
default_value = DKOPTREADER_CONFIG_RENDER_QUALITY,
|
2014-08-05 04:04:17 +00:00
|
|
|
advanced = true,
|
2015-03-16 13:49:53 +00:00
|
|
|
enabled_func = function(configurable)
|
2018-05-26 17:45:37 +00:00
|
|
|
return optionsutil.enableIfEquals(configurable, "text_wrap", 1)
|
2015-03-16 13:49:53 +00:00
|
|
|
end,
|
2018-05-26 17:45:37 +00:00
|
|
|
name_text_hold_callback = optionsutil.showValues,
|
Enable HW dithering in a few key places (#4541)
* Enable HW dithering on supported devices (Clara HD, Forma; Oasis 2, PW4)
* FileManager and co. (where appropriate, i.e., when covers are shown)
* Book Status
* Reader, where appropriate:
* CRe: on pages whith image content (for over 7.5% of the screen area, should hopefully leave stuff like bullet points or small scene breaks alone).
* Other engines: on user-request (in the gear tab of the bottom menu), via the new "Dithering" knob (will only appear on supported devices).
* ScreenSaver
* ImageViewer
* Minimize repaints when flash_ui is enabled (by, almost everywhere, only repainting the flashing element, and not the toplevel window which hosts it).
(The first pass of this involved fixing a few Button instances whose show_parent was wrong, in particular, chevrons in the FM & TopMenu).
* Hunted down a few redundant repaints (unneeded setDirty("all") calls),
either by switching the widget to nil when only a refresh was needed, and not a repaint,
or by passing the appropritate widget to setDirty.
(Note to self: Enable *verbose* debugging to catch broken setDirty calls via its post guard).
There were also a few instances of 'em right behind a widget close.
* Don't repaint the underlying widget when initially showing TopMenu & ConfigDialog.
We unfortunately do need to do it when switching tabs, because of their variable heights.
* On Kobo, disabled the extra and completely useless full refresh before suspend/reboot/poweroff, as well as on resume. No more double refreshes!
* Fix another debug guard in Kobo sysfs_light
* Switch ImageWidget & ImageViewer mostly to "ui" updates, which will be better suited to image content pretty much everywhere, REAGL or not.
PS: (Almost :100: commits! :D)
2019-02-07 00:14:37 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
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_text_hold_callback = optionsutil.showValues,
|
2014-03-13 13:52:43 +00:00
|
|
|
},
|
2014-07-17 14:32:20 +00:00
|
|
|
{
|
|
|
|
name = "forced_ocr",
|
|
|
|
name_text = S.FORCED_OCR,
|
|
|
|
toggle = {S.ON, S.OFF},
|
|
|
|
values = {1, 0},
|
|
|
|
default_value = 0,
|
|
|
|
advanced = true,
|
2018-05-26 17:45:37 +00:00
|
|
|
name_text_hold_callback = optionsutil.showValues,
|
2014-07-17 14:32:20 +00:00
|
|
|
},
|
2014-03-13 13:52:43 +00:00
|
|
|
{
|
|
|
|
name = "defect_size",
|
|
|
|
name_text = S.DEFECT_SIZE,
|
|
|
|
toggle = {S.SMALL, S.MEDIUM, S.LARGE},
|
|
|
|
values = {1.0, 3.0, 5.0},
|
|
|
|
default_value = DKOPTREADER_CONFIG_DEFECT_SIZE,
|
|
|
|
event = "DefectSizeUpdate",
|
|
|
|
show = false,
|
2015-03-16 13:49:53 +00:00
|
|
|
enabled_func = function(configurable)
|
2018-05-26 17:45:37 +00:00
|
|
|
return optionsutil.enableIfEquals(configurable, "text_wrap", 1)
|
2015-03-16 13:49:53 +00:00
|
|
|
end,
|
2018-05-26 17:45:37 +00:00
|
|
|
name_text_hold_callback = optionsutil.showValues,
|
2014-03-13 13:52:43 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name = "auto_straighten",
|
|
|
|
name_text = S.AUTO_STRAIGHTEN,
|
|
|
|
toggle = {S.ZERO_DEG, S.FIVE_DEG, S.TEN_DEG},
|
|
|
|
values = {0, 5, 10},
|
|
|
|
default_value = DKOPTREADER_CONFIG_AUTO_STRAIGHTEN,
|
|
|
|
show = false,
|
2015-03-16 13:49:53 +00:00
|
|
|
enabled_func = function(configurable)
|
2018-05-26 17:45:37 +00:00
|
|
|
return optionsutil.enableIfEquals(configurable, "text_wrap", 1)
|
2015-03-16 13:49:53 +00:00
|
|
|
end,
|
2018-05-26 17:45:37 +00:00
|
|
|
name_text_hold_callback = optionsutil.showValues,
|
2014-03-13 13:52:43 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name = "detect_indent",
|
|
|
|
name_text = S.INDENTATION,
|
|
|
|
toggle = {S.ON, S.OFF},
|
|
|
|
values = {1, 0},
|
|
|
|
default_value = DKOPTREADER_CONFIG_DETECT_INDENT,
|
|
|
|
show = false,
|
2015-03-16 13:49:53 +00:00
|
|
|
enabled_func = function(configurable)
|
2018-05-26 17:45:37 +00:00
|
|
|
return optionsutil.enableIfEquals(configurable, "text_wrap", 1)
|
2015-03-16 13:49:53 +00:00
|
|
|
end,
|
2018-05-26 17:45:37 +00:00
|
|
|
name_text_hold_callback = optionsutil.showValues,
|
2014-03-13 13:52:43 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
2013-04-08 14:26:54 +00:00
|
|
|
}
|
2013-10-18 20:38:07 +00:00
|
|
|
|
|
|
|
return KoptOptions
|