]> git.donarmstrong.com Git - lilypond.git/blob - lily/dot-column-engraver.cc
release: 1.5.13
[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--2001 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> head_l_arr_;
22 public:
23   TRANSLATOR_DECLARATIONS(
24   Dot_column_engraver );
25   
26 protected:
27   virtual void acknowledge_grob (Grob_info);
28   virtual void stop_translation_timestep ();  
29 };
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   if (dotcol_)
42     {
43
44       /*
45         Add the stem to the support so dots stay clear of flags.
46
47         See [Ross, p 171]
48        */
49       if (stem_)
50         dotcol_->set_grob_property ("stem", stem_->self_scm ());
51       
52       typeset_grob (dotcol_);
53       dotcol_ =0;
54     }
55   head_l_arr_.clear ();
56   stem_ =0;
57 }
58
59 void
60 Dot_column_engraver::acknowledge_grob (Grob_info info)
61 {
62   Grob *d = unsmob_grob (info.grob_l_->get_grob_property ("dot"));
63   if (d)
64     {
65       if (!dotcol_)
66         {
67           dotcol_ = new Item (get_property ("DotColumn"));
68           announce_grob (dotcol_, 0);
69         }
70
71       Dot_column::add_head (dotcol_, info.grob_l_);
72     }
73   else if (Stem::has_interface (info.grob_l_))
74     {
75       stem_ = info.grob_l_;
76     }
77 }
78
79
80
81
82 ENTER_DESCRIPTION(Dot_column_engraver,
83 /* descr */       " Engraves dots on dotted notes shifted to the right of the note.
84 If omitted, then dots appear on top of the notes.
85 ",
86 /* creats*/       "DotColumn",
87 /* acks  */       "dot-column-interface stem-interface",
88 /* reads */       "",
89 /* write */       "");