- extract_grob_set (left_col, "right-neighbors", neighbors);
-
- for (vsize i = 0; i < neighbors.size (); i++)
- {
- Grob *wish = neighbors[i];
-
- Item *wish_rcol = Spacing_interface::right_column (wish);
- if (Spacing_interface::left_column (wish) != left_col
- || (wish_rcol != right_col && wish_rcol != right_col->original ()))
- continue;
-
- /*
- This is probably a waste of time in the case of polyphonic
- music. */
- if (Note_spacing::has_interface (wish))
- {
- Real inc = options->increment_;
- Grob *gsp = unsmob_grob (left_col->get_object ("grace-spacing"));
- if (gsp && Paper_column::when_mom (left_col).grace_part_)
- {
- Spacing_options grace_opts;
- grace_opts.init_from_grob (gsp);
- inc = grace_opts.increment_;
- }
- springs.push_back (Note_spacing::get_spacing (wish, right_col, base_note_space, inc));
- }
- }
+ extract_grob_set (left_col, "spacing-wishes", wishes);
+
+ for (vsize i = 0; i < wishes.size (); i++)
+ {
+ Grob *wish = wishes[i];
+ if (Spacing_interface::left_column (wish) != left_col)
+ {
+ /* This shouldn't really happen, but the ancient music
+ stuff really messes up the spacing code, grrr
+ */
+ continue;
+ }
+
+ extract_grob_set (wish, "right-items", right_items);
+ bool found_matching_column = false;
+ for (vsize j = 0; j < right_items.size (); j++)
+ {
+ Item *it = dynamic_cast<Item *> (right_items[j]);
+ if (it && (right_col == it->get_column ()
+ || right_col->original () == it->get_column ()))
+ found_matching_column = true;
+ }
+
+ /*
+ This is probably a waste of time in the case of polyphonic
+ music. */
+ if (found_matching_column && has_interface<Note_spacing> (wish))
+ {
+ Real inc = options->increment_;
+ Grob *gsp = unsmob<Grob> (left_col->get_object ("grace-spacing"));
+ if (gsp && Paper_column::when_mom (left_col).grace_part_)
+ {
+ Spacing_options grace_opts;
+ grace_opts.init_from_grob (gsp);
+ inc = grace_opts.increment_;
+ }
+ springs.push_back (Note_spacing::get_spacing (wish, right_col, spring, inc));
+ }
+ }