2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 2000--2015 Jan Nieuwenhuizen <janneke@gnu.org>
6 LilyPond is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 LilyPond is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
20 #include "engraver.hh"
21 #include "pointer-group-interface.hh"
23 #include "rhythmic-head.hh"
24 #include "side-position-interface.hh"
25 #include "staff-symbol-referencer.hh"
31 Create line-spanner grobs for lines that connect note heads.
33 TODO: have the line commit suicide if the notes are connected with
36 class Note_head_line_engraver : public Engraver
39 TRANSLATOR_DECLARATIONS (Note_head_line_engraver);
42 void acknowledge_rhythmic_head (Grob_info);
43 void process_acknowledged ();
44 void stop_translation_timestep ();
54 Note_head_line_engraver::Note_head_line_engraver ()
64 Note_head_line_engraver::acknowledge_rhythmic_head (Grob_info info)
67 Context *tr = find_context_above (context (), ly_symbol2scm ("Staff"));
70 && to_boolean (get_property ("followVoice")))
79 Note_head_line_engraver::process_acknowledged ()
81 if (!line_ && follow_ && last_head_ && head_)
83 /* TODO: Don't follow if there's a beam.
85 We can't do beam-stuff here, since beam doesn't exist yet.
86 Should probably store follow_ in line_, and suicide at some
89 line_ = make_spanner ("VoiceFollower", head_->self_scm ());
91 line_->set_bound (LEFT, last_head_);
92 line_->set_bound (RIGHT, head_);
99 Note_head_line_engraver::stop_translation_timestep ()
107 #include "translator.icc"
110 Note_head_line_engraver::boot ()
112 ADD_ACKNOWLEDGER (Note_head_line_engraver, rhythmic_head);
115 ADD_TRANSLATOR (Note_head_line_engraver,
117 "Engrave a line between two note heads in a staff"
118 " switch if @code{followVoice} is set.",