From 41d79cb63739f658ab0e82856f1535e0f7e809db Mon Sep 17 00:00:00 2001 From: Joe Neeman Date: Fri, 11 Jun 2010 09:40:10 +0900 Subject: [PATCH] Fix 1031. 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 | 8 ++------ lily/include/rest-collision.hh | 1 - lily/rest-collision.cc | 33 +++++++-------------------------- 3 files changed, 9 insertions(+), 33 deletions(-) diff --git a/lily/beam.cc b/lily/beam.cc index 1cb48dade1..dfc33cbaa9 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -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 diff --git a/lily/include/rest-collision.hh b/lily/include/rest-collision.hh index 6afe568262..1064edf1bf 100644 --- a/lily/include/rest-collision.hh +++ b/lily/include/rest-collision.hh @@ -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 *); diff --git a/lily/rest-collision.cc b/lily/rest-collision.cc index 1b5b2ee85a..079030bc88 100644 --- a/lily/rest-collision.cc +++ b/lily/rest-collision.cc @@ -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")); -- 2.39.2