]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/output-ps.scm
Merge commit 'ce4b499'
[lilypond.git] / scm / output-ps.scm
index 1a136ba772b2f14dbd6c843daeffcf842386245d..5b5217868caf4bef7ca986f64df2fa622421ae9c 100644 (file)
@@ -2,7 +2,7 @@
 ;;;;
 ;;;;  source file of the GNU LilyPond music typesetter
 ;;;; 
-;;;; (c) 1998--2006 Jan Nieuwenhuizen <janneke@gnu.org>
+;;;; (c) 1998--2007 Jan Nieuwenhuizen <janneke@gnu.org>
 ;;;;                 Han-Wen Nienhuys <hanwen@xs4all.nl>
 
 ;;;; Note: currently misused as testbed for titles with markup, see
 
 
 (define (grob-cause offset grob)
-  (let* ((cause (ly:grob-property grob 'cause))
-        (music-origin (if (ly:stream-event? cause)
-                          (ly:event-property cause 'origin))))
-    (if (not (ly:input-location? music-origin))
-       ""
-       (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)))
-              (x-ext (ly:grob-extent grob grob X))
-              (y-ext (ly:grob-extent grob grob Y)))
-
-         (if (and (< 0 (interval-length x-ext))
-                  (< 0 (interval-length y-ext)))
-             (ly:format "~4f ~4f ~4f ~4f (textedit://~a:~a:~a:~a) mark_URI\n"
-                        (+ (car offset) (car x-ext))
-                        (+ (cdr offset) (car y-ext))
-                        (+ (car offset) (cdr x-ext))
-                        (+ (cdr offset) (cdr y-ext))
-
-                        ;; TODO
-                        ;;full escaping.
-
-                        ;; backslash is interpreted by GS.
-                        (ly:string-substitute "\\" "/" 
-                                              (ly:string-substitute " " "%20" file))
-                        (cadr location)
-                        (caddr location)
-                        (cadddr location))
-             "")))))
-
+  (if (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))))
+       (if (ly:input-location? music-origin)
+           (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)))
+                  (x-ext (ly:grob-extent grob grob X))
+                  (y-ext (ly:grob-extent grob grob Y)))
+
+             (if (and (< 0 (interval-length x-ext))
+                      (< 0 (interval-length y-ext)))
+                 (ly:format "~4f ~4f ~4f ~4f (textedit://~a:~a:~a:~a) mark_URI\n"
+                            (+ (car offset) (car x-ext))
+                            (+ (cdr offset) (car y-ext))
+                            (+ (car offset) (cdr x-ext))
+                            (+ (cdr offset) (cdr y-ext))
+
+                            ;; TODO
+                            ;;full escaping.
+
+                            ;; backslash is interpreted by GS.
+                            (ly:string-substitute "\\" "/" 
+                                                  (ly:string-substitute " " "%20" file))
+                            (cadr location)
+                            (caddr location)
+                            (cadddr location))
+                 ""))
+           ""))
+      ""))
 
 (define (named-glyph font glyph)
   (ly:format "~a /~a glyphshow " ;;Why is there a space at the end?
   "\n unknown\n")
 
 (define (url-link url x y)
-  (ly:format "~a ~a ~a ~a (~a) mark_URI"
+  (ly:format "~a ~a currentpoint vector_add  ~a ~a currentpoint vector_add (~a) mark_URI"
             (car x)
             (car y)
             (cdr x)