2 note-head-line-engraver.cc -- implement Note_head_line_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2000--2003 Jan Nieuwenhuizen <janneke@gnu.org>
10 #include "group-interface.hh"
15 #include "rhythmic-head.hh"
16 #include "side-position-interface.hh"
17 #include "staff-symbol-referencer.hh"
18 #include "translator-group.hh"
21 Create line-spanner grobs for lines that connect note heads.
23 TODO: have the line commit suicide if the notes are connected with
27 class Note_head_line_engraver : public Engraver
30 TRANSLATOR_DECLARATIONS(Note_head_line_engraver);
33 virtual void acknowledge_grob (Grob_info);
34 virtual void process_acknowledged_grobs ();
35 virtual void stop_translation_timestep ();
39 Translator* last_staff_;
45 Note_head_line_engraver::Note_head_line_engraver ()
55 Note_head_line_engraver::acknowledge_grob (Grob_info info)
57 if (Rhythmic_head::has_interface (info.grob_))
60 if (to_boolean (get_property ("followVoice")))
62 Translator_group * tr = daddy_trans_;
63 while (tr && !tr->is_alias (ly_symbol2scm ( "Staff")))
64 tr = tr->daddy_trans_ ;
66 if (tr && tr->is_alias (ly_symbol2scm ("Staff")) && tr != last_staff_)
78 Note_head_line_engraver::process_acknowledged_grobs ()
80 if (!line_ && follow_ && last_head_ && head_)
82 /* TODO: Don't follow if there's a beam.
84 We can't do beam-stuff here, since beam doesn't exist yet.
85 Should probably store follow_ in line_, and suicide at some
88 line_ = make_spanner ("VoiceFollower");
90 line_->set_bound (LEFT, last_head_);
91 line_->set_bound (RIGHT, head_);
93 announce_grob(line_, head_->self_scm ());
100 Note_head_line_engraver::stop_translation_timestep ()
104 typeset_grob (line_);
115 ENTER_DESCRIPTION(Note_head_line_engraver,
116 /* descr */ "Engrave a line between two note heads, for example a glissando. If "
117 " followVoice is set, staff switches also generate a line.",
118 /* creats*/ "Glissando VoiceFollower",
119 /* accepts */ "glissando-event",
120 /* acks */ "rhythmic-head-interface",
121 /* reads */ "followVoice",