2 slur-grav.cc -- implement Slur_engraver
4 (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
9 #include "musical-request.hh"
10 #include "slur-grav.hh"
13 #include "note-column.hh"
16 Slur_engraver::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_engraver::acknowledge_element (Score_elem_info info
)
29 if (info
.elem_l_
->is_type_b (Note_column::static_name ()))
31 Note_column
*col_l
=(Note_column
*) info
.elem_l_
->item() ;// ugh
32 for (int i
= 0; i
< slur_l_stack_
.size(); i
++)
33 slur_l_stack_
[i
]->add (col_l
);
34 for (int i
= 0; i
< end_slur_l_arr_
.size(); i
++)
35 end_slur_l_arr_
[i
]->add (col_l
);
40 Slur_engraver::do_removal_processing ()
42 for (int i
= 0; i
< slur_l_stack_
.size(); i
++)
44 typeset_element (slur_l_stack_
[i
]);
46 slur_l_stack_
.clear ();
47 for (int i
=0; i
< requests_arr_
.size(); i
++)
49 requests_arr_
[i
]->warning (_("unterminated slur"));
56 Slur_engraver::Slur_engraver()
61 Slur_engraver::do_process_requests()
63 Array
<Slur
*> start_slur_l_arr_
;
64 for (int i
=0; i
< new_slur_req_l_arr_
.size(); i
++)
66 Slur_req
* slur_req_l
= new_slur_req_l_arr_
[i
];
67 // end slur: move the slur to other array
68 if (slur_req_l
->spantype
== Span_req::STOP
)
70 if (slur_l_stack_
.empty())
72 slur_req_l
->warning (_("can't find slur to end"));
75 end_slur_l_arr_
.push (slur_l_stack_
.pop());
79 else if (slur_req_l
->spantype
== Span_req::START
)
81 // push a new slur onto stack.
82 //(use temp. array to wait for all slur STOPs)
84 Scalar prop
= get_property ("slurdash");
87 requests_arr_
.push (slur_req_l
);
88 start_slur_l_arr_
.push (s_p
);
89 announce_element (Score_elem_info (s_p
, slur_req_l
));
92 for (int i
=0; i
< start_slur_l_arr_
.size(); i
++)
93 slur_l_stack_
.push (start_slur_l_arr_
[i
]);
97 Slur_engraver::do_pre_move_processing()
99 dir_
= (Direction
) int(get_property ("ydirection"));
100 for (int i
= 0; i
< end_slur_l_arr_
.size(); i
++)
103 end_slur_l_arr_
[i
]->dir_
= dir_
;
104 typeset_element (end_slur_l_arr_
[i
]);
106 end_slur_l_arr_
.clear();
110 Slur_engraver::do_post_move_processing()
112 new_slur_req_l_arr_
.clear();
115 IMPLEMENT_IS_TYPE_B1(Slur_engraver
,Engraver
);
116 ADD_THIS_TRANSLATOR(Slur_engraver
);