]> git.donarmstrong.com Git - lilypond.git/blob - lily/dots-engraver.cc
Run grand-replace (issue 3765)
[lilypond.git] / lily / dots-engraver.cc
1 /*
2   This file is part of LilyPond, the GNU music typesetter.
3
4   Copyright (C) 2006--2014 Han-Wen Nienhuys <hanwen@lilypond.org>
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 "engraver.hh"
21 #include "duration.hh"
22 #include "item.hh"
23 #include "rhythmic-head.hh"
24 #include "stream-event.hh"
25
26 #include "translator.icc"
27
28 class Dots_engraver : public Engraver
29 {
30   DECLARE_ACKNOWLEDGER (rhythmic_head);
31   TRANSLATOR_DECLARATIONS (Dots_engraver);
32 };
33
34 Dots_engraver::Dots_engraver ()
35 {
36 }
37
38 void
39 Dots_engraver::acknowledge_rhythmic_head (Grob_info gi)
40 {
41   Stream_event *cause = gi.event_cause ();
42   if (!cause)
43     return;
44
45   Grob *note = gi.grob ();
46   if (unsmob_grob (note->get_object ("dot")))
47     return;
48
49   Duration *dur = unsmob_duration (cause->get_property ("duration"));
50   if (dur && dur->dot_count ())
51     {
52       Item *d = make_item ("Dots", note->self_scm ());
53       Rhythmic_head::set_dots (note, d);
54
55       d->set_parent (note, Y_AXIS);
56     }
57 }
58
59 ADD_ACKNOWLEDGER (Dots_engraver, rhythmic_head);
60
61 ADD_TRANSLATOR (Dots_engraver,
62                 "Create @ref{Dots} objects for"
63                 " @ref{rhythmic-head-interface}s.",
64
65                 /* create */
66                 "Dots ",
67
68                 /* read */
69                 "",
70
71                 /* write */
72                 ""
73                );