]> git.donarmstrong.com Git - lilypond.git/commitdiff
Get the right common_refpoint in accidental-placement
authorJoe Neeman <joeneeman@gmail.com>
Sat, 2 Dec 2006 07:58:47 +0000 (09:58 +0200)
committerJoe Neeman <joeneeman@gmail.com>
Sat, 2 Dec 2006 08:10:13 +0000 (10:10 +0200)
(cherry picked from 80587b78aa5e1f521772deb2836d8af5a43b6898 commit)

lily/accidental-placement.cc
lily/grob.cc

index db505c694bf845432b84bbddf8596aca18d52ea7..71c6af771ead00ccdbaf94586afd3f9cbd4af606 100644 (file)
@@ -302,7 +302,19 @@ Accidental_placement::calc_positioning_done (SCM smob)
 
   vector_sort (heads, less<Grob*> ());
   uniq (heads);
+
+  vector<Grob *> 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<Grob*> ());
+  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<Grob *> 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<Grob*> ());
-  uniq (stems);
   for (vsize i = 0; i < stems.size (); i ++)
     {
       int very_large = INT_MAX;
index e377494e7c0022bfe1af74797a035ee13ede77c3..3ff7b5df468f3cbf59211a43b5a4bb9db596cb23 100644 (file)
@@ -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.  */