1 ;;;; This file is part of LilyPond, the GNU music typesetter.
3 ;;;; Copyright (C) 2006--2011 Han-Wen Nienhuys <hanwen@xs4all.nl>
5 ;;;; LilyPond is free software: you can redistribute it and/or modify
6 ;;;; it under the terms of the GNU General Public License as published by
7 ;;;; the Free Software Foundation, either version 3 of the License, or
8 ;;;; (at your option) any later version.
10 ;;;; LilyPond is distributed in the hope that it will be useful,
11 ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ;;;; GNU General Public License for more details.
15 ;;;; You should have received a copy of the GNU General Public License
16 ;;;; along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
18 (define-module (scm paper-system))
22 (define-public (paper-system-title? system)
23 (equal? #t (ly:prob-property system 'is-title)
26 (define-public (paper-system-stencil system)
27 (ly:prob-property system 'stencil))
29 (define-public (paper-system-layout system)
31 ((g (paper-system-system-grob system)))
37 (define-public (paper-system-system-grob paper-system)
38 (ly:prob-property paper-system 'system-grob))
40 (define-public (paper-system-extent system axis)
41 (ly:stencil-extent (paper-system-stencil system) axis))
43 (define-public (paper-system-staff-extents ps)
44 (ly:prob-property ps 'staff-refpoint-extent '(0 . 0)))
46 (define-public (paper-system-annotate-last system layout)
48 ((bottomspace (ly:prob-property system 'bottom-space))
49 (y-extent (paper-system-extent system Y))
50 (x-extent (paper-system-extent system X))
51 (stencil (ly:prob-property system 'stencil))
53 (arrow (if (number? bottomspace)
54 (annotate-y-interval layout
56 (cons (- (car y-extent) bottomspace)
63 (ly:stencil-add stencil arrow)))
65 (set! (ly:prob-property system 'stencil)
69 ; TODO: annotate the spacing for every spaceable staff within the system.
70 (define-public (paper-system-annotate system next-system layout)
71 "Add arrows and texts to indicate which lengths are set."
72 (let* ((annotations (list))
73 (grob (ly:prob-property system 'system-grob))
74 (estimate-extent (if (ly:grob? grob)
75 (annotate-y-interval layout
77 (ly:grob-property grob 'pure-Y-extent)
80 (let* ((spacing-spec (cond ((and next-system
81 (paper-system-title? system)
82 (paper-system-title? next-system))
83 (ly:output-def-lookup layout 'markup-markup-spacing))
84 ((paper-system-title? system)
85 (ly:output-def-lookup layout 'markup-system-spacing))
87 (paper-system-title? next-system))
88 (ly:output-def-lookup layout 'score-markup-spacing))
90 (ly:output-def-lookup layout 'last-bottom-spacing))
92 (ly:output-def-lookup layout 'system-system-spacing))))
93 (last-staff-Y (car (paper-system-staff-extents system))))
96 (annotate-spacing-spec layout spacing-spec last-staff-Y (car (paper-system-extent system Y)))))
99 (stack-stencils X RIGHT 0.5
103 (if (not (null? annotations))
104 (set! (ly:prob-property system 'stencil)
106 (ly:prob-property system 'stencil)
108 (ly:stencil-expr annotations)
109 (ly:stencil-extent empty-stencil X)
110 (ly:stencil-extent empty-stencil Y)))))
111 (ly:prob-property system 'stencil)))