]> git.donarmstrong.com Git - lilypond.git/blob - lily/breathing-sign-engraver.cc
Run grand-replace (issue 3765)
[lilypond.git] / lily / breathing-sign-engraver.cc
1 /*
2   This file is part of LilyPond, the GNU music typesetter.
3
4   Copyright (C) 1999--2014 Michael Krause
5
6   written for the GNU LilyPond music typesetter
7
8   TODO:
9
10   . Spacing is not yet completely pretty
11
12   LilyPond is free software: you can redistribute it and/or modify
13   it under the terms of the GNU General Public License as published by
14   the Free Software Foundation, either version 3 of the License, or
15   (at your option) any later version.
16
17   LilyPond is distributed in the hope that it will be useful,
18   but WITHOUT ANY WARRANTY; without even the implied warranty of
19   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20   GNU General Public License for more details.
21
22   You should have received a copy of the GNU General Public License
23   along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
24 */
25
26 #include "breathing-sign.hh"
27 #include "engraver.hh"
28 #include "item.hh"
29 #include "stream-event.hh"
30
31 #include "translator.icc"
32
33 class Breathing_sign_engraver : public Engraver
34 {
35 public:
36   TRANSLATOR_DECLARATIONS (Breathing_sign_engraver);
37
38 protected:
39   void process_music ();
40   void stop_translation_timestep ();
41
42   DECLARE_TRANSLATOR_LISTENER (breathing);
43 private:
44   Stream_event *breathing_sign_event_;
45   Grob *breathing_sign_;
46 };
47
48 Breathing_sign_engraver::Breathing_sign_engraver ()
49 {
50   breathing_sign_ = 0;
51   breathing_sign_event_ = 0;
52 }
53
54 IMPLEMENT_TRANSLATOR_LISTENER (Breathing_sign_engraver, breathing);
55 void
56 Breathing_sign_engraver::listen_breathing (Stream_event *ev)
57 {
58   ASSIGN_EVENT_ONCE (breathing_sign_event_, ev);
59 }
60
61 void
62 Breathing_sign_engraver::process_music ()
63 {
64   if (breathing_sign_event_)
65     {
66       breathing_sign_ = make_item ("BreathingSign", breathing_sign_event_->self_scm ());
67     }
68 }
69
70 void
71 Breathing_sign_engraver::stop_translation_timestep ()
72 {
73   breathing_sign_ = 0;
74   breathing_sign_event_ = 0;
75 }
76
77 ADD_TRANSLATOR (Breathing_sign_engraver,
78                 /* doc */
79                 "Create a breathing sign.",
80
81                 /* create */
82                 "BreathingSign ",
83
84                 /* read */
85                 "",
86
87                 /* write */
88                 ""
89                );