Joe Neeman wrote:
> Have you tried using ly:context-property-where-defined instead of
> searching for PianoStaff explicitly? There are non-PianoStaff contexts
> containing Span_arpeggio_engraver, after all. Other than that, this is a
> very cool trick!
Joe,
Thanks for the tip. I rewrote arpeggio-generic with ly:context-
property-where-defined and also made some changes to arpeggioNormal.
Also, line 281 of property-init.ly says this:
% For drawing vertical chord brackets with \arpeggio
% This is a shorthand for the value of the print-function property
% of either Staff.Arpeggio or PianoStaff.Arpeggio, depending whether
% cross-staff brackets are desired.
This is completely false, right? Otherwise these commands would work
without the \applyContext gymnastics I've been coding in this thread.
If my code (below) gets approved, I think I'll either remove the
comment it or change it to:
% These commands look for 'connectArpeggios (cross-staff arpeggios)
% to determine the proper context in which to operate.
Any objections? How close is this to being acceptable? I'll wait for
approval.
Thanks.
- Mark
*****************
\version "2.13.3"
%%%%%% begin property-init.ly revision %%%%%%
#(define (arpeggio-generic context pushpops)
(let* ((parent (ly:context-property-where-defined context
'connectArpeggios))
(target (if (null? parent) context parent)))
(for-each
(lambda (pushpop)
(if (pair? pushpop)
(ly:context-pushpop-property target
'Arpeggio
(car pushpop)
(cdr pushpop))
(ly:context-pushpop-property target
'Arpeggio
pushpop)))
pushpops)))
arpeggioArrowUp =
\applyContext
#(lambda (context)
(arpeggio-generic context
`(stencil X-extent (arpeggio-direction . ,UP))))
arpeggioArrowDown =
\applyContext
#(lambda (context)
(arpeggio-generic context
`(stencil X-extent (arpeggio-direction . ,DOWN))))
arpeggioNormal =
\applyContext
#(lambda (context)
(let ((Staff (ly:context-find context 'Staff)))
(if (and Staff (not (eq? context Staff)))
(arpeggio-generic Staff
`(stencil X-extent arpeggio-direction dash-definition)))
(arpeggio-generic context
`(stencil X-extent arpeggio-direction dash-definition))))
arpeggioBracket =
\applyContext
#(lambda (context)
(arpeggio-generic context
`(X-extent (stencil . ,ly:arpeggio::brew-chord-bracket))))
%%%%%% end property-init.ly revision %%%%%%
%%%%%% demonstration %%%%%%
\new PianoStaff \relative <<
\new Staff {
\arpeggioArrowUp
<c e g>4\arpeggio
\arpeggioNormal
<c e g>\arpeggio
\set PianoStaff.connectArpeggios = ##t
\arpeggioArrowUp
<c e g>\arpeggio
\arpeggioBracket
<c e g>\arpeggio
\set PianoStaff.connectArpeggios = ##f
\arpeggioNormal
<c e g>\arpeggio
}
\new Staff {
\clef bass
\arpeggioArrowDown
<c, e g>4\arpeggio
<c e g>\arpeggio
<c e g>\arpeggio
<c e g>\arpeggio
<c e g>\arpeggio
}
>>
_______________________________________________
lilypond-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-devel