add simple readerhyphenation menu

pull/72/head
Qingping Hou 11 years ago
parent 92cbbabbcf
commit 3ab79f69e9

@ -0,0 +1,38 @@
ReaderHyphenation = InputContainer:new{
hyph_menu_title = _("Hyphenation"),
hyph_table = nil,
cur_hyph_idx = nil,
}
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()
self.cur_hyph_idx = k
self.hyph_alg = v
UIManager:show(InfoMessage:new{
text = _("Change Hyphenation to ")..v,
})
self.hyph_table[k].selected = true
self.hyph_table[self.cur_hyph_idx].selected = false
cre.setHyphDictionary(v)
end
})
end
self.ui.menu:registerToMainMenu(self)
end
function ReaderHyphenation:addToMainMenu(tab_item_table)
-- insert table to main reader menu
table.insert(tab_item_table.typeset, {
text = self.hyph_menu_title,
sub_item_table = self.hyph_table,
})
end

@ -16,6 +16,7 @@ require "ui/reader/readercopt"
require "ui/reader/readerhinting"
require "ui/reader/readerscreenshot"
require "ui/reader/readerfrontlight"
require "ui/reader/readerhyphenation"
--[[
This is an abstraction for a reader interface
@ -175,6 +176,12 @@ function ReaderUI:init()
ui = self
}
table.insert(self, typeset)
table.insert(self, ReaderHyphenation:new{
dialog = self.dialog,
view = self[1],
ui = self
})
end
if self.document.info.configurable then
-- configurable controller

Loading…
Cancel
Save