X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scm%2Fclip-region.scm;h=890cb657e3d263af8042a3e10e64e5e3d376919b;hb=b586253323a60a4ca9acab1a53759504af88b944;hp=14f593adc6b9315449a3319001b4f6a6cfc40533;hpb=bc95f4434f760d41191341ab4508b2064eb19025;p=lilypond.git diff --git a/scm/clip-region.scm b/scm/clip-region.scm index 14f593adc6..890cb657e3 100644 --- a/scm/clip-region.scm +++ b/scm/clip-region.scm @@ -1,6 +1,6 @@ ;;;; This file is part of LilyPond, the GNU music typesetter. ;;;; -;;;; Copyright (C) 2006--2010 Han-Wen Nienhuys +;;;; Copyright (C) 2006--2012 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 @@ -19,55 +19,25 @@ (use-modules (lily)) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;; The procedures shown in this list have been moved to +;; scm/output-lib.scm +;; +;; +;; (define-public (make-rhythmic-location bar-num num den) +;; (define-public (rhythmic-location? a) +;; (define-public (make-graceless-rhythmic-location loc) +;; (define-public rhythmic-location-measure-position cdr) +;; (define-public rhythmic-location-bar-number car) +;; (define-public (rhythmic-location=? a b) +;; (define-public (rhythmic-location>? a b) +;; (define-public (rhythmic-location=? a b) +;; (define-public (rhythmic-location->file-string a) +;; (define-public (rhythmic-location->string a) -(define-public (make-rhythmic-location bar-num num den) - (cons - bar-num (ly:make-moment num den))) - -(define-public (rhythmic-location? a) - (and (pair? a) - (integer? (car a)) - (ly:moment? (cdr a)))) - -(define-public (make-graceless-rhythmic-location loc) - (make-rhythmic-location - (car loc) - (ly:moment-main-numerator (rhythmic-location-measure-position loc)) - (ly:moment-main-denominator (rhythmic-location-measure-position loc)))) - - -(define-public rhythmic-location-measure-position cdr) -(define-public rhythmic-location-bar-number car) - -(define-public (rhythmic-location (car a) (car b)) #f) - (else - (ly:moment=? a b) - (rhythmic-location? a b) - (rhythmic-locationfile-string a) - (ly:format "~a.~a.~a" - (car a) - (ly:moment-main-numerator (cdr a)) - (ly:moment-main-denominator (cdr a)))) - -(define-public (rhythmic-location->string a) - (ly:format "bar ~a ~a" - (car a) - (ly:moment->string (cdr a)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Actual clipping logic. @@ -75,20 +45,20 @@ ;; ;; the total of this will be ;; O(#systems * #regions) -;; +;; ;; we can actually do better by sorting the regions as well, ;; but let's leave that for future extensions. ;; (define-public (system-clipped-x-extent system-grob clip-region) - "Return the X-extent of the SYSTEM-GROB when clipped with -CLIP-REGION. Return #f if not appropriate." - + "Return the X-extent of @var{system-grob} when clipped with +@var{clip-region}. Return @code{#f} if not appropriate." + (let* ((region-start (car clip-region)) (columns (ly:grob-object system-grob 'columns)) (region-end (cdr clip-region)) (found-grace-end #f) - (candidate-columns + (candidate-columns (filter (lambda (j) (let* @@ -96,7 +66,7 @@ CLIP-REGION. Return #f if not appropriate." (loc (ly:grob-property column 'rhythmic-location)) (grace-less (make-graceless-rhythmic-location loc)) ) - + (and (rhythmic-location? loc) (rhythmic-location<=? region-start loc) (or (rhythmic-location= 1 (length candidate-columns)) #f @@ -125,16 +95,16 @@ CLIP-REGION. Return #f if not appropriate." system-grob (ly:grob-array-ref columns (car column-range))) system-grob X)) - + (interval-end (ly:grob-robust-relative-extent (if (= (1- (ly:grob-array-length columns)) (cdr column-range)) system-grob (ly:grob-array-ref columns (cdr column-range))) system-grob X))) - - + + #f ))) - + clipped-x-interval))