Nitpick: ly:spanner-bound grob name slur -> spanner.
[lilypond.git] / lily / slur-performer.cc
blob422f065fd261b0db60504472cee4688216d0c06e
1 /*
2 slur-performer.cc -- implement Slur_performer
4 source file of the GNU LilyPond music typesetter
6 (c) 1996--2009 Jan Nieuwenhuizen <janneke@gnu.org>
7 */
9 #include "performer.hh"
10 #include "audio-item.hh"
11 #include "audio-column.hh"
12 #include "global-context.hh"
13 #include "stream-event.hh"
14 #include "warn.hh"
16 #include "translator.icc"
19 this is C&P from beam_performer.
22 class Slur_performer : public Performer
24 public:
25 TRANSLATOR_DECLARATIONS (Slur_performer);
27 protected:
28 void start_translation_timestep ();
29 void process_music ();
30 void set_melisma (bool);
32 DECLARE_TRANSLATOR_LISTENER (slur);
33 private:
34 Stream_event *start_ev_;
35 Stream_event *now_stop_ev_;
36 bool slur_;
39 Slur_performer::Slur_performer ()
41 slur_ = false;
42 start_ev_ = 0;
43 now_stop_ev_ = 0;
46 void
47 Slur_performer::process_music ()
49 if (now_stop_ev_)
51 slur_ = false;
52 set_melisma (false);
55 if (start_ev_)
57 slur_ = true;
58 set_melisma (true);
62 void
63 Slur_performer::set_melisma (bool ml)
65 context ()->set_property ("slurMelismaBusy", ml ? SCM_BOOL_T : SCM_BOOL_F);
68 void
69 Slur_performer::start_translation_timestep ()
71 start_ev_ = 0;
72 now_stop_ev_ = 0;
75 IMPLEMENT_TRANSLATOR_LISTENER (Slur_performer, slur);
76 void
77 Slur_performer::listen_slur (Stream_event *ev)
79 Direction d = to_dir (ev->get_property ("span-direction"));
81 if (d == START)
82 start_ev_ = ev;
83 else if (d == STOP)
84 now_stop_ev_ = ev;
87 ADD_TRANSLATOR (Slur_performer,
88 /* doc */
89 "",
91 /* create */
92 "",
94 /* read */
95 "",
97 /* write */