2 rhythmic-column-engraver.cc -- implement Rhythmic_column_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
10 #include "rhythmic-head.hh"
12 #include "note-column.hh"
13 #include "dot-column.hh"
14 #include "pointer-group-interface.hh"
16 #include "translator.icc"
19 this engraver glues together stems, rests and note heads into a NoteColumn
22 It also generates spacing objects. Originally, we have tried to
23 have the spacing functionality at different levels.
25 - by simply using the sequence of Separation-item as
26 spacing-sequences (at staff level). Unfortunately, this fucks up if
27 there are different kinds of tuplets in different voices (8th and
28 8ths triplets combined made the program believe there were 1/12 th
31 Doing it in a separate engraver using timing info is generally
32 complicated (start/end time management), and fucks up if a voice
35 Now we do it from here again. This has the problem that voices can
36 appear and disappear at will, leaving lots of loose ends (the note
37 spacing engraver don't know where to connect the last note of the
38 voice on the right with), but we don't complain about those, and let
39 the default spacing do its work.
42 class Rhythmic_column_engraver : public Engraver
44 Link_array<Grob> rheads_;
52 TRANSLATOR_DECLARATIONS (Rhythmic_column_engraver);
55 DECLARE_ACKNOWLEDGER(dot_column);
56 DECLARE_ACKNOWLEDGER(stem);
57 DECLARE_ACKNOWLEDGER(rhythmic_head);
58 PRECOMPUTED_VIRTUAL void process_acknowledged ();
59 PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
62 Rhythmic_column_engraver::Rhythmic_column_engraver ()
73 Rhythmic_column_engraver::process_acknowledged ()
79 note_column_ = make_item ("NoteColumn", rheads_[0]->self_scm ());
81 spacing_ = make_item ("NoteSpacing", SCM_EOL);
82 spacing_->set_object ("left-items", scm_cons (note_column_->self_scm (), SCM_EOL));
86 Pointer_group_interface::add_grob (last_spacing_,
87 ly_symbol2scm ("right-items"),
92 for (int i = 0; i < rheads_.size (); i++)
94 if (!rheads_[i]->get_parent (X_AXIS))
95 Note_column::add_head (note_column_, rheads_[i]);
103 && !dotcol_->get_parent (X_AXIS))
105 Note_column::set_dotcol (note_column_, dotcol_);
109 && !stem_->get_parent (X_AXIS))
111 Note_column::set_stem (note_column_, stem_);
118 Rhythmic_column_engraver::acknowledge_stem (Grob_info i)
124 Rhythmic_column_engraver::acknowledge_rhythmic_head (Grob_info i)
126 rheads_.push (i.grob ());
130 Rhythmic_column_engraver::acknowledge_dot_column (Grob_info i)
136 Rhythmic_column_engraver::stop_translation_timestep ()
142 last_spacing_ = spacing_;
151 ADD_ACKNOWLEDGER(Rhythmic_column_engraver,dot_column);
152 ADD_ACKNOWLEDGER(Rhythmic_column_engraver,stem);
153 ADD_ACKNOWLEDGER(Rhythmic_column_engraver,rhythmic_head);
155 ADD_TRANSLATOR (Rhythmic_column_engraver,
156 /* descr */ "Generates NoteColumn, an objects that groups stems, noteheads and rests.",
157 /* creats*/ "NoteColumn NoteSpacing",