Commit Graph

474 Commits

Author SHA1 Message Date
Sebastian Ramacher
f7fddf750e Initial D-Bus interface for synctex
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-12-23 18:16:36 +01:00
Sebastian Ramacher
45a997c88e More consts
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-12-17 16:32:50 +01:00
Sebastian Ramacher
660a3e7757 CS
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-12-17 16:27:34 +01:00
Sebastian Ramacher
87af53afbb Make inital values more explicit
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-12-17 16:26:13 +01:00
Sebastian Neuser
42a8382a45 Set position on document load only if no page was specified 2013-12-17 15:38:40 +01:00
Sebastian Ramacher
f59a6f539e Remove GTK+2 support
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-11-25 18:57:59 +01:00
Sebastian Ramacher
903dae55e0 Get the correct adjustment
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-11-05 02:29:20 +01:00
Sebastian Ramacher
08d799a1f8 Set viewport info early and set correct page size the first time
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-11-05 02:22:30 +01:00
Sebastian Ramacher
cc0ad0ad64 Make a string translatable 2013-11-04 19:57:23 +01:00
Sebastian Ramacher
3575157cb2 Connect the correct callback
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-10-31 14:39:32 +01:00
Abdo Roig-Maranges
e02806b6e2 get rid of the hide_inputbar hack
We no longer need to hide the inputbar to get the right jump position,
since now showing or hiding the inputbar does not change the position
stored in the document object.

Wen the adjustments get resized, the changed_callback resets the value
from what is stored in the document object, effectively recentering the
position to the middle of the viewport.
2013-10-26 17:13:57 +02:00
Abdo Roig-Maranges
84736dc89b remove zathura->global.update_page_number global hack
The callbacks are no longer aware of it anyways
2013-10-26 17:13:57 +02:00
Abdo Roig-Maranges
9367d646d9 get rid of tracking adjustments
They are not used anywere, and do not seem to become useful anymore in
the light of the new separation of document and view.
2013-10-26 17:13:56 +02:00
Abdo Roig-Maranges
860c748889 remove delayed versions of page_set and position_set
We don't need the anymore since the new page_set and position_set are
already 'delayed'.
2013-10-26 17:13:56 +02:00
Abdo Roig-Maranges
4a75efd4f2 use the new document functions for the jumplist
And get rid of explicit gtk calls to the adjustment
2013-10-26 17:13:56 +02:00
Abdo Roig-Maranges
6ca81e3716 use the new document functions for marks, bookmarks and initialization
We get the position data from the document object instead of the gtk
adjustment itself.
2013-10-26 17:13:56 +02:00
Abdo Roig-Maranges
1171bffb6b replace delayed versions of page_set and position_set
The new page_set and position_set behave as delayed, but with the
immediate availability of the new positions through the document
object. We no longer need to keep delayed and non-delayed versions!
2013-10-26 17:13:56 +02:00
Abdo Roig-Maranges
3634636227 adapt view_adjustment callbacks to new document/view separation
The adjustment callbacks act as an interface between position data in
the document object, and the adjustments.

We remove the horizontal centering code, as now it is done by
position_set. Those callbacks should not change the position read from
the document object in any way.

Also, we split the adjustment_value_changed callback into a vertical and
an horizontal version. Previously a single callback was reused for both,
horizontal and vertical. That lead to a subtle problem when coming out
of index mode. What happened was the following:

  1. horizontal adjustment bounds change coming out of index mode. This
     triggers an hadjustment changed signal.

  2. the hadjustment_changed callback handles it, and resets the
     hadjustment value, as the bound may have changed. This triggers a
     value_changed event.

  3. the value_changed callback handles the event, and captures the
     position for *BOTH*, horizontal and vertical adjustments, saving
     them to the document object.

  1..3 is repeated for the vertical adjustment.

  Now, if in 3. the horizontal adjustment bounds were not yet updated
  after the index mode, we got ourselves at the wrong vertical position.

This race condition is avoided now because both value_changed callbacks
*ONLY* handle their own direction, either vertical or horizontal, not
 both.
2013-10-26 17:13:56 +02:00
Abdo Roig-Maranges
c4245600c9 move adjustment code from sc_adjust_window to adjust_view
This new function adjust_view is in charge of recomputing the scale
according to adjustment settings and trigger a render_all.

adjust_view contains the old sc_adjust_window code, slightly simplified
thanks to the availability of the document_get_viewport_size.

Then it is used by sc_adjust_window, document_open and the
cb_view_resized callback. Makes slightly more sense this way than
calling the shortcut sc_adjust_window directly.
2013-10-26 17:13:56 +02:00
Abdo Roig-Maranges
54b6f7336d make position_set and page_set more asynchronous
Now page_set and position_set save the computed page and position to the
document object, then trigger a refresh-view signal. They do not handle
GTK adjustments anymore.
2013-10-26 17:13:56 +02:00
Abdo Roig-Maranges
692e72abd4 add a custom refresh-view signal
Now we can trigger a gtk page refresh calling refresh_view. This
function triggers a custom signal refresh-view, whose handler copies the
position from the document object to the adjustments.
2013-10-26 17:13:56 +02:00
Abdo Roig-Maranges
c5930c900a page_widget_set_mode now sets the page-padding too
- fix the computation of the number of rows in the table. Doing a ceil
    of an integer division has no effect...

  - set the page_padding in page_widget_set_mode function, instead of
    doing it independently.

  - call zathura_document_set_layout after calling page_widget_set_mode
    to save the page layout settings into the document object.
2013-10-26 16:01:02 +02:00
Abdo Roig-Maranges
7329209d84 change arguments to page_calc_height_width
now accepts a document object and explicit width and height. This will
make it easier to reuse this function for computing the document page
cell width and height.
2013-10-26 15:58:26 +02:00
Sebastian Ramacher
e7cd4e5f8c Move page cache to ZathuraRenderer
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-10-18 20:00:04 +02:00
Sebastian Ramacher
2c9e34fa8a Merge branch 'feature/renderer-take-2' into develop 2013-10-18 16:12:50 +02:00
Sebastian Ramacher
2ad2b9e0c4 Use signals for selected images and text
The page widget shouldn't have to care what should be done with selected images
and text.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-08-31 13:12:41 +02:00
Sebastian Ramacher
a9f044c951 Set recolor info initially
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-08-30 18:55:42 +02:00
Sebastian Ramacher
8a9bd7f512 We don't need zathura
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-08-30 15:43:43 +02:00
Sebastian Ramacher
7d5863ae1d Clean up includes
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-08-30 15:05:00 +02:00
Sebastian Ramacher
b02d3d4b8f Move recolor state to the renderer
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-08-24 00:07:32 +02:00
Sebastian Ramacher
10115db62f Rewrite render thread as request based system
ZathuraRenderer is a thread pool rendering the pages. Every page widget holds a
ZathuraRenderRequest instance to request its page to be rendered. This object
can also be used to abort the request in case the page is not visible anymore.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-08-21 18:32:18 +02:00
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