lilypond-user
[Top][All Lists]
Advanced

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

Re: Color tweaks (edition engraver)


From: David Nalesnik
Subject: Re: Color tweaks (edition engraver)
Date: Mon, 27 Apr 2015 12:12:49 -0500

Hi,

On Mon, Apr 27, 2015 at 9:44 AM, Urs Liska <address@hidden> wrote:


Am 27.04.2015 um 16:27 schrieb Noeck:
Dear all, dear Urs,

I would like to color tweaks of a particular edition of the edition
engraver. I know that there is a checkbox in Frescobaldi to color, so it
seems possible to color tweaked grobs in general.

No, I don't think this is possible, although I would really like to have that feature (to immediately make visible what is "original" and what is "manual").

What we have in Frescobaldi depends on what we can "catch" by either listening through engravers or by redefining command. So far I haven't found a notion of a grob knowing if it has been tweaked or not.

Here's a code snippet to show that it is possible to tell if a grob has been altered.  Right now you have to add the procedure for each grob you want to examine.

\version "2.19.17"

#(define (mark-tweak grob)
   (let* ((default (assoc-get (grob::name grob) all-grob-descriptions))
          (props (ly:grob-basic-properties grob))
          ;; Our procedure has been added to the head of grob's basic
          ;; properties.  Let's not count it as a tweak!
          (props
           (remove
            (lambda (p)
              (and (procedure? (cdr p))
                   (eq? (procedure-name (cdr p)) 'mark-tweak)))
            props))
          (diff (lset-difference eq? props default)))
     ;; Tweaks will not appear in the "basic properties" alist of our grob, but
     ;; we can find them through the music event which led to the grob.  This
     ;; is (currently) available through the stream-event which caused our grob.
     (if (null? diff)
         (let* ((cause (event-cause grob))
                (tweaks (and cause
                             (ly:music-property
                              (ly:event-property cause 'music-cause)
                              'tweaks))))
           (if (pair? tweaks)
               (set! (ly:grob-property grob 'color) red)))
         (set! (ly:grob-property grob 'color) green))))

{
  \override NoteHead.after-line-breaking = #mark-tweak
  c'
  \once \override NoteHead.font-size = 3
  c'
  c'
  \tweak font-size 3 c'
  c'
  \override Slur.after-line-breaking = #mark-tweak
  c'( e')
  \shape #'((0 . 0) (0 . -0.5) (0 . -0.5) (0 . 0)) Slur
  c'( e')
}

%%%

Hope this is helpful.
David

reply via email to

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