]> git.donarmstrong.com Git - lilypond.git/commitdiff
Change \overrideProperty to take a single symbol-list as path
authorDavid Kastrup <dak@gnu.org>
Sun, 28 Oct 2012 13:10:15 +0000 (14:10 +0100)
committerDavid Kastrup <dak@gnu.org>
Tue, 30 Oct 2012 21:41:06 +0000 (22:41 +0100)
ly/music-functions-init.ly

index edce98a9a0efb29bfa6f4e38e386a495f5322328..09607b1f0651bc9e69a3f86dc8e6e01189333175 100644 (file)
@@ -720,33 +720,28 @@ 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-path value)
-   (symbol-list? symbol-list-or-symbol? scheme?)
-
-   (_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)
-       (make-music 'ApplyOutputEvent
-                   'context-type (if (null? (cdr name)) 'Bottom
-                                     (car name))
-                   'procedure
-                   (lambda (grob orig-context context)
-                     (if (equal?
-                          (cdr (assoc 'name (ly:grob-property grob 'meta)))
-                          (last name))
-                         (if (symbol? property-path)
-                             (ly:grob-set-property! grob property-path value)
-                             (case (length property-path)
-                               ((0) *unspecified*)
-                               ((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)
+#(define-music-function (parser location grob-property-path value)
+   (symbol-list? scheme?)
+
+   (_i "Set the grob property specified by @var{grob-property-path} to
+@var{value}.  @var{grob-property-path} is a symbol list of the form
+@code{Context.GrobName.property} or @code{GrobName.property}, possibly
+with subproperties given as well.")
+   (let ((p (check-grob-path grob-property-path parser location
+                             #:default 'Bottom
+                             #:min 3)))
+     (if p
+         (make-music 'ApplyOutputEvent
+                     'context-type (first p)
+                     'procedure
+                     (lambda (grob orig-context context)
+                       (if (equal?
+                            (cdr (assoc 'name (ly:grob-property grob 'meta)))
+                            (second p))
+                         (if (null? (cdddr p))
+                             (ly:grob-set-property! grob (caddr p) value)
+                             (ly:grob-set-nested-property!
+                              grob (cddr p) value)))))
          (make-music 'Music))))