2 rest-collision-reg.cc -- implement Rest_collision_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
10 #include "rest-collision.hh"
11 #include "engraver.hh"
12 #include "collision.hh"
13 #include "note-column.hh"
16 class Rest_collision_engraver
: public Engraver
18 Item
* rest_collision_p_
;
20 Link_array
<Note_column
> note_column_l_arr_
;
22 virtual void acknowledge_element (Score_element_info
);
23 virtual void process_acknowledged ();
24 virtual void do_pre_move_processing();
26 VIRTUAL_COPY_CONS(Translator
);
27 Rest_collision_engraver();
31 ADD_THIS_TRANSLATOR(Rest_collision_engraver
);
33 Rest_collision_engraver::Rest_collision_engraver()
39 Rest_collision_engraver::process_acknowledged ()
41 if (rest_collision_p_
|| note_column_l_arr_
.size () < 2)
44 rest_collision_p_
= new Item (get_property ("basicRestCollisionProperties"));
45 Rest_collision (rest_collision_p_
).set_interface();
46 announce_element (Score_element_info (rest_collision_p_
, 0));
47 for (int i
=0; i
< note_column_l_arr_
.size (); i
++)
48 Rest_collision (rest_collision_p_
).add_column (note_column_l_arr_
[i
]);
52 Rest_collision_engraver::acknowledge_element (Score_element_info i
)
54 if (dynamic_cast<Note_column
*> (i
.elem_l_
))
55 note_column_l_arr_
.push (dynamic_cast<Note_column
*> (i
.elem_l_
));
59 Rest_collision_engraver::do_pre_move_processing()
61 if (rest_collision_p_
)
63 typeset_element (rest_collision_p_
);
64 rest_collision_p_
= 0;
66 note_column_l_arr_
.clear ();