summaryrefslogtreecommitdiff
path: root/lily/rod.cc
blob: 932133f33918cc0e5b1f1782a4fd5eaacc910ddc (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*   
  rod.cc --  implement Rod, Column_rod
  
  source file of the GNU LilyPond music typesetter
  
  (c) 1998--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
  
 */
#include "rod.hh"
#include "paper-column.hh"
#include "debug.hh"
#include "dimensions.hh"
#include "spaceable-element.hh"

Rod::Rod ()
{
  distance_f_ = 0.0;
  item_l_drul_[LEFT] = item_l_drul_[RIGHT] =0;
}



void
Rod::columnize ()
{
  Direction d = LEFT;
  do {
    Paper_column * pc = item_l_drul_[d]->column_l ();
    distance_f_ += - d * item_l_drul_[d]->relative_coordinate (pc, X_AXIS);
    item_l_drul_[d] = pc;
  } while ((flip (&d))!=LEFT);

}

void
Rod::add_to_cols ()
{
  columnize ();
  if (item_l_drul_[LEFT] != item_l_drul_[RIGHT])
    Spaceable_grob::add_rod (item_l_drul_[LEFT],
				item_l_drul_[RIGHT],
				distance_f_);
}