From 18b1e6e9649bddeaccdd4b4daa74cda0324b8fb3 Mon Sep 17 00:00:00 2001 From: Joe Neeman Date: Wed, 7 Feb 2007 09:41:11 +0200 Subject: [PATCH] Make sure cross-staff tuplet brackets belong to the right staff. --- .../regression/tuplet-bracket-cross-staff.ly | 21 +++++++++++++++++++ lily/include/slur.hh | 2 +- lily/slur.cc | 4 ++-- lily/tuplet-bracket.cc | 9 ++++++-- lily/tuplet-number.cc | 2 +- 5 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 input/regression/tuplet-bracket-cross-staff.ly diff --git a/input/regression/tuplet-bracket-cross-staff.ly b/input/regression/tuplet-bracket-cross-staff.ly new file mode 100644 index 0000000000..58c4321985 --- /dev/null +++ b/input/regression/tuplet-bracket-cross-staff.ly @@ -0,0 +1,21 @@ +\version "2.11.16" +\paper { ragged-right = ##t } +\layout { + \context { + \Score + \override TupletBracket #'bracket-visibility = ##t + } +} + +voice = { + \times 2/3 { b8 \change Staff=RH c' d' } + \times 2/3 { d' c' \change Staff=LH b } +} + +\score { + \new PianoStaff + << + \new Staff = "RH" { s4 s4 s4 } + \new Staff = "LH" { \clef bass \voice } + >> +} \ No newline at end of file diff --git a/lily/include/slur.hh b/lily/include/slur.hh index a5ea54e77e..3680c73749 100644 --- a/lily/include/slur.hh +++ b/lily/include/slur.hh @@ -27,7 +27,7 @@ public: DECLARE_SCHEME_CALLBACK (height, (SCM)); DECLARE_SCHEME_CALLBACK (outside_slur_callback, (SCM, SCM)); DECLARE_SCHEME_CALLBACK (pure_outside_slur_callback, (SCM, SCM, SCM, SCM)); - DECLARE_SCHEME_CALLBACK (cross_staff, (SCM)); + DECLARE_SCHEME_CALLBACK (calc_cross_staff, (SCM)); DECLARE_GROB_INTERFACE(); static Bezier get_curve (Grob *me); }; diff --git a/lily/slur.cc b/lily/slur.cc index 1bb88339a6..8c2e36106f 100644 --- a/lily/slur.cc +++ b/lily/slur.cc @@ -356,9 +356,9 @@ Slur::auxiliary_acknowledge_extra_object (Grob_info const &info, e->name().c_str ())); } -MAKE_SCHEME_CALLBACK (Slur, cross_staff, 1) +MAKE_SCHEME_CALLBACK (Slur, calc_cross_staff, 1) SCM -Slur::cross_staff (SCM smob) +Slur::calc_cross_staff (SCM smob) { Grob *me = unsmob_grob (smob); Grob *staff = Staff_symbol_referencer::get_staff_symbol (me); diff --git a/lily/tuplet-bracket.cc b/lily/tuplet-bracket.cc index 6733b97da8..faa25a85ca 100644 --- a/lily/tuplet-bracket.cc +++ b/lily/tuplet-bracket.cc @@ -542,8 +542,11 @@ Tuplet_bracket::calc_position_and_height (Grob *me_grob, Real *offset, Real *dy) Real ss = 0.5 * Staff_symbol_referencer::staff_space (me); - Real lp = ss * robust_scm2double (stems[LEFT]->get_property ("stem-end-position"), 0.0); - Real rp = ss * robust_scm2double (stems[RIGHT]->get_property ("stem-end-position"), 0.0); + Real my_parent_offset = me->get_parent (Y_AXIS)->relative_coordinate (commony, Y_AXIS); + Real lp = ss * robust_scm2double (stems[LEFT]->get_property ("stem-end-position"), 0.0) + + stems[LEFT]->get_parent (Y_AXIS)->relative_coordinate (commony, Y_AXIS) - my_parent_offset; + Real rp = ss * robust_scm2double (stems[RIGHT]->get_property ("stem-end-position"), 0.0) + + stems[RIGHT]->get_parent (Y_AXIS)->relative_coordinate (commony, Y_AXIS) - my_parent_offset; *dy = rp - lp; points.push_back (Offset (stems[LEFT]->relative_coordinate (commonx, X_AXIS) - x0, lp)); @@ -654,6 +657,8 @@ Tuplet_bracket::calc_position_and_height (Grob *me_grob, Real *offset, Real *dy) Kind of pointless since we put them outside the staff anyway, but let's leave code for the future when possibly allow them to move into the staff once again. + + This doesn't seem to support cross-staff tuplets atm. */ if (*dy == 0 && fabs (*offset) < ss * Staff_symbol_referencer::staff_radius (me)) diff --git a/lily/tuplet-number.cc b/lily/tuplet-number.cc index 7ace42eb3a..22d857bdd2 100644 --- a/lily/tuplet-number.cc +++ b/lily/tuplet-number.cc @@ -72,7 +72,7 @@ SCM Tuplet_number::calc_cross_staff (SCM smob) { Grob *me = unsmob_grob (smob); - return unsmob_grob (me->get_object ("bracket"))->get_property ("cross_staff"); + return unsmob_grob (me->get_object ("bracket"))->get_property ("cross-staff"); } ADD_INTERFACE (Tuplet_number, -- 2.39.5