]> git.donarmstrong.com Git - lilypond.git/commitdiff
fix spacing regressions up to spacing-folded-clef
authorJoe Neeman <joeneeman@gmail.com>
Wed, 27 Jun 2007 04:26:25 +0000 (07:26 +0300)
committerJoe Neeman <joeneeman@gmail.com>
Wed, 27 Jun 2007 04:26:25 +0000 (07:26 +0300)
lily/include/spacing-interface.hh
lily/note-spacing.cc
lily/simple-spacer.cc
lily/spacing-interface.cc

index e670d8a0fa00bdcfcc475316b96d08da4ee95c84..14b8c2bf03c468fa9bdab9365a33d371b683e080 100644 (file)
@@ -18,6 +18,7 @@ struct Spacing_interface
   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();
 };
index 6577fa70856b610af41a7a2d30764ecb079b832c..61af354f4cb1ebc161c289437a86e0333156db2a 100644 (file)
@@ -65,8 +65,16 @@ Note_spacing::get_spacing (Grob *me, Item *right_col,
     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);
index 4b30033601b29b74c4d14c205b40d5115a14a1f4..8e0722438e4195c7fa45a4cb544639dd9849079a 100644 (file)
@@ -81,7 +81,7 @@ Real
 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;
 }
index 6b0964df1e664e233ae41eaef28be1904a761a23..dbfe4e43c6dd1e4dc9cea9cf7632de16aacc7cc5 100644 (file)
 #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,
@@ -65,6 +66,14 @@ Spacing_interface::minimum_distance (Grob *me, Grob *right_col)
     }
   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]));
 }