2 voice-regs.cc -- implement Voice_registers
4 source file of the LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
8 #include "commandrequest.hh"
9 #include "musicalrequest.hh"
10 #include "voice-regs.hh"
11 #include "register.hh"
12 #include "slur-reg.hh"
14 #include "walkregs.hh"
17 Voice_registers::Voice_registers(Voice
*v_p
)
20 add(new Notehead_register
);
21 add(new Slur_register
);
25 Voice_registers::acknowledge_element(Staff_elem_info i
)
27 if (i
.voice_l_
!= voice_l_
)
29 Register_group_register::acknowledge_element(i
);
33 Voice_registers::try_request(Request
*r_l
)
35 if (r_l
->voice_l() !=voice_l_
)
38 Command_req
*c
=r_l
->command();
39 if (c
&&c
->terminate()) {
40 daddy_reg_l_
->terminate_register(this);
41 return true; // scary. We're deleted now..
42 } else if (c
&&c
->groupchange()) {
44 ((Walker_registers
*)daddy_reg_l_
->daddy_reg_l_
)-> // scary.
45 change_group(c
->groupchange(), this,
46 (Voice_group_registers
*)daddy_reg_l_
); // UGR!
50 return Register_group_register::try_request(r_l
);
54 Voice_registers::acceptable_request_b(Request
*r
)
56 // return (r->rest() || r->note() || r->slur() || r->groupchange());
57 return r
->groupchange()
58 || Register_group_register::acceptable_request_b(r
);
61 Voice_registers::do_print() const
63 mtor
<< "Voice= " << voice_l_
<<'\n';
64 Register_group_register::do_print();