]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/align-interface.cc
Fix rest-dot-position.ly
[lilypond.git] / lily / align-interface.cc
index 786e91010bf00c10c9958306893a4caf72ab0588..45761f40c8a6cd7a2ffa8ec1dd83bcb1f114f971 100644 (file)
@@ -110,7 +110,8 @@ get_skylines (Grob *me,
       
       child_refpoints.push_back (child_common);
     }
-  Grob *common_refpoint = common_refpoint_of_array (child_refpoints, me, other_axis (a));
+
+  Grob *other_common = common_refpoint_of_array (child_refpoints, me, other_axis (a));
   
   for (vsize i = elements->size (); i--;)
     {
@@ -122,28 +123,30 @@ get_skylines (Grob *me,
         to some absolute reference point */
       if (!pure)
        {
-         Skyline_pair *skys = Skyline_pair::unsmob (g->get_property ("skylines"));
+         Skyline_pair *skys = Skyline_pair::unsmob (g->get_property (a == Y_AXIS
+                                                                     ? "vertical-skylines"
+                                                                     : "horizontal-skylines"));
          if (skys)
            skylines = *skys;
-         else
-           programming_error ("no skylines for alignment-child\n");
 
          /* this is perhaps an abuse of minimum-?-extent: maybe we should create
             another property? But it seems that the only (current) use of
             minimum-Y-extent is to separate vertically-aligned elements */
-         SCM min_extent = g->get_property (a == X_AXIS ? "minimum-X-extent" : "minimum-Y-extent");
+         SCM min_extent = g->get_property (a == X_AXIS
+                                           ? ly_symbol2scm ("minimum-X-extent")
+                                           : ly_symbol2scm ("minimum-Y-extent"));
 
          if (is_number_pair (min_extent))
            {
              Box b;
-             Interval other_extent = g->extent (common_refpoint, other_axis (a));
+             Interval other_extent = g->extent (other_common, other_axis (a));
              b[a] = ly_scm2interval (min_extent);
              b[other_axis (a)] = other_extent;
              if (!other_extent.is_empty ())
                skylines.insert (b, 0, other_axis (a));
            }
 
-         Real offset = child_refpoints[i]->relative_coordinate (common_refpoint, other_axis (a));
+         Real offset = child_refpoints[i]->relative_coordinate (other_common, other_axis (a));
          skylines.shift (offset);
        }
       else
@@ -275,12 +278,12 @@ Align_interface::stretch (Grob *me, Real amount, Axis a)
   Real non_empty_elts = stretchable_children_count (me);
   Real offset = 0.0;
   Direction dir = robust_scm2dir (me->get_property ("stacking-dir"), DOWN);
-  for (vsize i = 0; i < elts.size (); i++)
+  for (vsize i = 1; i < elts.size (); i++)
     {
-      elts[i]->translate_axis (dir * offset, a);
       if (!elts[i]->extent (me, a).is_empty ()
          && !to_boolean (elts[i]->get_property ("keep-fixed-while-stretching")))
        offset += amount / non_empty_elts;
+      elts[i]->translate_axis (dir * offset, a);
     }
   me->flush_extent_cache (Y_AXIS);
 }
@@ -394,22 +397,6 @@ Align_interface::calc_max_stretch (SCM smob)
   return scm_from_double (ret);
 }
 
-/*
-  Find Y-axis parent of G that has a #'forced-distance property. This
-  has the effect of finding the piano-staff given an object in that
-  piano staff.
-
-  FIXME: piano staves no longer have forced-distance. The code that
-  relies on this function (in line-spanner) is broken.
-*/
-Grob *
-find_fixed_alignment_parent (Grob *g)
-{
-  (void) g;
-  programming_error ("deprecated. We don't use forced-distance anymore");
-  return 0;
-}
-
 ADD_INTERFACE (Align_interface,
               
               "Order grobs from top to bottom, left to right, right to left or bottom "