2 rest-collision-reg.cc -- implement Rest_collision_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2003 Han-Wen Nienhuys <hanwen@cs.uu.nl>
10 #include "rest-collision.hh"
11 #include "engraver.hh"
12 #include "note-collision.hh"
13 #include "note-column.hh"
15 class Rest_collision_engraver
: public Engraver
17 Item
* rest_collision_
;
19 Link_array
<Grob
> note_columns_
;
21 virtual void acknowledge_grob (Grob_info
);
22 virtual void process_acknowledged_grobs ();
23 virtual void stop_translation_timestep ();
25 TRANSLATOR_DECLARATIONS(Rest_collision_engraver
);
30 Rest_collision_engraver::Rest_collision_engraver ()
36 Rest_collision_engraver::process_acknowledged_grobs ()
38 if (rest_collision_
|| note_columns_
.size () < 2)
41 rest_collision_
= new Item (get_property ("RestCollision"));
43 announce_grob(rest_collision_
, SCM_EOL
);
44 for (int i
=0; i
< note_columns_
.size (); i
++)
45 Rest_collision::add_column (rest_collision_
,note_columns_
[i
]);
49 Rest_collision_engraver::acknowledge_grob (Grob_info i
)
51 if (Note_column::has_interface (i
.grob_
))
52 note_columns_
.push (i
.grob_
);
56 Rest_collision_engraver::stop_translation_timestep ()
60 typeset_grob (rest_collision_
);
63 note_columns_
.clear ();
65 ENTER_DESCRIPTION(Rest_collision_engraver
,
66 /* descr */ "Handles collisions of rests.",
67 /* creats*/ "RestCollision",
69 /* acks */ "note-column-interface",