Add arrowed sharp signs
[lilypond.git] / lily / arpeggio-engraver.cc
blob062d6a816fa3cf3155eee6513329f51522f75d92
1 /*
2 arpeggio-engraver.cc -- implement Arpeggio_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2000--2008 Jan Nieuwenhuizen <janneke@gnu.org>
7 */
9 #include "engraver.hh"
11 #include "pointer-group-interface.hh"
12 #include "arpeggio.hh"
13 #include "stem.hh"
14 #include "rhythmic-head.hh"
15 #include "side-position-interface.hh"
16 #include "stream-event.hh"
17 #include "note-column.hh"
18 #include "item.hh"
20 #include "translator.icc"
22 class Arpeggio_engraver : public Engraver
24 public:
25 TRANSLATOR_DECLARATIONS (Arpeggio_engraver);
27 void acknowledge_stem (Grob_info);
28 void acknowledge_rhythmic_head (Grob_info);
29 protected:
30 void process_music ();
31 void stop_translation_timestep ();
32 DECLARE_TRANSLATOR_LISTENER (arpeggio);
33 private:
34 Item *arpeggio_;
35 Stream_event *arpeggio_event_;
38 Arpeggio_engraver::Arpeggio_engraver ()
40 arpeggio_ = 0;
41 arpeggio_event_ = 0;
44 IMPLEMENT_TRANSLATOR_LISTENER (Arpeggio_engraver, arpeggio);
45 void Arpeggio_engraver::listen_arpeggio (Stream_event *ev)
47 ASSIGN_EVENT_ONCE (arpeggio_event_, ev);
50 void
51 Arpeggio_engraver::acknowledge_stem (Grob_info info)
53 if (arpeggio_)
55 if (!arpeggio_->get_parent (Y_AXIS))
56 arpeggio_->set_parent (info.grob (), Y_AXIS);
58 Pointer_group_interface::add_grob (arpeggio_,
59 ly_symbol2scm ("stems"),
60 info.grob ());
63 void
64 Arpeggio_engraver::acknowledge_rhythmic_head (Grob_info info)
66 if (arpeggio_)
69 We can't catch local key items (accidentals) from Voice context,
70 see Local_key_engraver
72 Side_position_interface::add_support (arpeggio_, info.grob ());
75 void
76 Arpeggio_engraver::process_music ()
78 if (arpeggio_event_)
80 arpeggio_ = make_item ("Arpeggio", arpeggio_event_->self_scm ());
84 void
85 Arpeggio_engraver::stop_translation_timestep ()
87 arpeggio_ = 0;
88 arpeggio_event_ = 0;
91 ADD_ACKNOWLEDGER (Arpeggio_engraver, stem);
92 ADD_ACKNOWLEDGER (Arpeggio_engraver, rhythmic_head);
94 ADD_TRANSLATOR (Arpeggio_engraver,
95 /* doc */
96 "Generate an Arpeggio symbol.",
98 /* create */
99 "Arpeggio",
101 /* read */
104 /* write */