]> git.donarmstrong.com Git - lilypond.git/blob - lily/dot-column.cc
release: 0.1.13
[lilypond.git] / lily / dot-column.cc
1 /*
2   dot-column.cc -- implement Dot_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 "dots.hh"
10 #include "dot-column.hh"
11 #include "rhythmic-head.hh"
12
13 void
14 Dot_column::add (Dots *d)
15 {
16   dot_l_arr_.push (d);
17   add_dependency (d);
18   add_element (d);
19 }
20
21 void
22 Dot_column::add (Rhythmic_head *r)
23 {
24   if (!r->dots_l_)
25     return ;
26   
27   head_l_arr_.push (r);
28   add_dependency (r);
29   add (r->dots_l_);
30 }
31
32 void
33 Dot_column::do_substitute_dependency (Score_elem*o,Score_elem*n)
34 {
35   Item *oi =o->item ();
36   Item *ni = n?n->item ():0;
37   
38   if (oi&&oi->is_type_b (Rhythmic_head::static_name ()))
39     head_l_arr_.substitute ((Rhythmic_head*)oi, (Rhythmic_head*)ni);
40   else if (oi && oi->is_type_b (Dots::static_name ()))
41     dot_l_arr_.substitute ((Dots*) oi, (Dots*) ni);
42 }
43
44 void
45 Dot_column::do_pre_processing ()
46 {
47   Interval w;
48   for (int i=0; i < head_l_arr_.size (); i++)
49     w.unite (head_l_arr_[i]->width ());
50   
51   if (!w.empty_b ())
52     translate (w[RIGHT] - width() [LEFT],X_AXIS);
53 }
54
55 IMPLEMENT_IS_TYPE_B1(Dot_column, Horizontal_group_item);