2 rhythmic-column-grav.cc -- implement Rhythmic_column_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2001 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"
16 #include "musical-request.hh"
19 class Rhythmic_column_engraver :public Engraver
21 Link_array<Grob> rhead_l_arr_;
29 TRANSLATOR_DECLARATIONS(Rhythmic_column_engraver);
32 virtual void acknowledge_grob (Grob_info);
33 virtual void create_grobs ();
34 virtual void stop_translation_timestep ();
35 virtual void start_translation_timestep ();
40 Rhythmic_column_engraver::Rhythmic_column_engraver ()
52 Rhythmic_column_engraver::create_grobs ()
54 if (rhead_l_arr_.size ())
58 note_column_ = new Item (get_property ("NoteColumn"));
59 Note_column::set_interface (note_column_);
60 announce_grob (note_column_, 0);
62 spacing_ = new Item (get_property ("NoteSpacing"));
63 spacing_->set_grob_property ("left-item", note_column_->self_scm ());
64 announce_grob (spacing_, 0);
68 last_spacing_->set_grob_property ("right-item" , note_column_->self_scm ());
72 for (int i=0; i < rhead_l_arr_.size (); i++)
74 if (!rhead_l_arr_[i]->get_parent (X_AXIS))
75 Note_column::add_head (note_column_, rhead_l_arr_[i]);
77 rhead_l_arr_.set_size (0);
84 && !dotcol_l_->get_parent (X_AXIS))
86 Note_column::set_dotcol (note_column_, dotcol_l_);
90 && !stem_l_->get_parent (X_AXIS))
92 Note_column::set_stem (note_column_, stem_l_);
100 Rhythmic_column_engraver::acknowledge_grob (Grob_info i)
102 Item * item = dynamic_cast <Item *> (i.grob_l_);
103 if (item && Stem::has_interface (item))
107 else if (item && Rhythmic_head::has_interface (item))
109 rhead_l_arr_.push (item);
111 else if (item && Dot_column::has_interface (item))
118 Rhythmic_column_engraver::stop_translation_timestep ()
122 typeset_grob (note_column_);
128 Rhythmic_column_engraver::start_translation_timestep ()
136 ENTER_DESCRIPTION(Rhythmic_column_engraver,
137 /* descr */ "Generates NoteColumn, an objects that groups stems, noteheads and rests.",
138 /* creats*/ "NoteColumn",
139 /* acks */ "stem-interface rhythmic-head-interface dot-column-interface",