]> git.donarmstrong.com Git - lilypond.git/blob - lily/lyric-grav.cc
release: 0.1.63
[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--1998 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 #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->musical();
27   if (!m || ! m->lreq_l()) 
28     return false;
29   lreq_l_ = m->lreq_l();
30
31   return true;
32 }
33
34 void
35 Lyric_engraver::do_process_requests()
36 {
37   if (lreq_l_) 
38     {
39       lyric_item_p_ =  new Text_item (lreq_l_->tdef_p_);
40
41       lyric_item_p_->translate_axis (paper()->note_width ()/2 , X_AXIS);
42       lyric_item_p_->dir_ = DOWN;
43       lyric_item_p_->fat_b_ = true;
44       announce_element (Score_elem_info (lyric_item_p_, lreq_l_));
45     }
46 }
47
48 void
49 Lyric_engraver::do_post_move_processing()
50 {
51   lreq_l_ =0;
52 }
53
54 void
55 Lyric_engraver::do_pre_move_processing()
56 {
57   if (lyric_item_p_)
58     {
59       /*
60         urg. should check-out deriving from staff/line spanner
61         */
62       if (experimental_features_global_b)
63         {
64           if (lyric_item_p_->tdef_p_->static_name () == Text_def::static_name ())
65             {
66               Text_def* t = (Text_def*)lyric_item_p_->tdef_p_;
67               t->text_str_ += "\\hrule 1mm 10mm 20mm";
68             }
69         }
70       typeset_element (lyric_item_p_);
71       lyric_item_p_ =0;
72     }
73 }
74
75
76 IMPLEMENT_IS_TYPE_B1(Lyric_engraver,Engraver);
77 ADD_THIS_TRANSLATOR(Lyric_engraver);