]> git.donarmstrong.com Git - lilypond.git/blob - lily/dot-column-engraver.cc
(class Phrasing_slur_engraver):
[lilypond.git] / lily / dot-column-engraver.cc
1 /*
2   dot-column-engraver.cc -- implement Dot_column_engraver
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1998--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9 #include "rhythmic-head.hh"
10 #include "dot-column.hh"
11 #include "side-position-interface.hh"
12 #include "engraver.hh"
13 #include "stem.hh"
14 #include "translator.icc"
15
16 class Dot_column_engraver : public Engraver
17 {
18   Grob *dotcol_;
19   Grob *stem_;
20   Link_array<Item> heads_;
21 public:
22   TRANSLATOR_DECLARATIONS (Dot_column_engraver);
23
24 protected:
25
26   DECLARE_ACKNOWLEDGER (stem);
27   DECLARE_ACKNOWLEDGER (rhythmic_head);
28   
29   void stop_translation_timestep ();
30 };
31
32 Dot_column_engraver::Dot_column_engraver ()
33 {
34   dotcol_ = 0;
35   stem_ = 0;
36 }
37
38 void
39 Dot_column_engraver::stop_translation_timestep ()
40 {
41   /*
42     Add the stem to the support so dots stay clear of flags.
43
44     See [Ross, p 171]
45   */
46   if (stem_ && dotcol_)
47     dotcol_->set_object ("stem", stem_->self_scm ());
48
49   dotcol_ = 0;
50   heads_.clear ();
51   stem_ = 0;
52 }
53
54 void
55 Dot_column_engraver::acknowledge_rhythmic_head (Grob_info info)
56 {
57   Grob *d = unsmob_grob (info.grob ()->get_object ("dot"));
58   if (d)
59     {
60       if (!dotcol_)
61         {
62           dotcol_ = make_item ("DotColumn", SCM_EOL);
63         }
64
65       Dot_column::add_head (dotcol_, info.grob ());
66     }
67 }
68
69
70 void
71 Dot_column_engraver::acknowledge_stem (Grob_info info)
72 {
73   stem_ = info.grob ();
74 }
75
76 ADD_ACKNOWLEDGER (Dot_column_engraver, stem);
77 ADD_ACKNOWLEDGER (Dot_column_engraver, rhythmic_head);
78 ADD_TRANSLATOR (Dot_column_engraver,
79                 /* doc */ "Engraves dots on dotted notes shifted to the right of the note.\n"
80                 "If omitted, then dots appear on top of the notes.",
81                 /* create */ "DotColumn",
82                 /* accept */ "",
83                 /* read */ "",
84                 /* write */ "");