Merge branch 'fret-diagram-details'
[lilypond/csorensen.git] / lily / dots-engraver.cc
blobbf0d67fd0b7c5ab3f42fb050ad12845c42353145
1 /*
2 dots-engraver.cc -- implement Dots_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2006--2007 Han-Wen Nienhuys <hanwen@lilypond.org>
8 */
10 #include "engraver.hh"
11 #include "duration.hh"
12 #include "item.hh"
13 #include "rhythmic-head.hh"
14 #include "stream-event.hh"
16 #include "translator.icc"
19 class Dots_engraver : public Engraver
21 DECLARE_ACKNOWLEDGER (rhythmic_head);
22 TRANSLATOR_DECLARATIONS (Dots_engraver);
25 Dots_engraver::Dots_engraver ()
29 void
30 Dots_engraver::acknowledge_rhythmic_head (Grob_info gi)
32 Stream_event *cause = gi.event_cause ();
33 if (!cause)
34 return;
36 Grob *note = gi.grob ();
37 if (unsmob_grob (note->get_object ("dot")))
38 return;
41 Duration *dur = unsmob_duration (cause->get_property ("duration"));
42 if (dur && dur->dot_count ())
44 Item *d = make_item ("Dots", note->self_scm ());
45 Rhythmic_head::set_dots (note, d);
47 d->set_property ("dot-count", scm_from_int (dur->dot_count ()));
48 d->set_parent (note, Y_AXIS);
53 ADD_ACKNOWLEDGER (Dots_engraver, rhythmic_head);
55 ADD_TRANSLATOR (Dots_engraver,
56 "Create @ref{Dots} objects for"
57 " @ref{rhythmic-head-interface}s.",
59 /* create */
60 "Dots ",
62 /* read */
63 "",
65 /* write */