]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/note-spacing.cc
Run `make grand-replace'.
[lilypond.git] / lily / note-spacing.cc
index cd97c179704a9feca75780ed2545215c87b1193d..2cc5c70ae2369c38b47a87309ebf1ca715ca8218 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 2001--2007  Han-Wen Nienhuys <hanwen@xs4all.nl>
+  (c) 2001--2008  Han-Wen Nienhuys <hanwen@xs4all.nl>
 */
 
 #include "note-spacing.hh"
 #include "output-def.hh"
 #include "pointer-group-interface.hh"
 
+static bool
+non_empty_barline (Grob *me)
+{
+  return Bar_line::has_interface (me) && !me->extent (me, X_AXIS).is_empty ();
+}
+
 /*
   TODO: detect hshifts due to collisions, and account for them in
   spacing?
@@ -74,11 +80,13 @@ Note_spacing::get_spacing (Grob *me, Item *right_col,
 
   /* If we have a NonMusical column on the right, we measure the ideal distance
      to the bar-line (if present), not the start of the column. */
-  if (!Paper_column::is_musical (right_col) && !skys[RIGHT].is_empty ())
+  if (!Paper_column::is_musical (right_col)
+      && !skys[RIGHT].is_empty ()
+      && to_boolean (me->get_property ("space-to-barline")))
     {
       Grob *bar = Pointer_group_interface::find_grob (right_col,
                                                      ly_symbol2scm ("elements"),
-                                                     Bar_line::has_interface);
+                                                     non_empty_barline);
 
       if (bar)
        {
@@ -86,11 +94,15 @@ Note_spacing::get_spacing (Grob *me, Item *right_col,
          ideal -= shift;
          min_desired_space -= max (shift, 0.0);
        }
+      else
+       ideal -= right_col->extent (right_col, X_AXIS)[RIGHT];
     }
 
   ideal = max (ideal, min_desired_space);
   stem_dir_correction (me, right_col, increment, &ideal, &min_desired_space);
 
+  /* TODO: grace notes look bad when things are stretched. Should we increase
+     their stretch strength? */
   Spring ret (max (0.0, ideal), min_dist);
   ret.set_inverse_compress_strength (max (0.0, ideal - min_desired_space));
   ret.set_inverse_stretch_strength (max (0.1, base_space - increment));
@@ -307,12 +319,12 @@ Note_spacing::stem_dir_correction (Grob *me, Item *rcolumn,
 ADD_INTERFACE (Note_spacing,
               "This object calculates spacing wishes for individual voices.",
 
-              
+              /* properties */
               "knee-spacing-correction "
               "left-items "
               "right-items "
               "same-direction-correction "
               "stem-spacing-correction "
-
+              "space-to-barline "
               );