2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 1997--2015 Han-Wen Nienhuys <hanwen@xs4all.nl>
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 "rhythmic-head.hh"
23 #include "note-column.hh"
25 #include "dot-column.hh"
26 #include "pointer-group-interface.hh"
28 #include "translator.icc"
33 this engraver glues together stems, rests and note heads into a NoteColumn
36 It also generates spacing objects. Originally, we have tried to
37 have the spacing functionality at different levels.
39 - by simply using the sequence of Separation-item as
40 spacing-sequences (at staff level). Unfortunately, this fucks up if
41 there are different kinds of tuplets in different voices (8th and
42 8ths triplets combined made the program believe there were 1/12 th
45 Doing it in a separate engraver using timing info is generally
46 complicated (start/end time management), and fucks up if a voice
49 Now we do it from here again. This has the problem that voices can
50 appear and disappear at will, leaving lots of loose ends (the note
51 spacing engraver don't know where to connect the last note of the
52 voice on the right with), but we don't complain about those, and let
53 the default spacing do its work.
56 class Rhythmic_column_engraver : public Engraver
58 vector<Grob *> rheads_;
63 TRANSLATOR_DECLARATIONS (Rhythmic_column_engraver);
66 DECLARE_ACKNOWLEDGER (stem);
67 DECLARE_ACKNOWLEDGER (flag);
68 DECLARE_ACKNOWLEDGER (rhythmic_head);
69 void process_acknowledged ();
70 void stop_translation_timestep ();
73 Rhythmic_column_engraver::Rhythmic_column_engraver ()
82 Rhythmic_column_engraver::process_acknowledged ()
87 note_column_ = make_item ("NoteColumn", rheads_[0]->self_scm ());
89 for (vsize i = 0; i < rheads_.size (); i++)
90 if (!rheads_[i]->get_parent (X_AXIS))
91 Note_column::add_head (note_column_, rheads_[i]);
99 && !stem_->get_parent (X_AXIS))
101 Note_column::set_stem (note_column_, stem_);
107 Pointer_group_interface::add_grob (note_column_, ly_symbol2scm ("elements"), flag_);
114 Rhythmic_column_engraver::acknowledge_stem (Grob_info i)
120 Rhythmic_column_engraver::acknowledge_flag (Grob_info i)
126 Rhythmic_column_engraver::acknowledge_rhythmic_head (Grob_info i)
128 rheads_.push_back (i.grob ());
132 Rhythmic_column_engraver::stop_translation_timestep ()
139 ADD_ACKNOWLEDGER (Rhythmic_column_engraver, stem);
140 ADD_ACKNOWLEDGER (Rhythmic_column_engraver, flag);
141 ADD_ACKNOWLEDGER (Rhythmic_column_engraver, rhythmic_head);
143 ADD_TRANSLATOR (Rhythmic_column_engraver,
145 "Generate @code{NoteColumn}, an object that groups stems,"
146 " note heads, and rests.",