]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 2997/1: Let Tweak_engraver deal with nested properties
authorDavid Kastrup <dak@gnu.org>
Sat, 24 Nov 2012 20:02:18 +0000 (21:02 +0100)
committerDavid Kastrup <dak@gnu.org>
Fri, 30 Nov 2012 12:37:33 +0000 (13:37 +0100)
lily/tweak-engraver.cc

index d6fb7855224349f018e762cc23aea1c13ed6cc14..188780c59171e6b5388938b4c847f836567425fe 100644 (file)
@@ -46,15 +46,32 @@ Tweak_engraver::acknowledge_grob (Grob_info info)
     ev = info.ultimate_event_cause ();
   if (ev)
     {
+      // Each tweak conses an address and a value.
+      // The address has one of the following forms:
+      // symbol -> direct tweak
+      // (grob . symbol) -> targeted tweak
+      // (#t . symbol-path) -> direct nested tweak
+      // (grob . symbol-path) -> targeted nested tweak
       for (SCM s = ev->get_property ("tweaks");
            scm_is_pair (s); s = scm_cdr (s))
         {
           if (scm_is_pair (scm_caar (s)))
             {
-              if (SCM_UNBNDP (grobname))
-                grobname = scm_from_locale_symbol (info.grob ()->name ().c_str ());
-              if (scm_is_eq (scm_caaar (s), grobname))
-                info.grob ()->set_property (scm_cdaar (s), scm_cdar (s));
+              if (scm_is_symbol (scm_caaar (s)))
+                {
+                  if (SCM_UNBNDP (grobname))
+                    grobname = scm_from_locale_symbol
+                      (info.grob ()->name ().c_str ());
+                  if (scm_is_eq (scm_caaar (s), grobname))
+                    if (scm_is_symbol (scm_cdaar (s)))
+                      info.grob ()->set_property (scm_cdaar (s), scm_cdar (s));
+                    else
+                      set_nested_property (info.grob (), scm_cdaar (s),
+                                           scm_cdar (s));
+                }
+              else if (direct)
+                set_nested_property (info.grob (), scm_cdaar (s),
+                                     scm_cdar (s));
             }
           else if (direct)
             info.grob ()->set_property (scm_caar (s), scm_cdar (s));