From b8dfb88ca356cdde12cccb4cf57ecc64397c137b Mon Sep 17 00:00:00 2001 From: Reinhold Kainhofer Date: Tue, 26 Apr 2011 12:11:33 +0200 Subject: [PATCH] Fixes issues 1639 and 1640. Consecutive glissandos are typeset, and line breaks can happen with killed glissandi. --- input/regression/glissando-chord-linebreak.ly | 29 ++++++++++ input/regression/glissando-consecutive.ly | 13 +++++ lily/glissando-engraver.cc | 54 ++++++++++--------- 3 files changed, 72 insertions(+), 24 deletions(-) create mode 100644 input/regression/glissando-chord-linebreak.ly create mode 100644 input/regression/glissando-consecutive.ly diff --git a/input/regression/glissando-chord-linebreak.ly b/input/regression/glissando-chord-linebreak.ly new file mode 100644 index 0000000000..d33e464e71 --- /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 = { + 4 + \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 index 0000000000..62c4085789 --- /dev/null +++ b/input/regression/glissando-consecutive.ly @@ -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 +} diff --git a/lily/glissando-engraver.cc b/lily/glissando-engraver.cc index ebd2bb32c7..26b869dd51 100644 --- a/lily/glissando-engraver.cc +++ b/lily/glissando-engraver.cc @@ -44,6 +44,7 @@ protected: private: vector lines_; + vector 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); -- 2.39.2