X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Farpeggio-engraver.cc;h=58dd2c6fcd866e26fb9026596cd2061ddf55a247;hb=90fbf91f6169ddb2f07a1d95d132babf33934620;hp=856b5a7303899c61a934af799fca2f4eeea3ae78;hpb=a7f82e4dc22fc6219a9fe0f6874f8c91e3f31f24;p=lilypond.git diff --git a/lily/arpeggio-engraver.cc b/lily/arpeggio-engraver.cc index 856b5a7303..58dd2c6fcd 100644 --- a/lily/arpeggio-engraver.cc +++ b/lily/arpeggio-engraver.cc @@ -1,9 +1,20 @@ /* - arpeggio-engraver.cc -- implement Arpeggio_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 "engraver.hh" @@ -13,7 +24,9 @@ #include "stem.hh" #include "rhythmic-head.hh" #include "side-position-interface.hh" +#include "stream-event.hh" #include "note-column.hh" +#include "item.hh" #include "translator.icc" @@ -22,14 +35,15 @@ class Arpeggio_engraver : public Engraver public: TRANSLATOR_DECLARATIONS (Arpeggio_engraver); + void acknowledge_stem (Grob_info); + void acknowledge_rhythmic_head (Grob_info); protected: - virtual void acknowledge_grob (Grob_info); - PRECOMPUTED_VIRTUAL void process_music (); - PRECOMPUTED_VIRTUAL void stop_translation_timestep (); - virtual bool try_music (Music *); + void process_music (); + void stop_translation_timestep (); + DECLARE_TRANSLATOR_LISTENER (arpeggio); private: Item *arpeggio_; - Music *arpeggio_event_; + Stream_event *arpeggio_event_; }; Arpeggio_engraver::Arpeggio_engraver () @@ -38,45 +52,36 @@ Arpeggio_engraver::Arpeggio_engraver () arpeggio_event_ = 0; } -bool -Arpeggio_engraver::try_music (Music *m) +IMPLEMENT_TRANSLATOR_LISTENER (Arpeggio_engraver, arpeggio); +void Arpeggio_engraver::listen_arpeggio (Stream_event *ev) { - if (!arpeggio_event_) - { - arpeggio_event_ = m; - } - return true; + ASSIGN_EVENT_ONCE (arpeggio_event_, ev); } void -Arpeggio_engraver::acknowledge_grob (Grob_info info) +Arpeggio_engraver::acknowledge_stem (Grob_info info) { if (arpeggio_) { - if (Stem::has_interface (info.grob ())) - { - if (!arpeggio_->get_parent (Y_AXIS)) - arpeggio_->set_parent (info.grob (), Y_AXIS); - - Pointer_group_interface::add_grob (arpeggio_, - ly_symbol2scm ("stems"), - info.grob ()); - } - - /* - We can't catch local key items (accidentals) from Voice context, - see Local_key_engraver - */ - else if (Rhythmic_head::has_interface (info.grob ())) - { - Side_position_interface::add_support (arpeggio_, info.grob ()); - } - else if (Note_column::has_interface (info.grob ())) - { - info.grob ()->set_object ("arpeggio", arpeggio_->self_scm ()); - } + if (!arpeggio_->get_parent (Y_AXIS)) + arpeggio_->set_parent (info.grob (), Y_AXIS); + + Pointer_group_interface::add_grob (arpeggio_, + ly_symbol2scm ("stems"), + info.grob ()); } } +void +Arpeggio_engraver::acknowledge_rhythmic_head (Grob_info info) +{ + if (arpeggio_) + + /* + We can't catch local key items (accidentals) from Voice context, + see Local_key_engraver + */ + Side_position_interface::add_support (arpeggio_, info.grob ()); +} void Arpeggio_engraver::process_music () @@ -94,10 +99,19 @@ Arpeggio_engraver::stop_translation_timestep () arpeggio_event_ = 0; } +ADD_ACKNOWLEDGER (Arpeggio_engraver, stem); +ADD_ACKNOWLEDGER (Arpeggio_engraver, rhythmic_head); + ADD_TRANSLATOR (Arpeggio_engraver, - /* descr */ "Generate an Arpeggio symbol", - /* creats*/ "Arpeggio", - /* accepts */ "arpeggio-event", - /* acks */ "stem-interface rhythmic-head-interface note-column-interface", - /* reads */ "", - /* write */ ""); + /* doc */ + "Generate an Arpeggio symbol.", + + /* create */ + "Arpeggio", + + /* read */ + "", + + /* write */ + "" + );