Commit Graph

183 Commits

Author SHA1 Message Date
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