summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHan-Wen Nienhuys <hanwen@xs4all.nl>2007-01-02 03:13:35 +0100
committerHan-Wen Nienhuys <hanwen@xs4all.nl>2007-01-02 03:13:35 +0100
commitbf5ff33bc96f32cb6fbdea186ac25d37c2fc35fc (patch)
tree00b61147b798b648046ddaff32477b97c0aafdf1
parent3cf78860f1c419ff2cc1a54af0956b0fce2f108b (diff)
Fix #210 & #211.
Add break points for cluster at end of array. Don't reverse order of points. Fixes coverage of cluster.cc
-rw-r--r--input/regression/cluster-break.ly21
-rw-r--r--input/regression/cluster-style.ly34
-rw-r--r--input/regression/cluster.ly2
-rw-r--r--lily/cluster.cc32
4 files changed, 67 insertions, 22 deletions
diff --git a/input/regression/cluster-break.ly b/input/regression/cluster-break.ly
new file mode 100644
index 0000000000..9b42b923c0
--- /dev/null
+++ b/input/regression/cluster-break.ly
@@ -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
index 0000000000..9d4dfc8236
--- /dev/null
+++ b/input/regression/cluster-style.ly
@@ -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
+ }
+
+>>
+
+
diff --git a/input/regression/cluster.ly b/input/regression/cluster.ly
index 289c1f8984..a05f2ac73d 100644
--- a/input/regression/cluster.ly
+++ b/input/regression/cluster.ly
@@ -15,7 +15,7 @@ fragment = \relative c' {
<<
\new Staff \fragment
- \new Staff \applyMusic #notes-to-clusters \fragment
+ \new Staff \makeClusters \fragment
>>
diff --git a/lily/cluster.cc b/lily/cluster.cc
index 90c2adcf50..8fe55dc69a 100644
--- a/lily/cluster.cc
+++ b/lily/cluster.cc
@@ -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 ();