]> git.donarmstrong.com Git - lilypond.git/blob - lily/lyric-engraver.cc
release: 1.0.1
[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--1998 Han-Wen Nienhuys <hanwen@cs.uu.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 #include "main.hh"
16
17 Lyric_engraver::Lyric_engraver()
18 {
19   lreq_l_ =0;
20   lyric_item_p_ =0;
21 }
22
23 bool
24 Lyric_engraver::do_try_request (Request*r)
25 {
26   Musical_req * m =r->access_Musical_req ();
27   if (!m || ! m->access_Lyric_req ()) 
28     return false;
29   lreq_l_ = m->access_Lyric_req ();
30
31   return true;
32 }
33
34 void
35 Lyric_engraver::do_process_requests()
36 {
37   if (lreq_l_) 
38     {
39       Text_def *td_p = new Text_def;
40       td_p->text_str_ = lreq_l_->text_str_;
41       td_p->align_dir_ = LEFT;
42       Scalar style = get_property ("textstyle");
43       if (style.length_i ())
44         {
45           td_p->style_str_ = style;
46         }
47       
48       lyric_item_p_ =  new Text_item (td_p);
49
50       lyric_item_p_->dir_ = DOWN;
51       lyric_item_p_->fat_b_ = true;
52       announce_element (Score_element_info (lyric_item_p_, lreq_l_));
53     }
54 }
55
56 void
57 Lyric_engraver::do_post_move_processing()
58 {
59   lreq_l_ =0;
60 }
61
62 void
63 Lyric_engraver::do_pre_move_processing()
64 {
65   if (lyric_item_p_)
66     {
67       typeset_element (lyric_item_p_);
68       lyric_item_p_ =0;
69     }
70 }
71
72
73 IMPLEMENT_IS_TYPE_B1(Lyric_engraver,Engraver);
74 ADD_THIS_TRANSLATOR(Lyric_engraver);