2013-10-18 20:38:07 +00:00
|
|
|
local EventListener = require("ui/widget/eventlistener")
|
2013-03-12 12:28:01 +00:00
|
|
|
|
2013-10-18 20:38:07 +00:00
|
|
|
local ReaderHinting = EventListener:new{
|
2014-03-13 13:52:43 +00:00
|
|
|
hinting_states = {}
|
2013-03-12 12:28:01 +00:00
|
|
|
}
|
|
|
|
|
2013-09-14 07:27:11 +00:00
|
|
|
function ReaderHinting:onHintPage()
|
2014-03-13 13:52:43 +00:00
|
|
|
if not self.view.hinting then return true end
|
|
|
|
for i=1, DHINTCOUNT do
|
2016-02-06 21:01:45 +00:00
|
|
|
if self.view.state.page + i <= self.document.info.number_of_pages then
|
|
|
|
self.document:hintPage(
|
2014-03-13 13:52:43 +00:00
|
|
|
self.view.state.page + i,
|
|
|
|
self.zoom:getZoom(self.view.state.page + i),
|
|
|
|
self.view.state.rotation,
|
|
|
|
self.view.state.gamma,
|
|
|
|
self.view.render_mode)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return true
|
2013-09-14 07:27:11 +00:00
|
|
|
end
|
|
|
|
|
2013-03-12 12:28:01 +00:00
|
|
|
function ReaderHinting:onSetHinting(hinting)
|
2014-03-13 13:52:43 +00:00
|
|
|
self.view.hinting = hinting
|
2013-03-12 12:28:01 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function ReaderHinting:onDisableHinting()
|
2014-03-13 13:52:43 +00:00
|
|
|
table.insert(self.hinting_states, self.view.hinting)
|
|
|
|
self.view.hinting = false
|
|
|
|
return true
|
2013-03-12 12:28:01 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function ReaderHinting:onRestoreHinting()
|
2014-03-13 13:52:43 +00:00
|
|
|
self.view.hinting = table.remove(self.hinting_states)
|
|
|
|
return true
|
2013-09-14 07:27:11 +00:00
|
|
|
end
|
2013-10-18 20:38:07 +00:00
|
|
|
|
|
|
|
return ReaderHinting
|