*/
Rational
Spacing_spanner::effective_shortest_duration (Grob *me,
- Link_array<Grob> const &all)
+ vector<Grob*> const &all)
{
SCM preset_shortest = me->get_property ("common-shortest-duration");
Rational global_shortest;
/*
can't use get_system() ? --hwn.
*/
- Link_array<Grob> all (get_root_system (me)->columns ());
+ vector<Grob*> all (get_root_system (me)->columns ());
set_explicit_neighbor_columns (all);
stuff, then.
*/
Rational
-Spacing_spanner::find_shortest (Grob *me, Link_array<Grob> const &cols)
+Spacing_spanner::find_shortest (Grob *me, vector<Grob*> const &cols)
{
/*
ascending in duration
*/
- std::vector<Rational> durations;
- std::vector<int> counts;
+ vector<Rational> durations;
+ vector<int> counts;
Rational shortest_in_measure;
shortest_in_measure.set_infinite (1);
shortest_in_measure = min (shortest_in_measure, this_shortest.main_part_);
}
else if (!shortest_in_measure.is_infinity ()
- && Item::is_breakable (cols[i]))
+ && Paper_column::is_breakable (cols[i]))
{
vsize j = 0;
for (; j < durations.size (); j++)
{
if (durations[j] > shortest_in_measure)
{
- counts.insert (1, j);
- durations.insert (shortest_in_measure, j);
+ counts.insert (counts.begin () + j, 1);
+ durations.insert (durations.begin () + j, shortest_in_measure);
break;
}
else if (durations[j] == shortest_in_measure)
void
Spacing_spanner::generate_springs (Grob *me,
- Link_array<Grob> const &cols,
+ vector<Grob*> const &cols,
Spacing_options const *options)
{
- Paper_column *next = 0;
- Paper_column *next_next = 0;
- for (vsize i = cols.size (); i--;)
+ Paper_column *prev = 0;
+ for (vsize i = 0; i < cols.size (); i++)
{
Paper_column *col = dynamic_cast<Paper_column *> (cols[i]);
- if (next)
- generate_pair_spacing (me, col, next, next_next, options);
+ Paper_column *next = (i < cols.size()-1) ? dynamic_cast<Paper_column *> (cols[i+1]) : 0;
+
+ if (i > 0)
+ generate_pair_spacing (me, prev, col, next, options);
- next_next = next;
- next = col;
+ prev = col;
}
}
Real compound_fixed_note_space = 0.0;
if (options->stretch_uniformly_)
- compound_note_space = base_note_space;
+ {
+ compound_note_space = base_note_space;
+
+ if (!Paper_column::is_musical (right_col))
+ {
+ /*
+ Crude fix for notes that lead up to barlines and time sigs.
+ */
+ Interval lext = right_col->extent (right_col, X_AXIS);
+ if (!lext.is_empty ())
+ compound_note_space += -lext[LEFT];
+ }
+
+ }
else
{
int wish_count = 0;