lilypond-1.1.7
[lilypond.git] / src / textreg.cc
blob7e6d59e2cba2c97bcd9fc4a5971e1e2a198f3af9
1 /*
2 textreg.cc -- implement Text_register
4 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
5 */
7 #include "musicalrequest.hh"
8 #include "textreg.hh"
9 #include "textitem.hh"
11 Text_register::Text_register(Complex_walker*w)
12 : Request_register(w)
14 text_p_ = 0;
15 set_dir(0);
18 bool
19 Text_register::try_request(Request*req_l)
21 if (!req_l->text())
22 return false;
23 if (accepted_req_arr_.size() &&
24 Text_req::compare(*req_l->text(), *accepted_req_arr_[0]->text()))
26 return false;
28 accepted_req_arr_.push(req_l);
29 return true;
32 void
33 Text_register::process_request()
36 if (accepted_req_arr_.size()) {
37 text_p_ = new Text_item(accepted_req_arr_[0]->text(), 10);
38 announce_element(Staff_elem_info(text_p_, accepted_req_arr_[0], this));
41 void
42 Text_register::do_pre_move_process()
44 if (text_p_) {
45 text_p_->dir_i_ = dir_i_;
46 typeset_element(text_p_);
47 text_p_ = 0;
50 void
51 Text_register::set_dir(int i)
53 dir_i_ = i;