[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: |
Wed, 09 Oct 2013 04:37:42 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
Paul Morris <address@hidden> writes:
> David Kastrup wrote
>> Looks fine. \colorizeDir is not actually being used as a tweak here,
>> but then that makes pretty little sense anyway.
>
> Ok, I've added it here:
> http://lsr.dsi.unimi.it/LSR/Item?id=889
>
> Since it requires 2.17 I had to comment out the whole thing, and add a
> single note to get the LSR to accept it.
Might make more sense to add it to LilyPond's own snippet base, I guess.
Obviously, we have no limitations how new any snippets may be there.
> I also split colorizeDir up into two parts, as shown below. This seemed
> easier to understand and avoids (re-)defining grob-colorize-dir for every
> grob that gets colored. Let me know if that's not a good call.
Well, I try keeping the global name space uncluttered, but if you see an
actual potential for use outside of \colorizeDir, that's certainly a
small price to pay.
> #(define (grob-colorize-dir grob)
> (let ((ev (event-cause grob)))
> (case (and ev (ly:event-property ev 'direction))
> ((1) red)
> ((-1) blue)
> (else '()))))
>
> colorizeDir =
> #(define-music-function (parser location item)
> (symbol-list-or-music?)
> #{ \tweak color #grob-colorize-dir #item #})
--
David Kastrup