KOPT bottom menu: hide it when applying Zoom options

reviewable/pr7137/r1
poire-z 3 years ago
parent b92c078e9c
commit 9b11497652

@ -200,7 +200,7 @@ function ReaderZooming:onZoom(direction)
return true return true
end end
function ReaderZooming:onDefineZoom(btn) function ReaderZooming:onDefineZoom(btn, when_applied_callback)
local config = self.ui.document.configurable local config = self.ui.document.configurable
local settings = ({ local settings = ({
[7] = {right_to_left = false, zoom_bottom_to_top = false, zoom_direction_vertical = false}, [7] = {right_to_left = false, zoom_bottom_to_top = false, zoom_direction_vertical = false},
@ -281,9 +281,10 @@ function ReaderZooming:onDefineZoom(btn)
btn == "columns" and settings.zoom_overlap_h or settings.zoom_overlap_v btn == "columns" and settings.zoom_overlap_h or settings.zoom_overlap_v
) )
end end
if tonumber(btn) then if when_applied_callback then
-- Provided when hide_on_apply, and ConfigDialog temporarily hidden:
-- show an InfoMessage with the values, and call when_applied_callback on dismiss
UIManager:show(InfoMessage:new{ UIManager:show(InfoMessage:new{
timeout = 2,
text = T(_([[Zoom set to: text = T(_([[Zoom set to:
mode: %1 mode: %1
@ -298,6 +299,7 @@ function ReaderZooming:onDefineZoom(btn)
("%.2f"):format(self:getNumberOf("rows", settings.zoom_overlap_v)), ("%.2f"):format(self:getNumberOf("rows", settings.zoom_overlap_v)),
settings.zoom_overlap_v, settings.zoom_overlap_v,
("%.2f"):format(self:getNumberOf("columns"))), ("%.2f"):format(self:getNumberOf("columns"))),
dismiss_callback = when_applied_callback,
}) })
end end
end end

@ -94,6 +94,7 @@ In 'semi-auto' and 'manual' modes, you may need to define areas once on an odd p
event = "DefineZoom", event = "DefineZoom",
args = {0, 12, 24, 36, 48, 60, 72, 84}, args = {0, 12, 24, 36, 48, 60, 72, 84},
labels = {0, 12, 24, 36, 48, 60, 72, 84}, labels = {0, 12, 24, 36, 48, 60, 72, 84},
hide_on_apply = true,
name_text_hold_callback = optionsutil.showValues, name_text_hold_callback = optionsutil.showValues,
help_text = _([[Set horizontal zoom overlap (between columns).]]), help_text = _([[Set horizontal zoom overlap (between columns).]]),
}, },
@ -111,6 +112,7 @@ In 'semi-auto' and 'manual' modes, you may need to define areas once on an odd p
event = "DefineZoom", event = "DefineZoom",
args = {0, 12, 24, 36, 48, 60, 72, 84}, args = {0, 12, 24, 36, 48, 60, 72, 84},
labels = {0, 12, 24, 36, 48, 60, 72, 84}, labels = {0, 12, 24, 36, 48, 60, 72, 84},
hide_on_apply = true,
name_text_hold_callback = optionsutil.showValues, name_text_hold_callback = optionsutil.showValues,
help_text = _([[Set vertical zoom overlap (between lines).]]), help_text = _([[Set vertical zoom overlap (between lines).]]),
}, },
@ -156,6 +158,7 @@ In 'semi-auto' and 'manual' modes, you may need to define areas once on an odd p
end, end,
event = "DefineZoom", event = "DefineZoom",
args = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0}, args = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0},
hide_on_apply = true,
name_text_hold_callback = optionsutil.showValues, name_text_hold_callback = optionsutil.showValues,
help_text = _([[Set the number of columns or rows into which to split the page.]]), help_text = _([[Set the number of columns or rows into which to split the page.]]),
}, },
@ -181,6 +184,7 @@ In 'semi-auto' and 'manual' modes, you may need to define areas once on an odd p
end, end,
event = "DefineZoom", event = "DefineZoom",
args = {0.7, 1.0, 1.5, 2.0, 3.0, 5.0, 10.0, 20.0}, args = {0.7, 1.0, 1.5, 2.0, 3.0, 5.0, 10.0, 20.0},
hide_on_apply = true,
name_text_hold_callback = optionsutil.showValues, name_text_hold_callback = optionsutil.showValues,
}, },
{ {
@ -222,6 +226,7 @@ In 'semi-auto' and 'manual' modes, you may need to define areas once on an odd p
default_value = 7, default_value = 7,
event = "DefineZoom", event = "DefineZoom",
args = {7, 6, 5, 4, 3, 2, 1, 0}, args = {7, 6, 5, 4, 3, 2, 1, 0},
hide_on_apply = true,
name_text_hold_callback = optionsutil.showValues, name_text_hold_callback = optionsutil.showValues,
help_text = _([[Set how paging and swiping forward should move the view on the page: help_text = _([[Set how paging and swiping forward should move the view on the page:
left to right or reverse, top to bottom or reverse.]]), left to right or reverse, top to bottom or reverse.]]),

Loading…
Cancel
Save