2 output-property-engraver.cc -- implement Output_property_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2000--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
10 #include "engraver.hh"
13 #include "stream-event.hh"
15 #include "translator.icc"
18 class Output_property_engraver : public Engraver
20 TRANSLATOR_DECLARATIONS (Output_property_engraver);
22 vector<Stream_event*> props_;
24 DECLARE_ACKNOWLEDGER (grob);
25 DECLARE_TRANSLATOR_LISTENER (apply_output);
27 void stop_translation_timestep ();
30 IMPLEMENT_TRANSLATOR_LISTENER (Output_property_engraver, apply_output);
32 Output_property_engraver::listen_apply_output (Stream_event *ev)
35 UGH. Only swallow the output property event in the context
36 it was intended for. This is inelegant but not inefficient.
38 if (context ()->is_alias (ev->get_property ("context-type")))
39 props_.push_back (ev);
43 Output_property_engraver::acknowledge_grob (Grob_info inf)
45 for (vsize i = props_.size (); i--;)
47 Stream_event *o = props_[i];
48 Context *d = inf.context ();
49 SCM proc = o->get_property ("procedure");
51 inf.grob ()->self_scm (),
53 context ()->self_scm ());
58 Output_property_engraver::stop_translation_timestep ()
63 Output_property_engraver::Output_property_engraver ()
67 ADD_ACKNOWLEDGER (Output_property_engraver,grob);
68 ADD_TRANSLATOR (Output_property_engraver,
71 "Apply a procedure to any grob acknowledged. ",