2 voicegroup.cc -- implement Voice_group_registers
4 source file of the LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
11 #include "musical-request.hh"
12 #include "voice-regs.hh"
13 #include "voice-group-regs.hh"
14 #include "register.hh"
15 #include "complex-walker.hh"
16 #include "command-request.hh"
18 #include "input-register.hh"
20 static int temp_id_count;
22 Voice_group_registers::Voice_group_registers(String id,
23 Input_register const *ireg_C)
26 Register_group_register::add(ireg_C->get_nongroup_p_arr());
28 id = __FUNCTION__ + String(temp_id_count++);
34 Voice_group_registers::try_request(Request*r_l)
36 for (int i=0; i < voice_reg_l_arr_.size(); i++) {
37 if (voice_reg_l_arr_[i]->voice_l_ == r_l->voice_l())
38 goto gotcha; // yeah, yeah, I know
42 Command_req* c_l = r_l->command();
43 if (c_l&& c_l->groupfeature()) {
45 f.type_ = c_l->groupfeature()->type_str_;
46 f.value_ = c_l->groupfeature()->value_str_;
50 return Register_group_register::try_request(r_l);
54 IMPLEMENT_STATIC_NAME(Voice_group_registers);
57 Voice_group_registers::do_print() const
60 mtor << "ID: " << group_id_str_<<"\n";
61 mtor << "stopping at " << termination_mom_ << "\n";
62 Register_group_register::do_print();
66 Voice_group_registers::add(Request_register*r_l)
68 Register_group_register::add(r_l);
69 if (r_l->name() == Voice_registers::static_name()) {
70 Voice_registers * vregs_l = (Voice_registers*)r_l;
71 voice_reg_l_arr_.push( vregs_l );
72 Voice *v_l = vregs_l->voice_l_;
73 termination_mom_ = termination_mom_ >? v_l -> last();
74 mtor << "adding Voice_registers, now terminating at " <<
75 termination_mom_<< "\n";
81 Voice_group_registers::post_move_processing()
83 if ( get_staff_info().time_C_ ->when_ > termination_mom_ ){
84 mtor << "Terminating voice_group\n";
85 daddy_reg_l_->terminate_register(this);
88 Register_group_register::post_move_processing();
92 Voice_group_registers::get_register_p(Request_register *reg_l)
94 if (reg_l->name() == Voice_registers::static_name()) {
95 for (int i=0; i <voice_reg_l_arr_.size(); i++) {
96 if (reg_l == voice_reg_l_arr_[i])
97 voice_reg_l_arr_.del(i);
100 Request_register*reg_p =Register_group_register::get_register_p(reg_l);
107 Voice_group_registers::OK() const
109 for (int i=0; i < voice_reg_l_arr_.size(); i++) {
110 iter(reg_list_.find(voice_reg_l_arr_[i]), j);