X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fgrob.cc;h=924c80e500221b2d7bcfc2a8fab0102fea2a7c3c;hb=5d84bfad4626892bcffd05adcced53c8a2329047;hp=d5dcf6794dd90233209e94d924972f8fe5612815;hpb=7c44f8bece4865eb0eb26b0490a4a9a04499a76b;p=lilypond.git diff --git a/lily/grob.cc b/lily/grob.cc index d5dcf6794d..924c80e500 100644 --- a/lily/grob.cc +++ b/lily/grob.cc @@ -146,21 +146,15 @@ Grob::get_print_stencil () const /* 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")) + 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")); + Real line_thickness = 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 ())); + get_property ("whiteout-style"), + get_property ("whiteout"), + scm_from_double (line_thickness))); } if (transparent) @@ -195,11 +189,11 @@ Grob::get_print_stencil () const retval = Stencil (retval.extent_box (), expr); } - SCM id = get_property ("id"); - if (scm_is_string (id)) + SCM attributes = get_property ("output-attributes"); + if (scm_is_pair (attributes)) { - SCM expr = scm_list_3 (ly_symbol2scm ("id"), - id, + SCM expr = scm_list_3 (ly_symbol2scm ("output-attributes"), + attributes, retval.expr ()); retval = Stencil (retval.extent_box (), expr); @@ -339,18 +333,21 @@ Real Grob::relative_coordinate (Grob const *refp, Axis a) const { /* eaa - hmmm, should we do a programming_error() here? */ - if ((this == NULL) || (refp == this)) + if (refp == this) return 0.0; /* We catch PARENT_L_ == nil case with this, but we crash if we did not ask for the absolute coordinate (ie. REFP == nil.) */ - Real off = get_offset (a); - if (refp == dim_cache_[a].parent_) - return off; - off += dim_cache_[a].parent_->relative_coordinate (refp, a); + return get_offset (a) + parent_relative (refp, a); +} - return off; +Real +Grob::parent_relative (Grob const *refp, Axis a) const +{ + if (Grob *p = get_parent (a)) + return p->relative_coordinate (refp, a); + return 0.0; } Real @@ -391,7 +388,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); @@ -496,7 +493,7 @@ Grob::extent (Grob *refp, Axis a) const } 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 ()); @@ -518,7 +515,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 @@ -638,7 +635,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); @@ -657,8 +654,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)); @@ -819,16 +816,17 @@ ADD_INTERFACE (Grob, "cause " "color " "cross-staff " - "id " "extra-offset " "footnote-music " "forced-spacing " "horizontal-skylines " + "id " "interfaces " "layer " "meta " "minimum-X-extent " "minimum-Y-extent " + "output-attributes " "parenthesis-friends " "pure-Y-offset-in-progress " "rotation " @@ -839,7 +837,7 @@ ADD_INTERFACE (Grob, "transparent " "vertical-skylines " "whiteout " - "whiteout-box " + "whiteout-style " ); /**************************************************************** @@ -965,11 +963,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;