]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/auto-beam.scm
Add '-dcrop' option to ps and svg backends
[lilypond.git] / scm / auto-beam.scm
index 72c7ea322982ae4644799c76083aca4300cf11e3..9ba08705ef0102cab09683c8e2747411f7a23704 100644 (file)
@@ -1,6 +1,6 @@
 ;;;; This file is part of LilyPond, the GNU music typesetter.
 ;;;;
-;;;; Copyright (C) 2000--2014 Jan Nieuwenhuizen <janneke@gnu.org>
+;;;; Copyright (C) 2000--2015 Jan Nieuwenhuizen <janneke@gnu.org>
 ;;;;
 ;;;; LilyPond is free software: you can redistribute it and/or modify
 ;;;; it under the terms of the GNU General Public License as published by
     (let ((value (ly:context-property context name)))
       (if (not (null? value)) value default)))
 
-  (define (ending-moments group-list start-beat base-length)
-    (if (null? group-list)
-        '()
-        (let ((new-start (+ start-beat (car group-list))))
-          (cons (* new-start base-length)
-                (ending-moments (cdr group-list) new-start base-length)))))
+  (define (ending-moments group-list base-length)
+    (let ((beat 0))
+      (map-in-order (lambda (x)
+                      (set! beat (+ beat x))
+                      (* base-length beat))
+                    group-list)))
 
   (define (larger-setting type sorted-alist)
     (assoc type sorted-alist <=))
@@ -64,7 +64,7 @@
              (time-signature-fraction
               (get 'timeSignatureFraction '(4 . 4)))
              (beat-structure (get 'beatStructure '(1 1 1 1)))
-             (beat-endings (ending-moments beat-structure base-length))
+             (beat-endings (ending-moments beat-structure base-length))
              (exceptions (sort (map
                                 (lambda (a)
                                   (if (pair? (car a))
@@ -95,7 +95,7 @@
                                   type))
              (exception-moments (and exception-grouping
                                      (ending-moments
-                                      exception-grouping grouping-moment))))
+                                      exception-grouping grouping-moment))))
 
         (if (= dir START)
             ;; Start rules -- #t if beam is allowed to start