lilypond-0.1.16
[lilypond.git] / src / voicegroupregs.cc
blobd23b58ac70cc87e637ce6cc05a027c91f39fc055
1 /*
2 voicegroup.cc -- implement Voice_group_registers
4 source file of the LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
9 #include "plist.hh"
10 #include "musicalrequest.hh"
11 #include "voiceregs.hh"
12 #include "voicegroupregs.hh"
13 #include "register.hh"
14 #include "textreg.hh"
15 #include "stembeamreg.hh"
16 #include "scriptreg.hh"
17 #include "complexwalker.hh"
18 #include "commandrequest.hh"
20 static int temp_id_count;
22 Voice_group_registers::Voice_group_registers(Complex_walker*w_l, String id)
24 walk_l_ = w_l;
25 add(new Text_register(w_l));
26 add(new Stem_beam_register(w_l));
27 add(new Script_register(w_l));
29 if (id=="") // UGH
30 id = __FUNCTION__ + String(temp_id_count++);
31 group_id_str_ = id;
34 bool
35 Voice_group_registers::try_request(Request*r_l)
37 if (r_l->groupfeature()) {
38 set_dir(r_l->groupfeature()->stemdir_i_);
39 return true;
41 return Register_group::try_request(r_l);
44 void
45 Voice_group_registers::acknowledge_element(Staff_elem_info i)
47 if (i.group_regs_l_!= this)
48 return;
49 Register_group::acknowledge_element(i);
51 #if 1
52 void
53 Voice_group_registers::set_dir(int i)
55 Register_group::set_dir(i);
57 // ughh
58 Array<Voice_registers*> vr_arr (walk_l_->get_voice_regs(this));
59 for (int j=0; j<vr_arr.size(); j++) {
60 if (vr_arr[j])
61 vr_arr[j]->set_dir(i);
64 #endif
65 bool
66 Voice_group_registers::acceptable_request_b(Request*r)
68 return (r->stem() || r->beam() || r->text() || r->script() ||
69 r->groupfeature());