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