]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 3997: \magnifyMusic: don't modify nested properties.
authorMark Polesky <markpolesky@yahoo.com>
Fri, 11 Jul 2014 06:11:16 +0000 (23:11 -0700)
committerMark Polesky <markpolesky@yahoo.com>
Fri, 11 Jul 2014 06:36:01 +0000 (23:36 -0700)
Also reformat Scheme code.

ly/music-functions-init.ly
scm/music-functions.scm

index 78a6b236c4c7861ed53b5af45b83a81cda3a8582..b5eb7feb0fd917945b2a4efd6902944b245f72af 100644 (file)
@@ -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))))
      }
    #})
 
index b8ceadf5bde6d516fa464ed827c439ec87a80ee8..791547706f4e8f6faf302bbd0e46a72a5dcb575b 100644 (file)
@@ -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)