]> git.donarmstrong.com Git - lilypond.git/blob - lily/lyric-register.cc
release: 0.0.57
[lilypond.git] / lily / lyric-register.cc
1 /*
2   lyric-register.cc -- implement Lyric_register
3
4   source file of the LilyPond music typesetter
5
6   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
8
9 #include "staff-walker.hh"
10 #include "lyric-register.hh"
11 #include "musical-request.hh"
12 #include "text-item.hh"
13 #include "paper-def.hh"
14 #include "lookup.hh"
15
16 Lyric_register::Lyric_register()
17 {
18 }
19
20 bool
21 Lyric_register::try_request(Request*r)
22 {
23     Musical_req * m =r->musical();
24     if (!m || ! m->lreq_l()) 
25         return false;
26     lreq_arr_.push(m->lreq_l());
27
28     return true;
29 }
30
31 void
32 Lyric_register::process_requests()
33 {
34     Text_item * last_item_l =0;
35     for (int i=0; i < lreq_arr_.size(); i++) {
36         Text_item *lp = new Text_item(lreq_arr_[i]->tdef_p_ );
37         lp->dir_i_ = -1;
38         lp->fat_b_ = true;
39         if (last_item_l)
40             lp->add_support(last_item_l);
41         last_item_l = lp;
42         typeset_element(lp);
43     }
44     get_staff_info().walk_l_->allow_break();
45 }
46
47 void
48 Lyric_register::post_move_processing()
49 {
50     lreq_arr_.set_size(0);
51 }
52
53
54 bool
55 Lyric_register::acceptable_request_b(Request*r)
56 {
57     Musical_req * m =r->musical();
58     return (!m || ! m->lreq_l()) ;
59 }
60
61 IMPLEMENT_STATIC_NAME(Lyric_register);
62 ADD_THIS_REGISTER(Lyric_register);