]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fix 1031.
authorJoe Neeman <joeneeman@gmail.com>
Fri, 11 Jun 2010 00:40:10 +0000 (09:40 +0900)
committerJoe Neeman <joeneeman@gmail.com>
Sat, 19 Jun 2010 08:44:29 +0000 (11:44 +0300)
Prevent ly:beam::rest-collision-callback (which is used in the calculation
of a rest's Y-offset) from asking for the rest's Y-offset.

lily/beam.cc
lily/include/rest-collision.hh
lily/rest-collision.cc

index 1cb48dade12133fa2e0dfc56ffe4a35d17014f3c..dfc33cbaa9d235d0391adfbd16733344b5d5401d 100644 (file)
@@ -1468,12 +1468,8 @@ Beam::rest_collision_callback (SCM smob, SCM prev_offset)
 
   Grob *common_y = rest->common_refpoint (beam, Y_AXIS);
 
-  /*
-    TODO: this is dubious, because this call needs the info we're
-    computing right now.
-   */
-  Interval rest_extent = rest->extent (common_y, Y_AXIS);
-  rest_extent.translate (offset);
+  Interval rest_extent = rest->extent (rest, Y_AXIS);
+  rest_extent.translate (offset + rest->get_parent (Y_AXIS)->relative_coordinate (common_y, Y_AXIS));
 
   Real rest_dim = rest_extent[d];
   Real minimum_distance
index 6afe56826281e1db3382fa484d500e45da3fcd11..1064edf1bfcd9325f80fb888227219d27c6f294f 100644 (file)
@@ -29,7 +29,6 @@ public:
   static void add_column (Grob *me, Grob *);
 
   DECLARE_GROB_INTERFACE();
-  DECLARE_SCHEME_CALLBACK (force_shift_callback, (SCM element));
   DECLARE_SCHEME_CALLBACK (calc_positioning_done, (SCM element));
   DECLARE_SCHEME_CALLBACK (force_shift_callback_rest, (SCM element, SCM off));
   static SCM do_shift (Grob *);
index 1b5b2ee85a70eca7a178996103c05fd90f9f7ce2..079030bc883d640856da6dfce999c02620ecb26d 100644 (file)
@@ -36,23 +36,6 @@ using namespace std;
 #include "grob.hh"
 #include "warn.hh"
 
-MAKE_SCHEME_CALLBACK (Rest_collision, force_shift_callback, 1);
-SCM
-Rest_collision::force_shift_callback (SCM smob)
-{
-  Grob *them = unsmob_grob (smob);
-  if (Note_column::has_rests (them))
-    {
-      Grob *collision = unsmob_grob (them->get_object ("rest-collision"));
-
-      if (collision)
-       {
-         (void) collision->get_property ("positioning-done");
-       }
-    }
-  return scm_from_double (0.0);
-}
-
 MAKE_SCHEME_CALLBACK_WITH_OPTARGS (Rest_collision, force_shift_callback_rest, 2, 1, "");
 SCM
 Rest_collision::force_shift_callback_rest (SCM rest, SCM offset)
@@ -67,8 +50,13 @@ Rest_collision::force_shift_callback_rest (SCM rest, SCM offset)
   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 ());
+  if (Note_column::has_interface (parent) && Note_column::has_rests (parent))
+    {
+      Grob *collision = unsmob_grob (parent->get_object ("rest-collision"));
+
+      if (collision)
+       (void) collision->get_property ("positioning-done");
+    }
 
   return scm_from_double (0.0);
 }
@@ -78,13 +66,6 @@ Rest_collision::add_column (Grob *me, Grob *p)
 {
   Pointer_group_interface::add_grob (me, ly_symbol2scm ("elements"), p);
 
-  /*
-    only add callback for the rests, since we don't move anything
-    else.
-
-    (not?)
-  */
-  add_offset_callback (p, Rest_collision::force_shift_callback_proc, Y_AXIS);
   p->set_object ("rest-collision", me->self_scm ());
 
   Grob *rest = unsmob_grob (p->get_object ("rest"));