]> git.donarmstrong.com Git - lilypond.git/blob - lily/lyric-grav.cc
85e8e630fd14e4401d0d535374ca9fb7966c0d95
[lilypond.git] / lily / lyric-grav.cc
1 /*
2   lyric-engraver.cc -- implement Lyric_engraver
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
8
9 #include "lyric-engraver.hh"
10 #include "musical-request.hh"
11 #include "text-item.hh"
12 #include "paper-def.hh"
13 #include "lookup.hh"
14 #include "paper-def.hh"
15
16 Lyric_engraver::Lyric_engraver()
17 {
18     lreq_l_ =0;
19     lyric_item_p_ =0;
20 }
21
22 bool
23 Lyric_engraver::do_try_request(Request*r)
24 {
25     Musical_req * m =r->musical();
26     if (!m || ! m->lreq_l()) 
27         return false;
28     lreq_l_ = m->lreq_l();
29
30     return true;
31 }
32
33 void
34 Lyric_engraver::do_process_requests()
35 {
36     if ( lreq_l_ ) {  
37         lyric_item_p_ =  new Text_item(lreq_l_->tdef_p_ );
38
39         lyric_item_p_->translate_x( paper()->note_width()/2 );
40         lyric_item_p_->dir_i_ = -1;
41         lyric_item_p_->fat_b_ = true;
42         announce_element( Score_elem_info( lyric_item_p_, lreq_l_));
43     }
44 }
45
46 void
47 Lyric_engraver::do_post_move_processing()
48 {
49     lreq_l_ =0;
50 }
51
52 void
53 Lyric_engraver::do_pre_move_processing()
54 {
55     if ( lyric_item_p_ ){
56         typeset_element( lyric_item_p_);
57         lyric_item_p_ =0;
58     }
59 }
60
61
62 IMPLEMENT_IS_TYPE_B1(Lyric_engraver,Engraver);
63 ADD_THIS_ENGRAVER(Lyric_engraver);