[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/pdf-tools 97cffdd1b2 6/8: Allow creation of markup annotat
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/pdf-tools 97cffdd1b2 6/8: Allow creation of markup annotations without a text selection |
Date: |
Sat, 10 Jun 2023 16:02:07 -0400 (EDT) |
branch: elpa/pdf-tools
commit 97cffdd1b214d0c6e904630468550802d20f4601
Author: Augusto Stoffel <arstoffel@gmail.com>
Commit: Vedang Manerikar <ved.manerikar@gmail.com>
Allow creation of markup annotations without a text selection
This allows calling `pdf-info-addannot` from Lisp with a nil
`markup-edges` argument, which was previously disallowed.
In this case, the annotation covers exactly the selected region of the
page, without attempting to match it to a certain text region.
This means that you can now highlight an exact region! Just select the
region by holding down the Meta key and dragging the mouse. Then
invoke `pdf-annot-add-highlight-markup-annotation` (with `C-c C-a h`)
and voila!
Closes: #191
---
lisp/pdf-annot.el | 7 +++++--
server/epdfinfo.c | 15 +++++++++++++++
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/lisp/pdf-annot.el b/lisp/pdf-annot.el
index e0f2ae9ae3..078f132cad 100644
--- a/lisp/pdf-annot.el
+++ b/lisp/pdf-annot.el
@@ -1053,9 +1053,12 @@ Return the new annotation."
(> (length edges) 1))
(error "Edges argument should be a single edge-list for text annotations"))
(let* ((selection-style pdf-view-selection-style)
+ (non-markup (pcase type
+ ('text t)
+ ('highlight pdf-view--have-rectangle-region)))
(a (apply #'pdf-info-addannot
page
- (if (eq type 'text)
+ (if non-markup
(car edges)
(apply #'pdf-util-edges-union
(apply #'append
@@ -1066,7 +1069,7 @@ Return the new annotation."
type
selection-style
nil
- (if (not (eq type 'text)) edges)))
+ (unless non-markup edges)))
(id (pdf-annot-get-id a)))
(when property-alist
(condition-case err
diff --git a/server/epdfinfo.c b/server/epdfinfo.c
index 6d3e14efd5..b3925d0ef7 100644
--- a/server/epdfinfo.c
+++ b/server/epdfinfo.c
@@ -1635,6 +1635,21 @@ annotation_new (const epdfinfo_t *ctx, document_t *doc,
PopplerPage *page,
#ifdef HAVE_POPPLER_ANNOT_MARKUP
garray = g_array_new (FALSE, FALSE, sizeof (PopplerQuadrilateral));
poppler_page_get_size (page, &width, &height);
+ if (nargs == 0)
+ {
+ PopplerQuadrilateral q;
+
+ q.p1.x = r->x1;
+ q.p1.y = r->y1;
+ q.p2.x = r->x2;
+ q.p2.y = r->y1;
+ q.p4.x = r->x2;
+ q.p4.y = r->y2;
+ q.p3.x = r->x1;
+ q.p3.y = r->y2;
+
+ g_array_append_val (garray, q);
+ }
for (i = 0; i < nargs; ++i)
{
PopplerRectangle *rr = &carg.value.rectangle;
- [nongnu] elpa/pdf-tools updated (a9c9a12c3e -> 70865fb38d), ELPA Syncer, 2023/06/10
- [nongnu] elpa/pdf-tools 70865fb38d 8/8: Fix: Keep cursor on the same line when reopening list of annots, ELPA Syncer, 2023/06/10
- [nongnu] elpa/pdf-tools fb6616c15e 2/8: Add an FAQ on re-compiling epdfinfo, ELPA Syncer, 2023/06/10
- [nongnu] elpa/pdf-tools c451c0e3db 1/8: Auto enable pdf-view-dark-minor-mode if the theme is dark, ELPA Syncer, 2023/06/10
- [nongnu] elpa/pdf-tools 154e31dc3c 4/8: Display a header line when editing annotation contents, ELPA Syncer, 2023/06/10
- [nongnu] elpa/pdf-tools 0822f438de 7/8: Update NEWS with recent contributions, ELPA Syncer, 2023/06/10
- [nongnu] elpa/pdf-tools 5b58c6bcc3 3/8: Add command and submenu to switch between selection styles, ELPA Syncer, 2023/06/10
- [nongnu] elpa/pdf-tools 6a86b29140 5/8: Use 'C-c C-k' to abandon edits of annotation contents, ELPA Syncer, 2023/06/10
- [nongnu] elpa/pdf-tools 97cffdd1b2 6/8: Allow creation of markup annotations without a text selection,
ELPA Syncer <=