mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Highlight: add note marker (#9395)
This commit is contained in:
@@ -307,6 +307,13 @@ local highlight_style = {
|
||||
{_("Invert"), "invert"},
|
||||
}
|
||||
|
||||
local note_mark = {
|
||||
{_("None"), "none"},
|
||||
{_("Underline"), "underline"},
|
||||
{_("Side line"), "sideline"},
|
||||
{_("Side mark"), "sidemark"},
|
||||
}
|
||||
|
||||
local long_press_action = {
|
||||
{_("Ask with popup dialog"), "ask"},
|
||||
{_("Do nothing"), "nothing"},
|
||||
@@ -386,6 +393,47 @@ function ReaderHighlight:addToMainMenu(menu_items)
|
||||
UIManager:show(spin_widget)
|
||||
end,
|
||||
})
|
||||
table.insert(menu_items.highlight_options.sub_item_table, {
|
||||
text_func = function()
|
||||
local notemark = self.view.highlight.note_mark or "none"
|
||||
for __, v in ipairs(note_mark) do
|
||||
if v[2] == notemark then
|
||||
return T(_("Note marker: %1"), string.lower(v[1]))
|
||||
end
|
||||
end
|
||||
end,
|
||||
callback = function(touchmenu_instance)
|
||||
local notemark = self.view.highlight.note_mark or "none"
|
||||
local radio_buttons = {}
|
||||
for _, v in ipairs(note_mark) do
|
||||
table.insert(radio_buttons, {
|
||||
{
|
||||
text = v[1],
|
||||
checked = v[2] == notemark,
|
||||
provider = v[2],
|
||||
},
|
||||
})
|
||||
end
|
||||
UIManager:show(require("ui/widget/radiobuttonwidget"):new{
|
||||
title_text = _("Note marker"),
|
||||
width_factor = 0.5,
|
||||
keep_shown_on_apply = true,
|
||||
radio_buttons = radio_buttons,
|
||||
callback = function(radio)
|
||||
if radio.provider == "none" then
|
||||
self.view.highlight.note_mark = nil
|
||||
G_reader_settings:delSetting("highlight_note_marker")
|
||||
else
|
||||
self.view.highlight.note_mark = radio.provider
|
||||
G_reader_settings:saveSetting("highlight_note_marker", radio.provider)
|
||||
end
|
||||
self.view:setupNoteMarkPosition()
|
||||
UIManager:setDirty(self.dialog, "ui")
|
||||
if touchmenu_instance then touchmenu_instance:updateItems() end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
})
|
||||
if self.document.info.has_pages then
|
||||
menu_items.panel_zoom_options = {
|
||||
text = _("Panel zoom (manga/comic)"),
|
||||
|
||||
Reference in New Issue
Block a user