X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scm%2Fdisplay-lily.scm;h=788f89e3596f35f48a81279e4a7e47aa37194919;hb=27a17e23984f146aecd0ed712304e2e9bae65e38;hp=51b13eb25941f21356691c0a48a59c459e185365;hpb=2bf520787e5668f22dcf0d5ab3faf74693376d6a;p=lilypond.git diff --git a/scm/display-lily.scm b/scm/display-lily.scm index 51b13eb259..788f89e359 100644 --- a/scm/display-lily.scm +++ b/scm/display-lily.scm @@ -2,7 +2,7 @@ ;;; ;;; ;;; -;;; Copyright (C) 2005--2011 Nicolas Sceaux +;;; Copyright (C) 2005--2012 Nicolas Sceaux ;;; ;;; - This file defines the procedures used to define display methods for each @@ -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,26 @@ 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) + (let ((addr (car tweak)) + (val (cdr tweak))) + (format #f "~a\\tweak ~a #~a" + (if post-event? "-" "") + (cond + ((symbol? addr) + (format #f "~a" addr)) + ((symbol? (cdr addr)) + (format #f "~a.~a" (car addr) (cdr addr))) + (else + (format #f "~{~a~^.~}" + (if (symbol? (car addr)) + addr + (cdr addr))))) + (scheme-expr->lily-string val)))) + (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 +110,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))) @@ -274,8 +293,7 @@ inside body." (define *max-element-number-before-break* (make-parameter 6)) ;; \times factor (used in durations) -(define *time-factor-denominator* (make-parameter #f)) -(define *time-factor-numerator* (make-parameter #f)) +(define *time-scale* (make-parameter 1)) (define *current-context* (make-parameter 'Bottom)) @@ -289,11 +307,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") +