Commit Graph

1435 Commits

Author SHA1 Message Date
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
Sebastian Ramacher
cd3314b490 Save some string copies
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-03-25 02:58:37 +01:00
Marwan Tanager
e7cbd25be0 Don't render if the new surface passed to zathura_page_widget_update_surface is NULL.
I don't see any reason for queueing a redraw if the new surface is NULL.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-03-24 15:42:27 +01:00
Sebastian Ramacher
9c1503809a CS
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-03-23 16:12:38 +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
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
f4b17f3389 Add 'q' and 'BackSpace' shortcuts in fullscreen mode
Now by default, 'q' quits zathura even in fullscreen mode, and
'BackSpace' does the reverse of 'space', i.e. go back one page.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-03-17 14:15:11 +01:00
Benoît Knecht
e13ae4cfb7 Update French translation
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-03-17 14:15:00 +01:00
Benoît Knecht
ea6fa95074 Update translations
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-03-17 14:14:35 +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
b895759e72 Add oblique
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-03-09 18:54:42 +01:00
Sebastian Ramacher
c0802434e6 Update AUTHORS
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-03-09 18:53:52 +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
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
Moritz Lipp
1c70185171 Update man page 2013-02-28 12:10:50 +01:00
Moritz Lipp
af0d5ccd2c Update README 2013-02-24 12:29:01 +01:00
Sebastian Ramacher
7ad6c2f422 Don't render same page multiple times
If we have already requested a page to be rendered, we don't have to request it
once again.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-02-24 03:27:57 +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
Sebastian Ramacher
0e3efe0504 Fix compiler warnings
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-02-23 17:32:30 +01:00
Sebastian Ramacher
f2ed53aa72 Fix the off-by-one with the poppler plugin
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-02-23 17:18:02 +01:00
Sebastian Ramacher
1fd5ca3ebb Remove some duplicated code
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-02-23 16:48:19 +01:00
Sebastian Ramacher
cad4b11764 Talk a bit more about flags.
Closes: #292
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-02-23 14:12:44 +01: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
Sebastian Ramacher
9134040300 Build tests with magic if WITH_MAGIC != 0
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-02-22 15:58:13 +01:00
Sebastian Ramacher
0a92abe720 Fix the logic in guess_type 2013-02-19 15:27:23 +01:00
Sebastian Ramacher
1899011a6c add some debug output 2013-02-19 15:19:10 +01:00
Sebastian Ramacher
4446456159 add some comments 2013-02-13 15:43:02 +01:00
Sebastian Ramacher
c6c0fd1ce2 Merge branch 'staging-mime' into develop
Conflicts:
	Makefile
	config.mk
	document.c
2013-02-13 15:41:38 +01:00
Diego Joss
1d23f466a2 replace g_content_type_guess with libmagic
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-02-13 15:33:29 +01:00
Sebastian Ramacher
4b1edf1a41 Be a bit more verbose in the README
There is another software called magic out there, so let's call it libmagic from
file(1).
2013-02-13 15:25:52 +01:00
Sebastian Ramacher
376aea65a0 Remove the note that glib >= 2.32 is required 2013-02-09 15:42:52 +01:00
Sebastian Ramacher
519c606923 g_get_real_time appeard in 2.28 2013-02-09 15:18:35 +01:00
Sebastian Ramacher
edde1bf00f Restore compatibility with earlier versions of glib
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-02-09 15:10:00 +01:00
Sebastian Ramacher
b0d5cdd7c0 Don't call g_threads_init with glib 2.31 and newer 2013-02-08 19:05:36 +01:00
Ignas Anikevicius (gns_ank)
c839e3fced Add Ignas to AUTHORS
Signed-off-by: Ignas Anikevicius (gns_ank) <anikevicius@gmail.com>
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-02-08 18:03:07 +01:00
Ignas Anikevicius (gns_ank)
7dd30a42cf Fix some mutex deprecation warnings in page-widget
According to my compiler output and the page on glib deprecated APIs
[1], some of the stuff needed to be removed or changed.

[1] - http://developer.gnome.org/glib/2.31/glib-Deprecated-Thread-APIs.html

Signed-off-by: Ignas Anikevicius (gns_ank) <anikevicius@gmail.com>
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-02-08 18:03:07 +01:00
Ignas Anikevicius (gns_ank)
bb8bfc0dd3 Set the horizontal scroll step
Previously it was set to -1, which was essentially disabling the
horizontal scrolling. This enables the scrolling by default by setting
it to be the same as the vertical scrolling.

Signed-off-by: Ignas Anikevicius (gns_ank) <anikevicius@gmail.com>
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-02-08 18:03:06 +01:00
Marwan Tanager
815c51d066 Pass hadjustment to set_adjustment() instead of vadjustment.
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-02-08 14:24:18 +01:00
Sebastian Ramacher
3f20ede9ab Add Marwan and Diego to AUTHORS 2013-02-08 10:59:54 +01:00
Sebastian Ramacher
f51d66b8ed Update README 2013-02-08 10:59:43 +01:00