LEFT | RIGHT |
1 ;;;; This file is part of LilyPond, the GNU music typesetter. | 1 ;;;; This file is part of LilyPond, the GNU music typesetter. |
2 ;;;; | 2 ;;;; |
3 ;;;; Copyright (C) 1998--2011 Jan Nieuwenhuizen <janneke@gnu.org> | 3 ;;;; Copyright (C) 1998--2011 Jan Nieuwenhuizen <janneke@gnu.org> |
4 ;;;; Han-Wen Nienhuys <hanwen@xs4all.nl> | 4 ;;;; Han-Wen Nienhuys <hanwen@xs4all.nl> |
5 ;;;; | 5 ;;;; |
6 ;;;; LilyPond is free software: you can redistribute it and/or modify | 6 ;;;; LilyPond is free software: you can redistribute it and/or modify |
7 ;;;; it under the terms of the GNU General Public License as published by | 7 ;;;; it under the terms of the GNU General Public License as published by |
8 ;;;; the Free Software Foundation, either version 3 of the License, or | 8 ;;;; the Free Software Foundation, either version 3 of the License, or |
9 ;;;; (at your option) any later version. | 9 ;;;; (at your option) any later version. |
10 ;;;; | 10 ;;;; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 ((ly:grob? cause) (event-cause cause)) | 51 ((ly:grob? cause) (event-cause cause)) |
52 (else #f)))) | 52 (else #f)))) |
53 | 53 |
54 (define-public (grob-interpret-markup grob text) | 54 (define-public (grob-interpret-markup grob text) |
55 (let* ((layout (ly:grob-layout grob)) | 55 (let* ((layout (ly:grob-layout grob)) |
56 (defs (ly:output-def-lookup layout 'text-font-defaults)) | 56 (defs (ly:output-def-lookup layout 'text-font-defaults)) |
57 (props (ly:grob-alist-chain grob defs))) | 57 (props (ly:grob-alist-chain grob defs))) |
58 | 58 |
59 (ly:text-interface::interpret-markup layout props text))) | 59 (ly:text-interface::interpret-markup layout props text))) |
60 | 60 |
| 61 |
| 62 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 63 ;; beam slope |
| 64 |
| 65 ;; calculates each slope of a broken beam individually |
| 66 (define-public (beam::place-broken-parts-individually grob) |
| 67 (ly:beam::quanting grob '(+inf.0 . -inf.0) #f)) |
| 68 |
| 69 ;; calculates the slope of a beam as a single unit, |
| 70 ;; even if it is broken. this assures that the beam |
| 71 ;; will pick up where it left off after a line break |
| 72 (define-public (beam::align-with-broken-parts grob) |
| 73 (ly:beam::quanting grob '(+inf.0 . -inf.0) #t)) |
| 74 |
| 75 ;; uses the broken beam style from edition peters combines the |
| 76 ;; values of place-broken-parts-individually and align-with-broken-parts above, |
| 77 ;; favoring place-broken-parts-individually when the beam naturally has a steepe
r |
| 78 ;; incline and align-with-broken-parts when the beam is flat |
| 79 (define-public (beam::slope-like-broken-parts grob) |
| 80 (define (slope y x) |
| 81 (/ (- (cdr y) (car y)) (- (cdr x) (car x)))) |
| 82 (let* ((quant1 (ly:beam::quanting grob '(+inf.0 . -inf.0) #t)) |
| 83 (original (ly:grob-original grob)) |
| 84 (siblings (if (ly:grob? original) |
| 85 (ly:spanner-broken-into original) |
| 86 '()))) |
| 87 (if (null? siblings) |
| 88 quant1 |
| 89 (let* ((quant2 (ly:beam::quanting grob '(+inf.0 . -inf.0) #f)) |
| 90 (x-span (ly:grob-property grob 'X-positions)) |
| 91 (slope1 (slope quant1 x-span)) |
| 92 (slope2 (slope quant2 x-span)) |
| 93 (quant2 (if (not (= (sign slope1) (sign slope2))) |
| 94 '(0 . 0) |
| 95 quant2)) |
| 96 (factor (/ (atan (abs slope1)) PI-OVER-TWO)) |
| 97 (base (cons-map |
| 98 (lambda (x) |
| 99 (+ (* (x quant1) (- 1 factor)) |
| 100 (* (x quant2) factor))) |
| 101 (cons car cdr)))) |
| 102 (ly:beam::quanting grob base #f))))) |
61 | 103 |
62 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 104 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
63 ;; cross-staff stuff | 105 ;; cross-staff stuff |
64 | 106 |
65 (define-public (script-or-side-position-cross-staff g) | 107 (define-public (script-or-side-position-cross-staff g) |
66 (or | 108 (or |
67 (ly:script-interface::calc-cross-staff g) | 109 (ly:script-interface::calc-cross-staff g) |
68 (ly:side-position-interface::calc-cross-staff g))) | 110 (ly:side-position-interface::calc-cross-staff g))) |
69 | 111 |
70 | 112 |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 (vector (string? (car result)) #t (string? (cdr result))) | 384 (vector (string? (car result)) #t (string? (cdr result))) |
343 all-invisible))) | 385 all-invisible))) |
344 | 386 |
345 (define-public (shift-right-at-line-begin g) | 387 (define-public (shift-right-at-line-begin g) |
346 "Shift an item to the right, but only at the start of the line." | 388 "Shift an item to the right, but only at the start of the line." |
347 (if (and (ly:item? g) | 389 (if (and (ly:item? g) |
348 (equal? (ly:item-break-dir g) RIGHT)) | 390 (equal? (ly:item-break-dir g) RIGHT)) |
349 (ly:grob-translate-axis! g 3.5 X))) | 391 (ly:grob-translate-axis! g 3.5 X))) |
350 | 392 |
351 (define-public (pure-from-neighbor-interface::extra-spacing-height grob) | 393 (define-public (pure-from-neighbor-interface::extra-spacing-height grob) |
352 (ly:pure-from-neighbor-interface::keep-next-door-neighbors grob) | |
353 (let* ((height (ly:grob::stencil-height grob)) | 394 (let* ((height (ly:grob::stencil-height grob)) |
354 (from-neighbors (interval-union | 395 (from-neighbors (interval-union |
355 height | 396 height |
356 (ly:axis-group-interface::pure-height | 397 (ly:axis-group-interface::pure-height |
357 grob | 398 grob |
358 0 | 399 0 |
359 10000000)))) | 400 10000000)))) |
360 (coord-operation - from-neighbors height))) | 401 (coord-operation - from-neighbors height))) |
361 | 402 |
362 (define (time-signature::extra-spacing-height grob) | 403 (define-public (pure-from-neighbor-interface::account-for-span-bar grob) |
| 404 (define (other-op x) (x (cons cdr car))) |
| 405 (let* ((esh (pure-from-neighbor-interface::extra-spacing-height grob)) |
| 406 (hsb (ly:grob-property grob 'has-span-bar))) |
| 407 (if (pair? hsb) |
| 408 (cons-map |
| 409 (lambda (x) |
| 410 (if (and ((other-op x) hsb) |
| 411 (not (and (eq? x car) |
| 412 (not (ly:grob-property grob 'allow-span-bar))))) |
| 413 (x esh) |
| 414 0)) |
| 415 (cons car cdr)) |
| 416 '(0 . 0)))) |
| 417 |
| 418 (define (pure-from-neighbor-interface::extra-spacing-height-including-staff grob
) |
363 (let ((esh (pure-from-neighbor-interface::extra-spacing-height grob)) | 419 (let ((esh (pure-from-neighbor-interface::extra-spacing-height grob)) |
364 (to-staff (coord-operation - | 420 (to-staff (coord-operation - |
365 (interval-widen | 421 (interval-widen |
366 '(0 . 0) | 422 '(0 . 0) |
367 (ly:staff-symbol-staff-radius grob)) | 423 (ly:staff-symbol-staff-radius grob)) |
368 (ly:grob::stencil-height grob)))) | 424 (ly:grob::stencil-height grob)))) |
369 (interval-union esh to-staff))) | 425 (interval-union esh to-staff))) |
370 | 426 |
371 | 427 |
372 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 428 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1009 (list))))) | 1065 (list))))) |
1010 | 1066 |
1011 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 1067 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1012 ;; laissez-vibrer tie | 1068 ;; laissez-vibrer tie |
1013 ;; | 1069 ;; |
1014 ;; needed so we can make laissez-vibrer a pure print | 1070 ;; needed so we can make laissez-vibrer a pure print |
1015 ;; | 1071 ;; |
1016 (define-public (laissez-vibrer::print grob) | 1072 (define-public (laissez-vibrer::print grob) |
1017 (ly:tie::print grob)) | 1073 (ly:tie::print grob)) |
1018 | 1074 |
LEFT | RIGHT |