Invert progress bar direction, independently of UI layout (LTR/RTL) (#13382)

This commit is contained in:
David authored and GitHub committed 2025-08-29 08:13:01 +02:00
1 parent 1ad234d754
commit 6c25d045eb
7 files changed
+164 -17

No files matched your search

@@ -213,6 +213,7 @@ function ReaderMenu:setUpdateItemTable()
{
text = _("Save document settings as default"),
keep_menu_open = true,
separator = true,
callback = function()
UIManager:show(ConfirmBox:new{
text = _("Save current document settings as default values?"),
@@ -230,6 +231,51 @@ function ReaderMenu:setUpdateItemTable()
},
}
if not Device:isTouchDevice() then
-- This menu entry is a duplicate of the one found in page_turns for touch devices
-- but we need to add it here for non-touch devices.
table.insert(self.menu_items.document_settings.sub_item_table, {
text_func = function()
local text = _("Invert document-related dialogs")
if G_reader_settings:isTrue("invert_ui_layout") then
text = text .. " ★"
end
return text
end,
checked_func = function()
return self.view:shouldInvertBiDiLayoutMirroring()
end,
callback = function()
UIManager:broadcastEvent(Event:new("ToggleUILayoutMiroring"))
end,
hold_callback = function(touchmenu_instance)
local invert_ui_layout = G_reader_settings:isTrue("invert_ui_layout")
local MultiConfirmBox = require("ui/widget/multiconfirmbox")
UIManager:show(MultiConfirmBox:new{
text = invert_ui_layout and _("The default (★) for newly opened books is to Invert document-related dialogs.\n\nWould you like to change it?")
or _("The default (★) for newly opened books is not to Invert document-related dialogs.\n\nWould you like to change it?"),
choice1_text_func = function()
return invert_ui_layout and _("Don't invert") or _("Don't invert") .." (★)"
end,
choice1_callback = function()
G_reader_settings:makeFalse("invert_ui_layout")
if touchmenu_instance then touchmenu_instance:updateItems() end
end,
choice2_text_func = function()
return invert_ui_layout and _("Invert") .." (★)" or _("Invert")
end,
choice2_callback = function()
G_reader_settings:makeTrue("invert_ui_layout")
if touchmenu_instance then touchmenu_instance:updateItems() end
end,
})
end,
help_text = _([[
When enabled the UI direction for the Table of Contents, Book Map, and Page Browser dialogs will mirror the default UI direction.
Useful when used alongside 'Invert page turns'.]]),
})
end
self.menu_items.page_overlap = dofile("frontend/ui/elements/page_overlap.lua")
-- settings tab