Hi Urs,

On Sat, Sep 28, 2013 at 12:13 PM, Urs Liska <[email protected]> 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
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to