]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fix #122.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 1 Jan 2007 15:54:19 +0000 (16:54 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 1 Jan 2007 15:54:19 +0000 (16:54 +0100)
Add Stem::is_normal_stem(), which disregards stemlet-length.  Use it
for concaveness/slope calculations.

input/regression/beam-slope-stemlet.ly [new file with mode: 0644]
lily/beam-concave.cc
lily/beam.cc
lily/include/stem.hh
lily/stem.cc

diff --git a/input/regression/beam-slope-stemlet.ly b/input/regression/beam-slope-stemlet.ly
new file mode 100644 (file)
index 0000000..a0657e8
--- /dev/null
@@ -0,0 +1,22 @@
+
+\header {
+
+  texidoc = "For slope calculations, stemlets are treated
+as invisible stems."
+
+}
+
+\version "2.10.7"
+
+\layout {
+  ragged-right = ##t
+  indent = #0
+}
+
+\relative c' {
+  \times 2/3 {r8[ c' g']}
+  \override Stem #'stemlet-length = #0.5
+  \times 2/3 {r8[ c, g']}
+}
+
+
index ee351d0a26739d2fba275b4615cd108b3bfad33b..a37005c17ca35e57d9a59e4cc9f2b73e5aebc9e3 100644 (file)
@@ -96,13 +96,13 @@ Beam::calc_concaveness (SCM smob)
   Direction beam_dir = CENTER;
   for (vsize i = stems.size (); i--;)
     {
-      if (Stem::is_invisible (stems[i]))
-       stems.erase (stems.begin () + i);
-      else
+      if (Stem::is_normal_stem (stems[i]))
        {
          if (Direction dir = get_grob_direction (stems[i]))
            beam_dir = dir;
        }
+      else
+       stems.erase (stems.begin () + i);
     }
 
   if (stems.size () <= 2)
index 58fd432493f3db625afa4a27138d6e3af7c05a93..a2e7a3cb9214a5ceecd79c0406f790049d50dba6 100644 (file)
@@ -894,8 +894,9 @@ Beam::calc_least_squares_positions (SCM smob, SCM posns)
       for (vsize i = 0; i < stems.size (); i++)
        {
          Grob *s = stems[i];
-         if (Stem::is_invisible (s))
+         if (!Stem::is_normal_stem (s))
            continue;
+
          ideals.push_back (Offset (x_posns[i],
                               Stem::get_stem_info (s).ideal_y_
                               + s->relative_coordinate (commony, Y_AXIS)
@@ -1287,7 +1288,7 @@ Beam::first_visible_stem (Grob *me)
 
   for (vsize i = 0; i < stems.size (); i++)
     {
-      if (!Stem::is_invisible (stems[i]))
+      if (Stem::is_normal_stem (stems[i]))
        return stems[i];
     }
   return 0;
@@ -1300,7 +1301,7 @@ Beam::last_visible_stem (Grob *me)
 
   for (vsize i = stems.size (); i--;)
     {
-      if (!Stem::is_invisible (stems[i]))
+      if (Stem::is_normal_stem (stems[i]))
        return stems[i];
     }
   return 0;
index 8808d16665576eec2b82a9786684e911945cd78e..b3663b6eeeef3046ff6e655708b8f87a7950f486 100644 (file)
@@ -33,6 +33,7 @@ public:
   static Real thickness (Grob *);
   static int head_count (Grob *);
   static bool is_invisible (Grob *);
+  static bool is_normal_stem (Grob *);
   static Interval head_positions (Grob *);
   static Real stem_end_position (Grob *);
   static Stencil flag (Grob *);
index d333690491c6d98de4d1e85bb21688afb96728f8..6757582869960d15ecd600493113f6af459a225c 100644 (file)
@@ -222,6 +222,14 @@ Stem::is_invisible (Grob *me)
           && scm_to_int (me->get_property ("duration-log")) >= 1);
 }
 
+
+bool
+Stem::is_normal_stem (Grob *me)
+{
+  return head_count (me) && scm_to_int (me->get_property ("duration-log")) >= 1;
+}
+
+
 MAKE_SCHEME_CALLBACK (Stem, pure_height, 3)
 SCM
 Stem::pure_height (SCM smob, SCM start, SCM end)