2 stem-beam-reg.cc -- part of GNU LilyPond
4 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 #include "musical-request.hh"
8 #include "stem-beam-reg.hh"
11 #include "grouping.hh"
12 #include "text-spanner.hh"
13 #include "complex-walker.hh"
15 #include "grouping.hh"
16 #include "note-head.hh"
18 Stem_beam_register::Stem_beam_register()
20 post_move_processing();
29 Stem_beam_register::try_request(Request*req_l)
32 Musical_req* mus_l = req_l->musical();
33 /* Debiele puntkomma's. Laat je er eentje per ongeluk achter een
34 if(..) staan, lijkt het net op een luis in gcc.
42 if ( mus_l->beam() ) {
43 if (bool(beam_p_ ) == bool(mus_l->beam()->spantype == Span_req::START))
46 if (beam_req_l_ && Beam_req::compare(*beam_req_l_ , *mus_l->beam()))
49 beam_req_l_ = mus_l->beam();
53 if ( mus_l->stem() ) {
54 if (current_grouping && !current_grouping->child_fit_b(
55 get_staff_info().time_C_->whole_in_measure_))
58 if (stem_req_l_ && Stem_req::compare(*stem_req_l_, *mus_l->stem()))
61 stem_req_l_ = mus_l->stem();
68 Stem_beam_register::process_requests()
71 if (beam_req_l_->spantype == Span_req::STOP) {
76 start_req_l_ = beam_req_l_;
78 current_grouping = new Rhythmic_grouping;
79 if (beam_req_l_->nplet) {
80 Text_spanner* t = new Text_spanner();
81 Text_def *defp = new Text_def;
82 t->set_support(beam_p_);
84 defp->text_str_ = beam_req_l_->nplet;
85 defp->style_str_="italic";
94 stem_p_ = new Stem(8);
96 current_grouping->add_child(
97 get_staff_info().time_C_->whole_in_measure_,
98 stem_req_l_->duration());
100 stem_p_->flag_i_ = stem_req_l_->duration_.type_i_;
103 if (stem_req_l_->duration_.type_i_<= 4)
104 stem_req_l_->warning( "stem doesn't fit in Beam");
106 beam_p_->add(stem_p_);
107 stem_p_->print_flag_b_ = false;
109 stem_p_->print_flag_b_ = true;
112 announce_element(Score_elem_info(stem_p_, stem_req_l_));
117 Stem_beam_register::acknowledge_element(Score_elem_info info)
122 if (info.elem_l_->name() == Note_head::static_name() &&
123 stem_req_l_->duration()
124 == info.req_l_->musical()->rhythmic()->duration()){
125 Note_head * n_l= (Note_head*)info.elem_l_->item();
130 Stem_beam_register::pre_move_processing()
134 stem_p_->dir_i_ = default_dir_i_;
136 typeset_element(stem_p_);
139 if (beam_p_ && end_beam_b_) {
140 Rhythmic_grouping const * rg_C = get_staff_info().rhythmic_C_;
141 rg_C->extend(current_grouping->interval());
142 beam_p_->set_grouping(*rg_C, *current_grouping);
143 typeset_element(beam_p_);
144 delete current_grouping;
145 current_grouping = 0;
151 Stem_beam_register::post_move_processing()
159 Stem_beam_register::~Stem_beam_register()
162 start_req_l_->warning("unterminated beam");
166 Stem_beam_register::set_feature(Feature i)
168 if (i.type_ == "vdir")
169 default_dir_i_ = i.value_;
172 IMPLEMENT_STATIC_NAME(Stem_beam_register);
173 ADD_THIS_REGISTER(Stem_beam_register);