]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fix #210 & #211.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 2 Jan 2007 02:13:35 +0000 (03:13 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 2 Jan 2007 02:13:35 +0000 (03:13 +0100)
Add break points for cluster at end of array.  Don't reverse order of
points.  Fixes coverage of cluster.cc

input/regression/cluster-break.ly [new file with mode: 0644]
input/regression/cluster-style.ly [new file with mode: 0644]
input/regression/cluster.ly
lily/cluster.cc

diff --git a/input/regression/cluster-break.ly b/input/regression/cluster-break.ly
new file mode 100644 (file)
index 0000000..9b42b92
--- /dev/null
@@ -0,0 +1,21 @@
+
+\version "2.10.7"
+\header {
+  texidoc = "Clusters behave well across line breaks."
+}
+
+\layout { ragged-right = ##t }
+
+fragment = \relative c' {
+  \time 2/4 
+  <e d'>4
+  <g a>4 | \break
+  <e a>
+  <f a>
+}
+
+<< \new Staff \makeClusters \fragment
+   \new Staff \fragment
+>>
+
+
diff --git a/input/regression/cluster-style.ly b/input/regression/cluster-style.ly
new file mode 100644 (file)
index 0000000..9d4dfc8
--- /dev/null
@@ -0,0 +1,34 @@
+
+
+\version "2.10.7"
+\header {
+  texidoc = "Clusters behave well across line breaks."
+}
+
+\layout { ragged-right = ##t }
+
+fragment = \relative c' {
+  <e d'>4
+  <g a>4 
+  <e a>4
+}
+
+<<
+  \time 2/4 
+  \new Staff {
+    \override ClusterSpanner #'style = #'ramp
+    \makeClusters \fragment
+    r4
+    \override ClusterSpanner #'style = #'leftsided-stairs
+    \makeClusters \fragment
+    r4
+    \override ClusterSpanner #'style = #'rightsided-stairs
+    \makeClusters \fragment
+    r4
+    \override ClusterSpanner #'style = #'centered-stairs
+    \makeClusters \fragment
+    }
+  
+>>
+
+
index 289c1f8984fa5b419421a169d096aef4a6f59675..a05f2ac73d5b575bdb00b8b7d174b1f5e7b2cdc2 100644 (file)
@@ -15,7 +15,7 @@ fragment = \relative c' {
 
 <<
   \new Staff \fragment
-  \new Staff \applyMusic #notes-to-clusters \fragment
+  \new Staff \makeClusters \fragment
 >>
 
 
index 90c2adcf5054a15f9f8151e878ec8220590890ca..8fe55dc69a942941c531836f89881cc0a5fe8e14 100644 (file)
@@ -164,32 +164,22 @@ Cluster::print (SCM smob)
   /*
     Across a line break we anticipate on the next pitches.
   */
-  if (spanner->original ())
+  if (Spanner *next = spanner->broken_neighbor (RIGHT))
     {
-      Spanner *orig = dynamic_cast<Spanner *> (spanner->original ());
-
-      if (spanner->get_break_index () < orig->broken_intos_.size () - 1)
+      extract_grob_set (next, "columns", next_cols);
+      if (next_cols.size () > 0)
        {
-         Spanner *next = orig->broken_intos_[spanner->get_break_index () + 1];
-         vector<Grob*> const &next_cols = extract_grob_array (next, "columns");
-         if (next_cols.size () > 0)
-           {
-             Grob *next_commony = common_refpoint_of_array (next_cols, next, Y_AXIS);
-             Grob *col = next_cols[0];
-
-             Interval v = col->extent (next_commony, Y_AXIS);
-             Real x = right_bound->relative_coordinate (commonx, X_AXIS) - left_coord;
-
-             bottom_points.insert (bottom_points.begin (),
-                                   Offset (x, v[DOWN]));
-             top_points.insert (top_points.begin (), Offset (x, v[UP]));
-           }
+         Grob *next_commony = common_refpoint_of_array (next_cols, next, Y_AXIS);
+         Grob *col = next_cols[0];
+
+         Interval v = col->extent (next_commony, Y_AXIS);
+         Real x = right_bound->relative_coordinate (commonx, X_AXIS) - left_coord;
+
+         bottom_points.push_back (Offset (x, v[DOWN]));
+         top_points.push_back (Offset (x, v[UP]));
        }
     }
 
-  reverse (bottom_points);
-  reverse (top_points);
-
   Stencil out = brew_cluster_piece (me, bottom_points, top_points);
   out.translate_axis (- me->relative_coordinate (commony, Y_AXIS), Y_AXIS);
   return out.smobbed_copy ();