]> git.donarmstrong.com Git - lilypond.git/blob - lily/dot-column-engraver.cc
* lily/system.cc (do_derived_mark): don't mark from object_alist_
[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
15 class Dot_column_engraver : public Engraver
16 {
17   Grob *dotcol_;
18   Grob *stem_;
19   Link_array<Item> heads_;
20 public:
21   TRANSLATOR_DECLARATIONS (Dot_column_engraver);
22
23 protected:
24   virtual void acknowledge_grob (Grob_info);
25   virtual void stop_translation_timestep ();
26 };
27
28 Dot_column_engraver::Dot_column_engraver ()
29 {
30   dotcol_ = 0;
31   stem_ = 0;
32 }
33
34 void
35 Dot_column_engraver::stop_translation_timestep ()
36 {
37   /*
38     Add the stem to the support so dots stay clear of flags.
39
40     See [Ross, p 171]
41   */
42   if (stem_ && dotcol_)
43     dotcol_->set_object ("stem", stem_->self_scm ());
44
45   dotcol_ = 0;
46   heads_.clear ();
47   stem_ = 0;
48 }
49
50 void
51 Dot_column_engraver::acknowledge_grob (Grob_info info)
52 {
53   Grob *d = unsmob_grob (info.grob ()->get_object ("dot"));
54   if (d)
55     {
56       if (!dotcol_)
57         {
58           dotcol_ = make_item ("DotColumn", SCM_EOL);
59         }
60
61       Dot_column::add_head (dotcol_, info.grob ());
62     }
63   else if (Stem::has_interface (info.grob ()))
64     {
65       stem_ = info.grob ();
66     }
67 }
68
69 ADD_TRANSLATOR (Dot_column_engraver,
70                 /* descr */ "Engraves dots on dotted notes shifted to the right of the note.\n"
71                 "If omitted, then dots appear on top of the notes.",
72                 /* creats*/ "DotColumn",
73                 /* accepts */ "",
74                 /* acks  */ "rhythmic-head-interface dot-column-interface stem-interface",
75                 /* reads */ "",
76                 /* write */ "");