mirror of
https://github.com/koreader/koreader.git
synced 2025-12-18 12:02:09 +01:00
Bidi: add Bidi.invert()
This commit is contained in:
committed by
Frans de Jonge
parent
62c6c757cc
commit
42dd5aadca
@@ -43,6 +43,7 @@ local _ = require("gettext")
|
|||||||
local Bidi = {
|
local Bidi = {
|
||||||
_mirrored_ui_layout = false,
|
_mirrored_ui_layout = false,
|
||||||
_rtl_ui_text = false,
|
_rtl_ui_text = false,
|
||||||
|
_inverted = false,
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Setup UI mirroring and RTL text for UI language
|
-- Setup UI mirroring and RTL text for UI language
|
||||||
@@ -126,6 +127,22 @@ function Bidi.mirroredUILayout()
|
|||||||
return Bidi._mirrored_ui_layout
|
return Bidi._mirrored_ui_layout
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- This fuction can be used by document widgets to temporarily match a widget
|
||||||
|
-- to the document page turn direction instead of the UI layout direction.
|
||||||
|
function Bidi.invert()
|
||||||
|
if G_reader_settings:isTrue("invert_ui_layout_mirroring") and not Bidi._inverted then
|
||||||
|
Bidi._mirrored_ui_layout = not Bidi._mirrored_ui_layout
|
||||||
|
Bidi._inverted = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function Bidi.resetInvert()
|
||||||
|
if Bidi._inverted then
|
||||||
|
Bidi._mirrored_ui_layout = not Bidi._mirrored_ui_layout
|
||||||
|
Bidi._inverted = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- This function might only be useful in some rare cases (RTL text
|
-- This function might only be useful in some rare cases (RTL text
|
||||||
-- is handled directly by TextWidget and TextBoxWidget)
|
-- is handled directly by TextWidget and TextBoxWidget)
|
||||||
function Bidi.rtlUIText()
|
function Bidi.rtlUIText()
|
||||||
|
|||||||
@@ -122,6 +122,21 @@ local PageTurns = {
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text = _("Also invert document-related dialogs"),
|
||||||
|
checked_func = function()
|
||||||
|
return G_reader_settings:isTrue("invert_ui_layout_mirroring")
|
||||||
|
end,
|
||||||
|
enabled_func = function()
|
||||||
|
return ReaderUI.instance.view.inverse_reading_order
|
||||||
|
end,
|
||||||
|
callback = function()
|
||||||
|
G_reader_settings:flipNilOrFalse("invert_ui_layout_mirroring")
|
||||||
|
end,
|
||||||
|
help_text = _([[
|
||||||
|
When enabled the UI direction for the Table of Contents, Book Map, and Page Browser dialogs will follow the page turn direction instead of the default UI direction.]]),
|
||||||
|
separator = true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user