2 span-arpeggio-engraver.cc -- implement Span_arpeggio_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2000--2006 Jan Nieuwenhuizen <janneke@gnu.org>
8 Han-Wen Nienhuys <hanwen@xs4all.nl>
11 #include "engraver.hh"
12 #include "arpeggio.hh"
13 #include "pointer-group-interface.hh"
14 #include "side-position-interface.hh"
15 #include "staff-symbol-referencer.hh"
18 Make arpeggios that span multiple staves. Catch arpeggios, and span a
19 Span_arpeggio over them if we find more than two arpeggios.
21 class Span_arpeggio_engraver : public Engraver
24 TRANSLATOR_DECLARATIONS (Span_arpeggio_engraver);
25 DECLARE_ACKNOWLEDGER (arpeggio);
28 void process_acknowledged ();
29 void stop_translation_timestep ();
33 vector<Grob*> arpeggios_;
36 Span_arpeggio_engraver::Span_arpeggio_engraver ()
42 Span_arpeggio_engraver::acknowledge_arpeggio (Grob_info info)
44 if (info.origin_contexts (this).size ()) // huh? what's this test for?
45 arpeggios_.push_back (info.grob ());
49 Span_arpeggio_engraver::process_acknowledged ()
52 connectArpeggios is slightly brusque; we should really read a grob
53 property of the caught non-span arpeggios. That way, we can have
55 both non-connected and connected arps in one pianostaff.
58 if (!span_arpeggio_ && arpeggios_.size () > 1
59 && to_boolean (get_property ("connectArpeggios")))
60 span_arpeggio_ = make_item ("Arpeggio", SCM_EOL);
64 Span_arpeggio_engraver::stop_translation_timestep ()
69 we do this very late, to make sure we also catch `extra'
70 side-pos support like accidentals.
72 for (vsize j = 0; j < arpeggios_.size (); j++)
74 extract_grob_set (arpeggios_[j], "stems", stems);
75 for (vsize i = stems.size (); i--;)
76 Pointer_group_interface::add_grob (span_arpeggio_, ly_symbol2scm ("stems"),
79 extract_grob_set (arpeggios_[j], "side-support-elements", sses);
80 for (vsize i = sses.size (); i--;)
81 Pointer_group_interface::add_grob (span_arpeggio_, ly_symbol2scm ("side-support-elements"),
85 we can't kill the children, since we don't want to the
86 previous note to bump into the span arpeggio; so we make
88 arpeggios_[j]->set_property ("transparent", SCM_BOOL_T);
96 #include "translator.icc"
98 ADD_ACKNOWLEDGER (Span_arpeggio_engraver, arpeggio);
99 ADD_TRANSLATOR (Span_arpeggio_engraver,
101 /* create */ "Arpeggio",
103 /* read */ "connectArpeggios",