X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fbend-engraver.cc;h=8427af0525e345f5d2a0d46f54c35745f66f5bc4;hb=ee0488f3aa19e0060b6e17c46a4d88cb9d57c489;hp=b260f6fbfb6ebc2f4d4e28eba94bf2c48852c46c;hpb=0432c8dd16a35cab22fb6218a2890c6ad649e40d;p=lilypond.git diff --git a/lily/bend-engraver.cc b/lily/bend-engraver.cc index b260f6fbfb..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 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 (); @@ -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 */ + "" + );