Commit Graph

1748 Commits (a4fa231b00b73f5b90e3a6186c3df0b5df24b888)
 

Author SHA1 Message Date
Tigran Aivazian a4fa231b00 Merge pull request #631 from chrox/cacheclaim
cleanup: use current_memsize instead of counting cache sizes
12 years ago
Tigran Aivazian 74741a7a8f Merge pull request #630 from chrox/koptconfig-default
add koptconfig defaults in defaults.lua and some cleanups
12 years ago
chrox 31a61a995b add koptconfig defaults in defaults.lua 12 years ago
chrox 10b4804d2e cleanup: use current_memsize instead of counting cache sizes 12 years ago
Tigran Aivazian 328a1a853f Merge pull request #627 from chrox/kopt-writecache
bugfix: write cache before new reflows && fix memory leak
12 years ago
{Qingping,Dave} Hou f41d56d397 Merge pull request #626 from chrox/kopt-cache
bugfix: calculate current cache size and free oldest cache if needed
12 years ago
chrox 1b1b0e423f bugfix: destroying attr objects immediately after pthread_create 12 years ago
{Qingping,Dave} Hou f27ee2f5fa Merge pull request #628 from tigran123/highlights
Fix deleting highlights via Shift-N + cleanup of battery logging.
12 years ago
{Qingping,Dave} Hou 1b95b4b874 Merge pull request #624 from tigran123/history
Re-sort Last Documents list on closing the document and remove unneeded page redraw
12 years ago
chrox f5b45aa253 bugfix: reclaim thread stack explicitly by using detached threads
Otherwise the VmData size will keep increasing in multi-threads mode.
Although the increasing VmData size doesn't mean there is enormous
memory leak, it does show that the thread stack is not handled properly
when threads exit.
12 years ago
Tigran Aivazian f047084320 Cleanups of battery logging
1. No need to pass the header through string.format()
2. Check for G_battery_logging value inside logBatteryLevel() function
to simply the code in the callers thereof.
12 years ago
Tigran Aivazian fa0c08cb56 Fix deleting highlights via Shift-N
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.
12 years ago
chrox ff267ee735 bugfix: get rid of memory leak in koptreader
Memory leak came from the master bitmap that is reused in each reflow. But the bitmap
width and height were not set to zero when bitmap was freed. When the master bitmap was
enlarged in some cases the size of the master bitmap would increase monotonically.
This patch fixes this issue by setting master bitmap width and height to zero at the
beginning of each reflow. And a memeory usage logger is added in koptreader.
12 years ago
chrox 9583a477fe bugfix: write cache before a new reflow
Reflowed bitmap should be written to cache before a new reflow is
started because all reflowing processes share the same masterinfo in
libk2pdfopt which contains the data of reflowed bitmap. If a new reflow
is started before a priviously reflowed bitmap is written, the
priviously reflowed bitmap will be corrupted which may cause
segmentation fault when it is written into cache finally.
12 years ago
chrox 0603dc8a38 bugfix: calculate current cache size and free oldest cache if needed
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.
12 years ago
Tigran Aivazian 4bc9f37b49 Two trivial optimizations
1. Comment out re-calculation of parameters to adjust for the case when
the user changed screen orientation, because we force portrait mode on
document close. I left a comment explaining this, so we can uncomment
this code if we choose to not force portrait mode on document close in
thefuture.
2. Don't re-sort the list if the file does not exist.
This predicts the most likely scenario, namely that the user
will choose to delete this stale history entry.
And even if he chooses NOT to delete it, placing a stale entry
to the top of the list contradicts our logic because the
non-existent file was never opened.
12 years ago
Tigran Aivazian 722ddc96f9 Redraw current page on return from highlight mode
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.
12 years ago
Tigran Aivazian 6a73dad4f5 Re-sort the history list on closing document
The "Last Documents" list is re-sorted on operations that modify it,
such as deleting an entry. But opening/closing a document is also one
such operation and, therefore, requires re-sorting.
12 years ago
Tigran Aivazian 7cfc505d21 Remove unneeded 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.
12 years ago
{Qingping,Dave} Hou 13f67822a1 Merge pull request #622 from tigran123/ext-all
Restore full File Manager functionality to KPV
12 years ago
{Qingping,Dave} Hou c2ab146203 Merge pull request #621 from tigran123/home
Unify Home and Alt-Back commands for UniReader
12 years ago
{Qingping,Dave} Hou b74fa0e0e2 Merge pull request #620 from tigran123/delete-bookmarks-crengine
Support deleting bookmarks in crengine
12 years ago
{Qingping,Dave} Hou 7c1cf60438 Merge pull request #618 from tigran123/rotation-mode
Cleanup the forcing of portrait mode and make FileChooser work in landscape mode
12 years ago
{Qingping,Dave} Hou 5a6ffc5582 Merge pull request #617 from tigran123/bookmarks
Added InfoMessage:drawTopMsg() method
12 years ago
Tigran Aivazian 6c036b4933 Use empty string as default extension
For treating document settings it is better to use empty string ""
rather than "txt" as a default extension type.
12 years ago
Tigran Aivazian 4ae40aa1ed Don't crash on files with no extension 12 years ago
Tigran Aivazian 7d61ea20fd Don't crash in fileinfo on files with no extension
Treat a file with no extension as crengine-supported txt file.
12 years ago
Tigran Aivazian 65e9f2fed3 Restore full filemanager functionality
Prior to introduction of the reader-chooser infrastructure we had a very
useful feature of browsing (and therefore
copying/moving/deleting/renaming/creating) filesystem tree accessing
arbitrary files if the user privilege mode is set to any value higher
than BEGINNER.
This patch restores this functionality by checking the privilege levels
in readerchooser and returning CREReader for any file type if there is
no other reader associated with it (including files with no extension).
12 years ago
Tigran Aivazian bb6480e458 Bugfix: prevent crash in openFile()
The code which determines file type in openFile() is actually unused, so
it can be safely removed. Moreover, if the filename passed to openFile()
happens to have no extension then this would crash openFile(). The
reason this was not noticed before is because no such filename was
passed to openFile() ever, but will be after the next few commits that
are coming...
12 years ago
Tigran Aivazian 72e0a314fb Unify Home and Alt-Back commands for UniReader
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.
12 years ago
Tigran Aivazian 630d3f1002 Add support for deleting bookmarks for crengine
The function CREReader:showBookMarks() can have the same logic present
also in its UniReader counterpart, except the goto has to deal with
"xpointers".
Also, I added the number of bookmarks shown in the title of bookmarks
list dialog, just like I did for UniReader:showBookMarks() previously.
12 years ago
Tigran Aivazian 7e5712946a Make bm_menu in UniReader:showBookMarks() local
We should not overwrite a global bm_menu (if it exists).
12 years ago
Tigran Aivazian f0edb9fc55 Make FileChooser:choose() work in landscape
Although we are forcing portrait mode upon closing a document and also
start up FileChooser in portrait mode, it is best to not rely on this
fact within the FileChooser itself.
Therefore, I have enhanced FileChooser:choose() method to handle both
landscape and portrait modes by removing the assumption that the global
variables G_width and G_height will maintain the value they had
upon the entry to this function.
This supercedes the fix in PR 616 which actually introduced a memory
corruption bug by using the stale values of G_height/G_width in some
contexts and refreshed value(s) in others.
12 years ago
Tigran Aivazian eb45c49fd6 Cleanup FileChooser:choose() method.
1. Remove the unnecessary parameters from FileChooser:choose() method.
2. Save frequently used expression G_width - 2*self.margin_H in a local
variable.
3. Replace the calls to fb.bb:getWidth() and fb.bb:getHeight() with the
locally saved copies of G_width and G_height respectively.
12 years ago
Tigran Aivazian f2c161d45d 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.
12 years ago
Tigran Aivazian 93a0db59a1 Added InfoMessage:drawTopMsg() method
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.
12 years ago
{Qingping,Dave} Hou d3b0be1bf4 Merge pull request #616 from kai771/fc_bugfix
bugfix: FileChooser crashes when closing landscape document
12 years ago
kai771 6919e40db2 bugfix: FileChooser crashes when closing landscape document
Yes, we already fixed that forcing portrait mode on KPV start, and
document close. However, this is a fix that will prevent the crash if
we don't force portrait. I'm not suggesting that we stop forcing portrait -
I think we all agreed that FileChooser in landscape mode on K3 is not
very usable. But, this might be handy on Touch or KPW (we'll see about that
later), so it should be usable should we need it. To test this, you need to
comment out self:setRotationMode(0) line in UniReader:inputLoop() in
unireader.lua, thus removing forcing of portrait on document close
.
12 years ago
Tigran Aivazian c4246b3134 Merge pull request #614 from chrox/master
bugfix: remove koptreflow.o in make clean
12 years ago
chrox 0b2a03b8fe remove koptreflow.o in make clean 12 years ago
{Qingping,Dave} Hou 7c7e2af4eb Merge pull request #613 from kai771/jumps_bugfix
bugfix: incorrectly positioned jumps
12 years ago
{Qingping,Dave} Hou d631445636 Merge pull request #612 from tigran123/droid
Use the font DroidSansFallbackFull.ttf and mkdir history and clipboard for the emu
12 years ago
Tigran Aivazian 8fd76e243f Create history and clipboard dirs for the emulator 12 years ago
kai771 c50b53b604 bugfix: incorrectly positioned jumps
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.
12 years ago
Tigran Aivazian e7c264c576 Use the font DroidSansFallbackFull.ttf 12 years ago
Tigran Aivazian d350c6005a Merge pull request #610 from kai771/bbox_bugfix2
correction for #608. I added the line in the wrong place
12 years ago
kai771 f9be17ecad correction for #608. I added the line in the wrong place 12 years ago
Tigran Aivazian 4b197ad382 Merge pull request #607 from kai771/SS_bugfix
bugfix: Screen Saver not working if Help page is displayed
12 years ago
Tigran Aivazian bf4d548aef Merge pull request #608 from kai771/bbox_bugfix
bugfix: using bbox of previous document
12 years ago
kai771 ba90e9e97c bugfix: using bbox of previous document
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.
12 years ago