lilypond-user
[Top][All Lists]
Advanced

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

Re: Catch direction operators


From: David Nalesnik
Subject: Re: Catch direction operators
Date: Sat, 28 Sep 2013 17:36:23 -0500

Hi Urs,


On Sat, Sep 28, 2013 at 12:13 PM, Urs Liska <address@hidden> wrote:
Hi,

I have a 'function' that redefines commands like \slurUp to color the corresponding grob (highlighting manual interventions during score development).

Is it possible to 'catch' instances of grobs whose direction has been set by the ^ and _ operators and call a music function on the affected object.
I'd like to write

a^(

and as a result get

\once \override Slur #'color = red
a^(

Any ideas?

I couldn't get any results with a music function, but a little experimenting got me a tiny engraver which responds to the directional operators.  Not sure how useful this is, but here goes:

\version "2.17.25"

#(define (Color_explicit_direction_engraver ctx)
    (make-engraver
     (acknowledgers
      ((slur-interface trans grob source)
       (let* ((event (event-cause grob))
              (dir (ly:event-property event 'direction)))
         (if (not (null? dir))
             (set! (ly:grob-property grob 'color) red)))))))

\new Staff {
  c''^(
  d'')
  c''(
  d'')
  c''_(
  d'')
  <c'' e''>^(
  <d'' f''>)
}

\layout {
  \context {
    \Staff
    \consists #Color_explicit_direction_engraver
  }
}


%%%%%%%%%%%

HTH,
David

reply via email to

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