]> git.donarmstrong.com Git - lilypond.git/commitdiff
Make sure cross-staff tuplet brackets belong to the right staff.
authorJoe Neeman <joeneeman@gmail.com>
Wed, 7 Feb 2007 07:41:11 +0000 (09:41 +0200)
committerJoe Neeman <joeneeman@gmail.com>
Wed, 7 Feb 2007 07:41:11 +0000 (09:41 +0200)
input/regression/tuplet-bracket-cross-staff.ly [new file with mode: 0644]
lily/include/slur.hh
lily/slur.cc
lily/tuplet-bracket.cc
lily/tuplet-number.cc

diff --git a/input/regression/tuplet-bracket-cross-staff.ly b/input/regression/tuplet-bracket-cross-staff.ly
new file mode 100644 (file)
index 0000000..58c4321
--- /dev/null
@@ -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
index a5ea54e77e69fa0bd784114e4e77ab7facae6708..3680c7374965477060e1c652ec463267ed5d725e 100644 (file)
@@ -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);
 };
index 1bb88339a6d254a540956d12d067d1ca8d55416f..8c2e36106f8a410e8bfd414c058ed477d7177283 100644 (file)
@@ -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);
index 6733b97da81a26b1326a3850dba2e544f5d1ff28..faa25a85ca6a06e9203c3fde6fa6fed830855b83 100644 (file)
@@ -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))
index 7ace42eb3a413429552834cdd5773451407908a9..22d857bdd2a2a2fb04f34eef3877de334230d2f1 100644 (file)
@@ -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,