]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fixes issues 1639 and 1640.
authorReinhold Kainhofer <reinhold@kainhofer.com>
Tue, 26 Apr 2011 10:11:33 +0000 (12:11 +0200)
committerCarl Sorensen <c_sorensen@byu.edu>
Wed, 25 May 2011 17:56:17 +0000 (11:56 -0600)
Consecutive glissandos are typeset, and line breaks can happen
with killed glissandi.

input/regression/glissando-chord-linebreak.ly [new file with mode: 0644]
input/regression/glissando-consecutive.ly [new file with mode: 0644]
lily/glissando-engraver.cc

diff --git a/input/regression/glissando-chord-linebreak.ly b/input/regression/glissando-chord-linebreak.ly
new file mode 100644 (file)
index 0000000..d33e464
--- /dev/null
@@ -0,0 +1,29 @@
+\version "2.13.61"
+%% This should really be 2.15.0, because the glissando code
+%% hasn't been backported -- this is a git-only test at this point
+
+\header {
+
+  texidoc = "
+A glissando between chords should not interfere with line breaks.  In
+this case, the music should be in two lines and there should be no
+warning messages issued.  Also, the glissando should be printed.
+"
+
+}
+
+theNotes = {
+  <c e>4 <c e> <c e>
+  \glissando
+  d
+}
+
+\score {
+  \new Staff {
+    \relative c'' {
+      \theNotes
+      \break
+      \theNotes
+    }
+  }
+}
diff --git a/input/regression/glissando-consecutive.ly b/input/regression/glissando-consecutive.ly
new file mode 100644 (file)
index 0000000..62c4085
--- /dev/null
@@ -0,0 +1,13 @@
+\version "2.13.61"
+%% This should really be 2.15.0, because the glissando code
+%% hasn't been backported -- this is a git-only test at this point
+
+\header {
+
+  texidoc = "Lilypond prints consecutive glissandi."
+
+}
+
+\relative c' {
+  c1 \glissando d1 \glissando e1
+}
index ebd2bb32c78d29c356ca09e29f63ee361f395bfd..26b869dd51f73afc6bf5cf65bd6a060000bda046 100644 (file)
@@ -44,6 +44,7 @@ protected:
 
 private:
   vector<Spanner *> lines_;
+  vector<Spanner *> kill_me_;
   bool start_glissandi;
   bool stop_glissandi;
 
@@ -77,6 +78,31 @@ void
 Glissando_engraver::acknowledge_note_column (Grob_info info)
 {
   Grob *g = info.grob ();
+  if (stop_glissandi)
+    {
+      extract_grob_set (g, "note-heads", note_heads);
+      int glissando_index = 0;
+      for (vsize i=0; i < note_column_1.size (); i++)
+        {
+          if (note_column_2[i] >= note_heads.size ())
+            {
+              kill_me_.push_back (lines_[i]);
+              announce_end_grob (lines_[i], SCM_EOL);
+            }
+          else
+            {
+              lines_[i]->set_bound (RIGHT, note_heads[note_column_2[i]]);
+              lines_[i]->set_property ("glissando-index", scm_from_int (glissando_index));
+              glissando_index++;
+              announce_end_grob (lines_[i], note_heads[note_column_2[i]]->self_scm ());
+            }
+        }
+      lines_.clear ();
+      note_column_1.clear ();
+      note_column_2.clear ();
+      stop_glissandi = false;
+    }      
+
   if (start_glissandi)
     {
       extract_grob_set (g, "note-heads", note_heads);
@@ -106,28 +132,6 @@ Glissando_engraver::acknowledge_note_column (Grob_info info)
           lines_.back ()->set_bound (LEFT, note_heads[note_column_1[i]]);
         }
     }
-
-  if (stop_glissandi)
-    {
-      extract_grob_set (g, "note-heads", note_heads);
-      int glissando_index = 0;
-      for (vsize i=0; i < note_column_1.size (); i++)
-        {
-          if (note_column_2[i] >= note_heads.size ())
-            lines_[i]->suicide ();
-          else
-            {
-              lines_[i]->set_bound (RIGHT, note_heads[note_column_2[i]]);
-              lines_[i]->set_property ("glissando-index", scm_from_int (glissando_index));
-              glissando_index++;
-              announce_end_grob (lines_[i], note_heads[note_column_2[i]]->self_scm ());
-            }
-        }
-      lines_.clear ();
-      note_column_1.clear ();
-      note_column_2.clear ();
-      stop_glissandi = false;
-    }      
 }
 
 void
@@ -139,9 +143,8 @@ Glissando_engraver::stop_translation_timestep ()
       if (stop_glissandi)
        programming_error ("overwriting glissando");
       stop_glissandi = true;
+      start_glissandi = false;
     }
-
-  start_glissandi = false;
   event_ = 0;
 }
 
@@ -160,6 +163,9 @@ Glissando_engraver::finalize ()
       for (vsize i=0; i < lines_.size (); i++)
         lines_[i]->suicide ();
     }
+
+  for (vsize i=0; i < kill_me_.size (); i++)
+    kill_me_[i]->suicide ();
 }
 
 ADD_ACKNOWLEDGER (Glissando_engraver, note_column);