Commit graph

138 commits

Author SHA1 Message Date
Moritz Lipp
0fc5b80121 Replace glib memory functions with try version 2014-01-19 16:47:08 +01:00
Sebastian Ramacher
2eeaef341c Remove unused includes
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2014-01-14 18:13:14 +01:00
Sebastian Ramacher
5021767a18 Split of guess_content_type
… and use it everywhere we want to get the content type of a file.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2014-01-14 18:01:34 +01:00
Sebastian Ramacher
8d2e331b1a Fix up some types
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2014-01-10 18:53:21 +01:00
Sebastian Ramacher
40fe7cdd9e Some typos
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2014-01-07 03:43:38 +01:00
Sebastian Ramacher
5d2666daf5 Move file based detection into separate function 2014-01-06 01:18:56 +01:00
Sebastian Ramacher
ecf090b9b1 Split guess_type methods into separate functions
Also don't try to run file if we have libmagic available.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2014-01-05 23:40:37 +01:00
Sebastian Ramacher
086d49bb1a Be consistent with earlier versions
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-11-22 06:24:38 +01:00
Sebastian Ramacher
badc0e2815 Make sure that first-page-column does not exceed any bounds
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-11-22 06:14:41 +01:00
Sebastian Ramacher
403d867ca4 Some CS
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-11-05 02:23:52 +01: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
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
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
Moritz Lipp
df466eeeb2 Fix 2013-05-28 23:39:18 +02:00
Moritz Lipp
cf96d52790 Report missing plugin/unsupported file type 2013-05-28 17:00:37 +02:00
Moritz Lipp
87f10baffc Allow negative offsets 2013-05-08 18:28:32 +02:00
Sebastian Ramacher
9a00028a0d Remove some unnecessary \ns
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-03-26 15:21:03 +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
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
7c3fa7fd1a Add support to detect mimetypes with magic
Thanks to Diego Joss <djego.joss@gmail.com> for the patch.
2013-02-08 10:59:26 +01:00
Sebastian Ramacher
9765b43113 Cover all cases of read.
Files smaller than GT_MAX_READ cause guess_type to hang in an endless loop.

Closes: #285
2013-01-17 10:13:31 +01:00
Benoît Knecht
27d7973586 Add document method to compute the size of a cell
A document is laid out on a homogeneous gtk table/grid. This new method,
zathura_document_get_cell_size, computes the size of the cells in that
table/grid, at the current scale.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2012-12-13 18:18:03 +01:00
Moritz Lipp
89e7832047 Update style 2012-10-09 01:12:18 +02:00
Moritz Lipp
5ad335043d Hide plugin structure and introduce new functions 2012-06-13 16:08:24 +02:00
Moritz Lipp
488ab101e9 Set default adjust mode to none 2012-04-21 00:00:03 +02:00
Moritz Lipp
97247f41ca Unhitch zathura_t from document_t/page_t/plugin_manager_t 2012-04-03 09:02:45 +02:00
Moritz Lipp
1b44ccb0f8 Add missing include 2012-04-01 21:15:32 +02:00
Moritz Lipp
025c995d89 Introduce plugin manager 2012-04-01 18:32:16 +02:00
Moritz Lipp
ab4c364e56 Update document information plugin api 2012-03-30 18:24:00 +02:00
Moritz Lipp
64e9f540fb Fix set_rotation 2012-03-28 16:44:46 +02:00
Moritz Lipp
334b4fbb95 Introduce and use zathura_document wrapper functions 2012-03-27 21:59:35 +02:00
Moritz Lipp
647f26a77f Implemented some zathura_document wrapper functions 2012-03-27 14:44:09 +02:00
Moritz Lipp
61d7a6a436 Pass document/page data to plugin functions 2012-03-27 14:22:36 +02:00
Moritz Lipp
4ade2c1472 Introduced plugin.h and plugin-api.h 2012-03-27 13:30:04 +02:00
Moritz Lipp
fa40facc71 Begin to introduce types.h 2012-03-27 11:19:39 +02:00
Moritz Lipp
1133207a48 Update zathura_page plugin functions 2012-03-26 15:17:01 +02:00
Moritz Lipp
efc108fbe2 Introduced page.h 2012-03-26 14:44:56 +02:00
Moritz Lipp
90796b5b5c Added :offset command and some style updates 2012-03-24 18:27:10 +01:00
Sebastian Ramacher
22d750eb4e If g_guess_content_type fails, fall back to file. 2012-03-23 18:08:24 +01:00
Sebastian Ramacher
1dd2430554 If g_content_type_guess is certain, stop early. 2012-03-22 16:28:36 +01:00
Sebastian Ramacher
9c334cc6a6 Add ABI versioning. 2012-03-21 16:23:29 +01:00
Sebastian Ramacher
393fb2a2b6 Simplify zathura_document_plugins_load. 2012-03-19 17:13:00 +01:00