]> git.donarmstrong.com Git - lilypond.git/blob - lily/rod.cc
release: 0.1.53
[lilypond.git] / lily / rod.cc
1 /*   
2   rod.cc --  implement Rod, Column_rod
3   
4   source file of the GNU LilyPond music typesetter
5   
6   (c) 1998 Han-Wen Nienhuys <hanwen@cs.ruu.nl>
7   
8  */
9 #include "rod.hh"
10 #include "p-col.hh"
11 #include "debug.hh"
12 #include "single-malt-grouping-item.hh"
13
14 Rod::Rod (Single_malt_grouping_item *l, Single_malt_grouping_item *r)
15 {
16   item_l_drul_[LEFT] =l;
17   item_l_drul_[RIGHT]=r;
18   distance_f_ = l->my_width () [RIGHT] + r->my_width ()[LEFT];
19 }
20           
21 Rod::Rod ()
22 {
23   distance_f_ = 0.0;
24   item_l_drul_[LEFT] = item_l_drul_[RIGHT] =0;
25 }
26
27 void
28 Column_rod::print () const
29 {
30 #ifndef NDEBUG
31   DOUT << "Column_rod { rank = "
32        << other_l_->rank_i () << ", dist = " << distance_f_ << "}\n";   
33 #endif
34 }
35
36 Column_rod::Column_rod ()
37 {
38   distance_f_ = 0;
39   other_l_ = 0;
40 }
41   
42 int
43 Column_rod::compare (const Column_rod &r1, const Column_rod &r2)
44 {
45   return r1.other_l_->rank_i() - r2.other_l_->rank_i();
46 }
47 void
48 Rod::add_to_cols ()
49 {
50   item_l_drul_[RIGHT]->column_l ()->add_rod
51     (item_l_drul_[LEFT]->column_l (), distance_f_);
52   item_l_drul_[LEFT]->column_l ()->add_rod
53     (item_l_drul_[RIGHT]->column_l (), distance_f_);
54 }