]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fix 622.
authorJoe Neeman <joeneeman@gmail.com>
Sat, 17 May 2008 08:40:08 +0000 (18:40 +1000)
committerJoe Neeman <joeneeman@gmail.com>
Sat, 17 May 2008 08:40:08 +0000 (18:40 +1000)
Add a cross-staff property to rests.

lily/include/rest.hh
lily/rest.cc
scm/define-grobs.scm

index ed67c6310704bf855a68a0ac9d0a2aa26c02b7c9..96c2b44cc71a915d8c0eff57b6b6139e3621c4cf 100644 (file)
@@ -17,6 +17,7 @@ class Rest
 {
 public:
   DECLARE_SCHEME_CALLBACK (y_offset_callback, (SCM));
+  DECLARE_SCHEME_CALLBACK (calc_cross_staff, (SCM));
   DECLARE_GROB_INTERFACE();
   static string glyph_name (Grob *, int, string, bool);
   static SCM brew_internal_stencil (Grob*, bool);
index 1abb770d7b307a7150e22ed90be2f746e5124400..22420f54f4def9528dbccb739288d5ca8ade0727 100644 (file)
@@ -46,6 +46,22 @@ Rest::y_offset_callback (SCM smob)
   return scm_from_double (amount);
 }
 
+/* A rest might lie under a beam, in which case it should be cross-staff if
+   the beam is cross-staff because the rest's position depends on the
+   formatting of the beam. */
+MAKE_SCHEME_CALLBACK (Rest, calc_cross_staff, 1);
+SCM
+Rest::calc_cross_staff (SCM smob)
+{
+  Grob *me = unsmob_grob (smob);
+  Grob *stem = unsmob_grob (me->get_object ("stem"));
+
+  if (!stem)
+    return SCM_BOOL_F;
+
+  return stem->get_property ("cross-staff");
+}
+
 /*
   make this function easily usable in C++
 */
index 94e30465e9b7f36b09c88cd0ef45fe65636a1eb8..956a8e0045a039e60528a806eb043076ea589415 100644 (file)
        (Y-extent . ,ly:rest::height)
        (Y-offset . ,ly:rest::y-offset-callback)
        (minimum-distance . 0.25)
+       (cross-staff . ,ly:rest::calc-cross-staff)
        (meta . ((class . Item)
                 (interfaces . (font-interface
                                rhythmic-head-interface