lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fixes issues 1639 and 1640. (issue4457042)


From: mtsolo
Subject: Fixes issues 1639 and 1640. (issue4457042)
Date: Sat, 30 Apr 2011 22:26:45 +0000

Reviewers: ,

Message:
This patch fixes issues 1639 and 1640.

Description:
Fixes issues 1639 and 1640.

Consecutive glissandos are typeset, and line breaks can happen
with killed glissandi.

Please review this at http://codereview.appspot.com/4457042/

Affected files:
  A input/regression/glissando-chord-linebreak.ly
  M lily/glissando-engraver.cc


Index: input/regression/glissando-chord-linebreak.ly
diff --git a/input/regression/glissando-chord-linebreak.ly b/input/regression/glissando-chord-linebreak.ly
new file mode 100644
index 0000000000000000000000000000000000000000..d33e464e7199d421df76bafad9c11face683c96c
--- /dev/null
+++ b/input/regression/glissando-chord-linebreak.ly
@@ -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
+    }
+  }
+}
Index: lily/glissando-engraver.cc
diff --git a/lily/glissando-engraver.cc b/lily/glissando-engraver.cc
index ebd2bb32c78d29c356ca09e29f63ee361f395bfd..26b869dd51f73afc6bf5cf65bd6a060000bda046 100644
--- a/lily/glissando-engraver.cc
+++ b/lily/glissando-engraver.cc
@@ -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);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]