]> git.donarmstrong.com Git - lilypond.git/blob - src/textreg.cc
partial: 0.0.38.hanjan
[lilypond.git] / src / textreg.cc
1 /*
2   textreg.cc -- implement Text_register
3
4   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
5 */
6
7 #include "musicalrequest.hh"
8 #include "textreg.hh"
9 #include "textitem.hh"
10
11 Text_register::Text_register(Complex_walker*w)
12     : Request_register(w)
13 {
14     text_p_ = 0;
15     set_dir(0);
16 }
17
18 bool
19 Text_register::try_request(Request*req_l)
20 {
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()))
25
26         return false;
27
28     accepted_req_arr_.push(req_l);
29     return true;
30 }
31
32 void
33 Text_register::process_request()
34 {
35     
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));
39     }
40 }
41 void
42 Text_register::do_pre_move_process()
43 {
44     if (text_p_) {
45         text_p_->dir_i_ = dir_i_;
46         typeset_element(text_p_);
47         text_p_ = 0;
48     }
49 }
50 void
51 Text_register::set_dir(int i)
52 {
53     dir_i_ = i;
54 }