X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scm%2Fparser-clef.scm;h=a731e7459e7e6a38e6f796998d3f3b12b3852122;hb=5670dc898dbedc105b5ff0719959317850ef443d;hp=2f17701d4672f6d492885368207f3bf8fd716cd2;hpb=e18531db1f79fb685fbd16d6a2a67bf4b6c09915;p=lilypond.git diff --git a/scm/parser-clef.scm b/scm/parser-clef.scm index 2f17701d46..a731e7459e 100644 --- a/scm/parser-clef.scm +++ b/scm/parser-clef.scm @@ -1,6 +1,6 @@ ;;;; This file is part of LilyPond, the GNU music typesetter. ;;;; -;;;; Copyright (C) 2004--2010 Han-Wen Nienhuys +;;;; Copyright (C) 2004--2011 Han-Wen Nienhuys ;;;; ;;;; LilyPond is free software: you can redistribute it and/or modify ;;;; it under the terms of the GNU General Public License as published by @@ -74,6 +74,7 @@ ("petrucci-c5" . ("clefs.petrucci.c5" 4 0)) ("petrucci-f3" . ("clefs.petrucci.f" 0 0)) ("petrucci-f4" . ("clefs.petrucci.f" 2 0)) + ("petrucci-f5" . ("clefs.petrucci.f" 4 0)) ("petrucci-f" . ("clefs.petrucci.f" 2 0)) ("petrucci-g" . ("clefs.petrucci.g" -2 0)))) @@ -105,7 +106,7 @@ ("clefs.petrucci.g" . -4))) (define-public (make-clef-set clef-name) - "Generate the clef setting commands for a clef with name CLEF-NAME." + "Generate the clef setting commands for a clef with name @var{clef-name}." (define (make-prop-set props) (let ((m (make-music 'PropertySet))) (map (lambda (x) (set! (ly:music-property m (car x)) (cdr x))) props) @@ -113,7 +114,7 @@ (let ((e '()) (c0 0) (oct 0) - (match (string-match "^(.*)([_^])([0-9]+)$" clef-name))) + (match (string-match "^(.*)([_^])([1-9][0-9]*)$" clef-name))) (if match (begin (set! clef-name (match:substring match 1)) @@ -143,9 +144,70 @@ (sort (map car supported-clefs) stringnumber (match:substring match 3)) 1))))) + (set! e (assoc-get clef-name supported-clefs)) + (if e + (let* ((musics (map make-prop-set + `(((symbol . cueClefGlyph) (value . ,(car e))) + ((symbol . middleCCuePosition) + (value . ,(+ oct + (cadr e) + (assoc-get (car e) c0-pitch-alist)))) + ((symbol . cueClefPosition) (value . ,(cadr e))) + ((symbol . cueClefOctavation) (value . ,(- oct)))))) + (recalc-mid-C (make-music 'ApplyContext)) + (seq (make-music 'SequentialMusic + 'elements (append musics (list recalc-mid-C)))) + (csp (make-music 'ContextSpeccedMusic))) + (set! (ly:music-property recalc-mid-C 'procedure) ly:set-middle-C!) + (context-spec-music seq 'Staff)) + (begin + (ly:warning (_ "unknown clef type `~a'") clef-name) + (ly:warning (_ "supported clefs: ~a") + (string-join + (sort (map car supported-clefs) string