;;;; This file is part of LilyPond, the GNU music typesetter.
;;;;
-;;;; Copyright (C) 1998--2009 Jan Nieuwenhuizen <janneke@gnu.org>
+;;;; Copyright (C) 1998--2011 Jan Nieuwenhuizen <janneke@gnu.org>
;;;; Han-Wen Nienhuys <hanwen@xs4all.nl>
;;;;
;;;; LilyPond is free software: you can redistribute it and/or modify
letter)))
radius X)))
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; clipping
+
+(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<? a b)
+ (cond
+ ((< (car a) (car b)) #t)
+ ((> (car a) (car b)) #f)
+ (else
+ (ly:moment<? (cdr a) (cdr b)))))
+
+(define-public (rhythmic-location<=? a b)
+ (not (rhythmic-location<? b a)))
+(define-public (rhythmic-location>=? a b)
+ (rhythmic-location<? a b))
+(define-public (rhythmic-location>? a b)
+ (rhythmic-location<? b a))
+
+(define-public (rhythmic-location=? a b)
+ (and (rhythmic-location<=? a b)
+ (rhythmic-location<=? b a)))
+
+(define-public (rhythmic-location->file-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))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; break visibility
(define-public center-visible #(#f #t #f))
(define-public end-of-line-visible #(#t #f #f))
(define-public all-invisible #(#f #f #f))
+(define-public (inherit-x-parent-visibility grob)
+ (let ((parent (ly:grob-parent grob X)))
+ (ly:grob-property parent 'break-visibility all-invisible)))
+
(define-public spanbar-begin-of-line-invisible #(#t #f #f))
("'" . ("'" . ()))
("empty" . (() . ()))
("brace" . (() . "brace"))
- ("bracket" . (() . "bracket"))))
+ ("bracket" . (() . "bracket"))
+
+ ;; segno bar lines
+ ("S" . ("||" . "S"))
+ ("|S" . ("|" . "S"))
+ ("S|" . ("S" . ()))
+ (":|S" . (":|" . "S"))
+ (":|S." . (":|S" . ()))
+ ("S|:" . ("S" . "|:"))
+ (".S|:" . ("|" . "S|:"))
+ (":|S|:" . (":|" . "S|:"))
+ (":|S.|:" . (":|S" . "|:"))))
(define-public (bar-line::calc-glyph-name grob)
(let* ((glyph (ly:grob-property grob 'glyph))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Color
-(define-public color? list?)
+(define-public (color? x)
+ (and (list? x)
+ (= 3 (length x))
+ (apply eq? #t (map number? x))
+ (apply eq? #t (map (lambda (y) (<= 0 y 1)) x))))
+
(define-public (rgb-color r g b) (list r g b))
; predefined colors
(list lp rp)))
(define-public (parentheses-item::calc-angled-bracket-stencils grob)
- (let* ((font (ly:grob-default-font grob))
- (lp (ly:stencil-aligned-to (ly:stencil-aligned-to
- (grob-interpret-markup
- grob
- (ly:wide-char->utf-8 #x2329))
- Y CENTER)
- X RIGHT))
- (rp (ly:stencil-aligned-to (ly:stencil-aligned-to
- (grob-interpret-markup
- grob
- (ly:wide-char->utf-8 #x232A))
- Y CENTER)
- X LEFT)))
-
+ (let* ((parent (ly:grob-parent grob Y))
+ (y-extent (ly:grob-extent parent parent Y))
+ (half-thickness 0.05) ; should it be a property?
+ (width 0.5) ; should it be a property?
+ (angularity 1.5) ; makes angle brackets
+ (white-padding 0.1) ; should it be a property?
+ (lp (ly:stencil-aligned-to
+ (ly:stencil-aligned-to
+ (make-parenthesis-stencil y-extent
+ half-thickness
+ (- width)
+ angularity)
+ Y CENTER)
+ X RIGHT))
+ (lp-x-extent
+ (interval-widen (ly:stencil-extent lp X) white-padding))
+ (rp (ly:stencil-aligned-to
+ (ly:stencil-aligned-to
+ (make-parenthesis-stencil y-extent
+ half-thickness
+ width
+ angularity)
+ Y CENTER)
+ X LEFT))
+ (rp-x-extent
+ (interval-widen (ly:stencil-extent rp X) white-padding)))
+ (set! lp (ly:make-stencil (ly:stencil-expr lp)
+ lp-x-extent
+ (ly:stencil-extent lp Y)))
+ (set! rp (ly:make-stencil (ly:stencil-expr rp)
+ rp-x-extent
+ (ly:stencil-extent rp Y)))
(list (stencil-whiteout lp)
- (stencil-whiteout rp))))
+ (stencil-whiteout rp))))
(define (parenthesize-elements grob . rest)
(let* ((refp (if (null? rest)
(define-public (system-start-text::calc-y-offset grob)
(define (live-elements-list me)
- (let* ((elements (ly:grob-object me 'elements))
- (elts-length (ly:grob-array-length elements))
- (live-elements '()))
+ (let ((elements (ly:grob-object me 'elements)))
- (let get-live ((len elts-length))
- (if (> len 0)
- (let ((elt (ly:grob-array-ref elements (1- len))))
-
- (if (grob::is-live? elt)
- (set! live-elements (cons elt live-elements)))
- (get-live (1- len)))))
- live-elements))
+ (filter! grob::is-live?
+ (ly:grob-array->list elements))))
(let* ((left-bound (ly:spanner-bound grob LEFT))
(live-elts (live-elements-list grob))
(begin
(ly:grob-suicide! grob)
(list)))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; laissez-vibrer tie
+;;
+;; needed so we can make laissez-vibrer a pure print
+;;
+(define-public (laissez-vibrer::print grob)
+ (ly:tie::print grob))
+