]> git.donarmstrong.com Git - lilypond.git/commitdiff
use correct left to right ordering in keySignature list
authorReinhold Kainhofer <reinhold@kainhofer.com>
Sun, 30 Nov 2008 20:08:49 +0000 (21:08 +0100)
committerReinhold Kainhofer <reinhold@kainhofer.com>
Mon, 23 Feb 2009 14:08:52 +0000 (15:08 +0100)
The keySignature property list of the KeySignature so far was using
reversed order (e.g. the rightmost accidental came first). This was
quite confusing when manually setting non-standard key signatures like
  \set Staff.keySignature = #`(((0 . 3) . ,SHARP)
                               ((0 . 5) . ,FLAT)
                               ((0 . 6) . ,FLAT))
In this example, you got bes, as, fis in that reversed order rather than
in the order in which you list the alterations. Now, you'll get fis, as,
bes in that (expected) order.

Also update the snippets and add convert-ly check to warn users about the
reversion (the keySignature property was hardly ever used, though).

input/lsr/makam-example.ly
input/lsr/non-traditional-key-signatures.ly
input/new/revised/non-traditional-key-signatures.ly
input/regression/key-signature-padding.ly
input/regression/key-signature-scordatura.ly
input/regression/keys.ly
lily/key-engraver.cc
python/convertrules.py
python/musicexp.py

index 38ab92ea659aa1a2294179ee76e7b49834e5abfc..d751d9b4e85a6d8d12651b724c39dc93552a71db 100644 (file)
@@ -39,7 +39,7 @@ for details of pitch names and alterations."
 \include "makam.ly"
 
 \relative c' {
-  \set Staff.keySignature = #`((3 . ,BAKIYE) (6 . ,(- KOMA)))
+  \set Staff.keySignature = #`((6 . ,(- KOMA)) (3 . ,BAKIYE))
   c4 cc db fk
   gbm4 gfc gfb efk
   fk4 db cc c
index 772c4dad1d8e96d986dcab6bb4b0c19a5c9a6ab0..5748db983d5fc89c76ad57ce4857c5e3255aeb1a 100644 (file)
@@ -63,8 +63,7 @@ format of this command is a list:
 @code{octave} specifies the octave (0 being the octave from middle C to
 the B above), @code{step} specifies the note within the octave (0 means
 C and 6 means B), and @code{alter} is @code{,SHARP ,FLAT ,DOUBLE-SHARP}
-etc. (Note the leading comma.) The accidentals in the key signature
-will appear in the reverse order to that in which they are specified.
+etc. (Note the leading comma.)
 
 
 Alternatively, for each item in the list, using the more concise format
@@ -84,9 +83,9 @@ whole-tone scale:
 } % begin verbatim
 
 \relative c' {
-  \set Staff.keySignature = #`(((0 . 3) . ,SHARP)
+  \set Staff.keySignature = #`(((0 . 6) . ,FLAT)
                                ((0 . 5) . ,FLAT)
-                               ((0 . 6) . ,FLAT))
+                               ((0 . 3) . ,SHARP))
   c4 d e fis
   aes4 bes c2
 }
index 7929c556b3d81a5ce71b527653fd82e360d608e8..b4dbed4e9879f1467f1802d8affd5d9246e57b53 100644 (file)
@@ -77,9 +77,9 @@ scale:
 "
 } % begin verbatim
 \relative c' {
-  \set Staff.keySignature = #`(((0 . 3) . ,SHARP)
+  \set Staff.keySignature = #`(((0 . 6) . ,FLAT)
                                ((0 . 5) . ,FLAT)
-                               ((0 . 6) . ,FLAT))
+                               ((0 . 3) . ,SHARP))
   c4 d e fis
   aes4 bes c2
 }
index a27bde7cff2e9534bf26fe2c4abe7e39bd8f583a..0f74ac2fec1707de5c7acb42ea18de45fe7c4503 100644 (file)
@@ -10,6 +10,6 @@
 {
   \override Staff.KeySignature #'padding-pairs
     = #'((("accidentals.flat" . "accidentals.sharp.slashslash.stemstemstem") . 0.5))
-    \set Staff.keySignature = #`((2 . ,SEMI-FLAT)  (6 . ,THREE-Q-SHARP) (4 . ,FLAT))
+    \set Staff.keySignature = #`((4 . ,FLAT) (6 . ,THREE-Q-SHARP) (2 . ,SEMI-FLAT))
   e2
 }
index 93710c2c7066dc2588d9ae873e918a41bdac6aee..f00fd1c23c6e7864995f2412c6ae1b971a47cd0d 100644 (file)
@@ -11,9 +11,9 @@ key signatures can be set invidually per pitch.
 }
 \relative c'
 \new Staff {
-    \set Staff.keySignature = #`(((1 .  2) . ,SHARP) ((0 . 3) . ,FLAT))
+    \set Staff.keySignature = #`(((0 . 3) . ,FLAT) ((1 .  2) . ,SHARP))
     f8 a c e
-    \set Staff.keySignature = #`(((1 .  2) . ,FLAT) ((0 . 4) . ,DOUBLE-SHARP))
+    \set Staff.keySignature = #`(((0 . 4) . ,DOUBLE-SHARP) ((1 .  2) . ,FLAT))
     e a, g a
 }
 
index 0a3fb7e8a586829fc67bdef3b68cbd9323c63c58..6e7d713c753023fd1b1e0a54bbe33d901a36bece 100644 (file)
@@ -25,7 +25,7 @@ are created also on a clef change.
     \break
     \key bes \major % \major
     c2 \clef alto c2   \key d \major \clef treble c2
-    \set Staff.keySignature = #`((2 . ,SEMI-FLAT)  (6 . ,THREE-Q-SHARP) (4 . ,FLAT))
+    \set Staff.keySignature = #`((4 . ,FLAT) (6 . ,THREE-Q-SHARP) (2 . ,SEMI-FLAT))
     e2
 }
 
index 11234556fd058961112b96b1a9b947eed478f7da..c396d73351e080aa6eb8c78f8142a64312418a36 100644 (file)
@@ -94,13 +94,13 @@ Key_engraver::create_key (bool is_default)
                                         key_event_
                                         ? key_event_->self_scm () : SCM_EOL);
              
-             cancellation_->set_property ("alteration-alist", restore);
+             cancellation_->set_property ("alteration-alist", scm_reverse (restore));
              cancellation_->set_property ("c0-position",
                                           get_property ("middleCPosition"));
            }
        }
 
-      item_->set_property ("alteration-alist", key);
+      item_->set_property ("alteration-alist", scm_reverse (key));
     }
 
   if (!is_default)
@@ -188,7 +188,7 @@ Key_engraver::read_event (Stream_event const *r)
        r->origin ()->warning ("No ordering for key signature alterations");      
     }
   
-  context ()->set_property ("keySignature", accs);
+  context ()->set_property ("keySignature", scm_reverse (accs));
   context ()->set_property ("tonic",
                            r->get_property ("tonic"));
 }
index 1320ebc5001328a3c6ad613931aa41557e93df86..d0bd108d7b1f3b644b1731c7b5f95396c186a1a9 100644 (file)
@@ -2875,6 +2875,14 @@ def conv(str):
         raise FatalConversionError ()
     return str
 
+@rule ((2, 13, 0), _ ("keySignature property not reversed any more"))
+def conv(str):
+    if re.search(r'\set Staff.keySignature', str):
+        stderr_write ("\n")
+        stderr_write (NOT_SMART % _("The alist for Staff.keySignature is no \
+longer in reversed order.\n"))
+    return str
+
 # Guidelines to write rules (please keep this at the end of this file)
 #
 # - keep at most one rule per version; if several conversions should be done,
index 440fcbfb3f1c12c87957c79b2f204f95b2efcf0f..1a3fea70feda673afe99f34ad50b4cb54a629f81 100644 (file)
@@ -1468,11 +1468,6 @@ class KeySignatureChange (Music):
         elif self.non_standard_alterations:
             alterations = [self.format_non_standard_alteration (a) for
                                         a in self.non_standard_alterations]
-            # TODO: Check if the alterations should really be given in reverse
-            #       order of if that's just a bug in Lilypond. If it's a bug,
-            #       fix it and remove the following call, otherwise add a
-            #       proper comment here!
-            alterations.reverse ()
             return "\\set Staff.keySignature = #`(%s)" % string.join (alterations, " ")
         else:
             return ''