diff options
-rw-r--r-- | lily/beam.cc | 2 | ||||
-rw-r--r-- | lily/fingering-column.cc | 3 | ||||
-rw-r--r-- | lily/grob.cc | 14 | ||||
-rw-r--r-- | lily/include/grob.hh | 1 | ||||
-rw-r--r-- | lily/side-position-interface.cc | 4 | ||||
-rw-r--r-- | lily/tuplet-bracket.cc | 2 |
6 files changed, 14 insertions, 12 deletions
diff --git a/lily/beam.cc b/lily/beam.cc index a20530c0f3..a50f2904bc 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -1280,7 +1280,7 @@ Beam::rest_collision_callback (SCM smob, SCM prev_offset) Real offset = robust_scm2double (prev_offset, 0.0); Interval rest_extent = rest->extent (rest, Y_AXIS); - rest_extent.translate (offset + rest->get_parent (Y_AXIS)->relative_coordinate (common_y, Y_AXIS)); + rest_extent.translate (offset + rest->parent_relative (common_y, Y_AXIS)); Real rest_dim = rest_extent[d]; Real minimum_distance diff --git a/lily/fingering-column.cc b/lily/fingering-column.cc index c9db28baf9..c069fb7c74 100644 --- a/lily/fingering-column.cc +++ b/lily/fingering-column.cc @@ -99,8 +99,7 @@ Fingering_column::do_y_positioning (Grob *me) { Interval x_ext = fingerings[i]->extent(common[X_AXIS], X_AXIS); Interval y_ext = fingerings[i]->extent(fingerings[i], Y_AXIS); - Real parent_y = fingerings[i]->get_parent(Y_AXIS) - ->relative_coordinate(common[Y_AXIS], Y_AXIS); + Real parent_y = fingerings[i]->parent_relative (common[Y_AXIS], Y_AXIS); // Checking only between sequential neighbors, seems good enough if (!intersection(x_ext, prev_x_ext).is_empty()) diff --git a/lily/grob.cc b/lily/grob.cc index eafa66288e..23a1cafae4 100644 --- a/lily/grob.cc +++ b/lily/grob.cc @@ -338,14 +338,16 @@ Grob::relative_coordinate (Grob const *refp, Axis a) const /* 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; - if (dim_cache_[a].parent_ != NULL) - 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 diff --git a/lily/include/grob.hh b/lily/include/grob.hh index a9408f09a2..5da4dff74e 100644 --- a/lily/include/grob.hh +++ b/lily/include/grob.hh @@ -141,6 +141,7 @@ public: /* offsets */ void translate_axis (Real, Axis); Real relative_coordinate (Grob const *refp, Axis) const; + Real parent_relative (Grob const *refp, Axis) const; Real pure_relative_y_coordinate (Grob const *refp, int start, int end); Real maybe_pure_coordinate (Grob const *refp, Axis a, bool pure, int start, int end); diff --git a/lily/side-position-interface.cc b/lily/side-position-interface.cc index 16e2929a66..52551e8b52 100644 --- a/lily/side-position-interface.cc +++ b/lily/side-position-interface.cc @@ -220,7 +220,7 @@ Side_position_interface::aligned_side (Grob *me, Axis a, bool pure, int start, i // skyline will likely be of infinite width anyway // and we don't want to prematurely trigger H spacing Real xc = a == X_AXIS || (pure && dynamic_cast<Spanner *> (me)) - ? me->get_parent (X_AXIS)->relative_coordinate (common[X_AXIS], X_AXIS) + ? me->parent_relative (common[X_AXIS], X_AXIS) : me->relative_coordinate (common[X_AXIS], X_AXIS); // same here, for X_AXIS spacing, if it's happening, it should only be // before line breaking. because there is no thing as "pure" x spacing, @@ -274,7 +274,7 @@ Side_position_interface::aligned_side (Grob *me, Axis a, bool pure, int start, i if (unsmob<Skyline_pair> (sp)) { Real xc = pure && dynamic_cast<Spanner *> (e) - ? e->get_parent (X_AXIS)->relative_coordinate (common[X_AXIS], X_AXIS) + ? e->parent_relative (common[X_AXIS], X_AXIS) : e->relative_coordinate (common[X_AXIS], X_AXIS); // same logic as above // we assume horizontal spacing is always pure diff --git a/lily/tuplet-bracket.cc b/lily/tuplet-bracket.cc index 17e1194de8..340b017723 100644 --- a/lily/tuplet-bracket.cc +++ b/lily/tuplet-bracket.cc @@ -540,7 +540,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]; |