2 slur-reg.cc -- implement Slur_register
4 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
9 #include "musical-request.hh"
10 #include "complex-walker.hh"
11 #include "slur-reg.hh"
14 #include "note-column.hh"
17 Slur_register::acceptable_request_b(Request*req_l)
19 return req_l->musical() && req_l->musical()->slur();
23 Slur_register::try_request(Request *req_l)
28 new_slur_req_l_arr_.push(req_l->slur());
33 Slur_register::acknowledge_element(Score_elem_info info)
35 if (info.elem_l_->name() == Note_column::static_name()) {
36 Note_column *col_l =(Note_column*) info.elem_l_->item() ;// ugh
37 for (int i = 0; i < slur_l_stack_.size(); i++)
38 slur_l_stack_[i]->add(col_l );
39 for (int i = 0; i < end_slur_l_arr_.size(); i++)
40 end_slur_l_arr_[i]->add(col_l);
45 Slur_register::set_feature(Feature f)
47 if (f.type_ == "vdir")
54 Slur_register::Slur_register()
59 Slur_register::process_requests()
61 Array<Slur*> start_slur_l_arr_;
62 for (int i=0; i< new_slur_req_l_arr_.size(); i++) {
63 Slur_req* slur_req_l = new_slur_req_l_arr_[i];
64 // end slur: move the slur to other array
65 if (slur_req_l->spantype == Span_req::STOP) {
66 if (slur_l_stack_.empty())
68 slur_req_l->warning("can't find slur to end");
70 end_slur_l_arr_.push(slur_l_stack_.pop());
73 } else if (slur_req_l->spantype == Span_req::START) {
74 // push a new slur onto stack.
75 //(use temp. array to wait for all slur STOPs)
77 requests_arr_.push(slur_req_l);
78 start_slur_l_arr_.push(s_p);
79 announce_element(Score_elem_info(s_p, slur_req_l));
82 for (int i=0; i < start_slur_l_arr_.size(); i++)
83 slur_l_stack_.push(start_slur_l_arr_[i]);
87 Slur_register::pre_move_processing()
89 for (int i = 0; i < end_slur_l_arr_.size(); i++) {
91 end_slur_l_arr_[i]->dir_i_ = dir_i_;
92 typeset_element(end_slur_l_arr_[i]);
94 end_slur_l_arr_.set_size(0);
98 Slur_register::post_move_processing()
100 new_slur_req_l_arr_.set_size(0);
102 Slur_register::~Slur_register()
104 for (int i=0; i < requests_arr_.size(); i++) {
105 requests_arr_[i]->warning("unterminated slur");
108 IMPLEMENT_STATIC_NAME(Slur_register);
109 ADD_THIS_REGISTER(Slur_register);