static vector<Item*> left_note_columns (Grob *me);
static Item* right_column (Grob *me);
static Item* left_column (Grob *me);
+ static Drul_array<Skyline> skylines (Grob *me, Grob *right_col);
DECLARE_GROB_INTERFACE();
};
the full amount of space. We give them half the amount of space, but then
adjust things so there are no collisions.
*/
- Real min_dist = Spacing_interface::minimum_distance (me, right_col);
+ Drul_array<Skyline> skys = Spacing_interface::skylines (me, right_col);
+ Real min_dist = max (0.0, skys[LEFT].distance (skys[RIGHT]));
Real min_desired_space = left_head_end + (min_dist - left_head_end) / 2;
+
+ /* if the right object sticks out a lot, include a bit of extra space.
+ But only for non-musical-columns; this shouldn't apply to accidentals */
+ if (!Paper_column::is_musical (right_col))
+ min_desired_space = max (min_desired_space,
+ left_head_end + LEFT * skys[RIGHT].max_height ());
+
Real ideal = base_space - increment + min_desired_space;
stem_dir_correction (me, right_col, increment, &ideal, &min_desired_space);
Simple_spacer::rod_force (int l, int r, Real dist)
{
Real d = range_ideal_len (l, r);
- Real c = range_stiffness (l, r, d > dist);
+ Real c = range_stiffness (l, r, dist > d);
Real block_stretch = dist - d;
return c * block_stretch;
}
#include "separation-item.hh"
#include "skyline.hh"
-/* return the minimum distance between the left-items and the right-items of
- this spacing object */
-Real
-Spacing_interface::minimum_distance (Grob *me, Grob *right_col)
+/* return the right-pointing skyline of the left-items and the left-pointing
+ skyline of the right-items (with the skyline of the left-items in
+ ret[LEFT]) */
+Drul_array<Skyline>
+Spacing_interface::skylines (Grob *me, Grob *right_col)
{
/* the logic here is a little convoluted.
A {Staff,Note}_spacing doesn't copy left-items when it clones,
}
while (flip (&d) != LEFT);
+ return skylines;
+}
+
+Real
+Spacing_interface::minimum_distance (Grob *me, Grob *right)
+{
+ Drul_array<Skyline> skylines = Spacing_interface::skylines (me, right);
+
return max (0.0, skylines[LEFT].distance (skylines[RIGHT]));
}