]> git.donarmstrong.com Git - lilypond.git/blob - lily/breathing-sign-engraver.cc
Issue 4814: grob.cc segfaults with gcc6
[lilypond.git] / lily / breathing-sign-engraver.cc
1 /*
2   This file is part of LilyPond, the GNU music typesetter.
3
4   Copyright (C) 1999--2015 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   void listen_breathing (Stream_event *);
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 void
55 Breathing_sign_engraver::listen_breathing (Stream_event *ev)
56 {
57   ASSIGN_EVENT_ONCE (breathing_sign_event_, ev);
58 }
59
60 void
61 Breathing_sign_engraver::process_music ()
62 {
63   if (breathing_sign_event_)
64     {
65       breathing_sign_ = make_item ("BreathingSign", breathing_sign_event_->self_scm ());
66     }
67 }
68
69 void
70 Breathing_sign_engraver::stop_translation_timestep ()
71 {
72   breathing_sign_ = 0;
73   breathing_sign_event_ = 0;
74 }
75
76 void
77 Breathing_sign_engraver::boot ()
78 {
79   ADD_LISTENER (Breathing_sign_engraver, breathing);
80 }
81
82 ADD_TRANSLATOR (Breathing_sign_engraver,
83                 /* doc */
84                 "Create a breathing sign.",
85
86                 /* create */
87                 "BreathingSign ",
88
89                 /* read */
90                 "",
91
92                 /* write */
93                 ""
94                );