From 9621fd600e1153146ebd4326f40eef4491396a97 Mon Sep 17 00:00:00 2001 From: David Kastrup Date: Fri, 26 Apr 2013 14:20:28 +0200 Subject: [PATCH] Issue 3293: Add point-and-click to SVG output --- scm/output-svg.scm | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/scm/output-svg.scm b/scm/output-svg.scm index 8e2c532a3b..1df5a53d70 100644 --- a/scm/output-svg.scm +++ b/scm/output-svg.scm @@ -473,13 +473,38 @@ (if (not (ly:get-option 'svg-woff)) embedded-glyph-string woff-glyph-string)) (define (grob-cause offset grob) - "") + (and (ly:get-option 'point-and-click) + (let* ((cause (ly:grob-property grob 'cause)) + (music-origin (if (ly:stream-event? cause) + (ly:event-property cause 'origin))) + (point-and-click (ly:get-option 'point-and-click))) + (and (ly:input-location? music-origin) + (cond ((boolean? point-and-click) point-and-click) + ((symbol? point-and-click) + (ly:in-event-class? cause point-and-click)) + (else (any (lambda (t) + (ly:in-event-class? cause t)) + point-and-click))) + (let* ((location (ly:input-file-line-char-column music-origin)) + (raw-file (car location)) + (file (if (is-absolute? raw-file) + raw-file + (string-append (ly-getcwd) "/" raw-file)))) + + (ly:format "\n" + ;; Backslashes are not valid + ;; file URI path separators. + (ly:string-percent-encode + (ly:string-substitute "\\" "/" file)) + + (cadr location) + (caddr location) + (1+ (cadddr location)))))))) (define (named-glyph font name) (fontify font name)) -(define (no-origin) - "") +(define (no-origin) "\n") (define* (path thick commands #:optional (cap 'round) (join 'round) (fill? #f)) (define (convert-path-exps exps) -- 2.39.5