lilypond-0.1.35
[lilypond.git] / lily / text-grav.cc
blob4abff4f444709795bb68acea100190593e2fbb3d
1 /*
2 text-reg.cc -- implement Text_engraver
4 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
6 Obsolete.
7 */
8 #include "note-column.hh"
9 #include "musical-request.hh"
10 #include "text-grav.hh"
11 #include "text-item.hh"
13 Text_engraver::Text_engraver()
15 text_p_ = 0;
16 dir_i_ =0;
17 do_post_move_processing();
20 bool
21 Text_engraver::do_try_request (Request*req_l)
23 Musical_req *m = req_l->musical();
24 if (!m || ! m->text())
25 return false;
26 if (text_req_l_ && text_req_l_->equal_b (m))
27 return false;
29 text_req_l_ = m->text();
30 return true;
32 void
33 Text_engraver::acknowledge_element (Score_elem_info i)
35 if (text_p_ && i.elem_l_->name() == Note_column::static_name ())
37 text_p_->add_support (i.elem_l_);
40 void
41 Text_engraver::do_process_requests()
43 if (text_req_l_)
45 text_p_ = new Text_item (text_req_l_->tdef_p_, text_req_l_->dir_i_); // ugh
46 announce_element (Score_elem_info (text_p_, text_req_l_));
49 void
50 Text_engraver::do_pre_move_processing()
52 if (text_p_)
54 if (dir_i_ && !text_p_->dir_i_)
55 text_p_->dir_i_ = dir_i_;
56 Staff_symbol* s_l = get_staff_info().staff_sym_l_;
57 text_p_->set_staffsym (s_l);
58 typeset_element (text_p_);
60 text_p_ = 0;
63 void
64 Text_engraver::set_feature (Feature i)
66 if (i.type_ == "vdir")
67 dir_i_ = i.value_;
69 void
70 Text_engraver::do_post_move_processing()
72 text_req_l_ = 0;
75 IMPLEMENT_IS_TYPE_B1(Text_engraver,Engraver);
76 ADD_THIS_ENGRAVER(Text_engraver);