}
/*
- cut 'n paste from spring-spacer.cc
-
- generate springs between columns.
-
The algorithm is partly taken from :
Science, The Ohio State University, 1987.
TOO HAIRY.
+
+ TODO: write comments
*/
Array<Spring>
{
Item * l = cols[i];
Item * r = cols[i+1];
- Item * lb = l->find_broken_piece (RIGHT);
- Item * rb = r->find_broken_piece (LEFT);
+ Item * lb = l->find_prebroken_piece (RIGHT);
+ Item * rb = r->find_prebroken_piece (LEFT);
Item* combinations[4][2]={{l,r}, {lb,r}, {l,rb},{lb,rb}};
stretch_dist += right_dist;
if (s.distance_f_ <0)
- programming_error("negative dist");
-
+ {
+ programming_error("Negative dist, setting to 1.0 PT");
+ s.distance_f_ = 1.0;
+ }
if (stretch_dist == 0.0)
{
/*
This should be more advanced, since relative heights of the note
heads also influence required correction.
- Also might not work correctly ico. multi voices or staff changing voices
+ Also might not work correctly in case of multi voices or staff
+ changing voices
TODO: lookup correction distances? More advanced correction?
Possibly turn this off?
- This routine reads the DIR_LIST property of both its L and R arguments.
-*/
+ This routine reads the DIR-LIST property of both its L and R arguments. */
Real
Spacing_spanner::stem_dir_correction (Paper_column*l, Paper_column*r) const
{
Spacing_spanner::get_springs () const
{
Array<Spring> springs;
-
- SCM last_col = pscore_l_->line_l_->get_elt_property ("columns");
- Link_array<Paper_column> measure;
- for (SCM s = last_col; gh_pair_p (s); s = gh_cdr (s))
+
+ Link_array<Paper_column> all (pscore_l_->line_l_->column_l_arr ()) ;
+
+ int j = 0;
+
+ for (int i = 1; i < all.size (); i++)
{
- Score_element * elt = unsmob_element (gh_car (s));
- Paper_column* sc = dynamic_cast<Paper_column*> (elt);
- measure.push (sc);
+ Paper_column* sc = dynamic_cast<Paper_column*> (all[i]);
if (sc->breakable_b ())
{
- measure.reverse ();
+ Link_array<Paper_column> measure (all.slice (j, i+1));
springs.concat (do_measure (measure));
- measure.clear ();
- measure.push (sc);
+ j = i;
}
}
+
+ /*
+ farewell, cruel world
+ */
+ ((Spacing_spanner*)this)->suicide ();
+
return springs;
}