]> git.donarmstrong.com Git - lilypond.git/blob - lily/text-reg.cc
release: 0.0.50
[lilypond.git] / lily / text-reg.cc
1 /*
2   text-reg.cc -- implement Text_register
3
4   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
5 */
6
7 #include "musical-request.hh"
8 #include "text-reg.hh"
9 #include "text-item.hh"
10
11 Text_register::Text_register()
12 {
13     text_p_ = 0;
14     set_feature(Features::dir(0));
15     post_move_processing();
16 }
17
18 bool
19 Text_register::try_request(Request*req_l)
20 {
21     if (!req_l->text())
22         return false;
23     if (text_req_l_ &&
24         Text_req::compare(*req_l->text(), *text_req_l_))
25
26         return false;
27
28     text_req_l_ = req_l->text();
29     return true;
30 }
31
32 void
33 Text_register::process_requests()
34 {
35     if (text_req_l_) {
36         text_p_ = new Text_item(text_req_l_); // UGH
37         announce_element(Staff_elem_info(text_p_, text_req_l_));
38     }
39 }
40 void
41 Text_register::pre_move_processing()
42 {
43     if (text_p_) {
44         text_p_->dir_i_ = dir_i_;
45         Staff_symbol* s_l = get_staff_info().staff_sym_l_;
46         text_p_->set_staffsym(s_l);
47         typeset_element(text_p_);
48             
49         text_p_ = 0;
50     }
51 }
52 void
53 Text_register::set_feature(Features i)
54 {
55     dir_i_ = i.direction_i_;
56 }
57 void
58 Text_register::post_move_processing()
59 {
60     text_req_l_ = 0;
61 }
62 IMPLEMENT_STATIC_NAME(Text_register);
63 ADD_THIS_REGISTER(Text_register);