Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(127)

Unified Diff: scm/chord-generic-names.scm

Issue 223420043: Rewrite chordnames - disentangle data from formatting
Patch Set: deeper disentangle, fixing TODOs Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ly/property-init.ly ('k') | scm/chord-ignatzek-names.scm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scm/chord-generic-names.scm
diff --git a/scm/chord-generic-names.scm b/scm/chord-generic-names.scm
index d1c8005c4a6dd583b45ddbc1a3d1646098eb34b0..7455108fe6c3a518448b5f4e96e8dae8a9b564b7 100644
--- a/scm/chord-generic-names.scm
+++ b/scm/chord-generic-names.scm
@@ -23,7 +23,15 @@
(define (default-note-namer pitch)
- (note-name->markup pitch #f))
+ "Return a markup for @var{pitch}, with name of @var{pitch} and a (possible)
+accidental."
+ (let* ((note-namer (note-name->list pitch #f))
+ (name (assoc-get 'note-name note-namer))
+ (alteration (assoc-get 'alteration note-namer 0)))
+ (make-line-markup
+ (list
+ name
+ (format-accidental alteration)))))
(define (markup-or-empty-markup markup)
"Return MARKUP if markup, else empty-markup"
@@ -92,16 +100,16 @@ See @file{double-plus-new-chord-name.scm} for the signature of @var{style}.
(list
(make-simple-markup (number->string (step-nr pitch)))
(make-simple-markup
- (case (step-alteration pitch)
- ((DOUBLE-FLAT) "--")
- ((FLAT) "-")
- ((NATURAL) "")
- ((SHARP) "+")
- ((DOUBLE-SHARP) "++"))))))
+ (let ((step-alt (step-alteration pitch)))
+ (cond ((= -1 step-alt) "--")
+ ((= -1/2 step-alt) "-")
+ ((= 0 step-alt) "")
+ ((= 1/2 step-alt) "+")
+ ((= 1 step-alt) "++")))))))
(define (step->markup-accidental pitch)
(make-line-markup
- (list (accidental->markup (step-alteration pitch))
+ (list (format-accidental (step-alteration pitch))
(make-simple-markup (number->string (step-nr pitch))))))
(define (step->markup-ignatzek pitch)
@@ -109,7 +117,7 @@ See @file{double-plus-new-chord-name.scm} for the signature of @var{style}.
(if (and (= (step-nr pitch) 7)
(= (step-alteration pitch) 1))
(list (ly:context-property context 'majorSevenSymbol))
- (list (accidental->markup (step-alteration pitch))
+ (list (format-accidental (step-alteration pitch))
(make-simple-markup (number->string (step-nr pitch)))))))
;; tja, kennok
« no previous file with comments | « ly/property-init.ly ('k') | scm/chord-ignatzek-names.scm » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b