]> git.donarmstrong.com Git - lilypond.git/blob - lily/slur-engraver.cc
Issue 4903/3: Restructure slur engravers
[lilypond.git] / lily / slur-engraver.cc
1 /*
2   This file is part of LilyPond, the GNU music typesetter.
3
4   Copyright (C) 1997--2015 Han-Wen Nienhuys <hanwen@xs4all.nl>
5
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.
10
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.
15
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/>.
18 */
19
20 #include "context.hh"
21 #include "slur-proto-engraver.hh"
22
23 #include "translator.icc"
24
25 class Slur_engraver : public Slur_proto_engraver
26 {
27   virtual SCM event_symbol () const;
28   virtual bool double_property () const;
29   virtual SCM grob_symbol () const;
30   virtual const char * object_name () const;
31   virtual void set_melisma (bool);
32
33 public:
34   TRANSLATOR_DECLARATIONS (Slur_engraver);
35   TRANSLATOR_INHERIT (Slur_proto_engraver);
36 };
37
38 SCM
39 Slur_engraver::event_symbol () const
40 {
41   return ly_symbol2scm ("slur-event");
42 }
43
44 bool
45 Slur_engraver::double_property () const
46 {
47   return to_boolean (get_property ("doubleSlurs"));
48 }
49
50 SCM
51 Slur_engraver::grob_symbol () const
52 {
53   return ly_symbol2scm ("Slur");
54 }
55
56 const char *
57 Slur_engraver::object_name () const
58 {
59   return "slur";
60 }
61
62 Slur_engraver::Slur_engraver ()
63 {
64 }
65
66 void
67 Slur_engraver::set_melisma (bool m)
68 {
69   context ()->set_property ("slurMelismaBusy", ly_bool2scm (m));
70 }
71
72 void
73 Slur_engraver::boot ()
74 {
75   ADD_LISTENER (Slur_engraver, slur);
76   ADD_LISTENER (Slur_engraver, note);
77   ADD_ACKNOWLEDGER (Slur_engraver, inline_accidental);
78   ADD_ACKNOWLEDGER (Slur_engraver, fingering);
79   ADD_ACKNOWLEDGER (Slur_engraver, note_column);
80   ADD_ACKNOWLEDGER (Slur_engraver, script);
81   ADD_ACKNOWLEDGER (Slur_engraver, text_script);
82   ADD_ACKNOWLEDGER (Slur_engraver, dots);
83   ADD_END_ACKNOWLEDGER (Slur_engraver, tie);
84   ADD_ACKNOWLEDGER (Slur_engraver, tuplet_number);
85 }
86
87 ADD_TRANSLATOR (Slur_engraver,
88                 /* doc */
89                 "Build slur grobs from slur events.",
90
91                 /* create */
92                 "Slur ",
93
94                 /* read */
95                 "slurMelismaBusy "
96                 "doubleSlurs ",
97
98                 /* write */
99                 ""
100                );