mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Merge pull request #1178 from erosennin/show-current-settings
Show current font face and hyphenation dictionary in menu
This commit is contained in:
@@ -57,6 +57,9 @@ function ReaderFont:init()
|
||||
hold_callback = function()
|
||||
self:makeDefault(v)
|
||||
end,
|
||||
checked_func = function()
|
||||
return v == self.font_face
|
||||
end
|
||||
})
|
||||
face_list[k] = {text = v}
|
||||
end
|
||||
|
||||
@@ -6,24 +6,12 @@ local _ = require("gettext")
|
||||
local ReaderHyphenation = InputContainer:new{
|
||||
hyph_menu_title = _("Hyphenation"),
|
||||
hyph_table = nil,
|
||||
cur_hyph_idx = nil,
|
||||
}
|
||||
|
||||
function ReaderHyphenation:_changeSel(k)
|
||||
if self.cur_hyph_idx then
|
||||
self.hyph_table[self.cur_hyph_idx].selected = false
|
||||
end
|
||||
self.hyph_table[k].selected = true
|
||||
self.cur_hyph_idx = k
|
||||
end
|
||||
|
||||
function ReaderHyphenation:init()
|
||||
self.hyph_table = {}
|
||||
self.hyph_alg = cre.getSelectedHyphDict()
|
||||
for k,v in ipairs(cre.getHyphDictList()) do
|
||||
if v == self.hyph_alg then
|
||||
self.cur_hyph_idx = k
|
||||
end
|
||||
table.insert(self.hyph_table, {
|
||||
text = v,
|
||||
callback = function()
|
||||
@@ -31,9 +19,11 @@ function ReaderHyphenation:init()
|
||||
UIManager:show(InfoMessage:new{
|
||||
text = _("Change Hyphenation to ")..v,
|
||||
})
|
||||
self:_changeSel(k)
|
||||
self.ui.document:setHyphDictionary(v)
|
||||
self.ui.toc:onUpdateToc()
|
||||
end,
|
||||
checked_func = function()
|
||||
return v == self.hyph_alg
|
||||
end
|
||||
})
|
||||
end
|
||||
@@ -46,11 +36,6 @@ function ReaderHyphenation:onReadSettings(config)
|
||||
self.ui.document:setHyphDictionary(hyph_alg)
|
||||
end
|
||||
self.hyph_alg = cre.getSelectedHyphDict()
|
||||
for k,v in ipairs(self.hyph_table) do
|
||||
if v.text == self.hyph_alg then
|
||||
self:_changeSel(k)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ReaderHyphenation:onSaveSettings()
|
||||
|
||||
Reference in New Issue
Block a user