2 rhythmic-column-grav.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 "group-interface.hh"
17 this engraver glues together stems, rests and note heads into a NoteColumn
20 It also generates spacing objects. Originally, we have tried to
21 have the spacing functionality at different levels.
23 - by simply using the sequence of Separation-item as
24 spacing-sequences (at staff level). Unfortunately, this fucks up if
25 there are different kinds of tuplets in different voices (8th and
26 8ths triplets combined made the program believe there were 1/12 th
29 Doing it in a separate engraver using timing info is generally
30 complicated (start/end time management), and fucks up if a voice
33 Now we do it from here again. This has the problem that voices can
34 appear and disappear at will, leaving lots of loose ends (the note
35 spacing engraver don't know where to connect the last note of the
36 voice on the right with), but we don't complain about those, and let
37 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 virtual void acknowledge_grob (Grob_info);
56 virtual void process_acknowledged_grobs ();
57 virtual void stop_translation_timestep ();
62 Rhythmic_column_engraver::Rhythmic_column_engraver ()
74 Rhythmic_column_engraver::process_acknowledged_grobs ()
80 note_column_ = make_item ("NoteColumn",rheads_[0]->self_scm ());
82 spacing_ = make_item ("NoteSpacing", SCM_EOL);
83 spacing_->set_property ("left-items", scm_cons (note_column_->self_scm (), SCM_EOL));
90 Pointer_group_interface::add_grob (last_spacing_,
91 ly_symbol2scm ("right-items" ),
97 for (int i = 0; i < rheads_.size (); i++)
99 if (!rheads_[i]->get_parent (X_AXIS))
100 Note_column::add_head (note_column_, rheads_[i]);
102 rheads_.set_size (0);
109 && !dotcol_->get_parent (X_AXIS))
111 Note_column::set_dotcol (note_column_, dotcol_);
115 && !stem_->get_parent (X_AXIS))
117 Note_column::set_stem (note_column_, stem_);
125 Rhythmic_column_engraver::acknowledge_grob (Grob_info i)
127 Item * item = dynamic_cast <Item *> (i.grob_);
128 if (!item || item->get_parent (X_AXIS))
130 if (Stem::has_interface (item))
134 else if (Rhythmic_head::has_interface (item))
138 else if (Dot_column::has_interface (item))
145 Rhythmic_column_engraver::stop_translation_timestep ()
151 last_spacing_ = spacing_;
161 ADD_TRANSLATOR (Rhythmic_column_engraver,
162 /* descr */ "Generates NoteColumn, an objects that groups stems, noteheads and rests.",
163 /* creats*/ "NoteColumn NoteSpacing",
165 /* acks */ "stem-interface rhythmic-head-interface dot-column-interface",