Commit Graph

17 Commits

Author SHA1 Message Date
Abdo Roig-Maranges
9f201f4a1f need to set the page number before the position
In the case we want to automatically set the position by by passing -1
to position_set, we better tell it the page before.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-10-31 01:02:03 +01:00
Sebastian Ramacher
f10d847a95 CS
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-10-30 03:35:56 +01:00
Abdo Roig-Maranges
efc7d23f92 use the new document functions in link evaluation
We now use the data available on the document object to compute the
exact positioning of the link target.

This way we get rid of page_calculate_offset, which uses explicit GTK
calls.
2013-10-26 17:13:56 +02:00
Abdo Roig-Maranges
030a8c65c1 add functions to compute page positions
The plan is to put in adjustment.c every piece of code that has to do
with document positioning, either computing it from data on the document
side, or talking to GTK.

We want to have at our disposal functions to compute sizes and positions
without having to ask for it to a GTK widget. The new functions are:

 - move page_calc_height_width to adjustment.c

 - add page_calc_position that rotates a position relative to a page
   according to the rotation settings.

 - add position_to_page_number that computes the number of a page
   sitting at a given position (given in document-relative coordinates)

 - add page_number_to_position that computes the position (in document
   relative coordinates) that will be placed at the center of the viewport.

 - add page_is_visible that checks whether the given page intersects the
   viewport.
2013-10-26 17:13:55 +02:00
Abdo Roig-Maranges
1d5efad36a add a config setting to prevent link_evaluate from changing scale
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-10-26 01:12:32 +02:00
Moritz Lipp
d699424cbe Add missing field initializer 2013-07-26 09:10:47 +02:00
Marwan Tanager
d9f8750c86 Move calls to zathura_jumplist_add surrounding zathura_link_evaluate to zathura_link_evaluate itself
This is just in case that zathura_link_evaluate returns without evaluating the
link, which would result in a new jump being added for the current position,
but without adding a corresponding jump for the target position (actually a
second one would be added but the check in zathura_jumplist_add would prevent
it from being appended on the linked list since it's position would be the same
as the current one, because the link haven't been evaluated).

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-06-21 10:56:08 +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
Abdó Roig-Maranges
8e9631946d Option to keep horizontal position when following internal links
Added config parameter "link-hadjust" with default value true. When set to false,
following internal links do not change the horizontal position of the page, only
the vertical position.

Also updates page number when following links, now.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-04-02 14:30:44 +02:00
Sebastian Ramacher
a079b05ddd Handle ZATHURA_LINK_NONE
Thanks to oblique for the patch.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-02-23 13:56:10 +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
11bf7ba2c8 Update link evaluation 2012-10-31 07:29:17 +01:00
Moritz Lipp
89e7832047 Update style 2012-10-09 01:12:18 +02:00
Abdó Roig-Maranges
16dd45ffe6 Update current page when following links. 2012-09-10 00:14:37 +02:00
Moritz Lipp
dfbd39c59d Evalute ZATHURA_LINK_DESTINATION_XYZ 2012-06-06 16:20:12 +02:00
Moritz Lipp
7d2265c294 Consider link types in link_new and link_free 2012-06-06 15:45:20 +02:00
Moritz Lipp
365dc9a66e Improve zathura_link_t 2012-05-28 12:43:22 +02:00