From 7463bfe6a859ffab3a4fd6ea65dc1c144233ec92 Mon Sep 17 00:00:00 2001 From: Neil Puttock Date: Tue, 23 Sep 2008 01:33:14 +0100 Subject: [PATCH] Implement two variations on double repeat sign. Add context property doubleRepeatType so that default double repeat can be changed for volte using \repeat volta. --- Documentation/user/rhythms.itely | 8 +++--- .../regression/double-repeat-default-volta.ly | 26 +++++++++++++++++++ input/regression/double-repeat.ly | 22 ++++++++++++++++ lily/bar-line.cc | 22 ++++++++++++++++ lily/repeat-acknowledge-engraver.cc | 3 ++- lily/span-bar.cc | 4 +++ ly/engraver-init.ly | 1 + scm/define-context-properties.scm | 2 ++ scm/output-lib.scm | 3 +++ 9 files changed, 86 insertions(+), 5 deletions(-) create mode 100644 input/regression/double-repeat-default-volta.ly create mode 100644 input/regression/double-repeat.ly diff --git a/Documentation/user/rhythms.itely b/Documentation/user/rhythms.itely index 8387123d8b..fff7c7c1e4 100644 --- a/Documentation/user/rhythms.itely +++ b/Documentation/user/rhythms.itely @@ -2031,11 +2031,11 @@ with the end of a measure the specified bar line is inserted at that point in the printed output. Such insertions do not affect the calculation and placement of subsequent automatic bar lines. -The simple bar line and four types of double bar line are available +The simple bar line and five types of double bar line are available for manual insertion: @lilypond[quote,ragged-right,fragment,relative=1,verbatim] -f1 \bar "|" g \bar "||" a \bar ".|" b \bar ".|." c \bar "|." d +f1 \bar "|" g \bar "||" a \bar ".|" b \bar ".|." c \bar "|.|" d \bar "|." e @end lilypond @noindent @@ -2046,10 +2046,10 @@ f1 \bar ":" g \bar "dashed" a @end lilypond @noindent -and three types of repeat bar line: +and five types of repeat bar line: @lilypond[quote,ragged-right,fragment,relative=1,verbatim] -f1 \bar "|:" g \bar ":|:" a \bar ":|" b +f1 \bar "|:" g \bar ":|:" a \bar ":|.|:" b \bar ":|.:" c \bar ":|" d @end lilypond @cindex repeats diff --git a/input/regression/double-repeat-default-volta.ly b/input/regression/double-repeat-default-volta.ly new file mode 100644 index 0000000000..b095b3c501 --- /dev/null +++ b/input/regression/double-repeat-default-volta.ly @@ -0,0 +1,26 @@ +\version "2.11.60" + +\header { + texidoc = "For volte, the style of double repeats can be set + using @code{doubleRepeatType}." +} + +\relative c' { + \repeat volta 1 { + c1 + } + \mark "default" + \repeat volta 1 { + c1 + } + \mark "\":|.|:\"" + \set Score.doubleRepeatType = #":|.|:" + \repeat volta 1 { + c1 + } + \mark "\":|.:\"" + \set Score.doubleRepeatType = #":|.:" + \repeat volta 1 { + c1 + } +} diff --git a/input/regression/double-repeat.ly b/input/regression/double-repeat.ly new file mode 100644 index 0000000000..5c2f697279 --- /dev/null +++ b/input/regression/double-repeat.ly @@ -0,0 +1,22 @@ +\version "2.11.60" + +\header { + texidoc = "Three types of double repeat bar line are supported." +} +\new StaffGroup << + \new Staff \relative c' { + c1 + \mark "\":|:\"" + \bar ":|:" + c1 + \mark "\":|.|:\"" + \bar ":|.|:" + c1 + \mark "\":|.:\"" + \bar ":|.:" + c1 + } + \new Staff \relative c' { + \repeat unfold 4 { c1 } + } +>> diff --git a/lily/bar-line.cc b/lily/bar-line.cc index 4d2cbf9b59..d0b18fd1c5 100644 --- a/lily/bar-line.cc +++ b/lily/bar-line.cc @@ -145,11 +145,33 @@ Bar_line::compound_barline (Grob *me, string str, Real h, m.add_at_edge (X_AXIS, RIGHT, thick, kern); m.add_at_edge (X_AXIS, RIGHT, colon, kern); } + else if (str == ":|.|:") + { + m.add_at_edge (X_AXIS, LEFT, thick, 0); + m.add_at_edge (X_AXIS, LEFT, thin, kern); + m.add_at_edge (X_AXIS, LEFT, colon, kern); + m.add_at_edge (X_AXIS, RIGHT, thin, kern); + m.add_at_edge (X_AXIS, RIGHT, colon, kern); + + } + else if (str == ":|.:") + { + m.add_at_edge (X_AXIS, LEFT, thick, 0); + m.add_at_edge (X_AXIS, LEFT, thin, kern); + m.add_at_edge (X_AXIS, LEFT, colon, kern); + m.add_at_edge (X_AXIS, RIGHT, colon, kern); + } else if (str == ".|.") { m.add_at_edge (X_AXIS, LEFT, thick, thinkern); m.add_at_edge (X_AXIS, RIGHT, thick, kern); } + else if (str == "|.|") + { + m.add_at_edge (X_AXIS, LEFT, thick, 0); + m.add_at_edge (X_AXIS, LEFT, thin, kern); + m.add_at_edge (X_AXIS, RIGHT, thin, kern); + } else if (str == "||") { /* diff --git a/lily/repeat-acknowledge-engraver.cc b/lily/repeat-acknowledge-engraver.cc index cf42756f14..5d7b98d36e 100644 --- a/lily/repeat-acknowledge-engraver.cc +++ b/lily/repeat-acknowledge-engraver.cc @@ -83,7 +83,7 @@ Repeat_acknowledge_engraver::process_music () } if (start && end) - s = ":|:"; + s = robust_scm2string (get_property ("doubleRepeatType"), ":|:"); else if (start) s = "|:"; else if (end) @@ -116,6 +116,7 @@ ADD_TRANSLATOR (Repeat_acknowledge_engraver, "", /* read */ + "doubleRepeatType " "repeatCommands " "whichBar ", diff --git a/lily/span-bar.cc b/lily/span-bar.cc index 76e1b60280..48a1df4f3a 100644 --- a/lily/span-bar.cc +++ b/lily/span-bar.cc @@ -186,6 +186,10 @@ Span_bar::calc_glyph_name (SCM smob) type = "|."; else if (type == ":|:") type = ".|."; + else if (type == ":|.|:") + type = "|.|"; + else if (type == ":|.:") + type = "|."; return ly_string2scm (type); } diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly index 80700b8584..ba0d48d987 100644 --- a/ly/engraver-init.ly +++ b/ly/engraver-init.ly @@ -513,6 +513,7 @@ automatically when an output definition (a @code{\score} or decrescendoSpanner = #'hairpin defaultBarType = #"|" + doubleRepeatType = #":|:" barNumberVisibility = #first-bar-number-invisible automaticBars = ##t diff --git a/scm/define-context-properties.scm b/scm/define-context-properties.scm index 24bd6ddf60..e3245477ee 100644 --- a/scm/define-context-properties.scm +++ b/scm/define-context-properties.scm @@ -177,6 +177,8 @@ non-hairpin decrescendo, i.e., @samp{dim.}.") This variable is read by @rinternals{Timing_translator} at @rinternals{Score} level.") + (doubleRepeatType ,string? "Set the default bar line for double +repeats.") (doubleSlurs ,boolean? "If set, two slurs are created for every slurred note, one above and one below the chord.") (drumPitchTable ,hash-table? "A table mapping percussion diff --git a/scm/output-lib.scm b/scm/output-lib.scm index 7a50af6c1e..eb6d98db06 100644 --- a/scm/output-lib.scm +++ b/scm/output-lib.scm @@ -226,6 +226,8 @@ centered, X==1 is at the right, X == -1 is at the left." ;; How should a bar line behave at a break? (define bar-glyph-alist '((":|:" . (":|" . "|:")) + (":|.|:" . (":|" . "|:")) + (":|.:" . (":|" . "|:")) ("||:" . ("||" . "|:")) ("dashed" . ("dashed" . '())) ("|" . ("|" . ())) @@ -239,6 +241,7 @@ centered, X==1 is at the right, X == -1 is at the left." (":|" . (":|" . ())) ("||" . ("||" . ())) (".|." . (".|." . ())) + ("|.|" . ("|.|" . ())) ("" . ("" . "")) (":" . (":" . "")) ("." . ("." . ())) -- 2.39.5