/*
This file is part of LilyPond, the GNU music typesetter.
- Copyright (C) 1996--2010 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ Copyright (C) 1996--2011 Han-Wen Nienhuys <hanwen@xs4all.nl>
LilyPond is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
c[j]->translate_axis (breaking[i].config_[j], X_AXIS);
dynamic_cast<Paper_column *> (c[j])->set_system (system);
/* collect the column labels */
- SCM col_labels = c[j]->get_property ("labels");
- if (scm_is_pair (col_labels))
- system_labels = scm_append (scm_list_2 (col_labels, system_labels));
+ collect_labels (c[j], &system_labels);
}
+ /*
+ Collect labels from any loose columns too: theses will be set on
+ an empty bar line or a column which is otherwise unused mid-line
+ */
+ vector<Grob *> loose (breaking[i].loose_cols_);
+ for (vsize j = 0; j < loose.size (); j++)
+ collect_labels (loose[j], &system_labels);
+
system->set_property ("labels", system_labels);
set_loose_columns (system, &breaking[i]);
}
}
+void
+System::collect_labels (Grob const *col, SCM *labels)
+{
+ SCM col_labels = col->get_property ("labels");
+ if (scm_is_pair (col_labels))
+ *labels = scm_append (scm_list_2 (col_labels, *labels));
+}
+
void
System::add_column (Paper_column *p)
{
return 0;
}
+Interval
+System::pure_refpoint_extent (vsize start, vsize end)
+{
+ Interval ret;
+ Grob *alignment = get_vertical_alignment ();
+ if (!alignment)
+ return Interval ();
+
+ extract_grob_set (alignment, "elements", staves);
+ vector<Real> offsets = Align_interface::get_pure_minimum_translations (alignment, staves, Y_AXIS, start, end);
+
+ for (vsize i = 0; i < offsets.size (); ++i)
+ if (Page_layout_problem::is_spaceable (staves[i]))
+ {
+ ret[UP] = offsets[i];
+ break;
+ }
+
+ for (vsize i = offsets.size (); i--;)
+ if (Page_layout_problem::is_spaceable (staves[i]))
+ {
+ ret[DOWN] = offsets[i];
+ break;
+ }
+
+ return ret;
+}
+
Interval
System::part_of_line_pure_height (vsize start, vsize end, bool begin)
{
return Interval ();
extract_grob_set (alignment, "elements", staves);
- vector<Real> offsets = Align_interface::get_minimum_translations (alignment, staves, Y_AXIS, true, start, end);
+ vector<Real> offsets = Align_interface::get_pure_minimum_translations (alignment, staves, Y_AXIS, start, end);
Interval ret;
for (vsize i = 0; i < staves.size (); ++i)
return ly_interval2scm (begin);
}
+Grob*
+System::get_pure_bound (Direction d, int start, int end)
+{
+ vector<vsize> ranks = pscore_->get_break_ranks ();
+ vector<vsize> indices = pscore_->get_break_indices ();
+ vector<Grob*> cols = pscore_->get_columns ();
+
+ vsize target_rank = (d == LEFT ? start : end);
+ vector<vsize>::const_iterator i =
+ lower_bound (ranks.begin (), ranks.end (), target_rank, std::less<vsize> ());
+
+ if (i != ranks.end () && (*i) == target_rank)
+ return cols[indices[i - ranks.begin ()]];
+ else
+ return 0;
+}
+
+Grob*
+System::get_maybe_pure_bound (Direction d, bool pure, int start, int end)
+{
+ return pure ? get_pure_bound (d, start, end) : get_bound (d);
+}
+
ADD_INTERFACE (System,
"This is the top-level object: Each object in a score"
" ultimately has a @code{System} object as its X and"