]> git.donarmstrong.com Git - lilypond.git/commitdiff
Be a little more generous with Stem::pure_height.
authorJoe Neeman <joeneeman@gmail.com>
Mon, 6 Aug 2007 12:34:21 +0000 (22:34 +1000)
committerJoe Neeman <joeneeman@gmail.com>
Mon, 6 Aug 2007 12:34:21 +0000 (22:34 +1000)
More checks for cross-staff grobs in Axis_group_interface.

lily/axis-group-interface.cc
lily/stem.cc

index 291c799910e56d6f8109adc593597ac5275ced02..959043274665b2c12916e1a56442dbbf6bf8ea83 100644 (file)
@@ -194,7 +194,8 @@ Axis_group_interface::relative_pure_height (Grob *me, int start, int end)
 
       if (rank > end)
        break;
-      else if (rank >= start && it->pure_is_visible (start, end))
+      else if (rank >= start && it->pure_is_visible (start, end)
+              && !to_boolean (it->get_property ("cross-staff")))
        {
          Interval dims = it->pure_height (common, start, end);
          if (!dims.is_empty ())
@@ -205,7 +206,8 @@ Axis_group_interface::relative_pure_height (Grob *me, int start, int end)
   for (vsize i = 0; i < spanners.size (); i++)
     {
       Interval_t<int> rank_span = spanners[i]->spanned_rank_interval ();
-      if (rank_span[LEFT] <= end && rank_span[RIGHT] >= start)
+      if (rank_span[LEFT] <= end && rank_span[RIGHT] >= start
+         && !to_boolean (spanners[i]->get_property ("cross-staff")))
        {
          Interval dims = spanners[i]->pure_height (common, start, end);
          if (!dims.is_empty ())
index 9ef07652e33bff3df8fc314e793fbed3a4e51c11..4ac91fa7f38ac3d650ca984affadd61000d2bf20 100644 (file)
@@ -240,22 +240,27 @@ Stem::pure_height (SCM smob, SCM start, SCM end)
   if (!is_normal_stem (me))
     return ly_interval2scm (iv);
 
-  /* if we are part of a cross-staff beam, return empty */
-  if (get_beam (me) && Beam::is_cross_staff (get_beam (me)))
-    return ly_interval2scm (iv);
-  
   Real ss = Staff_symbol_referencer::staff_space (me);
-  Real len = scm_to_double (calc_length (smob)) * ss / 2;
-  Direction dir = get_grob_direction (me);
 
-  Interval hp = head_positions (me);
-  if (dir == UP)
-    iv = Interval (0, len);
-  else
-    iv = Interval (-len, 0);
+  if (!to_boolean (me->get_property ("cross-staff")))
+    {
+      Real len = scm_to_double (calc_length (smob)) * ss / 2;
+      Direction dir = get_grob_direction (me);
 
-  if (!hp.is_empty ())
-    iv.translate (hp[dir] * ss / 2);
+      Interval hp = head_positions (me);
+      if (dir == UP)
+       iv = Interval (0, len);
+      else
+       iv = Interval (-len, 0);
+
+      if (!hp.is_empty ())
+       iv.translate (hp[dir] * ss / 2);
+    }
+
+  /* at a minimum, make the pure-height cover the staff symbol */
+  Real rad = Staff_symbol_referencer::staff_radius (me);
+  iv.add_point (-rad * ss);
+  iv.add_point (rad * ss);
 
   return ly_interval2scm (iv);
 }