staff-symbol-referencer.cc: Junk redundant functions.
[lilypond.git] / lily / laissez-vibrer-engraver.cc
blobefb0afbaa4315328708fa1bbf965195e3726fa67
1 /*
2 laissez-vibrer-engraver.cc -- implement Laissez_vibrer_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2005--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
8 */
11 #include "engraver.hh"
12 #include "item.hh"
13 #include "pointer-group-interface.hh"
14 #include "stream-event.hh"
16 #include "translator.icc"
18 class Laissez_vibrer_engraver : public Engraver
20 Stream_event *event_;
21 Grob *lv_column_;
22 vector<Grob*> lv_ties_;
24 void stop_translation_timestep ();
25 DECLARE_ACKNOWLEDGER (note_head);
26 protected:
27 DECLARE_TRANSLATOR_LISTENER (laissez_vibrer);
28 public:
29 TRANSLATOR_DECLARATIONS (Laissez_vibrer_engraver);
32 Laissez_vibrer_engraver::Laissez_vibrer_engraver ()
34 event_ = 0;
35 lv_column_ = 0;
38 void
39 Laissez_vibrer_engraver::stop_translation_timestep ()
41 event_ = 0;
42 lv_column_ = 0;
43 lv_ties_.clear ();
46 IMPLEMENT_TRANSLATOR_LISTENER (Laissez_vibrer_engraver, laissez_vibrer);
47 void
48 Laissez_vibrer_engraver::listen_laissez_vibrer (Stream_event *ev)
50 ASSIGN_EVENT_ONCE (event_, ev);
53 void
54 Laissez_vibrer_engraver::acknowledge_note_head (Grob_info inf)
56 if (!event_)
57 return;
59 if (!lv_column_)
61 lv_column_ = make_item ("LaissezVibrerTieColumn", event_->self_scm ());
64 SCM cause = event_->self_scm ();
65 Grob *lv_tie = make_item ("LaissezVibrerTie", cause);
66 lv_tie->set_object ("note-head", inf.grob ()->self_scm ());
68 Pointer_group_interface::add_grob (lv_column_, ly_symbol2scm ("ties"),
69 lv_tie);
71 if (is_direction (unsmob_stream_event (cause)->get_property ("direction")))
73 Direction d = to_dir (unsmob_stream_event (cause)->get_property ("direction"));
74 lv_tie->set_property ("direction", scm_from_int (d));
77 lv_tie->set_parent (lv_column_, Y_AXIS);
79 lv_ties_.push_back (lv_tie);
82 ADD_ACKNOWLEDGER (Laissez_vibrer_engraver, note_head);
83 ADD_TRANSLATOR (Laissez_vibrer_engraver,
84 /* doc */
85 "Create laissez vibrer items.",
87 /* create */
88 "LaissezVibrerTie "
89 "LaissezVibrerTieColumn ",
91 /* read */
92 "",
94 /* write */