X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fgrob.cc;h=f7bf31f2868db17937bfa33d1a64b4d35d2c9602;hb=8920247a80a350aaab540166ab7a4937f45786a6;hp=2377a5d963f92d794916185c6518b395fcf29aca;hpb=958e95822083954cad00e0a598eb9f12ceba67b9;p=lilypond.git diff --git a/lily/grob.cc b/lily/grob.cc index 2377a5d963..f7bf31f286 100644 --- a/lily/grob.cc +++ b/lily/grob.cc @@ -38,6 +38,7 @@ #include "system.hh" #include "unpure-pure-container.hh" #include "warn.hh" +#include "lily-imports.hh" Grob * @@ -141,15 +142,36 @@ Grob::get_print_stencil () const retval = *m; bool transparent = to_boolean (get_property ("transparent")); + /* Process whiteout before color and grob-cause to prevent colored */ + /* whiteout background and larger file sizes with \pointAndClickOn. */ + /* A grob has to be visible, otherwise the whiteout property has no effect. */ + /* Calls the scheme procedure stencil-whiteout in scm/stencils.scm */ + if (!transparent && (scm_is_number (get_property("whiteout")) + || to_boolean (get_property ("whiteout")))) + { + Real thickness = robust_scm2double (get_property("whiteout"), 3.0) + * layout ()->get_dimension (ly_symbol2scm ("line-thickness")); + retval = *unsmob + (Lily::stencil_whiteout (retval.smobbed_copy (), + scm_from_double (thickness))); + } + + /* Calls the scheme procedure stencil-whiteout-box in scm/stencils.scm */ + if (!transparent && to_boolean (get_property ("whiteout-box"))) + { + retval = *unsmob + (Lily::stencil_whiteout_box (retval.smobbed_copy ())); + } + if (transparent) retval = Stencil (m->extent_box (), SCM_EOL); else { - SCM expr = m->expr (); - expr = scm_list_3 (ly_symbol2scm ("grob-cause"), - self_scm (), expr); + SCM expr = scm_list_3 (ly_symbol2scm ("grob-cause"), + self_scm (), + retval.expr ()); - retval = Stencil (m->extent_box (), expr); + retval = Stencil (retval.extent_box (), expr); } SCM rot = get_property ("rotation"); @@ -173,17 +195,6 @@ Grob::get_print_stencil () const retval = Stencil (retval.extent_box (), expr); } - /* process whiteout */ - /* a grob has to be visible, otherwise the whiteout property has no effect */ - if (!transparent && to_boolean (get_property ("whiteout"))) - { - /* Call the scheme procedure stencil-whiteout in scm/stencils.scm */ - /* to add a round-filled-box stencil to the stencil list */ - retval - = *unsmob (scm_call_1 (ly_lily_module_constant ("stencil-whiteout"), - retval.smobbed_copy ())); - } - SCM id = get_property ("id"); if (scm_is_string (id)) { @@ -380,7 +391,7 @@ Grob::pure_relative_y_coordinate (Grob const *refp, int start, int end) if (Grob *p = get_parent (Y_AXIS)) { Real trans = 0; - if (Align_interface::has_interface (p) && !dim_cache_[Y_AXIS].offset_) + if (has_interface (p) && !dim_cache_[Y_AXIS].offset_) trans = Align_interface::get_pure_child_y_translation (p, this, start, end); return off + trans + p->pure_relative_y_coordinate (refp, start, end); @@ -478,14 +489,14 @@ Grob::extent (Grob *refp, Axis a) const if(!isinf (offset)) real_ext.translate(offset); else - this->warning(_f ("ignored infinite %s-offset", + warning(_f ("ignored infinite %s-offset", a == X_AXIS ? "X" : "Y")); return real_ext; } Interval -Grob::pure_height (Grob *refp, int start, int end) +Grob::pure_y_extent (Grob *refp, int start, int end) { SCM iv_scm = get_pure_property ("Y-extent", start, end); Interval iv = robust_scm2interval (iv_scm, Interval ()); @@ -507,7 +518,7 @@ Grob::pure_height (Grob *refp, int start, int end) Interval Grob::maybe_pure_extent (Grob *refp, Axis a, bool pure, int start, int end) { - return (pure && a == Y_AXIS) ? pure_height (refp, start, end) : extent (refp, a); + return (pure && a == Y_AXIS) ? pure_y_extent (refp, start, end) : extent (refp, a); } Interval_t @@ -627,7 +638,7 @@ get_maybe_root_vertical_alignment (Grob *g, Grob *maybe) { if (!g) return maybe; - if (Align_interface::has_interface (g)) + if (has_interface (g)) return get_maybe_root_vertical_alignment (g->get_parent (Y_AXIS), g); return get_maybe_root_vertical_alignment (g->get_parent (Y_AXIS), maybe); @@ -646,8 +657,8 @@ Grob::get_vertical_axis_group (Grob *g) return 0; if (!g->get_parent (Y_AXIS)) return 0; - if (Axis_group_interface::has_interface (g) - && Align_interface::has_interface (g->get_parent (Y_AXIS))) + if (has_interface (g) + && has_interface (g->get_parent (Y_AXIS))) return g; return get_vertical_axis_group (g->get_parent (Y_AXIS)); @@ -754,7 +765,7 @@ Grob::name () const SCM meta = get_property ("meta"); SCM nm = scm_assq (ly_symbol2scm ("name"), meta); nm = (scm_is_pair (nm)) ? scm_cdr (nm) : SCM_EOL; - return scm_is_symbol (nm) ? ly_symbol2string (nm) : this->class_name (); + return scm_is_symbol (nm) ? ly_symbol2string (nm) : class_name (); } ADD_INTERFACE (Grob, @@ -828,6 +839,7 @@ ADD_INTERFACE (Grob, "transparent " "vertical-skylines " "whiteout " + "whiteout-box " ); /**************************************************************** @@ -953,11 +965,11 @@ robust_relative_extent (Grob *me, Grob *refpoint, Axis a) bool Grob::check_cross_staff (Grob *commony) { - if (Align_interface::has_interface (commony)) + if (has_interface (commony)) return true; for (Grob *g = this; g && g != commony; g = g->get_parent (Y_AXIS)) - if (Align_interface::has_interface (g)) + if (has_interface (g)) return true; return false;