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_
;
22 Link_array
<Grob
> grace_slur_endings_
;
28 VIRTUAL_COPY_CONS (Translator
);
29 virtual void acknowledge_grob (Grob_info
);
30 virtual void create_grobs ();
31 virtual void stop_translation_timestep ();
32 virtual void start_translation_timestep ();
34 Rhythmic_column_engraver ();
40 Rhythmic_column_engraver::Rhythmic_column_engraver ()
49 Rhythmic_column_engraver::create_grobs ()
51 if (rhead_l_arr_
.size ())
55 ncol_p_
= new Item (get_property ("NoteColumn"));
56 Note_column::set_interface (ncol_p_
);
57 announce_grob (ncol_p_
, 0);
60 for (int i
=0; i
< rhead_l_arr_
.size (); i
++)
62 if (!rhead_l_arr_
[i
]->parent_l (X_AXIS
))
63 Note_column::add_head (ncol_p_
, rhead_l_arr_
[i
]);
65 rhead_l_arr_
.set_size (0);
72 && !dotcol_l_
->parent_l (X_AXIS
))
74 Note_column::set_dotcol (ncol_p_
, dotcol_l_
);
78 && !stem_l_
->parent_l (X_AXIS
))
80 Note_column::set_stem (ncol_p_
, stem_l_
);
84 SCM wg
= get_property ("weAreGraceContext");
85 bool wegrace
= to_boolean (wg
);
88 for (int i
=0; i
< grace_slur_endings_
.size (); i
++)
89 Slur::add_column (grace_slur_endings_
[i
], ncol_p_
);
90 grace_slur_endings_
.clear ();
95 Rhythmic_column_engraver::acknowledge_grob (Grob_info i
)
97 SCM wg
= get_property ("weAreGraceContext");
98 bool wegrace
= to_boolean (wg
);
99 if (wegrace
!= to_boolean (i
.elem_l_
->get_grob_property ("grace"))
100 && !Slur::has_interface (i
.elem_l_
))
103 Item
* item
= dynamic_cast <Item
*> (i
.elem_l_
);
104 if (item
&& Stem::has_interface (item
))
108 else if (item
&& Rhythmic_head::has_interface (item
))
110 rhead_l_arr_
.push (item
);
112 else if (item
&& Dot_column::has_interface (item
))
116 else if (Slur::has_interface (i
.elem_l_
))
119 end slurs starting on grace notes
122 if (to_boolean (i
.elem_l_
->get_grob_property ("grace")))
123 grace_slur_endings_
.push (i
.elem_l_
);
128 Rhythmic_column_engraver::stop_translation_timestep ()
132 typeset_grob (ncol_p_
);
138 Rhythmic_column_engraver::start_translation_timestep ()
140 grace_slur_endings_
.clear ();
145 ADD_THIS_TRANSLATOR (Rhythmic_column_engraver
);