lilypond-1.3.69
[lilypond.git] / lily / rod.cc
blob15b4c7a8085bb13eb097178375d042e2aff5d622
1 /*
2 rod.cc -- implement Rod, Column_rod
4 source file of the GNU LilyPond music typesetter
6 (c) 1998--2000 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 "separation-item.hh"
16 Rod::Rod ()
18 distance_f_ = 0.0;
19 item_l_drul_[LEFT] = item_l_drul_[RIGHT] =0;
23 Column_rod::Column_rod ()
25 distance_f_ = 0;
26 other_l_ = 0;
29 void
30 Rod::columnize ()
32 Direction d = LEFT;
33 do {
34 Paper_column * pc = item_l_drul_[d]->column_l ();
35 distance_f_ += - d * item_l_drul_[d]->relative_coordinate (pc, X_AXIS);
36 item_l_drul_[d] = pc;
37 } while ((flip (&d))!=LEFT);
41 void
42 Rod::add_to_cols ()
44 columnize();
45 if (item_l_drul_[LEFT] != item_l_drul_[RIGHT])
46 dynamic_cast<Paper_column*> (item_l_drul_[LEFT])->
47 add_rod(dynamic_cast<Paper_column*>(item_l_drul_[RIGHT]), distance_f_ );