1
0
mirror of https://gitlab.gnome.org/GNOME/evince synced 2024-07-05 00:59:07 +00:00
Commit Graph

706 Commits

Author SHA1 Message Date
Nelson Benítez León
c76be8ba6f use default color when annotation has no color
Annotations may come with a NULL color, use
a default color there instead of letting
undefined GdkRGBA to crash the application.

We take the chance to share this default color
to be the same we already use when creating
an annotation from Evince.

We also take the chance to replace deprecated
function ev_annotation_set_color() with
ev_annotation_set_rgba()

Fixes crash in #1800
2022-06-05 11:52:56 -04:00
Germán Poo-Caamaño
204ec3a77b Add deprecation guards to now old find text related functions 2022-05-23 00:04:27 -04:00
Nelson Benítez León
495dd97e46 Add support for multi-line text search
which is available in Poppler since version 21.03.0

For that we create a new EvFindRectangle type to hold more match
information apart from coordinates, and use it all across Evince
including pdf backend (ev-poppler.cc) and djvu backend (djvu-document.c)
which are the only backends implementing the EvDocumentFindInterface.

To not break API compatibility, we added a new EvDocumentFindInterface
function which returns GList of this new EvFindRectangle type:

   GList *(* find_text_extended) (EvDocumentFind *document_find,
                                  EvPage         *page,
                                  const gchar    *text,
                                  EvFindOptions   options);

and changed Evince to use this new function instead of find_text_with_options().

Some info about how this new search feature works:

 - Ignores hyphen character while matching when:
      1) it's the last character of the line.
      2) its corresponding matching character in the search term
         is not an hyphen too.

 - Any whitespace characters in the search term will be allowed
   to match on the logic position where the lines split (i.e. what
   would normally be the newline character in a text file, but
   PDF text does not include newline characters between lines).

 - It won't match on text spanning more than two lines, i.e. it
   only matches text spanning from end of one line to start of
   next line.

Part of issue #333
2022-05-22 21:14:46 +00:00
Germán Poo-Caamaño
2dd19b3e30 libview: Fix typos in annotations 2022-03-02 16:08:07 -03:00
Germán Poo-Caamaño
e429e0b8c9 libview: Fix compilation warning on multiline string 2022-03-02 16:03:10 -03:00
Mads Chr. Olesen
9aaddb477c libview: set has-tooltip property unconditionally at init
The conditional setting seems to be an old artifact of once using
EvTooltip, instead of GTK tooltips.
2022-02-23 18:08:38 -03:00
Mads Chr. Olesen
f07b41adec libview: Bugfix: Move cursor over link handling to a separate function
Make "set-tooltip" set, even if no preview is shown.

Fixes #1695
2022-02-23 18:08:38 -03:00
Nelson Benítez León
e5594f9646 pdf: let launch action to open pdfs from click event
Issue #1333 removed Evince ability to run any command
from pdf 'launch action', while the security concerns
brought up in #1333 were valid, the measure implemented
was maybe too drastic, as there are valid use cases
where launching a pdf is needed.

For instance, the cases described in issue #48, one of
them is the document 'Nissan Patrol Maintenance Manual'
which is comprised of several pdf files, where there is
one acting as index for the others, this index pdf file
uses the launch action to open the other pdf's.

So this commit allows to launch a file from a link
action only when:

- that file is a pdf file.
- the launch action originates from click event,
  to be sure the user requested the action.

Besides, we don't just let the system execute the
file, but because it's a pdf we do it ourselves by
launching a new evince instance (or if that file was
already opened then presenting its window).

Fixes issue #48
2022-02-23 18:04:48 +00:00
Nelson Ben
da076895b1 EvView: fix cancelling ongoing highlight text annotation
Fix ev_view_cancel_add_annotation() to correctly cancel
an ongoing highlight text annotation.

Fixes issue #1690
2022-02-23 17:55:54 +00:00
Nelson Benítez León
04b2736786 New EvView signal to inform EvWindow we cancelled adding annotation
EvView have signals 'annot-added', 'annot-removed', 'annot-changed'
which EvWindow connects to update the window widgets accordingly.

When cancelling an ongoing add-annotation operation through eg.
not highlighting any text when adding a markup annotation, we
don't have any corresponding signal to let EvWindow know of this
cancel (as 'annot-added' is only for when it's created
succesfully).

So we add a new EvView 'annot-cancel-add' signal which is
emitted for this case and that EvWindow can respond to it
by updating the ui accordingly i.e. unpressing button in
EvAnnotationsToolbar.

Fixes part of #1730
2022-02-23 16:43:34 +00:00
Nelson Benítez León
6f06d2d688 EvView: preview popups only triggered by motion events
to avoid unwanted previews showing up in any of these
situations:

- when scrolling the view
- when pressing PageUp/PageDown or NextPage/PrevPage keys
- when changing to a page by clicking a bookmark or outline entry

we make sure to only show them when moving the mouse over them
(motion events).

Fixes issue #1666
2022-01-19 05:34:43 +00:00
Alexander Mikhaylenko
70916d5ed5 annotation-window: Fix title color
Use the same color for title as for the button instead of hardcoded black.
Remove the css that was leaking out to the context menu.
2022-01-12 03:24:53 +00:00
Christian Persch
117e36e6ae libview: Add Portal implementation of EvPrintOperationExport
Add EvPrintOperationExportPortal that uses the Print portal.
2022-01-12 02:05:56 +00:00
Christian Persch
454a350963 libview: Split the unix printing impl from the export print operation
Make EvPrintOperationExport an abstract base class, and move the
unix printing specific code to a new EvPrintOperationExportUnix.

This is in preparation to creating a EvPrintOperationExportPortal
which implements the export operation via Portal.
2022-01-12 02:05:56 +00:00
Christian Persch
e36ee4065d libview: Use GObject:constructed instead of constructor 2022-01-12 02:05:56 +00:00
Christian Persch
d73ac65cf4 libview: Whitespace cleanup 2022-01-12 02:05:56 +00:00
andreastedile
ad215dc600 libview: Open annotation windows when opening the document
By right clicking an annotation and selecting "Annotation Properties...",
there exists an option called "Initial window state" which regulates
whether the annotation window should be opened when opening the document.
This behavior was altered by commit aed1af6fa7,
whose purpose was exactly to prevent annotation windows from opening
for performance reasons.

Fixes: https://gitlab.gnome.org/GNOME/evince/-/issues/1425
2022-01-12 01:56:11 +00:00
Qiu Wenbo
b6237a2b2e doc: migrate to gi-docgen
Switch to gi-docgen to build the documentation.

Signed-off-by: Qiu Wenbo <qiuwenbo@kylinos.com.cn>
2022-01-09 00:13:20 +08:00
Christian Persch
39694038f5 libview: Add EvJobLoad class to load from file descriptor 2022-01-08 00:03:15 -03:00
Christian Persch
60ba7b0ee5 all: Replace include guards with pragma once
Instead of using the "#ifndef FOO_H", "#define FOO_H", …, "#endif FOO_H"
guards around the header file, use the "#pragma once".
2021-12-15 02:24:07 +00:00
Marek Kasik
8f7a7a1477 libview: Do not draw invalid surface
Fail the render job if the surface is in error state. This prevents
the failure of the render job leaking out to failing to render the
evince UI.

Based on a patch by Marek Kasik <mkasik@redhat.com>.
2021-12-02 23:24:55 +00:00
Christian Persch
6d5c94ee99 libview: Fix volatile misuse
Remove an incorrect/extraneous 'volatile', fixing a build warning about
incompatible pointer types with g_atomic_pointer_get().
2021-12-01 21:31:36 +01:00
Christian Persch
8ac25ff55e libview: Use symbol visibility for exported symbols
Use the newly added EV_PUBLIC macro to explicitly mark symbols to be
exported, instead of exporting everything starting with "ev_".

This removes lots of accidentally exposed, private functions. Since
those are not contained in public installed headers, this should be ok.
2021-12-01 16:51:33 +01:00
Christian Persch
40f495fbe2 libview: ev-view-cursor.h private to libview 2021-12-01 16:51:33 +01:00
Christian Persch
565be9b044 libview: EvPixbufCache is private to libview 2021-12-01 16:51:33 +01:00
Christian Persch
024d912682 libview: EvPageCache is private to libview
... so don't add it to the public API documentation.
2021-12-01 16:51:33 +01:00
Christian Persch
97a8f67a8c libview: EvAnnotationWindow is private to libview
... so don't add it to the public API documentation.
2021-12-01 16:51:33 +01:00
Christian Persch
c2c24b68da libview: Fix critial warnings when destroying EvPageAccessible
Only clear priv->links when it's not NULL. This fixes lots of warnings
when closing the previewer window on a document with links:

GLib-CRITICAL **: 23:46:34.810: g_hash_table_remove_all: assertion 'hash_table != NULL' failed
GLib-CRITICAL **: 23:46:34.810: g_hash_table_destroy: assertion 'hash_table != NULL' failed
2021-12-01 00:26:58 +00:00
Germán Poo-Caamaño
eb18290336 libview: Fix gobject-introspection deprecation warning
* Use annotations on the identifier instead of Gtk-Doc tag to rename
  function
2021-11-30 20:55:29 -03:00
Christian Persch
bc595ce828 build: Fix dependency tracking
The executables must declare their dependency on
libevdocument/libevview, so that a rebuild works correctly.
2021-11-30 22:16:19 +00:00
Christian Persch
abb4433981 libview: Fix volatile misuse 2021-11-30 22:08:51 +00:00
Germán Poo-Caamaño
ffe10b249c libview: Fix compilation warning on accessibility code path 2021-10-17 17:09:18 +00:00
Qiu Wenbo
49b75ccd61 Remove legacy code path for Gtk < 3.22
Evince depends on GTK 3.22, hence we do not need those safeguards
for running on old GTK versions as they would fail anyway.

Signed-off-by: Qiu Wenbo <qiuwenbo@kylinos.com.cn>
2021-10-11 21:59:56 -03:00
Qiu Wenbo
bf49bd4e0d libview: fix a typo of function name
Signed-off-by: Qiu Wenbo <qiuwenbo@kylinos.com.cn>
2021-10-11 14:44:34 -03:00
Michaël B
42f4694893 libview: Open new annotation window only for text annotation
Commit 722b38a2bc introduce the automatic opening of new annotation window when a user highlight text.
While it is convenient for reviewing articles, it is not for users who only want to highlight text or annotate in some other way.
2021-08-25 12:16:26 +00:00
Jose Santos
0ae3f1ca0a shell: Adding padding to improve readability
When adding a note the text view lacks padding, and the text is too
close to the borders.

Fixes #1571
2021-06-26 16:31:53 -04:00
Mads Chr. Olesen
62c38a8b16 shell: Reload the annotation sidebar when the type changes
* Reload the annotation sidebar when an annotation is changed
  (including by the properties dialog which did not update the
   sidebar before)

Fixes #1004
2021-06-26 15:51:24 -04:00
Mads Chr. Olesen
722b38a2bc shell: Always show the annotation window on new annotations
Every time the user annotates, it opens the annotation window
to let the user enter content associated to the annotation.
2021-06-26 15:47:52 -04:00
Nelson Benítez León
e948907ce6 Presentation: fix g_critical about removing non-existant timer 2021-06-26 05:06:20 +00:00
Nelson Benítez León
d4ab3574d1 EvTransitionEffect: support duration in decimal value
Property 'duration' of EvTransitionEffect was of
int type, so when passing a 0.5 value it would
cast to zero.

So let's add a new 'duration_real' property to hold
the duration in decimal format, and use it for the
effect's duration.

Fixes #637
2021-06-26 05:06:20 +00:00
Raghuveer Kasaraneni
0c3cd02db3 libview: dual page option is ignored for single page documents
The dual page setting doesn't make sense when the document contains
only one page. With this change, dual page setting is ignored for
displaying single page documents.

Closes #220
2021-06-09 04:26:25 +00:00
Kalev Lember
ca4b7aaff6 Avoid changing soname
Bumping the major version to 40 in commit
288be740b5 inadvertently changed the
soname for shared libevdocument and libevview.

Fix this by making the soname calculation independent from the project
version as the library ABI hasn't actually changed.
2021-03-26 14:53:15 +01:00
Nelson Benítez León
08f54ef415 keep same visual appearance between displayed and copied text
When copying text from displayed document to the clipboard,
we want a normalization that preserves 'canonical equivalence'
i.e. that the text after normalization is not visually
different than the original text. Our previous normalization
was just preserving unicode 'compatibility'.

Relevant documentation:
* https://www.win.tue.nl/~aeb/linux/uc/nfc_vs_nfd.html
* https://en.wikipedia.org/wiki/Unicode_equivalence
* https://developer.gnome.org/glib/stable/glib-Unicode-Manipulation.html#g-utf8-normalize

Issue #1085
2021-02-12 01:25:16 -04:00
Andrew Mayorov
0296d46f3a
libview: forgo setting device offset on page surfaces
I believe that passing unscaled offset coordinates to cairo_set_source_surface
during a process of drawing a page _effectively_ does the same transformation.

Also this fixes link preview popups when a link is on the currently viewed
page, because the solution introduced in commit caad329a did not account for
nonzero device offsets. Without this patch any preview of a link referring
to the current page would go completely black when the page is scrolled at
least popup's height pixels down.
2021-02-06 21:57:43 +03:00
Mads Chr. Olesen
caad329a6f libview: Fix support for HiDPI in link preview
When showing link preview popover we should take device_scale
into consideration.

Two cases must be handled:
1. If we get the page_surface from the ev_pixbuf_cache
   (this typically happens if link is to same page or within +/- 10
pages)
2. If we render the page_surface by our own job
   (this typically happins if link is more than 10 pages away)

Fixes #1543
2021-01-27 22:08:32 +01:00
Jonas Danielsson
691b9d788f print: Add print setting to draw borders
Fixes #221
2021-01-23 22:08:52 -03:00
Nelson Benítez León
42e88f9c4a presentation mode: fix X11 regression
caused by my commit b2b9012c5e because
it added a wayland fix without ensuring
it'll be used in Wayland only.

Fixes #1504
2021-01-06 16:38:31 +00:00
Chris Lamb
3a8954af85 Make the build reproducible
The Reproducible Builds effort <https://reproducible-builds.org/>
noticed that evince could not be built reproducibly.

This is because it generates .h header files that contain the absolute
build path via the @filename@ placeholder.

Use @basename@ instead — these are comments, after all.

Bug-Debian: https://bugs.debian.org/970383
2020-10-13 10:33:40 +01:00
Marek Kasik
fe9573da12 Handle reset form action
Add new type of action EV_LINK_ACTION_TYPE_RESET_FORM for EvLinkAction
together with properties "reset-fields" and "exclude-reset-fields".
The properties controls which fields are reset and are set in PDF document.
This commit extends EvDocumentFormsInterface with new method "reset_form".

Issue #46
2020-08-30 15:28:07 +00:00
Germán Poo-Caamaño
b1de8c2844 pdf: Reimplement 'de facto' tooltip with no ABI break
Structs in EvForm are not opaque, and
Commit e2ad8611a4 introduced a ABI change
2020-08-30 10:27:09 -04:00