]> git.donarmstrong.com Git - lilypond.git/blob - lily/lyric-grav.cc
release: 0.0.76
[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
15 Lyric_engraver::Lyric_engraver()
16 {
17     lreq_l_ =0;
18     lyric_item_p_ =0;
19 }
20
21 bool
22 Lyric_engraver::do_try_request(Request*r)
23 {
24     Musical_req * m =r->musical();
25     if (!m || ! m->lreq_l()) 
26         return false;
27     lreq_l_ = m->lreq_l();
28
29     return true;
30 }
31
32 void
33 Lyric_engraver::do_process_requests()
34 {
35     if ( lreq_l_ ) {  
36         lyric_item_p_ =  new Text_item(lreq_l_->tdef_p_ );
37         lyric_item_p_->dir_i_ = -1;
38         lyric_item_p_->fat_b_ = true;
39         announce_element( Score_elem_info( lyric_item_p_, lreq_l_));
40     }
41 }
42
43 void
44 Lyric_engraver::do_post_move_processing()
45 {
46     lreq_l_ =0;
47 }
48
49 void
50 Lyric_engraver::do_pre_move_processing()
51 {
52     if ( lyric_item_p_ ){
53         typeset_element( lyric_item_p_);
54         lyric_item_p_ =0;
55     }
56 }
57
58 IMPLEMENT_STATIC_NAME(Lyric_engraver);
59 IMPLEMENT_IS_TYPE_B1(Lyric_engraver,Engraver);
60 ADD_THIS_ENGRAVER(Lyric_engraver);