2 script-reg.cc -- implement Script_register
4 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 #include "script-reg.hh"
9 #include "musical-request.hh"
11 #include "staff-sym.hh"
13 Script_register::Script_register()
15 do_post_move_processing();
19 Script_register::do_try_request(Request
*r_l
)
21 if (!r_l
->musical() || ! r_l
->musical()->musicalscript())
24 for (int i
=0; i
< script_req_l_arr_
.size(); i
++)
25 if ( !Script_req::compare(*script_req_l_arr_
[i
], *r_l
->script())) {
29 script_req_l_arr_
.push( r_l
->script());
35 Script_register::do_process_requests()
37 for (int i
=0; i
< script_req_l_arr_
.size(); i
++){
38 Script_req
* l
=script_req_l_arr_
[i
];
39 Script
*p
=new Script
;
40 p
->dir_i_
= l
->dir_i_
;
41 p
->specs_l_
= l
->scriptdef_p_
;
42 script_p_arr_
.push(p
);
43 announce_element(Score_elem_info(p
, l
));
48 Script_register::acceptable_elem_b(Score_elem
*s_l
)
50 char const *nC
= s_l
->name();
51 return (nC
== Stem::static_name());
55 Script_register::acknowledge_element(Score_elem_info info
)
57 Score_elem
*elem_l
= info
.elem_l_
;
58 if (!acceptable_elem_b(elem_l
))
61 for (int i
=0; i
< script_p_arr_
.size(); i
++) {
62 Script
*script_l
= script_p_arr_
[i
];
63 if (elem_l
->name() == Stem::static_name())
64 script_l
->set_stem((Stem
*)elem_l
->item());
69 Script_register::do_pre_move_processing()
71 Staff_symbol
* s_l
= get_staff_info().staff_sym_l_
;
72 for (int i
=0; i
< script_p_arr_
.size(); i
++) {
74 Script
*script_p
= script_p_arr_
[i
];
75 script_p
->set_staffsym( s_l
);
76 typeset_element(script_p
);
78 script_p_arr_
.set_size(0);
82 Script_register::do_post_move_processing()
84 script_req_l_arr_
.set_size(0);
87 IMPLEMENT_STATIC_NAME(Script_register
);
88 IMPLEMENT_IS_TYPE_B1(Script_register
,Request_register
);
89 ADD_THIS_REGISTER(Script_register
);