]> git.donarmstrong.com Git - lilypond.git/commitdiff
only consider hairpin broken if it continues on next line. Fixes #151
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 9 Nov 2006 13:35:08 +0000 (14:35 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 9 Nov 2006 13:35:08 +0000 (14:35 +0100)
input/regression/hairpin-barline-break.ly [new file with mode: 0644]
lily/hairpin.cc

diff --git a/input/regression/hairpin-barline-break.ly b/input/regression/hairpin-barline-break.ly
new file mode 100644 (file)
index 0000000..3f783db
--- /dev/null
@@ -0,0 +1,15 @@
+\header {
+
+  texidoc ="If a hairpin ends on the first note of a new stave, we
+don't print that ending.  But on the previous line, this hairpin
+should not be left open, and should end at the barline. "
+}
+
+\version "2.9.26"
+\layout { ragged-right = ##t }
+\relative c' {
+  \set hairpinToBarline = ##t
+  c1\>
+  \break
+  c1\!
+}
index 4b9c215e2e9b7cbd4936a7262653ee0f06baa72f..ca5a7c050d942c3a6879dfb4fa7f3397bca90cff 100644 (file)
@@ -58,7 +58,12 @@ Hairpin::print (SCM smob)
 {
   Spanner *me = dynamic_cast<Spanner *> (unsmob_grob (smob));
 
-  consider_suicide (me);
+  if (Spanner *orig = dynamic_cast<Spanner*> (me->original ()))
+    {
+      for (vsize i = 0; i < orig->broken_intos_.size (); i++)
+       Hairpin::consider_suicide (orig->broken_intos_[i]);
+    }
+  
   SCM s = me->get_property ("grow-direction");
   if (!is_direction (s))
     {
@@ -78,17 +83,16 @@ Hairpin::print (SCM smob)
       broken[d] = bounds[d]->break_status_dir () != CENTER;
     }
   while (flip (&d) != LEFT);
+
+  broken[RIGHT] = broken[RIGHT] && me->broken_neighbor (RIGHT);
+  broken[RIGHT] = broken[RIGHT] && me->broken_neighbor (RIGHT)->is_live ();
+  
   if (broken[RIGHT])
     {
-      Spanner *orig = dynamic_cast<Spanner*> (me->original ());
-      if (me->get_break_index ()
-         < orig->broken_intos_.size () - 1)
-       {
-         Spanner *next = orig->broken_intos_[me->get_break_index () + 1];
-         Stencil *s = next->get_stencil ();
-         if (!s || s->is_empty ())
-           broken[RIGHT] = false;
-       }
+      Spanner *next = me->broken_neighbor (RIGHT);
+      Stencil *s = next->get_stencil ();
+      if (!s || s->is_empty ())
+       broken[RIGHT] = false;
     }
 
   Grob *common = bounds[LEFT]->common_refpoint (bounds[RIGHT], X_AXIS);