X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fbend-engraver.cc;h=cd2d47a9d7751aaf9f484b84a34bd081e5f63d35;hb=67ff565b4ada90eeb753a866b22ddb4eaa8c6234;hp=9f5602fef096ccde37a9a10fedb01aeb5116c0ab;hpb=2eb63c6977706ba261e4ee0674c734a34b3ee904;p=lilypond.git diff --git a/lily/bend-engraver.cc b/lily/bend-engraver.cc index 9f5602fef0..cd2d47a9d7 100644 --- a/lily/bend-engraver.cc +++ b/lily/bend-engraver.cc @@ -1,9 +1,20 @@ /* - bend-engraver.cc -- implement Bend_engraver + This file is part of LilyPond, the GNU music typesetter. - (c) 2006--2007 Han-Wen Nienhuys + Copyright (C) 2006--2011 Han-Wen Nienhuys - + LilyPond is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + LilyPond is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LilyPond. If not, see . */ #include "engraver.hh" @@ -22,6 +33,7 @@ public: protected: DECLARE_TRANSLATOR_LISTENER (bend_after); + void finalize (); void process_music (); void stop_translation_timestep (); void start_translation_timestep (); @@ -31,9 +43,19 @@ private: Moment stop_moment_; Stream_event *fall_event_; Spanner *fall_; + Spanner *last_fall_; Grob *note_head_; }; +void +Bend_engraver::finalize () +{ + // We shouldn't end a spanner on the last musical column of a piece because then + // it would extend past the last breakable column of the piece. + if (last_fall_) + last_fall_->set_bound (RIGHT, unsmob_grob (get_property ("currentCommandColumn"))); +} + void Bend_engraver::stop_fall () { @@ -43,6 +65,7 @@ Bend_engraver::stop_fall () fall_->set_bound (RIGHT, unsmob_grob (bar ? get_property ("currentCommandColumn") : get_property ("currentMusicalColumn"))); + last_fall_ = fall_; fall_ = 0; note_head_ = 0; fall_event_ = 0; @@ -61,6 +84,8 @@ Bend_engraver::stop_translation_timestep () void Bend_engraver::start_translation_timestep () { + last_fall_ = 0; + if (fall_ && now_mom ().main_part_ >= stop_moment_.main_part_) { stop_fall (); @@ -86,6 +111,7 @@ Bend_engraver::acknowledge_note_head (Grob_info info) Bend_engraver::Bend_engraver () { fall_ = 0; + last_fall_ = 0; note_head_ = 0; fall_event_ = 0; }