]> git.donarmstrong.com Git - lilypond.git/commitdiff
Derive melisma_busy state from child contexts when available
authorDavid Kastrup <dak@gnu.org>
Mon, 8 Sep 2014 21:19:23 +0000 (23:19 +0200)
committerDavid Kastrup <dak@gnu.org>
Sun, 14 Sep 2014 05:48:29 +0000 (07:48 +0200)
lily/context.cc

index 8a85165cfdde63d5aef1c665786d3196b3f6acb0..da1810240135ff030d5f419ef4ea33a479d4137a 100644 (file)
@@ -812,14 +812,29 @@ set_context_property_on_children (Context *trans, SCM sym, SCM val)
 bool
 melisma_busy (Context *tr)
 {
-  SCM melisma_properties = tr->get_property ("melismaBusyProperties");
-  bool busy = false;
+  // When there are subcontexts, they are responsible for maintaining
+  // melismata.
+  SCM ch = tr->children_contexts ();
+  if (scm_is_pair (ch))
+    {
+      // all contexts need to have a busy melisma for this to evaluate
+      // to true.
+
+      do {
+        if (!melisma_busy (Context::unsmob (scm_car (ch))))
+          return false;
+        ch = scm_cdr (ch);
+      } while (scm_is_pair (ch));
+      return true;
+    }
 
-  for (; !busy && scm_is_pair (melisma_properties);
+  for (SCM melisma_properties = tr->get_property ("melismaBusyProperties");
+       scm_is_pair (melisma_properties);
        melisma_properties = scm_cdr (melisma_properties))
-    busy = busy || to_boolean (tr->get_property (scm_car (melisma_properties)));
+    if (to_boolean (tr->get_property (scm_car (melisma_properties))))
+      return true;
 
-  return busy;
+  return false;
 }
 
 bool