From f00599ead92bbffcee5d47613c3cc9f19a9f6a30 Mon Sep 17 00:00:00 2001 From: poire-z Date: Sun, 13 May 2018 21:08:09 +0200 Subject: [PATCH 1/2] Re-order typeset menu And add symbols for default and fallback to the Hyphenation menu, as it was done recently to the Font menu. --- .../apps/reader/modules/readerhyphenation.lua | 18 +++++++++++++++--- frontend/ui/elements/reader_menu_order.lua | 10 +++++----- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/frontend/apps/reader/modules/readerhyphenation.lua b/frontend/apps/reader/modules/readerhyphenation.lua index 8e35d7ef7fdc..a3f925dbe502 100644 --- a/frontend/apps/reader/modules/readerhyphenation.lua +++ b/frontend/apps/reader/modules/readerhyphenation.lua @@ -64,7 +64,16 @@ function ReaderHyphenation:init() for k,v in ipairs(lang_data) do self.hyph_algs_settings[v.filename] = v -- just store full table table.insert(self.hyph_table, { - text = v.name, + text_func = function() + local text = v.name + if v.filename == G_reader_settings:readSetting("hyph_alg_default") then + text = text .. " ★" + end + if v.filename == G_reader_settings:readSetting("hyph_alg_fallback") then + text = text .. " �" + end + return text + end, callback = function() self.hyph_alg = v.filename self.ui.doc_settings:saveSetting("hyph_alg", self.hyph_alg) @@ -79,23 +88,26 @@ function ReaderHyphenation:init() -- signal readerrolling to update pos in new height, and redraw page self.ui:handleEvent(Event:new("UpdatePos")) end, - hold_callback = function() + hold_may_update_menu = true, + hold_callback = function(refresh_menu_func) UIManager:show(MultiConfirmBox:new{ -- No real need for a way to remove default one, we can just -- toggle between setting a default OR a fallback (if a default -- one is set, no fallback will ever be used - if a fallback one -- is set, no default is wanted; so when we set one below, we -- remove the other). - text = T( _("Set default or fallback hyphenation pattern to %1?\nDefault will always take precedence while fallback will only be used if the language of the book can't be automatically determined."), v.name), + text = T( _("Would you like %1 to be used as the default (★) or fallback (�) hyphenation language?\n\nDefault will always take precedence while fallback will only be used if the language of the book can't be automatically determined."), v.name), choice1_text = _("Default"), choice1_callback = function() G_reader_settings:saveSetting("hyph_alg_default", v.filename) G_reader_settings:delSetting("hyph_alg_fallback") + if refresh_menu_func then refresh_menu_func() end end, choice2_text = _("Fallback"), choice2_callback = function() G_reader_settings:saveSetting("hyph_alg_fallback", v.filename) G_reader_settings:delSetting("hyph_alg_default") + if refresh_menu_func then refresh_menu_func() end end, }) end, diff --git a/frontend/ui/elements/reader_menu_order.lua b/frontend/ui/elements/reader_menu_order.lua index b1354e6d7a12..62c0b6040476 100644 --- a/frontend/ui/elements/reader_menu_order.lua +++ b/frontend/ui/elements/reader_menu_order.lua @@ -20,17 +20,17 @@ local order = { "follow_links", }, typeset = { - "page_overlap", - "switch_zoom_mode", + "highlight_options", + "----------------------------", "set_render_style", "style_tweaks", "----------------------------", - "highlight_options", - "----------------------------", - "floating_punctuation", "change_font", "hyphenation", + "floating_punctuation", "----------------------------", + "switch_zoom_mode", + "page_overlap", "speed_reading_module_perception_expander", }, setting = { From 02d6b23aa4f054e1dd2afcb42f7e5c1913e8f2af Mon Sep 17 00:00:00 2001 From: poire-z Date: Sun, 13 May 2018 22:12:13 +0200 Subject: [PATCH 2/2] move Highlighting to bottom --- frontend/ui/elements/reader_menu_order.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/ui/elements/reader_menu_order.lua b/frontend/ui/elements/reader_menu_order.lua index 62c0b6040476..8da31a21fd1a 100644 --- a/frontend/ui/elements/reader_menu_order.lua +++ b/frontend/ui/elements/reader_menu_order.lua @@ -20,8 +20,6 @@ local order = { "follow_links", }, typeset = { - "highlight_options", - "----------------------------", "set_render_style", "style_tweaks", "----------------------------", @@ -30,8 +28,11 @@ local order = { "floating_punctuation", "----------------------------", "switch_zoom_mode", + "----------------------------", "page_overlap", "speed_reading_module_perception_expander", + "----------------------------", + "highlight_options", }, setting = { "read_from_right_to_left",