]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 4914/1: Move Output_property_engraver to Score level
authorDavid Kastrup <dak@gnu.org>
Sat, 2 Jul 2016 23:37:15 +0000 (01:37 +0200)
committerDavid Kastrup <dak@gnu.org>
Sun, 10 Jul 2016 17:47:01 +0000 (19:47 +0200)
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.

lily/output-property-engraver.cc

index 7a0fa2d3c3389484cb94f03c6f798f0a1e6b866c..370d6e1c1f011400f0b8a8763083a0763e1a21f3 100644 (file)
@@ -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 ());
+        }
     }
 }