This new function adjust_view is in charge of recomputing the scale
according to adjustment settings and trigger a render_all.
adjust_view contains the old sc_adjust_window code, slightly simplified
thanks to the availability of the document_get_viewport_size.
Then it is used by sc_adjust_window, document_open and the
cb_view_resized callback. Makes slightly more sense this way than
calling the shortcut sc_adjust_window directly.
Now page_set and position_set save the computed page and position to the
document object, then trigger a refresh-view signal. They do not handle
GTK adjustments anymore.
Now we can trigger a gtk page refresh calling refresh_view. This
function triggers a custom signal refresh-view, whose handler copies the
position from the document object to the adjustments.
- fix the computation of the number of rows in the table. Doing a ceil
of an integer division has no effect...
- set the page_padding in page_widget_set_mode function, instead of
doing it independently.
- call zathura_document_set_layout after calling page_widget_set_mode
to save the page layout settings into the document object.
ZathuraRenderer is a thread pool rendering the pages. Every page widget holds a
ZathuraRenderRequest instance to request its page to be rendered. This object
can also be used to abort the request in case the page is not visible anymore.
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
This patch implements two new ZathuraDatabaseInterface functions, save_jumplist
and load_jumplist, for both the plain and sqlite backends (along with some
cleanups).
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
- Don't delete the elements on the right of the current one, when
appending a new jump to the jumplist, because this makes no sense at
all; the point of the jumplist in the first place is to remember
previously jumped-to positions in the document, so there is no need
to delete anythings except to trim the oldest entries from the
beginning to maintain the maximum size. This also makes us compatible
with the Vim way of doing things.
- Make the jumplist mechanism functional on the same page; if we
followed a link to a target on the same page, remember the
adjustments before and after following the link. The same holds for
navigating search results on the same page.
- Implement position_set and use it instead of position_set_delayed
when following links in order to give zathura_jumplist_save a chance
to record the exact adjustments of the link target. Otherwise, it
will always record the adjustments after going to the target page,
but before going to the exact position within it.
- Don't consider movements with ^i and ^o as jumps :)
- Don't use page_set followed by setting the adjustments in
sc_jumplist, because this is redundant and causes clutter when using
^i and ^o, as the adjustments is set twice this way (once in page_set
and again in position_set_delayed). It's enough to only update the
page number on the statusbar and then set the adjustments.
- Hide implementation details (zathura_jumplist_save and
zathura_jumplist_append), and make things more consistent by
exporting and using only zathura_jumplist_add for adding new entries.
The end result: A more slick jumping experience :-)
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
This patch implements a page cache that is invalidated in a LRU fashion.
Pages are added to the cache as soon as they become visible. When the cache is
full and a new page that isn't in the cache becomes visible, the least recently
viewed page in the cache is evicted from memory and the new one takes it's
place.
The cache size is configurable using the page-cache-size configuration
variable, with a default value of 15 pages. Very large values for the cache
size are not recommended, though, as it will stress the system memory out.
The old periodic page reclaiming code is no longer necessary with this patch,
so I removed it.
Special thanks to Ignas Anikevičius, and Sebastian Ramacher for the
inspirations.
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
Instead of guesstimating the values of the scrollbars adjustments after
a change in zoom level, connect callbacks to the "changed" GtkAdjustment
event (which is emitted when the bounds or page_size of the adjustment
change, e.g. when the zoom level changes), and compute the new values
from there.
The previous adjustment values are tracked in zathura->ui.hadjustment
and zathura->ui.vadjustment (and updated by signal handlers as well), so
that the view's position can be maintained while zooming.
cb_view_hadjustment_changed() centers the page horizontally if a
"best-fit" or "width" zoom is being performed, or if "zoom-center" is
true; otherwise, it keeps the view horizontally centered around the same
area of the page.
cb_view_vadjustment_changed() always keeps the view vertically centered
around the same area of the page.
Many thanks to Marwan Tanager for thoroughly reviewing the various
stages of this patch, and actually coming up with a working solution.
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
If '--page [number]' (or '-P [number]') is given on the command-line,
the document is opened at the specified page number. Negative numbers
are allowed, and denote a page number starting from the end of the
document.
See issue 275 <http://bugs.pwmt.org/issue275>.
Reported-by: bob <sean258@gmail.com>
Both in the documentation and in function names, "synctex" was sometimes
spelled "syntex" or "syntec".
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
zathura records jumps through searches, index, links, etc. and enables to go
back and forth via ^o ^i.
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
If option recolor-keephue is true, the recoloring algorithm
only adjusts the lightness of the original color, keeping the
rest of the properties close to the original.
When recolor-keephue is set to false, the recoloring is performed
as it was before, interpolating linearly between recolor-lightcolor
and recolor-darkcolor except for a different weighting for the
lightness which is closer to perception.
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>