]> git.donarmstrong.com Git - lilypond.git/blob - lily/rest-column.cc
a58e73846f9424379187f62180ca187e64b24867
[lilypond.git] / lily / rest-column.cc
1 /*
2   rest-column.cc -- implement Rest_column
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
8
9 #include "debug.hh"
10 #include "rest-column.hh"
11 #include "note-head.hh"
12 #include "rest-column.hh"
13 #include "stem.hh"
14
15 IMPLEMENT_STATIC_NAME(Rest_column);
16 IMPLEMENT_IS_TYPE_B1(Rest_column,Item);
17
18 Rest_column::Rest_column()
19 {
20     dir_i_ = 0;
21     stem_l_ = 0;
22 }
23     
24 void
25 Rest_column::add(Note_head *n_l)
26 {
27     add_support(n_l);
28     head_l_arr_.push(n_l);
29 }
30
31 void
32 Rest_column::add(Stem*stem_l)
33 {
34     stem_l_ = stem_l;
35     add_dependency(stem_l);
36 //    add_support(stem_l);
37 }
38
39 void
40 Rest_column::do_print() const
41 {
42 #ifndef NPRINT
43     mtor << "heads: " << head_l_arr_.size();
44 #endif
45 }
46
47 void
48 Rest_column::do_substitute_dependency(Score_elem*o,Score_elem*n)
49 {
50     Script_column::do_substitute_dependency(o,n);
51     if (o == stem_l_)
52         stem_l_ = n? (Stem*)n->item() :0;
53     
54     if (o->is_type_b( Note_head::static_name()) ) 
55         head_l_arr_.substitute( (Note_head*)o->item(), 
56                                 (n)? (Note_head*)n->item() : 0);
57 }
58
59
60 /**
61   translate the rest symbols
62  */
63 void
64 Rest_column::translate_heads(int dy_i)
65 {
66     for (int i=0; i < head_l_arr_.size(); i++)
67         head_l_arr_[i]->position_i_ += dy_i;
68 }
69