summaryrefslogtreecommitdiff
path: root/lily/text-reg.cc
blob: 5c61f6179dcc97e0451ae291efaec10b29fa1705 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
  text-reg.cc -- implement Text_register

  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
*/

#include "musical-request.hh"
#include "text-reg.hh"
#include "text-item.hh"

Text_register::Text_register()
{
    text_p_ = 0;
    set_feature(Features::dir(0));
    post_move_processing();
}

bool
Text_register::try_request(Request*req_l)
{
    if (!req_l->text())
	return false;
    if (text_req_l_ &&
	Text_req::compare(*req_l->text(), *text_req_l_))

	return false;

    text_req_l_ = req_l->text();
    return true;
}

void
Text_register::process_requests()
{
    
    if (text_req_l_) {
	text_p_ = new Text_item(text_req_l_, 10); // UGH
	announce_element(Staff_elem_info(text_p_, text_req_l_));
    }
}
void
Text_register::pre_move_processing()
{
    if (text_p_) {
	text_p_->dir_i_ = dir_i_;
	typeset_element(text_p_);
	text_p_ = 0;
    }
}
void
Text_register::set_feature(Features i)
{
    dir_i_ = i.direction_i_;
}
void
Text_register::post_move_processing()
{
    text_req_l_ = 0;
}
IMPLEMENT_STATIC_NAME(Text_register);
ADD_THIS_REGISTER(Text_register);