OLD | NEW |
1 ;;;; This file is part of LilyPond, the GNU music typesetter. | 1 ;;;; This file is part of LilyPond, the GNU music typesetter. |
2 ;;;; | 2 ;;;; |
3 ;;;; Copyright (C) 2004--2011 Han-Wen Nienhuys <hanwen@xs4all.nl> | 3 ;;;; Copyright (C) 2004--2011 Han-Wen Nienhuys <hanwen@xs4all.nl> |
4 ;;;; | 4 ;;;; |
5 ;;;; LilyPond is free software: you can redistribute it and/or modify | 5 ;;;; LilyPond is free software: you can redistribute it and/or modify |
6 ;;;; it under the terms of the GNU General Public License as published by | 6 ;;;; it under the terms of the GNU General Public License as published by |
7 ;;;; the Free Software Foundation, either version 3 of the License, or | 7 ;;;; the Free Software Foundation, either version 3 of the License, or |
8 ;;;; (at your option) any later version. | 8 ;;;; (at your option) any later version. |
9 ;;;; | 9 ;;;; |
10 ;;;; LilyPond is distributed in the hope that it will be useful, | 10 ;;;; LilyPond is distributed in the hope that it will be useful, |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 (vector->list result))) | 564 (vector->list result))) |
565 (if #f ;; pc-debug | 565 (if #f ;; pc-debug |
566 (display result)) | 566 (display result)) |
567 result)) | 567 result)) |
568 | 568 |
569 | 569 |
570 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 570 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
571 | 571 |
572 (define-public (add-quotable parser name mus) | 572 (define-public (add-quotable parser name mus) |
573 (let* ((tab (eval 'musicQuotes (current-module))) | 573 (let* ((tab (eval 'musicQuotes (current-module))) |
574 » (context-list (recording-group-emulate (context-spec-music mus 'Voice) | 574 (voicename (get-next-unique-voice-name)) |
575 » » » » » » (ly:parser-lookup parser 'partCo
mbineListener)))) | 575 ;; recording-group-emulate returns an assoc list (reversed!), so |
576 (if (pair? context-list) | 576 ;; hand it a proper unique context name and extract that key: |
577 » (hash-set! tab name | 577 (ctx-spec (context-spec-music mus 'Voice voicename)) |
578 » » ;; cdr : skip name string | 578 (listener (ly:parser-lookup parser 'partCombineListener)) |
579 » » (list->vector (reverse! (cdar context-list) | 579 (context-list (reverse (recording-group-emulate ctx-spec listener))) |
580 » » » » » '())))))) | 580 (raw-voice (assoc voicename context-list)) |
| 581 (quote-contents (if (pair? raw-voice) (cdr raw-voice) '()))) |
| 582 |
| 583 ;; If the context-specced quoted music does not contain anything, try to |
| 584 ;; use the first child, i.e. the next in context-list after voicename |
| 585 ;; That's the case e.g. for \addQuote "x" \relative c \new Voice {...} |
| 586 (if (null? quote-contents) |
| 587 (let find-non-empty ((current-tail (member raw-voice context-list))) |
| 588 ;; if voice has contents, use them, otherwise check next ctx |
| 589 (cond ((null? current-tail) #f) |
| 590 ((and (pair? (car current-tail)) |
| 591 (pair? (cdar current-tail))) |
| 592 (set! quote-contents (cdar current-tail))) |
| 593 (else (find-non-empty (cdr current-tail)))))) |
| 594 |
| 595 (if (not (null? quote-contents)) |
| 596 (hash-set! tab name (list->vector (reverse! quote-contents '()))) |
| 597 (ly:music-message mus (ly:format (_ "quoted music `~a' is empty") name))
))) |
OLD | NEW |