]> git.donarmstrong.com Git - lilypond.git/blob - lily/rhythmic-column-engraver.cc
6d7fc6927b3135ba0b926006dc361300ef78d923
[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
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       for (int i=0; i < script_l_arr_.size(); i++) 
57         {
58           if (ncol_p_)
59             ncol_p_->add_script (script_l_arr_[i]);
60         }
61   
62       script_l_arr_.clear();
63     }
64 }
65
66 void
67 Rhythmic_column_engraver::acknowledge_element (Score_element_info i)
68 {
69   Item * item =  i.elem_l_->access_Item ();
70   if (!item)
71     return;
72   if (item->is_type_b (Script::static_name ())
73       && i.req_l_
74       && i.req_l_->access_Musical_req ()) 
75     {
76       script_l_arr_.push ((Script*)item);
77     }
78   else if (item->is_type_b (Stem::static_name()))
79     {
80       stem_l_ = (Stem*) item;
81     }
82   else if (item->is_type_b (Rhythmic_head::static_name ()))
83     {
84       rhead_l_arr_.push ((Rhythmic_head*)item);
85     }
86   else if (item->is_type_b (Dot_column::static_name ()))
87     {
88       dotcol_l_ = (Dot_column*) item;
89     }
90 }
91
92 void
93 Rhythmic_column_engraver::do_pre_move_processing()
94 {
95   if (ncol_p_) 
96     {
97       if (! ncol_p_->h_shift_b_)
98         // egcs
99         ncol_p_->h_shift_b_  = get_property ("hshift").operator bool ();
100       if (! ncol_p_->dir_)
101         ncol_p_->dir_ =(Direction) int(get_property ("ydirection"));
102
103       typeset_element (ncol_p_);
104       ncol_p_ =0;
105     }
106 }
107
108 void
109 Rhythmic_column_engraver::do_post_move_processing()
110 {
111   script_l_arr_.clear();
112   dotcol_l_ =0;
113   stem_l_ =0;
114 }
115
116
117
118
119 IMPLEMENT_IS_TYPE_B1(Rhythmic_column_engraver,Engraver);
120 ADD_THIS_TRANSLATOR(Rhythmic_column_engraver);