]> git.donarmstrong.com Git - lilypond.git/blob - lily/dot-column-engraver.cc
(acknowledge_grob): avoid more
[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--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7   
8  */
9
10
11 #include "rhythmic-head.hh"
12 #include "dot-column.hh"
13 #include "side-position-interface.hh"
14 #include "engraver.hh"
15 #include "stem.hh"
16
17 class Dot_column_engraver : public Engraver
18 {
19   Grob *dotcol_ ;
20   Grob * stem_;
21   Link_array<Item> heads_;
22 public:
23   TRANSLATOR_DECLARATIONS (Dot_column_engraver );
24   
25 protected:
26   virtual void acknowledge_grob (Grob_info);
27   virtual void stop_translation_timestep ();  
28 };
29
30
31 Dot_column_engraver::Dot_column_engraver ()
32 {
33   dotcol_ = 0;
34   stem_ = 0;
35 }
36
37 void
38 Dot_column_engraver::stop_translation_timestep ()
39 {
40   /*
41     Add the stem to the support so dots stay clear of flags.
42
43     See [Ross, p 171]
44   */
45   if (stem_ && dotcol_)
46     dotcol_->set_property ("stem", stem_->self_scm ());
47       
48   dotcol_ =0;
49   heads_.clear ();
50   stem_ =0;
51 }
52
53 void
54 Dot_column_engraver::acknowledge_grob (Grob_info info)
55 {
56   Grob *d = unsmob_grob (info.grob_->get_property ("dot"));
57   if (d)
58     {
59       if (!dotcol_)
60         {
61           dotcol_ = make_item ("DotColumn", SCM_EOL);
62           
63         }
64
65       Dot_column::add_head (dotcol_, info.grob_);
66     }
67   else if (Stem::has_interface (info.grob_))
68     {
69       stem_ = info.grob_;
70     }
71 }
72
73
74
75
76 ENTER_DESCRIPTION (Dot_column_engraver,
77 /* descr */       " Engraves dots on dotted notes shifted to the right of the note.\n"
78 "If omitted, then dots appear on top of the notes.",
79 /* creats*/       "DotColumn",
80 /* accepts */     "",
81 /* acks  */      "rhythmic-head-interface dot-column-interface stem-interface",
82 /* reads */       "",
83 /* write */       "");