2 auto-plet-engraver.cc -- implement Auto_plet_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
10 #include "tuplet-engraver.hh"
11 #include "command-request.hh"
12 #include "tuplet-spanner.hh"
13 #include "note-column.hh"
14 #include "compressed-music.hh"
15 #include "text-def.hh"
18 Tuplet_engraver::do_try_music (Music
*r
)
20 if (Compressed_music
* c
= dynamic_cast<Compressed_music
*> (r
))
22 compressed_music_arr_
.push (c
);
23 stop_moments_
.push (now_moment () + c
->duration ());
30 Tuplet_engraver::do_process_requests ()
32 for (int i
= started_span_p_arr_
.size ();
33 i
< compressed_music_arr_
.size (); i
++)
35 Plet_spanner
* glep
= new Plet_spanner
;
36 started_span_p_arr_
.push (glep
);
38 Text_def
*t
= new Text_def
;
39 t
->text_str_
= to_str (compressed_music_arr_
[i
]->den_i_
);
40 glep
->tdef_p_
.set_p (t
);
41 announce_element (Score_element_info (glep
, compressed_music_arr_
[i
]));
46 Tuplet_engraver::acknowledge_element (Score_element_info i
)
48 if (Note_column
*nc
= dynamic_cast<Note_column
*> (i
.elem_l_
))
50 for (int j
=0; j
<started_span_p_arr_
.size (); j
++)
51 started_span_p_arr_
[j
]->add_column (nc
);
56 Tuplet_engraver::do_post_move_processing ()
58 Moment now
= now_moment ();
59 for (int i
= started_span_p_arr_
.size (); i
--; )
61 if (now
>= stop_moments_
[i
])
63 typeset_element (started_span_p_arr_
[i
]);
64 started_span_p_arr_
.del (i
);
66 compressed_music_arr_
.del(i
);
72 Tuplet_engraver::do_removal_processing ()
74 for (int i
=0; i
< started_span_p_arr_
.size (); i
++)
76 typeset_element (started_span_p_arr_
[i
]);
80 ADD_THIS_TRANSLATOR(Tuplet_engraver
);