From: Mike Solomon Date: Wed, 15 Feb 2012 07:12:03 +0000 (+0100) Subject: Correctly determines if glissandi are cross-staff X-Git-Tag: release/2.15.30-1~12 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=832857653060b17464516f6b65fd68e73724e3e8;p=lilypond.git Correctly determines if glissandi are cross-staff --- diff --git a/input/regression/glissando-cross-staff.ly b/input/regression/glissando-cross-staff.ly new file mode 100644 index 0000000000..2e687e618a --- /dev/null +++ b/input/regression/glissando-cross-staff.ly @@ -0,0 +1,20 @@ +\version "2.15.29" +\header { + texidoc = "Cross staff glissandi reach their endpoints correctly. +" +} + +\new PianoStaff << +\new Staff = "right" { + e'''2\glissando + \change Staff = "left" + + a,,\glissando + \change Staff = "right" + b''8 +} +\new Staff = "left" { + \clef bass + s1 s8 +} +>> diff --git a/lily/line-spanner.cc b/lily/line-spanner.cc index 6397046726..028fe20e15 100644 --- a/lily/line-spanner.cc +++ b/lily/line-spanner.cc @@ -38,6 +38,7 @@ class Line_spanner { public: DECLARE_SCHEME_CALLBACK (print, (SCM)); + DECLARE_SCHEME_CALLBACK (calc_cross_staff, (SCM)); DECLARE_SCHEME_CALLBACK (calc_left_bound_info, (SCM)); DECLARE_SCHEME_CALLBACK (calc_left_bound_info_and_text, (SCM)); DECLARE_SCHEME_CALLBACK (calc_right_bound_info, (SCM)); @@ -200,6 +201,22 @@ Line_spanner::calc_bound_info (SCM smob, Direction dir) return details; } +MAKE_SCHEME_CALLBACK (Line_spanner, calc_cross_staff, 1); +SCM +Line_spanner::calc_cross_staff (SCM smob) +{ + Spanner *me = unsmob_spanner (smob); + if (!me) + return SCM_BOOL_F; + + if (to_boolean (me->get_bound (LEFT)->get_property ("non-musical")) + || to_boolean (me->get_bound (RIGHT)->get_property ("non-musical"))) + return SCM_BOOL_F; + + return scm_from_bool (Staff_symbol_referencer::get_staff_symbol (me->get_bound (LEFT)) + != Staff_symbol_referencer::get_staff_symbol (me->get_bound (RIGHT))); +} + MAKE_SCHEME_CALLBACK (Line_spanner, calc_right_bound_info, 1); SCM Line_spanner::calc_right_bound_info (SCM smob) diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index 1b9507a0b8..4413033434 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -970,6 +970,7 @@ (padding . 0.5) )) )) + (cross-staff . ,ly:line-spanner::calc-cross-staff) (gap . 0.5) (left-bound-info . ,ly:line-spanner::calc-left-bound-info) (normalized-endpoints . ,ly:spanner::calc-normalized-endpoints)