]> git.donarmstrong.com Git - lilypond.git/blob - lily/dot-column.cc
release: 1.1.32
[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--1999 Han-Wen Nienhuys <hanwen@cs.uu.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 (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_head (Rhythmic_head *r)
23 {
24   if (!r->dots_l_)
25     return ;
26   
27   head_l_arr_.push (r);
28   add_dependency (r);
29   add_dots (r->dots_l_);
30 }
31
32 void
33 Dot_column::do_substitute_element_pointer (Score_element*o,Score_element*n)
34 {
35   Item *oi =dynamic_cast <Item *> (o);
36   
37   if (oi && dynamic_cast<Rhythmic_head *> (oi))
38     head_l_arr_.substitute (dynamic_cast<Rhythmic_head*> (oi),
39                             dynamic_cast<Rhythmic_head*>(n));
40   else if (oi && dynamic_cast<Dots *> (oi))
41     dot_l_arr_.substitute (dynamic_cast<Dots*> (oi),
42                            dynamic_cast<Dots*> (n));
43 }
44
45 void
46 Dot_column::do_pre_processing ()
47 {
48   Interval w;
49   for (int i=0; i < head_l_arr_.size (); i++)
50     w.unite (head_l_arr_[i]->extent (X_AXIS));
51   
52   if (!w.empty_b ())
53     translate_axis (w[RIGHT] - extent(X_AXIS) [LEFT],X_AXIS);
54 }
55
56