Format and improve documentation of internal grob properties.
[lilypond.git] / lily / rod.cc
blob2e6ab483dbf7f5b10bf7e4d4686b0ad47207f2d7
1 /*
2 rod.cc -- implement Rod, Column_rod
4 source file of the GNU LilyPond music typesetter
6 (c) 1998--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
9 #include "rod.hh"
11 #include "paper-column.hh"
12 #include "warn.hh"
13 #include "dimensions.hh"
14 #include "spaceable-grob.hh"
16 Rod::Rod ()
18 distance_ = 0.0;
19 item_drul_[LEFT] = item_drul_[RIGHT] = 0;
22 void
23 Rod::columnize ()
25 if (!item_drul_[LEFT]
26 || !item_drul_[RIGHT])
27 return;
29 Direction d = LEFT;
32 Paper_column *pc = item_drul_[d]->get_column ();
33 distance_ += -d * item_drul_[d]->relative_coordinate (pc, X_AXIS);
34 item_drul_[d] = pc;
36 while ((flip (&d)) != LEFT);
39 void
40 Rod::add_to_cols ()
42 columnize ();
43 if (item_drul_[LEFT] != item_drul_[RIGHT]
44 && item_drul_[LEFT] && item_drul_[RIGHT])
45 Spaceable_grob::add_rod (item_drul_[LEFT],
46 item_drul_[RIGHT],
47 distance_);