]> git.donarmstrong.com Git - lilypond.git/blob - lily/breathing-sign-engraver.cc
Merge branch 'master' into lilypond/translation
[lilypond.git] / lily / breathing-sign-engraver.cc
1 /*
2   breathing_sign-engraver.cc -- implement Breathing_sign_engraver
3
4   (c) 1999--2007 Michael Krause
5
6   written for the GNU LilyPond music typesetter
7
8   TODO:
9
10   . Cancel any beams running through the breathing sign
11   ([e8 \breathe f e f] should become [e8] \breathe [f e f])
12   . Spacing is not yet completely pretty
13 */
14
15 #include "breathing-sign.hh"
16 #include "engraver.hh"
17 #include "item.hh"
18 #include "stream-event.hh"
19
20 #include "translator.icc"
21
22 class Breathing_sign_engraver : public Engraver
23 {
24 public:
25   TRANSLATOR_DECLARATIONS (Breathing_sign_engraver);
26
27 protected:
28   void process_music ();
29   void stop_translation_timestep ();
30
31   DECLARE_TRANSLATOR_LISTENER (breathing);
32 private:
33   Stream_event *breathing_sign_event_;
34   Grob *breathing_sign_;
35 };
36
37 Breathing_sign_engraver::Breathing_sign_engraver ()
38 {
39   breathing_sign_ = 0;
40   breathing_sign_event_ = 0;
41 }
42
43 IMPLEMENT_TRANSLATOR_LISTENER (Breathing_sign_engraver, breathing);
44 void
45 Breathing_sign_engraver::listen_breathing (Stream_event *ev)
46 {
47   ASSIGN_EVENT_ONCE (breathing_sign_event_, ev);
48 }
49
50 void
51 Breathing_sign_engraver::process_music ()
52 {
53   if (breathing_sign_event_)
54     {
55       breathing_sign_ = make_item ("BreathingSign", breathing_sign_event_->self_scm ());
56     }
57 }
58
59 void
60 Breathing_sign_engraver::stop_translation_timestep ()
61 {
62   breathing_sign_ = 0;
63   breathing_sign_event_ = 0;
64 }
65
66 ADD_TRANSLATOR (Breathing_sign_engraver,
67                 /* doc */
68                 "Create a breathing sign.",
69
70                 /* create */
71                 "BreathingSign ",
72
73                 /* read */
74                 "",
75
76                 /* write */
77                 ""
78                 );