From: Han-Wen Nienhuys <hanwen@xs4all.nl>
Date: Sun, 7 Jan 2007 02:31:04 +0000 (+0100)
Subject: More accurate wishcount computation.  Fix shadowing bug,
X-Git-Tag: release/2.11.10-1~27
X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=a87a0e4fb3eab8f4b7997e4e2cead0723d9ec4cb;p=lilypond.git

More accurate wishcount computation.  Fix shadowing bug,
that caused bar sizes to disappear.
---

diff --git a/lily/staff-spacing.cc b/lily/staff-spacing.cc
index f89113187e..0f1ec15de1 100644
--- a/lily/staff-spacing.cc
+++ b/lily/staff-spacing.cc
@@ -107,7 +107,7 @@ Staff_spacing::bar_y_positions (Grob *bar_grob)
 	  || glyph_string.substr (0, 1) == ".")
 	{
 	  Grob *common = bar_grob->common_refpoint (staff_sym, Y_AXIS);
-	  Interval bar_size = bar_grob->extent (common, Y_AXIS);
+	  bar_size = bar_grob->extent (common, Y_AXIS);
 	  bar_size *= 1.0 / Staff_symbol_referencer::staff_space (bar_grob);
 	}
     }
@@ -138,28 +138,33 @@ Staff_spacing::next_notes_correction (Grob *me, Grob *last_grob,
     {
       Grob *g = right_items[i];
 
-      Real space = 0.0;
-      Real fixed = 0.0;
 
-      next_note_correction (me, g, bar_size, &space, &fixed);
-
-      *compound_space += space;
-      *compound_fixed += fixed; 
-      wish_count ++;
-      
-      extract_grob_set (g, "elements", elts);
-      for (vsize j = elts.size (); j--;)
+      if (Note_column::has_interface (g))
 	{
 	  Real space = 0.0;
 	  Real fixed = 0.0;
-	  next_note_correction (me, elts[j], bar_size, &space, &fixed);
-	  *compound_fixed += fixed;
+      
+	  next_note_correction (me, g, bar_size, &space, &fixed);
+
 	  *compound_space += space;
+	  *compound_fixed += fixed; 
 	  wish_count ++;
 	}
+      else
+	{
+	  extract_grob_set (g, "elements", elts);
+	  for (vsize j = elts.size (); j--;)
+	    {
+	      Real space = 0.0;
+	      Real fixed = 0.0;
+	      next_note_correction (me, elts[j], bar_size, &space, &fixed);
+	      *compound_fixed += fixed;
+	      *compound_space += space;
+	      wish_count ++;
+	    }
+	}
     }
-
-  if (wish_count)
+  if (wish_count > 1)
     {
       *compound_space /= wish_count;
       *compound_fixed /= wish_count;