]> git.donarmstrong.com Git - lilypond.git/blob - lily/spring.cc
release: 1.5.3
[lilypond.git] / lily / spring.cc
1 /*   
2   spring.cc --  implement Spring
3   
4   source file of the GNU LilyPond music typesetter
5   
6   (c) 1999--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7   
8  */
9
10 #include "spring.hh"
11 #include "debug.hh"
12 #include "item.hh"
13 #include "spaceable-grob.hh"
14 #include "paper-column.hh"
15
16 Spring::Spring ()
17 {
18   item_l_drul_[LEFT]  =item_l_drul_[RIGHT] =0;
19   distance_f_ =0.;
20   strength_f_ =1.0;
21 }
22
23 /*
24
25  ugh : if we go from items to cols, we should adjust distance and strength.
26  */
27
28 void
29 Spring::add_to_cols ()
30 {
31   Spaceable_grob::add_spring (item_l_drul_[LEFT]->column_l (),
32                                  item_l_drul_[RIGHT]->column_l (),
33                                  distance_f_, strength_f_);
34 }
35
36 void
37 Spring::set_to_cols( )
38 {
39   Direction d = LEFT;
40   do
41     {
42       item_l_drul_[d] = item_l_drul_[d]->column_l ();
43     }
44   while (flip (&d) != LEFT);
45
46 }
47
48 Column_spring::Column_spring ()
49 {
50   other_l_ = 0;
51   distance_f_ =0;
52   strength_f_ =1.0;
53 }
54
55
56