[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Scheme Help
From: |
Thomas Morley |
Subject: |
Re: Scheme Help |
Date: |
Sun, 12 Nov 2017 20:37:58 +0100 |
2017-11-11 17:11 GMT+01:00 Benjamin Bloomfield <address@hidden>:
> I am trying to write a scheme to achieve the functionality I was asking
> about in my earlier message. I think that I could do it with a simple
> callback function on the NoteHead.transparent property and make the notehead
> transparent if it is a breve that is preceded by another breve and not the
> first note in its system.
>
> It's easy enough to determine whether the NoteHead is a breve in scheme, but
> how do I determine whether it's the first of its system, and how do I
> reference the NoteHead that comes immediately before it (if any) to
> determine whether that is also a breve?
>
> Thanks!
>
> Benjamin Bloomfield
Wouldn't you want any note at line-begin to be visible? So why check
what's the preceding?
For the other stuff you may find some procedures helpful, which David
Nalesnik had coded:
%% Thanks to David Nalesnik
#(define (at-line-end? grob)
(let* ((col (ly:item-get-column grob))
(ln (ly:grob-object col 'right-neighbor))
(col-to-check (if (ly:grob? ln) ln col)))
(and (eq? #t (ly:grob-property col-to-check 'non-musical))
(= -1 (ly:item-break-dir col-to-check)))))
#(define (at-line-beginning? grob)
(let* ((col (ly:item-get-column grob))
(ln (ly:grob-object col 'left-neighbor))
(col-to-check (if (ly:grob? ln) ln col)))
(and (eq? #t (ly:grob-property col-to-check 'non-musical))
(= 1 (ly:item-break-dir col-to-check)))))
{
\override NoteHead.after-line-breaking =
#(lambda (grob)
(ly:grob-set-property! grob 'color
(cond ((at-line-end? grob) cyan)
((at-line-beginning? grob) red)
(else '()))))
\repeat unfold 150 c'1
}
HTH,
Harm
- Scheme Help, Benjamin Bloomfield, 2017/11/11
- Re: Scheme Help,
Thomas Morley <=