]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fix beaming problems with cross-staff beams and slurs.
authorJoe Neeman <joeneeman@gmail.com>
Fri, 4 Jul 2008 06:50:48 +0000 (09:50 +0300)
committerJoe Neeman <joeneeman@gmail.com>
Fri, 4 Jul 2008 06:50:48 +0000 (09:50 +0300)
Mark as cross-staff any grob that is outside or around a
cross-staff slur.

lily/grob-closure.cc
lily/include/grob.hh
lily/include/slur.hh
lily/slur.cc

index b2d0160adaf175942ff0e1e5a057cf7d57ff1dff..124d1437932c034f7fa5e2ba1dd5195585dac6ad 100644 (file)
@@ -67,9 +67,9 @@ add_offset_callback (Grob *g, SCM proc, Axis a)
 
 */
 void
-chain_offset_callback (Grob *g, SCM proc, Axis a)
+chain_callback (Grob *g, SCM proc, SCM sym)
 {
-  SCM data = g->get_property_data (axis_offset_symbol (a));
+  SCM data = g->get_property_data (sym);
 
   if (ly_is_procedure (data))
     data = ly_make_simple_closure (scm_list_1  (data));
@@ -84,9 +84,15 @@ chain_offset_callback (Grob *g, SCM proc, Axis a)
     data = SCM_UNDEFINED;
 
   SCM expr = scm_list_2 (proc, data);
-  g->set_property (axis_offset_symbol (a),
+  g->set_property (sym,
                   
                   // twice: one as a wrapper for grob property routines,
                   // once for the actual delayed binding. 
                   ly_make_simple_closure (ly_make_simple_closure (expr)));
 }
+
+void
+chain_offset_callback (Grob *g, SCM proc, Axis a)
+{
+  chain_callback (g, proc, axis_offset_symbol (a));
+}
index 82591eb7c37240f75e0b98b1f0893e4490820805..f0191e3e446570b1db9c4ebd55b8f9756c4e444e 100644 (file)
@@ -146,6 +146,7 @@ Interval robust_relative_extent (Grob *, Grob *, Axis);
 /* offset/extent callbacks. */
 void add_offset_callback (Grob *g, SCM proc, Axis a);
 void chain_offset_callback (Grob *g, SCM proc, Axis a);
+void chain_callback (Grob *g, SCM proc, SCM sym);
 SCM axis_offset_symbol (Axis a);
 SCM axis_parent_positioning (Axis a);
 
index 3680c7374965477060e1c652ec463267ed5d725e..5059bdff9645cdf847ca3050c064c7042823d13f 100644 (file)
@@ -27,6 +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 (outside_slur_cross_staff, (SCM, SCM));
   DECLARE_SCHEME_CALLBACK (calc_cross_staff, (SCM));
   DECLARE_GROB_INTERFACE();
   static Bezier get_curve (Grob *me);
index 3d47e876fc07ce0c18d21803f0ce2840f3f52ae5..faa40725ad4644cb9024c70242180f25830b9ef2 100644 (file)
@@ -349,6 +349,7 @@ Slur::auxiliary_acknowledge_extra_object (Grob_info const &info,
       if (slur)
        {
          chain_offset_callback (e, outside_slur_callback_proc, Y_AXIS);
+         chain_callback (e, outside_slur_cross_staff_proc, ly_symbol2scm("cross-staff"));
          e->set_object ("slur", slur->self_scm ());
        }
     }
@@ -357,6 +358,27 @@ Slur::auxiliary_acknowledge_extra_object (Grob_info const &info,
                    e->name().c_str ()));
 }
 
+/*
+  A callback that will be chained together with the original cross-staff
+  value of a grob that is placed 'outside or 'around a slur. This just says
+  that any grob becomes cross-staff if it is placed 'outside or 'around a
+  cross-staff slur.
+*/
+MAKE_SCHEME_CALLBACK (Slur, outside_slur_cross_staff, 2)
+SCM
+Slur::outside_slur_cross_staff (SCM smob, SCM previous)
+{
+  if (previous == SCM_BOOL_T)
+    return previous;
+
+  Grob *me = unsmob_grob (smob);
+  Grob *slur = unsmob_grob (me->get_object ("slur"));
+
+  if (!slur)
+    return SCM_BOOL_F;
+  return slur->get_property ("cross-staff");
+}
+
 MAKE_SCHEME_CALLBACK (Slur, calc_cross_staff, 1)
 SCM
 Slur::calc_cross_staff (SCM smob)