From e1fd8890eae91be854e84b120893af257dc8daca Mon Sep 17 00:00:00 2001 From: Joe Neeman Date: Sat, 2 Dec 2006 09:58:47 +0200 Subject: [PATCH] Get the right common_refpoint in accidental-placement (cherry picked from 80587b78aa5e1f521772deb2836d8af5a43b6898 commit) --- lily/accidental-placement.cc | 21 ++++++++++++--------- lily/grob.cc | 14 ++++++++------ 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/lily/accidental-placement.cc b/lily/accidental-placement.cc index db505c694b..71c6af771e 100644 --- a/lily/accidental-placement.cc +++ b/lily/accidental-placement.cc @@ -302,7 +302,19 @@ Accidental_placement::calc_positioning_done (SCM smob) vector_sort (heads, less ()); uniq (heads); + + vector stems; + for (vsize i = 0; i < heads.size (); i++) + { + if (Grob *s = Rhythmic_head::get_stem (heads[i])) + stems.push_back (s); + } + + vector_sort (stems, less ()); + uniq (stems); + common[Y_AXIS] = common_refpoint_of_array (heads, common[Y_AXIS], Y_AXIS); + common[Y_AXIS] = common_refpoint_of_array (stems, common[Y_AXIS], Y_AXIS); for (vsize i = apes.size (); i--;) { @@ -340,15 +352,6 @@ Accidental_placement::calc_positioning_done (SCM smob) head_extents.push_back (Box (heads[i]->extent (common[X_AXIS], X_AXIS), heads[i]->extent (common[Y_AXIS], Y_AXIS))); - vector stems; - for (vsize i = 0; i < heads.size (); i++) - { - if (Grob *s = Rhythmic_head::get_stem (heads[i])) - stems.push_back (s); - } - - vector_sort (stems, less ()); - uniq (stems); for (vsize i = 0; i < stems.size (); i ++) { int very_large = INT_MAX; diff --git a/lily/grob.cc b/lily/grob.cc index e377494e7c..3ff7b5df46 100644 --- a/lily/grob.cc +++ b/lily/grob.cc @@ -309,13 +309,15 @@ Grob::pure_relative_y_coordinate (Grob const *refp, int start, int end) it probably means that the Alignment was fixed and it has already been calculated. */ - Grob *p = get_parent (Y_AXIS); - Real trans = 0; - if (Align_interface::has_interface (p) && !dim_cache_[Y_AXIS].offset_) - trans = Align_interface::get_pure_child_y_translation (p, this, start, end); + if (Grob *p = get_parent (Y_AXIS)) + { + Real trans = 0; + if (Align_interface::has_interface (p) && !dim_cache_[Y_AXIS].offset_) + trans = Align_interface::get_pure_child_y_translation (p, this, start, end); - return off + trans - + dim_cache_[Y_AXIS].parent_->pure_relative_y_coordinate (refp, start, end); + return off + trans + p->pure_relative_y_coordinate (refp, start, end); + } + return off; } /* Invoke callbacks to get offset relative to parent. */ -- 2.39.5