]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 4131/1: Reimplement forced partcombine decisions via context properties
authorDavid Kastrup <dak@gnu.org>
Tue, 10 Sep 2013 16:22:40 +0000 (18:22 +0200)
committerDavid Kastrup <dak@gnu.org>
Mon, 5 Oct 2015 10:28:52 +0000 (12:28 +0200)
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.

input/regression/part-combine-force.ly
ly/music-functions-init.ly
ly/property-init.ly
scm/define-context-properties.scm
scm/define-event-classes.scm
scm/define-music-properties.scm
scm/define-music-types.scm
scm/part-combiner.scm

index fda6838ce690207dfcb2e291dabeb6861218353c..e988e1e1cc9672254e18a128d148480631dbd667 100644 (file)
@@ -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 }
index e976cb66440498876a627e339fc194e0bbd35441..5c6fb24e6ed04e773d5f41bc22d40d0a6c13b046 100644 (file)
@@ -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?)
index 4a11fcf4d716c818ae3c519a65fcd7c837d3ba19..16275693e9ac8920ef0358da58184e3ff2ca27c2 100644 (file)
@@ -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
 
index 3ad11f49133bd29eff0792065b92a6645fb7d7ed..df664bd98f09b1ea413129621432fa139bbee579 100644 (file)
@@ -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}.")
index dd976e1b04d15ce64e443e830c3a2c19d04434a5..4eebdfac0ee7627aec9cdc616fbafe7e58bcb2b1 100644 (file)
@@ -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
index 0bcc5a20afca3ce95ec88ced86da76ed28d2e46e..4df3f933405fd4a1be7ea953eae62912a295bcb5 100644 (file)
@@ -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
index 5ae59799f604303e90bdebcc25f448653ca3e755..e0190eda5516c419eb6763affa58e968b082ae20 100644 (file)
@@ -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)
index 71b5e5652643c4017f135145194360d20d1305d8..94860cdf6fc5a56103e700abab7a6140a0d1f02a 100644 (file)
@@ -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)
             '()