]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/auto-beam.scm
(grob-cause): replace backslashes by /
[lilypond.git] / scm / auto-beam.scm
index e3369a4346c32a0dd81f10925001c92f813c611e..610cb051f413ef7984c6f3e7eefe0283fe5b9483 100644 (file)
@@ -2,7 +2,7 @@
 ;;;;
 ;;;; source file of the GNU LilyPond music typesetter
 ;;;; 
-;;;; (c) 2000--2005 Jan Nieuwenhuizen <janneke@gnu.org>
+;;;; (c) 2000--2006 Jan Nieuwenhuizen <janneke@gnu.org>
 
 ;;; specify generic beam begin and end times
 
@@ -190,15 +190,16 @@ a fresh copy of the list-head is made."
     (let ((value (ly:context-property context name)))
       (if (not (null? value)) value default)))
 
-  (if (!= (ly:moment-grace-numerator (ly:context-now context)) 0)
-      ;; No auto beaming for grace notes
+  ;; Don't start auto beams on grace notes
+  (if (and (!= (ly:moment-grace-numerator (ly:context-now context)) 0)
+          (= dir START))
       #f
       (let* ((beat-length (get 'beatLength (ly:make-moment 1 1)))
             (measure-length (get 'measureLength (ly:make-moment 1 1)))
-            (measure-pos (get 'measurePosition (ly:make-moment 0 1)))
+            (measure-pos (get 'measurePosition ZERO-MOMENT))
             (settings (get 'autoBeamSettings '()))
             (function (list (if (= dir START) 'begin 'end)))
-            (num-mom (ly:div-moment measure-length beat-length))
+            (num-mom (ly:moment-div measure-length beat-length))
             (num (inexact->exact
                   (round (/ (ly:moment-main-numerator num-mom)
                             (ly:moment-main-denominator num-mom)))))
@@ -208,7 +209,7 @@ a fresh copy of the list-head is made."
                         (ly:moment-main-denominator test)))
             (pos (if (>= (ly:moment-main-numerator measure-pos) 0)
                      measure-pos
-                     (ly:add-moment measure-length measure-pos)))
+                     (ly:moment-add measure-length measure-pos)))
             (lst (list
                   ;; Hmm, should junk user-override feature,
                   ;; or split this in user-override and config section?
@@ -216,6 +217,7 @@ a fresh copy of the list-head is made."
                   (append function '(* * * *))
                   (append function type time)
                   (append function '(* *) time))))
+
        (if (or
             ;; always begin or end beams at beginning/ending of measure
             (= (ly:moment-main-numerator pos) 0)
@@ -229,4 +231,4 @@ a fresh copy of the list-head is made."
                ;; end at any beat
                (and (not (first-assoc lst settings))
                     (= (ly:moment-main-denominator
-                        (ly:div-moment pos beat-length)) 1)))))))
+                        (ly:moment-div pos beat-length)) 1)))))))