Commit Graph

109 Commits

Author SHA1 Message Date
Marwan Tanager
cd381c813d Don't set visibility, update view time, or lookup the cache, if the page is already visible.
This also has the side effect of not flooding the console with debug messages
on every change of the vertical adjustment as a result of redundant cache
lookups.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-03-29 18:33:15 +01:00
Marwan Tanager
cb18fe8603 Replace the periodic page reclaiming code with a LRU caching algorithm.
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>
2013-03-26 12:45:43 +01:00
Sebastian Ramacher
9c1503809a CS
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-03-23 16:12:38 +01:00
Benoît Knecht
1702fb620a Don't scroll the document when focusing the inputbar
Add a new adjust mode that is set when focusing the inputbar and
disables adjusting the vertical scrollbar. As a result, focusing the
inputbar doesn't scroll the document, leading to better results when
changing pages from the inputbar (e.g. using bookmarks).

Reported-by: Marwan Tanager <marwan.tngr@gmail.com>

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-03-23 16:03:11 +01:00
Benoît Knecht
c9eef95492 Use signals to readjust_view_after_zooming()
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>
2013-03-23 16:02:56 +01:00
Benoît Knecht
27c291758e Add a '--page' option to open at the specified page
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>
2013-03-17 11:30:22 +01:00
Benoît Knecht
ff305e6972 Initialize GdkRectangle structs in cb_view_vadjustment_value_changed
Initializing page_rect makes Valgrind happy; it was complaining before,
even though all the values were properly initialized, but it's more
obvious this way.

Initialize the other two structs in the same way for consitency.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2012-12-13 18:18:03 +01:00
Benoît Knecht
2192b7172c Add new shortcut function to display links
This is useful when the text of the link doesn't match its target. The
default key is set to 'F'.

See issue 266 <http://bugs.pwmt.org/issue266>.

Reported-by: Iron <o380770@rtrtr.com>

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2012-12-07 18:05:59 +01:00
Moritz Lipp
89e7832047 Update style 2012-10-09 01:12:18 +02:00
Abdó Roig-Maranges
eb67d97180 Implemented jumplist bound to ^o ^i
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>
2012-09-02 00:31:47 +02:00
Abdó Roig-Maranges
c57463a053 Added option to recolor keeping hues of original color.
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>
2012-08-01 16:05:31 +02:00
Sebastian Ramacher
6d462f4732 Implement first-page-column.
Thanks to J. Commelin for the patch.
2012-06-27 22:34:16 +02:00
Moritz Lipp
365dc9a66e Improve zathura_link_t 2012-05-28 12:43:22 +02:00
sandnon
3986cbc032 Fix the bug that index can not jump to specific page 2012-05-12 17:04:25 +02:00
Moritz Lipp
800d039293 Check for numeric events 2012-05-01 19:09:33 +02:00
Moritz Lipp
c2b0f7c20f Close document in cb_destroy
Fixes: #158
2012-05-01 12:03:18 +02:00
Moritz Lipp
adc9f41264 Introduce new link types 2012-04-22 10:04:46 +02:00
Moritz Lipp
97247f41ca Unhitch zathura_t from document_t/page_t/plugin_manager_t 2012-04-03 09:02:45 +02:00
Moritz Lipp
334b4fbb95 Introduce and use zathura_document wrapper functions 2012-03-27 21:59:35 +02:00
Moritz Lipp
fa40facc71 Begin to introduce types.h 2012-03-27 11:19:39 +02:00
Moritz Lipp
efc108fbe2 Introduced page.h 2012-03-26 14:44:56 +02:00
Moritz Lipp
fd06599d57 Remove unnecessary addition 2012-03-24 17:42:31 +01:00
Sebastian Ramacher
64905f282b Remove invisible pages from the memory. 2012-03-24 16:15:34 +01:00
Sebastian Ramacher
66bc63f5a7 Rename page_widget to page-widget. 2012-03-16 14:37:54 +01:00
Moritz Lipp
9265c9473a Add 'recolor' setting 2012-03-14 17:33:35 +01:00
Sebastian Ramacher
b244e016d0 Some refactoring. 2012-03-08 23:49:59 +01:00
Sebastian Ramacher
24345dafba Check the right coordinates in cb_view_vadjustment_value_changed. 2012-03-08 23:27:56 +01:00
Moritz Lipp
593d8063fe Close open document in cb_destroy 2012-03-07 01:11:18 +01:00
Sebastian Ramacher
b7a20a5e2b Make all strings passed to girara_notify translateable. 2012-03-04 18:45:58 +01:00
Moritz Lipp
737fb386ae Style update 2012-03-04 01:30:27 +01:00
Moritz Lipp
a4b4c91dae Calculate current page number only if scrolling 2012-02-21 20:39:42 +01:00
Sebastian Ramacher
98755c7c90 Merge branch 'develop' of pwmt.org:zathura into develop
Conflicts:
	callbacks.c
2012-02-20 20:18:12 +01:00
Sebastian Ramacher
fcca562280 use gdk_threads_enter and leave in file monitor callbacks 2012-02-20 20:17:16 +01:00
Moritz Lipp
b6f1868e7f Fix automatic file reloading 2012-02-20 20:07:24 +01:00
Sebastian Ramacher
0251fb75dd use gdk_threads_add_idle instead of g_idle_add 2012-02-16 16:18:12 +01:00
Sebastian Ramacher
e7f0e30d99 only call sc_adjust_window if the allocation of the window really changed 2012-02-14 15:53:04 +01:00
Moritz Lipp
5c09bdd5e2 Fix segmentation fault in cb_pages_per_row_value_changed 2012-02-12 15:34:05 +01:00
Sebastian Ramacher
95c8510118 Stay on the same page on :set pages-per-row (Closes: ##108) 2012-02-10 14:13:08 +01:00
Moritz Lipp
851ef7cd7b Adjust on resize / Adjust on open 2012-02-09 01:46:51 +01:00
Moritz Lipp
8f83192d74 Feedback on incorrect password 2012-02-09 00:01:35 +01:00
Moritz Lipp
3212d52406 Ask for password if input has been incorrect 2012-02-08 23:50:55 +01:00
Moritz Lipp
1d606ef027 Ask for password if file is encrypted 2012-02-08 23:21:27 +01:00
Moritz Lipp
2669ed43a8 Renamed buffer_changed function 2012-02-08 15:19:51 +01:00
Moritz Lipp
9d87451389 Update sc_follow 2012-02-08 00:19:35 +01:00
Moritz Lipp
30f62a1f3a Implemented auto reload basics 2012-02-07 19:25:47 +01:00
Moritz Lipp
21a65cbe34 Rename PageViewWidget to PageWidget 2012-02-07 18:30:46 +01:00
Moritz Lipp
76323a4c3e Remove debug output 2012-02-07 18:23:09 +01:00
Moritz Lipp
82a6caa211 Merge branch 'develop' of pwmt.org:zathura into develop 2012-02-07 18:00:51 +01:00
Moritz Lipp
0b88e118a5 Evaluate sc_follow input correctly 2012-02-07 18:00:47 +01:00
Sebastian Ramacher
762f3819d4 add zathura_link_free 2012-02-07 17:41:40 +01:00