lilypond-user
[Top][All Lists]
Advanced

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

Re: Catch direction operators


From: David Kastrup
Subject: Re: Catch direction operators
Date: Sun, 29 Sep 2013 17:50:46 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

David Kastrup <address@hidden> writes:

> Thomas Morley <address@hidden> writes:
>
>>>>>You can write:
>>>>>colorizeDir =
>>>>>#(define-music-function (parser location item)
>>>>>   (symbol-list-or-music?)
>>>>>   (define (grob-colorize-dir grob)
>>>>>     (let ((ev (event-cause grob)))
>>>>>       (case (ly:event-property ev 'direction)
>>>>>             ((1) red)
>>>>>             ((-1) blue)
>>>>>             (else '()))))
>>>>>   #{ \tweak color #grob-colorize-dir #item #})
>>>>
>>>> Thanks, this works perfectly.

Actually, it's oversimplified.  It has to have

(case (and ev (ly:event-property ev 'direction))

or it will bomb out in the cases of coloring grobs not traceable to a
music event.

-- 
David Kastrup




reply via email to

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