mirror of
https://github.com/koreader/koreader
synced 2024-11-13 19:11:25 +00:00
Merge branch 'new_ui_code' of github.com:hwhw/kindlepdfviewer into new_ui_code
This commit is contained in:
commit
1c0fbb10db
@ -147,14 +147,10 @@ function BBoxWidget:onConfirmCrop()
|
|||||||
self.ui:handleEvent(Event:new("BBoxUpdate"), self.page_bbox)
|
self.ui:handleEvent(Event:new("BBoxUpdate"), self.page_bbox)
|
||||||
self.document.bbox[self.pageno] = self.page_bbox
|
self.document.bbox[self.pageno] = self.page_bbox
|
||||||
self.document.bbox[self:oddEven(self.pageno)] = self.page_bbox
|
self.document.bbox[self:oddEven(self.pageno)] = self.page_bbox
|
||||||
self.ui:handleEvent(Event:new("SetZoomMode", self.orig_zoom_mode))
|
self.ui:handleEvent(Event:new("ExitPageCrop"))
|
||||||
self.document.configurable.text_wrap = self.orig_reflow_mode
|
|
||||||
UIManager.repaint_all = true
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function BBoxWidget:onCancelCrop()
|
function BBoxWidget:onCancelCrop()
|
||||||
UIManager:close(self)
|
UIManager:close(self)
|
||||||
self.ui:handleEvent(Event:new("SetZoomMode", self.orig_zoom_mode))
|
self.ui:handleEvent(Event:new("ExitPageCrop"))
|
||||||
self.document.configurable.text_wrap = self.orig_reflow_mode
|
|
||||||
UIManager.repaint_all = true
|
|
||||||
end
|
end
|
||||||
|
@ -4,12 +4,18 @@ ReaderCropping = InputContainer:new{}
|
|||||||
|
|
||||||
function ReaderCropping:onPageCrop(mode)
|
function ReaderCropping:onPageCrop(mode)
|
||||||
if mode == "auto" then return end
|
if mode == "auto" then return end
|
||||||
local orig_reflow_mode = self.document.configurable.text_wrap
|
self.orig_reflow_mode = self.document.configurable.text_wrap
|
||||||
self.document.configurable.text_wrap = 0
|
|
||||||
self.ui:handleEvent(Event:new("CloseConfig"))
|
self.ui:handleEvent(Event:new("CloseConfig"))
|
||||||
self.cropping_zoommode = true
|
self.cropping_zoommode = true
|
||||||
self.cropping_offset = true
|
self.cropping_offset = true
|
||||||
|
if self.orig_reflow_mode == 1 then
|
||||||
|
self.document.configurable.text_wrap = 0
|
||||||
|
-- if we are in reflow mode, then we are already in page
|
||||||
|
-- mode, just force readerview to recalculate visible_area
|
||||||
|
self.view:recalculate()
|
||||||
|
else
|
||||||
self.ui:handleEvent(Event:new("SetZoomMode", "page"))
|
self.ui:handleEvent(Event:new("SetZoomMode", "page"))
|
||||||
|
end
|
||||||
self.cropping_zoommode = false
|
self.cropping_zoommode = false
|
||||||
local ubbox = self.document:getPageBBox(self.current_page)
|
local ubbox = self.document:getPageBBox(self.current_page)
|
||||||
--DEBUG("used page bbox", ubbox)
|
--DEBUG("used page bbox", ubbox)
|
||||||
@ -19,13 +25,25 @@ function ReaderCropping:onPageCrop(mode)
|
|||||||
crop = self,
|
crop = self,
|
||||||
document = self.document,
|
document = self.document,
|
||||||
pageno = self.current_page,
|
pageno = self.current_page,
|
||||||
orig_zoom_mode = self.orig_zoom_mode,
|
|
||||||
orig_reflow_mode = orig_reflow_mode,
|
|
||||||
}
|
}
|
||||||
UIManager:show(self.crop_bbox)
|
UIManager:show(self.crop_bbox)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function ReaderCropping:onExitPageCrop()
|
||||||
|
self.document.configurable.text_wrap = self.orig_reflow_mode
|
||||||
|
self.view:recalculate()
|
||||||
|
-- Exiting should have the same look and feel with entering.
|
||||||
|
if self.orig_reflow_mode == 1 then
|
||||||
|
self.document.configurable.text_wrap = 1
|
||||||
|
self.view:recalculate()
|
||||||
|
else
|
||||||
|
self.ui:handleEvent(Event:new("SetZoomMode", self.orig_zoom_mode))
|
||||||
|
end
|
||||||
|
UIManager.repaint_all = true
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
function ReaderCropping:onPageUpdate(page_no)
|
function ReaderCropping:onPageUpdate(page_no)
|
||||||
--DEBUG("page updated to", page_no)
|
--DEBUG("page updated to", page_no)
|
||||||
self.current_page = page_no
|
self.current_page = page_no
|
||||||
@ -38,7 +56,7 @@ end
|
|||||||
|
|
||||||
function ReaderCropping:onScreenOffsetUpdate(screen_offset)
|
function ReaderCropping:onScreenOffsetUpdate(screen_offset)
|
||||||
if self.cropping_offset then
|
if self.cropping_offset then
|
||||||
DEBUG("offset updated to", screen_offset)
|
--DEBUG("offset updated to", screen_offset)
|
||||||
self.screen_offset = screen_offset
|
self.screen_offset = screen_offset
|
||||||
self.cropping_offset = false
|
self.cropping_offset = false
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user