ReaderZooming: Fix defaults handling (#7463)

It appears the fancy split settings from #6885 were not being honored at all.

Also:

* Made sure "pagewidth" is actually the default zoom mode again, "full" had sneaked in as the default state of the zoom type toggle).
* Display human-readable values in the "Make as default" popup, instead of the raw, meaningless numerical setting.
* Disable zoom options when reflow is enabled, and restore 'em properly when it's disabled.

Fix #7461, #7228, #7192
This commit is contained in:
NiLuJe
2021-03-30 18:47:52 +02:00
committed by GitHub
parent b9ffc3d05b
commit f0f69e9a7a
5 changed files with 87 additions and 23 deletions

View File

@@ -57,7 +57,7 @@ local CreOptions = {
}
end
end,
-- For Dispatcher's sake
-- For Dispatcher & onMakeDefault's sake
labels = {C_("Rotation", "⤹ 90°"), C_("Rotation", "↑ 0°"), C_("Rotation", "⤸ 90°"), C_("Rotation", "↓ 180°")},
alternate = false,
values = {Screen.ORIENTATION_LANDSCAPE_ROTATED, Screen.ORIENTATION_PORTRAIT, Screen.ORIENTATION_LANDSCAPE, Screen.ORIENTATION_PORTRAIT_ROTATED},

View File

@@ -64,7 +64,7 @@ local KoptOptions = {
}
end
end,
-- For Dispatcher's sake
-- For Dispatcher & onMakeDefault's sake
labels = {C_("Rotation", "⤹ 90°"), C_("Rotation", "↑ 0°"), C_("Rotation", "⤸ 90°"), C_("Rotation", "↓ 180°")},
alternate = false,
values = {Screen.ORIENTATION_LANDSCAPE_ROTATED, Screen.ORIENTATION_PORTRAIT, Screen.ORIENTATION_LANDSCAPE, Screen.ORIENTATION_PORTRAIT_ROTATED},
@@ -119,6 +119,10 @@ In 'semi-auto' and 'manual' modes, you may need to define areas once on an odd p
{
name = "zoom_overlap_h",
name_text = _("Horizontal overlap"),
enabled_func = function(configurable, document)
-- NOTE: document.is_reflowable is wonky as hell, don't trust it.
return optionsutil.enableIfEquals(configurable, "text_wrap", 0)
end,
buttonprogress = true,
fine_tune = true,
values = {0, 12, 24, 36, 48, 60, 72, 84},
@@ -137,6 +141,10 @@ In 'semi-auto' and 'manual' modes, you may need to define areas once on an odd p
{
name = "zoom_overlap_v",
name_text = _("Vertical overlap"),
enabled_func = function(configurable, document)
-- NOTE: document.is_reflowable is wonky as hell, don't trust it.
return optionsutil.enableIfEquals(configurable, "text_wrap", 0)
end,
buttonprogress = true,
fine_tune = true,
values = {0, 12, 24, 36, 48, 60, 72, 84},
@@ -155,10 +163,14 @@ In 'semi-auto' and 'manual' modes, you may need to define areas once on an odd p
{
name = "zoom_mode_type",
name_text = _("Fit"),
enabled_func = function(configurable, document)
-- NOTE: document.is_reflowable is wonky as hell, don't trust it.
return optionsutil.enableIfEquals(configurable, "text_wrap", 0)
end,
toggle = {_("full"), _("width"), _("height")},
alternate = false,
values = {2, 1, 0},
default_value = 2,
default_value = 1,
show_func = function(config) return config and config.zoom_mode_genus > 2 end,
event = "DefineZoom",
args = {"full", "width", "height"},
@@ -176,6 +188,10 @@ In 'semi-auto' and 'manual' modes, you may need to define areas once on an odd p
return _("Number")
end,
name_text_true_values = true,
enabled_func = function(configurable, document)
-- NOTE: document.is_reflowable is wonky as hell, don't trust it.
return optionsutil.enableIfEquals(configurable, "text_wrap", 0)
end,
show_true_value_func = function(str)
return string.format("%.1f", str)
end,
@@ -202,6 +218,10 @@ In 'semi-auto' and 'manual' modes, you may need to define areas once on an odd p
name = "zoom_factor",
name_text = _("Zoom factor"),
name_text_true_values = true,
enabled_func = function(configurable, document)
-- NOTE: document.is_reflowable is wonky as hell, don't trust it.
return optionsutil.enableIfEquals(configurable, "text_wrap", 0)
end,
show_true_value_func = function(str)
return string.format("%.1f", str)
end,
@@ -226,6 +246,10 @@ In 'semi-auto' and 'manual' modes, you may need to define areas once on an odd p
{
name = "zoom_mode_genus",
name_text = _("Zoom to"),
enabled_func = function(configurable, document)
-- NOTE: document.is_reflowable is wonky as hell, don't trust it.
return optionsutil.enableIfEquals(configurable, "text_wrap", 0)
end,
-- toggle = {_("page"), _("content"), _("columns"), _("rows"), _("manual")},
item_icons = {
"zoom.page",
@@ -236,6 +260,7 @@ In 'semi-auto' and 'manual' modes, you may need to define areas once on an odd p
},
alternate = false,
values = {4, 3, 2, 1, 0},
labels = {_("page"), _("content"), _("columns"), _("rows"), _("manual")},
default_value = 4,
event = "DefineZoom",
args = {"page", "content", "columns", "rows", "manual"},
@@ -245,7 +270,7 @@ In 'semi-auto' and 'manual' modes, you may need to define areas once on an odd p
name = "zoom_direction",
name_text = _("Direction"),
enabled_func = function(config)
return config.zoom_mode_genus < 3
return optionsutil.enableIfEquals(config, "text_wrap", 0) and config.zoom_mode_genus < 3
end,
item_icons = {
"direction.LRTB",
@@ -259,6 +284,16 @@ In 'semi-auto' and 'manual' modes, you may need to define areas once on an odd p
},
alternate = false,
values = {7, 6, 5, 4, 3, 2, 1, 0},
labels = {
_("Left to Right, Top to Bottom"),
_("Top to Bottom, Left to Right"),
_("Left to Right, Bottom to Top"),
_("Bottom to Top, Left to Right"),
_("Bottom to Top, Right to Left"),
_("Right to Left, Bottom to Top"),
_("Top to Bottom, Right to Left"),
_("Right to Left, Top to Bottom"),
},
default_value = 7,
event = "DefineZoom",
args = {7, 6, 5, 4, 3, 2, 1, 0},
@@ -574,7 +609,7 @@ This can also be used to remove some gray background or to convert a grayscale o
"column.two",
"column.three",
},
values = {1,2,3},
values = {1, 2, 3},
default_value = DKOPTREADER_CONFIG_MAX_COLUMNS,
enabled_func = function(configurable)
return optionsutil.enableIfEquals(configurable, "text_wrap", 1)