]> git.donarmstrong.com Git - lilypond.git/blob - lily/rhythmic-column-engraver.cc
49acc59c388ed9e8af5ce4da99254c58b1cba894
[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 "script.hh"
14 #include "dot-column.hh"
15 #include "musical-request.hh"
16
17 Rhythmic_column_engraver::Rhythmic_column_engraver()
18 {
19   stem_l_ =0;
20   ncol_p_=0;
21   dotcol_l_ =0;
22 }
23
24
25 void
26 Rhythmic_column_engraver::process_acknowledged ()
27 {
28   if (rhead_l_arr_.size ())
29     {
30       if (!ncol_p_)
31         {
32           ncol_p_ = new Note_column;
33           announce_element (Score_element_info (ncol_p_, 0));
34         }
35
36       for (int i=0; i < rhead_l_arr_.size (); i++)
37         {
38           ncol_p_->add_head (rhead_l_arr_[i]);
39         }
40       rhead_l_arr_.set_size (0);
41     }
42
43   
44   if (ncol_p_)
45     {
46       if (dotcol_l_)
47         {
48           ncol_p_->set_dotcol (dotcol_l_);
49         }
50
51       if (stem_l_)
52         {
53           ncol_p_->set_stem (stem_l_);
54           stem_l_ = 0;
55         }
56       
57       for (int i=0; i < script_l_arr_.size(); i++) 
58         {
59           if (ncol_p_)
60             ncol_p_->add_script (script_l_arr_[i]);
61         }
62   
63       script_l_arr_.clear();
64     }
65 }
66
67 void
68 Rhythmic_column_engraver::acknowledge_element (Score_element_info i)
69 {
70   Item * item =  dynamic_cast <Item *> (i.elem_l_);
71   if (!item)
72     return;
73   if (Script *s=dynamic_cast<Script *> (item))
74     {
75       if (i.req_l_ && dynamic_cast <Musical_req *> (i.req_l_)) 
76         {
77           script_l_arr_.push (s);
78         }
79     }
80   else if (Stem*s=dynamic_cast<Stem *> (item))
81     {
82       stem_l_ = s;
83     }
84       else if (Rhythmic_head*r=dynamic_cast<Rhythmic_head *> (item))
85     {
86       rhead_l_arr_.push (r);
87     }
88       else if (Dot_column*d =dynamic_cast<Dot_column *> (item))
89     {
90       dotcol_l_ = d;
91     }
92 }
93
94 void
95 Rhythmic_column_engraver::do_pre_move_processing()
96 {
97   if (ncol_p_) 
98     {
99       if (! ncol_p_->h_shift_b_)
100         // egcs
101         ncol_p_->h_shift_b_  = get_property ("hshift", 0).operator bool ();
102       if (! ncol_p_->dir_)
103         ncol_p_->dir_ =(Direction) int(get_property ("ydirection", 0));
104
105       typeset_element (ncol_p_);
106       ncol_p_ =0;
107     }
108 }
109
110 void
111 Rhythmic_column_engraver::do_post_move_processing()
112 {
113   script_l_arr_.clear();
114   dotcol_l_ =0;
115   stem_l_ =0;
116 }
117
118
119
120
121
122 ADD_THIS_TRANSLATOR(Rhythmic_column_engraver);