]> git.donarmstrong.com Git - lilypond.git/commitdiff
More accurate wishcount computation. Fix shadowing bug,
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 7 Jan 2007 02:31:04 +0000 (03:31 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 7 Jan 2007 02:31:04 +0000 (03:31 +0100)
that caused bar sizes to disappear.

lily/staff-spacing.cc

index f89113187ed1c435adc678efc7e518c5374873f9..0f1ec15de111210756d5ff0a20d6ecaa484c895d 100644 (file)
@@ -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;