]> git.donarmstrong.com Git - lilypond.git/blob - lily/lyric-engraver.cc
patch::: 1.3.18.jcn1
[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 "text-item.hh"
13 #include "paper-def.hh"
14 #include "lookup.hh"
15
16 ADD_THIS_TRANSLATOR (Lyric_engraver);
17
18 Lyric_engraver::Lyric_engraver()
19 {
20   text_p_ =0;
21   req_l_ =0;
22 }
23
24 bool
25 Lyric_engraver::do_try_music (Music*r)
26 {
27   if (Lyric_req* l = dynamic_cast <Lyric_req *> (r))
28     {
29       if (req_l_)
30         return false;
31       req_l_ =l;
32       return true;
33     }
34   return false;
35 }
36
37 void
38 Lyric_engraver::do_process_requests()
39 {
40   if (req_l_)
41     {
42       text_p_=  new Text_item;
43       
44       text_p_->set_elt_property ("text",
45                                  ly_str02scm   ((req_l_->text_str_ + " ").ch_C ()));
46       text_p_->set_elt_property ("non-rhythmic", SCM_BOOL_T);
47       announce_element (Score_element_info (text_p_, req_l_));
48     }
49 }
50
51 void
52 Lyric_engraver::do_pre_move_processing()
53 {
54   if (text_p_)
55     {
56       typeset_element (text_p_);
57       text_p_ =0;
58     }
59 }
60
61 void
62 Lyric_engraver::do_post_move_processing ()
63 {
64   req_l_ =0;
65 }
66
67