lilypond-user
[Top][All Lists]
Advanced

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

Re: Conditionally color all tweaked objects


From: Urs Liska
Subject: Re: Conditionally color all tweaked objects
Date: Tue, 23 Apr 2013 10:17:30 +0200

Am Montag, den 22.04.2013, 19:03 +0200 schrieb David Kastrup:
> Urs Liska <address@hidden> writes:
> 
> > Hi,
> >
> > is it possible somehow to hook into the engraving process and color all
> > grobs that have been manually tweaked?
> >
> > In my library I have a 'draft mode'. All my functions or shorthands that
> > tweak the positioning have a counterpart in draft mode. The draft mode
> > functions basically call the normal functions and add coloring to them.
> > This way I can compile a score in draft mode and immediately see where I
> > had to apply some manual interventions.
> >
> > While this is quite useful in the process of finishing a score (and also
> > to evaluate LilyPond's performance) it obviously only works with tweaks
> > applied through my custom functions. But it would only be _really_
> > useful if I could highlight _all_ manual interventions.
> > Of course it isn't a viable solution to write such functions for any
> > tweak I'm applying so I thought if it would be possible to do such a
> > thing in a more fundamental way.
> 
> You could redefine \tweak but it is probably more reliable to use
> internals:
> 
> > So would such a thing be possible, maybe in Scheme?
> > Or if that's not possible in Scheme would that be an interesting feature
> > request?
> 
> 
> \version "2.16.2"
> 
> { c d e f \tweak #'font-size 3 g a b c }
> 
> \layout
> {
>   \context {
>     \Score
>     \consists #(make-engraver
>               (acknowledgers
>                ((grob-interface engraver grob source)
>                 (let ((ev (event-cause grob)))
>                   (if (and (ly:stream-event? ev)
>                            (pair? (ly:event-property ev 'tweaks)))
>                       (set! (ly:grob-property grob 'color) red))))))
>   }
> }
> 
> This does not try to differentiate events into several grobs, so in this
> case, the whole note with stem and notehead will get colored even though
> just the notehead was tweaked.  It is more cumbersome to pick out
> further details, so this is left as an exercise to the reader.
> 
Thank you very much.
I hope to get somewhere from that and will take the exercise ;-)

Urs





reply via email to

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