X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scm%2Fdefine-music-types.scm;h=184b4e54850ad3eb911120d05a40fc71c60ffd5a;hb=c2a9058c5df7efb1b17d971250f6dd0e2853412b;hp=5cc5907fbc3606ce0d5182995886a3d109161b6b;hpb=cf137655b7aee9988ef536d6fa5e38d279ee73cf;p=lilypond.git diff --git a/scm/define-music-types.scm b/scm/define-music-types.scm index 5cc5907fbc..184b4e5485 100644 --- a/scm/define-music-types.scm +++ b/scm/define-music-types.scm @@ -33,7 +33,7 @@ Syntax: @var{note}@code{\\x}, where @code{\\x} is a dynamic mark like )) (AlternativeEvent - . ((description . "Create a alternative event.") + . ((description . "Create an alternative event.") (types . (general-music event alternative-event)) )) @@ -397,6 +397,11 @@ Syntax: @code{\\override} [ @var{context} @code{.} ] (PartialSet . ((description . "Create an anacrusis or upbeat (partial measure).") (iterator-ctor . ,ly:partial-iterator::constructor) + ;; The length-callback is kind of cheesy since 'elements is + ;; empty. We just use that in order to get a zero length + ;; for the overall timing in spite of having a non-zero + ;; duration field. + (length-callback . ,ly:music-sequence::cumulative-length-callback) (types . (general-music partial-set)) )) @@ -707,8 +712,8 @@ brackets start and stop.") )) (UnfoldedRepeatedMusic - . ((description . "Repeated music which is fully written -(and played) out.") + . ((description . "Repeated music which is fully written (and +played) out.") (iterator-ctor . ,ly:unfolded-repeat-iterator::constructor) (start-callback . ,ly:repeated-music::first-start) (types . (general-music repeated-music unfolded-repeated-music)) @@ -770,22 +775,44 @@ Syntax: @code{\\\\}") "Create a music object of given name, and set its properties according to @code{music-properties}, a list of alternating property symbols and values. E.g: +@example (make-music 'OverrideProperty 'symbol 'Stem 'grob-property 'thickness - 'grob-value (* 2 1.5))" + 'grob-value (* 2 1.5)) +@end example +Instead of a successive symbol and value, an entry in the list may +also be an alist or a music object in which case its elements, +respectively its @emph{mutable} property list (properties not inherent +to the type of the music object) will get taken. + +The argument list will be interpreted left-to-right, so later entries +override earlier ones." (if (not (symbol? name)) (ly:error (_ "symbol expected: ~S") name)) (let ((props (hashq-ref music-name-to-property-table name '()))) (if (not (pair? props)) (ly:error (_ "cannot find music object: ~S") name)) (let ((m (ly:make-music props))) + (define (alist-set-props lst) + (for-each (lambda (e) + (set! (ly:music-property m (car e)) (cdr e))) + (reverse lst))) (define (set-props mus-props) - (if (and (not (null? mus-props)) - (not (null? (cdr mus-props)))) - (begin - (set! (ly:music-property m (car mus-props)) (cadr mus-props)) - (set-props (cddr mus-props))))) + (if (pair? mus-props) + (let ((e (car mus-props)) + (mus-props (cdr mus-props))) + (cond ((symbol? e) + (set! (ly:music-property m e) (car mus-props)) + (set-props (cdr mus-props))) + ((ly:music? e) + (alist-set-props (ly:music-mutable-properties e)) + (set-props mus-props)) + ((cheap-list? e) + (alist-set-props e) + (set-props mus-props)) + (else + (ly:error (_ "bad make-music argument: ~S") e)))))) (set-props music-properties) m)))