]> git.donarmstrong.com Git - lilypond.git/blob - lily/lyric-engraver.cc
f5807666da8b71a4024544a88de1c521969427ee
[lilypond.git] / lily / lyric-engraver.cc
1 /*
2   lyric-engraver.cc -- implement Lyric_engraver
3
4   source file of the GNU LilyPond music typesetter
5
6   (c)  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7   Jan Nieuwenhuizen <janneke@gnu.org>
8 */
9
10 #include "lyric-engraver.hh"
11 #include "musical-request.hh"
12 #include "g-text-item.hh"
13 #include "paper-def.hh"
14 #include "lookup.hh"
15
16 ADD_THIS_TRANSLATOR (Lyric_engraver);
17
18
19 Lyric_engraver::Lyric_engraver()
20 {
21   text_p_ =0;
22   req_l_ =0;
23 }
24
25 bool
26 Lyric_engraver::do_try_music (Music*r)
27 {
28   if (Lyric_req* l = dynamic_cast <Lyric_req *> (r))
29     {
30       if (req_l_)
31         return false;
32       req_l_ =l;
33       return true;
34     }
35   return false;
36 }
37
38 void
39 Lyric_engraver::do_process_requests()
40 {
41   if (req_l_)
42     {
43       text_p_=  new G_text_item;
44       text_p_->text_str_ = req_l_->text_str_;
45
46       Scalar style = get_property ("textStyle", 0);
47       if (style.length_i ())
48         text_p_->style_str_ = style;
49       
50       announce_element (Score_element_info (text_p_, req_l_));
51     }
52 }
53
54 void
55 Lyric_engraver::do_pre_move_processing()
56 {
57   if (text_p_)
58     {
59       typeset_element (text_p_);
60       text_p_ =0;
61     }
62 }
63
64 void
65 Lyric_engraver::do_post_move_processing ()
66 {
67   req_l_ =0;
68 }
69