]> git.donarmstrong.com Git - lilypond.git/blob - lily/rhythmic-column-engraver.cc
release: 1.1.49
[lilypond.git] / lily / rhythmic-column-engraver.cc
1 /*
2   rhythmic-column-grav.cc -- implement Rhythmic_column_engraver
3
4   source file of the GNU LilyPond music typesetter
5
6   (c)  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9 #include "rhythmic-column-engraver.hh"
10 #include "note-head.hh"
11 #include "stem.hh"
12 #include "note-column.hh"
13 #include "dot-column.hh"
14 #include "musical-request.hh"
15
16 Rhythmic_column_engraver::Rhythmic_column_engraver()
17 {
18   stem_l_ =0;
19   ncol_p_=0;
20   dotcol_l_ =0;
21 }
22
23
24 void
25 Rhythmic_column_engraver::process_acknowledged ()
26 {
27   if (rhead_l_arr_.size ())
28     {
29       if (!ncol_p_)
30         {
31           ncol_p_ = new Note_column;
32           announce_element (Score_element_info (ncol_p_, 0));
33         }
34
35       for (int i=0; i < rhead_l_arr_.size (); i++)
36         {
37           ncol_p_->add_head (rhead_l_arr_[i]);
38         }
39       rhead_l_arr_.set_size (0);
40     }
41
42   
43   if (ncol_p_)
44     {
45       if (dotcol_l_)
46         {
47           ncol_p_->set_dotcol (dotcol_l_);
48         }
49
50       if (stem_l_)
51         {
52           ncol_p_->set_stem (stem_l_);
53           stem_l_ = 0;
54         }
55     }
56 }
57
58 void
59 Rhythmic_column_engraver::acknowledge_element (Score_element_info i)
60 {
61   Item * item =  dynamic_cast <Item *> (i.elem_l_);
62   if (!item)
63     return;
64  if (Stem*s=dynamic_cast<Stem *> (item))
65     {
66       stem_l_ = s;
67     }
68       else if (Rhythmic_head*r=dynamic_cast<Rhythmic_head *> (item))
69     {
70       rhead_l_arr_.push (r);
71     }
72       else if (Dot_column*d =dynamic_cast<Dot_column *> (item))
73     {
74       dotcol_l_ = d;
75     }
76 }
77
78 void
79 Rhythmic_column_engraver::do_pre_move_processing()
80 {
81   if (ncol_p_) 
82     {
83       Scalar sh = get_property ("horizontalNoteShift", 0);
84       // egcs
85       if (sh.to_bool () && sh.isnum_b ())
86         {
87           ncol_p_->set_elt_property (horizontal_shift_scm_sym,
88                                      gh_int2scm (int (sh)));
89         }
90
91       typeset_element (ncol_p_);
92       ncol_p_ =0;
93     }
94 }
95
96 void
97 Rhythmic_column_engraver::do_post_move_processing()
98 {
99   dotcol_l_ =0;
100   stem_l_ =0;
101 }
102
103
104
105
106
107 ADD_THIS_TRANSLATOR(Rhythmic_column_engraver);