The function memUsage() parses the file "/proc/self/status" and extracts
the sizes (in KB) of RSS, Data, Stack, Lib and TotalVM.
These are displayed when Menu button is pressed inside readers.
We must initialize show_overlap_enable to true in
DJVUReader:setDefaults() method, otherwise it will be uninitialized on
the first open of a DjVu file (i.e. with no history file).
Because we re-use the same instance of UniReader object (i.e. PDFReader,
DJVUReader, CREReader and PICViewer) we have to re-initialize the
defaults on closing the document. The clean way to do this which allows
to keep the default values in a single place is in a :setDefaults()
method which this commit provides, together with the example of usage in
DJVUReader and PICViewer.
While browsing libdjvu sources I remembered that I always validated DjVu
magic string before passing the file to djvulibre. This is because
forcing djvulibre errors on open is a bad idea --- it can lead to
very strange side effects, such as refusing to open the next (valid!)
DjVu file.
So, I have now implemented the same in KPV --- check DjVu magic string
before passing it to the proper DjVu :openDocument() method.
I timed the difference between opening with and without validation and
it was absolutely negligible (i.e. by far most of the time is spent in DjVu
document decoding anyway).
Although the current rendering mode can also be ascertained by pressing
"R" and noting the current position in the menu, it is convenient to
show it alongside the page type in the Menu status info.
The DjVu info shown in the status line includes:
1. Physical page dimensions.
2. Current value of gamma and (in square brackets) the value of the
display for which the page was designed.
3. Page resolution (in dpi).
4. Page type.
For the end-user probably the most useful bit is the page type as it
helps him decide which rendering mode to choose for this page (and also
explains why he can't see anything on the page --- e.g. when rendering
some COMPOUND or PHOTO pages in B&W mode). For the developer the
physical page dimensions are also interesting as they allow to estimate
the amount of time needed for page decoding and cache efficiency.
Also added support for all other rendering modes handled by djvulibre.
Also made the message print a human-readable description of the mode rather than just the number.
This change introduce object's dest_x and dest_y coordinates which
are needed in zoomedRectCoordTransform to make highlight scale and
move according to current pan position.
* add _isEntireLineInScreenHeightRange() method
For better page view navigation when highlighting
or moving cursor.
* bug fix in _isWordInScreenRange() method
* add _nextGap(), _prevGap(), _gapInNextLine()
and _gapInPrevLine() methods, so now key event
handling code in cursor moving mode only focuses
on drawing, calculation task is passed to these
four methods.