1. When switching file manager mode from restricted (formerly known as
"Beginner") to unrestricted (formerly known as "Expert" or "Advanced")
and paging down the file list KPV would crash.
2. Clear up the mess with the file manager mode --- we only need two
modes: RESTRICTED and UNRESTRICTED. When we need more we'll add them. No
need to pollute code with future "what if"s.
3. Setting file manager mode function has no place in unireader (it was
formerly needed because the event notifications was dependent on it ---
not anymore).
4. Bugfix: show the correct number of books in UNRESTRICTED file manager
mode when pressing fiveway Right key on a directory.
When deleting highlights the tables pointing to a highlight's page
number and sequential number within that page must be rebuilt.
The present implementation illustrates the typical use of local
functions in Lua, i.e. for this situation the lexical scope feature of
Lua's local functions is ideally suited.
Cache ttl should not be decreased only when there is no free slot for
new cache but decreased when claiming new cache each time. Otherwise
caches will be freed altogether which obviously is not the purpose of
the cache system. This patch only free the oldest caches and make just
enough free slots for the new one.
When returning from highlight mode there is no need to :goto() to the
current page (and force dummy pre-cache) --- all that is needed is the
redraw of the current page.
The function UniReader:showHighLight() internally handles all cases
where page redraw is necessary. Therefore, there is no need to redraw
the current page (much less to :goto() to it) on return from it.
The command handlers for Home and Alt-Back commands currently perform
exactly the same function (of closing the document) despite the help page
and even the Lua code suggesting otherwise, so it makes sense to merge
them into a single command handler.
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.
Displaying a pop-up window for operations like adding a bookmark seems a
bit of an overkill for simple messages like "Bookmark added" or
"Bookmark already exists". Therefore, based on the suggestion by
@dracodoc I have implemented an InfoMessage:drawTopMsg() for this
purpose which just renders the text in the top left corner on a gray
background of auto-calculated appropriate width.
1. In a document with different even/odd bbox, when jumping from odd to even
page, page would be incorrectly positioned.
2. When closing document in fit-to-content-width and 2-column-mode,
and opening it again, the page would not be positioned correctly if you
were not at the beginning of the page when closing.
If you open a document, manually set bbox, then close it and open
another one without bbox, manually set bbox of the previous bbox is
used, which is annoying. This fixes it.
Turning off overlap was instantly visible, but turning it back on was visible only on the next view. This makes both turning on/off overlap instantly visible. Since the result of a keypress is immediately visible, I commented out the inform message, since it's not needed anymore.
This patch changes the second argument of InfoMessage:inform() function
to be either DINFO_DELAY or DINFO_NODELAY with the following
semantics:
DINFO_DELAY - display the message and delay DINFO_DELAY ms before
returning. Save and restore the screen content.
DINFO_NODELAY - display the message and return immediately without
saving/restoring the screen content.
Also, tidy up the call to modBBox() from Shift-X command handler, it
should be unireader:modBBox() and not self:modBBox(unireader) --- there
is no need to pass the reader object to the :modBBox() method.
Thanks to kai771's idea of setting the value of DINFO_TIMEOUT_FAST=1
(in defaults.lua) we can still have the same behaviour of calls to
InfoMessage:inform(..DINFO_TIMEOUT_FAST..) on both the emulator and the
Kindle without the need to manually refresh the page after the call.
Also, now we don't need to set pagedirty=true in filechooser when
displaying a popup window with DINFO_TIMEOUT_FAST flag.
Also, add space to the end of the text messages passed to :inform() for
symmetry.
I have removed the calls to self:redrawPage() recently after the calls
to InfoMessage:inform() with DINFO_TIMEOUT_FAST because on the emulator
the screen was refreshed automatically. But not so on the real Kindle
hardware --- we have to refresh the page explicitly, otherwise the popup
window stays until one forces manual refresh via Space or turns the page
(or causes a refresh by some other way, e.g. pressing Menu twice).
This patch restores those calls to self:redrawCurrentPage().
Also, it adds space to the end of some messages for symmetry and
switches Alt-Z toggle to DINFO_TIMEOUT_FAST mode as well.
1. There is no need to call the :goto() method which does the extra work
of adding to jump history and (most importantly) pre-caching, which is
not relevant for the simple task of redrawing the current page.
2. The page goto "G" function can now be optimized to avoid pre-caching if
the page has not actually changed.
Previously, if you follow a local link in the PDF file which points to a
place only one page away from the current page and then press Back it
will bring you to some random location (depending on the previous jump
history). But normally you would expect to be returned to the link's
location, regardless of its distance from the target page. This commit
fixes this problem, also raised as an issue 575.