OLD | NEW |
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) 2009--2010 Marc Hohl <marc@hohlart.de> | 3 ;;;; Copyright (C) 2009--2010 Marc Hohl <marc@hohlart.de> |
4 ;;;; | 4 ;;;; |
5 ;;;; LilyPond is free software: you can redistribute it and/or modify | 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 | 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 | 7 ;;;; the Free Software Foundation, either version 3 of the License, or |
8 ;;;; (at your option) any later version. | 8 ;;;; (at your option) any later version. |
9 ;;;; | 9 ;;;; |
10 ;;;; LilyPond is distributed in the hope that it will be useful, | 10 ;;;; LilyPond is distributed in the hope that it will be useful, |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 ;; apply whiteout to each element of the list | 173 ;; apply whiteout to each element of the list |
174 (map stencil-whiteout | 174 (map stencil-whiteout |
175 (parentheses-item::calc-parenthesis-stencils grob))) | 175 (parentheses-item::calc-parenthesis-stencils grob))) |
176 (parentheses-item::calc-parenthesis-stencils grob)))) | 176 (parentheses-item::calc-parenthesis-stencils grob)))) |
177 | 177 |
178 ;; the handler for ties in tablature; according to TabNoteHead #'details, | 178 ;; the handler for ties in tablature; according to TabNoteHead #'details, |
179 ;; the 'tied to' note is handled differently after a line break | 179 ;; the 'tied to' note is handled differently after a line break |
180 (define-public (tie::handle-tab-note-head grob) | 180 (define-public (tie::handle-tab-note-head grob) |
181 (let* ((original (ly:grob-original grob)) | 181 (let* ((original (ly:grob-original grob)) |
182 (tied-tab-note-head (ly:spanner-bound grob RIGHT)) | 182 (tied-tab-note-head (ly:spanner-bound grob RIGHT)) |
| 183 (cautionary (ly:grob-property tied-tab-note-head 'display-cautionary #f
)) |
183 (siblings (if (ly:grob? original) | 184 (siblings (if (ly:grob? original) |
184 (ly:spanner-broken-into original) '()))) | 185 (ly:spanner-broken-into original) '()))) |
185 | 186 |
186 (if (and (>= (length siblings) 2) | 187 (if cautionary |
187 (eq? (car (last-pair siblings)) grob)) | 188 ;; tab note head is right bound of a tie and left of spanner, |
188 ;; tie is split -> get TabNoteHead #'details | 189 ;; -> parenthesize it at all events |
189 (let* ((details (ly:grob-property tied-tab-note-head 'details)) | 190 (ly:grob-set-property! tied-tab-note-head 'stencil |
190 (tied-properties (assoc-get 'tied-properties details '())) | 191 (lambda (grob) |
191 (tab-note-head-parenthesized (assoc-get 'parenthesize tied-proper
ties #t)) | 192 (parenthesize-tab-note-head
grob))) |
192 ;; we need the begin-of-line entry in the 'break-visibility vecto
r | 193 ;; otherwise, check whether tie is split: |
193 (tab-note-head-visible | 194 (if (and (>= (length siblings) 2) |
194 (vector-ref (assoc-get 'break-visibility | 195 (eq? (car (last-pair siblings)) grob)) |
195 tied-properties #(#f #f #t)) 2))) | 196 ;; tie is split -> get TabNoteHead #'details |
| 197 (let* ((details (ly:grob-property tied-tab-note-head 'details)) |
| 198 (tied-properties (assoc-get 'tied-properties details '())) |
| 199 (tab-note-head-parenthesized (assoc-get 'parenthesize tied-pr
operties #t)) |
| 200 ;; we need the begin-of-line entry in the 'break-visibility v
ector |
| 201 (tab-note-head-visible |
| 202 (vector-ref (assoc-get 'break-visibility |
| 203 tied-properties #(#f #f #t)) 2))) |
196 | 204 |
197 » (if tab-note-head-visible | 205 (if tab-note-head-visible |
198 » ;; tab note head is visible | 206 ;; tab note head is visible |
199 » (if tab-note-head-parenthesized | 207 (if tab-note-head-parenthesized |
200 » » (ly:grob-set-property! tied-tab-note-head 'stencil | 208 (ly:grob-set-property! tied-tab-note-head 'stencil |
201 » » » » » (lambda (grob) | 209 (lambda (grob) |
202 » » » » » (parenthesize-tab-note-head grob)))) | 210 (parenthesize-
tab-note-head grob)))) |
203 » ;; tab note head is invisible | 211 ;; tab note head is invisible |
204 » (begin | 212 (ly:grob-set-property! tied-tab-note-head 'transparent #t))) |
205 » (ly:grob-set-property! tied-tab-note-head 'transparent #t) | |
206 » (ly:grob-set-property! tied-tab-note-head 'whiteout #f)))) | |
207 | 213 |
208 ;; tie is not split -> make fret number invisible | 214 ;; tie is not split |
209 (begin | 215 (ly:grob-set-property! tied-tab-note-head 'transparent #t))))) |
210 (ly:grob-set-property! tied-tab-note-head 'transparent #t) | 216 |
211 (ly:grob-set-property! tied-tab-note-head 'whiteout #f))))) | 217 |
212 | 218 |
213 ;; repeat ties occur within alternatives in a repeat construct; | 219 ;; repeat ties occur within alternatives in a repeat construct; |
214 ;; TabNoteHead #'details handles the appearance in this case | 220 ;; TabNoteHead #'details handles the appearance in this case |
215 (define-public (repeat-tie::handle-tab-note-head grob) | 221 (define-public (repeat-tie::handle-tab-note-head grob) |
216 (let* ((tied-tab-note-head (ly:grob-object grob 'note-head)) | 222 (let* ((tied-tab-note-head (ly:grob-object grob 'note-head)) |
217 (details (ly:grob-property tied-tab-note-head 'details)) | 223 (cautionary (ly:grob-property tied-tab-note-head 'display-cautionary #f
))) |
218 (repeat-tied-properties (assoc-get 'repeat-tied-properties details '())
) | 224 (if cautionary |
219 (tab-note-head-visible (assoc-get 'note-head-visible repeat-tied-proper
ties #t)) | 225 ;; tab note head is between a tie and a slur/glissando |
220 (tab-note-head-parenthesized (assoc-get 'parenthesize repeat-tied-prope
rties #t))) | 226 ;; -> parenthesize it at all events |
| 227 (ly:grob-set-property! tied-tab-note-head 'stencil |
| 228 (lambda (grob) |
| 229 (parenthesize-tab-note-head g
rob))) |
| 230 ;; otherwise check 'details |
| 231 (let* ((details (ly:grob-property tied-tab-note-head 'details)) |
| 232 (repeat-tied-properties (assoc-get 'repeat-tied-properties detail
s '())) |
| 233 (tab-note-head-visible (assoc-get 'note-head-visible repeat-tied-
properties #t)) |
| 234 (tab-note-head-parenthesized (assoc-get 'parenthesize repeat-tied
-properties #t))) |
221 | 235 |
222 (if tab-note-head-visible | 236 (if tab-note-head-visible |
223 ;; tab note head is visible | 237 ;; tab note head is visible |
224 (if tab-note-head-parenthesized | 238 (if tab-note-head-parenthesized |
225 » (ly:grob-set-property! tied-tab-note-head 'stencil | 239 (ly:grob-set-property! tied-tab-note-head 'stencil |
226 » » » » (lambda (grob) | 240 (lambda (grob) |
227 » » » » (parenthesize-tab-note-head grob)))) | 241 (parenthesize-tab-no
te-head grob)))) |
228 » ;; tab note head is invisible | 242 ;; tab note head is invisible |
229 » (begin | 243 (ly:grob-set-property! tied-tab-note-head 'transparent #t)))))) |
230 (ly:grob-set-property! tied-tab-note-head 'transparent #t) | |
231 (ly:grob-set-property! tied-tab-note-head 'whiteout #f))))) | |
232 | 244 |
233 ;; the slurs should not be too far apart from the corresponding fret number, so | 245 ;; the slurs should not be too far apart from the corresponding fret number, so |
234 ;; we move the slur towards the TabNoteHeads: | 246 ;; we move the slur towards the TabNoteHeads; moreover, if the left fret number
is |
| 247 ;; the right-bound of a tie, we'll set it in parentheses: |
235 (define-public (slur::draw-tab-slur grob) | 248 (define-public (slur::draw-tab-slur grob) |
236 ;; TODO: use a less "brute-force" method to decrease | 249 ;; TODO: use a less "brute-force" method to decrease |
237 ;; the distance between the slur ends and the fret numbers | 250 ;; the distance between the slur ends and the fret numbers |
238 (let* ((staff-space (ly:staff-symbol-staff-space grob)) | 251 (let* ((original (ly:grob-original grob)) |
| 252 (left-bound (ly:spanner-bound original LEFT)) |
| 253 (left-tab-note-head (ly:grob-property left-bound 'cause)) |
| 254 ;; (cautionary (ly:grob-property left-tab-note-head 'display-cautionary
#f)) |
| 255 (staff-space (ly:staff-symbol-staff-space grob)) |
239 (control-points (ly:grob-property grob 'control-points)) | 256 (control-points (ly:grob-property grob 'control-points)) |
240 (new-control-points (map | 257 (new-control-points (map |
241 » » » (lambda (p) | 258 (lambda (p) |
242 » » » » (cons (car p) | 259 (cons (car p) |
243 » » » » (- (cdr p) | 260 (- (cdr p) |
244 » » » » » (* staff-space | 261 (* staff-space |
245 » » » » » (ly:grob-property grob 'direction) | 262 (ly:grob-property grob 'direction) |
246 » » » » » 0.35)))) | 263 0.35)))) |
247 » » » control-points))) | 264 control-points))) |
248 | 265 |
249 (ly:grob-set-property! grob 'control-points new-control-points) | 266 (ly:grob-set-property! grob 'control-points new-control-points) |
| 267 ;; (and tie-follow |
| 268 ;; (ly:grob-set-property! left-tab-note-head 'stencil |
| 269 ;; (lambda (grob) |
| 270 ;; (parenthesize-tab-note-he
ad grob)))) |
250 (ly:slur::print grob))) | 271 (ly:slur::print grob))) |
251 | 272 |
| 273 ;; The glissando routine works similarly to the slur routine; if the |
| 274 ;; fret number is "tied to", it should become parenthesized. |
| 275 (define-public (glissando::draw-tab-glissando grob) |
| 276 (let* ((original (ly:grob-original grob)) |
| 277 (left-tab-note-head (ly:spanner-bound original LEFT)) |
| 278 (cautionary (ly:grob-property left-tab-note-head 'display-cautionary #f
))) |
| 279 |
| 280 (and cautionary |
| 281 ;; (ly:grob-set-property! left-tab-note-head 'stencil |
| 282 ;; (lambda (grob) |
| 283 ;; (parenthesize-tab-note-he
ad grob))) |
| 284 ;; increase left padding to avoid collision between |
| 285 ;; closing parenthesis and glissando line |
| 286 (ly:grob-set-nested-property! grob '(bound-details left padding) 0.75)) |
| 287 (ly:line-spanner::print grob))) |
| 288 |
252 ;; for \tabFullNotation, the stem tremolo beams are too big in comparison to | 289 ;; for \tabFullNotation, the stem tremolo beams are too big in comparison to |
253 ;; normal staves; this wrapper function scales accordingly: | 290 ;; normal staves; this wrapper function scales accordingly: |
254 (define-public (stem-tremolo::calc-tab-width grob) | 291 (define-public (stem-tremolo::calc-tab-width grob) |
255 (let ((width (ly:stem-tremolo::calc-width grob)) | 292 (let ((width (ly:stem-tremolo::calc-width grob)) |
256 » (staff-space (ly:staff-symbol-staff-space grob))) | 293 (staff-space (ly:staff-symbol-staff-space grob))) |
257 (/ width staff-space))) | 294 (/ width staff-space))) |
OLD | NEW |