2 paper-column.cc -- implement Paper_column
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 #include "paper-column.hh"
10 #include "paper-score.hh"
12 #include "axis-group-interface.hh"
15 Paper_column::add_rod (Paper_column * p, Real d)
17 Direction dir = Direction (sign (p->rank_i () - rank_i ()));
21 programming_error ("Must set minimum distance LTOR.");
25 for (int i=0; i < minimal_dists_.size (); i++)
27 Column_rod &rod = minimal_dists_[i];
28 if (rod.other_l_ == p)
30 rod.distance_f_ = rod.distance_f_ >? d;
39 minimal_dists_.push (cr);
43 Paper_column::add_spring (Paper_column * p, Real d, Real s)
45 Direction dir = Direction (sign (p->rank_i () - rank_i ()));
49 programming_error ("Must set springs LTOR");
53 for (int i=0; i < springs_.size (); i++)
55 Column_spring &spring = springs_[i];
56 if (spring.other_l_ == p)
58 spring.distance_f_ = spring.distance_f_ >? d;
72 Paper_column::rank_i() const
78 Paper_column::set_rank (int i)
86 Paper_column::line_l() const
92 Paper_column::column_l () const
94 return (Paper_column*)(this);
97 Paper_column::Paper_column (Moment w)
100 SCM when = (new Moment (w))->smobify_self ();
101 scm_unprotect_object (when);
102 set_elt_property ("when", when);
104 Axis_group_interface (this).set_interface ();
105 Axis_group_interface (this).set_axes (X_AXIS, X_AXIS);
112 Paper_column::when_mom () const
114 SCM m = get_elt_property ("when");
116 if (SMOB_IS_TYPE_B(Moment, m))
118 s = *SMOB_TO_TYPE (Moment,m);
124 Paper_column::musical_b () const
126 SCM m = get_elt_property ("shortest-starter-duration");
128 if (SMOB_IS_TYPE_B(Moment, m))
130 s = *SMOB_TO_TYPE (Moment,m);
132 return s != Moment(0);
136 Paper_column::used_b ()const
138 return gh_pair_p (get_elt_pointer ("elements")) || breakable_b ();