X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fgrob.cc;h=a6b862e04eee586495fd6e1b3aff343e0340678b;hb=a9bb3b4c5d19638083d833cd084280c73e095c16;hp=828ae7f07b40687457f8031475f0a42d9992dc67;hpb=30f2bb655e6f240a795af9f52c1476849b378ead;p=lilypond.git diff --git a/lily/grob.cc b/lily/grob.cc index 828ae7f07b..a6b862e04e 100644 --- a/lily/grob.cc +++ b/lily/grob.cc @@ -20,6 +20,7 @@ #include "grob.hh" #include +#include #include "align-interface.hh" #include "axis-group-interface.hh" @@ -35,6 +36,7 @@ #include "stencil.hh" #include "stream-event.hh" #include "system.hh" +#include "unpure-pure-container.hh" #include "warn.hh" #include "ly-smobs.icc" @@ -78,17 +80,30 @@ Grob::Grob (SCM basicprops) if (get_property_data ("X-extent") == SCM_EOL) set_property ("X-extent", Grob::stencil_width_proc); if (get_property_data ("Y-extent") == SCM_EOL) - set_property ("Y-extent", Grob::stencil_height_proc); + set_property ("Y-extent", + ly_make_unpure_pure_container (Grob::stencil_height_proc, + Grob::pure_stencil_height_proc)); + if (get_property_data ("vertical-skylines") == SCM_EOL) + set_property ("vertical-skylines", + ly_make_unpure_pure_container (Grob::simple_vertical_skylines_from_extents_proc, + Grob::pure_simple_vertical_skylines_from_extents_proc)); + if (get_property_data ("horizontal-skylines") == SCM_EOL) + set_property ("horizontal-skylines", + ly_make_unpure_pure_container (Grob::simple_horizontal_skylines_from_extents_proc, + Grob::pure_simple_horizontal_skylines_from_extents_proc)); } Grob::Grob (Grob const &s) - : dim_cache_ (s.dim_cache_) { original_ = (Grob *) & s; self_scm_ = SCM_EOL; immutable_property_alist_ = s.immutable_property_alist_; mutable_property_alist_ = SCM_EOL; + + for (Axis a = X_AXIS; a < NO_AXES; incr (a)) + dim_cache_ [a] = s.dim_cache_ [a]; + interfaces_ = s.interfaces_; object_alist_ = SCM_EOL; @@ -467,9 +482,11 @@ Grob::extent (Grob *refp, Axis a) const } // We never want nan, so we avoid shifting infinite values. - for (LEFT_and_RIGHT (d)) - if (!isinf (real_ext[d])) - real_ext[d] += offset; + if(!isinf (offset)) + real_ext.translate(offset); + else + this->warning(_f ("ignored infinite %s-offset", + a == X_AXIS ? "X" : "Y")); return real_ext; } @@ -478,7 +495,7 @@ Interval Grob::pure_height (Grob *refp, int start, int end) { SCM iv_scm = get_pure_property ("Y-extent", start, end); - Interval iv = robust_scm2interval (iv_scm, Interval (0, 0)); + Interval iv = robust_scm2interval (iv_scm, Interval ()); Real offset = pure_relative_y_coordinate (refp, start, end); SCM min_ext = get_property ("minimum-Y-extent"); @@ -799,11 +816,10 @@ ADD_INTERFACE (Grob, "color " "cross-staff " "id " - "extra-X-extent " - "extra-Y-extent " "extra-offset " "footnote-music " "forced-spacing " + "horizontal-skylines " "interfaces " "layer " "meta " @@ -814,10 +830,12 @@ ADD_INTERFACE (Grob, "outside-staff-priority " "pure-Y-offset-in-progress " "rotation " + "skyline-horizontal-padding " "springs-and-rods " "staff-symbol " "stencil " "transparent " + "vertical-skylines " "whiteout " ); @@ -843,6 +861,18 @@ Grob::stencil_height (SCM smob) return grob_stencil_extent (me, Y_AXIS); } +MAKE_SCHEME_CALLBACK (Grob, pure_stencil_height, 3); +SCM +Grob::pure_stencil_height (SCM smob, SCM /* beg */, SCM /* end */) +{ + Grob *me = unsmob_grob (smob); + if (unsmob_stencil (me->get_property_data ("stencil"))) + return grob_stencil_extent (me, Y_AXIS); + + return ly_interval2scm (Interval ()); + +} + MAKE_SCHEME_CALLBACK (Grob, y_parent_positioning, 1); SCM Grob::y_parent_positioning (SCM smob) @@ -903,6 +933,20 @@ common_refpoint_of_array (vector const &arr, Grob *common, Axis a) return common; } +Grob * +common_refpoint_of_array (set const &arr, Grob *common, Axis a) +{ + set::iterator it; + + for (it = arr.begin (); it != arr.end (); it++) + if (common) + common = common->common_refpoint (*it, a); + else + common = *it; + + return common; +} + Interval robust_relative_extent (Grob *me, Grob *refpoint, Axis a) {