Commit graph

1702 commits

Author SHA1 Message Date
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
030a8c65c1 add functions to compute page positions
The plan is to put in adjustment.c every piece of code that has to do
with document positioning, either computing it from data on the document
side, or talking to GTK.

We want to have at our disposal functions to compute sizes and positions
without having to ask for it to a GTK widget. The new functions are:

 - move page_calc_height_width to adjustment.c

 - add page_calc_position that rotates a position relative to a page
   according to the rotation settings.

 - add position_to_page_number that computes the number of a page
   sitting at a given position (given in document-relative coordinates)

 - add page_number_to_position that computes the position (in document
   relative coordinates) that will be placed at the center of the viewport.

 - add page_is_visible that checks whether the given page intersects the
   viewport.
2013-10-26 17:13:55 +02:00
Abdo Roig-Maranges
bca5bcc571 let the document know about the current adjustments
The document object now has functions to set and get the position and
the viewport size.

The position is a relative position with respect to the size of the
entire document, i.e. position_y=0 means top of the document and
position_y=1 bottom.

The viewport size is stored in screen coordinates, in pixels.
2013-10-26 16:02:27 +02:00
Abdo Roig-Maranges
a0a64832d9 move zathura_get_document_size to document.c
It makes more sense, plus now the document knows about the page layout
and can do the computation.
2013-10-26 16:02:23 +02:00
Abdo Roig-Maranges
0da491f78b merge callbacks for pages-per-row, first-page-column and page-padding
All of those callbacks are conceptually related (change the page
layout), and depend from one another.

Now the single callback page_layout_value_changed defers to
page_widget_set_mode to change whatever is needed in the GTK widgets.
2013-10-26 16:02:21 +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
25998f8320 make the document object aware of page layout
Now the document object knows about pages_per_row, first_page_column and
page_padding, so we will be able to compute sizes and positions of the
document view without querying the GTK widgets.
2013-10-26 15:58:26 +02:00
Abdo Roig-Maranges
f617ee61e5 faster zathura_document_get_cell_size
We precompute the maximum width and maximum height when opening the
document. Then, when someone calls zathura_document_get_cell_size we use
page_calc_width_height to apply the rotation and scale the precomputed
values.
2013-10-26 15:58:26 +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
Marwan Tanager
ed27f8b88e Minor cleanup
Since we 'continue' the loop if num_search_results is 0, there is no need for
the second check.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-10-26 15:12:33 +02:00
Marwan Tanager
cba5d8df77 Fix issue 345 (http://bugs.pwmt.org/issue345)
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-10-26 01:20:57 +02:00
Sebastian Ramacher
834bc8f4c9 CS
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-10-26 01:16:19 +02:00
Abdo Roig-Maranges
3629e3acd2 fix gtk_widget_get_requisition deprecation warning in GTK3
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-10-26 01:12:49 +02:00
Abdo Roig-Maranges
1d5efad36a add a config setting to prevent link_evaluate from changing scale
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-10-26 01:12:32 +02:00
Sebastian Ramacher
f27769d1b7 Fix format string not a string literal
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-10-21 14:19:28 +02:00
Sebastian Ramacher
157c9d6d53 girara_notify takes something the markup parser can understand
This should fix #347.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-10-21 14:16:38 +02:00
Sebastian Ramacher
c918c590ee Rename zathura_page_cache_add
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-10-20 16:06:15 +02:00
Sebastian Ramacher
5df5357fb0 Finish moving of the page cache
Add two more signals to ZathuraRenderRequest to notify pages if they are cached
or not. This allows us to move some logic away from
cb_view_vadjutment_value_changed to more appropriate places.

ZathuraPageWidget will now release the surface if
* it gets the signal that the page is no longer cached and the page is
  invisible,
* the page is not cached and the render request is aborted.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-10-19 17:45:12 +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
Moritz Lipp
f3ef76f909 Initialize x_clipboard_text with NULL 2013-10-07 09:02:38 +02:00
Moritz Lipp
d423ff7305 Allow numbers for quickmarks 2013-09-14 23:43:39 +02:00
Sebastian Ramacher
4e010616e8 It's clipboard
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-09-13 00:01:55 +02:00
Sebastian Ramacher
9d70da690c Add Keywords
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-09-12 19:55:51 +02:00
Sebastian Ramacher
fef9d8f27e Update list of possible arguments
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-09-01 18:23:21 +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
d48f1e023b Use primary selection as before
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-08-31 12:32:12 +02:00
Marwan Tanager
d09cd5c62c Make the X clipboard buffer configurable
This patch adds a new configuration setting, selection-clipboard, which allows
us to choose between the PRIMARY selection, and the CLIPBOARD selection, for
determining which X clipboard to use for storing mouse-selected data. It has
only two valid values: "primary" and "clipboard", with "clipboard" being set as
the it's default value.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-08-31 12:30:12 +02:00
Sebastian Ramacher
7127a46033 Fix deprecated gdk thread function calls
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-08-30 19:25:24 +02:00
Sebastian Ramacher
16fbefa5cf Abort requests if the page becomes invisible
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-08-30 18:59:47 +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
07005886f8 Sort requests based on last view time again
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-08-30 17:50:34 +02:00
Sebastian Ramacher
8d53833d81 Move recolor code into separate function
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-08-30 16:10:44 +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
08a87f679e Mark the request as done in the signal emitter
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-08-30 13:52:58 +02:00
Sebastian Ramacher
9e77b26a3d Don't loop
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-08-30 13:25:59 +02:00
Sebastian Ramacher
35bd419e49 Emit signal from main context
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-08-30 13:25:22 +02:00
Sebastian Ramacher
e733e032ce Add a callback for the signal
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-08-30 12:59:27 +02:00
Sebastian Ramacher
70cebde1f6 Merge branch 'develop' into feature/renderer-take-2 2013-08-30 12:45:41 +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
72573199fe Merge branch 'develop' of pwmt.org:zathura into develop 2013-08-22 22:27:16 +02:00
Sebastian Ramacher
b460c711a0 Save some forks
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-08-22 22:26:52 +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
Moritz Lipp
0afc0e5382 Merge tag '0.2.4' into develop
Version 0.2.4
2013-08-15 00:44:59 +02:00
Moritz Lipp
e5f36e4018 Merge branch 'release/0.2.4' 2013-08-15 00:44:52 +02:00
Moritz Lipp
3978dc30b4 Version 0.2.4 2013-08-15 00:44:50 +02:00
Sebastian Ramacher
eabc306ec8 Run update-po
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-08-15 00:37:57 +02:00