]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/stem.cc
Build: Unify the rules and variables for xref-map files.
[lilypond.git] / lily / stem.cc
index 568e1846c376e7f57cd28fe5b55e47fb0ed1562c..8c0e128487b4f48027bb7f23e8810b19aa229c56 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 1996--2011 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  Copyright (C) 1996--2012 Han-Wen Nienhuys <hanwen@xs4all.nl>
   Jan Nieuwenhuizen <janneke@gnu.org>
 
   TODO: This is way too hairy
@@ -277,7 +277,12 @@ Stem::is_invisible (Grob *me)
 bool
 Stem::is_normal_stem (Grob *me)
 {
-  return head_count (me) && scm_to_int (me->get_property ("duration-log")) >= 1;
+  if (!head_count (me))
+     return false;
+
+  extract_grob_set (me, "note-heads", heads);
+  SCM style = heads[0]->get_property ("style");
+  return style != ly_symbol2scm ("kievan") && scm_to_int (me->get_property ("duration-log")) >= 1;
 }
 
 MAKE_SCHEME_CALLBACK (Stem, pure_height, 3)
@@ -302,7 +307,7 @@ Stem::internal_pure_height (Grob *me, bool calc_beam)
 
   if (!beam)
     return iv;
-  if (!to_boolean (me->get_property ("cross-staff")) && calc_beam)
+  if (calc_beam)
     {
       Interval overshoot;
       Direction dir = get_grob_direction (me);
@@ -315,12 +320,35 @@ Stem::internal_pure_height (Grob *me, bool calc_beam)
       vector<Grob *> my_stems;
       extract_grob_set (beam, "normal-stems", normal_stems);
       for (vsize i = 0; i < normal_stems.size (); i++)
-        if (normal_stems[i] != me && get_grob_direction (normal_stems[i]) == dir)
+        if (get_grob_direction (normal_stems[i]) == dir)
           {
-            heights.push_back (Stem::internal_pure_height (normal_stems[i], false));
+            if (normal_stems[i] != me)
+              heights.push_back (Stem::internal_pure_height (normal_stems[i], false));
+            else
+              heights.push_back (iv);
             my_stems.push_back (normal_stems[i]);
-            iv.unite (heights.back ());
           }
+      //iv.unite (heights.back ());
+      // look for cross staff effects
+      vector<Real> coords;
+      Grob *common = common_refpoint_of_array (my_stems, me, Y_AXIS);
+      Real min_pos = infinity_f;
+      Real max_pos = -infinity_f;
+      for (vsize i = 0; i < my_stems.size (); i++)
+        {
+          coords.push_back (my_stems[i]->pure_relative_y_coordinate (common, 0, INT_MAX));
+          min_pos = min (min_pos, coords[i]);
+          max_pos = max (max_pos, coords[i]);
+        }
+      for (vsize i = 0; i < heights.size (); i++)
+        {
+          heights[i][dir] += dir == DOWN
+                             ? coords[i] - max_pos
+                             : coords[i] - min_pos;
+        }
+
+      for (vsize i = 0; i < heights.size (); i++) iv.unite (heights[i]);
+
       for (vsize i = 0; i < my_stems.size (); i++)
         cache_pure_height (my_stems[i], iv, heights[i]);
       iv.intersect (overshoot);
@@ -1105,6 +1133,7 @@ ADD_INTERFACE (Stem,
                "stemlet-length "
                "thickness "
                "tremolo-flag "
+               "tuplet-start "
               );
 
 /****************************************************************/