]> git.donarmstrong.com Git - lilypond.git/blob - lily/text-reg.cc
release: 0.0.71pre
[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   Obsolete.
7 */
8 #include "note-column.hh"
9 #include "musical-request.hh"
10 #include "text-reg.hh"
11 #include "text-item.hh"
12
13 Text_register::Text_register()
14 {
15     text_p_ = 0;
16     dir_i_ =0;
17     do_post_move_processing();
18 }
19
20 bool
21 Text_register::do_try_request(Request*req_l)
22 {
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_))
28
29         return false;
30
31     text_req_l_ = m->text();
32     return true;
33 }
34 void
35 Text_register::acknowledge_element(Score_elem_info i)
36 {
37     if (text_p_ && i.elem_l_->name() == Note_column::static_name()) {
38         text_p_->add_support(i.elem_l_);
39     }
40 }
41 void
42 Text_register::do_process_requests()
43 {
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_));
47     }
48 }
49 void
50 Text_register::do_pre_move_processing()
51 {
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_);
58             
59         text_p_ = 0;
60     }
61 }
62 void
63 Text_register::set_feature(Feature i)
64 {
65     if (i.type_ == "vdir")      
66         dir_i_ = i.value_;
67 }
68 void
69 Text_register::do_post_move_processing()
70 {
71     text_req_l_ = 0;
72 }
73 IMPLEMENT_STATIC_NAME(Text_register);
74 IMPLEMENT_IS_TYPE_B1(Text_register,Request_register);
75 ADD_THIS_REGISTER(Text_register);