]> git.donarmstrong.com Git - lilypond.git/blob - lily/lyric-engraver.cc
patch::: 1.3.76.gp1
[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--2000 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 "item.hh"
13 #include "paper-def.hh"
14 #include "lookup.hh"
15 #include "side-position-interface.hh"
16
17 ADD_THIS_TRANSLATOR (Lyric_engraver);
18
19
20 Lyric_engraver::Lyric_engraver()
21 {
22   text_p_ =0;
23   req_l_ =0;
24 }
25
26 bool
27 Lyric_engraver::do_try_music (Music*r)
28 {
29   if (Lyric_req* l = dynamic_cast <Lyric_req *> (r))
30     {
31       if (req_l_)
32         return false;
33       req_l_ =l;
34       return true;
35     }
36   return false;
37 }
38
39 void
40 Lyric_engraver::do_process_music()
41 {
42   if (req_l_)
43     {
44       text_p_=  new Item (get_property ("basicLyricTextProperties"));
45       
46       text_p_->set_elt_property ("text",
47 //                               ly_str02scm   ((req_l_->text_str_ + " ").ch_C ()));
48                                  ly_str02scm   ((req_l_->text_str_).ch_C ()));
49
50       text_p_->add_offset_callback (&Side_position::aligned_on_self,X_AXIS);
51       /*
52         We can't reach the notehead where we're centered from here. So
53         we kludge.
54       */
55       text_p_->translate_axis (paper_l()->get_var ("quartwidth")/2, X_AXIS);
56       
57       announce_element (text_p_, req_l_);
58     }
59 }
60
61 void
62 Lyric_engraver::do_pre_move_processing()
63 {
64   if (text_p_)
65     {
66       typeset_element (text_p_);
67       text_p_ =0;
68     }
69 }
70
71 void
72 Lyric_engraver::do_post_move_processing ()
73 {
74   req_l_ =0;
75 }
76
77