2 slur-reg.cc -- implement Slur_register
4 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
9 #include "musical-request.hh"
10 #include "slur-reg.hh"
13 #include "note-column.hh"
16 Slur_register::do_try_request(Request
*req_l
)
18 Musical_req
*mus_l
= req_l
->musical();
19 if(!mus_l
|| !mus_l
->slur())
22 new_slur_req_l_arr_
.push(mus_l
->slur());
27 Slur_register::acknowledge_element(Score_elem_info info
)
29 if (info
.elem_l_
->name() == Note_column::static_name()) {
30 Note_column
*col_l
=(Note_column
*) info
.elem_l_
->item() ;// ugh
31 for (int i
= 0; i
< slur_l_stack_
.size(); i
++)
32 slur_l_stack_
[i
]->add(col_l
);
33 for (int i
= 0; i
< end_slur_l_arr_
.size(); i
++)
34 end_slur_l_arr_
[i
]->add(col_l
);
39 Slur_register::set_feature(Feature f
)
41 if (f
.type_
== "vdir")
48 Slur_register::Slur_register()
53 Slur_register::do_process_requests()
55 Array
<Slur
*> start_slur_l_arr_
;
56 for (int i
=0; i
< new_slur_req_l_arr_
.size(); i
++) {
57 Slur_req
* slur_req_l
= new_slur_req_l_arr_
[i
];
58 // end slur: move the slur to other array
59 if (slur_req_l
->spantype
== Span_req::STOP
) {
60 if (slur_l_stack_
.empty())
62 slur_req_l
->warning("can't find slur to end");
64 end_slur_l_arr_
.push(slur_l_stack_
.pop());
67 } else if (slur_req_l
->spantype
== Span_req::START
) {
68 // push a new slur onto stack.
69 //(use temp. array to wait for all slur STOPs)
71 requests_arr_
.push(slur_req_l
);
72 start_slur_l_arr_
.push(s_p
);
73 announce_element(Score_elem_info(s_p
, slur_req_l
));
76 for (int i
=0; i
< start_slur_l_arr_
.size(); i
++)
77 slur_l_stack_
.push(start_slur_l_arr_
[i
]);
81 Slur_register::do_pre_move_processing()
83 for (int i
= 0; i
< end_slur_l_arr_
.size(); i
++) {
85 end_slur_l_arr_
[i
]->dir_i_
= dir_i_
;
86 typeset_element(end_slur_l_arr_
[i
]);
88 end_slur_l_arr_
.set_size(0);
92 Slur_register::do_post_move_processing()
94 new_slur_req_l_arr_
.set_size(0);
96 Slur_register::~Slur_register()
98 for (int i
=0; i
< requests_arr_
.size(); i
++) {
99 requests_arr_
[i
]->warning("unterminated slur");
102 IMPLEMENT_STATIC_NAME(Slur_register
);
103 IMPLEMENT_IS_TYPE_B1(Slur_register
,Request_register
);
104 ADD_THIS_REGISTER(Slur_register
);