2 span-arpeggio-engraver.cc -- implement Span_arpeggio_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2000--2004 Jan Nieuwenhuizen <janneke@gnu.org>
8 Han-Wen Nienhuys <hanwen@xs4all.nl>
11 #include "engraver.hh"
12 #include "lily-guile.hh"
14 #include "arpeggio.hh"
15 #include "group-interface.hh"
16 #include "side-position-interface.hh"
17 #include "staff-symbol-referencer.hh"
21 Make arpeggios that span multiple staves. Catch arpeggios, and span a
22 Span_arpeggio over them if we find more than two arpeggios.
24 class Span_arpeggio_engraver
: public Engraver
27 TRANSLATOR_DECLARATIONS (Span_arpeggio_engraver
);
30 virtual void acknowledge_grob (Grob_info
);
31 virtual void process_acknowledged_grobs ();
32 virtual void stop_translation_timestep ();
36 Link_array
<Grob
> arpeggios_
;
40 Span_arpeggio_engraver::Span_arpeggio_engraver ()
46 Span_arpeggio_engraver::acknowledge_grob (Grob_info info
)
48 if (Arpeggio::has_interface (info
.grob_
)
49 && info
.origin_contexts (this).size ()) // huh? what's this test for?
51 arpeggios_
.push (info
.grob_
);
56 Span_arpeggio_engraver::process_acknowledged_grobs ()
59 connectArpeggios is slightly brusque; we should really read a grob
60 property of the caught non-span arpeggios. That way, we can have
62 both non-connected and connected arps in one pianostaff.
65 if (!span_arpeggio_
&& arpeggios_
.size () > 1
66 && to_boolean (get_property ("connectArpeggios")))
68 span_arpeggio_
= make_item ("Arpeggio");
69 announce_grob (span_arpeggio_
, SCM_EOL
);
74 Span_arpeggio_engraver::stop_translation_timestep ()
79 we do this very late, to make sure we also catch `extra'
80 side-pos support like accidentals.
82 for (int i
=0; i
< arpeggios_
.size (); i
++)
84 for (SCM s
= arpeggios_
[i
]->get_property ("stems");
85 gh_pair_p (s
); s
= ly_cdr (s
))
86 Group_interface::add_thing (span_arpeggio_
, ly_symbol2scm ("stems"), ly_car (s
));
87 for (SCM s
= arpeggios_
[i
]->get_property ("side-support-elements");
88 gh_pair_p (s
); s
= ly_cdr (s
))
89 Group_interface::add_thing (span_arpeggio_
, ly_symbol2scm ("side-support-elements"), ly_car (s
));
92 we can't kill the children, since we don't want to the
93 previous note to bump into the span arpeggio; so we make
95 arpeggios_
[i
]->set_property ("print-function", SCM_EOL
);
98 typeset_grob (span_arpeggio_
);
106 ENTER_DESCRIPTION (Span_arpeggio_engraver
,
108 /* creats*/ "Arpeggio",
110 /* acks */ "arpeggio-interface",
111 /* reads */ "connectArpeggios",