X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fglissando-engraver.cc;h=ff918886770bc2547fbaa16c6c83cee9e9c4cb59;hb=33aea9c0d161f3ed0166bef403b6daf52d74847a;hp=f5b0527bd170350bc634cb14a51d5bd64828636c;hpb=9f3572d98bb948c9689cd1f75401a029451fa001;p=lilypond.git diff --git a/lily/glissando-engraver.cc b/lily/glissando-engraver.cc index f5b0527bd1..ff91888677 100644 --- a/lily/glissando-engraver.cc +++ b/lily/glissando-engraver.cc @@ -3,14 +3,19 @@ source file of the GNU LilyPond music typesetter - (c) 2000--2006 Jan Nieuwenhuizen + (c) 2000--2007 Jan Nieuwenhuizen */ #include "engraver.hh" + #include "international.hh" #include "rhythmic-head.hh" #include "spanner.hh" +#include "stream-event.hh" #include "warn.hh" +#include "item.hh" + +#include "translator.icc" /** Create line-spanner grobs for glissandi lines that connect note @@ -22,16 +27,16 @@ public: TRANSLATOR_DECLARATIONS (Glissando_engraver); protected: + DECLARE_TRANSLATOR_LISTENER (glissando); DECLARE_ACKNOWLEDGER (rhythmic_head); virtual void finalize (); - virtual bool try_music (Music *); void stop_translation_timestep (); void process_music (); private: Spanner *line_; Spanner *last_line_; - Music *event_; + Stream_event *event_; }; Glissando_engraver::Glissando_engraver () @@ -40,15 +45,11 @@ 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 @@ -66,14 +67,19 @@ 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 Glissando_engraver::stop_translation_timestep () { if (last_line_ && last_line_->get_bound (RIGHT)) - last_line_ = 0; + { + last_line_ = 0; + } if (line_) { if (last_line_) @@ -101,12 +107,9 @@ Glissando_engraver::finalize () } } -#include "translator.icc" - ADD_ACKNOWLEDGER (Glissando_engraver, rhythmic_head); ADD_TRANSLATOR (Glissando_engraver, /* doc */ "Engrave a glissandi", /* create */ "Glissando", - /* accept */ "glissando-event", /* read */ "followVoice", /* write */ "");