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