Fixed page caching. Cache strategy is the following:
prio 1: cache/render requested area
prio 2: cache/render as much of the current page as possible
prio 3: cache/render full page
prio 4: render next page
This is still a bit buggy when in fit-to-content mode.
we allow for bigger render buffers, so the cache now returns
the ID (hash) of the relevant cashed tile PLUS offsets into that
tile, pointing to the coordinates where the requested frame
has its origin.
It's not that simple since ZOOM_FIT_TO_CONTENT_HALF_WIDTH also
needs bounding boxes, and this seems like over-optimization
which seems to be bug infested especially because it deals
with negative numbers so code just *looks* wrong
* Since fontchooser is replaced by selectmenu, it
is no longer needed. So I rewrite it into font.lua
module which can cache faces that shared among all
UIs.
* add progressBar method in graphics.lua to draw
reading progress.
* add reading progress information in reading menu.
It is just a demo. Should be clean up in next release
when the real reading menu is out. :)
Now you get a instance rotate :) With only one bug.
I have to restore to previous rotation state of the
native system after exists. Because the native system
does poll the new rotation state that changed by ioctl.
Currently, I don't know how to force the native system
to detect the changes.
* move rotation mode to global variable, now check rotation
with Screen.cur_rotation_mode
* move screenRotate to screen module so other UIs can use it.
This mode is used with ZOOM_FIT_TO_CONTENT_WIDTH, so
when press KEY_PGFWD, you jump to lower part of current
page. When hit page bottom, you do a real page turn. It
now behaviors the same like the native reader as I
mentioned in issue #41.
The first time you set to ZOOM_FIT_TO_CONTENT_WIDTH mode,
the reader will setup proper zoom factor and offset, then
switch to ZOOM_FIT_TO_CONTENT_WIDTH_PAN mode. When you hit
the page bottom, the reader will set the mode back to
ZOOM_FIT_TO_CONTENT_WIDTH mode and do a real page turn.
This is especially useful if you want PDF pages which bouding box
includes headers or footers which are full page width files like #25
I opted to ignore margins with Shift+F to be consistant with other zoom
modes.
It's important for us to take maring into account because rouding error
can force us to skip right marging. However, this shouldn't be done
when not in pan_by_page mode, so this diff is artifically large
re-apply the changes introduced by HW in commit:
3c56f50cae
I mistakenly overwrote it when merging from djvu
branch. :(
Since the title needs to be cleaned in two places,
I turn it into a method.
NOTE that the jumpstack maintaining strategy has
been changed in this commit compared to commit #15
and #31. Now current viewing page in kept in the
stack to preserve the notes.
Add unireader class for better code reuse.
Now pdfreader and djvureader are subclass of
unireader.
Every subclass needs to have a init() method
that will be called in reader.lua.