From 6c7a171483afdec10d0f6cfeff121c1e1bc9ebd1 Mon Sep 17 00:00:00 2001 From: David Kastrup Date: Wed, 17 Apr 2013 16:17:14 +0200 Subject: [PATCH] Issue 3322: Add callback factory grob::inherit-parent-property "@var{grob} callback generator for inheriting a @var{property} from an @var{axis} parent, defaulting to @var{default} if there is no parent or the parent has no setting." --- scm/output-lib.scm | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/scm/output-lib.scm b/scm/output-lib.scm index 4533cf2a96..f424931c2d 100644 --- a/scm/output-lib.scm +++ b/scm/output-lib.scm @@ -1099,6 +1099,19 @@ and draws the stencil based on its coordinates. (define-public ((grob::calc-property-by-non-event-cause prop) grob) (ly:grob-property (non-event-cause grob) prop)) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; general inheritance + +(define-public ((grob::inherit-parent-property axis property . default) grob) + "@var{grob} callback generator for inheriting a @var{property} from +an @var{axis} parent, defaulting to @var{default} if there is no +parent or the parent has no setting." + (let ((parent (ly:grob-parent grob axis))) + (cond + ((ly:grob? parent) + (apply ly:grob-property parent property default)) + ((pair? default) (car default)) + (else '())))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; fret boards -- 2.39.5