]> git.donarmstrong.com Git - lilypond.git/blob - lily/dots-engraver.cc
83eef1c05dbdc8a29049c8dfce2a672afa1c0f9a
[lilypond.git] / lily / dots-engraver.cc
1 /* 
2   dots-engraver.cc -- implement Dots_engraver
3   
4   source file of the GNU LilyPond music typesetter
5   
6   (c) 2006--2007 Han-Wen Nienhuys <hanwen@lilypond.org>
7   
8 */
9
10 #include "engraver.hh"
11 #include "duration.hh"
12 #include "item.hh"
13 #include "rhythmic-head.hh"
14 #include "stream-event.hh"
15
16 #include "translator.icc"
17
18
19 class Dots_engraver : public Engraver 
20 {
21   DECLARE_ACKNOWLEDGER (rhythmic_head);
22   TRANSLATOR_DECLARATIONS (Dots_engraver);
23 };
24
25 Dots_engraver::Dots_engraver ()
26 {
27 }
28
29 void
30 Dots_engraver::acknowledge_rhythmic_head (Grob_info gi)
31 {
32   Stream_event *cause = gi.event_cause ();
33   if (!cause)
34     return;
35
36   Grob *note = gi.grob ();
37   if (unsmob_grob (note->get_object ("dot")))
38     return;
39   
40   Duration *dur = unsmob_duration (cause->get_property ("duration"));
41   if (dur && dur->dot_count ())
42     {
43       Item *d = make_item ("Dots", note->self_scm ());
44       Rhythmic_head::set_dots (note, d);
45
46       d->set_property ("dot-count", scm_from_int (dur->dot_count ()));
47       d->set_parent (note, Y_AXIS);
48     }
49 }
50
51
52 ADD_ACKNOWLEDGER (Dots_engraver, rhythmic_head);
53
54 ADD_TRANSLATOR (Dots_engraver,
55                 "Create @ref{Dots} objects for"
56                 " @ref{rhythmic-head-interface}s.",
57
58                 /* create */
59                 "Dots ",
60
61                 /* read */
62                 "",
63                
64                 /* write */
65                 ""
66                 );