2 walkregs.cc -- implement Walker_registers
4 source file of the GNU LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
9 #include "walk-regs.hh"
10 #include "staff-regs.hh"
11 #include "score-elem.hh"
13 #include "complex-walker.hh"
14 #include "staff-column.hh"
15 #include "score-walker.hh"
16 #include "bar.hh" // needed for Bar::static_name
17 #include "input-register.hh"
18 #include "staffline.hh"
20 Walker_registers::Walker_registers(Complex_walker
*w
)
23 Input_register
* ireg_l
= w
->staff_l_
->ireg_p_
;
24 if (ireg_l
->name_str_
== "Staff_registers")
25 add(new Staff_registers(ireg_l
));
27 add(ireg_l
->get_nongroup_p_arr());
32 Walker_registers::announce_element(Score_elem_info info
)
34 if (info
.elem_l_
->name() == Bar::static_name()) {
35 walk_l_
->allow_break();
37 announce_info_arr_
.push(info
);
41 Walker_registers::acknowledge_element(Score_elem_info
)
47 Walker_registers::do_announces()
50 for (int i
= 0; i
< announce_info_arr_
.size(); i
++){
51 Score_elem_info info
= announce_info_arr_
[i
];
52 mtor
<< "Announcing " << info
.elem_l_
->name()<<"\n";
55 info
.req_l_
= &dummy_req
;
56 Register_group_register::acknowledge_element(info
);
58 announce_info_arr_
.set_size(0);
62 Walker_registers::typeset_element(Score_elem
*elem_p
)
64 musical_item_p_arr_
.push(elem_p
);
68 Walker_registers::typeset_breakable_item(Item
* pre_p
, Item
* nobreak_p
,
72 prebreak_item_p_arr_
.push(pre_p
);
73 walk_l_
->staff_l_
->staff_line_l_
->add_element(pre_p
);
76 nobreak_item_p_arr_
.push(nobreak_p
);
77 walk_l_
->staff_l_
->staff_line_l_
->add_element(nobreak_p
);
80 postbreak_item_p_arr_
.push(post_p
);
81 walk_l_
->staff_l_
->staff_line_l_
->add_element(post_p
);
86 Walker_registers::pre_move_processing()
88 // this generates all items.
89 Register_group_register::pre_move_processing();
90 walk_l_
->ptr()->typeset_breakable_items(prebreak_item_p_arr_
,
92 postbreak_item_p_arr_
);
93 for (int i
=0; i
< musical_item_p_arr_
.size(); i
++)
94 walk_l_
->typeset_element(musical_item_p_arr_
[i
]);
95 musical_item_p_arr_
.set_size(0);
98 Walker_registers::post_move_processing()
100 Register_group_register::post_move_processing();
105 Walker_registers::get_staff_info()
108 if (walk_l_
->score_walk_l_
) // we get called ctors
109 inf
.break_allowed_b_
= walk_l_
->score_walk_l_
->break_allowed_b();
110 inf
.walk_l_
= walk_l_
;
111 inf
.time_C_
= &walk_l_
->time_
;
112 inf
.rhythmic_C_
= walk_l_
->default_grouping
;
117 Walker_registers::paper()const
119 return walk_l_
->staff_l_
->paper();