From 878c21f14a906637d2e234176e17c8a36d4695fb Mon Sep 17 00:00:00 2001 From: Carl Sorensen Date: Thu, 16 Dec 2010 05:40:00 -0700 Subject: [PATCH] Fix 1456 Remove context argument from \overrideTimeSignatureSettings. It always applies to the Timing context, so no argument is necessary. Fix documentation and regression tests to match new behavior. Write conversion rules for convert-ly Run convert-ly on the documentation --- Documentation/de/notation/rhythms.itely | 6 +- Documentation/es/notation/rhythms.itely | 6 +- Documentation/fr/notation/rhythms.itely | 6 +- Documentation/notation/rhythms.itely | 111 ++++++++++++++---- .../regression/multiple-time-sig-settings.ly | 32 ++--- .../skiptypesetting-multimeasurerest.ly | 1 - ly/music-functions-init.ly | 16 +-- python/convertrules.py | 6 + scm/time-signature-settings.scm | 18 +-- 9 files changed, 131 insertions(+), 71 deletions(-) diff --git a/Documentation/de/notation/rhythms.itely b/Documentation/de/notation/rhythms.itely index 5dec8ca8c2..b1ea1362ae 100644 --- a/Documentation/de/notation/rhythms.itely +++ b/Documentation/de/notation/rhythms.itely @@ -7,7 +7,7 @@ Guide, node Updating translation committishes. @end ignore -@c \version "2.13.36" +@c \version "2.13.44" @c Translators: Till Paala @@ -1104,7 +1104,6 @@ werden. \score { \relative c' { \overrideTimeSignatureSettings - #'Score #'(4 . 4) % time signature fraction #'(1 . 4) % base moment fraction #'(3 1) % beatStructure @@ -1141,14 +1140,13 @@ Standard zurückgesetzt werden: \relative c' { \repeat unfold 8 { c8 } | \overrideTimeSignatureSettings - #'Score % context #'(4 . 4) % timeSignatureFraction #'(1 . 4) % baseMomentFraction #'(3 1) % beatStructure #'((end . (((1 . 8) . (3 1))))) % beamExceptions \time 4/4 \repeat unfold 8 { c8 } | - \revertTimeSignatureSettings #'Score #'(4 . 4) + \revertTimeSignatureSettings #'(4 . 4) \time 4/4 \repeat unfold 8 { c8 } | } diff --git a/Documentation/es/notation/rhythms.itely b/Documentation/es/notation/rhythms.itely index 38f53b1340..6378b7ecec 100644 --- a/Documentation/es/notation/rhythms.itely +++ b/Documentation/es/notation/rhythms.itely @@ -7,7 +7,7 @@ Guide, node Updating translation committishes.. @end ignore -@c \version "2.13.36" +@c \version "2.13.44" @node Duraciones @section Duraciones @@ -1096,7 +1096,6 @@ existentes se pueden cambiar, o pueden añadirse valores nuevos: \score { \relative c' { \overrideTimeSignatureSettings - #'Score % context #'(4 . 4) % timeSignatureFraction #'(1 . 4) % baseMomentFraction #'(3 1) % beatStructure @@ -1146,14 +1145,13 @@ compás se pueden restaurar a los valores originales: \relative c' { \repeat unfold 8 { c8 } | \overrideTimeSignatureSettings - #'Score % context #'(4 . 4) % timeSignatureFraction #'(1 . 4) % baseMomentFraction #'(3 1) % beatStructure #'((end . (((1 . 8) . (3 1))))) % beamExceptions \time 4/4 \repeat unfold 8 { c8 } | - \revertTimeSignatureSettings #'Score #'(4 . 4) + \revertTimeSignatureSettings #'(4 . 4) \time 4/4 \repeat unfold 8 { c8 } | } diff --git a/Documentation/fr/notation/rhythms.itely b/Documentation/fr/notation/rhythms.itely index 3da2258df9..839675dec3 100644 --- a/Documentation/fr/notation/rhythms.itely +++ b/Documentation/fr/notation/rhythms.itely @@ -7,7 +7,7 @@ Guide, node Updating translation committishes.. @end ignore -@c \version "2.13.36" +@c \version "2.13.44" @c Translators: Frédéric Chiasson, Jean-Charles Malahieude @c Translation checkers: Valentin Villenave, Jean-Charles Malahieude, @@ -1101,7 +1101,6 @@ pouvez les modifier de la manière suivante@tie{}: \score { \relative c' { \overrideTimeSignatureSettings - #'Score % context #'(4 . 4) % timeSignatureFraction #'(1 . 4) % baseMomentFraction #'(3 1) % beatStructure @@ -1139,14 +1138,13 @@ métrique@tie{}: \relative c' { \repeat unfold 8 { c8 } | \overrideTimeSignatureSettings - #'Score % context #'(4 . 4) % timeSignatureFraction #'(1 . 4) % baseMomentFraction #'(3 1) % beatStructure #'((end . (((1 . 8) . (3 1))))) % beamExceptions \time 4/4 \repeat unfold 8 c8 | - \revertTimeSignatureSettings #'Score #'(4 . 4) + \revertTimeSignatureSettings #'(4 . 4) \time 4/4 \repeat unfold 8 { c8 } | } diff --git a/Documentation/notation/rhythms.itely b/Documentation/notation/rhythms.itely index e463b9fcc6..9ec5165cd1 100644 --- a/Documentation/notation/rhythms.itely +++ b/Documentation/notation/rhythms.itely @@ -7,7 +7,7 @@ Guide, node Updating translation committishes.. @end ignore -@c \version "2.13.36" +@c \version "2.13.44" @node Rhythms @section Rhythms @@ -1056,25 +1056,23 @@ be changed, or new default values can be added: @lilypond[quote,verbatim] \score { - \relative c' { - \overrideTimeSignatureSettings - #'Score % context - #'(4 . 4) % timeSignatureFraction - #'(1 . 4) % baseMomentFraction - #'(3 1) % beatStructure - #'() % beamExceptions - \time 4/4 - \repeat unfold 8 { c8 } | + \new Staff { + \relative c' { + \overrideTimeSignatureSettings + #'(4 . 4) % timeSignatureFraction + #'(1 . 4) % baseMomentFraction + #'(3 1) % beatStructure + #'() % beamExceptions + \time 4/4 + \repeat unfold 8 { c8 } | + } } } @end lilypond -@code{\overrideTimeSignatureSettings} takes five arguments: +@code{\overrideTimeSignatureSettings} takes four arguments: @enumerate -@item -@code{@var{context}}, a Scheme symbol that describes the context -to which the default setting will apply. @item @code{@var{timeSignatureFraction}}, a Scheme pair describing the @@ -1094,6 +1092,38 @@ for the time signature that go beyond ending at every beat, as described in @ref{Setting automatic beam behavior}. @end enumerate +The context containing @code{\overrideTimeSignatureSettings} must +be instantiated before the @code{\overrideTimeSignatureSettings} +call is executed. That means it must either be explicitly +instantiated or there must be music in the context before the +@code{\overrideTimeSignatureSettings} call: + +@lilypond[quote,verbatim] +\score { + \relative c' { + % This call will fail because the context isn't yet instantiated + \overrideTimeSignatureSettings + #'(4 . 4) % timeSignatureFraction + #'(1 . 4) % baseMomentFraction + #'(3 1) % beatStructure + #'() % beamExceptions + \time 4/4 + c8^\markup {"Beamed (2 2)"} + \repeat unfold 7 { c8 } | + % This call will succeed + \overrideTimeSignatureSettings + #'(4 . 4) % timeSignatureFraction + #'(1 . 4) % baseMomentFraction + #'(3 1) % beatStructure + #'() % beamExceptions + \time 4/4 + c8^\markup {"Beamed (3 1)"} + \repeat unfold 7 { c8 } | + } +} +@end lilypond + + @cindex time signature properties, restoring default values @cindex restoring default properties for time signatures @funindex \revertTimeSignatureSettings @@ -1106,20 +1136,61 @@ to the original values: \relative c' { \repeat unfold 8 { c8 } | \overrideTimeSignatureSettings - #'Score % context - #'(4 . 4) % timeSignatureFraction - #'(1 . 4) % baseMomentFraction - #'(3 1) % beatStructure - #'((end . (((1 . 8) . (3 1))))) % beamExceptions + #'(4 . 4) % timeSignatureFraction + #'(1 . 4) % baseMomentFraction + #'(3 1) % beatStructure + #'() % beamExceptions \time 4/4 \repeat unfold 8 { c8 } | - \revertTimeSignatureSettings #'Score #'(4 . 4) + \revertTimeSignatureSettings #'(4 . 4) \time 4/4 \repeat unfold 8 { c8 } | } } @end lilypond +Different values of default time signature properties can be established +for different staves by moving the @code{Timing_translator} and the +@code{Default_bar_line_engraver} from the @code{Score} context to the +@code{Staff} context. + +@lilypond[quote, verbatim] +\score { + \new StaffGroup << + \new Staff { + \overrideTimeSignatureSettings + #'(4 . 4) % timeSignatureFraction + #'(1 . 4) % baseMomentFraction + #'(3 1) % beatStructure + #'() % beamExceptions + \time 4/4 + \repeat unfold 8 {c''8} + } + \new Staff { + \overrideTimeSignatureSettings + #'(4 . 4) % timeSignatureFraction + #'(1 . 4) % baseMomentFraction + #'(1 3) % beatStructure + #'() % beamExceptions + \time 4/4 + \repeat unfold 8 {c''8} + } + >> + \layout { + \context { + \Score + \remove "Timing_translator" + \remove "Default_bar_line_engraver" + } + \context { + \Staff + \consists "Timing_translator" + \consists "Default_bar_line_engraver" + } + } +} +@end lilypond + @predefined @code{\numericTimeSignature}, @code{\defaultTimeSignature}. diff --git a/input/regression/multiple-time-sig-settings.ly b/input/regression/multiple-time-sig-settings.ly index 9a91b5417c..8eac48ba25 100644 --- a/input/regression/multiple-time-sig-settings.ly +++ b/input/regression/multiple-time-sig-settings.ly @@ -1,4 +1,4 @@ -\version "2.13.33" +\version "2.13.44" \header { texidoc = " @@ -8,27 +8,27 @@ by the markups. " } -\relative c' { - \overrideTimeSignatureSettings - #'Score +\new Staff{ + \relative c' { + \overrideTimeSignatureSettings #'(4 . 4) % time signature fraction #'(1 . 4) % base moment fraction #'(1 1 1 1) % beatStructure #'() % beamExceptions - \overrideTimeSignatureSettings - #'Score + \overrideTimeSignatureSettings #'(3 . 4) % time signature fraction #'(1 . 4) % base moment fraction #'(1 1 1) % beatStructure #'() % beamExceptions - \time 4/4 - c8^\markup {"Beam by 1/4"} c c c c c c c | - \time 3/4 - c8^\markup {"Beam by 1/4"} c c c c c | - \revertTimeSignatureSettings #'Score #'(4 . 4) - \revertTimeSignatureSettings #'Score #'(3 . 4) - \time 4/4 - c8^\markup {"Beam by 1/2"} c c c c c c c | - \time 3/4 - c8^\markup {"Beam by 3/4"} c c c c c | + \time 4/4 + c8^\markup {"Beam by 1/4"} c c c c c c c | + \time 3/4 + c8^\markup {"Beam by 1/4"} c c c c c | + \revertTimeSignatureSettings #'(4 . 4) + \revertTimeSignatureSettings #'(3 . 4) + \time 4/4 + c8^\markup {"Beam by 1/2"} c c c c c c c | + \time 3/4 + c8^\markup {"Beam by 3/4"} c c c c c | + } } diff --git a/input/regression/skiptypesetting-multimeasurerest.ly b/input/regression/skiptypesetting-multimeasurerest.ly index ce2cd6290e..3c87f10403 100644 --- a/input/regression/skiptypesetting-multimeasurerest.ly +++ b/input/regression/skiptypesetting-multimeasurerest.ly @@ -7,7 +7,6 @@ When @code{skipTypesetting} is set during a @code{skipBars}-induced " } -\version "2.13.36" << { \time 3/4 diff --git a/ly/music-functions-init.ly b/ly/music-functions-init.ly index bd7e60e691..9d66ee72ed 100644 --- a/ly/music-functions-init.ly +++ b/ly/music-functions-init.ly @@ -462,17 +462,17 @@ ottava = overrideTimeSignatureSettings = #(define-music-function - (parser location context time-signature base-moment beat-structure beam-exceptions) - (symbol? pair? pair? cheap-list? cheap-list?) + (parser location time-signature base-moment beat-structure beam-exceptions) + (pair? pair? cheap-list? cheap-list?) - (_i "Override @code{timeSignatureSettings} in @var{context} + (_i "Override @code{timeSignatureSettings} for time signatures of @var{time-signature} to have settings of @var{base-moment}, @var{beat-structure}, and @var{beam-exceptions}.") ;; TODO -- add warning if largest value of grouping is ;; greater than time-signature. (let ((setting (make-setting base-moment beat-structure beam-exceptions))) - (override-time-signature-setting time-signature setting context))) + (override-time-signature-setting time-signature setting))) overrideProperty = #(define-music-function (parser location name property value) @@ -739,12 +739,12 @@ resetRelativeOctave = revertTimeSignatureSettings = #(define-music-function - (parser location context time-signature) - (symbol? pair?) + (parser location time-signature) + (pair?) - (_i "Revert @code{timeSignatureSettings} in @var{context} + (_i "Revert @code{timeSignatureSettings} for time signatures of @var{time-signature}.") - (revert-time-signature-setting time-signature context)) + (revert-time-signature-setting time-signature)) rightHandFinger = #(define-music-function (parser location finger) (number-or-string?) diff --git a/python/convertrules.py b/python/convertrules.py index be132ac5e3..e17095c388 100644 --- a/python/convertrules.py +++ b/python/convertrules.py @@ -3122,6 +3122,12 @@ def conv(str): stderr_write (UPDATE_MANUALLY); return str +@rule ((2, 13, 44), + _ ("Remove context from overrideTimeSignatureSettings and revertTimeSignatureSettings.")) +def conv(str): + str = re.sub (r"\\(override|revert)TimeSignatureSettings(\s+[^#]*)(#[^#]*)#", r"\\\1TimeSignatureSettings\2#", str) + return str + # Guidelines to write rules (please keep this at the end of this file) # diff --git a/scm/time-signature-settings.scm b/scm/time-signature-settings.scm index 42bf5bfd41..c5792d9b80 100644 --- a/scm/time-signature-settings.scm +++ b/scm/time-signature-settings.scm @@ -281,7 +281,7 @@ a fresh copy of the list-head is made." property (revert-member current-value setting))))) -(define-public (override-time-signature-setting time-signature setting . rest) +(define-public (override-time-signature-setting time-signature setting) "Override the time signature settings for the context in @var{rest}, with the new setting alist @var{setting}. " (context-spec-music @@ -291,17 +291,9 @@ with the new setting alist @var{setting}. " 'timeSignatureSettings time-signature setting))) - (if (and (pair? rest) (symbol? (car rest))) - (car rest) - 'Voice))) + 'Timing)) -(define-public (score-override-time-signature-setting - time-signature setting) - (override-time-signature-setting - time-signature setting 'Score)) - -(define-public (revert-time-signature-setting - time-signature . rest) +(define-public (revert-time-signature-setting time-signature) (context-spec-music (make-apply-context (lambda (c) @@ -309,6 +301,4 @@ with the new setting alist @var{setting}. " c 'timeSignatureSettings time-signature))) - (if (and (pair? rest) (symbol? (car rest))) - (car rest) - 'Voice))) + 'Timing)) -- 2.39.2