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 "text-reg.hh"
16 #include "stem-beam-reg.hh"
17 #include "script-reg.hh"
18 #include "complex-walker.hh"
19 #include "command-request.hh"
21 #include "dynamic-reg.hh"
23 static int temp_id_count;
25 Voice_group_registers::Voice_group_registers(String id)
27 add(new Dynamic_register);
28 add(new Text_register);
29 add(new Stem_beam_register);
30 add(new Script_register);
33 id = __FUNCTION__ + String(temp_id_count++);
39 Voice_group_registers::try_request(Request*r_l)
41 for (int i=0; i < voice_regs_l_.size(); i++) {
42 if (voice_regs_l_[i]->voice_l_ == r_l->voice_l())
47 if (r_l->groupfeature()) {
48 set_feature(Features::dir(r_l->groupfeature()->stemdir_i_));
51 return Register_group_register::try_request(r_l);
56 Voice_group_registers::static_acceptable_request_b(Request*r)
58 return (r->stem() || r->beam() || r->text() || r->script() ||
63 Voice_group_registers::terminate_register(Request_register*r_l)
65 if (r_l->name() == Voice_registers::static_name()) {
66 for (int i=0; i <voice_regs_l_.size(); i++) {
67 if (r_l == voice_regs_l_[i])
69 mtor << "Terminating voice_reg " ;
70 Register_group_register::terminate_register(r_l);
76 IMPLEMENT_STATIC_NAME(Voice_group_registers);
79 Voice_group_registers::do_print() const
82 mtor << "ID: " << group_id_str_<<"\n";
83 mtor << "stopping at " << termination_mom_ << "\n";
84 Register_group_register::do_print();
88 Voice_group_registers::add(Request_register*r_l)
90 Register_group_register::add(r_l);
91 if (r_l->name() == Voice_registers::static_name()) {
92 Voice_registers * vregs_l = (Voice_registers*)r_l;
93 voice_regs_l_.push( vregs_l );
94 Voice *v_l = vregs_l->voice_l_;
95 termination_mom_ = termination_mom_ >? v_l -> last();
96 mtor << "adding Voice_registers, now terminating at " <<
97 termination_mom_<< "\n";
102 Voice_group_registers::post_move_processing()
104 if ( get_staff_info().time_C_ ->when_ > termination_mom_ ){
105 mtor << "Terminating voice_group\n";
106 daddy_reg_l_->terminate_register(this);
108 Register_group_register::post_move_processing();