]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/clip-region.scm
Add '-dcrop' option to ps and svg backends
[lilypond.git] / scm / clip-region.scm
index 890cb657e3d263af8042a3e10e64e5e3d376919b..277bbe1c7940ed1d9d0d38a9786d7460ddc32ba6 100644 (file)
@@ -1,6 +1,6 @@
 ;;;; This file is part of LilyPond, the GNU music typesetter.
 ;;;;
-;;;; Copyright (C) 2006--2012 Han-Wen Nienhuys <hanwen@lilypond.org>
+;;;; Copyright (C) 2006--2015 Han-Wen Nienhuys <hanwen@lilypond.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
 ;; 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>? 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)
+;;      (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>? a b)
+;;      (define-public (rhythmic-location=? a b)
+;;      (define-public (rhythmic-location->file-string a)
+;;      (define-public (rhythmic-location->string a)
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
        (region-end (cdr clip-region))
        (found-grace-end  #f)
        (candidate-columns
-       (filter
-        (lambda (j)
-          (let*
-              ((column (ly:grob-array-ref columns j))
-               (loc (ly:grob-property column 'rhythmic-location))
-               (grace-less (make-graceless-rhythmic-location loc))
-               )
+        (filter
+         (lambda (j)
+           (let*
+               ((column (ly:grob-array-ref columns j))
+                (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<? grace-less region-end)
-                     (and (rhythmic-location=? grace-less region-end)
-                          (eq? #t (ly:grob-property column 'non-musical))
+             (and (rhythmic-location? loc)
+                  (rhythmic-location<=? region-start loc)
+                  (or (rhythmic-location<? grace-less region-end)
+                      (and (rhythmic-location=? grace-less region-end)
+                           (eq? #t (ly:grob-property column 'non-musical))
 
-                          )))
+                           )))
 
-            ))
+             ))
 
-        (iota (ly:grob-array-length columns))))
+         (iota (ly:grob-array-length columns))))
 
        (column-range
-       (if (>= 1 (length candidate-columns))
-           #f
-           (cons (car candidate-columns)
-                 (car (last-pair candidate-columns)))))
+        (if (>= 1 (length candidate-columns))
+            #f
+            (cons (car candidate-columns)
+                  (car (last-pair candidate-columns)))))
 
        (clipped-x-interval
-       (if column-range
-           (cons
-
-            (interval-start
-             (ly:grob-robust-relative-extent
-              (if (= 0 (car column-range))
-                  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
-           )))
+        (if column-range
+            (cons
+
+             (interval-start
+              (ly:grob-robust-relative-extent
+               (if (= 0 (car column-range))
+                   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))