- /*
- We adjust the space following a note only if the next note
- happens after the current note (this is set in the grob
- property SPACING-SEQUENCE.
- */
- for (int i = 0; i < neighbors.size (); i++)
- {
- Grob *wish = neighbors[i];
-
- Item *wish_rcol = Note_spacing::right_column (wish);
- if (Note_spacing::left_column (wish) != lc
- || (wish_rcol != rc && wish_rcol != rc->original_))
- continue;
-
- /*
- This is probably a waste of time in the case of polyphonic
- music. */
- if (Note_spacing::has_interface (wish))
- {
- Real space = 0.0;
- Real fixed = 0.0;
-
- Note_spacing::get_spacing (wish, rc, base_note_space, increment, &space, &fixed);
-
- compound_note_space = compound_note_space + space;
- compound_fixed_note_space = compound_fixed_note_space + fixed;
- wish_count++;
- }
- }
-
- if (Paper_column::when_mom (rc).grace_part_
- && !Paper_column::when_mom (lc).grace_part_)
- {
- /*
- Ugh. 0.8 is arbitrary.
- */
- compound_note_space *= 0.8;
- }
-
- if (compound_note_space < 0 || wish_count == 0)
- {
- compound_note_space = base_note_space;
- compound_fixed_note_space = increment;
- }
+ prev = col;
+ }
+
+ Real padding = robust_scm2double (prev->get_property ("padding"), 0.1);
+ set_column_rods (cols, padding);
+}
+
+/*
+ Generate the space between two musical columns LEFT_COL and RIGHT_COL.
+*/
+void
+Spacing_spanner::musical_column_spacing (Grob *me,
+ Item *left_col,
+ Item *right_col,
+ Spacing_options const *options)
+{
+ Real base_note_space = note_spacing (me, left_col, right_col, options);
+ Spring spring;
+
+ if (options->stretch_uniformly_)
+ spring = Spring (base_note_space, 0.0);
+ else
+ {
+ vector<Spring> springs;
+ 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 && 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));
+ }
+ }
+
+ if (springs.empty ())
+ {
+
+ if (!Paper_column::is_musical (right_col))
+ {
+ /*
+ There used to be code that examined left_col->extent
+ (X_AXIS), but this is resulted in unexpected wide
+ spacing, because the width of s^"text" output is also
+ taken into account here.
+ */
+ spring = Spring (max (base_note_space, options->increment_),
+ options->increment_);
+ }
+ else
+ {
+ /*
+ Min distance should be 0.0. If there are no spacing
+ wishes, we're probably dealing with polyphonic spacing
+ of hemiolas.
+ */
+ spring = Spring (base_note_space, 0.0);
+ }
+ }