Rotation icons: make 'em dynamic. (#7440)

Followup to #7306.

As discussed there, the only way to make everybody happy is to make 'em context-aware. At which point, trying to make the fact that it's a *device* rotation and not a *content* one come across in the icon design loses its interest, and would actually only further muddy the issue.

So, these are similar is spirit to the traditional rotation icons in pretty much anything that can rotate text content, with a special inspiration from the Kindle 4 & PocketBook UI.

Fix #7429
This commit is contained in:
NiLuJe
2021-03-29 05:12:22 +02:00
committed by GitHub
parent f3341d9dc0
commit e33476996a
11 changed files with 771 additions and 21 deletions

View File

@@ -22,19 +22,48 @@ local CreOptions = {
{
name = "rotation_mode",
name_text = _("Rotation"),
item_icons = {
"rotation.90CCW",
"rotation.0UR",
"rotation.90CW",
"rotation.180UD",
},
item_icons_func = function()
if Screen:getRotationMode() == Screen.ORIENTATION_PORTRAIT then
-- P, 0UR
return {
"rotation.P.90CCW",
"rotation.P.0UR",
"rotation.P.90CW",
"rotation.P.180UD",
}
elseif Screen:getRotationMode() == Screen.ORIENTATION_PORTRAIT_ROTATED then
-- P, 180UD
return {
"rotation.P.90CW",
"rotation.P.180UD",
"rotation.P.90CCW",
"rotation.P.0UR",
}
elseif Screen:getRotationMode() == Screen.ORIENTATION_LANDSCAPE then
-- L, 90CW
return {
"rotation.L.90CCW",
"rotation.L.0UR",
"rotation.L.90CW",
"rotation.L.180UD",
}
else
-- L, 90CCW
return {
"rotation.L.90CW",
"rotation.L.180UD",
"rotation.L.90CCW",
"rotation.L.0UR",
}
end
end,
-- For Dispatcher'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},
args = {Screen.ORIENTATION_LANDSCAPE_ROTATED, Screen.ORIENTATION_PORTRAIT, Screen.ORIENTATION_LANDSCAPE, Screen.ORIENTATION_PORTRAIT_ROTATED},
default_arg = 0,
current_func = function() return Device.screen:getRotationMode() end,
current_func = function() return Screen:getRotationMode() end,
event = "SetRotationMode",
name_text_hold_callback = optionsutil.showValues,
},
@@ -50,7 +79,7 @@ local CreOptions = {
--[[ Commented out, to have it also available in portrait mode
current_func = function()
-- If not in landscape mode, shows "1" as selected
if Device.screen:getScreenMode() ~= "landscape" then
if Screen:getScreenMode() ~= "landscape" then
return 1
end
-- if we return nil, ConfigDialog will pick the one from the
@@ -59,7 +88,7 @@ local CreOptions = {
]]--
enabled_func = function(configurable)
return optionsutil.enableIfEquals(configurable, "view_mode", 0) -- "page" mode
-- and Device.screen:getScreenMode() == "landscape"
-- and Screen:getScreenMode() == "landscape"
end,
name_text_hold_callback = optionsutil.showValues,
help_text = _([[Render the document on half the screen width and display two pages at once with a single page number. This makes it look like two columns.
@@ -602,7 +631,7 @@ Whether enabled or disabled, KOReader's own status bar at the bottom of the scre
args = {true, false},
default_arg = nil,
event = "ToggleNightmodeImages",
show_func = function() return Device.screen.night_mode end,
show_func = function() return Screen.night_mode end,
name_text_hold_callback = optionsutil.showValues,
help_text = _([[Disable the automagic inversion of images when nightmode is enabled. Useful if your book contains mainly inlined mathematical content or scene break art.]]),
},