diff options
| author | Andreas Politz <politza@hochschule-trier.de> | 2018-09-24 23:04:20 +0200 |
|---|---|---|
| committer | Andreas Politz <politza@hochschule-trier.de> | 2018-09-24 23:04:20 +0200 |
| commit | 61cff64edd177eeb26d067108f4337ef5293a5a5 (patch) | |
| tree | 9b537b7d862625a17a159ba517276646b25212cd | |
| parent | ce7208191b2bc20663398b189b704c5a1083af4b (diff) | |
Improved handling of default annotation properties
| -rw-r--r-- | NEWS | 8 | ||||
| -rw-r--r-- | lisp/pdf-annot.el | 93 |
2 files changed, 87 insertions, 14 deletions
@@ -1,5 +1,13 @@ -*- org -*- +* Version 0.90 +** Improved handling of default annotation properties + A new variable pdf-annot-default-annotation-properties was + introduced, subsuming and obsoleting + pdf-annot-default-text-annotation-properties and + pdf-annot-default-markup-annotation-properties. The new variable + let's the user choose default properties, e.g. a color, for all + supported annotations separately. * Version 0.80 ** Tablist package The files tablist.el and tablist-filter.el are no longer part of diff --git a/lisp/pdf-annot.el b/lisp/pdf-annot.el index 982aee5..969bc3a 100644 --- a/lisp/pdf-annot.el +++ b/lisp/pdf-annot.el @@ -56,26 +56,87 @@ Implement and describe basic org example." :group 'pdf-annot :type 'hook) -(defcustom pdf-annot-default-text-annotation-properties - `((icon . "Note") - (color . "#ff0000") - (label . ,user-full-name) - (popup-is-open . nil)) - "Alist of initial properties for new text annotations. - -FIXME: Describe. Restrict keys and values." +(defcustom pdf-annot-default-text-annotation-properties nil + "Alist of initial properties for new text annotations." :group 'pdf-annot :type '(alist :key-type symbol :value-type sexp)) -(defcustom pdf-annot-default-markup-annotation-properties - `((label . ,user-full-name) - (popup-is-open . nil)) - "Alist of initial properties for new markup annotations. - -FIXME: Describe. Restrict keys and values." +(defcustom pdf-annot-default-markup-annotation-properties nil + "Alist of initial properties for new markup annotations." :group 'pdf-annot :type '(alist :key-type symbol :value-type sexp)) +(make-obsolete-variable 'pdf-annot-default-text-annotation-properties + 'pdf-annot-default-annotation-properties + "0.90") + +(make-obsolete-variable 'pdf-annot-default-markup-annotation-properties + 'pdf-annot-default-annotation-properties + "0.90") + +(defcustom pdf-annot-default-annotation-properties + `((t (label . ,user-full-name)) + (text (icon . "Note") + (color . "#ff0000")) + (highlight (color . "yellow")) + (squiggly (color . "orange")) + (strike-out(color . "red")) + (underline (color . "blue"))) + "An alist of initial properties for new annotations. + +The alist contains a sub-alist for each of the currently available +annotation types, i.e. text, highlight, squiggly, strike-out and +underline. Additionally a sub-alist with a key of t acts as a default +entry. + +Each of these sub-alists contain default property-values of newly +added annotations of its respective type. + +Some of the most important properties and their types are label +\(a string\), contents \(a string\), color \(a color\) and, for +text-annotations only, icon \(one of the standard icon-types, see +`pdf-annot-standard-text-icons'\). + +For example a value of + + \(\(t \(color . \"red\"\) + \(label . \"Joe\"\) + \(highlight \(color . \"green\"\)\) + +would use a green color for highlight and a red one for other +annotations. Additionally the label for all annotations is set +to \"Joe\"." + + :group 'pdf-annot + :type (let* ((label '(cons :tag "Label" (const label) string)) + (contents '(cons :tag "Contents" (const contents) string)) + (color '(cons :tag "Color" (const color) color)) + (icon `(cons :tag "Icon" + (const icon) + (choice + ,@(mapcar (lambda (icon) + `(const ,icon)) + '("Note" "Comment" "Key" "Help" "NewParagraph" + "Paragraph" "Insert" "Cross" "Circle"))))) + (other '(repeat + :tag "Other properties" + (cons :tag "Property" + (symbol :tag "Key ") + (sexp :tag "Value")))) + (text-properties + `(set ,label ,contents ,color ,icon ,other)) + (markup-properties + `(set ,label ,contents ,color)) + (all-properties + `(set ,label ,contents ,color ,icon ,other))) + `(set + (cons :tag "All Annotations" (const t) ,all-properties) + (cons :tag "Text Annotations" (const text) ,text-properties) + (cons :tag "Highlight Annotations" (const highlight) ,markup-properties) + (cons :tag "Underline Annotations" (const underline) ,markup-properties) + (cons :tag "Squiggly Annotations" (const squiggly) ,markup-properties) + (cons :tag "Strike-out Annotations" (const strike-out) ,markup-properties)))) + (defcustom pdf-annot-print-annotation-functions '(pdf-annot-print-annotation-latex-maybe) "A alist of functions for printing annotations, e.g. for the tooltip. @@ -1055,6 +1116,8 @@ Return the new annotation." (and icon `((icon . ,icon))) property-alist pdf-annot-default-text-annotation-properties + (cdr (assq 'text pdf-annot-default-annotation-properties)) + (cdr (assq t pdf-annot-default-annotation-properties)) `((color . ,(car pdf-annot-color-history)))))))) (defun pdf-annot-mouse-add-text-annotation (ev) @@ -1100,6 +1163,8 @@ Return the new annotation." (and color `((color . ,color))) property-alist pdf-annot-default-markup-annotation-properties + (cdr (assq type pdf-annot-default-annotation-properties)) + (cdr (assq t pdf-annot-default-annotation-properties)) (when pdf-annot-color-history `((color . ,(car pdf-annot-color-history)))) '((color . "#ffff00"))) |
