bug-lilypond
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Issue 2322 in lilypond: Add "layout-from" function to documentation


From: lilypond
Subject: Issue 2322 in lilypond: Add "layout-from" function to documentation
Date: Wed, 15 Feb 2012 10:49:46 +0000

Status: Accepted
Owner: ----
Labels: Type-Documentation Frog

New issue 2322 by address@hidden: Add "layout-from" function to documentation
http://code.google.com/p/lilypond/issues/detail?id=2322

David Kastrup wrote a function that extracts settings from a music expression and transform them to something that can be used inside \layout block.

"layout-from" =
#(define-void-function (parser location music)
   (ly:music?)
   (_i "To be used in output definitions.  Take the layout instruction
events from @var{music} and do the equivalent of context modifications
duplicating their effect.")
   (define (musicop m mods)
     (if (music-is-of-type? m 'layout-instruction-event)
         (ly:add-context-mod
          mods
          (case (ly:music-property m 'name)
            ((PropertySet)
             (list 'assign
                   (ly:music-property m 'symbol)
                   (ly:music-property m 'value)))
            ((PropertyUnset)
             (list 'unset
                   (ly:music-property m 'symbol)))
            ((OverrideProperty)
             (list 'push
                   (ly:music-property m 'symbol)
                   (ly:music-property m 'grob-property-path)
                   (ly:music-property m 'grob-value)))
            ((RevertProperty)
             (list 'pop
                   (ly:music-property m 'symbol)
                   (ly:music-property m 'grob-property-path)))))
         (case (ly:music-property m 'name)
             ((SequentialMusic SimultaneousMusic)
              (for-each (lambda (x)
                          (musicop x mods))
                        (ly:music-property m 'elements)))
             ((ContextSpeccedMusic)
              (module-set! (current-module)
                           (ly:music-property m 'context-type)
                           #{ \context { $(module-ref (current-module)
                                                      (ly:music-property m 
'context-type))
                                         $(musicop (ly:music-property m 
'element)
                                                   (ly:make-context-mod))
                                         } #}))))
     mods)
   (musicop music (ly:make-context-mod)))

it would be good to add it to documentation, perhaps as a snippet in NR 4.2.1.

more information in http://thread.gmane.org/gmane.comp.gnu.lilypond.devel/43324/focus=43449




reply via email to

[Prev in Thread] Current Thread [Next in Thread]