From f3cacac4bafd2bace7dd23033618895cf11ef695 Mon Sep 17 00:00:00 2001 From: Phil Holmes Date: Tue, 17 Jul 2012 18:35:14 +0100 Subject: [PATCH] Volta enhancements tranche 1 --- Documentation/de/notation/repeats.itely | 19 +++++++++++++ Documentation/de/notation/rhythms.itely | 4 +++ Documentation/notation/repeats.itely | 18 ++++++++++++ Documentation/notation/rhythms.itely | 4 +++ lily/repeat-acknowledge-engraver.cc | 38 +++++++++++++++++++++---- ly/music-functions-init.ly | 13 +++++++++ scm/define-context-properties.scm | 8 ++++++ 7 files changed, 98 insertions(+), 6 deletions(-) diff --git a/Documentation/de/notation/repeats.itely b/Documentation/de/notation/repeats.itely index 6735c55a03..4e9ccded75 100644 --- a/Documentation/de/notation/repeats.itely +++ b/Documentation/de/notation/repeats.itely @@ -242,6 +242,25 @@ g1 | Die @code{measureLength}-Eigenschaft ist beschrieben in @ref{Verwaltung der Zeiteinheiten}. +@cindex \inStaffSegno + +Der @code{\inStaffSegno}-Befehl kann angewandt werden, um das +Segno-Zeichen in die Notenzeile einzubinden, auch in Kooperation +mit dem @code{\repeat volta}-Befehl. Die benutzten +Taktstrichsymbole können durch Überschreiben der Eigenschaften +@code{segnoType}, @code{startRepeatSegnoType}, +@code{endRepeatSegnoType} bzw. @code{doubleRepeatSegnoType} +geändert werden. + +@lilypond[verbatim,quote,relative=1] +e1 +\repeat volta 2 { + \inStaffSegno + f2 g a b +} +c1_"D.S." \bar "|." +@end lilypond + @cindex Wiederholungen mit Überbindung @cindex Alternative Schlüsse mit Bindebogen @cindex Überbindung in Wiederholung diff --git a/Documentation/de/notation/rhythms.itely b/Documentation/de/notation/rhythms.itely index 1d9e76608f..9c50526191 100644 --- a/Documentation/de/notation/rhythms.itely +++ b/Documentation/de/notation/rhythms.itely @@ -2811,6 +2811,10 @@ c4 c c c \break c1 @end lilypond +Darüber hinaus wählt der @code{\inStaffSegno}-Befehl eines dieser +Segno-Taktstriche aus, in Zusammenarbeit mit dem +@code{\repeat volta}-Befehl. + In Partituren mit vielen Systemen wird ein @code{\bar}-Befehl in einem System automatisch auf alle anderen Systeme angewendet. Die resultierenden Taktstriche sind miteinander verbunden innerhalb einer Gruppe diff --git a/Documentation/notation/repeats.itely b/Documentation/notation/repeats.itely index 8696a75009..5d916d281d 100644 --- a/Documentation/notation/repeats.itely +++ b/Documentation/notation/repeats.itely @@ -239,6 +239,24 @@ g1 | The @code{measureLength} property is described in @ref{Time administration}. +@funindex \inStaffSegno + +The @code{\inStaffSegno} command can be used to place the segno +symbol in cooperation with the @code{\repeat volta} command. +Alternative bar line symbols can be set in a Score context by +overriding the properties @code{segnoType}, +@code{startRepeatSegnoType}, @code{endRepeatSegnoType} or +@code{doubleRepeatSegnoType} as required. + +@lilypond[verbatim,quote,relative=1] +e1 +\repeat volta 2 { + \inStaffSegno + f2 g a b +} +c1_"D.S." \bar "|." +@end lilypond + @cindex repeats, with ties @cindex alternative endings, with ties @cindex ties, in repeats diff --git a/Documentation/notation/rhythms.itely b/Documentation/notation/rhythms.itely index 4b2bac28e6..ed9424c455 100644 --- a/Documentation/notation/rhythms.itely +++ b/Documentation/notation/rhythms.itely @@ -2673,6 +2673,10 @@ c4 c c c \break c1 @end lilypond +Additionally there is an @code{\inStaffSegno} command which +creates a segno bar, placed in cooperation +with the @code{\repeat volta} command. + In scores with many staves, a @code{\bar} command in one staff is automatically applied to all staves. The resulting bar lines are diff --git a/lily/repeat-acknowledge-engraver.cc b/lily/repeat-acknowledge-engraver.cc index 6d2b508481..6ebb719994 100644 --- a/lily/repeat-acknowledge-engraver.cc +++ b/lily/repeat-acknowledge-engraver.cc @@ -80,6 +80,7 @@ Repeat_acknowledge_engraver::process_music () string s = ""; bool start = false; bool end = false; + bool segno = false; bool volta_found = false; while (scm_is_pair (cs)) { @@ -88,17 +89,36 @@ Repeat_acknowledge_engraver::process_music () start = true; else if (command == ly_symbol2scm ("end-repeat")) end = true; + else if (command == ly_symbol2scm ("segno-display")) + segno = true; else if (scm_is_pair (command) && scm_car (command) == ly_symbol2scm ("volta")) volta_found = true; cs = scm_cdr (cs); } - if (start && end) - s = robust_scm2string (get_property ("doubleRepeatType"), ":|:"); - else if (start) - s = robust_scm2string (get_property ("startRepeatType"), "|:"); - else if (end) - s = robust_scm2string (get_property ("endRepeatType"), ":|"); + /* + Select which bar type to set + */ + if (segno) + if (start) + if (end) // { segno, start, end } + s = robust_scm2string (get_property ("doubleRepeatSegnoType"), ":|S|:"); + else // { segno, start } + s = robust_scm2string (get_property ("startRepeatSegnoType"), ".S|:"); + else + if (end) // { segno, end } + s = robust_scm2string (get_property ("endRepeatSegnoType"), ":|S"); + else // { segno } + s = robust_scm2string (get_property ("segnoType"), "S"); + else + if (start) + if (end) // { start, end } + s = robust_scm2string (get_property ("doubleRepeatType"), ":|:"); + else // { start } + s = robust_scm2string (get_property ("startRepeatType"), "|:"); + else + if (end) // { end } + s = robust_scm2string (get_property ("endRepeatType"), ":|"); /* TODO: line breaks might be allowed if we set whichBar to "". @@ -128,6 +148,12 @@ ADD_TRANSLATOR (Repeat_acknowledge_engraver, /* read */ "doubleRepeatType " + "startRepeatType " + "endRepeatType " + "doubleRepeatSegnoType " + "startRepeatSegnoType " + "endRepeatSegnoType " + "segnoType " "repeatCommands " "whichBar ", diff --git a/ly/music-functions-init.ly b/ly/music-functions-init.ly index 54ada96164..45f9a13638 100644 --- a/ly/music-functions-init.ly +++ b/ly/music-functions-init.ly @@ -449,6 +449,19 @@ given through @var{ratio}.") \revert NoteHead #'stencil #}) +inStaffSegno = +#(define-music-function (parser location) () + (_i "Put the segno variant 'varsegno' at this position into the staff, +compatible with the repeat command.") + (make-music 'ApplyContext + 'procedure + (lambda (ctx) + (let ((score-ctx (ly:context-find ctx 'Score))) + (if (ly:context? score-ctx) + (let ((old-rc (ly:context-property score-ctx 'repeatCommands '()))) + (if (eq? (memq 'segno-display old-rc) #f) + (ly:context-set-property! score-ctx 'repeatCommands (cons 'segno-display old-rc))))))))) + instrumentSwitch = #(define-music-function (parser location name) (string?) diff --git a/scm/define-context-properties.scm b/scm/define-context-properties.scm index e0b45ab670..16a1b21b1e 100644 --- a/scm/define-context-properties.scm +++ b/scm/define-context-properties.scm @@ -212,6 +212,8 @@ This variable is read by @rinternals{Timing_translator} at (defaultStrings ,list? "A list of strings to use in calculating frets for tablatures and fretboards if no strings are provided in the notes for the current moment.") + (doubleRepeatSegnoType ,string? "Set the default bar line for +the combinations double repeat with segno. Default is @samp{:|S|:}.") (doubleRepeatType ,string? "Set the default bar line for double repeats.") (doubleSlurs ,boolean? "If set, two slurs are created for every @@ -228,6 +230,8 @@ the symbol @samp{hihat}) as keys, and a list @code{(@var{notehead-style} @var{script} @var{vertical-position})} as values.") + (endRepeatSegnoType ,string? "Set the default bar line for the +combinations ending of repeat with segno. Default is @samp{:|S}.") (endRepeatType ,string? "Set the default bar line for the ending of repeats.") (explicitClefVisibility ,vector? "@samp{break-visibility} @@ -447,6 +451,8 @@ automatic fret calculator.") (searchForVoice ,boolean? "Signal whether a search should be made of all contexts in the context hierarchy for a voice to provide rhythms for the lyrics.") + (segnoType ,string? "Set the default bar line for a requested segno. +Default is @samp{S}.") (shapeNoteStyles ,vector? "Vector of symbols, listing style for each note head relative to the tonic (qv.) of the scale.") (shortInstrumentName ,markup? "See @code{instrumentName}.") @@ -478,6 +484,8 @@ part-combining.") @code{traditional}, or @code{semitone}.") (stanza ,markup? "Stanza @q{number} to print before the start of a verse. Use in @code{Lyrics} context.") + (startRepeatSegnoType ,string? "Set the default bar line for the +combinations beginning of repeat with segno. Default is @samp{.S|:}.") (startRepeatType ,string? "Set the default bar line for the beginning of repeats.") (stemLeftBeamCount ,integer? "Specify the number of beams to draw -- 2.39.2