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 "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.
40 class Rhythmic_column_engraver : public Engraver
42 Link_array<Grob> rheads_;
50 TRANSLATOR_DECLARATIONS (Rhythmic_column_engraver);
53 virtual void acknowledge_grob (Grob_info);
54 virtual void process_acknowledged_grobs ();
55 virtual void stop_translation_timestep ();
58 Rhythmic_column_engraver::Rhythmic_column_engraver ()
69 Rhythmic_column_engraver::process_acknowledged_grobs ()
75 note_column_ = make_item ("NoteColumn", rheads_[0]->self_scm ());
77 spacing_ = make_item ("NoteSpacing", SCM_EOL);
78 spacing_->set_property ("left-items", scm_cons (note_column_->self_scm (), SCM_EOL));
82 Pointer_group_interface::add_grob (last_spacing_,
83 ly_symbol2scm ("right-items"),
88 for (int i = 0; i < rheads_.size (); i++)
90 if (!rheads_[i]->get_parent (X_AXIS))
91 Note_column::add_head (note_column_, rheads_[i]);
99 && !dotcol_->get_parent (X_AXIS))
101 Note_column::set_dotcol (note_column_, dotcol_);
105 && !stem_->get_parent (X_AXIS))
107 Note_column::set_stem (note_column_, stem_);
114 Rhythmic_column_engraver::acknowledge_grob (Grob_info i)
116 Item *item = dynamic_cast<Item *> (i.grob ());
117 if (!item || item->get_parent (X_AXIS))
119 if (Stem::has_interface (item))
123 else if (Rhythmic_head::has_interface (item))
127 else if (Dot_column::has_interface (item))
134 Rhythmic_column_engraver::stop_translation_timestep ()
140 last_spacing_ = spacing_;
148 ADD_TRANSLATOR (Rhythmic_column_engraver,
149 /* descr */ "Generates NoteColumn, an objects that groups stems, noteheads and rests.",
150 /* creats*/ "NoteColumn NoteSpacing",
152 /* acks */ "stem-interface rhythmic-head-interface dot-column-interface",