]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/accidental-placement.cc
add horizon_padding to skylines (although it is currently always 0)
[lilypond.git] / lily / accidental-placement.cc
index f9cac96ac71d38320369faea4232191f8efced00..f6bfefff5d944ca100b370bb9e1cdcb9133166ea 100644 (file)
@@ -302,9 +302,20 @@ Accidental_placement::calc_positioning_done (SCM smob)
 
   vector_sort (heads, less<Grob*> ());
   uniq (heads);
-  common[Y_AXIS] = common_refpoint_of_array (heads, 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);
+
+  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 = 0; i < heads.size  (); i++)
     {
       if (Grob *s = Rhythmic_head::get_stem (heads[i]))
@@ -329,8 +340,8 @@ Accidental_placement::calc_positioning_done (SCM smob)
 
          ape->extents_.insert (ape->extents_.end (), boxes.begin (), boxes.end ());
        }
-      ape->left_skyline_ = Skyline (ape->extents_, Y_AXIS, LEFT);
-      ape->right_skyline_ = Skyline (ape->extents_, Y_AXIS, RIGHT);
+      ape->left_skyline_ = Skyline (ape->extents_, 0, Y_AXIS, LEFT);
+      ape->right_skyline_ = Skyline (ape->extents_, 0, Y_AXIS, RIGHT);
     }
 
   Interval total;
@@ -362,7 +373,7 @@ Accidental_placement::calc_positioning_done (SCM smob)
                                   stems[i]->pure_height (common[Y_AXIS], 0, very_large)));
     }
 
-  head_ape->left_skyline_ = Skyline (head_extents, Y_AXIS, LEFT);
+  head_ape->left_skyline_ = Skyline (head_extents, 0, Y_AXIS, LEFT);
   head_ape->offset_ = 0.0;
 
   Real padding = robust_scm2double (me->get_property ("padding"), 0.2);