]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/display-lily.scm
Merge branch 'master' of git://git.savannah.gnu.org/lilypond.git
[lilypond.git] / scm / display-lily.scm
index 51b13eb25941f21356691c0a48a59c459e185365..302259fa23eda7d78d9704dc87f0c77fa6edbb15 100644 (file)
@@ -28,9 +28,7 @@
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-13)
   #:use-module (srfi srfi-39)
-  #:use-module (lily)
-  #:use-syntax (srfi srfi-39)
-  #:use-syntax (ice-9 optargs))
+  #:use-module (lily))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;
@@ -81,6 +79,15 @@ display method will be called."
                 (format #f "~a\\tag #'~a" (if post-event? "-" "") tag))
               (ly:music-property expr 'tags))))
 
+(define* (tweaks->lily-string expr #:optional (post-event? #f))
+  (format #f "~{~a ~}"
+          (map (lambda (tweak)
+                 (format #f "~a\\tweak #'~a #~a"
+                         (if post-event? "-" "")
+                         (car tweak)
+                         (scheme-expr->lily-string (cdr tweak))))
+               (ly:music-property expr 'tweaks))))
+
 (define-public (music->lily-string expr parser)
   "Print @var{expr}, a music expression, in LilyPond syntax."
   (if (ly:music? expr)
@@ -92,8 +99,9 @@ display method will be called."
                                              (proc expr parser))
                                            procs))))
        (if result-string
-           (format #f "~a~a" 
-                   (tag->lily-string expr (post-event? expr))
+           (format #f "~a~a~a"
+                    (tag->lily-string expr (post-event? expr))
+                    (tweaks->lily-string expr (post-event? expr))
                    result-string)
            (format #f "%{ Print method not implemented for music type ~a %}"
                    music-type)))
@@ -289,11 +297,14 @@ inside body."
 ;;;
 
 (define (make-music-type-predicate . music-types)
-  (define ((make-music-type-predicate-aux mtypes) expr)
-    (if (null? mtypes)
-       #f
-       (or (eqv? (car mtypes) (ly:music-property expr 'name))
-           ((make-music-type-predicate-aux (cdr mtypes)) expr))))
-  (make-music-type-predicate-aux music-types))
-
-(load "define-music-display-methods.scm")
\ No newline at end of file
+  (define make-music-type-predicate-aux
+    (lambda (mtypes)
+      (lambda (expr)
+       (if (null? mtypes)
+           #f
+           (or (eqv? (car mtypes) (ly:music-property expr 'name))
+               ((make-music-type-predicate-aux (cdr mtypes)) expr))))))
+      (make-music-type-predicate-aux music-types))
+
+(ly:load "define-music-display-methods.scm")
+