* python/lilylib.py (setup_temp): temporary directories are mode 700.
[lilypond.git] / lily / lyric-engraver.cc
blobff3ce86c3aa607a4e8cbf6ba8aeae09600331a2f
1 /*
2 lyric-engraver.cc -- implement Lyric_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2003 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 Jan Nieuwenhuizen <janneke@gnu.org>
8 */
10 #include "engraver.hh"
11 #include "event.hh"
12 #include "item.hh"
13 #include "paper-def.hh"
14 #include "font-metric.hh"
15 #include "side-position-interface.hh"
17 /**
18 Generate texts for lyric syllables. We only do one lyric at a time.
19 Multiple copies of this engraver should be used to do multiple voices.
21 class Lyric_engraver : public Engraver
23 protected:
24 virtual void stop_translation_timestep ();
25 virtual bool try_music (Music *);
26 virtual void process_acknowledged_grobs ();
27 virtual void start_translation_timestep ();
29 public:
30 TRANSLATOR_DECLARATIONS(Lyric_engraver);
31 private:
32 Music * req_;
33 Item* text_;
39 Lyric_engraver::Lyric_engraver ()
41 text_ =0;
42 req_ =0;
45 bool
46 Lyric_engraver::try_music (Music*r)
48 if (r->is_mus_type ("lyric-event"))
50 if (req_)
51 return false;
52 req_ =r;
53 return true;
55 return false;
58 void
59 Lyric_engraver::process_acknowledged_grobs ()
61 if (req_)
63 text_= new Item (get_property ("LyricText"));
65 text_->set_grob_property ("text", req_->get_mus_property ("text"));
68 We can't reach the notehead where we're centered from here. So
69 we kludge.
71 (UGH UGH, pulled amount of space out of thin air)
74 text_->translate_axis (0.66, X_AXIS);
76 announce_grob(text_, req_->self_scm());
77 req_ = 0;
81 void
82 Lyric_engraver::stop_translation_timestep ()
84 if (text_)
86 typeset_grob (text_);
87 text_ =0;
91 void
92 Lyric_engraver::start_translation_timestep ()
94 req_ =0;
98 ENTER_DESCRIPTION(Lyric_engraver,
99 /* descr */ "",
100 /* creats*/ "",
101 /* accepts */ "lyric-event",
102 /* acks */ "",
103 /* reads */ "",
104 /* write */ "");