indicate current highlight mode in submenu

pull/594/head
chrox 10 years ago
parent 3843459a97
commit 3726e096f9

@ -71,9 +71,7 @@ end
function ReaderHighlight:addToMainMenu(tab_item_table) function ReaderHighlight:addToMainMenu(tab_item_table)
-- insert table to main reader menu -- insert table to main reader menu
table.insert(tab_item_table.typeset, { table.insert(tab_item_table.typeset, {
text_func = function() text = _("Set highlight drawer "),
return _("Set highlight drawer ").."( "..self.view.highlight.saved_drawer.." )"
end,
sub_item_table = self:genHighlightDrawerMenu(), sub_item_table = self:genHighlightDrawerMenu(),
}) })
end end
@ -82,18 +80,27 @@ function ReaderHighlight:genHighlightDrawerMenu()
return { return {
{ {
text = _("Lighten"), text = _("Lighten"),
enabled_func = function()
return self.view.highlight.saved_drawer ~= "lighten"
end,
callback = function() callback = function()
self.view.highlight.saved_drawer = "lighten" self.view.highlight.saved_drawer = "lighten"
end end
}, },
{ {
text = _("Underscore"), text = _("Underscore"),
enabled_func = function()
return self.view.highlight.saved_drawer ~= "underscore"
end,
callback = function() callback = function()
self.view.highlight.saved_drawer = "underscore" self.view.highlight.saved_drawer = "underscore"
end end
}, },
{ {
text = _("Invert"), text = _("Invert"),
enabled_func = function()
return self.view.highlight.saved_drawer ~= "invert"
end,
callback = function() callback = function()
self.view.highlight.saved_drawer = "invert" self.view.highlight.saved_drawer = "invert"
end end
@ -129,8 +136,8 @@ end
local function inside_box(pos, box) local function inside_box(pos, box)
if pos then if pos then
local x, y = pos.x, pos.y local x, y = pos.x, pos.y
if box.x <= x and box.y <= y if box.x <= x and box.y <= y
and box.x + box.w >= x and box.x + box.w >= x
and box.y + box.h >= y then and box.y + box.h >= y then
return true return true
end end
@ -401,7 +408,7 @@ function ReaderHighlight:moreAction()
end end
function ReaderHighlight:deleteHighlight(page, i) function ReaderHighlight:deleteHighlight(page, i)
DEBUG("delete highlight") DEBUG("delete highlight")
table.remove(self.view.highlight.saved[page], i) table.remove(self.view.highlight.saved[page], i)
end end

Loading…
Cancel
Save