]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 2269: If piece begins with \cueDuringWithClef, ambitus is shown in cue's clef
authorDavid Kastrup <dak@gnu.org>
Sun, 5 Feb 2012 11:59:29 +0000 (12:59 +0100)
committerDavid Kastrup <dak@gnu.org>
Wed, 8 Feb 2012 10:09:23 +0000 (11:09 +0100)
input/regression/ambitus-cue.ly [new file with mode: 0644]
lily/ambitus-engraver.cc

diff --git a/input/regression/ambitus-cue.ly b/input/regression/ambitus-cue.ly
new file mode 100644 (file)
index 0000000..6bb87b9
--- /dev/null
@@ -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"
+ }
+}
index dfd23f1724c4633efaae681f6e0efa187f7523ca..8690b01f80b4dedab341344fb3e8ff8485fcfe00 100644 (file)
@@ -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 */
                 ""