]> git.donarmstrong.com Git - lilypond.git/blob - lily/head-column.cc
release: 0.1.11
[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_ =CENTER;
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     {
28       head_l_arr_.substitute ((Note_head*)o->item(), 
29                               (n)? (Note_head*)n->item() : 0);
30     }
31   if (stem_l_ == o) 
32     {
33       stem_l_ = n ? (Stem*)n->item():0;
34     }
35 }
36
37
38 void
39 Head_column::set (Stem*stem_l)
40 {
41   stem_l_ = stem_l;
42   Score_elem::add_dependency (stem_l);
43   for (int i=0; i < script_l_arr_.size(); i++)
44     script_l_arr_[i]->set_stem (stem_l);
45 }
46
47 void
48 Head_column::add (Script *script_l)
49 {
50   Script_column::add (script_l) ;
51   if  (stem_l_)
52     script_l->set_stem (stem_l_);
53 }
54 void
55 Head_column::add (Note_head *n_l)
56 {
57   add_support (n_l);
58   head_l_arr_.push (n_l);
59 }
60
61
62
63 IMPLEMENT_IS_TYPE_B1(Head_column,Script_column);
64
65 void
66 Head_column::do_print() const
67 {
68 #ifndef NPRINT
69   DOUT << "heads: " << head_l_arr_.size();
70 #endif
71 }
72
73 void
74 Head_column::do_pre_processing()
75 {
76   if (!dir_)
77     {
78       if (stem_l_)
79         dir_ = stem_l_->dir_;
80     }
81   Script_column::do_pre_processing();
82 }