#(define (make-box thick padding filled fill-color open-on-left open-on-right xext yext) (let* ((xext (interval-widen xext padding)) (yext (interval-widen yext padding))) (ly:stencil-add (if filled (ly:make-stencil (list 'color fill-color (list 'round-filled-box (- (- (car xext) thick)) (+ (cdr xext) thick) (- (car yext)) (cdr yext) 0.0) xext yext)) empty-stencil) (if (> thick 0) (make-filled-box-stencil (cons (- (car xext) thick) (+ (cdr xext) thick)) (cons (- (car yext) thick) (car yext))) empty-stencil) (if (> thick 0) (make-filled-box-stencil (cons (- (car xext) thick) (+ (cdr xext) thick)) (cons (cdr yext) (+ (cdr yext) thick))) empty-stencil) (if (and (not open-on-right) (> thick 0)) (make-filled-box-stencil (cons (cdr xext) (+ (cdr xext) thick)) yext) empty-stencil) (if (and (not open-on-left) (> thick 0)) (make-filled-box-stencil (cons (- (car xext) thick) (car xext)) yext) empty-stencil) ))) #(define (music-boxer-stencil grob) (let* ((elts (ly:grob-object grob 'elements)) (refp-X (ly:grob-common-refpoint-of-array grob elts X)) (X-ext (ly:relative-group-extent elts refp-X X)) (refp-Y (ly:grob-common-refpoint-of-array grob elts Y)) (Y-ext (ly:relative-group-extent elts refp-Y Y)) (padding (ly:grob-property grob 'padding 0.3)) (thick (ly:grob-property grob 'thickness 0.1)) (filled (ly:grob-property grob 'filled #f)) (fill-color (ly:grob-property grob 'fill-color grey)) (offset (ly:grob-relative-coordinate grob refp-X X)) ; (left-bound (ly:spanner-bound grob LEFT)) ; (right-bound (ly:spanner-bound grob RIGHT)) ; (break-dir-L (ly:item-break-dir left-bound)) ; (break-dir-R (ly:item-break-dir right-bound)) ; (open-on-left (if (= 1 break-dir-L) #t #f)) ; (open-on-right (if (= -1 break-dir-R) #t #f)) (open-on-left (and (ly:spanner? grob) (= 1 (ly:item-break-dir (ly:spanner-bound grob LEFT))))) ; (open-on-left ; (if (ly:spanner? grob) ; (if (= 1 (ly:item-break-dir (ly:spanner-bound grob LEFT))) ; #t #f) ; #f)) (open-on-right (and (ly:spanner? grob) (= -1 (ly:item-break-dir (ly:spanner-bound grob RIGHT))))) ;(open-on-right ;(if (ly:spanner? grob) ; (if (= -1 (ly:item-break-dir (ly:spanner-bound grob RIGHT))) ; #t #f) ; #f)) (stil (make-box thick padding filled fill-color open-on-left open-on-right X-ext Y-ext)) ) (ly:stencil-translate-axis stil (- offset) X) ) )