lilypond-0.1.56
[lilypond.git] / lily / text-reg.cc
blobed793eeab8d2cd36d394d3c9540eaf6e5937892c
1 /*
2 text-reg.cc -- implement Text_register
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-reg.hh"
11 #include "text-item.hh"
13 Text_register::Text_register()
15 text_p_ = 0;
16 dir_i_ =0;
17 do_post_move_processing();
20 bool
21 Text_register::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_ &&
27 Text_req::compare(*m->text(), *text_req_l_))
29 return false;
31 text_req_l_ = m->text();
32 return true;
34 void
35 Text_register::acknowledge_element(Score_elem_info i)
37 if (text_p_ && i.elem_l_->name() == Note_column::static_name()) {
38 text_p_->add_support(i.elem_l_);
41 void
42 Text_register::do_process_requests()
44 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_register::do_pre_move_processing()
52 if (text_p_) {
53 if (dir_i_ && !text_p_->dir_i_)
54 text_p_->dir_i_ = dir_i_;
55 Staff_symbol* s_l = get_staff_info().staff_sym_l_;
56 text_p_->set_staffsym(s_l);
57 typeset_element(text_p_);
59 text_p_ = 0;
62 void
63 Text_register::set_feature(Feature i)
65 if (i.type_ == "vdir")
66 dir_i_ = i.value_;
68 void
69 Text_register::do_post_move_processing()
71 text_req_l_ = 0;
73 IMPLEMENT_STATIC_NAME(Text_register);
74 IMPLEMENT_IS_TYPE_B1(Text_register,Request_register);
75 ADD_THIS_REGISTER(Text_register);