+ /* Maybe we are in the second pass of a two-pass spacing run. In that
+ case, the Y-extent of a system is already given to us */
+ System *system = dynamic_cast<System*> (me);
+ if (system)
+ {
+ SCM line_break_details = system->column (start)->get_property ("line-break-system-details");
+ SCM system_y_extent = scm_assq (ly_symbol2scm ("system-Y-extent"), line_break_details);
+ if (scm_is_pair (system_y_extent))
+ return scm_cdr (system_y_extent);
+ }
+
+ return ly_interval2scm (pure_group_height (me, start, end));
+}
+
+MAKE_SCHEME_CALLBACK (Axis_group_interface, calc_skylines, 1);
+SCM
+Axis_group_interface::calc_skylines (SCM smob)
+{
+ Grob *me = unsmob_grob (smob);
+ extract_grob_set (me, "elements", elts);
+ Skyline_pair skylines = skyline_spacing (me, elts);
+
+ /* add a minimum-Y-extent-sized box to the skyline */
+ SCM min_y_extent = me->get_property ("minimum-Y-extent");
+ if (is_number_pair (min_y_extent))
+ {
+ Box b (me->extent (me, X_AXIS), ly_scm2interval (min_y_extent));
+ skylines.insert (b, 0, X_AXIS);
+ }
+ return skylines.smobbed_copy ();
+}
+
+/* whereas calc_skylines calculates skylines for axis-groups with a lot of
+ visible children, combine_skylines is designed for axis-groups whose only
+ children are other axis-groups (ie. VerticalAlignment). Rather than
+ calculating all the skylines from scratch, we just merge the skylines
+ of the children.
+*/
+MAKE_SCHEME_CALLBACK (Axis_group_interface, combine_skylines, 1);
+SCM
+Axis_group_interface::combine_skylines (SCM smob)
+{
+ Grob *me = unsmob_grob (smob);
+ extract_grob_set (me, "elements", elements);
+ Grob *y_common = common_refpoint_of_array (elements, me, Y_AXIS);
+ Grob *x_common = common_refpoint_of_array (elements, me, X_AXIS);
+
+ if (y_common != me)
+ programming_error ("combining skylines that don't belong to me");
+
+ Skyline_pair ret;
+ for (vsize i = 0; i < elements.size (); i++)
+ {
+ SCM skyline_scm = elements[i]->get_property ("vertical-skylines");
+ if (Skyline_pair::unsmob (skyline_scm))
+ {
+ Real offset = elements[i]->relative_coordinate (y_common, Y_AXIS);
+ Skyline_pair other = *Skyline_pair::unsmob (skyline_scm);
+ other.raise (offset);
+ other.shift (elements[i]->relative_coordinate (x_common, X_AXIS));
+ ret.merge (other);
+ }
+ }
+ return ret.smobbed_copy ();