2 paper-column.cc -- implement Paper_column
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
10 #include "paper-column.hh"
11 #include "paper-score.hh"
13 #include "axis-group-interface.hh"
14 #include "spaceable-grob.hh"
15 #include "molecule.hh"
16 #include "text-item.hh"
18 #include "font-interface.hh"
22 Paper_columns form the top-most item parent. (The Paper_columns X
23 parent is System, which is a spanner.)
25 Paper_columns form the units for the spacing engine. They are
26 numbered, the first (leftmost) is column 0. Numbering happens before
27 line-breaking, and columns are not renumbered after line breaking.
29 Since many columns go unused, you should only use the rank field to
30 get ordering information. Two adjacent columns may have
36 Paper_column::do_break_processing ()
38 Spaceable_grob::remove_interface (this);
39 Item::do_break_processing ();
43 Paper_column::rank_i (Grob*me)
45 return dynamic_cast<Paper_column*> (me)->rank_i_;
49 Paper_column::line_l () const
55 Paper_column::column_l () const
57 return (Paper_column*) (this);
60 Paper_column::Paper_column (SCM l)
68 Paper_column::when_mom (Grob*me)
70 SCM m = me->get_grob_property ("when");
72 if (unsmob_moment (m))
74 return *unsmob_moment (m);
80 Paper_column::musical_b (Grob *me)
82 SCM m = me->get_grob_property ("shortest-starter-duration");
84 if (unsmob_moment (m))
86 s = *unsmob_moment (m);
88 return s != Moment (0);
94 Paper_column::used_b (Grob*me)
96 return gh_pair_p (me->get_grob_property ("elements")) || Item::breakable_b (me)
97 || gh_pair_p (me->get_grob_property ("bounded-by-me"))
102 Print a vertical line and the rank number, to aid debugging.
105 MAKE_SCHEME_CALLBACK(Paper_column,brew_molecule,1);
107 Paper_column::brew_molecule (SCM p)
109 Grob *me = unsmob_grob (p);
111 String r = to_str (Paper_column::rank_i (me));
112 SCM properties = Font_interface::font_alist_chain (me);
114 Molecule t = Text_item::text2molecule (me, ly_str02scm (r.ch_C()),
116 t.align_to (X_AXIS, CENTER);
117 t.align_to (Y_AXIS, DOWN);
119 Molecule l = Lookup::filledbox (Box (Interval (-0.01, 0.01),
123 return t.smobbed_copy ();
129 ADD_INTERFACE (Paper_column, "paper-column-interface",
131 "between-cols when bounded-by-me shortest-playing-duration shortest-starter-duration");