X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fglissando-engraver.cc;h=0d4c6a0eeca7d8d3de79298e7280f47127aab113;hb=89038542fcb8c151d930c51d3e1444c41c94ebe8;hp=cfc018dc0306a60eaf152cab49da75a6dd30421b;hpb=811be522d0b79493159f47789e5621dc85493495;p=lilypond.git diff --git a/lily/glissando-engraver.cc b/lily/glissando-engraver.cc index cfc018dc03..0d4c6a0eec 100644 --- a/lily/glissando-engraver.cc +++ b/lily/glissando-engraver.cc @@ -1,35 +1,49 @@ /* - note-head-line-engraver.cc -- implement Note_head_line_engraver + This file is part of LilyPond, the GNU music typesetter. - source file of the GNU LilyPond music typesetter + Copyright (C) 2000--2010 Jan Nieuwenhuizen - (c) 2000--2005 Jan Nieuwenhuizen + 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 "warn.hh" -#include "spanner.hh" -#include "rhythmic-head.hh" #include "engraver.hh" -/** - Create line-spanner grobs for glissandi lines that connect note - heads. -*/ +#include "international.hh" +#include "rhythmic-head.hh" +#include "spanner.hh" +#include "stream-event.hh" +#include "warn.hh" +#include "item.hh" + +#include "translator.icc" + class Glissando_engraver : public Engraver { public: TRANSLATOR_DECLARATIONS (Glissando_engraver); protected: + DECLARE_TRANSLATOR_LISTENER (glissando); DECLARE_ACKNOWLEDGER (rhythmic_head); virtual void finalize (); + void stop_translation_timestep (); - virtual bool try_music (Music *); void process_music (); private: Spanner *line_; Spanner *last_line_; - Music *event_; + Stream_event *event_; }; Glissando_engraver::Glissando_engraver () @@ -38,24 +52,18 @@ Glissando_engraver::Glissando_engraver () event_ = 0; } -bool -Glissando_engraver::try_music (Music *m) +IMPLEMENT_TRANSLATOR_LISTENER (Glissando_engraver, glissando); +void +Glissando_engraver::listen_glissando (Stream_event *ev) { - if (!event_) - { - event_ = m; - return true; - } - return false; + ASSIGN_EVENT_ONCE (event_, ev); } void Glissando_engraver::process_music () { if (event_) - { - line_ = make_spanner ("Glissando", event_->self_scm ()); - } + line_ = make_spanner ("Glissando", event_->self_scm ()); } void @@ -66,7 +74,10 @@ Glissando_engraver::acknowledge_rhythmic_head (Grob_info info) line_->set_bound (LEFT, g); if (last_line_) - last_line_->set_bound (RIGHT, g); + { + last_line_->set_bound (RIGHT, g); + announce_end_grob (last_line_, g->self_scm ()); + } } void @@ -91,7 +102,7 @@ Glissando_engraver::finalize () { if (line_) { - String msg = _ ("unterminated glissando"); + string msg = _ ("unterminated glissando"); if (event_) event_->origin ()->warning (msg); @@ -103,12 +114,17 @@ Glissando_engraver::finalize () } } -#include "translator.icc" - -ADD_ACKNOWLEDGER (Glissando_engraver,rhythmic_head); +ADD_ACKNOWLEDGER (Glissando_engraver, rhythmic_head); ADD_TRANSLATOR (Glissando_engraver, - /* descr */ "Engrave a glissandi", - /* creats*/ "Glissando", - /* accepts */ "glissando-event", - /* reads */ "followVoice", - /* write */ ""); + /* doc */ + "Engrave glissandi.", + + /* create */ + "Glissando ", + + /* read */ + "", + + /* write */ + "" + );