]> git.donarmstrong.com Git - lilypond.git/blob - src/voicegroup.cc
release: 0.0.27
[lilypond.git] / src / voicegroup.cc
1 #include "request.hh"
2 #include "complexwalker.hh"
3 #include "complexstaff.hh"
4 #include "voicegroup.hh"
5 #include "register.hh"
6
7 static int temp_id_count;
8
9 Voice_group_registers::Voice_group_registers(Complex_walker*w_l, String id)
10     : text_reg_(w_l),
11       stem_beam_reg_(w_l),
12       script_reg_(w_l)
13 {
14     walk_l_ = w_l;
15     if (id=="")
16         id = __FUNCTION__ + String(temp_id_count++);
17     group_id_str_ = id;
18     dir_i_ = 0;
19 }
20
21 void
22 Voice_group_registers::pre_move_processing()
23 {
24     stem_beam_reg_.pre_move_processing();
25     script_reg_.pre_move_processing();
26     text_reg_.pre_move_processing();  
27 }
28
29 void
30 Voice_group_registers::post_move_processing()
31 {
32     stem_beam_reg_.post_move_processing();
33     text_reg_.post_move_processing();
34     script_reg_.post_move_processing();
35 }
36
37 bool
38 Voice_group_registers::try_request(Request*r_l)
39 {
40     if (r_l->groupfeature()) {
41         dir_i_ = r_l->groupfeature()->stemdir_i_;
42         return true;
43     } 
44     bool b = stem_beam_reg_.try_request(r_l);
45     if (!b)
46         b|= script_reg_.try_request(r_l);
47     if (!b)
48         b|=  text_reg_.try_request(r_l);
49
50     return b;
51 }
52     
53 void
54 Voice_group_registers::announce_element(Staff_elem_info i)
55 {
56     if (i.group_regs_l_!= this)
57         return;
58         
59     stem_beam_reg_.acknowledge_element(i);
60     script_reg_.acknowledge_element(i);
61     text_reg_.acknowledge_element(i);
62 }
63
64
65 void
66 Voice_group_registers::process_requests()
67 {
68     stem_beam_reg_.process_request();
69     if (dir_i_)
70         stem_beam_reg_.set_dir (dir_i_);
71     
72     script_reg_.process_request();
73     text_reg_.process_request();
74 }
75
76
77 bool
78 Voice_group_registers::acceptable_request(Request*r)
79 {
80     return (r->stem() || r->beam() || r->text() || r->script() ||
81             r->groupfeature());
82 }