]> git.donarmstrong.com Git - lilypond.git/blob - lily/head-column.cc
release: 0.1.8
[lilypond.git] / lily / head-column.cc
1 /*
2   head-column.cc -- implement Head_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 "head-column.hh"
11 #include "note-head.hh"
12 #include "stem.hh"
13 #include "script.hh"
14
15 Head_column::Head_column()
16 {
17     stem_l_ = 0;
18     dir_i_ =0;
19 }
20
21 void
22 Head_column::do_substitute_dependency (Score_elem*o,
23                                       Score_elem*n)
24 {
25     Script_column::do_substitute_dependency (o,n);
26     if (o->name() == Note_head::static_name ()) {
27         head_l_arr_.substitute ((Note_head*)o->item(), 
28                                 (n)? (Note_head*)n->item() : 0);
29     }
30     if (stem_l_ == o) {
31         stem_l_ = n ? (Stem*)n->item():0;
32     }
33 }
34
35
36 void
37 Head_column::set (Stem*stem_l)
38 {
39     stem_l_ = stem_l;
40     Score_elem::add_dependency (stem_l);
41     for (int i=0; script_l_arr_.size(); i++)
42         script_l_arr_[i]->set_stem (stem_l);
43 }
44
45 void
46 Head_column::add (Script *script_l)
47 {
48     Script_column::add (script_l) ;
49     if  (stem_l_)
50         script_l->set_stem (stem_l_);
51 }
52 void
53 Head_column::add (Note_head *n_l)
54 {
55     add_support (n_l);
56     head_l_arr_.push (n_l);
57 }
58
59
60
61 IMPLEMENT_IS_TYPE_B1(Head_column,Script_column);
62
63 void
64 Head_column::do_print() const
65 {
66 #ifndef NPRINT
67     DOUT << "heads: " << head_l_arr_.size();
68 #endif
69 }
70
71 void
72 Head_column::do_pre_processing()
73 {
74     if (!dir_i_){
75         if (stem_l_)
76             dir_i_ = stem_l_->dir_i_;
77     }
78     Script_column::do_pre_processing();
79 }