2013-10-18 20:38:07 +00:00
|
|
|
local LeftContainer = require("ui/widget/container/leftcontainer")
|
|
|
|
local ImageWidget = require("ui/widget/imagewidget")
|
|
|
|
local Geom = require("ui/geometry")
|
|
|
|
local Screen = require("ui/screen")
|
2013-03-03 14:23:28 +00:00
|
|
|
|
2013-10-18 20:38:07 +00:00
|
|
|
local ReaderFlipping = LeftContainer:new{
|
2013-03-31 13:37:57 +00:00
|
|
|
orig_reflow_mode = 0,
|
|
|
|
}
|
2013-03-03 14:23:28 +00:00
|
|
|
|
|
|
|
function ReaderFlipping:init()
|
|
|
|
local widget = ImageWidget:new{
|
|
|
|
file = "resources/icons/appbar.book.open.png",
|
|
|
|
}
|
|
|
|
local icon_size = widget:getSize()
|
|
|
|
self.dimen = Geom:new{w = Screen:getWidth(), h = icon_size.h}
|
|
|
|
self[1] = widget
|
|
|
|
end
|
|
|
|
|
2013-03-31 13:37:57 +00:00
|
|
|
function ReaderFlipping:onSetFlippingMode(flipping_mode)
|
|
|
|
if flipping_mode then
|
|
|
|
self.orig_reflow_mode = self.view.document.configurable.text_wrap
|
2013-06-26 07:51:12 +00:00
|
|
|
self.orig_scroll_mode = self.view.page_scroll
|
2013-03-31 13:37:57 +00:00
|
|
|
self.view.document.configurable.text_wrap = 0
|
2013-06-26 07:51:12 +00:00
|
|
|
self.view.page_scroll = false
|
2013-03-31 13:37:57 +00:00
|
|
|
else
|
|
|
|
self.view.document.configurable.text_wrap = self.orig_reflow_mode
|
2013-06-26 07:51:12 +00:00
|
|
|
self.view.page_scroll = self.orig_scroll_mode
|
2013-03-31 13:37:57 +00:00
|
|
|
end
|
2013-03-03 14:23:28 +00:00
|
|
|
return true
|
2013-03-31 13:39:20 +00:00
|
|
|
end
|
2013-10-18 20:38:07 +00:00
|
|
|
|
|
|
|
return ReaderFlipping
|