lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 16/16] Let \overrideProperty accept nested properties


From: David Kastrup
Subject: [PATCH 16/16] Let \overrideProperty accept nested properties
Date: Tue, 9 Oct 2012 21:00:01 +0200

---
 ly/music-functions-init.ly |   19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/ly/music-functions-init.ly b/ly/music-functions-init.ly
index ef93fab..c32645a 100644
--- a/ly/music-functions-init.ly
+++ b/ly/music-functions-init.ly
@@ -712,10 +712,10 @@ of @var{base-moment}, @var{beat-structure}, and 
@var{beam-exceptions}.")
     (override-time-signature-setting time-signature setting)))
 
 overrideProperty =
-#(define-music-function (parser location name property value)
-   (symbol-list? symbol? scheme?)
+#(define-music-function (parser location name property-path value)
+   (symbol-list? symbol-list-or-symbol? scheme?)
 
-   (_i "Set @var{property} to @var{value} in all grobs named @var{name}.
+   (_i "Set @var{property-path} to @var{value} in all grobs named @var{name}.
 The @var{name} argument is a symbol list of the form @code{Context.GrobName}
 or @code{GrobName}.")
    (if (<= 1 (length name) 2)
@@ -727,11 +727,20 @@ or @code{GrobName}.")
                      (if (equal?
                           (cdr (assoc 'name (ly:grob-property grob 'meta)))
                           (last name))
-                         (set! (ly:grob-property grob property) value))))
+                         (if (symbol? property-path)
+                             (ly:grob-set-property! grob property-path value)
+                             (case (length property-path)
+                               ((0))
+                               ((1)
+                                (ly:grob-set-property!
+                                 grob (car property-path) value))
+                               (else
+                                (ly:grob-set-nested-property!
+                                 grob property-path value)))))))
        (begin
          (ly:parser-error parser (_ "bad grob name") location)
          (make-music 'Music))))
-   
+
 
 
 
-- 
1.7.9.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]