]> git.donarmstrong.com Git - lilypond.git/commit
Fix parenthesize to work with single notes, rests and whole chords
authorReinhold Kainhofer <reinhold@kainhofer.com>
Sun, 30 Mar 2008 11:45:00 +0000 (13:45 +0200)
committerReinhold Kainhofer <reinhold@kainhofer.com>
Sun, 30 Mar 2008 11:45:00 +0000 (13:45 +0200)
commit5e864591ae95b497cc6d85831565fca65d610e29
treecd38e728bff906582790e97a68bfc1172790a508
parentccfffa1bea9f6492116314b31a3cbb7b0f240006
Fix parenthesize to work with single notes, rests and whole chords

By default, Lilypond's \parenthesize function (to put parentheses around notes,
articulations, etc.) only works on notes if they are written inside a chord.
In particular, \parenthesize c4 will not work, only <\parenthesize c>4 will.
Similarly, trying to parenthesize a rest will fail. The reason is that
internally, Lilypond understands c4 as <c>4, so the first example is
internally the same as \parenthesize <c>4. The apparent solution is to make
\parenthesize apply to all elements inside a chord instead of the chord
itself (which the current implementation does).

In fact, one can simply redefine the \parenthesize function, which sets
the parenthesize property of a music expression to ##t, so that if applied
to a chord, it will set this property for all note and rest children of a
chord. This immediately solves the problem of parenthesizing rests, as well
as allowing the parenthesizing of all notes inside a chord at once. All
other uses of \parenthesize continue working as usual. So, using the
redefinition of \parenthesize from the snippet, finally the following
commands work as expected:

    \parenthesize c4-. \parenthesize r4 \parenthesize <c e g>4->
ly/music-functions-init.ly