]> git.donarmstrong.com Git - lilypond.git/commitdiff
Neil's patch for hairpin to bar line.
authorGraham Percival <graham@percival-music.ca>
Tue, 29 Apr 2008 03:43:41 +0000 (20:43 -0700)
committerGraham Percival <graham@percival-music.ca>
Tue, 29 Apr 2008 03:43:41 +0000 (20:43 -0700)
- remove hairpinToBarline snippet from expressive.itely
- remove hairpinToBarline from define-context-properties.scm
- change hairpin regression tests to reflect 'to-barline default
- remove backwards compatibility support for hairpinToBarline
- add 'to-barline snippet for Hairpin to input/new
- improve adding-text-indications-to-metronome-marks.ly

12 files changed:
Documentation/de/user/expressive.itely
Documentation/es/user/expressive.itely
Documentation/fr/user/expressive.itely
Documentation/user/expressive.itely
input/new/adding-text-indications-to-metronome-marks.ly
input/new/setting-hairpin-behavior-at-bar-lines.ly [new file with mode: 0644]
input/regression/hairpin-barline-break.ly
input/regression/hairpin-to-barline-mark.ly
input/regression/hairpin-to-barline.ly
lily/dynamic-engraver.cc
python/convertrules.py
scm/define-context-properties.scm

index b51c1833947030fd31edc8243e1508c01334aecf..a7e8afc12c86bfe31759cdc0c91f8cda1f910952 100644 (file)
@@ -184,10 +184,7 @@ fällt, endet die Klammer an der direkt vorhergehenden Taktlinie. Diese
 Einstellung lässt sich aber durch die Eigenschaft @code{hairpinToBarline} 
 verändern.
 
-@lilypond[quote,ragged-right,fragment,verbatim,relative=2]
-\set hairpinToBarline = ##f
-c4\< c2. c4\!
-@end lilypond
+@c TODO: Add link to new snippet for #'to-barline
 
 In manchen Situationen kann auch der @code{\espressivo}-Befehl 
 geeignet sein, ein An- und Abschwellen einer Note anzuzeigen.
index 1e26f4e573d27f0ff2f8700fb610ee72e0c1142c..030cbc59d165a04a409a3113046785ec8379a67e 100644 (file)
@@ -253,11 +253,7 @@ nota final cae sobre el principio de un compás, el
 anterior.  Esto se puede modificar estableciendo la propiedad
 @code{hairpinToBarline}:
 
-@lilypond[verbatim,quote,ragged-right,fragment,relative=2]
-e4\< e2. e1\!
-\set hairpinToBarline = ##f
-e4\< e2. e1\!
-@end lilypond
+@c TODO: Add link to new snippet for #'to-barline
 
 @cindex espressivo, articulación
 
index 5727f9b293bfbcd3e62d20b659a8674b242766c2..b8b906f762b5f200731a53ac345b34ffaaa245fb 100644 (file)
@@ -187,10 +187,7 @@ barre de mesure qui la précède.  Ce comportement peut être annulé
 en assignant @emph{faux} (lettre @q{f}) à la propriété
 @code{hairpinToBarline} :
 
-@lilypond[quote,ragged-right,fragment,verbatim,relative=2]
-\set hairpinToBarline = ##f
-c4\< c2. c4\!
-@end lilypond
+@c TODO: Add link to new snippet for #'to-barline
 
 On peut avoir recours à l'indication @code{\espressivo} pour indiquer un
 crescendo puis un decrescendo sur une seule note.
index c0ac7b89ef0dec568236d33b68bc50b203d20f2b..50d9e322c4f78c10041b86ab78d6810844b38c86 100644 (file)
@@ -231,12 +231,7 @@ on the immediately preceding bar line.  The following example
 illustrates this behavior:
 
 @c This example currently does not work. -pm
-
-@lilypond[verbatim,quote,ragged-right,fragment,relative=2]
-e4\< e2. e1\!
-\set hairpinToBarline = ##f
-e4\< e2. e1\!
-@end lilypond
+@c TODO: Add link to new snippet for #'to-barline
 
 Spacer notes are needed to engrave multiple marks on one note.
 
index 630ee5a1df34587d58ac684c3a5d5008851c318d..59ce545537800e616a2512474823d3d686739d52 100644 (file)
@@ -1,59 +1,58 @@
-\version "2.11.43"
+\version "2.11.45"
 \header {
-  lsrtags = "expressive-marks,text,tweaks-and-overrides"
+  lsrtags = "expressive-marks,tweaks-and-overrides"
   texidoc = "
 Using Scheme code to override the stencil for @code{MetronomeMark}
 objects, this example allows the creation of metronome marks which include
-text directions.  The function @code{\tempoChangeMarkup} is called with three
-strings: the text label, note duration, and beats per minute.  To print the
-new metronome mark, this is followed by the standard @code{\tempo} command.
+text directions.  The function @code{\movement} is called with three
+arguments: the text label, note duration, and beats per minute.
 "
   doctitle = "Adding text indications to metronome marks"
 }
 
-% Thanks to Alexander Kobel for this snippet
+#(define-markup-command (mvt layout props arg) (markup?)
+  (interpret-markup layout props
+     (markup #:huge #:bold arg)))
 
-tempoMarkLabelSize = #0
-tempoMarkNoteSize = #-6
+#(define (string->duration duration-string)
+  "Parse the `duration-string', e.g. ''4..'' or ''breve.'', and return a duration object."
+  (let* ((length (string-length duration-string))
+         (dot-index (or (string-index duration-string #\.) length))
+         (len (substring duration-string 0 dot-index))
+         (dots (- length dot-index)))
+   (ly:make-duration (cond ((string=? len "breve") -1)
+                           ((string=? len "longa") -2)
+                           ((string=? len "maxima") -3)
+                           (else (log2 (string->number len))))
+                     dots 1 1)))
 
-#(define (tempoChangeMarkupFactory grob label noteValue tempo)
- (interpret-markup
-  (ly:grob-layout grob)
-  (ly:grob-alist-chain grob (ly:output-def-lookup (ly:grob-layout grob) 'text-font-defaults))
-  (markup
-   #:fontsize tempoMarkLabelSize #:italic #:concat (label (if (string-null? label) "(" " (" ))
-   #:hspace -1
-   #:fontsize tempoMarkNoteSize #:general-align Y DOWN #:note noteValue UP
-   #:fontsize tempoMarkLabelSize #:italic #:concat( "= " tempo ")" )
-  )
- ))
+movement = #(define-music-function (parser location text duration count music)
+                        (string? string? integer? ly:music?)
+   (define (format-movement-markup dur count context)
+     (markup #:mvt text #:hspace 1
+             #:concat ("(" #:general-align Y DOWN #:smaller #:note duration 1)
+             "="
+             #:concat ((number->string count) ")")))
+  #{
+    \set Score.metronomeMarkFormatter = #$format-movement-markup
+    \set Score.tempoWholesPerMinute = #$(ly:moment-mul (ly:make-moment count 1)
+                                         (ly:duration-length
+                                           (string->duration duration)))
+    \set Score.tempoUnitDuration = #$(string->duration duration)
+    \set Score.tempoUnitCount = $count
+    $music
+    \set Score.metronomeMarkFormatter = #format-metronome-markup
+  #})
 
-#(define (tempoChangeStencil label noteValue tempo)
- (lambda (grob)
-  (tempoChangeMarkupFactory grob label noteValue tempo)
- ))
+\layout { ragged-right = ##f }
 
-tempoChangeMarkup = #(define-music-function (parser location label noteValue tempo) (string? string? string?)
-       #{
-         \once \override Score.MetronomeMark #'stencil = #(tempoChangeStencil $label $noteValue $tempo)
-       #})
-
-\relative c' {
-  \time 4/4
-  \clef treble
-  % initialize the override
-  \tempoChangeMarkup #"Moderato" #"4" #"63"
-  % markup is printed
-  \tempo 4 = 63
-  c4 d e f
-  g a b c
-  \time 6/4
-  \mark \default
-  \tempoChangeMarkup #"presto" #"2." #"90"
-  \tempo 2. = 90
-  c2. g \break
-  e \tempoChangeMarkup #"handling collision with RehearsalMark" #"4" #"120" \tempo 4 = 120 c
-  \time 4/4
-  \mark \default
-  c1
+\relative c' { 
+  \time 3/4
+  \movement "Allegro" "2." #92
+  c2 e4
+  g2.
+  \movement "Moderato" "4" #104
+  f4 e d
+  \tempo 4 = 92
+  c2.
 }
diff --git a/input/new/setting-hairpin-behavior-at-bar-lines.ly b/input/new/setting-hairpin-behavior-at-bar-lines.ly
new file mode 100644 (file)
index 0000000..5650871
--- /dev/null
@@ -0,0 +1,17 @@
+\version "2.11.46"\r
+\header {\r
+  lsrtags = "expressive-marks"\r
+  texidoc = "If the note which ends a hairpin falls on a downbeat,\r
+the hairpin stops at the bar line immediately preceding.  This behavior\r
+can be controlled by overriding the @code{'to-barline} property.\r
+"\r
+  doctitle = "Setting hairpin behavior at bar lines"\r
+}\r
+\r
+\relative c'' {\r
+  e4\< e2.\r
+  e1\!\r
+  \override Hairpin #'to-barline = ##f\r
+  e4\< e2.\r
+  e1\!\r
+}\r
index 754871be630aa8073e88dd92fd48620d99cc78f4..bcaa0630f55edf7f6f24eadf88c211fef6f27af7 100644 (file)
@@ -1,14 +1,13 @@
 \header {
 
-  texidoc ="If a hairpin ends on the first note of a new stave, we
-don't print that ending.  But on the previous line, this hairpin
-should not be left open, and should end at the barline. "
+  texidoc = "If a hairpin ends on the first note of a new stave, we
+do not print that ending.  But on the previous line, this hairpin
+should not be left open, and should end at the bar line. "
 }
 
-\version "2.10.0"
-\layout { ragged-right = ##t }
+\version "2.11.46"
+
 \relative c' {
-  \set hairpinToBarline = ##t
   c1\>
   \break
   c1\!
index 488ae8bc80cdb1d1481bb6968a9937de3ac88070..041e1232e19ba1a08a832cbd29876bef3f9078ac 100644 (file)
@@ -1,13 +1,13 @@
-\version "2.11.12"
-\paper { ragged-right = ##t }
+\version "2.11.46"
+
 \header {
 
-  texidoc = "hairpinToBarline is not confused by very long marks."
+  texidoc = "'to-barline is not confused by very long marks."
 
 }
 
 \new Staff \relative c' {
-  c1\< |
+  c1\<
   \mark "Very long mark"
-  c4\> c c c\! |
+  c4\> c c c\!
 }
index e5c450a3c2c98810f865831da4fa85877b347025..f9d0ee1ee8a4ea61e08ac0f889fcf2ddbe405179 100644 (file)
@@ -1,18 +1,13 @@
 \header {
 
-  texidoc = "By setting @code{hairpinToBarline}, hairpins will stop at
-the barline preceding the ending note."
+  texidoc = "Hairpins whose end note is preceded by a bar line
+should end at that bar line. "
 
 }
 
-\version "2.10.0"
-
-\paper {
-  ragged-right = ##t
-}
+\version "2.11.46"
 
 \relative c'' {
-  \set hairpinToBarline = ##t
   \override Hairpin #'bound-padding = #1.0
   c4\< c2. c4\!
 }
index 51161d15017c7d43498d8773ee85053b514f3401..2f66955d446317d3ad5682d633b992c579ee0c06 100644 (file)
@@ -176,16 +176,6 @@ Dynamic_engraver::process_music ()
            }
 
          finished_cresc_ = cresc_;
-
-         /* backwards compatibility with hairpinToBarline */
-         if (finished_cresc_->get_property ("to-barline") == SCM_EOL)
-           {
-             bool use_bar = to_boolean (get_property ("hairpinToBarline"))
-               && scm_is_string (get_property ("whichBar"));
-
-             finished_cresc_->set_property ("to-barline", scm_from_bool (use_bar));
-           }
-
          announce_end_grob (finished_cresc_, SCM_EOL);
          cresc_ = 0;
          current_cresc_ev_ = 0;
index 22ed07ad6072fac7c4d164ca80813fef6bc13c91..31d756f0e4cb2efd1ae737ff59290b4f6dfc95c6 100644 (file)
@@ -3033,3 +3033,18 @@ def conv (str):
 
 conversions.append (((2, 11, 38), conv, """\\setEasyHeads -> \\easyHeadsOn, \\fatText -> \\textLengthOn,
 \\emptyText -> \\textLengthOff"""))
+
+def conv (str):
+    str = re.sub (r"\\set\s+([a-zA-Z]+)\s*.\s*hairpinToBarline\s*=\s*##([tf]+)",
+                  r"\\override \1.Hairpin #'to-barline = ##\2", str)
+    str = re.sub (r"\\set\s+hairpinToBarline\s*=\s*##([tf]+)",
+                  r"\\override Hairpin #'to-barline = ##\1", str)
+    str = re.sub (r"\\unset\s+([a-zA-Z]+)\s*.\s*hairpinToBarline",
+                  r"\\revert \1.Hairpin #'to-barline", str)
+    str = re.sub (r"\\unset\s+hairpinToBarline",
+                  r"\\revert Hairpin #'to-barline", str)
+    str = re.sub (r"hairpinToBarline\s*=\s*##([tf]+)",
+                  r"\\override Hairpin #'to-barline = ##\1", str)
+    return str
+
+conversions.append (((2, 11, 46), conv, """\\set hairpinToBarline -> \\override Hairpin #'to-barline"""))
index e8c22474325ffa41203086b22a69bd6bbde5925a..e506ed24fea8a978dffb9be277b99910a9374c92 100644 (file)
@@ -231,8 +231,6 @@ for the full staff.")
 @code{GridPoint}s.")
 
 
-     (hairpinToBarline ,boolean? "If set, end a hairpin at the barline
-before the ending note.")
      (harmonicAccidentals ,boolean? "If set, harmonic notes in chords
 get accidentals.")
      (highStringOne ,boolean? "Whether the first string is the string
@@ -279,8 +277,10 @@ containing @code{(@var{step} . @var{alter})} or @code{((@var{octave} .
 0 to@tie{}6 and @var{alter} a fraction, denoting alteration.  For
 alterations, use symbols, e.g. @code{keySignature = #`((6 . ,FLAT))}.")
 
+
      (lyricMelismaAlignment ,ly:dir? "Alignment to use for a melisma syllable.")
 
+
      (majorSevenSymbol ,markup? "How should the major 7th be formatted
 in a chord name?")
      (markFormatter ,procedure? "A procedure taking as arguments the