diff options
author | David Kastrup <dak@gnu.org> | 2016-07-03 01:37:15 +0200 |
---|---|---|
committer | David Kastrup <dak@gnu.org> | 2016-07-10 19:47:01 +0200 |
commit | 1d1976cb7da1d4625357e59a34837b1d46cac70c (patch) | |
tree | 6a5acad02b510e643c13d67d45b21cb4886d502c /lily | |
parent | 90fce106774e91373aba8308f39da486064f4cef (diff) |
Issue 4914/1: Move Output_property_engraver to Score level
This has the advantage of needing only one instantiation of the engraver
and not having \applyOutput mysteriously refrain from having an effect
in contexts without Output_property_engraver .
Due to the hierarchical nature of acknowledgers, acknowledgers in lower
contexts will now get to see the grobs before applyOutput has done its
work. However, grobs are still unfinished (except for type, properties
initialized via context properties and cause) at the time they are
announced, with other details only getting filled in by the engraver
after announcement, so the potential for trouble seems low.
Acknowledgers should usually just register a grob (or write grob data)
with any actual reading of grob data occurring at the end of the
timestep instead or in the process-acknowledged phase.
Diffstat (limited to 'lily')
-rw-r--r-- | lily/output-property-engraver.cc | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/lily/output-property-engraver.cc b/lily/output-property-engraver.cc index 7a0fa2d3c3..370d6e1c1f 100644 --- a/lily/output-property-engraver.cc +++ b/lily/output-property-engraver.cc @@ -37,15 +37,12 @@ protected: void stop_translation_timestep (); }; +// We only run this in the Score context, so all events are likely to +// find a target void Output_property_engraver::listen_apply_output (Stream_event *ev) { - /* - UGH. Only swallow the output property event in the context - it was intended for. This is inelegant but not inefficient. - */ - if (context ()->is_alias (ev->get_property ("context-type"))) - props_.push_back (ev); + props_.push_back (ev); } void @@ -59,11 +56,16 @@ Output_property_engraver::acknowledge_grob (Grob_info inf) if (scm_is_symbol (grob) && ly_symbol2string (grob) != inf.grob ()->name ()) continue; + SCM typ = o->get_property ("context-type"); SCM proc = o->get_property ("procedure"); - scm_call_3 (proc, - inf.grob ()->self_scm (), - d->self_scm (), - context ()->self_scm ()); + for (Context *c = d; c; c = c->get_parent_context ()) + { + if (c->is_alias (typ)) + scm_call_3 (proc, + inf.grob ()->self_scm (), + d->self_scm (), + c->self_scm ()); + } } } |