X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Falign-interface.cc;h=daffa298fb1226d7c029034a81fa61aab3b2ebea;hb=5b6e9e92849785962a1b1831eeef20e12af5d2d5;hp=7294335bd9845d961cc1457b3880f936e8632f79;hpb=ce5cfa4a4b6e94655d12e3f1a1719bde789d2127;p=lilypond.git diff --git a/lily/align-interface.cc b/lily/align-interface.cc index 7294335bd9..daffa298fb 100644 --- a/lily/align-interface.cc +++ b/lily/align-interface.cc @@ -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,7 +123,9 @@ 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; @@ -136,14 +139,14 @@ get_skylines (Grob *me, 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 @@ -185,9 +188,7 @@ Align_interface::get_extents_aligned_translates (Grob *me, line_break_details = me_spanner->get_bound (LEFT)->get_property ("line-break-system-details"); if (!me->get_system () && !pure) - me->warning (_ ("vertical alignment called before line-breaking.\n" - "Only do cross-staff spanners with PianoStaff.")); - + me->programming_error ("vertical alignment called before line-breaking"); } Direction stacking_dir = robust_scm2dir (me->get_property ("stacking-dir"), @@ -220,6 +221,9 @@ Align_interface::get_extents_aligned_translates (Grob *me, dy = down_skyline.distance (skylines[j][-stacking_dir]); } + if (isinf (dy)) /* if the skyline is empty, maybe max_height is infinity_f */ + dy = 0.0; + dy = max (0.0, dy + padding + extra_space / elems.size ()); down_skyline.raise (-stacking_dir * dy); where += stacking_dir * dy; @@ -275,12 +279,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); } @@ -395,18 +399,16 @@ Align_interface::calc_max_stretch (SCM smob) } ADD_INTERFACE (Align_interface, + "Order grobs from top to bottom, left to right, right to left" + " or bottom to top. For vertical alignments of staves, the" + " @code{break-system-details} of the left" + " @internalsref{NonMusicalPaperColumn} may be set to tune" + " vertical spacing. Set @code{alignment-extra-space} to add" + " extra space for staves. Set" + " @code{fixed-alignment-extra-space} to force staves in" + " @code{PianoStaff}s further apart.", - "Order grobs from top to bottom, left to right, right to left or bottom " - "to top. " - "For vertical alignments of staves, the @code{break-system-details} of " - "the left @internalsref{NonMusicalPaperColumn} may be set to tune vertical spacing " - "Set @code{alignment-extra-space} to add extra space for staves. Set " - "@code{fixed-alignment-extra-space} to force staves in PianoStaves further apart." - , - - /* - properties - */ + /* properties */ "align-dir " "axes " "elements "