Commit Graph

443 Commits

Author SHA1 Message Date
Sebastian Ramacher
033833c50d Document that workaround
And a remainder that we want to drop this once we don't support GTK+2 anymore.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-08-14 23:39:34 +02:00
Marawan Tanager
c5e593d3c5 Don't hide the inputbar in case of incremental search
Hiding the inputbar immediately before jumping breaks incremental search, as
Guillaume Duranceau stated in an earlier mail.

This patch makes an exception for the case of incremental search, at the cost
of a slight displacement when jumping back (^o) after ending the incremental
search (pressing the ESC key). The rest of the jump cases are unaffected.

This should makes things usable for now, until we move to GTK3 (link to it by
default) which has a new widget that suits this problem nicely (GtkOverlay), as
demonstrated by an earlier patch by Abdo Roig-Maranges which is now included on
the develop branch in girara repo as commit
70fd1cf354ee1300d4a9bdab9e939d5cc975979e, but is compiled only with GTK3.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-08-14 23:35:43 +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
Guillaume Duranceau
12f7b393a6 new window-title-page option
When set to 'true', this option displays the page number in the title of
a zathura window.
2013-07-27 01:18:46 +02:00
Sebastian Ramacher
2ad8571f41 Add missing includes
Also fix other compiler warnings.

Closes: #332

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-07-25 21:57:39 +02:00
Abdó Roig-Maranges
f3229a6a5a Initialize bisect state when opening document
Otherwise, when opening a document at page 1, and no jumps are added,
bisect does not understand it has to initialize the bisect range, and
does not move from page 1.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-07-07 17:43:30 +02:00
Abdo Roig-Maranges
7cdd1e7719 refresh horizontal position in page_set
After page_set cb_view_hadjustment_changed must be called so that when
zoom-center is enabled, the page is recentered.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-07-07 00:14:56 +02:00
Marwan Tanager
a0c8f4c4ce Fix a memory leak
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-06-30 18:36:12 +02:00
Marwan Tanager
486698d9fb Logical error fix and cleanup for zathura_jumplist_reset_current
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-06-30 18:36:12 +02:00
Sebastian Ramacher
3cf8fba779 Add a note that I want this to go away
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-06-29 11:45:07 +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
87a7f2310f Hide the inputbar and completion menu before saving the adjustments ratios into a new jump structure
Since we are now saving the adjustments ratios in the jump structures, we need
to take care of the following scenario:

    - We do an action that results in a new jump structure being added to the
      jumplist while the inputbar is visible (e.g., search, jumping to a
      specific page, jumping to a bookmark, or following a link).

    - Since we are now storing the adjustments ratios in the jump structures,
      all of the above actions would result in the vertical adjustment ratio
      being saved while the inputbar and/or the completion menu is visible.

    - Now we are exactly on the target of the jump (note that the inputbar and
      completion menu now are hidden), so suppose that we want to go back using
      ^o (assuming that we didn't change the adjustments after jumping), then
      the check at sc_jumplist that compares the current adjustments ratios
      with that of the current jump (the jump that has just been added and
      which we are currently on it's position) would fail, because after the
      inputbar (with possibly the completion menu in case of bookmarks) is
      activated it is hidden, which results in the vertical adjustment upper
      bound to change, which in turn results in the vertical adjustment ratio
      returned by zathura_adjustment_get_ratio to become different from what is
      stored in the current jump structure, even though we haven't changed the
      adjustments at all after the jump.  This would always result in taking us
      back to the exact position of the jump (which would be slightly different
      from the current position) when we press ^o.  This can be annoying,
      because it would happen, for example, every time we need to go back
      quickly after jumping to a link target, a search result, or a bookmark.

So, what this patch does is essentially to make the vertical adjustment ratio
reflecting the current vertical adjustment after a jump, to always be the same
as the one stored in the newly added jump structure, since both are calculated
with zathura_adjustment_get_ratio while the inputbar is _not_ visible, so they
should be the same.

I've elaborated just to make things clear, in case the purpose of the patch
isn't obvious.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-06-29 11:35:13 +02:00
Marwan Tanager
7465ad6871 Jumplist: record the adjustments ratios, rather than their values
This makes jumping works accurately, even if the document is scaled up or down.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-06-29 11:35: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
Moritz Lipp
cdece59229 Fix previous commit 2013-05-28 18:12:15 +02:00
Moritz Lipp
cf96d52790 Report missing plugin/unsupported file type 2013-05-28 17:00:37 +02:00
Moritz Lipp
c07e7a0c39 Unref page twice (Temporary fix #274) 2013-04-17 13:42:03 +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
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
Marwan Tanager
964bdde27f Use gint64 for view time instead of guint64.
The last_view member in zathura_page_widget_private_s is gint64, so we should
do the same here.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-03-29 18:33:15 +01:00
Sebastian Ramacher
4b7347efa7 We get an int from girara_config_get
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-03-26 13:03:07 +01:00
Sebastian Ramacher
1440b45299 Make sure that the page size is positive
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-03-26 12:53:16 +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
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
Sebastian Ramacher
9b1a037fe0 Merge branch 'history-io' into develop 2013-03-17 16:25:19 +01:00
Sebastian Ramacher
c20b5e25c7 Use the correct command history
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-03-17 16:25:02 +01:00
Sebastian Ramacher
92f8784605 Implement input history IO in plain database
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-03-17 16:19:10 +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
fd07d3f5cf Merge branch 'develop' of pwmt.org:zathura into develop 2013-03-14 22:41:57 +01:00
Sebastian Ramacher
47eddd0e86 Implement sqlite backend for input history
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-03-14 22:20:51 +01:00
Sebastian Ramacher
b5dbe9ff6d Drop zathura_db_free
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-03-14 21:30:40 +01:00
Moritz Lipp
42cae85f80 Show warning if document does not contain any pages 2013-03-11 23:26:14 +01:00
Sebastian Ramacher
438c9cdc9f Add statusbar-basename option
Thanks to oblique for the patch.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-02-28 16:20:54 +01:00
Rob Cornish
723f1535e1 Document saves with current basename if given a directory
Currently, if :write is given a directory name as its argument, it fails with the "Failed to save document." error. This can sometimes be quite annoying: for instance, when viewing documents that have been downloaded to /tmp from the web, I often find myself wanting to hang on to file without changing its file name. In order to do so, I either have to leave Zathura and cp the file or else retype the whole filename after :write, neither of which are too convenient.

The following patch would make :write work sort of how mv does: if its argument is a currently existing directory, it will be inferred that the user wants to save the document in that directory using its current basename.

Signed-off-by: Sebastian Ramacher <sebastian@ramacher.at>
2013-01-17 14:28:19 +01:00
Sebastian Ramacher
a6e6c3f108 demote some info-level messages to debug 2013-01-15 11:31:35 +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
Moritz Lipp
89e7832047 Update style 2012-10-09 01:12:18 +02:00
Moritz Lipp
ac88923e5b Print error message if directory creation failed 2012-10-05 00:51:28 +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
f6c6b4a883 En/Disable syntex support 2012-08-13 18:17:20 +02:00
Sebastian Ramacher
30bb64c53d Update German translation. 2012-08-05 15:56:35 +02:00
Moritz Lipp
ec554bc33d Parse command line arguments in main 2012-08-05 15:34:10 +02:00
Moritz Lipp
83865d8998 Use GtkGrid instead of GtkTable 2012-08-05 02:30:03 +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
79cdc73951 Use correct default values. 2012-07-13 14:05:07 +02:00
Moritz Lipp
627a0749bc Update style 2012-07-12 10:39:21 +02:00
Moritz Lipp
66b6fa65a1 Add --version command line argument 2012-07-12 10:37:58 +02:00
Sebastian Ramacher
6b41759cbb Add option to use basename in window title (Closes: #229) 2012-07-02 14:13:13 +02:00