2 stembeamreg.cc -- part of LilyPond
4 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 #include "musicalrequest.hh"
8 #include "stembeamreg.hh"
11 #include "grouping.hh"
12 #include "textspanner.hh"
13 #include "complexwalker.hh"
14 #include "complexstaff.hh"
16 #include "grouping.hh"
17 Stem_beam_register::Stem_beam_register(Complex_walker
*w
)
20 do_post_move_process();
28 Stem_beam_register::try_request(Request
*req_l
)
30 if ( req_l
->beam() ) {
31 if (bool(beam_p_
) == bool(req_l
->beam()->spantype
== Span_req::START
))
34 if (beam_req_l_
&& Beam_req::compare(*beam_req_l_
, *req_l
->beam()))
37 beam_req_l_
= req_l
->beam();
41 if ( req_l
->stem() ) {
42 if (current_grouping
&& !current_grouping
->child_fit_query(
43 walk_l_
->time_
.whole_in_measure_
))
46 if (stem_req_l_
&& Stem_req::compare(*stem_req_l_
, *req_l
->stem()))
49 stem_req_l_
= req_l
->stem();
56 Stem_beam_register::process_request()
59 if (beam_req_l_
->spantype
== Span_req::STOP
) {
64 start_req_l_
= beam_req_l_
;
66 current_grouping
= new Rhythmic_grouping
;
67 if (beam_req_l_
->nplet
) {
68 Text_spanner
* t
= new Text_spanner();
69 t
->set_support(beam_p_
);
71 t
->spec
.text_str_
= beam_req_l_
->nplet
;
72 t
->spec
.style_str_
="italic";
80 stem_p_
= new Stem(4);
82 current_grouping
->add_child(
83 walk_l_
->time_
.whole_in_measure_
,
84 stem_req_l_
->duration());
86 stem_p_
->flag
= stem_req_l_
->balltype
;
89 if (stem_req_l_
->balltype
<= 4)
90 warning( "stem doesn't fit in Beam",
91 stem_req_l_
->defined_ch_c_l_
);
93 beam_p_
->add(stem_p_
);
94 stem_p_
->print_flag
= false;
96 stem_p_
->print_flag
= true;
99 announce_element(Staff_elem_info(stem_p_
,
105 Stem_beam_register::acknowledge_element(Staff_elem_info info
)
110 if (info
.elem_p_
->name() == String("Notehead") &&
111 stem_req_l_
->duration() == info
.req_l_
->rhythmic()->duration())
113 stem_p_
->add((Notehead
*)info
.elem_p_
);
117 Stem_beam_register::do_pre_move_process()
121 stem_p_
->dir
= default_dir_i_
;
123 typeset_element(stem_p_
);
126 if (beam_p_
&& end_beam_b_
) {
127 walk_l_
->default_grouping
->extend(current_grouping
->interval());
128 beam_p_
->set_grouping(*walk_l_
->default_grouping
, *current_grouping
);
129 typeset_element(beam_p_
);
130 delete current_grouping
;
131 current_grouping
= 0;
137 Stem_beam_register::do_post_move_process()
145 Stem_beam_register::~Stem_beam_register()
148 warning("unterminated beam", start_req_l_
->defined_ch_c_l_
);
152 Stem_beam_register::set_dir(int i
)