2 rhythmic-column-grav.cc -- implement Rhythmic_column_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2003 Han-Wen Nienhuys <hanwen@cs.uu.nl>
11 #include "engraver.hh"
12 #include "rhythmic-head.hh"
14 #include "note-column.hh"
15 #include "dot-column.hh"
18 #include "group-interface.hh"
23 this engraver glues together stems, rests and note heads into a NoteColumn
26 It also generates spacing objects. Originally, we have tried to
27 have the spacing functionality at different levels.
29 - by simply using the sequence of Separation-item as
30 spacing-sequences (at staff level). Unfortunately, this fucks up if
31 there are different kinds of tuplets in different voices (8th and
32 8ths triplets combined made the program believe there were 1/12 th
35 Doing it in a separate engraver using timing info is generally
36 complicated (start/end time management), and fucks up if a voice
39 Now we do it from here again. This has the problem that voices can
40 appear and disappear at will, leaving lots of loose ends (the note
41 spacing engraver don't know where to connect the last note of the
42 voice on the right with), but we don't complain about those, and let
43 the default spacing do its work.
48 class Rhythmic_column_engraver :public Engraver
50 Link_array<Grob> rheads_;
58 TRANSLATOR_DECLARATIONS(Rhythmic_column_engraver);
61 virtual void acknowledge_grob (Grob_info);
62 virtual void process_acknowledged_grobs ();
63 virtual void stop_translation_timestep ();
64 virtual void start_translation_timestep ();
69 Rhythmic_column_engraver::Rhythmic_column_engraver ()
81 Rhythmic_column_engraver::process_acknowledged_grobs ()
87 note_column_ = new Item (get_property ("NoteColumn"));
88 announce_grob(note_column_, rheads_[0]->self_scm ());
90 spacing_ = new Item (get_property ("NoteSpacing"));
91 spacing_->set_grob_property ("left-items", gh_cons (note_column_->self_scm (), SCM_EOL));
94 announce_grob (spacing_, SCM_EOL);
98 Pointer_group_interface::add_grob (last_spacing_,
99 ly_symbol2scm ("right-items" ),
105 for (int i=0; i < rheads_.size (); i++)
107 if (!rheads_[i]->get_parent (X_AXIS))
108 Note_column::add_head (note_column_, rheads_[i]);
110 rheads_.set_size (0);
117 && !dotcol_->get_parent (X_AXIS))
119 Note_column::set_dotcol (note_column_, dotcol_);
123 && !stem_->get_parent (X_AXIS))
125 Note_column::set_stem (note_column_, stem_);
133 Rhythmic_column_engraver::acknowledge_grob (Grob_info i)
135 Item * item = dynamic_cast <Item *> (i.grob_);
136 if (!item || item->get_parent (X_AXIS))
138 if (Stem::has_interface (item))
142 else if (Rhythmic_head::has_interface (item))
146 else if (Dot_column::has_interface (item))
153 Rhythmic_column_engraver::stop_translation_timestep ()
157 typeset_grob (note_column_);
163 typeset_grob (spacing_);
164 last_spacing_ = spacing_;
170 Rhythmic_column_engraver::start_translation_timestep ()
178 ENTER_DESCRIPTION(Rhythmic_column_engraver,
179 /* descr */ "Generates NoteColumn, an objects that groups stems, noteheads and rests.",
180 /* creats*/ "NoteColumn NoteSpacing",
182 /* acks */ "stem-interface rhythmic-head-interface dot-column-interface",