From 4992ee602685479b8f7c7c7d55a4c37cb8af646f Mon Sep 17 00:00:00 2001 From: David Kastrup Date: Sun, 5 Feb 2012 12:59:29 +0100 Subject: [PATCH] Issue 2269: If piece begins with \cueDuringWithClef, ambitus is shown in cue's clef --- input/regression/ambitus-cue.ly | 27 +++++++++++++++++++++++++++ lily/ambitus-engraver.cc | 11 +++++++++-- 2 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 input/regression/ambitus-cue.ly diff --git a/input/regression/ambitus-cue.ly b/input/regression/ambitus-cue.ly new file mode 100644 index 0000000000..6bb87b9ba3 --- /dev/null +++ b/input/regression/ambitus-cue.ly @@ -0,0 +1,27 @@ +\version "2.14.2" + +\header { + texidoc = "Ambitus for pieces beginning with @code{\\cueDuringWithClef}. + +Cues are often used at or near the beginning of a piece. Furthermore, +a cue is frequently in a different clef, so the +@code{\\cueDuringWithClef} command is handy. Using this command at +the beginning of a piece should leave the ambitus displayed based +on the main clef. +" +} + +\addQuote "other" \relative c { r4 c e g } + +\new Staff \new Voice \relative c' +{ + \cueDuringWithClef #"other" #UP #"bass" { R1 } | + e4 b c2 +} + +\layout { + \context { + \Voice + \consists "Ambitus_engraver" + } +} diff --git a/lily/ambitus-engraver.cc b/lily/ambitus-engraver.cc index dfd23f1724..8690b01f80 100644 --- a/lily/ambitus-engraver.cc +++ b/lily/ambitus-engraver.cc @@ -120,8 +120,14 @@ Ambitus_engraver::stop_translation_timestep () * may then oversee a clef that is defined in a staff context if * we are in a voice context; middleCPosition would then be * assumed to be 0. + + * Don't use middleCPosition as this may be thwarted by a cue + * starting here. middleCOffset is not affected by cue clefs. */ - start_c0_ = robust_scm2int (get_property ("middleCPosition"), 0); + int clef_pos = robust_scm2int (get_property ("middleCClefPosition"), 0); + int offset = robust_scm2int (get_property ("middleCOffset"), 0); + + start_c0_ = clef_pos + offset; start_key_sig_ = get_property ("keySignature"); is_typeset_ = true; @@ -231,7 +237,8 @@ ADD_TRANSLATOR (Ambitus_engraver, /* read */ "keySignature " - "middleCPosition ", + "middleCClefPosition " + "middleCOffset ", /* write */ "" -- 2.39.5