]> git.donarmstrong.com Git - lilypond.git/blob - lily/rhythmic-column-engraver.cc
8c1cacfdf5689884f7929b558682494fe9884137
[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--1998 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 (item->is_type_b (Script::static_name ())
74       && i.req_l_
75       && dynamic_cast <Musical_req *> (i.req_l_)) 
76     {
77       script_l_arr_.push ((Script*)item);
78     }
79   else if (item->is_type_b (Stem::static_name()))
80     {
81       stem_l_ = (Stem*) item;
82     }
83   else if (item->is_type_b (Rhythmic_head::static_name ()))
84     {
85       rhead_l_arr_.push ((Rhythmic_head*)item);
86     }
87   else if (item->is_type_b (Dot_column::static_name ()))
88     {
89       dotcol_l_ = (Dot_column*) item;
90     }
91 }
92
93 void
94 Rhythmic_column_engraver::do_pre_move_processing()
95 {
96   if (ncol_p_) 
97     {
98       if (! ncol_p_->h_shift_b_)
99         // egcs
100         ncol_p_->h_shift_b_  = get_property ("hshift").operator bool ();
101       if (! ncol_p_->dir_)
102         ncol_p_->dir_ =(Direction) int(get_property ("ydirection"));
103
104       typeset_element (ncol_p_);
105       ncol_p_ =0;
106     }
107 }
108
109 void
110 Rhythmic_column_engraver::do_post_move_processing()
111 {
112   script_l_arr_.clear();
113   dotcol_l_ =0;
114   stem_l_ =0;
115 }
116
117
118
119
120 IMPLEMENT_IS_TYPE_B1(Rhythmic_column_engraver,Engraver);
121 ADD_THIS_TRANSLATOR(Rhythmic_column_engraver);