X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scm%2Fclef.scm;h=997ef4c05cfb3c3c07fcc5bcd409fcf4b9693888;hb=d915ae794be635301e275cd659886f4315f78035;hp=45e6edcd5039c464e86f6394b554ecf5ad9b4da3;hpb=3ea702c329ba2121da532904a86e63f58c47a6ef;p=lilypond.git diff --git a/scm/clef.scm b/scm/clef.scm index 45e6edcd50..997ef4c05c 100644 --- a/scm/clef.scm +++ b/scm/clef.scm @@ -88,7 +88,18 @@ ) ) -(define-public (clef-name-to-properties cl) +(define-public (make-clef-set cl) + "Generate the clef setting commands for a clef with name CL." + (define (make-prop-set props) + (let* + ( + (m (make-music-by-name 'PropertySet)) + ) + + (map (lambda (x) (ly:set-mus-property! m (car x) (cdr x))) props) + m + )) + (let ((e '()) (c0 0) (oct 0) @@ -106,29 +117,39 @@ (set! e (assoc cl supported-clefs)) - + (if (pair? e) - `(((symbol . clefGlyph) - (iterator-ctor . ,Property_iterator::constructor) - (value . ,(cadr e)) - ) + (let* + ( + (musics (map make-prop-set - ((symbol . centralCPosition) - (iterator-ctor . ,Property_iterator::constructor) - (value . ,(+ oct (caddr e) (cdr (assoc (cadr e) c0-pitch-alist)))) - ) - ((symbol . clefPosition) - (iterator-ctor . ,Property_iterator::constructor) - (value . ,(caddr e)) - ) - ((symbol . clefOctavation) - (iterator-ctor . ,Property_iterator::constructor) - (value . ,(- oct)) - ) + `(((symbol . clefGlyph) + (value . ,(cadr e)) + ) + ((symbol . centralCPosition) + (value . ,(+ oct (caddr e) (cdr (assoc (cadr e) c0-pitch-alist)))) + ) + ((symbol . clefPosition) + (value . ,(caddr e)) + ) + ((symbol . clefOctavation) + (value . ,(- oct)) + ) + ))) + (seq (make-music-by-name 'SequentialMusic)) + (csp (make-music-by-name 'ContextSpeccedMusic)) + ) + + (ly:set-mus-property! seq 'elements musics) + (ly:set-mus-property! csp 'element seq) + (ly:set-mus-property! csp 'context-type "Staff") + + csp ) (begin - (ly-warn (string-append "Unknown clef type `" cl "'\nSee scm/lily.scm for supported clefs")) - '()) + (ly:warn (format "Unknown clef type `~a' +See scm/lily.scm for supported clefs" cl)) + (make-music-by-name 'Music) + + ) ))) - -