LEFT | RIGHT |
1 %%%% -*- Mode: Scheme -*- | 1 %%%% -*- Mode: Scheme -*- |
2 | 2 |
3 %%%% This file is part of LilyPond, the GNU music typesetter. | 3 %%%% This file is part of LilyPond, the GNU music typesetter. |
4 %%%% | 4 %%%% |
5 %%%% Copyright (C) 2003--2012 Han-Wen Nienhuys <hanwen@xs4all.nl> | 5 %%%% Copyright (C) 2003--2012 Han-Wen Nienhuys <hanwen@xs4all.nl> |
6 %%%% Jan Nieuwenhuizen <janneke@gnu.org> | 6 %%%% Jan Nieuwenhuizen <janneke@gnu.org> |
7 %%%% | 7 %%%% |
8 %%%% LilyPond is free software: you can redistribute it and/or modify | 8 %%%% LilyPond is free software: you can redistribute it and/or modify |
9 %%%% it under the terms of the GNU General Public License as published by | 9 %%%% it under the terms of the GNU General Public License as published by |
10 %%%% the Free Software Foundation, either version 3 of the License, or | 10 %%%% the Free Software Foundation, either version 3 of the License, or |
(...skipping 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1220 #(define-music-function (parser location tag arg) (symbol? ly:music?) | 1220 #(define-music-function (parser location tag arg) (symbol? ly:music?) |
1221 | 1221 |
1222 (_i "Add @var{tag} to the @code{tags} property of @var{arg}.") | 1222 (_i "Add @var{tag} to the @code{tags} property of @var{arg}.") |
1223 | 1223 |
1224 (set! | 1224 (set! |
1225 (ly:music-property arg 'tags) | 1225 (ly:music-property arg 'tags) |
1226 (cons tag | 1226 (cons tag |
1227 (ly:music-property arg 'tags))) | 1227 (ly:music-property arg 'tags))) |
1228 arg) | 1228 arg) |
1229 | 1229 |
| 1230 temporary = |
| 1231 #(define-music-function (parser location music) |
| 1232 (ly:music?) |
| 1233 (_i "Make any @code{\\override} in @var{music} replace an existing |
| 1234 grob property value only temporarily, restoring the old value when a |
| 1235 corresponding @code{\\revert} is executed. This is achieved by |
| 1236 clearing the @samp{pop-first} property normally set on |
| 1237 @code{\\override}s. |
| 1238 |
| 1239 An @code{\\override}/@/@code{\\revert} sequence created by using |
| 1240 @code{\\temporary} and @code{\\undo} on the same music containing |
| 1241 overrides will cancel out perfectly or cause a@tie{}warning. |
| 1242 |
| 1243 Non-property-related music is ignored, warnings are generated for any |
| 1244 property-changing music that isn't an @code{\\override}.") |
| 1245 (define warned #f) |
| 1246 (for-some-music |
| 1247 (lambda (m) |
| 1248 (and (or (music-is-of-type? m 'layout-instruction-event) |
| 1249 (music-is-of-type? m 'context-specification) |
| 1250 (music-is-of-type? m 'apply-context) |
| 1251 (music-is-of-type? m 'time-signature-music)) |
| 1252 (case (ly:music-property m 'name) |
| 1253 ((OverrideProperty) |
| 1254 (if (ly:music-property m 'pop-first #f) |
| 1255 (set! (ly:music-property m 'pop-first) '())) |
| 1256 (if (ly:music-property m 'once #f) |
| 1257 (set! (ly:music-property m 'once) '())) |
| 1258 #t) |
| 1259 ((ContextSpeccedMusic) |
| 1260 #f) |
| 1261 (else |
| 1262 (if (not warned) |
| 1263 (begin |
| 1264 (ly:input-warning location (_ "Cannot make ~a revertible") |
| 1265 (ly:music-property m 'name)) |
| 1266 (set! warned #t))) |
| 1267 #t)))) |
| 1268 music) |
| 1269 music) |
| 1270 |
1230 time = | 1271 time = |
1231 #(define-music-function (parser location beat-structure fraction) | 1272 #(define-music-function (parser location beat-structure fraction) |
1232 ((number-list? '()) fraction?) | 1273 ((number-list? '()) fraction?) |
1233 (_i "Set @var{fraction} as time signature, with optional | 1274 (_i "Set @var{fraction} as time signature, with optional |
1234 number list @var{beat-structure} before it.") | 1275 number list @var{beat-structure} before it.") |
1235 (make-music 'TimeSignatureMusic | 1276 (make-music 'TimeSignatureMusic |
1236 'numerator (car fraction) | 1277 'numerator (car fraction) |
1237 'denominator (cdr fraction) | 1278 'denominator (cdr fraction) |
1238 'beat-structure beat-structure)) | 1279 'beat-structure beat-structure)) |
1239 | 1280 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1304 value | 1345 value |
1305 (ly:music-property music 'tweaks))) | 1346 (ly:music-property music 'tweaks))) |
1306 (ly:input-warning location (_ "cannot find property type-check for ~a") p
rop)) | 1347 (ly:input-warning location (_ "cannot find property type-check for ~a") p
rop)) |
1307 music) | 1348 music) |
1308 | 1349 |
1309 undo = | 1350 undo = |
1310 #(define-music-function (parser location music) | 1351 #(define-music-function (parser location music) |
1311 (ly:music?) | 1352 (ly:music?) |
1312 (_i "Convert @code{\\override} and @code{\\set} in @var{music} to | 1353 (_i "Convert @code{\\override} and @code{\\set} in @var{music} to |
1313 @code{\\revert} and @code{\\unset}, respectively. Any reverts and | 1354 @code{\\revert} and @code{\\unset}, respectively. Any reverts and |
1314 unsets already in @var{music} are ignored and not converted.") | 1355 unsets already in @var{music} cause a warning. Non-property-related music is ig
nored.") |
| 1356 (define warned #f) |
1315 (let loop | 1357 (let loop |
1316 ((music music)) | 1358 ((music music)) |
1317 (let | 1359 (let |
1318 ((lst | 1360 ((lst |
1319 (fold-some-music | 1361 (fold-some-music |
1320 (lambda (m) (or (music-is-of-type? m 'layout-instruction-event) | 1362 (lambda (m) (or (music-is-of-type? m 'layout-instruction-event) |
1321 (music-is-of-type? m 'context-specification))) | 1363 (music-is-of-type? m 'context-specification) |
| 1364 (music-is-of-type? m 'apply-context) |
| 1365 (music-is-of-type? m 'time-signature-music))) |
1322 (lambda (m overrides) | 1366 (lambda (m overrides) |
1323 (case (ly:music-property m 'name) | 1367 (case (ly:music-property m 'name) |
1324 ((OverrideProperty) | 1368 ((OverrideProperty) |
1325 (cons | 1369 (cons |
1326 (make-music 'RevertProperty | 1370 (make-music 'RevertProperty |
1327 'symbol (ly:music-property m 'symbol) | 1371 'symbol (ly:music-property m 'symbol) |
1328 'grob-property-path | 1372 'grob-property-path |
1329 (cond | 1373 (cond |
1330 ((ly:music-property m 'grob-property #f) => list) | 1374 ((ly:music-property m 'grob-property #f) => list) |
1331 (else | 1375 (else |
1332 (ly:music-property m 'grob-property-path)))) | 1376 (ly:music-property m 'grob-property-path)))) |
1333 overrides)) | 1377 overrides)) |
1334 ((PropertySet) | 1378 ((PropertySet) |
1335 (cons | 1379 (cons |
1336 (make-music 'PropertyUnset | 1380 (make-music 'PropertyUnset |
1337 'symbol (ly:music-property m 'symbol)) | 1381 'symbol (ly:music-property m 'symbol)) |
1338 overrides)) | 1382 overrides)) |
1339 ((ContextSpeccedMusic) | 1383 ((ContextSpeccedMusic) |
1340 (cons | 1384 (cons |
1341 (make-music 'ContextSpeccedMusic | 1385 (make-music 'ContextSpeccedMusic |
1342 'element (loop (ly:music-property m 'element)) | 1386 'element (loop (ly:music-property m 'element)) |
1343 'context-type (ly:music-property m 'context-type)) | 1387 'context-type (ly:music-property m 'context-type)) |
1344 overrides)) | 1388 overrides)) |
1345 (else overrides))) | 1389 (else |
| 1390 (if (not warned) |
| 1391 (begin |
| 1392 (ly:input-warning location (_ "Cannot revert ~a") |
| 1393 (ly:music-property m 'name)) |
| 1394 (set! warned #t))) |
| 1395 overrides))) |
1346 '() | 1396 '() |
1347 music))) | 1397 music))) |
1348 (cond | 1398 (cond |
1349 ((null? lst) (make-music 'Music)) | 1399 ((null? lst) (make-music 'Music)) |
1350 ((null? (cdr lst)) (car lst)) | 1400 ((null? (cdr lst)) (car lst)) |
1351 (else (make-sequential-music lst)))))) | 1401 (else (make-sequential-music lst)))))) |
1352 | 1402 |
1353 unfoldRepeats = | 1403 unfoldRepeats = |
1354 #(define-music-function (parser location music) (ly:music?) | 1404 #(define-music-function (parser location music) (ly:music?) |
1355 (_i "Force any @code{\\repeat volta}, @code{\\repeat tremolo} or | 1405 (_i "Force any @code{\\repeat volta}, @code{\\repeat tremolo} or |
1356 @code{\\repeat percent} commands in @var{music} to be interpreted | 1406 @code{\\repeat percent} commands in @var{music} to be interpreted |
1357 as @code{\\repeat unfold}.") | 1407 as @code{\\repeat unfold}.") |
1358 (unfold-repeats music)) | 1408 (unfold-repeats music)) |
1359 | 1409 |
1360 void = | 1410 void = |
1361 #(define-void-function (parser location arg) (scheme?) | 1411 #(define-void-function (parser location arg) (scheme?) |
1362 (_i "Accept a scheme argument, return a void expression. | 1412 (_i "Accept a scheme argument, return a void expression. |
1363 Use this if you want to have a scheme expression evaluated | 1413 Use this if you want to have a scheme expression evaluated |
1364 because of its side-effects, but its value ignored.")) | 1414 because of its side-effects, but its value ignored.")) |
1365 | 1415 |
1366 withMusicProperty = | 1416 withMusicProperty = |
1367 #(define-music-function (parser location sym val music) | 1417 #(define-music-function (parser location sym val music) |
1368 (symbol? scheme? ly:music?) | 1418 (symbol? scheme? ly:music?) |
1369 (_i "Set @var{sym} to @var{val} in @var{music}.") | 1419 (_i "Set @var{sym} to @var{val} in @var{music}.") |
1370 | 1420 |
1371 (set! (ly:music-property music sym) val) | 1421 (set! (ly:music-property music sym) val) |
1372 music) | 1422 music) |
LEFT | RIGHT |