diff options
author | David Kastrup <dak@gnu.org> | 2013-09-10 18:22:40 +0200 |
---|---|---|
committer | David Kastrup <dak@gnu.org> | 2015-10-05 12:28:52 +0200 |
commit | dd9cdec4d7fb538b3a201f3b82a10b5ac9ef5f79 (patch) | |
tree | 1b89f538c0b1ff45bebb2cdccdba61f0a233046e | |
parent | aa2b5b377586a52fcb6b14d4dd464b94f6738560 (diff) |
Issue 4131/1: Reimplement forced partcombine decisions via context properties
One music type and concept less to worry about.
Since this tracks the partcombine decisions via context properties,
using one forced partcombine override in one voice will not be cancelled
by another forced partcombine in another.
In the event stream, \once\override is indistinguishable from
\override ... \revert so in order to be able to implement
\once\partcombine ... in one voice, we have to retain any permanent
\partcombineForce in the other.
-rw-r--r-- | input/regression/part-combine-force.ly | 6 | ||||
-rw-r--r-- | ly/music-functions-init.ly | 20 | ||||
-rw-r--r-- | ly/property-init.ly | 21 | ||||
-rw-r--r-- | scm/define-context-properties.scm | 3 | ||||
-rw-r--r-- | scm/define-event-classes.scm | 2 | ||||
-rw-r--r-- | scm/define-music-properties.scm | 1 | ||||
-rw-r--r-- | scm/define-music-types.scm | 5 | ||||
-rw-r--r-- | scm/part-combiner.scm | 13 |
8 files changed, 39 insertions, 32 deletions
diff --git a/input/regression/part-combine-force.ly b/input/regression/part-combine-force.ly index fda6838ce6..e988e1e1cc 100644 --- a/input/regression/part-combine-force.ly +++ b/input/regression/part-combine-force.ly @@ -1,9 +1,9 @@ \header { texidoc ="Overrides for the part-combiner. All functions like - @code{\\partcombineApart} and @code{\\partcombineApartOnce} are internally implemented - using a dedicated @code{PartCombineForceEvent}. -" + @code{\\partcombineApart} and @code{\\partcombineApartOnce} are + internally implemented using a dedicated @code{partCombineForced} + context property." } \layout { ragged-right = ##t } diff --git a/ly/music-functions-init.ly b/ly/music-functions-init.ly index e976cb6644..5c6fb24e6e 100644 --- a/ly/music-functions-init.ly +++ b/ly/music-functions-init.ly @@ -1294,25 +1294,7 @@ that they share a staff with stems directed downward.") #{ \with { \voiceTwo \override DynamicLineSpanner.direction = #DOWN } #} #{ \with { \voiceTwo \override DynamicLineSpanner.direction = #DOWN } #} )) -partcombineForce = -#(define-music-function (type once) (boolean-or-symbol? boolean?) - (_i "Override the part-combiner.") - (make-music 'EventChord - 'elements (list (make-music 'PartCombineForceEvent - 'forced-type type - 'once once)))) -partcombineApart = \partcombineForce #'apart ##f -partcombineApartOnce = \partcombineForce #'apart ##t -partcombineChords = \partcombineForce #'chords ##f -partcombineChordsOnce = \partcombineForce #'chords ##t -partcombineUnisono = \partcombineForce #'unisono ##f -partcombineUnisonoOnce = \partcombineForce #'unisono ##t -partcombineSoloI = \partcombineForce #'solo1 ##f -partcombineSoloIOnce = \partcombineForce #'solo1 ##t -partcombineSoloII = \partcombineForce #'solo2 ##f -partcombineSoloIIOnce = \partcombineForce #'solo2 ##t -partcombineAutomatic = \partcombineForce ##f ##f -partcombineAutomaticOnce = \partcombineForce ##f ##t +%% Part combine forcing to be found in ly/property-init.ly partial = #(define-music-function (dur) (ly:duration?) diff --git a/ly/property-init.ly b/ly/property-init.ly index 4a11fcf4d7..16275693e9 100644 --- a/ly/property-init.ly +++ b/ly/property-init.ly @@ -405,6 +405,27 @@ palmMute = (_i "Print @var{note} with a triangle-shaped note head.") (style-note-heads 'NoteHead 'do note)) +%% part combiner + +partcombineForce = +#(define-music-function (type) ((symbol?)) + (_i "Override the part-combiner.") + (if type (propertySet 'partCombineForced type) + (propertyUnset 'partCombineForced))) + +partcombineApart = \partcombineForce #'apart +partcombineApartOnce = \once \partcombineApart +partcombineChords = \partcombineForce #'chords +partcombineChordsOnce = \once \partcombineChords +partcombineUnisono = \partcombineForce #'unisono +partcombineUnisonoOnce = \once \partcombineUnisono +partcombineSoloI = \partcombineForce #'solo1 +partcombineSoloIOnce = \once \partcombineSoloI +partcombineSoloII = \partcombineForce #'solo2 +partcombineSoloIIOnce = \once \partcombineSoloII +partcombineAutomatic = \partcombineForce \default +partcombineAutomaticOnce = \once \partcombineAutomatic + %% phrasing slurs diff --git a/scm/define-context-properties.scm b/scm/define-context-properties.scm index 3ad11f4913..df664bd98f 100644 --- a/scm/define-context-properties.scm +++ b/scm/define-context-properties.scm @@ -495,6 +495,9 @@ Changing this creates a new text spanner.") translator during music interpretation.") + (partCombineForced ,symbol? "Override for the partcombine +decision. Can be @code{apart}, @code{chords}, @code{unisono}, +@code{solo1}, or @code{solo2}.") (partCombineTextsOnNote ,boolean? "Print part-combine texts only on the next note rather than immediately on rests or skips.") (pedalSostenutoStrings ,list? "See @code{pedalSustainStrings}.") diff --git a/scm/define-event-classes.scm b/scm/define-event-classes.scm index dd976e1b04..4eebdfac0e 100644 --- a/scm/define-event-classes.scm +++ b/scm/define-event-classes.scm @@ -31,7 +31,7 @@ extender-event span-event rhythmic-event dynamic-event break-event label-event percent-event key-change-event string-number-event stroke-finger-event tie-event - part-combine-event part-combine-force-event + part-combine-event beam-forbid-event script-event tempo-change-event tremolo-event bend-after-event fingering-event glissando-event harmonic-event hyphen-event diff --git a/scm/define-music-properties.scm b/scm/define-music-properties.scm index 0bcc5a20af..4df3f93340 100644 --- a/scm/define-music-properties.scm +++ b/scm/define-music-properties.scm @@ -96,7 +96,6 @@ a sequential iterator. Takes a single music parameter.") (footnote-text ,markup? "Text to appear in a footnote.") (force-accidental ,boolean? "If set, a cautionary accidental should always be printed on this note.") - (forced-type ,symbol? "Override for the part-combiner.") (grob-property ,symbol? "The symbol of the grob property to set.") (grob-property-path ,list? "A list of symbols, locating a nested grob diff --git a/scm/define-music-types.scm b/scm/define-music-types.scm index 5ae59799f6..e0190eda55 100644 --- a/scm/define-music-types.scm +++ b/scm/define-music-types.scm @@ -386,11 +386,6 @@ Syntax: @code{\\override} [ @var{context} @code{.} ] (types . (break-event page-turn-event event)) )) - (PartCombineForceEvent - . ((description . "Override the part-combiner's strategy.") - (types . (part-combine-force-event event)) - )) - (PartialSet . ((description . "Create an anacrusis or upbeat (partial measure).") (iterator-ctor . ,ly:partial-iterator::constructor) diff --git a/scm/part-combiner.scm b/scm/part-combiner.scm index 71b5e56526..94860cdf6f 100644 --- a/scm/part-combiner.scm +++ b/scm/part-combiner.scm @@ -345,9 +345,16 @@ LilyPond version 2.8 and earlier." (define (analyse-forced-combine result-idx prev-res) (define (get-forced-event x) - (and (ly:in-event-class? x 'part-combine-force-event) - (cons (ly:event-property x 'forced-type) - (ly:event-property x 'once)))) + (cond + ((and (ly:in-event-class? x 'SetProperty) + (eq? (ly:event-property x 'symbol) 'partCombineForced)) + (cons (ly:event-property x 'value #f) + (ly:event-property x 'once #f))) + ((and (ly:in-event-class? x 'UnsetProperty) + (eq? (ly:event-property x 'symbol) 'partCombineForced)) + (cons #f (ly:event-property x 'once #f))) + (else #f))) + (define (part-combine-events vs) (if (not vs) '() |