]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/rest-collision.cc
Fix outside-staff placement for children of System.
[lilypond.git] / lily / rest-collision.cc
index e10a7f0cc49fca061aa20925ca41d88a6edff31c..3e823288378faa780767edfbebe2ababb19326f5 100644 (file)
@@ -21,6 +21,7 @@ using namespace std;
 #include "rhythmic-head.hh"
 #include "staff-symbol-referencer.hh"
 #include "stem.hh"
+#include "grob.hh"
 #include "warn.hh"
 
 MAKE_SCHEME_CALLBACK (Rest_collision, force_shift_callback, 1);
@@ -40,7 +41,7 @@ Rest_collision::force_shift_callback (SCM smob)
   return scm_from_double (0.0);
 }
 
-MAKE_SCHEME_CALLBACK (Rest_collision, force_shift_callback_rest, 2);
+MAKE_SCHEME_CALLBACK_WITH_OPTARGS (Rest_collision, force_shift_callback_rest, 2, 1);
 SCM
 Rest_collision::force_shift_callback_rest (SCM rest, SCM offset)
 {
@@ -51,7 +52,8 @@ Rest_collision::force_shift_callback_rest (SCM rest, SCM offset)
     translate REST; we need the result of this translation later on,
     while the offset probably still is 0/calculation-in-progress.
    */
-  rest_grob->translate_axis (scm_to_double (offset), Y_AXIS);
+  if (scm_is_number (offset))
+    rest_grob->translate_axis (scm_to_double (offset), Y_AXIS);
   
   if (Note_column::has_interface (parent))
     force_shift_callback (parent->self_scm ());
@@ -151,7 +153,7 @@ Rest_collision::calc_positioning_done (SCM smob)
 
       Direction d = LEFT;
       do
-       vector_sort (ordered_rests[d], Note_column::shift_compare);
+       vector_sort (ordered_rests[d], Note_column::shift_less);
       while (flip (&d) != LEFT)
        ;
 
@@ -259,7 +261,7 @@ Rest_collision::calc_positioning_done (SCM smob)
   return SCM_UNSPECIFIED;
 }
 
-ADD_INTERFACE (Rest_collision, "rest-collision-interface",
+ADD_INTERFACE (Rest_collision,
               "Move around ordinary rests (not multi-measure-rests) to avoid "
               "conflicts.",