lilypond-1.3.31
[lilypond.git] / lily / rest-collision-reg.cc
blob259e33c94937a7eff81e819c6a1b2f76bc5e23a4
1 /*
2 rest-collision-reg.cc -- implement Rest_collision_register
4 source file of the GNU LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
9 #include "debug.hh"
10 #include "rest-collision.hh"
11 #include "rest-collision-reg.hh"
12 #include "collision.hh"
13 #include "rest-column.hh"
14 #include "note-column.hh"
16 IMPLEMENT_STATIC_NAME(Rest_collision_register);
17 IMPLEMENT_IS_TYPE_B1(Rest_collision_register, Request_register);
18 ADD_THIS_REGISTER(Rest_collision_register);
20 Rest_collision_register::Rest_collision_register()
22 rest_collision_p_ =0;
25 void
26 Rest_collision_register::acknowledge_element(Score_elem_info i)
28 char const * nC = i.elem_l_->name();
29 if (nC == Collision::static_name()) {
30 collision_l_arr_.push((Collision*)i.elem_l_->item());
32 else if (nC == Note_column::static_name()) {
33 // what should i do, what should _register do?
34 if (!rest_collision_p_)
35 rest_collision_p_ = new Rest_collision;
36 rest_collision_p_->add((Note_column*)i.elem_l_->item());
38 else if (nC == Rest_column::static_name()) {
39 if (!rest_collision_p_)
40 rest_collision_p_ = new Rest_collision;
41 rest_collision_p_->add((Rest_column*)i.elem_l_->item());
45 void
46 Rest_collision_register::do_pre_move_processing()
48 if (rest_collision_p_) {
49 typeset_element(rest_collision_p_);
50 rest_collision_p_ = 0;
54 void
55 Rest_collision_register::do_print() const
57 #ifndef NPRINT
58 mtor << "collisions: " << collision_l_arr_.size();
59 if ( rest_collision_p_ )
60 rest_collision_p_->print();
61 #endif