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