]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/accidental-placement.cc
Merge branch 'jneeman' of git+ssh://jneem@git.sv.gnu.org/srv/git/lilypond into jneeman
[lilypond.git] / lily / accidental-placement.cc
index 71c6af771ead00ccdbaf94586afd3f9cbd4af606..6aaf49b2e6ea12c11ab32370de72453f9a9f85ed 100644 (file)
@@ -75,6 +75,24 @@ Accidental_placement::split_accidentals (Grob *accs,
       }
 }
 
+vector<Grob*>
+Accidental_placement::get_break_reminder_accidentals (vector<Grob*> const &elts, Grob *left)
+{
+  vector<Grob*> br;
+  vector<Grob*> ra;
+  vector<Grob*> ret;
+
+  if (dynamic_cast<Item *> (left)->break_status_dir () != RIGHT)
+    return vector<Grob*> ();
+
+  for (vsize i = 0; i < elts.size (); i++)
+    {
+      split_accidentals (elts[i], &br, &ra);
+      ret.insert (ret.end (), br.begin (), br.end ());
+    }
+  return ret;
+}
+
 /*
   Accidentals are special, because they appear and disappear after
   ties at will.
@@ -316,6 +334,19 @@ Accidental_placement::calc_positioning_done (SCM smob)
   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]))
+       {
+         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--;)
     {
       Accidental_placement_entry *ape = apes[i];
@@ -327,8 +358,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;
@@ -360,7 +391,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);