]> git.donarmstrong.com Git - lilypond.git/blob - lily/dots-engraver.cc
Merge branch 'master' into lilypond/translation
[lilypond.git] / lily / dots-engraver.cc
1 /*
2   This file is part of LilyPond, the GNU music typesetter.
3
4   Copyright (C) 2006--2011 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
29 class Dots_engraver : public Engraver 
30 {
31   DECLARE_ACKNOWLEDGER (rhythmic_head);
32   TRANSLATOR_DECLARATIONS (Dots_engraver);
33 };
34
35 Dots_engraver::Dots_engraver ()
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 ADD_ACKNOWLEDGER (Dots_engraver, rhythmic_head);
62
63 ADD_TRANSLATOR (Dots_engraver,
64                 "Create @ref{Dots} objects for"
65                 " @ref{rhythmic-head-interface}s.",
66
67                 /* create */
68                 "Dots ",
69
70                 /* read */
71                 "",
72                
73                 /* write */
74                 ""
75                 );