]> git.donarmstrong.com Git - lilypond.git/blob - scm/define-context-properties.scm
add support for
[lilypond.git] / scm / define-context-properties.scm
1 ;;;; define-context-properties.scm -- part of backend documentation
2 ;;;;
3 ;;;;  source file of the GNU LilyPond music typesetter
4 ;;;; 
5 ;;;; (c) 1998--2006  Han-Wen Nienhuys <hanwen@cs.uu.nl>
6 ;;;;                  Jan Nieuwenhuizen <janneke@gnu.org>
7
8
9 (define-public all-translation-properties '())
10
11 (define (translator-property-description symbol type? description)
12  (if (not (equal? #f (object-property symbol 'translation-doc)))
13      (ly:error (_ "symbol ~S redefined" symbol)))
14   
15   (set-object-property! symbol 'translation-type? type?)
16   (set-object-property! symbol 'translation-doc description)
17   (set! all-translation-properties (cons symbol all-translation-properties))
18   symbol)
19
20 (define-public all-user-translation-properties
21   (map
22    (lambda (x)
23      (apply translator-property-description x))
24    `(
25
26      ;; TODO FIXME
27    
28      (aDueText ,string? "Text to print at a unisono passage.")
29      (alignBelowContext ,string? "Where to insert newly created context in vertiical alignment.")
30      (alignAboveContext ,string? "Where to insert newly created context in vertiical alignment.")
31      (alignBassFigureAccidentals ,boolean?
32                                  "If true, then the accidentals are aligned in bass figure context.")
33
34      (allowBeamBreak ,boolean? "If true allow line breaks for beams over bar lines.")
35      (associatedVoice ,string? "Name of the
36 @code{Voice} that has the melody for this @code{Lyrics} line.")
37      (autoBeamSettings ,list? "Specifies
38 when automatically generated beams should begin and end.
39 See @usermanref{Setting automatic beam behavior} for more information.
40 ")
41      (autoAccidentals ,list? "List of
42 different ways to typeset an accidental.
43
44 For determining when to print an accidental, several different rules
45 are tried.  The rule that gives the highest number of accidentals is
46 used.  Each rule consists of
47
48 @table @var
49
50 @item context:
51       In which context is the rule applied. For example, if
52 @var{context} is @internalsref{Score} then all staves share
53 accidentals, and if @var{context} is @internalsref{Staff} then all
54 voices in the same staff share accidentals, but staves do not.
55
56 @item octavation:
57       Whether the accidental changes all octaves or only the current
58       octave. Valid choices are 
59
60      @table @samp
61       @item same-octave:
62       This is the default algorithm. Accidentals are typeset if the note changes
63       the accidental of that note in that octave. Accidentals lasts to the end of the measure 
64       and then as many measures as specified in the value. I.e. 1 means to the end
65       of next measure, -1 means to the end of previous measure (that is: no duration at all), etc. #t means forever.
66       @item any-octave:
67       Accidentals are typeset if the note is different from 
68       the previous note on the same pitch in any octave. The value has same meaning as in
69       same-octave.
70       @end table
71
72 @item laziness
73
74 Over how many bar lines the accidental lasts.
75 If @var{laziness} is @code{-1} then the accidental is forgotten
76 immediately, and if @var{laziness} is @code{#t} then the accidental
77 lasts forever.
78 @end table
79 ")
80      (autoBeamCheck ,procedure? "Procedure taking three
81 arguments, CONTEXT, DIR start/stop (-1 or 1) and TEST shortest
82 note in the beam.  A non-#f return value starts or stops the auto beam.")
83      (autoBeaming ,boolean? "If set to true then beams are generated
84 automatically.")
85
86      (autoCautionaries ,list? "List similar to
87 @code{autoAccidentals}, but it controls cautionary accidentals rather than
88 normal ones. Both lists are tried, and the one giving the most accidentals
89 wins. In case of draw, a normal accidental is typeset.
90 ")
91      (automaticBars ,boolean? " If set to true then bar lines will not be
92 printed automatically; they must be explicitly created with
93 @code{\\bar} command.  Unlike the @code{\\cadenza} keyword, measures
94 are still counted.  Bar generation will resume according to that count
95 if this property is unset.
96 ")
97      
98      (barAlways ,boolean? "If set to true a bar line is drawn after each
99 note.")
100
101      (barCheckSynchronize ,boolean? "If true then reset @code{measurePosition}
102 when finding a barcheck.")
103
104      (barNumberAlignSymbol ,symbol? "Which break-align-symbol to align the bar number with.")
105      (barNumberVisibility ,procedure? "Procedure that takes an int and
106 returns whether the corresponding bar number should be printed")
107      (bassStaffProperties ,list? "Alist of property settings to apply
108 for the down staff of PianoStaff. Used by @code{\\autochange}")
109      (trebleStaffProperties ,list? "Alist of property settings to apply
110 for the up staff of PianoStaff. Used by @code{\\autochange}")
111
112      (figuredBassFormatter ,procedure? "Routine generating a markup
113 for a bass figure.")
114      (bassFigureFormatFunction ,procedure? "Procedure that is called
115 to produce the formatting for a @code{BassFigure} grob. It takes a
116 list of @code{BassFigureEvent}s, a context, and the grob to format.")
117      
118      (beatLength ,ly:moment? "The length of one beat in this time signature.")
119      (beatGrouping ,list?
120                    "List of beatgroups, e.g., in 5/8 time @code{'(2
121 3)}.")
122
123
124
125      (middleCPosition ,number? "Place of the middle C, measured in half
126 staff-spaces.  Usually determined by looking at @code{clefPosition} and
127 @code{clefGlyph}.")
128
129      (chordNameFunction ,procedure?
130                         "The function that converts lists of pitches to chord names.")
131      (chordNoteNamer ,procedure?
132                      "Function that converts from a pitch object to a text markup. Used for single pitches.")
133      (chordRootNamer ,procedure?
134                      "Function that converts from a pitch object to a text markup. Used for chords.")
135      (chordNameExceptions ,list?
136                           "An alist of chord exceptions.
137 Contains (@var{chord} . @var{markup}) entries.")
138      (chordNameExceptionsFull ,list?
139                               "An alist of chord exceptions.
140 Contains (@var{chord} . @var{markup}) entries.")
141      (chordNameExceptionsPartial
142       ,list?
143       "An alist of partial chord exceptions. Contains (@var{chord} . (@var{prefix-markup} @var{suffix-markup})) entries.")
144      
145      (chordNameSeparator ,markup?
146                          "The markup object used to separate
147  parts of a chord name.")
148      (chordPrefixSpacer ,number?
149                         "The space added between the root symbol and the prefix
150  of a chord name")
151      (chordChanges ,boolean? "Only show changes in chords scheme?")
152      (clefGlyph ,string? "Name of the symbol within the music font.")
153      (clefOctavation ,integer? "Add
154 this much extra octavation. Values of 7 and -7 are common.")
155
156      (clefPosition ,number? "Where should the center of the clef
157 symbol go, measured in half staff spaces from the center of the staff.")
158
159      (connectArpeggios ,boolean? " If set, connect arpeggios across
160 piano staff.")
161      (countPercentRepeats ,boolean? "If set, produce counters for
162 percent repeats. ")
163      (createKeyOnClefChange ,boolean? "Print a key signature whenever the clef is changed.")
164      (createSpacing ,boolean? "Create @code{StaffSpacing} objects?
165 Should be set for staves.")
166      (crescendoText ,markup? "Text to print at start of non-hairpin crescendo, i.e.: @samp{cresc.}")
167      (crescendoSpanner ,symbol? "Type of spanner to be used for crescendi.
168 One of: @samp{hairpin}, @samp{line}, @samp{dashed-line},
169 @samp{dotted-line}.  If unset, hairpin type is used.")
170      (decrescendoText ,markup? "Text to print at start of non-hairpin decrescendo, i.e.: @samp{dim.}")
171
172      (drumPitchTable ,hash-table? "A table mapping percussion
173 instruments (symbols) to pitches.")
174
175      (drumStyleTable ,hash-table? "A hash table containing mapping
176 drums to layout settings.  Predefined values: @samp{drums-style},
177 @samp{timbales-style}, @samp{congas-style}, @samp{bongos-style} and
178 @samp{percussion-style}.
179
180 The layout style is a hash table, containing the drum-pitches (e.g. the
181 symbol @samp{hihat}) as key, and a list (@var{notehead-style}
182 @var{script} @var{vertical-position}) as values.
183  ")
184      (currentBarNumber ,integer? "Contains the current barnumber. This property is incremented at
185 every bar line.
186 ")
187      (defaultBarType ,string? "Sets the default type of bar line.
188 See @code{whichBar} for information on available bar types.
189
190 This variable is  read by @internalsref{Timing_translator} at
191 @internalsref{Score} level.
192 ")
193
194      (decrescendoSpanner ,symbol? "See @code{crescendoSpanner}.")
195      (doubleSlurs ,boolean?
196                   "When set, two slurs are created for every slurred
197 note, one above and one below the chord.")
198      (explicitClefVisibility ,vector? "@samp{break-visibility} function for clef changes.")
199
200      (explicitKeySignatureVisibility ,vector?
201 "@samp{break-visibility} function for explicit key
202 changes. @samp{\\override} of the @code{break-visibility} property will set the
203 visibility for normal (i.e. at the start of the line) key signatures.")
204
205      (extraNatural ,boolean? "Whether to typeset an
206 extra natural sign before accidentals changing from a non-natural to 
207 another non-natural.")
208
209      (extraVerticalExtent ,number-pair?
210                           "extra vertical extent, same format as @var{minimumVerticalExtent}")
211
212
213      (figuredBassCenterContinuations ,boolean? "Whether to vertically center pairs of extender lines.")
214      (figuredBassPlusDirection ,ly:dir? "Where to put plus signs relative to the the main figure.")
215      
216      (figuredBassAlterationDirection ,ly:dir? "Where to put
217 alterations relative to the main figure.")
218      (followVoice ,boolean? "If set, note heads are tracked across staff
219 switches by a thin line")
220
221      (fontSize ,number?
222                "The relative size of all grobs in a context. ")
223
224      (fingeringOrientations ,list?
225                             "List of symbols, containing
226 @samp{left}, @samp{right}, @samp{up} and/or @samp{down}. This list
227 determines where fingerings are put relative to the chord being
228 fingered.")
229
230      (firstClef ,boolean? "If true, create a new clef when starting a
231 staff.")
232      (forceClef ,boolean? "Show clef symbol, even if it has not
233 changed. Only active for the first clef after the property is set, not
234 for the full staff.")
235      (gridInterval ,ly:moment?
236                    "Interval for which to generate @ref{GridPoint}s")
237
238      (harmonicAccidentals ,boolean? "If set, harmonic notes in chords
239 get accidentals.")
240      (highStringOne ,boolean? "Whether the 1st string is the string with
241 highest pitch on the instrument. This used by the automatic string
242 selector for tab notation.")
243
244      (ignoreBarChecks ,boolean? "Ignore bar checks")
245      (ignoreMelismata ,boolean? "Ignore melismata for this @internalsref{Lyrics} line.")
246
247      (implicitBassFigures ,list? "List of bass figures that are not
248 printed as numbers, but only as extender lines.")
249      
250      (instr ,markup? "See @code{instrument}")
251
252      (instrument ,markup? "The name to print left of a staff.  The
253 @code{instrument} property labels the staff in the first system, and
254 the @code{instr} property labels following lines.")
255      (instrumentEqualizer ,procedure? "
256 Function taking a string (instrument name), and returning a (@var{min} . @var{max}) pair of numbers for the loudness range of the instrument.
257 ")
258      (instrumentTransposition ,ly:pitch? "Defines the transposition of
259 the instrument. Its value is the pitch that sounds like middle C. This
260 is used to transpose the MIDI output, and @code{\\quote}s.")
261
262      (keepAliveInterfaces ,list? "List of symbols, signifying grob interfaces that
263 are worth keeping an staff with @code{remove-empty} set around for.")   
264      (keyAlterationOrder ,list? " Alist that defines in what order
265 alterations should be printed.  The format is (@var{step}
266 . @var{alter}), where @var{step} is from 0 .. 6 and @var{alter} from
267 -2 (sharp) and 2 (flat).
268 ")
269
270      (keySignature ,list? "The current key signature. This is an alist
271 containing (@var{name} . @var{alter}) or ((@var{octave} . @var{name}) . @var{alter}).
272  where @var{name} is from 0.. 6 and
273 @var{alter} from -4 (double flat) to 4 (double sharp).
274 ")
275      (majorSevenSymbol ,markup? "How should
276 the major 7th be formatted in a chord name?")
277      (markFormatter ,procedure? "Procedure
278 taking as arguments context and rehearsal mark. It should return the
279 formatted mark as a markup object.")
280
281      (measureLength ,ly:moment? "Length of one
282 measure in the current time signature.")
283
284      (measurePosition ,ly:moment? "How much of the current measure
285 have we had.  This can be set manually to create incomplete
286 measures.")
287
288      (melismaBusyProperties ,list? "List of properties (symbols) to
289 determine whether a melisma is playing.  Setting this property will
290 influence how lyrics are aligned to notes.  For example, if set to
291 @code{#'(melismaBusy beamMelismaBusy)}, only manual melismata and
292 manual beams are considered. Possible values include
293 @code{melismaBusy}, @code{slurMelismaBusy}, @code{tieMelismaBusy}, and
294 @code{beamMelismaBusy}")
295
296
297      (metronomeMarkFormatter ,procedure? "How to produce a metronome
298 markup.  Called with 2 arguments, event and context.")
299      (midiInstrument ,string? "Name of the MIDI instrument to use ")
300      (midiMinimumVolume ,number? "Sets the minimum loudness for MIDI. Ranges from 0 to 1.")
301      (midiMaximumVolume ,number? "Analogous to @code{midiMinimumVolume}.")
302      (minimumFret ,number? "The tablature auto string-selecting mechanism
303 selects the highest string with a fret at least @code{minimumFret}")
304      (minimumVerticalExtent ,number-pair? "minimum vertical extent, same
305 format as @var{verticalExtent}")
306      (ottavation ,string? "If set, the text for an ottava spanner. Changing
307 this creates a new text spanner. ")
308      (pedalSustainStrings ,list? "List of string to print for
309 sustain-pedal. Format is (@var{up} @var{updown} @var{down}), where
310 each of the three is the string to print when this is done with the
311 pedal.")
312      (pedalUnaCordaStrings ,list? "See @code{pedalSustainStrings}.")
313      (pedalSostenutoStrings ,list? "See @code{pedalSustainStrings}.")
314      (pedalSustainStyle ,symbol? "A symbol that indicates how to print
315 sustain pedals: @code{text}, @code{bracket} or @code{mixed} (both).")
316      (pedalUnaCordaStyle ,symbol? "see @code{pedalSustainStyle}.")
317      (pedalSostenutoStyle ,symbol? "see @code{pedalSustainStyle}.")
318      (printKeyCancellation ,boolean? "Print restoration alterations before a key signature change. ")
319      (printPartCombineTexts ,boolean? "set Solo/A due texts in the part combiner?")
320      (printOctaveNames ,boolean? "Print octave marks for the NoteNames context.")
321
322      (proportionalNotationDuration ,ly:moment? "Global override for
323 shortest-playing duration. This is used for switching on proportional
324 notation.")
325      (recordEventSequence ,procedure? "When Recording_group_engraver
326 is in this context, then upon termination of the context, this
327 function is called with current context and a list of music objects.
328 The list of contains entries with start times, music objects and
329 whether they are processed in this context.")
330
331      (rehearsalMark ,integer? "The last rehearsal mark printed.")
332      (rehearsalMarkAlignSymbol ,symbol? "Which @code{break-align-symbol} to put the mark on?  Example values:  @code{clef}, @code{key-signature}.")
333      
334      (repeatCommands ,list? "This property is read to find any command of the form @code{(volta . @var{x})}, where @var{x} is a string or @code{#f}")
335      (restNumberThreshold ,number?
336                           "If a multimeasure rest has more measures
337 than this, a number is printed. ")
338      (shapeNoteStyles ,vector? "Vector of symbols, listing style for each note
339 head relative to the tonic (qv.) of the scale.")
340      (skipBars ,boolean? "If set to true, then
341 skip the empty bars that are produced by multimeasure notes and rests.
342 These bars will not appear on the printed output.  If not set (the
343 default) multimeasure notes and rests expand into their full length,
344 printing the appropriate number of empty bars so that synchronization
345 with other voices is preserved.
346
347
348 @example
349 @@lilypond[fragment,verbatim,center]
350 r1 r1*3 R1*3 \\\\property Score.skipBars= ##t r1*3 R1*3
351 @@end lilypond
352 @end example
353 ")
354      (skipTypesetting ,boolean?
355                       "When true, all no typesetting is done, speeding
356 up the interpretation phase. This speeds up debugging large scores.")
357      (soloIIText ,string? "text for begin of solo for voice ``two'' when part-combining.")
358      (soloText ,string? "text for begin of solo when part-combining.")
359      (squashedPosition ,integer? " Vertical position of
360 squashing for @internalsref{Pitch_squash_engraver}.")
361
362      (stringNumberOrientations ,list? "See @code{fingeringOrientations}")
363      (stringOneTopmost ,boolean? "Whether the 1st string is printed on the
364 top line of the tablature.")
365
366      (stanza ,markup? "Stanza `number' to print before the start of a
367 verse. Use in Lyrics context.")
368
369      (stemLeftBeamCount ,integer? " Specify the number of beams to draw on
370 the left side of the next note.  Overrides automatic beaming.  The
371 value is only used once, and then it is erased.")
372
373      (stemRightBeamCount ,integer? "See @code{stemLeftBeamCount}.")
374
375      (stringTunings ,list? "The tablature strings tuning. It is a list
376 of the pitch (in semitones) of each string (starting with the lower
377 one).")
378
379      (subdivideBeams ,boolean? "If set, multiple beams will be subdivided
380 at beat positions by only drawing one beam over the beat.")
381      (suggestAccidentals ,boolean? "If set, accidentals are typeset as cautionary suggestions over the note.")
382
383      (systemStartDelimiterHierarchy ,pair? "A nested list, indicating the nesting of a start delimiters.") 
384
385      (systemStartDelimiter ,symbol? "Which grob to make for the start of
386 the system/staff? Set to @code{SystemStartBrace},
387 @code{SystemStartBracket} or @code{SystemStartBar}.")
388
389      (tablatureFormat ,procedure? "Function formatting a tab note head; it
390 takes a string number, a list of string tunings and Pitch object. It
391 returns the text as a string.")
392
393      (tieWaitForNote ,boolean? "If true, tied notes do not have to follow each other directly.
394 This can be used for writing out arpeggios")
395      (timeSignatureFraction ,number-pair?
396                             "pair of numbers, signifying the time
397 signature. For example @code{#'(4 . 4)} is a 4/4 time signature.")
398
399      (timing ,boolean? " Keep administration of measure length, position, bar number, etc?
400 Switch off for cadenzas.")
401      (tonic ,ly:pitch?
402             "The tonic of the current scale")
403
404      (tremoloFlags ,integer? "Number of tremolo flags to add if no
405 number is specified.")
406
407      (tupletFullLength ,boolean? "If set, the tuplet is printed upto
408 the start of the next note.")
409      (tupletNumberFormatFunction
410       ,procedure?
411       "Function taking a music as input, producing a string. This function
412 is called to determine the text to print on a tuplet bracket.")
413
414      (tupletSpannerDuration ,ly:moment? "
415 Normally a tuplet bracket is as wide as the
416 @code{\\times} expression that gave rise to it.  By setting this
417 property, you can make brackets last shorter.  Example
418
419 @example
420 @@lilypond[verbatim,fragment]
421 context Voice \\times 2/3 @{
422   property Voice.tupletSpannerDuration = #(ly:make-moment 1 4)
423   c-[8 c c-] c-[ c c-]
424 @}
425 @@end lilypond
426 @end example
427 .")
428
429      (useBassFigureExtenders ,boolean? "Whether to use extender lines
430 for repeated bass figures")
431
432      (verticalExtent ,number-pair? "Hard coded vertical extent.  The format
433 is a pair of dimensions, for example, this sets the sizes of a staff
434 to 10 (5+5) staff-spaces high.
435
436 @example
437 \\set Staff.verticalExtent = #'(-5.0 . 5.0)
438 @end example
439
440
441 This does not work for Voice or any other context that doesn't form a
442 vertical group.")
443      
444      (verticallySpacedContexts ,list? "List of symbols, containing
445 context names whose vertical axis groups should be taken into account for
446 vertical spacing of systems.")
447      
448      (vocalName ,markup? "Name of a vocal line.")
449      (vocNam ,markup? "Name of a vocal line, short version.")
450
451      (voltaOnThisStaff ,boolean?
452                        "Normally, volta brackets are put only on the
453 topmost staff.  This variable overrides this behavior, when set to
454 @code{#t} or @code{#f}.")
455
456      (voltaSpannerDuration ,ly:moment? "This specifies the maximum duration
457 to use for the brackets printed for @code{\\alternative}.  This can be
458 used to shrink the length of brackets in the situation where one
459 alternative is very large.")
460
461      (whichBar
462       ,string?
463       "This property is read to determine what type of bar line to create.
464
465 Example:
466 @example
467 \\set Staff.whichBar = \"|:\"
468 @end example
469
470 This will create a start-repeat bar in this staff only.
471 Valid values are described in @internalsref{bar-line-interface}.
472 ")
473      )))
474
475 (define-public all-internal-translation-properties
476   (map
477    (lambda (x)
478      (set-object-property! (car x) 'internal-translation #t)
479      (apply translator-property-description x)
480
481      )
482
483    `((slurMelismaBusy ,boolean? "Signal if a slur is present.")
484      (originalCentralCPosition
485       ,integer?
486       "Used for temporary overriding middle C in octavation brackets. ")
487      (melismaBusy ,boolean? "Signifies
488 whether a melisma is active. This can be used to signal melismas on
489 top of those automatically detected. ")
490      (graceSettings ,list?
491                     "Overrides for grace notes. This property should
492 be manipulated through the @code{add-grace-property} function.")
493      (currentCommandColumn ,ly:grob? "Grob that is X-parent to all
494 current breakable (clef, key signature, etc.) items.")
495      (currentMusicalColumn ,ly:grob? "Grob that is X-parent to all
496 non-breakable items (note heads, lyrics, etc.).")
497      (breakableSeparationItem ,ly:grob?
498                               "The breakable items in this time step,
499 for this staff.")
500
501      (localKeySignature ,list? "the key signature at this point in the
502 measure.  The format is the same as for keySignature, but can also
503 contain ((@var{octave} . @var{name}) . (@var{alter} . @var{barnumber}))
504 pairs. It is reset at every bar line.")
505
506      
507      (localKeySignatureChanges ,list? "Experimental. [DOCME]")
508
509      (finalizations ,list? "List of expressions to evaluate before proceeding to next time step. Internal variable.")
510      (busyGrobs ,list? "a queue of (@var{end-moment} . @var{GROB})
511 conses. This is for internal (C++) use only.  This property contains
512 the grobs which are still busy (e.g. note heads, spanners, etc.)
513 ")
514      (barCheckLastFail ,ly:moment? "Where in the measure did the last barcheck fail?") 
515      (associatedVoiceContext ,ly:context? "The context object of the Voice that has the melody for this Lyrics.")
516      (beamMelismaBusy ,boolean? "Signal if a beam is present.")
517      (dynamicAbsoluteVolumeFunction ,procedure? "[DOCUMENT-ME]")
518
519      (lastKeySignature ,list? "Last key signature before a key
520 signature change.")
521      (rootSystem ,ly:grob? "The System object")
522      (scriptDefinitions ,list? "Description of scripts. This is used by
523 Script_engraver for typesetting note-super/subscripts. See
524 @file{scm/script.scm} for more information
525 ")
526      (quotedEventTypes ,list? "List of symbols, representing the
527 event types that should be duplicated for @code{\\quote} commands.")
528
529 ;     (quotes ,hash-table? "Hash table, mapping names to music-event vectors.")
530      (stavesFound ,grob-list? "list of all staff-symbols found.")
531      (instrumentSupport ,grob-list? "list of grobs to attach instrument name
532 to.")
533      (tieMelismaBusy ,boolean? "Signal whether a tie is present.")
534      )))
535
536 (define-public all-translation-properties
537   (append all-user-translation-properties
538           all-internal-translation-properties))
539
540 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
541
542 (define-public default-melisma-properties '(melismaBusy slurMelismaBusy tieMelismaBusy beamMelismaBusy))