X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fstaff-symbol-engraver.cc;h=a103eda0b39fe963805833bf249a572c9fc19b69;hb=2ab74abbadbb2aed67c3ae6d42272db92988f8b9;hp=c147d54dfff9bd1f7430c1ab5959bd21c4c12ca2;hpb=0c80169e70289f3f2330772974b0e17b813d161c;p=lilypond.git diff --git a/lily/staff-symbol-engraver.cc b/lily/staff-symbol-engraver.cc index c147d54dff..a103eda0b3 100644 --- a/lily/staff-symbol-engraver.cc +++ b/lily/staff-symbol-engraver.cc @@ -1,13 +1,29 @@ /* - staff-symbol-engraver.cc -- implement Staff_symbol_engraver + This file is part of LilyPond, the GNU music typesetter. - source file of the GNU LilyPond music typesetter + Copyright (C) 1997--2010 Han-Wen Nienhuys - (c) 1997--2006 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 "spanner.hh" #include "engraver.hh" +#include "international.hh" +#include "spanner.hh" +#include "stream-event.hh" +#include "warn.hh" + +#include "translator.icc" class Staff_symbol_engraver : public Engraver { @@ -15,7 +31,7 @@ public: TRANSLATOR_DECLARATIONS (Staff_symbol_engraver); protected: - Drul_array span_events_; + Drul_array span_events_; Spanner *span_; Spanner *finished_span_; bool first_start_; @@ -25,9 +41,9 @@ protected: virtual void stop_spanner (); void stop_translation_timestep (); - virtual bool try_music (Music *); virtual ~Staff_symbol_engraver (); DECLARE_ACKNOWLEDGER (grob); + DECLARE_TRANSLATOR_LISTENER (staff_span); virtual void finalize (); void process_music (); }; @@ -46,17 +62,15 @@ Staff_symbol_engraver::Staff_symbol_engraver () span_events_[RIGHT] = 0; } -bool -Staff_symbol_engraver::try_music (Music *music) +IMPLEMENT_TRANSLATOR_LISTENER (Staff_symbol_engraver, staff_span); +void +Staff_symbol_engraver::listen_staff_span (Stream_event *ev) { - Direction d = to_dir (music->get_property ("span-direction")); + Direction d = to_dir (ev->get_property ("span-direction")); if (d) - { - span_events_[d] = music; - return true; - } - - return false; + ASSIGN_EVENT_ONCE (span_events_[d], ev); + else + programming_error (_ ("staff-span event has no direction")); } void @@ -142,14 +156,18 @@ Staff_symbol_engraver::acknowledge_grob (Grob_info s) } } -#include "translator.icc" - ADD_ACKNOWLEDGER (Staff_symbol_engraver, grob); ADD_TRANSLATOR (Staff_symbol_engraver, - /* doc */ "Create the constellation of five (default) " - "staff lines.", - /* create */ "StaffSymbol", - /* accept */ "staff-span-event", - /* read */ "", - /* write */ ""); + /* doc */ + "Create the constellation of five (default) staff lines.", + + /* create */ + "StaffSymbol ", + + /* read */ + "", + + /* write */ + "" + );