lilypond-1.1.47
[lilypond.git] / src / voice-regs.cc
blob1f61617007a565cc540b6778c26940d7720883fe
1 /*
2 voice-regs.cc -- implement Voice_registers
4 source file of the LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
8 #include "commandrequest.hh"
9 #include "musicalrequest.hh"
10 #include "voice-regs.hh"
11 #include "register.hh"
12 #include "slur-reg.hh"
13 #include "headreg.hh"
14 #include "walkregs.hh"
15 #include "debug.hh"
17 Voice_registers::Voice_registers(Voice *v_p)
19 voice_l_ = v_p;
20 add(new Notehead_register);
21 add(new Slur_register);
24 void
25 Voice_registers::acknowledge_element(Staff_elem_info i)
27 if (i.voice_l_ != voice_l_)
28 return;
29 Register_group_register::acknowledge_element(i);
32 bool
33 Voice_registers::try_request(Request*r_l)
35 if (r_l->voice_l() !=voice_l_)
36 return false;
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!
47 return true;
50 return Register_group_register::try_request(r_l);
53 bool
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);
60 void
61 Voice_registers::do_print() const
63 mtor << "Voice= " << voice_l_<<'\n';
64 Register_group_register::do_print();