2 arpeggio-engraver.cc -- implement Arpeggio_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2000--2001 Jan Nieuwenhuizen <janneke@gnu.org>
10 #include "group-interface.hh"
12 #include "musical-request.hh"
13 #include "arpeggio.hh"
15 #include "local-key-item.hh"
16 #include "rhythmic-head.hh"
17 #include "side-position-interface.hh"
18 #include "staff-symbol-referencer.hh"
20 class Arpeggio_engraver
: public Engraver
23 VIRTUAL_COPY_CONS (Translator
);
27 virtual void acknowledge_grob (Grob_info
);
28 virtual void create_grobs ();
29 virtual void stop_translation_timestep ();
30 virtual bool try_music (Music
*);
34 Arpeggio_req
*arpeggio_req_
;
35 Link_array
<Grob
> stems_
;
36 Link_array
<Grob
> supports_
;
39 Arpeggio_engraver::Arpeggio_engraver ()
46 Arpeggio_engraver::try_music (Music
* m
)
50 if (Arpeggio_req
*a
= dynamic_cast<Arpeggio_req
*> (m
))
60 Arpeggio_engraver::acknowledge_grob (Grob_info info
)
64 if (Stem::has_interface (info
.elem_l_
))
66 stems_
.push (info
.elem_l_
);
70 We can't catch local key items (accidentals) from Voice context,
71 see Local_key_engraver
73 else if (Rhythmic_head::has_interface (info
.elem_l_
))
75 supports_
.push (info
.elem_l_
);
81 Arpeggio_engraver::create_grobs ()
83 if (!arpeggio_
&& !stems_
.empty ())
85 arpeggio_
= new Item (get_property ("Arpeggio"));
86 arpeggio_
->set_parent (stems_
[0], Y_AXIS
);
88 for (int i
= 0; i
< stems_
.size (); i
++)
90 Pointer_group_interface::add_element (arpeggio_
, "stems", stems_
[i
]);
92 for (int i
= 0; i
< supports_
.size (); i
++)
94 Side_position_interface::add_support (arpeggio_
, supports_
[i
]);
96 announce_grob (arpeggio_
, arpeggio_req_
);
101 Arpeggio_engraver::stop_translation_timestep ()
105 typeset_grob (arpeggio_
);
114 ADD_THIS_TRANSLATOR (Arpeggio_engraver
);