2 note-head-line-engraver.cc -- implement Note_head_line_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2000--2005 Jan Nieuwenhuizen <janneke@gnu.org>
10 #include "group-interface.hh"
12 #include "rhythmic-head.hh"
13 #include "side-position-interface.hh"
14 #include "staff-symbol-referencer.hh"
18 Create line-spanner grobs for lines that connect note heads.
20 TODO: have the line commit suicide if the notes are connected with
23 class Note_head_line_engraver : public Engraver
26 TRANSLATOR_DECLARATIONS (Note_head_line_engraver);
29 virtual void acknowledge_grob (Grob_info);
30 virtual void process_acknowledged_grobs ();
31 virtual void stop_translation_timestep ();
41 Note_head_line_engraver::Note_head_line_engraver ()
51 Note_head_line_engraver::acknowledge_grob (Grob_info info)
53 if (Rhythmic_head::has_interface (info.grob ()))
56 if (to_boolean (get_property ("followVoice")))
58 Context *tr = context ();
59 while (tr && !tr->is_alias (ly_symbol2scm ("Staff")))
60 tr = tr->get_parent_context ();
63 && tr->is_alias (ly_symbol2scm ("Staff")) && tr != last_staff_)
74 Note_head_line_engraver::process_acknowledged_grobs ()
76 if (!line_ && follow_ && last_head_ && head_)
78 /* TODO: Don't follow if there's a beam.
80 We can't do beam-stuff here, since beam doesn't exist yet.
81 Should probably store follow_ in line_, and suicide at some
84 line_ = make_spanner ("VoiceFollower", head_->self_scm ());
86 line_->set_bound (LEFT, last_head_);
87 line_->set_bound (RIGHT, head_);
94 Note_head_line_engraver::stop_translation_timestep ()
102 ADD_TRANSLATOR (Note_head_line_engraver,
103 /* descr */ "Engrave a line between two note heads, for example a glissando. If "
104 " followVoice is set, staff switches also generate a line.",
105 /* creats*/ "Glissando VoiceFollower",
106 /* accepts */ "glissando-event",
107 /* acks */ "rhythmic-head-interface",
108 /* reads */ "followVoice",