lilypond-1.3.145
[lilypond.git] / lily / rod.cc
blob932133f33918cc0e5b1f1782a4fd5eaacc910ddc
1 /*
2 rod.cc -- implement Rod, Column_rod
4 source file of the GNU LilyPond music typesetter
6 (c) 1998--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
8 */
9 #include "rod.hh"
10 #include "paper-column.hh"
11 #include "debug.hh"
12 #include "dimensions.hh"
13 #include "spaceable-element.hh"
15 Rod::Rod ()
17 distance_f_ = 0.0;
18 item_l_drul_[LEFT] = item_l_drul_[RIGHT] =0;
23 void
24 Rod::columnize ()
26 Direction d = LEFT;
27 do {
28 Paper_column * pc = item_l_drul_[d]->column_l ();
29 distance_f_ += - d * item_l_drul_[d]->relative_coordinate (pc, X_AXIS);
30 item_l_drul_[d] = pc;
31 } while ((flip (&d))!=LEFT);
35 void
36 Rod::add_to_cols ()
38 columnize ();
39 if (item_l_drul_[LEFT] != item_l_drul_[RIGHT])
40 Spaceable_grob::add_rod (item_l_drul_[LEFT],
41 item_l_drul_[RIGHT],
42 distance_f_);