X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;ds=sidebyside;f=lily%2Fbend-engraver.cc;h=cd2d47a9d7751aaf9f484b84a34bd081e5f63d35;hb=446103a87933b297c209e87fec94e97fe9462ad0;hp=4287084c1e5ccaa2ecaa63a4b8f2ea8b7cbf6762;hpb=87eedcd59f4082cb0841528ad5bc82cb1d1191e3;p=lilypond.git diff --git a/lily/bend-engraver.cc b/lily/bend-engraver.cc index 4287084c1e..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 (); @@ -79,12 +104,14 @@ Bend_engraver::acknowledge_note_head (Grob_info info) } note_head_ = info.grob (); - stop_moment_ = now_mom () + get_event_length (info.event_cause ()); + stop_moment_ = now_mom () + get_event_length (info.event_cause (), + now_mom ()); } Bend_engraver::Bend_engraver () { fall_ = 0; + last_fall_ = 0; note_head_ = 0; fall_event_ = 0; } @@ -110,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 */ + "" + );