]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/part-combiner.scm
Run `make grand-replace'.
[lilypond.git] / scm / part-combiner.scm
index c92ea2f3dbb07020641ea5764bcc9e8a8618a522..ddaa17033fc8a9540651efd31306eeaef2e688f6 100644 (file)
@@ -2,7 +2,7 @@
 ;;;;
 ;;;;  source file of the GNU LilyPond music typesetter
 ;;;; 
-;;;; (c) 2004--2006    Han-Wen Nienhuys <hanwen@cs.uu.nl>
+;;;; (c) 2004--2008    Han-Wen Nienhuys <hanwen@xs4all.nl>
 
 ;; todo: figure out how to make module,
 ;; without breaking nested ly scopes
@@ -220,29 +220,20 @@ Voice-state objects
     (ly:interpret-music-expression (make-non-relative-music music) global)
     context-list))
 
-(define noticed '())
-;; todo: junk this, extract $defaultlayout from parser instead
-(define part-combine-listener '())
-
-; UGH - should pass noticed setter to part-combine-listener
-(define-safe-public (set-part-combine-listener x)
-  (set! part-combine-listener x))
-
-(define-public (notice-the-events-for-pc context lst)
-  "add CONTEXT-ID, EVENT list to NOTICED variable."
-  
-  (set! noticed (acons (ly:context-id context) lst noticed)))
-
-(define-public (make-part-combine-music music-list)
+(define-public (make-part-combine-music parser music-list)
   (let* ((m (make-music 'PartCombineMusic))
-       (m1 (make-non-relative-music (context-spec-music (first music-list) 'Voice "one")))
-       (m2  (make-non-relative-music  (context-spec-music (second music-list) 'Voice "two")))
-       (evs2 (recording-group-emulate m2 part-combine-listener))
-       (evs1 (recording-group-emulate m1 part-combine-listener)))
+        (m1 (make-non-relative-music (context-spec-music (first music-list) 'Voice "one")))
+        (m2  (make-non-relative-music  (context-spec-music (second music-list) 'Voice "two")))
+        (listener (ly:parser-lookup parser 'partCombineListener))
+        (evs2 (recording-group-emulate m2 listener))
+        (evs1 (recording-group-emulate m1 listener)))
+    
     (set! (ly:music-property m 'elements) (list m1 m2))
     (set! (ly:music-property m 'split-list)
-         (determine-split-list (reverse! (cdr (assoc "one" evs1)) '())
-                               (reverse! (cdr (assoc "two" evs2)) '())))
+      (if (and (assoc "one" evs1) (assoc "two" evs2))
+         (determine-split-list (reverse! (cdr (assoc "one" evs1)) '())
+                               (reverse! (cdr (assoc "two" evs2)) '()))
+         '() ))
     m))
 
 (define-public (determine-split-list evl1 evl2)
@@ -400,7 +391,10 @@ Only set if not set previously.
       
       (define (try-solo type start-idx current-idx)
        "Find a maximum stretch that can be marked as solo. Only set
-the mark when there are no spanners active."
+the mark when there are no spanners active.
+
+      return next idx to analyse.
+"
        (if (< current-idx (vector-length result))
            (let* ((now-state (vector-ref result current-idx))
                   (solo-state (current-voice-state now-state (if (equal? type 'solo1) 1 2)))
@@ -416,6 +410,7 @@ the mark when there are no spanners active."
                     current-idx)
                    ((and
                      (null? (span-state solo-state)))
+
                     ;;
                     ;; This includes rests. This isn't a problem: long rests
                     ;; will be shared with the silent voice, and be marked
@@ -490,11 +485,10 @@ the mark when there are no spanners active."
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-(define-public (add-quotable name mus)
-  (set! noticed '())
+(define-public (add-quotable parser name mus)
   (let* ((tab (eval 'musicQuotes (current-module)))
         (context-list (recording-group-emulate (context-spec-music mus 'Voice)
-                                             part-combine-listener)))
+                                               (ly:parser-lookup parser 'partCombineListener))))
     (if (pair? context-list)
        (hash-set! tab name
                   ;; cdr : skip name string