-/*
- Remove columns that are not tightly fitting from COLS. In the
- removed columns, set 'between-cols to the columns where it is in
- between.
-*/
-void
-Spacing_spanner::prune_loose_columns (Grob*me,Link_array<Grob> *cols, Rational shortest)
-{
- Link_array<Grob> newcols;
- Real increment = robust_scm2double (me->get_property ("spacing-increment"), 1.2);
- for (int i=0; i < cols->size (); i++)
- {
- if (Item::is_breakable (cols->elem (i)) || Paper_column::is_musical (cols->elem (i)))
- {
- newcols.push (cols->elem (i));
- continue;
- }
-
- Grob *c = cols->elem (i);
- if (loose_column (cols->elem (i-1), c, cols->elem (i+1)))
- {
- SCM lns = c->get_property ("left-neighbors");
- lns = ly_c_pair_p (lns) ? ly_car (lns) : SCM_BOOL_F;
-
- SCM rns = c->get_property ("right-neighbors");
- rns = ly_c_pair_p (rns) ? ly_car (rns) : SCM_BOOL_F;
-
- /*
- Either object can be non existent, if the score ends
- prematurely.
- */
- rns = ly_car (unsmob_grob (rns)->get_property ("right-items"));
- c->set_property ("between-cols", scm_cons (lns,
- rns));
-
- /*
- Set distance constraints for loose columns
- */
- Drul_array<Grob*> next_door;
- next_door[LEFT] =cols->elem (i - 1);
- next_door[RIGHT] =cols->elem (i + 1);
- Direction d = LEFT;
- Drul_array<Real> dists (0,0);
-
- do
- {
- dists[d] = 0.0;
- Item *lc = dynamic_cast<Item*> ((d == LEFT) ? next_door[LEFT] : c);
- Item *rc = dynamic_cast<Item*> (d == LEFT ? c : next_door[RIGHT]);
-
- for (SCM s = lc->get_property ("spacing-wishes");
- ly_c_pair_p (s); s = ly_cdr (s))
- {
- Grob *sp = unsmob_grob (ly_car (s));
- if (Note_spacing::left_column (sp) != lc
- || Note_spacing::right_column (sp) != rc)
- continue;
-
- Real space, fixed;
- fixed = 0.0;
- bool dummy;
-
- if (d == LEFT)
- {
- /*
- The note spacing should be taken from the musical
- columns.
-
- */
- Real base = note_spacing (me, lc, rc, shortest, &dummy);
- Note_spacing::get_spacing (sp, rc, base, increment, &space, &fixed);
-
- space -= increment;
-
- dists[d] = dists[d] >? space;
- }
- else
- {
- Real space, fixed_space;
- Staff_spacing::get_spacing_params (sp,
- &space, &fixed_space);
-
- dists[d] = dists[d] >? fixed_space;
- }
-
- }
- }
- while (flip (&d) != LEFT);
-
- Rod r;
- r.distance_ = dists[LEFT] + dists[RIGHT];
- r.item_l_drul_[LEFT] = dynamic_cast<Item*> (cols->elem (i-1));
- r.item_l_drul_[RIGHT] = dynamic_cast<Item*> (cols->elem (i+1));
-
- r.add_to_cols ();
- }
- else
- {
- newcols.push (c);
- }
- }