]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/accidental-placement.cc
Merge branch 'master' of git+ssh://git.sv.gnu.org/srv/git/lilypond
[lilypond.git] / lily / accidental-placement.cc
index db505c694bf845432b84bbddf8596aca18d52ea7..c706ff4a6915ccf9d0549fcbeaa6da33f52abf4c 100644 (file)
@@ -302,7 +302,33 @@ 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);
+
+  vector<Grob *> stems;
+  for (vsize i = 0; i < heads.size  (); i++)
+    {
+      if (Grob *s = Rhythmic_head::get_stem (heads[i]))
+       {
+         stems.push_back (s);
+         common[Y_AXIS] = s->common_refpoint (common[Y_AXIS], Y_AXIS);
+       }
+    }
+
+  vector_sort (stems, less<Grob*> ());
+  uniq (stems);
+  
 
   for (vsize i = apes.size (); i--;)
     {
@@ -340,15 +366,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;