X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fbend-engraver.cc;h=8427af0525e345f5d2a0d46f54c35745f66f5bc4;hb=ed430e2d3a44b70a0ee7b32f7dd2002bc6c6912b;hp=4f243dfc7371bbcb7f5447ea7f5fadd3a4a955c4;hpb=bcb3c657a4c434934327edf0fcdbdbaf7d5667dd;p=lilypond.git diff --git a/lily/bend-engraver.cc b/lily/bend-engraver.cc index 4f243dfc73..8427af0525 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--2010 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; } @@ -111,7 +137,15 @@ Bend_engraver::process_music () ADD_ACKNOWLEDGER (Bend_engraver, note_head); ADD_TRANSLATOR (Bend_engraver, - /* doc */ "Create fall spanners.", - /* create */ "BendAfter", - /* read */ "", - /* write */ ""); + /* doc */ + "Create fall spanners.", + + /* create */ + "BendAfter ", + + /* read */ + "", + + /* write */ + "" + );