Add display method for \bendAfter.
[lilypond/mpolesky.git] / lily / slur-performer.cc
blob114375dc894ee364a83a08b676c5becb238d8c3d
1 /*
2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 1996--2010 Jan Nieuwenhuizen <janneke@gnu.org>
6 LilyPond is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 LilyPond is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
20 #include "performer.hh"
21 #include "audio-item.hh"
22 #include "audio-column.hh"
23 #include "global-context.hh"
24 #include "stream-event.hh"
25 #include "warn.hh"
27 #include "translator.icc"
30 this is C&P from beam_performer.
33 class Slur_performer : public Performer
35 public:
36 TRANSLATOR_DECLARATIONS (Slur_performer);
38 protected:
39 void start_translation_timestep ();
40 void process_music ();
41 void set_melisma (bool);
43 DECLARE_TRANSLATOR_LISTENER (slur);
44 private:
45 Stream_event *start_ev_;
46 Stream_event *now_stop_ev_;
47 bool slur_;
50 Slur_performer::Slur_performer ()
52 slur_ = false;
53 start_ev_ = 0;
54 now_stop_ev_ = 0;
57 void
58 Slur_performer::process_music ()
60 if (now_stop_ev_)
62 slur_ = false;
63 set_melisma (false);
66 if (start_ev_)
68 slur_ = true;
69 set_melisma (true);
73 void
74 Slur_performer::set_melisma (bool ml)
76 context ()->set_property ("slurMelismaBusy", ml ? SCM_BOOL_T : SCM_BOOL_F);
79 void
80 Slur_performer::start_translation_timestep ()
82 start_ev_ = 0;
83 now_stop_ev_ = 0;
86 IMPLEMENT_TRANSLATOR_LISTENER (Slur_performer, slur);
87 void
88 Slur_performer::listen_slur (Stream_event *ev)
90 Direction d = to_dir (ev->get_property ("span-direction"));
92 if (d == START)
93 start_ev_ = ev;
94 else if (d == STOP)
95 now_stop_ev_ = ev;
98 ADD_TRANSLATOR (Slur_performer,
99 /* doc */
102 /* create */
105 /* read */
108 /* write */