lilypond-0.1.27
[lilypond.git] / lily / script-grav.cc
blob1fed7f0299d834cb864b93e92e3f0ab7d4cc5ad1
1 /*
2 script-reg.cc -- implement Script_engraver
4 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
5 */
7 #include "script-grav.hh"
8 #include "script.hh"
9 #include "musical-request.hh"
10 #include "stem.hh"
11 #include "staff-sym.hh"
13 Script_engraver::Script_engraver()
15 do_post_move_processing();
18 bool
19 Script_engraver::do_try_request (Request *r_l)
21 if (!r_l->musical() || ! r_l->musical ()->musicalscript ())
22 return false ;
24 for (int i=0; i < script_req_l_arr_.size(); i++)
26 if (r_l->equal_b (script_req_l_arr_[i]))
27 return true;
29 script_req_l_arr_.push (r_l->script());
31 return true;
34 void
35 Script_engraver::do_process_requests()
37 if (script_p_arr_.size ())
38 return ;
40 for (int i=0; i < script_req_l_arr_.size(); i++)
42 Script_req* l=script_req_l_arr_[i];
43 Script *p =new Script;
44 p->dir_ = l->dir_;
45 p->specs_l_ = l->scriptdef_p_;
46 script_p_arr_.push (p);
47 announce_element (Score_elem_info (p, l));
51 void
52 Script_engraver::do_pre_move_processing()
54 Staff_symbol* s_l = get_staff_info().staff_sym_l_;
55 for (int i=0; i < script_p_arr_.size(); i++)
57 Script*script_p = script_p_arr_[i];
58 script_p->set_staffsym (s_l);
59 typeset_element (script_p);
61 script_p_arr_.clear();
64 void
65 Script_engraver::do_post_move_processing()
67 script_req_l_arr_.clear();
71 IMPLEMENT_IS_TYPE_B1(Script_engraver,Engraver);
72 ADD_THIS_TRANSLATOR(Script_engraver);