summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReinhold Kainhofer <reinhold@kainhofer.com>2008-11-30 21:08:49 +0100
committerReinhold Kainhofer <reinhold@kainhofer.com>2009-02-23 15:08:52 +0100
commit229a64ff74ab2edf6ea5442f13ac4eecb03ea1e9 (patch)
tree5ea3c82d9b7e27adf72076cb15783249b3109f3b
parent05f1bf04283c17cad4695145e8145670741a3260 (diff)
use correct left to right ordering in keySignature list
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).
-rw-r--r--input/lsr/makam-example.ly2
-rw-r--r--input/lsr/non-traditional-key-signatures.ly7
-rw-r--r--input/new/revised/non-traditional-key-signatures.ly4
-rw-r--r--input/regression/key-signature-padding.ly2
-rw-r--r--input/regression/key-signature-scordatura.ly4
-rw-r--r--input/regression/keys.ly2
-rw-r--r--lily/key-engraver.cc6
-rw-r--r--python/convertrules.py8
-rw-r--r--python/musicexp.py5
9 files changed, 21 insertions, 19 deletions
diff --git a/input/lsr/makam-example.ly b/input/lsr/makam-example.ly
index 38ab92ea65..d751d9b4e8 100644
--- a/input/lsr/makam-example.ly
+++ b/input/lsr/makam-example.ly
@@ -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
diff --git a/input/lsr/non-traditional-key-signatures.ly b/input/lsr/non-traditional-key-signatures.ly
index 772c4dad1d..5748db983d 100644
--- a/input/lsr/non-traditional-key-signatures.ly
+++ b/input/lsr/non-traditional-key-signatures.ly
@@ -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
}
diff --git a/input/new/revised/non-traditional-key-signatures.ly b/input/new/revised/non-traditional-key-signatures.ly
index 7929c556b3..b4dbed4e98 100644
--- a/input/new/revised/non-traditional-key-signatures.ly
+++ b/input/new/revised/non-traditional-key-signatures.ly
@@ -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
}
diff --git a/input/regression/key-signature-padding.ly b/input/regression/key-signature-padding.ly
index a27bde7cff..0f74ac2fec 100644
--- a/input/regression/key-signature-padding.ly
+++ b/input/regression/key-signature-padding.ly
@@ -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
}
diff --git a/input/regression/key-signature-scordatura.ly b/input/regression/key-signature-scordatura.ly
index 93710c2c70..f00fd1c23c 100644
--- a/input/regression/key-signature-scordatura.ly
+++ b/input/regression/key-signature-scordatura.ly
@@ -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
}
diff --git a/input/regression/keys.ly b/input/regression/keys.ly
index 0a3fb7e8a5..6e7d713c75 100644
--- a/input/regression/keys.ly
+++ b/input/regression/keys.ly
@@ -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
}
diff --git a/lily/key-engraver.cc b/lily/key-engraver.cc
index 11234556fd..c396d73351 100644
--- a/lily/key-engraver.cc
+++ b/lily/key-engraver.cc
@@ -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"));
}
diff --git a/python/convertrules.py b/python/convertrules.py
index 1320ebc500..d0bd108d7b 100644
--- a/python/convertrules.py
+++ b/python/convertrules.py
@@ -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,
diff --git a/python/musicexp.py b/python/musicexp.py
index 440fcbfb3f..1a3fea70fe 100644
--- a/python/musicexp.py
+++ b/python/musicexp.py
@@ -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 ''