]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/change-iterator.cc
Add penalty to interface.
[lilypond.git] / lily / change-iterator.cc
index 804e3ff6e3887aae772539cc7dc284b03a2c5adb..aa03614babe8b8afa051086ea1dff54e1b95f6f4 100644 (file)
@@ -64,10 +64,23 @@ Change_iterator::process (Moment m)
   if (current) 
     if (last)
       {
-       Context * dest = 
-         get_outlet ()->find_create_context (to_type, to_id, SCM_EOL);
-       current->remove_context (last);
-       dest->add_context (last);
+       Context * dest = 0;
+       Context * where = get_outlet ();
+       while (!dest && where)
+         {
+           dest = where->find_context_below (to_type, to_id);
+           where = where->daddy_context_;
+         }
+       
+       if (dest)
+         {
+           current->remove_context (last);
+           dest->add_context (last);
+         }
+       else
+         {
+           get_music ()->origin ()->warning  ("could not find context to switch to.");
+         }
       }
     else
       {