2 span-arpeggio-engraver.cc -- implement Span_arpeggio_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2000--2002 Jan Nieuwenhuizen <janneke@gnu.org>
10 #include "lily-guile.hh"
12 #include "arpeggio.hh"
13 #include "group-interface.hh"
14 #include "side-position-interface.hh"
15 #include "staff-symbol-referencer.hh"
19 Make arpeggios that span multiple staves. Catch arpeggios, and span a
20 Span_arpeggio over them if we find more than two arpeggios.
22 class Span_arpeggio_engraver : public Engraver
25 TRANSLATOR_DECLARATIONS(Span_arpeggio_engraver);
28 virtual void acknowledge_grob (Grob_info);
29 virtual void process_acknowledged_grobs ();
30 virtual void stop_translation_timestep ();
34 Link_array<Grob> arpeggios_;
38 Span_arpeggio_engraver::Span_arpeggio_engraver ()
44 Span_arpeggio_engraver::acknowledge_grob (Grob_info info)
46 if (info.origin_trans_l_arr (this).size ()
47 && Arpeggio::has_interface (info.grob_l_))
49 arpeggios_.push (info.grob_l_);
54 Span_arpeggio_engraver::process_acknowledged_grobs ()
57 connectArpeggios is slightly brusque; we should really read a elt
58 property of the caught non-span arpeggios. That way, we can have
60 both non-connected and connected arps in one pianostaff.
64 if (!span_arpeggio_ && arpeggios_.size () > 1
65 && to_boolean (get_property ("connectArpeggios")))
67 span_arpeggio_ = new Item (get_property ("Arpeggio"));
68 announce_grob(span_arpeggio_, SCM_EOL);
73 Span_arpeggio_engraver::stop_translation_timestep ()
78 we do this very late, to make sure we also catch `extra'
79 side-pos support like accidentals.
81 for (int i=0; i < arpeggios_.size (); i ++)
83 for (SCM s = arpeggios_[i]->get_grob_property ("stems");
84 gh_pair_p (s); s = ly_cdr (s))
85 Group_interface::add_thing (span_arpeggio_, ly_symbol2scm ("stems"), ly_car (s));
86 for (SCM s = arpeggios_[i]->get_grob_property ("side-support-elements");
87 gh_pair_p (s); s = ly_cdr (s))
88 Group_interface::add_thing (span_arpeggio_, ly_symbol2scm ("side-support-elements"), ly_car (s));
91 we can't kill the children, since we don't want to the
92 previous note to bump into the span arpeggio; so we make
94 arpeggios_[i]->set_grob_property ("molecule-callback", SCM_EOL);
97 typeset_grob (span_arpeggio_);
105 ENTER_DESCRIPTION(Span_arpeggio_engraver,
107 /* creats*/ "Arpeggio",
108 /* acks */ "arpeggio-interface",
109 /* reads */ "connectArpeggios",