]> git.donarmstrong.com Git - lilypond.git/blob - lily/dots-engraver.cc
Web-ja: update introduction
[lilypond.git] / lily / dots-engraver.cc
1 /*
2   This file is part of LilyPond, the GNU music typesetter.
3
4   Copyright (C) 2006--2015 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   void acknowledge_rhythmic_head (Grob_info);
31   TRANSLATOR_DECLARATIONS (Dots_engraver);
32 };
33
34 Dots_engraver::Dots_engraver (Context *c)
35   : Engraver (c)
36 {
37 }
38
39 void
40 Dots_engraver::acknowledge_rhythmic_head (Grob_info gi)
41 {
42   Stream_event *cause = gi.event_cause ();
43   if (!cause)
44     return;
45
46   Grob *note = gi.grob ();
47   if (unsmob<Grob> (note->get_object ("dot")))
48     return;
49
50   Duration *dur = unsmob<Duration> (cause->get_property ("duration"));
51   if (dur && dur->dot_count ())
52     {
53       Item *d = make_item ("Dots", note->self_scm ());
54       Rhythmic_head::set_dots (note, d);
55
56       d->set_parent (note, Y_AXIS);
57     }
58 }
59
60
61 void
62 Dots_engraver::boot ()
63 {
64   ADD_ACKNOWLEDGER (Dots_engraver, rhythmic_head);
65 }
66
67 ADD_TRANSLATOR (Dots_engraver,
68                 "Create @ref{Dots} objects for"
69                 " @ref{rhythmic-head-interface}s.",
70
71                 /* create */
72                 "Dots ",
73
74                 /* read */
75                 "",
76
77                 /* write */
78                 ""
79                );