From: Mike Solomon Date: Sat, 31 Mar 2012 11:36:53 +0000 (+0200) Subject: Brings beamed rests closer to cross staff beams. X-Git-Tag: release/2.15.36-1~12 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=d20634cc1d274c5bef67f2190e211a2bf90e6162;p=lilypond.git Brings beamed rests closer to cross staff beams. --- diff --git a/input/regression/beam-cross-staff-rest.ly b/input/regression/beam-cross-staff-rest.ly new file mode 100644 index 0000000000..572c924266 --- /dev/null +++ b/input/regression/beam-cross-staff-rest.ly @@ -0,0 +1,19 @@ +\version "2.15.36" + +\header { + texidoc = "Placement of beamed cross staff rests should be +reasonably close to beam. +" +} + +Up = \change Staff = "up" +Down = \change Staff = "down" + +\new PianoStaff << + \new Staff = "up" + \relative c'' { + \time 6/8 a2. + c'8[ \Down c,16 \Up fis \Down r fis] \Up + } + \new Staff = "down" { s2. s4. } +>> diff --git a/lily/beam.cc b/lily/beam.cc index 4a27d648e1..4e48d43739 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -1238,9 +1238,16 @@ Beam::rest_collision_callback (SCM smob, SCM prev_offset) || !Beam::normal_stem_count (beam)) return scm_from_double (0.0); + Grob *common_y = rest->common_refpoint (beam, Y_AXIS); + Drul_array pos (robust_scm2drul (beam->get_property ("positions"), Drul_array (0, 0))); + Direction dir = LEFT; + do + pos[dir] += beam->relative_coordinate (common_y, Y_AXIS); + while (flip (&dir) != LEFT); + Real staff_space = Staff_symbol_referencer::staff_space (rest); scale_drul (&pos, staff_space); @@ -1273,7 +1280,6 @@ Beam::rest_collision_callback (SCM smob, SCM prev_offset) + (beam_count - 1) * beam_translation; Real beam_y = stem_y - d * height_of_my_beams; - Grob *common_y = rest->common_refpoint (beam, Y_AXIS); Interval rest_extent = rest->extent (rest, Y_AXIS); rest_extent.translate (offset + rest->get_parent (Y_AXIS)->relative_coordinate (common_y, Y_AXIS)); @@ -1316,7 +1322,8 @@ Beam::pure_rest_collision_callback (SCM smob, return scm_from_double (amount); Grob *beam = unsmob_grob (stem->get_object ("beam")); if (!beam - || !Beam::normal_stem_count (beam)) + || !Beam::normal_stem_count (beam) + || !is_direction (beam->get_property_data ("direction"))) return scm_from_double (amount); Real ss = Staff_symbol_referencer::staff_space (me);