]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/stem.cc
Doc: removing a left over html tag in a snippet
[lilypond.git] / lily / stem.cc
index 8eaf2321ea3ecdb669df157bf959cfa4ff706c11..4b5a68510b2752cc43fe4a160e40add3d4673c0b 100644 (file)
@@ -127,10 +127,13 @@ Stem::set_stem_positions (Grob *me, Real se)
   if (d && d * head_positions (me)[get_grob_direction (me)] >= se * d)
     me->warning (_ ("weird stem size, check for narrow beams"));
 
-  Interval height = me->pure_height (me, 0, INT_MAX);
+  // trigger note collision mechanisms
+  Real stem_beg = internal_calc_stem_begin_position (me, false);
   Real staff_space = Staff_symbol_referencer::staff_space (me);
   Real half_space = staff_space * 0.5;
 
+  Interval height;
+  height[-d] = stem_beg * half_space;
   height[d] = se * half_space + beam_end_corrective (me);
 
   Real stemlet_length = robust_scm2double (me->get_property ("stemlet-length"),
@@ -222,8 +225,7 @@ Stem::extremal_heads (Grob *me)
       Grob *n = heads[i];
       int p = Staff_symbol_referencer::get_rounded_position (n);
 
-      Direction d = LEFT;
-      do
+      for (LEFT_and_RIGHT (d))
         {
           if (d * p > d * extpos[d])
             {
@@ -231,23 +233,27 @@ Stem::extremal_heads (Grob *me)
               extpos[d] = p;
             }
         }
-      while (flip (&d) != DOWN);
     }
   return exthead;
 }
 
-/* The positions, in ascending order.  */
+/* The staff positions, in ascending order.
+ * If FILTER, include the main column of noteheads only */
 vector<int>
-Stem::note_head_positions (Grob *me)
+Stem::note_head_positions (Grob *me, bool filter)
 {
   vector<int> ps;
   extract_grob_set (me, "note-heads", heads);
+  Grob *xref = common_refpoint_of_array (heads, me, X_AXIS);
 
   for (vsize i = heads.size (); i--;)
     {
       Grob *n = heads[i];
-      int p = Staff_symbol_referencer::get_rounded_position (n);
+      if (filter
+          && n->relative_coordinate (xref, X_AXIS) != 0.0)
+        continue;
 
+      int p = Staff_symbol_referencer::get_rounded_position (n);
       ps.push_back (p);
     }
 
@@ -278,7 +284,7 @@ bool
 Stem::is_normal_stem (Grob *me)
 {
   if (!head_count (me))
-     return false;
+    return false;
 
   extract_grob_set (me, "note-heads", heads);
   SCM style = heads[0]->get_property ("style");
@@ -311,10 +317,8 @@ Stem::internal_pure_height (Grob *me, bool calc_beam)
     {
       Interval overshoot;
       Direction dir = get_grob_direction (me);
-      Direction d = DOWN;
-      do
+      for (DOWN_and_UP (d))
         overshoot[d] = d == dir ? dir * infinity_f : iv[d];
-      while (flip (&d) != DOWN);
 
       vector<Interval> heights;
       vector<Grob *> my_stems;
@@ -362,10 +366,8 @@ Stem::cache_pure_height (Grob *me, Interval iv, Interval my_iv)
 {
   Interval overshoot;
   Direction dir = get_grob_direction (me);
-  Direction d = DOWN;
-  do
+  for (DOWN_and_UP (d))
     overshoot[d] = d == dir ? dir * infinity_f : my_iv[d];
-  while (flip (&d) != DOWN);
 
   iv.intersect (overshoot);
   dynamic_cast<Item *> (me)->cache_pure_height (iv);
@@ -1133,6 +1135,7 @@ ADD_INTERFACE (Stem,
                "stemlet-length "
                "thickness "
                "tremolo-flag "
+               "tuplet-start "
               );
 
 /****************************************************************/