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 "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);
27 virtual void acknowledge_grob (Grob_info);
28 virtual void process_acknowledged_grobs ();
29 virtual void stop_translation_timestep ();
33 Link_array<Grob> arpeggios_;
36 Span_arpeggio_engraver::Span_arpeggio_engraver ()
42 Span_arpeggio_engraver::acknowledge_grob (Grob_info info)
44 if (Arpeggio::has_interface (info.grob_)
45 && info.origin_contexts (this).size ()) // huh? what's this test for?
47 arpeggios_.push (info.grob_);
52 Span_arpeggio_engraver::process_acknowledged_grobs ()
55 connectArpeggios is slightly brusque; we should really read a grob
56 property of the caught non-span arpeggios. That way, we can have
58 both non-connected and connected arps in one pianostaff.
61 if (!span_arpeggio_ && arpeggios_.size () > 1
62 && to_boolean (get_property ("connectArpeggios")))
64 span_arpeggio_ = make_item ("Arpeggio", SCM_EOL);
70 Span_arpeggio_engraver::stop_translation_timestep ()
75 we do this very late, to make sure we also catch `extra'
76 side-pos support like accidentals.
78 for (int i = 0; i < arpeggios_.size (); i++)
80 for (SCM s = arpeggios_[i]->get_property ("stems");
81 scm_is_pair (s); s = scm_cdr (s))
82 Group_interface::add_thing (span_arpeggio_, ly_symbol2scm ("stems"), scm_car (s));
83 for (SCM s = arpeggios_[i]->get_property ("side-support-elements");
84 scm_is_pair (s); s = scm_cdr (s))
85 Group_interface::add_thing (span_arpeggio_, ly_symbol2scm ("side-support-elements"), scm_car (s));
88 we can't kill the children, since we don't want to the
89 previous note to bump into the span arpeggio; so we make
91 arpeggios_[i]->set_property ("print-function", SCM_EOL);
99 ADD_TRANSLATOR (Span_arpeggio_engraver,
101 /* creats*/ "Arpeggio",
103 /* acks */ "arpeggio-interface",
104 /* reads */ "connectArpeggios",