2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 2011 Mike Solomon <mike@apollinemike.com>
6 LilyPond is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 LilyPond is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
22 #include "column-description.hh"
23 #include "paper-column.hh"
24 #include "simple-spacer.hh"
25 #include "spaceable-grob.hh"
29 next_spaceable_column (vector<Grob *> const &list, vsize starting)
31 for (vsize i = starting + 1; i < list.size (); i++)
32 if (!Paper_column::is_loose (list[i]))
38 Column_description::get_column_description (vector<Grob *> const &cols, vsize col_index, bool line_starter)
40 Grob *col = cols[col_index];
42 col = Item::maybe_find_prebroken_piece (dynamic_cast<Item *> (col), RIGHT);
44 Column_description description;
45 Grob *next_col = next_spaceable_column (cols, col_index);
47 description.spring_ = Spaceable_grob::get_spring (col, next_col);
49 Grob *end_col = dynamic_cast<Item *> (cols[col_index + 1])->find_prebroken_piece (LEFT);
51 description.end_spring_ = Spaceable_grob::get_spring (col, end_col);
53 for (SCM s = Spaceable_grob::get_minimum_distances (col);
54 scm_is_pair (s); s = scm_cdr (s))
56 Grob *other = unsmob_grob (scm_caar (s));
57 vsize j = binary_search (cols, other, Paper_column::less_than, col_index);
61 description.rods_.push_back (Rod_description (j, scm_to_double (scm_cdar (s))));
62 else /* it must end at the LEFT prebroken_piece */
63 description.end_rods_.push_back (Rod_description (j, scm_to_double (scm_cdar (s))));
67 if (!line_starter && to_boolean (col->get_property ("keep-inside-line")))
68 description.keep_inside_line_ = col->extent (col, X_AXIS);
70 description.break_permission_ = col->get_property ("line-break-permission");