2 stembeamreg.cc -- part of LilyPond
4 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 #include "stembeamreg.hh"
10 #include "grouping.hh"
11 #include "textspanner.hh"
12 #include "complexwalker.hh"
13 #include "complexstaff.hh"
16 Stem_beam_register::Stem_beam_register(Complex_walker
*w
)
19 do_post_move_process();
27 Stem_beam_register::try_request(Request
*req_l
)
29 if ( req_l
->beam() ) {
30 if (bool(beam_p_
) == bool(req_l
->beam()->spantype
== Span_req::START
))
33 if (beam_req_l_
&& Beam_req::compare(*beam_req_l_
, *req_l
->beam()))
36 beam_req_l_
= req_l
->beam();
40 if ( req_l
->stem() ) {
41 if (current_grouping
&& !current_grouping
->child_fit_query(
42 walk_l_
->col()->tdescription_
->whole_in_measure
))
45 if (stem_req_l_
&& Stem_req::compare(*stem_req_l_
, *req_l
->stem()))
48 stem_req_l_
= req_l
->stem();
55 Stem_beam_register::process_request()
58 if (beam_req_l_
->spantype
== Span_req::STOP
) {
63 start_req_l_
= beam_req_l_
;
65 current_grouping
= new Rhythmic_grouping
;
66 if (beam_req_l_
->nplet
) {
67 Text_spanner
* t
= new Text_spanner();
68 t
->set_support(beam_p_
);
70 t
->spec
.text_str_
= beam_req_l_
->nplet
;
78 stem_p_
= new Stem(4);
80 current_grouping
->add_child(
81 walk_l_
->col()->tdescription_
->whole_in_measure
,
82 stem_req_l_
->duration());
84 stem_p_
->flag
= stem_req_l_
->balltype
;
87 if (stem_req_l_
->balltype
<= 4)
88 warning( "stem doesn't fit in Beam",
89 stem_req_l_
->defined_ch_c_l_m
);
91 beam_p_
->add(stem_p_
);
92 stem_p_
->print_flag
= false;
94 stem_p_
->print_flag
= true;
97 announce_element(Staff_elem_info(stem_p_
,
103 Stem_beam_register::acknowledge_element(Staff_elem_info info
)
108 if (info
.elem_p_
->name() == String("Notehead") &&
109 stem_req_l_
->duration() == info
.req_l_
->rhythmic()->duration())
111 stem_p_
->add((Notehead
*)info
.elem_p_
);
115 Stem_beam_register::do_pre_move_process()
119 stem_p_
->dir
= default_dir_i_
;
121 typeset_element(stem_p_
);
124 if (beam_p_
&& end_beam_b_
) {
125 walk_l_
->default_grouping
.extend(current_grouping
->interval());
126 beam_p_
->set_grouping(walk_l_
->default_grouping
, *current_grouping
);
127 typeset_element(beam_p_
);
128 delete current_grouping
;
129 current_grouping
= 0;
135 Stem_beam_register::do_post_move_process()
143 Stem_beam_register::~Stem_beam_register()
146 warning("unterminated beam", start_req_l_
->defined_ch_c_l_m
);
150 Stem_beam_register::set_dir(int i
)