X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Ftuplet-bracket.cc;h=3228c9f7b6edab7b79b7c7dbea8500b3284fafe0;hb=5d84bfad4626892bcffd05adcced53c8a2329047;hp=17e1194de80762822da92ed5e7d8767bc6a8a7d0;hpb=8920247a80a350aaab540166ab7a4937f45786a6;p=lilypond.git diff --git a/lily/tuplet-bracket.cc b/lily/tuplet-bracket.cc index 17e1194de8..3228c9f7b6 100644 --- a/lily/tuplet-bracket.cc +++ b/lily/tuplet-bracket.cc @@ -41,6 +41,8 @@ */ #include "tuplet-bracket.hh" + +#include "bracket.hh" #include "axis-group-interface.hh" #include "line-interface.hh" #include "beam.hh" @@ -373,15 +375,15 @@ Tuplet_bracket::print (SCM smob) } } - Stencil brack = make_bracket (me, Y_AXIS, - points[RIGHT] - points[LEFT], - height, - /* - 0.1 = more space at right due to italics - TODO: use italic correction of font. - */ - Interval (-0.5, 0.5) * gap + 0.1, - flare, shorten); + Stencil brack = + Bracket::make_bracket ( + me, Y_AXIS, points[RIGHT] - points[LEFT], height, + /* + 0.1 = more space at right due to italics + TODO: use italic correction of font. + */ + Interval (-0.5, 0.5) * gap + 0.1, + flare, shorten); for (LEFT_and_RIGHT (d)) { @@ -396,64 +398,6 @@ Tuplet_bracket::print (SCM smob) return mol.smobbed_copy (); } -/* - should move to lookup? - - TODO: this will fail for very short (shorter than the flare) - brackets. -*/ -Stencil -Tuplet_bracket::make_bracket (Grob *me, // for line properties. - Axis protrusion_axis, - Offset dz, - Drul_array height, - Interval gap, - Drul_array flare, - Drul_array shorten) -{ - Drul_array corners (Offset (0, 0), dz); - - Real length = dz.length (); - Drul_array gap_corners; - - Axis bracket_axis = other_axis (protrusion_axis); - - Drul_array straight_corners = corners; - - for (LEFT_and_RIGHT (d)) - straight_corners[d] += -d * shorten[d] / length * dz; - - if (!gap.is_empty ()) - { - for (LEFT_and_RIGHT (d)) - gap_corners[d] = (dz * 0.5) + gap[d] / length * dz; - } - - Drul_array flare_corners = straight_corners; - for (LEFT_and_RIGHT (d)) - { - flare_corners[d][bracket_axis] = straight_corners[d][bracket_axis]; - flare_corners[d][protrusion_axis] += height[d]; - straight_corners[d][bracket_axis] += -d * flare[d]; - } - - Stencil m; - if (!gap.is_empty ()) - for (LEFT_and_RIGHT (d)) - m.add_stencil (Line_interface::line (me, straight_corners[d], - gap_corners[d])); - else - m.add_stencil (Line_interface::line (me, straight_corners[LEFT], - straight_corners[RIGHT])); - - if (scm_is_number (me->get_property ("dash-fraction"))) - me->set_property ("dash-fraction", scm_from_double (1.0)); - for (LEFT_and_RIGHT (d)) - m.add_stencil (Line_interface::line (me, straight_corners[d], - flare_corners[d])); - return m; -} - void Tuplet_bracket::get_bounds (Grob *me, Grob **left, Grob **right) { @@ -540,7 +484,7 @@ Tuplet_bracket::calc_position_and_height (Grob *me_grob, Real *offset, Real *dy) if (Grob *beam = Stem::get_beam (stems[side])) (void) beam->get_property ("quantized-positions"); poss[side] = stems[side]->extent (stems[side], Y_AXIS)[get_grob_direction (stems[side])] - + stems[side]->get_parent (Y_AXIS)->relative_coordinate (commony, Y_AXIS); + + stems[side]->parent_relative (commony, Y_AXIS); } *dy = poss[RIGHT] - poss[LEFT];