2 span-arpeggio-engraver.cc -- implement Span_arpeggio_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2000--2005 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 Link_array<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?
46 arpeggios_.push (info.grob ());
51 Span_arpeggio_engraver::process_acknowledged ()
54 connectArpeggios is slightly brusque; we should really read a grob
55 property of the caught non-span arpeggios. That way, we can have
57 both non-connected and connected arps in one pianostaff.
60 if (!span_arpeggio_ && arpeggios_.size () > 1
61 && to_boolean (get_property ("connectArpeggios")))
63 span_arpeggio_ = make_item ("Arpeggio", SCM_EOL);
68 Span_arpeggio_engraver::stop_translation_timestep ()
73 we do this very late, to make sure we also catch `extra'
74 side-pos support like accidentals.
76 for (int j = 0; j < arpeggios_.size (); j++)
78 extract_grob_set (arpeggios_[j], "stems", stems);
79 for (int i = stems.size() ; i--;)
80 Pointer_group_interface::add_grob (span_arpeggio_, ly_symbol2scm ("stems"),
83 extract_grob_set (arpeggios_[j], "side-support-elements", sses);
84 for (int i = sses.size() ; i--;)
85 Pointer_group_interface::add_grob (span_arpeggio_, ly_symbol2scm ("side-support-elements"),
89 we can't kill the children, since we don't want to the
90 previous note to bump into the span arpeggio; so we make
92 arpeggios_[j]->set_property ("print-function", SCM_EOL);
100 #include "translator.icc"
102 ADD_ACKNOWLEDGER (Span_arpeggio_engraver,arpeggio);
103 ADD_TRANSLATOR (Span_arpeggio_engraver,
105 /* creats*/ "Arpeggio",
107 /* reads */ "connectArpeggios",