Cleanup the forcing of portrait mode

1. Move the setting of G_width/G_height inside the function
Screen:setRotationMode()
2. Don't call self:clearCache() twice on closing the document (once is enough).
3. Get rid of UniReader:setRotationMode() method because
Screen:setRotationMode() is enough, as there is nothing reader- or
document-specific in this function.
Tigran Aivazian 12 years ago
parent d3b0be1bf4
commit f2c161d45d

@ -122,7 +122,6 @@ Screen.native_rotation_mode = Screen.cur_rotation_mode
-- force portrait mode
Screen:setRotationMode(0)
G_width, G_height = fb:getSize()
-- set up reader's setting: font
G_reader_settings = DocSettings:open(".reader")

@ -58,6 +58,7 @@ function Screen:setRotationMode(mode)
fb:setOrientation(self.cur_rotation_mode)
fb:close()
fb = einkfb.open("/dev/fb0")
G_width, G_height = fb:getSize()
end
-- @orien: 1 for clockwise rotate, -1 for anti-clockwise

@ -1893,14 +1893,6 @@ function UniReader:screenRotate(orien)
self:clearCache()
end
function UniReader:setRotationMode(mode)
Screen:setRotationMode(mode)
-- update global width and height variable
G_width, G_height = fb:getSize()
self:clearCache()
end
function UniReader:cleanUpTocTitle(title)
return (title:gsub("\13", ""))
end
@ -2512,7 +2504,7 @@ function UniReader:inputLoop()
self.toc_cview = nil
self.toc_curidx_to_x = nil
self.show_overlap = 0
self:setRotationMode(0)
Screen:setRotationMode(0)
self:setDefaults()
if self.doc ~= nil then
self.doc:close()

Loading…
Cancel
Save