From 2edad293ba802fe6016af1fc8bf0ae841f141206 Mon Sep 17 00:00:00 2001 From: Carl Sorensen Date: Mon, 11 Aug 2008 12:47:30 -0600 Subject: [PATCH] Add remove-grace-property code --- scm/music-functions.scm | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/scm/music-functions.scm b/scm/music-functions.scm index 5ca4d309af..7b2cc3404f 100644 --- a/scm/music-functions.scm +++ b/scm/music-functions.scm @@ -689,7 +689,6 @@ SkipEvent. Useful for extracting parts from crowded scores" ((< i 0)) (f (vector-ref v i)))) -;; TODO: make a remove-grace-property too. (define-public (add-grace-property context-name grob sym val) "Set SYM=VAL for GROB in CONTEXT-NAME. " (define (set-prop context) @@ -700,6 +699,25 @@ SkipEvent. Useful for extracting parts from crowded scores" (ly:context-set-property! where 'graceSettings new-settings))) (ly:export (context-spec-music (make-apply-context set-prop) 'Voice))) +(define-public (remove-grace-property context-name grob sym) + "Remove all SYM for GROB in CONTEXT-NAME. " + (define (sym-grob-context? property sym grob context-name) + (and (eq? (car property) context-name) + (eq? (cadr property) grob) + (eq? (caddr property) sym))) + (define (delete-prop context) + (let* ((where (ly:context-property-where-defined context 'graceSettings)) + (current (ly:context-property where 'graceSettings)) + (prop-settings (filter + (lambda(x) (sym-grob-context? x sym grob context-name)) + current)) + (new-settings current)) + (for-each (lambda(x) + (set! new-settings (delete x new-settings))) + prop-settings) + (ly:context-set-property! where 'graceSettings new-settings))) + (ly:export (context-spec-music (make-apply-context delete-prop) 'Voice))) + (defmacro-public def-grace-function (start stop) -- 2.39.5