Commit Graph

237 Commits

Author SHA1 Message Date
Marwan Tanager
5b7fc5de5f Make jumping with ^o and ^i more compatible with Vim
- Allow the user to always start with the very last (or first) jump on the
      jumplist when pressing ^o (or ^i), while the jumplist iterator is
      pointing to the last (or first) jump, and the document is not currently
      at the position of this pointed-to jump. This is instead of jumping
      directly to the previous/next jump, and skipping the last/first one.

    - Don't jump to the current jump pointed to by the jumplist iterator, if
      there is no more next jumps, and the jump direction is FORWARD.

    - Don't jump to the current jump pointed to by the jumplist iterator, if
      there is no more previous jumps, and the jump direction is BACKWARD.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-06-20 20:18:04 +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
Marwan Tanager
cc3b9aea18 More Vim-like search behavior
This patch activates the last aborted search when pressing the search shortcuts
('n' or 'N').

To avoid confusion, and to make things more predictable, I've chosen to always
reactivate an aborted search starting from the beginning (or end, in case of
'N' or '?') of the current page, as opposed to Vim which continues from the
next search term each time the search is reactivated.

Searching using '/' or '?' doesn't center the view at the current search term
like when using 'n' or 'N', so we fix this here.

Also, I managed to work around the issue of the thin rectangular margins that
show around the previously-highlighted search terms after the search is aborted
(either explicitly or as a result of following links), by redrawing the page
widget (only if it's visible) instead of redrawing the rectangles covering the
highlighted search terms.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-06-10 14:35:19 +02:00
Marwan Tanager
2d9ea08729 Use show-v-scrollbar instead of show-scrollbars
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-06-02 11:45:26 +02:00
Moritz Lipp
87f10baffc Allow negative offsets 2013-05-08 18:28:32 +02:00
Abdo Roig-Maranges
5563da4d91 also adjust the horizontal position in sc_bisect
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-04-02 21:46:55 +02:00
Abdo Roig-Maranges
49e5b053bf bisect functionality to navigate documents
This uses the jumplist to implement a bisect functionality between the
last two jump points. ^j and ^k are bound to bisect forward and backward
respectively.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-04-02 21:22:20 +02:00
Abdo Roig-Maranges
1c3274bbd6 properly set horizontal position when navigating
Call cb_view_hadjustment_changed to set horizontal position in
navigation shortcuts: sc_navigate, sc_goto.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-04-02 20:52:46 +02:00
Marwan Tanager
8f695b8c52 Set the adjustment mode to ZATHURA_ADJUST_INPUTBAR before displaying or following links.
This will not scroll the document when pressing 'f' or 'F', just to make the
behavior consistent with activating the inputbar using ':'.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-03-29 18:33:15 +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
f5b02a9751 Revert commit ce6e735
This wasn't correct. Padding is already accounted for:

  scale = (width - (pages_per_row - 1) * padding) /
          (pages_per_row * cell_width)

If you add padding on the denominator, you end up with black margins on
the sides of the window, which isn't what padding is for (i.e. insert a
gap between rendered pages), and defeats the purpose of a "best-fit".

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
99a03faed1 CS
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-03-03 02:26:08 +01:00
Marwan Tanager
7841eea2eb Scale vertical/horizontal scrolling by the contents of the numeric buffer.
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-03-03 02:23:51 +01:00
Moritz Lipp
ce6e7351ca Respect padding in sc_adjust_window
Thanks to Marwan Tanager
2013-02-07 09:26:37 +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
92c26ed28d Account for scrollbars when fitting page into window
The width of the vertical scrollbar (if there is one) needs to be
substracted from the width of the GtkScrolledWindow in order to obtain
the correct dimensions of the view area.

See issue 27 <http://bugs.pwmt.org/issue27>.

It also deals better with documents where pages don't all have the same
size.

Reported-by: Andreas Weinlich <business@weinlich.org>

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2012-12-13 18:18:03 +01:00
Benoît Knecht
a16819fdf0 Always free the GtkTreePath in sc_navigate_index
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2012-12-10 00:01:37 +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
Benoît Knecht
48d12f49be Also wrap when scrolling with 'j' and 'k'
The scroll-wrap option used to only change the behavior of 'J' and 'K'
(i.e.  moving one page forward/backward).

Now, if scroll-wrap is true and the top of the first page is shown,
pressing 'k' will show the bottom of the last page; conversely, when at
the bottom of the last page, pressing 'j' will show the top of the first
page.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2012-12-06 20:39:16 +01:00
Benoît Knecht
c06d353eb7 Reverse scroll-wrap's logic
When set to true, it used to _not_ wrap around the begining/end. Now it
wraps if set to true, and it doesn't if set to false.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2012-12-06 20:38:51 +01:00
Moritz Lipp
89e7832047 Update style 2012-10-09 01:12:18 +02:00
Moritz Lipp
94d8eef959 Toggle multi-page-mode with d 2012-10-06 14:58:07 +02:00
Moritz Lipp
b24ae033ad Set fullscreen mode and custom button press events 2012-10-05 00:41:05 +02:00
Moritz Lipp
7f42c4b7e7 Set scroll_full_overlap to zero by default 2012-09-19 21:31:52 +02:00
Moritz Lipp
bb104073f3 Fix adjust_window when inputbar is visible 2012-09-17 21:25:48 +02:00
Sebastian Ramacher
0ce7730965 CS 2012-09-17 16:56:43 +02:00
Jonas Hoersch
9c9d07a615 Introduce page aware scrolling
if scroll-page-aware is set, scrolling by full and half pages stops at
page boundaries (as djview4 does it on <space> and <backspace>).

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2012-09-17 16:42:56 +02:00
Jonas Hoersch
d76e33e3ec Add full page scroll overlap setting
The default of 0.1 keeps 10% of a page visible on a full-page scroll.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2012-09-17 16:30:39 +02:00
Moritz Lipp
207f5e571d Overwrite abort inputbar bindings 2012-09-03 10:30:25 +02:00
Sebastian Ramacher
e79a48452f Honor the current zoom level.
Otherwise jump positions are off after changing the zoom level.
2012-09-02 00:44:58 +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
ad27b0471d Respect scrollbar spacing in sc_adjust_window 2012-08-14 16:06:25 +02:00
Moritz Lipp
83865d8998 Use GtkGrid instead of GtkTable 2012-08-05 02:30:03 +02:00
Ignas Anikevicius (gns_ank)
e4b9924c4d Fix BESTFIT to work well when pages-per-row > 1.
There are two causes of the problem:

    - page_ratio should be defined differently

        This is because the usefull page ratio is max_height/total_width
        or max_width/total_height. This then changes accordingly if
        pages_per_row != 1, otherwise, if the pages are of the same
        size, the page ratios will not change, which screws up the
        resizing.

    - Sometimes we need to do height or width division diferently.

        This is because not always total_height or total_width is
        meaningful in BESTFIT condition.

This commit also should fix the bug #0000226.

Signed-off-by: Ignas Anikevicius (gns_ank) <anikevicius@gmail.com>
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2012-08-01 16:16:39 +02:00
Sebastian Ramacher
8c21a6116a gtk_tree_path_up is weird.
Thils should fix #241.
2012-08-01 00:23:43 +02:00
Sebastian Ramacher
6d462f4732 Implement first-page-column.
Thanks to J. Commelin for the patch.
2012-06-27 22:34:16 +02:00
Sebastian Ramacher
db459fe3d9 Merge branch 'develop' of pwmt.org:zathura into develop 2012-06-27 21:20:08 +02:00
Julian Orth
30eda65aaa We added three options
1) zoom-center :: bool
   zoom-center = false

   If zoom-center = false nothing changes.
   If zoom-center = true zooming respects the horizontal center of the
   pageview. That is, the vertical line dividing the displayed part of
   the document doesn't move within the document.

   Reasoning: When viewing a pdf with a margin we usually want to hide the
   margin at both sides by zooming in.

2) scroll-hstep :: float
   scroll-hstep = -1

   If scroll-hstep < 0 nothing changes.
   If scroll-hstep >= 0 then scroll-hstep defines the scroll step in the
   horizontal direction.

   Reasoning: This allows us to make finer adjustments in the horizontal
   direction without the mouse and without loosing the ablility to
   navigate quickly through the document.

3) search-hadjust :: bool
   search-hadjust = true

   If search-hadjust = true nothing changes.
   If search-hadjust = false searching does not adjust the horizontal
   center of the document when showing search results.

   Reasoning: When viewing a pdf with a margin we usually want to hide
   the margin at both sides by zooming in. The horizontal adjustment
   sometimes hides parts of the document by moving the horizontal
   center.
2012-06-27 21:18:05 +02:00
Moritz Lipp
23a483962e Update zoom shortcut and zoom configuration 2012-06-27 14:03:26 +02:00
Moritz Lipp
8e1cf395a5 Show correct page after leaving fullscreen mode
Fixes #220
2012-06-17 00:20:36 +02:00
Moritz Lipp
cbb22739e5 Fix sc_adjust_window 2012-06-16 00:21:18 +02:00
Moritz Lipp
4868bcec55 Update sc_adjust_window 2012-06-15 16:26:59 +02:00
Moritz Lipp
83f55ff24a Implement sc_print 2012-05-08 16:47:34 +02:00
Moritz Lipp
de17088c91 Update sc_adjust_window on ZATHURA_ADJUST_BESTFIT
Closes: #200
2012-05-08 14:08:09 +02:00
Sebastian Ramacher
d05e40a8b5 Escape path in sc_focus_inputvar with APPEND_FILEPATH (Closes: #198) 2012-05-07 23:41:11 +02:00
Moritz Lipp
13711243f4 Improve widget size fix for sc_adjust_window 2012-05-06 22:52:33 +02:00
Moritz Lipp
9d2df003a3 Use gdk_threads_add_idle for adjust_window 2012-05-06 13:48:17 +02:00
Moritz Lipp
9e643d4224 Reset position correctly after viewing index
Fixes #188
2012-05-01 08:22:17 +02:00
Moritz Lipp
b5bf7ef835 Fix pan problem 2012-04-30 22:42:53 +02:00
Sebastian Ramacher
d24ad831b8 Add setting abort-clear-search and clear search results on abort if set. 2012-04-28 21:47:27 +02:00
Moritz Lipp
d882bf9cd8 Enable t in sc_rotate 2012-04-22 23:59:30 +02:00
Moritz Lipp
c5f22141eb Resolve warning 2012-04-21 10:40:29 +02:00
Moritz Lipp
7d92d54539 Implemented marks 2012-04-21 04:59:58 +02:00
Moritz Lipp
2534c7abc2 Fix t 2012-04-20 23:41:10 +02:00
Moritz Lipp
4cd4638fd8 Allow to zoom in n times 2012-04-20 23:39:34 +02:00
Sebastian Ramacher
ace9718f75 Add option to advance the number of pages per row. (Closes: #167) 2012-04-10 17:40:29 +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
ab4c364e56 Update document information plugin api 2012-03-30 18:24:00 +02:00
Moritz Lipp
9cdd963784 Auto-adjust on rotate / Update sc_adjust_window 2012-03-28 17:26:20 +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
5bf32f33a5 Rename page_get_id to page_get_index 2012-03-26 15:30:58 +02:00
Moritz Lipp
efc108fbe2 Introduced page.h 2012-03-26 14:44:56 +02:00
Moritz Lipp
90796b5b5c Added :offset command and some style updates 2012-03-24 18:27:10 +01:00
Moritz Lipp
defbf056c1 Update style 2012-03-24 17:56:23 +01:00
Moritz Lipp
42d3373558 Update sc_goto 2012-03-24 17:45:25 +01:00
Sebastian Ramacher
6cdc2b1974 Add argument to rotate to support counter-clockwise rotation (Closes: #154) 2012-03-19 11:43:07 +01:00
Felix Herrmann
d4b92610de readjust view in sc_adjust_window (to keep position) 2012-03-19 11:22:01 +01:00
Sebastian Ramacher
9fe03f72e2 Allow page-padding to be changed. 2012-03-16 15:47:30 +01:00
Sebastian Ramacher
66bc63f5a7 Rename page_widget to page-widget. 2012-03-16 14:37:54 +01:00
Moritz Lipp
1028d90e6c Re-render all pages when calling cb_color_change 2012-03-14 18:09:00 +01:00
Moritz Lipp
0474235483 Added 'scroll-wrap' for sc_navigate 2012-03-14 17:44:36 +01:00
Moritz Lipp
9265c9473a Add 'recolor' setting 2012-03-14 17:33:35 +01:00
Moritz Lipp
7271166b20 Update style 2012-03-09 08:05:48 +01:00
Sebastian Ramacher
ec2ec61463 Keep the current page in sc_toogle_fullscreen (Closes: #134) 2012-03-08 19:12:27 +01:00
Moritz Lipp
6b042b17b5 Show error message if no index exists 2012-03-08 18:37:51 +01:00
Moritz Lipp
e73ca51d05 Disable fullscreen mode if no document has been opened 2012-03-07 01:08:17 +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
be8b8f3bb7 Revert latest commit 2012-02-25 23:54:38 +01:00
Moritz Lipp
6eb9db6cb6 Use update_page_number instead of setting it directly 2012-02-25 23:48:52 +01:00
Moritz Lipp
21856c0061 Iterate through all search results correctly 2012-02-25 16:56:11 +01:00
Moritz Lipp
a4b4c91dae Calculate current page number only if scrolling 2012-02-21 20:39:42 +01:00
Moritz Lipp
ffd2da55bd Style changes and additional parseable arguments 2012-02-21 17:11:59 +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
Moritz Lipp
d8bc9fefac Implement sc_focus_inputbar with possible APPEND_FILEPATH parameter 2012-02-20 16:33:59 +01:00
Moritz Lipp
eac3cbd904 Consider page padding in sc_scroll 2012-02-20 09:33:18 +01:00
Moritz Lipp
65d2241e06 Simplify sc_mouse_scroll 2012-02-15 11:48:28 +01:00
Moritz Lipp
b815fa6ecf Update to new girara event definitions 2012-02-15 00:21:51 +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
392275eed3 Resolve sc_follow issue 2012-02-12 11:16:10 +01:00
Moritz Lipp
2adb25223c Options for zoom_min/zoom_max 2012-02-09 18:30:36 +01:00
Moritz Lipp
851ef7cd7b Adjust on resize / Adjust on open 2012-02-09 01:46:51 +01:00
Moritz Lipp
1ff8f6eb22 Use correct dimensions for sc_adjust_window 2012-02-09 01:20:42 +01:00
Moritz Lipp
d2fc051f36 Pan by using mouse button 2 2012-02-09 01:07:25 +01:00
Moritz Lipp
8fad2ae7d0 Update mouse event configuration 2012-02-09 00:36:41 +01:00
Moritz Lipp
954ace7a76 Resolve SIGSEGV in sc_abort 2012-02-08 23:42:09 +01:00
Moritz Lipp
70dbf39184 Merge branch 'develop' of pwmt.org:zathura into develop
Conflicts:
	document.c
2012-02-08 23:23:42 +01:00