X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Farpeggio-engraver.cc;h=e0face3d7a0d82fc4a8ee9c235d1cd1053a167be;hb=90e4d7057f3857da049dfda3d130017d4719bd6b;hp=399823408f88d501a246a97a3ae5cd54fa321ce2;hpb=deabe8e6c21ae6080e13b269bab24901f74a2254;p=lilypond.git diff --git a/lily/arpeggio-engraver.cc b/lily/arpeggio-engraver.cc index 399823408f..e0face3d7a 100644 --- a/lily/arpeggio-engraver.cc +++ b/lily/arpeggio-engraver.cc @@ -1,21 +1,33 @@ /* - 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--2015 Jan Nieuwenhuizen - (c) 2000--2007 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" -#include "pointer-group-interface.hh" #include "arpeggio.hh" -#include "stem.hh" +#include "item.hh" +#include "note-column.hh" +#include "pointer-group-interface.hh" #include "rhythmic-head.hh" +#include "separation-item.hh" #include "side-position-interface.hh" +#include "stem.hh" #include "stream-event.hh" -#include "note-column.hh" -#include "item.hh" #include "translator.icc" @@ -26,22 +38,24 @@ public: void acknowledge_stem (Grob_info); void acknowledge_rhythmic_head (Grob_info); + void acknowledge_note_column (Grob_info); + protected: void process_music (); void stop_translation_timestep (); - DECLARE_TRANSLATOR_LISTENER (arpeggio); + void listen_arpeggio (Stream_event *); private: Item *arpeggio_; Stream_event *arpeggio_event_; }; -Arpeggio_engraver::Arpeggio_engraver () +Arpeggio_engraver::Arpeggio_engraver (Context *c) + : Engraver (c) { arpeggio_ = 0; arpeggio_event_ = 0; } -IMPLEMENT_TRANSLATOR_LISTENER (Arpeggio_engraver, arpeggio); void Arpeggio_engraver::listen_arpeggio (Stream_event *ev) { ASSIGN_EVENT_ONCE (arpeggio_event_, ev); @@ -53,11 +67,11 @@ Arpeggio_engraver::acknowledge_stem (Grob_info info) if (arpeggio_) { if (!arpeggio_->get_parent (Y_AXIS)) - arpeggio_->set_parent (info.grob (), Y_AXIS); + arpeggio_->set_parent (info.grob (), Y_AXIS); Pointer_group_interface::add_grob (arpeggio_, - ly_symbol2scm ("stems"), - info.grob ()); + ly_symbol2scm ("stems"), + info.grob ()); } } void @@ -72,6 +86,13 @@ Arpeggio_engraver::acknowledge_rhythmic_head (Grob_info info) Side_position_interface::add_support (arpeggio_, info.grob ()); } +void +Arpeggio_engraver::acknowledge_note_column (Grob_info info) +{ + if (arpeggio_) + Separation_item::add_conditional_item (info.grob (), arpeggio_); +} + void Arpeggio_engraver::process_music () { @@ -88,11 +109,26 @@ Arpeggio_engraver::stop_translation_timestep () arpeggio_event_ = 0; } -ADD_ACKNOWLEDGER (Arpeggio_engraver, stem); -ADD_ACKNOWLEDGER (Arpeggio_engraver, rhythmic_head); + +void +Arpeggio_engraver::boot () +{ + ADD_LISTENER (Arpeggio_engraver, arpeggio); + ADD_ACKNOWLEDGER (Arpeggio_engraver, stem); + ADD_ACKNOWLEDGER (Arpeggio_engraver, rhythmic_head); + ADD_ACKNOWLEDGER (Arpeggio_engraver, note_column); +} ADD_TRANSLATOR (Arpeggio_engraver, - /* doc */ "Generate an Arpeggio symbol", - /* create */ "Arpeggio", - /* read */ "", - /* write */ ""); + /* doc */ + "Generate an Arpeggio symbol.", + + /* create */ + "Arpeggio", + + /* read */ + "", + + /* write */ + "" + );