2 span-arpeggio-engraver.cc -- implement Span_arpeggio_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2000 Jan Nieuwenhuizen <janneke@gnu.org>
10 #include "lily-guile.hh"
12 #include "arpeggio.hh"
13 #include "span-arpeggio.hh"
14 #include "group-interface.hh"
15 #include "side-position-interface.hh"
16 #include "staff-symbol-referencer.hh"
20 Make arpeggios that span multiple staffs. Catch arpeggios, and span a
21 Span_arpeggio over them if we find more than two arpeggios.
23 class Span_arpeggio_engraver : public Engraver
26 VIRTUAL_COPY_CONS (Translator);
27 Span_arpeggio_engraver ();
30 virtual void acknowledge_element (Score_element_info);
31 virtual void process_acknowledged ();
32 virtual void do_pre_move_processing ();
36 Link_array<Score_element> arpeggios_;
40 Span_arpeggio_engraver::Span_arpeggio_engraver ()
46 Span_arpeggio_engraver::acknowledge_element (Score_element_info info)
48 if (info.origin_trans_l_arr (this).size ()
49 && Arpeggio::has_interface (info.elem_l_))
51 arpeggios_.push (info.elem_l_);
56 Span_arpeggio_engraver::process_acknowledged ()
59 connectArpeggios is slightly brusque; we should really read a elt
60 property of the caught non-span arpeggios. That way, we can have
62 both non-connected and connected arps in one pianostaff.
66 if (!span_arpeggio_ && arpeggios_.size () > 1
67 && to_boolean (get_property ("connectArpeggios")))
69 span_arpeggio_ = new Item (get_property ("Arpeggio"));
70 announce_element (span_arpeggio_, 0);
75 Span_arpeggio_engraver::do_pre_move_processing ()
80 we do this very late, to make sure we also catch `extra'
81 side-pos support like accidentals.
83 for (int i=0; i < arpeggios_.size (); i ++)
85 for (SCM s = arpeggios_[i]->get_elt_property ("stems");
86 gh_pair_p (s); s = gh_cdr (s))
87 Group_interface::add_thing (span_arpeggio_, "stems", gh_car (s));
88 for (SCM s = arpeggios_[i]->get_elt_property ("side-support-elements");
89 gh_pair_p (s); s = gh_cdr (s))
90 Group_interface::add_thing (span_arpeggio_, "side-support-elements", gh_car (s));
93 we can't kill the children, since we don't want to the
94 previous note to bump into the span arpeggio; so we make
96 arpeggios_[i]->set_elt_property ("molecule-callback", SCM_BOOL_T);
99 typeset_element (span_arpeggio_);
105 ADD_THIS_TRANSLATOR (Span_arpeggio_engraver);