lilypond-1.1.31
[lilypond.git] / src / script-reg.cc
blob6cfba0f397b41fafd158b57419b21b569263cc06
1 /*
2 script-reg.cc -- implement Script_register
4 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
5 */
7 #include "script-reg.hh"
8 #include "script.hh"
9 #include "musicalrequest.hh"
10 #include "complex-walker.hh"
11 #include "stem.hh"
13 Script_register::Script_register()
15 script_p_ = 0;
16 post_move_processing();
19 bool
20 Script_register::try_request(Request *r_l)
22 if (!r_l->script())
23 return false ;
25 if (script_req_l_
26 && Script_req::compare(*script_req_l_, *r_l->script()))
28 return false;
30 script_req_l_ = r_l->script();
32 return true;
35 void
36 Script_register::process_requests()
38 if (script_req_l_) {
39 script_p_ = new Script(script_req_l_, 10);
40 announce_element(
41 Staff_elem_info(script_p_, script_req_l_));
45 void
46 Script_register::acknowledge_element(Staff_elem_info info)
48 if (!script_p_)
49 return;
50 if (info.elem_p_->name() == Stem::static_name())
51 script_p_->set_stem((Stem*)info.elem_p_);
52 else if (info.req_l_->rhythmic())
53 script_p_->set_support(info.elem_p_->item());
56 void
57 Script_register::pre_move_processing()
59 if (script_p_){
60 script_p_->dir = dir_i_;
61 typeset_element(script_p_);
62 script_p_ = 0;
65 void
66 Script_register::post_move_processing()
68 script_req_l_ = 0;
71 void
72 Script_register::set_feature(Features i)
74 if (i.direction_i_|| i.initialiser_b_)
75 dir_i_ = i.direction_i_;