From: Keith OHara Date: Tue, 12 Nov 2013 01:58:48 +0000 (-0800) Subject: keySignature-> keyAlterations X-Git-Tag: release/2.19.7-1~11 X-Git-Url: https://git.donarmstrong.com/?p=lilypond.git;a=commitdiff_plain;h=bd54c92776cd01d08f403dedadbd62e308eb67d9 keySignature-> keyAlterations to avoid confusion with the grob KeySignature --- diff --git a/lily/accidental-engraver.cc b/lily/accidental-engraver.cc index cb33a4545b..0845a66de2 100644 --- a/lily/accidental-engraver.cc +++ b/lily/accidental-engraver.cc @@ -99,7 +99,7 @@ public: }; /* - localKeySignature is changed at runtime, which means that references + localAlterations is changed at runtime, which means that references in grobs should always store ly_deep_copy ()s of those. */ @@ -120,7 +120,7 @@ Accidental_engraver::update_local_key_signature (SCM new_sig) { last_keysig_ = new_sig; set_context_property_on_children (context (), - ly_symbol2scm ("localKeySignature"), + ly_symbol2scm ("localAlterations"), new_sig); Context *trans = context ()->get_parent_context (); @@ -131,9 +131,9 @@ Accidental_engraver::update_local_key_signature (SCM new_sig) */ SCM val; - while (trans && trans->where_defined (ly_symbol2scm ("localKeySignature"), &val) == trans) + while (trans && trans->where_defined (ly_symbol2scm ("localAlterations"), &val) == trans) { - trans->set_property ("localKeySignature", ly_deep_copy (last_keysig_)); + trans->set_property ("localAlterations", ly_deep_copy (last_keysig_)); trans = trans->get_parent_context (); } } @@ -402,7 +402,7 @@ Accidental_engraver::stop_translation_timestep () SCM localsig = SCM_EOL; while (origin - && origin->where_defined (ly_symbol2scm ("localKeySignature"), &localsig)) + && origin->where_defined (ly_symbol2scm ("localAlterations"), &localsig)) { bool change = false; if (accidentals_[i].tied_ @@ -429,7 +429,7 @@ Accidental_engraver::stop_translation_timestep () } if (change) - origin->set_property ("localKeySignature", localsig); + origin->set_property ("localAlterations", localsig); origin = origin->get_parent_context (); } @@ -498,7 +498,7 @@ Accidental_engraver::acknowledge_finger (Grob_info info) void Accidental_engraver::process_music () { - SCM sig = get_property ("keySignature"); + SCM sig = get_property ("keyAlterations"); if (last_keysig_ != sig) update_local_key_signature (sig); } @@ -530,9 +530,9 @@ ADD_TRANSLATOR (Accidental_engraver, "extraNatural " "harmonicAccidentals " "accidentalGrouping " - "keySignature " - "localKeySignature ", + "keyAlterations " + "localAlterations ", /* write */ - "localKeySignature " + "localAlterations " ); diff --git a/lily/ambitus-engraver.cc b/lily/ambitus-engraver.cc index a72c735b51..f904b877e0 100644 --- a/lily/ambitus-engraver.cc +++ b/lily/ambitus-engraver.cc @@ -126,7 +126,7 @@ Ambitus_engraver::stop_translation_timestep () int offset = robust_scm2int (get_property ("middleCOffset"), 0); start_c0_ = clef_pos + offset; - start_key_sig_ = get_property ("keySignature"); + start_key_sig_ = get_property ("keyAlterations"); is_typeset_ = true; } @@ -230,7 +230,7 @@ ADD_TRANSLATOR (Ambitus_engraver, "AmbitusNoteHead ", /* read */ - "keySignature " + "keyAlterations " "middleCClefPosition " "middleCOffset ", diff --git a/lily/key-engraver.cc b/lily/key-engraver.cc index 57035089c4..5b48b1d78a 100644 --- a/lily/key-engraver.cc +++ b/lily/key-engraver.cc @@ -78,8 +78,8 @@ Key_engraver::create_key (bool is_default) item_->set_property ("c0-position", get_property ("middleCClefPosition")); - SCM last = get_property ("lastKeySignature"); - SCM key = get_property ("keySignature"); + SCM last = get_property ("lastKeyAlterations"); + SCM key = get_property ("keyAlterations"); if ((to_boolean (get_property ("printKeyCancellation")) || key == SCM_EOL) @@ -140,7 +140,7 @@ Key_engraver::acknowledge_clef (Grob_info /* info */) void Key_engraver::acknowledge_bar_line (Grob_info /* info */) { - if (scm_is_pair (get_property ("keySignature"))) + if (scm_is_pair (get_property ("keyAlterations"))) create_key (true); } @@ -148,7 +148,7 @@ void Key_engraver::process_music () { if (key_event_ - || get_property ("lastKeySignature") != get_property ("keySignature")) + || get_property ("lastKeyAlterations") != get_property ("keyAlterations")) create_key (false); } @@ -156,7 +156,7 @@ void Key_engraver::stop_translation_timestep () { item_ = 0; - context ()->set_property ("lastKeySignature", get_property ("keySignature")); + context ()->set_property ("lastKeyAlterations", get_property ("keyAlterations")); cancellation_ = 0; key_event_ = 0; } @@ -198,7 +198,7 @@ Key_engraver::read_event (Stream_event const *r) r->origin ()->warning (_ ("Incomplete keyAlterationOrder for key signature")); } - context ()->set_property ("keySignature", scm_reverse_x (accs, SCM_EOL)); + context ()->set_property ("keyAlterations", scm_reverse_x (accs, SCM_EOL)); context ()->set_property ("tonic", r->get_property ("tonic")); } @@ -206,8 +206,8 @@ Key_engraver::read_event (Stream_event const *r) void Key_engraver::initialize () { - context ()->set_property ("keySignature", SCM_EOL); - context ()->set_property ("lastKeySignature", SCM_EOL); + context ()->set_property ("keyAlterations", SCM_EOL); + context ()->set_property ("lastKeyAlterations", SCM_EOL); Pitch p (0, 0, 0); context ()->set_property ("tonic", p.smobbed_copy ()); @@ -229,13 +229,13 @@ ADD_TRANSLATOR (Key_engraver, "explicitKeySignatureVisibility " "extraNatural " "keyAlterationOrder " - "keySignature " - "lastKeySignature " + "keyAlterations " + "lastKeyAlterations " "printKeyCancellation " "middleCClefPosition ", /* write */ - "keySignature " - "lastKeySignature " + "keyAlterations " + "lastKeyAlterations " "tonic " ); diff --git a/lily/pitched-trill-engraver.cc b/lily/pitched-trill-engraver.cc index 04b620a912..0e97853f7e 100644 --- a/lily/pitched-trill-engraver.cc +++ b/lily/pitched-trill-engraver.cc @@ -98,7 +98,7 @@ Pitched_trill_engraver::make_trill (Stream_event *ev) SCM scm_pitch = ev->get_property ("pitch"); Pitch *p = unsmob_pitch (scm_pitch); - SCM keysig = get_property ("localKeySignature"); + SCM keysig = get_property ("localAlterations"); SCM key = scm_cons (scm_from_int (p->get_octave ()), scm_from_int (p->get_notename ())); diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly index 5148ff436f..ebfff6a2fc 100644 --- a/ly/engraver-init.ly +++ b/ly/engraver-init.ly @@ -86,7 +86,7 @@ \consists "Cue_clef_engraver" \consists "Fingering_column_engraver" - localKeySignature = #'() + localAlterations = #'() createSpacing = ##t ignoreFiguredBassRest = ##f @@ -162,7 +162,7 @@ contained staves are not connected vertically." \context{ \type "Engraver_group" - localKeySignature = #'() + localAlterations = #'() createSpacing = ##t squashedPosition = #0 @@ -305,7 +305,7 @@ multiple voices on the same staff." \context{ \type "Engraver_group" \name GrandStaff - localKeySignature = #'() + localAlterations = #'() \description "A group of staves, with a brace on the left side, grouping the staves together. The bar lines of the diff --git a/python/convertrules.py b/python/convertrules.py index bbafef4a3d..5eb2a75bfc 100644 --- a/python/convertrules.py +++ b/python/convertrules.py @@ -3711,6 +3711,13 @@ def conv (str): str = re.sub (r'\\lyricmode\s*(\\lyricsto\b)', r"\1", str) return str +@rule ((2, 19, 7), "keySignature -> keyAlterations") +def conv(str): + str = re.sub (r'\bkeySignature\b', 'keyAlterations', str) + str = re.sub (r'\blastKeySignature\b', 'lastKeyAlterations', str) + str = re.sub (r'\blocalKeySignature\b', 'localAlterations', str) + 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 ea2525d866..a564f29ce5 100644 --- a/python/musicexp.py +++ b/python/musicexp.py @@ -1489,7 +1489,7 @@ class KeySignatureChange (Music): elif self.non_standard_alterations: alterations = [self.format_non_standard_alteration (a) for a in self.non_standard_alterations] - return "\\set Staff.keySignature = #`(%s)" % string.join (alterations, " ") + return "\\set Staff.keyAlterations = #`(%s)" % string.join (alterations, " ") else: return '' diff --git a/scm/define-context-properties.scm b/scm/define-context-properties.scm index 06f307b843..2d38188d29 100644 --- a/scm/define-context-properties.scm +++ b/scm/define-context-properties.scm @@ -396,12 +396,12 @@ alterations should be printed. The format is @code{(@var{step} . @var{alter})}, where @var{step} is a number from 0 to@tie{}6 and @var{alter} from -2 (sharp) to 2 (flat).") - (keySignature ,list? "The current key signature. This is an alist + (keyAlterations ,list? "The current key signature. This is an alist containing @code{(@var{step} . @var{alter})} or @code{((@var{octave} . @var{step}) . @var{alter})}, where @var{step} is a number in the range 0 to@tie{}6 and @var{alter} a fraction, denoting alteration. For alterations, use symbols, e.g. -@code{keySignature = #`((6 . ,FLAT))}.") +@code{keyAlterations = #`((6 . ,FLAT))}.") (lyricMelismaAlignment ,number? "Alignment to use for a melisma syllable.") @@ -710,10 +710,10 @@ in an axis group.") (lastChord ,markup? "Last chord, used for detecting chord changes.") - (lastKeySignature ,list? "Last key signature before a key + (lastKeyAlterations ,list? "Last key signature before a key signature change.") - (localKeySignature ,list? "The key signature at this point in the -measure. The format is the same as for @code{keySignature}, but can + (localAlterations ,list? "The key signature at this point in the +measure. The format is the same as for @code{keyAlterations}, but can also contain @code{((@var{octave} . @var{name}) . (@var{alter} @var{barnumber} . @var{measureposition}))} pairs.") diff --git a/scm/music-functions.scm b/scm/music-functions.scm index b0c98769ae..ba567229e7 100644 --- a/scm/music-functions.scm +++ b/scm/music-functions.scm @@ -1431,13 +1431,14 @@ Returns @code{#f} or the reason for the invalidation, a symbol." (define (check-pitch-against-signature context pitch barnum laziness octaveness all-naturals) "Checks the need for an accidental and a @q{restore} accidental against -@code{localKeySignature}. The @var{laziness} is the number of measures +@code{localAlterations} and @code{keyAlterations}. +The @var{laziness} is the number of measures for which reminder accidentals are used (i.e., if @var{laziness} is zero, only cancel accidentals in the same measure; if @var{laziness} is three, we cancel accidentals up to three measures after they first appear. @var{octaveness} is either @code{'same-octave} or @code{'any-octave} and specifies whether accidentals should be canceled in different octaves. -If @var{all-naturals} is ##t, notes that do not occur in @code{keySignature} +If @var{all-naturals} is ##t, notes that do not occur in @code{keyAlterations} also get an accidental." (let* ((ignore-octave (cond ((equal? octaveness 'any-octave) #t) ((equal? octaveness 'same-octave) #f) @@ -1445,8 +1446,8 @@ also get an accidental." (ly:warning (_ "Unknown octaveness type: ~S ") octaveness) (ly:warning (_ "Defaulting to 'any-octave.")) #t))) - (key-sig (ly:context-property context 'keySignature)) - (local-key-sig (ly:context-property context 'localKeySignature)) + (key (ly:context-property context 'keyAlterations)) + (local (ly:context-property context 'localAlterations)) (notename (ly:pitch-notename pitch)) (octave (ly:pitch-octave pitch)) (pitch-handle (cons octave notename)) @@ -1454,17 +1455,17 @@ also get an accidental." (need-accidental #f) (previous-alteration #f) (from-other-octaves #f) - (from-same-octave (assoc-get pitch-handle local-key-sig)) - (from-key-sig (or (assoc-get notename local-key-sig) + (from-same-octave (assoc-get pitch-handle local)) + (from-key-sig (or (assoc-get notename local) - ;; If no key signature match is found from localKeySignature, we may have a custom + ;; If no notename match is found from localAlterations, we may have a custom ;; type with octave-specific entries of the form ((octave . pitch) alteration) ;; instead of (pitch . alteration). Since this type cannot coexist with entries in - ;; localKeySignature, try extracting from keySignature instead. - (assoc-get pitch-handle key-sig)))) + ;; localAlterations, try extracting from keyAlterations instead. + (assoc-get pitch-handle key)))) - ;; loop through localKeySignature to search for a notename match from other octaves - (let loop ((l local-key-sig)) + ;; loop through localAlterations to search for a notename match from other octaves + (let loop ((l local)) (if (pair? l) (let ((entry (car l))) (if (and (pair? (car entry)) @@ -1532,7 +1533,7 @@ accidental rule." (check-pitch-against-signature context pitch barnum laziness octaveness #t)) (define (key-entry-notename entry) - "Return the pitch of an @var{entry} in @code{localKeySignature}. + "Return the pitch of an @var{entry} in @code{localAlterations}. The @samp{car} of the entry is either of the form @code{notename} or of the form @code{(octave . notename)}. The latter form is used for special key signatures or to indicate an explicit accidental. @@ -1546,25 +1547,25 @@ an accidental in music." (car entry))) (define (key-entry-octave entry) - "Return the octave of an entry in @code{localKeySignature} + "Return the octave of an entry in @code{localAlterations} or @code{#f} if the entry does not have an octave. See @code{key-entry-notename} for details." (and (pair? (car entry)) (caar entry))) (define (key-entry-bar-number entry) - "Return the bar number of an entry in @code{localKeySignature} + "Return the bar number of an entry in @code{localAlterations} or @code {#f} if the entry does not have a bar number. See @code{key-entry-notename} for details." (and (pair? (cdr entry)) (caddr entry))) (define (key-entry-measure-position entry) - "Return the measure position of an entry in @code{localKeySignature} + "Return the measure position of an entry in @code{localAlterations} or @code {#f} if the entry does not have a measure position. See @code{key-entry-notename} for details." (and (pair? (cdr entry)) (cdddr entry))) (define (key-entry-alteration entry) - "Return the alteration of an entry in localKeySignature. + "Return the alteration of an entry in localAlterations For convenience, returns @code{0} if entry is @code{#f}." (if entry @@ -1597,7 +1598,7 @@ If no matching entry is found, @var{#f} is returned." key signature @emph{and} does not directly follow a note on the same staff line. This rule should not be used alone because it does neither look at bar lines nor different accidentals at the same note name." - (let* ((keysig (ly:context-property context 'localKeySignature)) + (let* ((keysig (ly:context-property context 'localAlterations)) (entry (find-pitch-entry keysig pitch #t #t))) (if (not entry) (cons #f #f) @@ -1628,7 +1629,7 @@ is a common accidental style in contemporary notation." "An accidental rule that typesets a cautionary accidental if it is included in the key signature @emph{and} does not directly follow a note on the same staff line." - (let* ((keysig (ly:context-property context 'localKeySignature)) + (let* ((keysig (ly:context-property context 'localAlterations)) (entry (find-pitch-entry keysig pitch #t #t))) (if (not entry) (cons #f #f) @@ -1809,8 +1810,8 @@ as a context." ,teaching-accidental-rule) context)) - ;; do not set localKeySignature when a note alterated differently from - ;; localKeySignature is found. + ;; do not set localAlterations when a note alterated differently from + ;; localAlterations is found. ;; Causes accidentals to be printed at every note instead of ;; remembered for the duration of a measure. ;; accidentals not being remembered, causing accidentals always to @@ -1835,15 +1836,15 @@ as a context." (define-public (invalidate-alterations context) "Invalidate alterations in @var{context}. -Elements of @code{'localKeySignature} corresponding to local +Elements of @code{'localAlterations} corresponding to local alterations of the key signature have the form @code{'((octave . notename) . (alter barnum . measurepos))}. Replace them with a version where @code{alter} is set to @code{'clef} to force a repetition of accidentals. Entries that conform with the current key signature are not invalidated." - (let* ((keysig (ly:context-property context 'keySignature))) - (set! (ly:context-property context 'localKeySignature) + (let* ((keysig (ly:context-property context 'keyAlterations))) + (set! (ly:context-property context 'localAlterations) (map-in-order (lambda (entry) (let* ((localalt (key-entry-alteration entry))) @@ -1859,7 +1860,7 @@ Entries that conform with the current key signature are not invalidated." #t #t)))) entry (cons (car entry) (cons 'clef (cddr entry)))))) - (ly:context-property context 'localKeySignature))))) + (ly:context-property context 'localAlterations))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;