[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH]: Allow context modifications to be stored in a variable and inse
From: |
Reinhold Kainhofer |
Subject: |
[PATCH]: Allow context modifications to be stored in a variable and inserted into \context or \with |
Date: |
Fri, 12 Mar 2010 14:41:20 +0100 |
User-agent: |
KMail/1.13.1 (Linux/2.6.31-20-generic; KDE/4.4.1; i686; ; ) |
Our problems with \RemoveEmptyStaffContext resetting previous context
modifications highlights one problem we have: So far, it was not possible to
store a bunch of context modifications into a variable and apply them later
on.
Another incarnation of this problem is that it is not possible to collect some
modifications and use them in a \with block. So far, the contents of the \with
block had to be explicitly written out. I had the problem that in a full score
I needed several staves to be smaller (since they are optional), but I
couldn't use a global definition of the settings (defining my own Staff-
derived context was also not possible, because in the instrumental part, I
need a normal Staff, so all \override Staff.... would break in one or the
other case).
So, here is a patch against current origin/master:
http://codereview.appspot.com/475041
It modifies the parser so that context mods can be stored in variables and can
be inserted into \with or \context blocks:
-) context modifications lists are stored in a dedicated simple scheme object
(C++ class Context_mod)
-) Changes to the parser:
-) context_modifications objects (stored in variables) are now also allowed
with \with clauses
-) context_modifications objects are also allowed inside \context
-) this allows us to rewrite \RemoveEmptyStaffContext (unfortunately with
a little different syntax, since we no longer store \Staff inside the
new \RemoveEmptyStaves command) so that it no longer erases previous
settings to the Staff context. Now, instead of
\context { \RemoveEmptyStaffContext }
one can do
\context { \Staff \RemoveEmptyStaves }
with the same effect and preserve previous changes to the Staff
context. (The same applies of course to \DrumStaff, \RhythmicStaff,
etc. as well)
-) Adjusted engraver-init.ly and the regtests accordingly; Also added regtest
that checks for RESC not discarding previous settings to the Staff context
What do you think of it?
Cheers,
Reinhold
--
------------------------------------------------------------------
Reinhold Kainhofer, address@hidden, http://reinhold.kainhofer.com/
* Financial & Actuarial Math., Vienna Univ. of Technology, Austria
* http://www.fam.tuwien.ac.at/, DVR: 0005886
* LilyPond, Music typesetting, http://www.lilypond.org
- [PATCH]: Allow context modifications to be stored in a variable and inserted into \context or \with,
Reinhold Kainhofer <=
- Re: [PATCH]: Allow context modifications to be stored in a variable and inserted into \context or \with, Mats Bengtsson, 2010/03/12
- Re: [PATCH]: Allow context modifications to be stored in a variable and inserted into \context or \with, Reinhold Kainhofer, 2010/03/16
- Re: [PATCH]: Allow context modifications to be stored in a variable and inserted into \context or \with, Reinhold Kainhofer, 2010/03/22
- Re: [PATCH]: Allow context modifications to be stored in a variable and inserted into \context or \with, David Kastrup, 2010/03/22
- Re: [PATCH]: Allow context modifications to be stored in a variable and inserted into \context or \with, Reinhold Kainhofer, 2010/03/22
- Re: [PATCH]: Allow context modifications to be stored in a variable and inserted into \context or \with, David Kastrup, 2010/03/22
- Re: [PATCH]: Allow context modifications to be stored in a variable and inserted into \context or \with, Werner LEMBERG, 2010/03/22
- Message not available
- Re: [PATCH]: Allow context modifications to be stored in a variableand inserted into \context or \with, Reinhold Kainhofer, 2010/03/22
- Re: [PATCH]: Allow context modifications to be stored in a variable and inserted into \context or \with, Ian Hulin, 2010/03/22
- Re: [PATCH]: Allow context modifications to be stored in a variable and inserted into \context or \with, David Kastrup, 2010/03/22