Commit Graph

83 Commits

Author SHA1 Message Date
Abdo Roig-Maranges
c4245600c9 move adjustment code from sc_adjust_window to adjust_view
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.
2013-10-26 17:13:56 +02:00
Abdo Roig-Maranges
54b6f7336d make position_set and page_set more asynchronous
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.
2013-10-26 17:13:56 +02:00
Abdo Roig-Maranges
692e72abd4 add a custom refresh-view signal
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.
2013-10-26 17:13:56 +02:00
Abdo Roig-Maranges
c5930c900a page_widget_set_mode now sets the page-padding too
- 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.
2013-10-26 16:01:02 +02:00
Sebastian Ramacher
e7cd4e5f8c Move page cache to ZathuraRenderer
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-10-18 20:00:04 +02:00
Sebastian Ramacher
b02d3d4b8f Move recolor state to the renderer
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-08-24 00:07:32 +02:00
Sebastian Ramacher
10115db62f Rewrite render thread as request based system
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>
2013-08-21 18:32:18 +02:00
Sebastian Ramacher
b5237680f2 Don't store surface for invisible and uncached pages
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-07-27 16:25:20 +02:00
Sebastian Ramacher
65da0ffa50 Decouple bisect from jumplist
Move some bisect state to zathura_t and manipulate the jumplist that much.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-07-07 00:03:52 +02:00
Marwan Tanager
99b32ae109 Make the jumplist persistent on a per-file basis
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>
2013-06-29 11:35:29 +02:00
Marwan Tanager
092fe81839 Use jumplist with marks
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-06-10 14:48:11 +02:00
Marwan Tanager
afd008f466 Enhancements/Cleanups for the jumplist mechansim
- 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>
2013-06-10 14:48:10 +02:00
Abdo Roig-Maranges
d05ecc3043 added function to check whether current jump is first or last
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-04-02 21:22:20 +02: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
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
Sebastian Ramacher
35adeacbf5 Implement colors for 'Loading ...'.
Thanks to oblique for the patch.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-02-23 17:33:03 +01:00
Rob Cornish
1a6b03fc62 Fixed reverse searching behaviour to be more like less/vi
Signed-off-by: Sebastian Ramacher <sebastian@ramacher.at>
2012-12-19 00:29:31 +01:00
Benoît Knecht
824843a917 Correct misspellings of the word "synctex"
Both in the documentation and in function names, "synctex" was sometimes
spelled "syntex" or "syntec".

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2012-12-06 20:34:14 +01:00
Sebastian Ramacher
af04432892 Don't expose zathura_jump_[st] in the public API.
It's only for internal use.
2012-09-02 00:44: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
Moritz Lipp
f6c6b4a883 En/Disable syntex support 2012-08-13 18:17:20 +02:00
Sebastian Ramacher
0a9e27a94d Fix build error with GTK 3. 2012-08-05 15:31:42 +02:00
Moritz Lipp
ec554bc33d Parse command line arguments in main 2012-08-05 15:34:10 +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
49116a0834 Synctex backwards synchronization
Thanks to Roland Schatz for the patch.
2012-07-13 15:39:16 +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
a86940b3f4 Implement ZATHURA_LINK_GOTO_REMOTE 2012-04-22 11:11:36 +02:00
Moritz Lipp
7d92d54539 Implemented marks 2012-04-21 04:59:58 +02:00
Sebastian Ramacher
f7c119b244 There is no need to include zathura.h anymore. 2012-04-03 18:39:00 +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
025c995d89 Introduce plugin manager 2012-04-01 18:32:16 +02:00
Moritz Lipp
334b4fbb95 Introduce and use zathura_document wrapper functions 2012-03-27 21:59:35 +02:00
Moritz Lipp
8a44158fd5 Remove deprecated page_padding 2012-03-24 18:33:10 +01:00
Sebastian Ramacher
6cdc2b1974 Add argument to rotate to support counter-clockwise rotation (Closes: #154) 2012-03-19 11:43:07 +01:00
Sebastian Ramacher
75b7ce0bc9 Mark zathura->global.page_padding as deprecated. 2012-03-16 15:56:37 +01:00
Moritz Lipp
7271166b20 Update style 2012-03-09 08:05:48 +01:00
Sebastian Ramacher
4b559e585b Implement support to use both database backends. 2012-03-04 15:56:54 +01:00
Géraud Le Falher
ead85e28f1 add the ability to horizontally scroll half or full screen 2012-03-02 14:03:38 +01:00
Moritz Lipp
a4b4c91dae Calculate current page number only if scrolling 2012-02-21 20:39:42 +01:00
Vicky Chijwani
6aced3f870 add EXPAND_ALL and COLLAPSE_ALL shortcuts to index 2012-02-21 16:59:23 +01:00
Moritz Lipp
b6f1868e7f Fix automatic file reloading 2012-02-20 20:07:24 +01:00
Sebastian Ramacher
9d04a7bfcf make highlight colors configurable during runtime 2012-02-14 14:46:19 +01:00
Moritz Lipp
34b6fffc33 Update documentation 2012-02-08 15:30:13 +01:00
Moritz Lipp
21a65cbe34 Rename PageViewWidget to PageWidget 2012-02-07 18:30:46 +01:00
Moritz Lipp
f8f4345540 Update documentation 2012-01-22 21:57:18 +01:00
Moritz Lipp
3311038681 Begin to draw sc_follow results 2012-01-19 00:49:08 +01:00
Sebastian Ramacher
c75eaf4c43 center the pages (Closes: #85, #87) 2012-01-13 17:39:46 +01:00
Sebastian Ramacher
56efd1550e use GIRARA_UNUSED 2011-11-25 11:56:21 +01:00
Sebastian Ramacher
911d84c908 update includes due to girara restructuring 2011-10-23 17:01:15 +02:00