lilypond-0.1.35
[lilypond.git] / lily / script-grav.cc
blob597fe0809ab72e6130849746661621d9d4a9b177
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"
12 #include "general-script-def.hh"
14 Script_engraver::Script_engraver()
16 do_post_move_processing();
19 bool
20 Script_engraver::do_try_request (Request *r_l)
22 if (!r_l->musical() || ! r_l->musical ()->musicalscript ())
23 return false ;
25 for (int i=0; i < script_req_l_arr_.size(); i++)
27 if (r_l->equal_b (script_req_l_arr_[i]))
28 return true;
30 script_req_l_arr_.push (r_l->script());
32 return true;
35 void
36 Script_engraver::do_process_requests()
38 if (script_p_arr_.size ())
39 return ;
41 for (int i=0; i < script_req_l_arr_.size(); i++)
43 Script_req* l=script_req_l_arr_[i];
44 Script *p =new Script;
45 p->dir_ = l->dir_;
46 p->specs_l_ = l->scriptdef_p_;
47 script_p_arr_.push (p);
48 announce_element (Score_elem_info (p, l));
52 void
53 Script_engraver::do_pre_move_processing()
55 Staff_symbol* s_l = get_staff_info().staff_sym_l_;
56 for (int i=0; i < script_p_arr_.size(); i++)
58 Script*script_p = script_p_arr_[i];
59 if (!script_p->specs_l_->inside_b())
60 script_p->add_support (s_l);
62 typeset_element (script_p);
64 script_p_arr_.clear();
67 void
68 Script_engraver::do_post_move_processing()
70 script_req_l_arr_.clear();
74 IMPLEMENT_IS_TYPE_B1(Script_engraver,Engraver);
75 ADD_THIS_TRANSLATOR(Script_engraver);