2 span-arpeggio-engraver.cc -- implement Span_arpeggio_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2000--2001 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 staffs. 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 VIRTUAL_COPY_CONS (Translator
);
26 Span_arpeggio_engraver ();
29 virtual void acknowledge_grob (Grob_info
);
30 virtual void create_grobs ();
31 virtual void stop_translation_timestep ();
35 Link_array
<Grob
> arpeggios_
;
39 Span_arpeggio_engraver::Span_arpeggio_engraver ()
45 Span_arpeggio_engraver::acknowledge_grob (Grob_info info
)
47 if (info
.origin_trans_l_arr (this).size ()
48 && Arpeggio::has_interface (info
.elem_l_
))
50 arpeggios_
.push (info
.elem_l_
);
55 Span_arpeggio_engraver::create_grobs ()
58 connectArpeggios is slightly brusque; we should really read a elt
59 property of the caught non-span arpeggios. That way, we can have
61 both non-connected and connected arps in one pianostaff.
65 if (!span_arpeggio_
&& arpeggios_
.size () > 1
66 && to_boolean (get_property ("connectArpeggios")))
68 span_arpeggio_
= new Item (get_property ("Arpeggio"));
69 announce_grob (span_arpeggio_
, 0);
74 Span_arpeggio_engraver::stop_translation_timestep ()
79 we do this very late, to make sure we also catch `extra'
80 side-pos support like accidentals.
82 for (int i
=0; i
< arpeggios_
.size (); i
++)
84 for (SCM s
= arpeggios_
[i
]->get_grob_property ("stems");
85 gh_pair_p (s
); s
= gh_cdr (s
))
86 Group_interface::add_thing (span_arpeggio_
, "stems", gh_car (s
));
87 for (SCM s
= arpeggios_
[i
]->get_grob_property ("side-support-elements");
88 gh_pair_p (s
); s
= gh_cdr (s
))
89 Group_interface::add_thing (span_arpeggio_
, "side-support-elements", gh_car (s
));
92 we can't kill the children, since we don't want to the
93 previous note to bump into the span arpeggio; so we make
95 arpeggios_
[i
]->set_grob_property ("molecule-callback", SCM_BOOL_T
);
98 typeset_grob (span_arpeggio_
);
104 ADD_THIS_TRANSLATOR (Span_arpeggio_engraver
);