gnu-music-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnu-music-discuss] cue context?


From: Mats Bengtsson
Subject: Re: [Gnu-music-discuss] cue context?
Date: Mon, 18 Sep 2000 11:35:47 +0200

> Well, at the risk of earning another (sigh), this doesn't work
> either. I have 

OK, let's try to explain how it works:
Look in the file engraver.ly. First the identifier 
\StaffContext is defined to give the default behaviour:
StaffContext = \translator {
        \type "Engraver_group_engraver";
        \name Staff ;
        ...
}
So far, this identifier is just an identifier, Lilypond still 
doesn't really know anything about Staff contexts.
Next, the line
\translator{\StaffContext }
tells Lilypond to create a translator (context handler) with its 
contents taken from the identifier (named container of things) 
\StaffContext. Now, Lilypond knows what to do with contexts 
named "Staff".

If you want to have a modified translator that's almost like
the default Staff context, you could use the default definitions
as a starting point since they are stored in the identifier 
\StaffContext.
If you do the change in a single file, just do
\paper{
  ...
  \translator {
    \StaffContext
    <own modifications>
  }
}
Again, a new translator is created taking its definitions
(including the connection to the context name "Staff")
from the identifier \StaffContext. Additionally, it 
includes your own modifications.
If you at some other place have 
  \translator {
    \StaffContext
    <other modifications>
  }
you get a translator which overwrites the previous one
(since it has the same \name) and which again uses the
default definitions in \StaffContext plus your new
modifications, i.e., your previous modifications are
lost.

If you want to make incremental modifications of a 
translator, you simply change the identifier too:
StaffContext = \translator {
    \StaffContext
    <global modifications>
  }
This will redefine the identifier based on its previous definition.
Note that these changes will not be noticed by Lilypond until
you say
\translator{
  \StaffContext
}

I hope this gives a clearer picture of the mechanism and
that you realize why your example should be changed to (untested)

%%%%%%%%%%%%%

\paper {
\translator {
            \VoiceContext
            \name CueVoice;
            basicNoteHeadProperties \push #'font-size = #-1
            basicStemProperties \push #'font-size = #-1
            basicBeamProperties \push #'font-size = #-1
            basicTextScriptProperties \push #'font-size = #-1
            basicSlurProperties \push #'font-size = #-1
            basicLocalKeyProperties \push #'font-size = #-1
        }
StaffContext = \translator{
  \StaffContext
  \accepts CueVoice;
}
\translator{\StaffContext}

...

\score{
  ...
  \paper {
     \translator{
       \StaffContext
       \remove "Time_signature_engraver";
      }
    ...
   }
}
%%%%%%%%%%%%%

If you want, you could use some other identifier for your
modified version of \Staffcontext, e.g., 
MyStaffContext = \translator{...}
\translator{\MyStaffContext}

        /Mats




reply via email to

[Prev in Thread] Current Thread [Next in Thread]