From: Mark Polesky Date: Fri, 11 Jul 2014 06:11:16 +0000 (-0700) Subject: Issue 3997: \magnifyMusic: don't modify nested properties. X-Git-Tag: release/2.19.10-1~5 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=49adeb064850d230ef3f1163aa29cfa5930f996e;p=lilypond.git Issue 3997: \magnifyMusic: don't modify nested properties. Also reformat Scheme code. --- diff --git a/ly/music-functions-init.ly b/ly/music-functions-init.ly index 78a6b236c4..b5eb7feb0f 100644 --- a/ly/music-functions-init.ly +++ b/ly/music-functions-init.ly @@ -642,19 +642,21 @@ slurs, ties, and horizontal spacing are adjusted automatically.") (define unshrinkable-props '( ;; stems - Stem.thickness + (Stem thickness) + ;; slurs - Slur.line-thickness - Slur.thickness - PhrasingSlur.line-thickness - PhrasingSlur.thickness + (Slur line-thickness) + (Slur thickness) + (PhrasingSlur line-thickness) + (PhrasingSlur thickness) + ;; ties - Tie.line-thickness - Tie.thickness - LaissezVibrerTie.line-thickness - LaissezVibrerTie.thickness - RepeatTie.line-thickness - RepeatTie.thickness + (Tie line-thickness) + (Tie thickness) + (LaissezVibrerTie line-thickness) + (LaissezVibrerTie thickness) + (RepeatTie line-thickness) + (RepeatTie thickness) )) ;; these props ARE allowed to shrink below default size @@ -662,61 +664,21 @@ slurs, ties, and horizontal spacing are adjusted automatically.") '( ;; TODO: uncomment spacing-increment here once Issue 3987 is fixed ;; override at the 'Score level - ;SpacingSpanner.spacing-increment - - ;; Beam.beam-thickness is dealt with separately below + ;(SpacingSpanner spacing-increment) ;; lengths and heights - Beam.length-fraction - Stem.length-fraction - Stem.beamlet-default-length - Slur.height-limit - Slur.minimum-length - PhrasingSlur.height-limit - PhrasingSlur.minimum-length - - ;; every Slur.details prop that's - ;; not a factor, penalty, ratio, or slope - Slur.details.region-size - Slur.details.free-head-distance - Slur.details.free-slur-distance - Slur.details.gap-to-staffline-inside - Slur.details.gap-to-staffline-outside - Slur.details.extra-encompass-free-distance - Slur.details.extra-encompass-collision-distance - Slur.details.close-to-edge-length - Slur.details.encompass-object-range-overshoot - Slur.details.slur-tie-extrema-min-distance - - ;; every PhrasingSlur.details prop that's - ;; not a factor, penalty, ratio, or slope - PhrasingSlur.details.region-size - PhrasingSlur.details.free-head-distance - PhrasingSlur.details.free-slur-distance - PhrasingSlur.details.gap-to-staffline-inside - PhrasingSlur.details.gap-to-staffline-outside - PhrasingSlur.details.extra-encompass-free-distance - PhrasingSlur.details.extra-encompass-collision-distance - PhrasingSlur.details.close-to-edge-length - PhrasingSlur.details.encompass-object-range-overshoot - PhrasingSlur.details.slur-tie-extrema-min-distance - - ;; every Tie.details prop that's - ;; not a factor, penalty, ratio, or slope - Tie.details.center-staff-line-clearance - Tie.details.tip-staff-line-clearance - Tie.details.note-head-gap - Tie.details.stem-gap - Tie.details.height-limit - Tie.details.tie-tie-collision-distance - Tie.details.intra-space-threshold - Tie.details.outer-tie-vertical-gap - Tie.details.multi-tie-region-size - Tie.details.single-tie-region-size - Tie.details.between-length-limit + (Beam length-fraction) + (Stem length-fraction) + (Stem beamlet-default-length) + (Slur height-limit) + (Slur minimum-length) + (PhrasingSlur height-limit) + (PhrasingSlur minimum-length) + + ;; Beam.beam-thickness is dealt with separately below )) #{ - \context Voice { + \context Bottom { %% TODO: uncomment \newSpacingSection once Issue 3990 is fixed %\newSpacingSection #(scale-fontSize mag) @@ -732,7 +694,7 @@ slurs, ties, and horizontal spacing are adjusted automatically.") #(revert-fontSize mag) #(revert-props (append unshrinkable-props shrinkable-props - (list 'Beam.beam-thickness))) + '((Beam beam-thickness)))) } #}) diff --git a/scm/music-functions.scm b/scm/music-functions.scm index b8ceadf5bd..791547706f 100644 --- a/scm/music-functions.scm +++ b/scm/music-functions.scm @@ -2430,48 +2430,27 @@ factor @var{mag}, and do the equivalent of a than the current value. Props are formatted like: @example -Slur.height-limit -Slur.details.region-size +'(Slur height-limit) @end example" (make-apply-context (lambda (context) - (define (scale-prop grob.prop) - (let* ((grob-prop-list (map string->symbol - (string-split - (symbol->string grob.prop) #\.))) - (prop-is-alist? (eq? 3 (length grob-prop-list))) - (grob (car grob-prop-list)) + (define (scale-prop grob-prop-list) + (let* ((grob (car grob-prop-list)) (prop (cadr grob-prop-list)) (where (if (eq? grob 'SpacingSpanner) (ly:context-find context 'Score) context)) - (grob-def (ly:context-grob-definition where grob))) - (if prop-is-alist? - (let* ((subprop (caddr grob-prop-list)) - (old-alist (ly:assoc-get prop grob-def)) - (val (ly:assoc-get subprop old-alist 1)) - (round-if-needed - (lambda (x) - ;; these props require exact integers - (if (or (eq? subprop 'multi-tie-region-size) - (eq? subprop 'single-tie-region-size)) - (inexact->exact (round x)) - x))) - (new-val (if allowed-to-shrink? - (round-if-needed (* val mag)) - (round-if-needed (* val (max 1 mag))))) - (new-alist (cons (cons subprop new-val) old-alist))) - (ly:context-pushpop-property where grob prop new-alist)) - (let* ((val (ly:assoc-get prop grob-def 1)) - (proc (lambda (x) - (if allowed-to-shrink? - (* x mag) - (* x (max 1 mag))))) - (new-val (if (number-pair? val) - (cons (proc (car val)) - (proc (cdr val))) - (proc val)))) - (ly:context-pushpop-property where grob prop new-val))))) + (grob-def (ly:context-grob-definition where grob)) + (val (ly:assoc-get prop grob-def 1)) + (proc (lambda (x) + (if allowed-to-shrink? + (* x mag) + (* x (max 1 mag))))) + (new-val (if (number-pair? val) + (cons (proc (car val)) + (proc (cdr val))) + (proc val)))) + (ly:context-pushpop-property where grob prop new-val))) (for-each scale-prop props)))) (define-public (scale-beam-thickness mag) @@ -2496,27 +2475,12 @@ scaling, then does the equivalent of a Props are formatted like: @example -Slur.height-limit -Slur.details.region-size -@end example - -Nested properties are reverted by reverting the parent property only. -For example, @code{Slur.details.region-size} gets reverted like this: - -@example -\revert Slur.details -@end example - -This is safe as long as the number of reverts matches the number of -overrides. Any user overrides within a @code{\\magnifyMusic} block -should be reverted before closing the block." +'(Slur height-limit) +@end example" (make-apply-context (lambda (context) - (define (revert-prop grob.prop) - (let* ((grob-prop-list (map string->symbol - (string-split - (symbol->string grob.prop) #\.))) - (grob (car grob-prop-list)) + (define (revert-prop grob-prop-list) + (let* ((grob (car grob-prop-list)) (prop (cadr grob-prop-list)) (where (if (eq? grob 'SpacingSpanner) (ly:context-find context 'Score)