]> git.donarmstrong.com Git - lilypond.git/blob - ly/engraver-init.ly
* scm/define-grobs.scm: uniform naming for definitions and output
[lilypond.git] / ly / engraver-init.ly
1 \version "1.7.3"
2
3 %
4 % setup for Request->Element conversion. Guru-only
5 %
6
7 StaffContext=\translator {
8         \type "Engraver_group_engraver"
9         \name Staff
10
11         \description "Handles clefs, bar lines, keys, accidentals.  It can contain
12 @code{Voice} contexts."
13
14         
15         \consists "Output_property_engraver"    
16         
17         \consists "Bar_engraver"
18  % Bar_engraver must be first so default bars aren't overwritten
19 % with empty ones.
20         \consists "Font_size_engraver"
21
22 %       \consists "Repeat_engraver"
23         \consists "Volta_engraver"
24         \consists "Separating_line_group_engraver"      
25         SeparatingGroupSpanner \override #'spacing-procedure
26           =  #Separating_group_spanner::set_spacing_rods_and_seqs
27         \consists "Dot_column_engraver"
28
29         % perhaps move to Voice context?
30         \consists "Ottava_spanner_engraver"
31         \consists "Clef_engraver"
32         \consists "Key_engraver"
33         \consists "Time_signature_engraver"
34         \consists "Staff_symbol_engraver"
35         \consists "Collision_engraver"
36         \consists "Rest_collision_engraver"
37         \consists "Accidental_engraver"
38         \consists "Piano_pedal_engraver"
39         \consists "Instrument_name_engraver"
40         \consists "Grob_pq_engraver"
41         \consists "Forbid_line_break_engraver"
42         \consistsend "Axis_group_engraver"
43
44         minimumVerticalExtent = #'(-6 . 6)
45         extraVerticalExtent = ##f
46         verticalExtent = ##f 
47         localKeySignature = #'()
48
49         % explicitly set instrument, so we don't get 
50         % weird effects when doing instrument names for
51         % piano staves
52
53         instrument = #'()
54         instr = #'()
55           
56         \accepts "Voice"
57 }
58
59
60 StaffContainerContext = \translator {
61         \type Engraver_group_engraver
62         \consists "Axis_group_engraver"
63         minimumVerticalExtent = ##f
64         extraVerticalExtent = ##f
65         verticalExtent = ##f 
66         localKeySignature = #'()
67
68         \accepts Staff
69         \name StaffContainer
70 }
71
72 InnerChoirStaffContext = \translator {
73         \type "Engraver_group_engraver"
74         \name InnerChoirStaff
75         %% alignmentReference = #0 FIXME
76         \consists "System_start_delimiter_engraver"
77         systemStartDelimiter = #'SystemStartBracket
78         localKeySignature = #'()
79
80         \accepts "Staff"
81         \accepts "RhythmicStaff"
82         \accepts "GrandStaff"
83         \accepts "PianoStaff"
84         \accepts "Lyrics"
85         \accepts "ChordNames"
86 }
87 ChoirStaffContext = \translator {
88         \InnerChoirStaffContext
89         \name ChoirStaff
90         
91         \description "Identical to @code{StaffGroup} except that the
92     contained staves are not connected vertically."
93         
94         \accepts "InnerChoirStaff"
95         \accepts "InnerStaffGroup"
96 }
97
98
99 RhythmicStaffContext=\translator{
100         \type "Engraver_group_engraver"
101         
102         \consists "Output_property_engraver"    
103
104 \description  "
105     A context like @code{Staff} but for printing rhythms.  Pitches are
106     ignored; the notes are printed on one line.  It can contain
107     @code{Voice} contexts.
108 "
109         minimumVerticalExtent = ##f
110         extraVerticalExtent = ##f
111         verticalExtent = ##f 
112         localKeySignature = #'()
113
114         \consists "Pitch_squash_engraver"
115         \consists "Separating_line_group_engraver"      
116         \name RhythmicStaff
117         \alias "Staff"
118         
119         BarLine \override #'bar-size = #4
120         VoltaBracket \override #'minimum-space =  #15  % urg, in \pt
121         VoltaBracket \override #'padding =  #5  % urg, in \pt
122         StaffSymbol \override #'line-count = #1 
123
124         Stem \override #'neutral-direction = #1
125         Beam \override #'neutral-direction = #1         
126 %       \consists "Repeat_engraver"
127         \consists "Dot_column_engraver"
128         \consists "Volta_engraver"
129         \consists "Bar_engraver"
130         \consists "Time_signature_engraver"
131         \consists "Staff_symbol_engraver"
132         \consists "Instrument_name_engraver"
133         \consistsend "Axis_group_engraver"
134         \accepts "Voice"
135 }
136
137
138 VoiceContext = \translator {
139         \type "Engraver_group_engraver"
140         \name Voice
141 \description "
142     Corresponds to a voice on a staff.  This context handles the
143     conversion of dynamic signs, stems, beams, super- and subscripts,
144     slurs, ties, and rests.
145
146     You have to instantiate this explicitly if you want to have
147     multiple voices on the same staff."
148
149         localKeySignature = #'()
150         \consists "Font_size_engraver"
151         
152         % must come before all
153         \consists "Voice_devnull_engraver"
154         \consists "Output_property_engraver"    
155         \consists "Arpeggio_engraver"
156         \consists "Multi_measure_rest_engraver"
157         \consists "Text_spanner_engraver"
158         \consists "Grob_pq_engraver"
159
160         \consists "Ligature_bracket_engraver"
161         \consists "Breathing_sign_engraver"
162         % \consists "Rest_engraver"
163         \consists "Stem_engraver"
164         \consists "Beam_engraver"
165         \consists "Grace_beam_engraver"
166         \consists "Auto_beam_engraver"
167         \consists "New_fingering_engraver"
168         \consists "Chord_tremolo_engraver"
169         \consists "Percent_repeat_engraver"
170         \consists "Melisma_engraver"
171
172 %{
173  Must come before text_engraver, but after note_column engraver.
174
175 %}
176         \consists "Text_engraver"
177         \consists "Dynamic_engraver"
178         \consists "Fingering_engraver"
179
180         \consists "Script_engraver"
181         \consists "Script_column_engraver"
182         \consists "Rhythmic_column_engraver"
183         \consists "Phrasing_slur_engraver"
184         \consists "Cluster_engraver"
185         \consists "Slur_engraver"
186         \consists "Tie_engraver"
187         \consists "New_tie_engraver"
188         \consists "Tuplet_engraver"
189         \consists "A2_engraver"
190
191         \consists "Skip_event_swallow_translator"
192         \accepts Thread % bug if you leave out this!
193 }
194
195 ThreadContext = \translator{
196         \type Engraver_group_engraver
197         \name Thread
198         localKeySignature = #'()
199 \description "
200     Handles note heads, and is contained in the Voice context.  You
201     have to instantiate this explicitly if you want to adjust the
202     style of individual note heads.
203 "
204         \consists "Font_size_engraver"  
205         \consists "Thread_devnull_engraver"
206         \consists "Note_heads_engraver"
207         \consists "Rest_engraver"
208
209         % why here ? 
210         \consists "Note_head_line_engraver"
211         \consists "Output_property_engraver"    
212
213 }
214
215
216
217 GrandStaffContext=\translator{
218         \type "Engraver_group_engraver"
219         \name GrandStaff
220         localKeySignature = #'()
221         \description "
222     Contains @code{Staff} or @code{RhythmicStaff} contexts.  It adds a
223     brace on the left side, grouping the staves together.  The bar
224     lines of the contained staves are connected vertically.  It can
225     contain @code{Staff} contexts."
226
227         \consists "Span_bar_engraver"
228         \consists "Span_arpeggio_engraver"
229         \consists "System_start_delimiter_engraver"
230         systemStartDelimiter = #'SystemStartBrace
231
232         \accepts "Staff"
233 }
234
235 PianoStaffContext = \translator{
236         \GrandStaffContext
237         \name "PianoStaff"
238         \alias "GrandStaff"
239 \description "
240     Just like @code{GrandStaff} but with @code{minVerticalAlign} set
241     equal to @code{maxVerticalAlign} so that interstaff beaming and
242     slurring can be used."
243         verticalAlignmentChildCallback = #Align_interface::fixed_distance_alignment_callback
244         VerticalAlignment \override #'forced-distance = #12
245         VerticalAlignment \override #'self-alignment-Y = #0
246
247         \consists "Vertical_align_engraver"
248         \consists "Instrument_name_engraver"
249         
250         instrument = #'()
251         instr = #'()
252         
253 %       \consistsend "Axis_group_engraver"
254 }
255
256 InnerStaffGroupContext= \translator {
257         \type "Engraver_group_engraver"
258         \name InnerStaffGroup
259         localKeySignature = #'()
260
261         \consists "Span_bar_engraver"
262         \consists "Span_arpeggio_engraver"
263         \consists "Output_property_engraver"    
264         systemStartDelimiter = #'SystemStartBracket
265
266         \consists "System_start_delimiter_engraver"
267         \accepts "Staff"
268         \accepts "RhythmicStaff"
269         \accepts "GrandStaff"
270         \accepts "PianoStaff"
271         \accepts "TabStaff"     
272         \accepts "Lyrics"
273         \accepts "ChordNames"
274 }
275
276 StaffGroupContext = \translator {
277         \InnerStaffGroupContext
278         \name StaffGroup
279         \description "
280     Contains @code{Staff} or @code{RhythmicStaff} contexts.  Adds a
281     bracket on the left side, grouping the staves together.  The bar
282     lines of the contained staves are connected vertically.  It can
283     contain @code{Staff}, @code{RhythmicStaff}, @code{GrandStaff}, or
284     @code{Lyrics} contexts.
285 "
286         
287         \accepts "InnerChoirStaff"
288         \accepts "ChoirStaff"
289         \accepts "InnerStaffGroup"
290         \accepts "FiguredBass"
291 }
292
293
294 % UGH! JUNKME
295 LyricsVoiceContext= \translator{
296         \type "Engraver_group_engraver"
297         \consistsend "Hara_kiri_engraver"
298         minimumVerticalExtent = #'(-1.2 . 1.2)
299         extraVerticalExtent = ##f
300         verticalExtent = ##f
301
302         \description "
303     Corresponds to a voice with lyrics.  Handles the printing of a
304     single line of lyrics.
305 "
306         
307         \name LyricsVoice 
308         \consists "Separating_line_group_engraver"
309         \consists "Lyric_engraver"
310         \consists "Extender_engraver"
311         \consists "Hyphen_engraver"
312         \consists "Stanza_number_engraver"
313         \consists "Skip_event_swallow_translator"
314         phrasingPunctuation = #".,:!?\""
315         
316 }
317 NoteNamesContext = \translator {
318         \type "Engraver_group_engraver"
319         \name NoteNames
320         \consistsend "Axis_group_engraver"
321
322         minimumVerticalExtent = ##f
323         extraVerticalExtent = ##f
324         verticalExtent = ##f 
325
326         
327         \consists "Note_name_engraver"
328         \consists "Separating_line_group_engraver"
329 }
330
331 LyricsContext = \translator {
332         \type "Engraver_group_engraver"
333         \name Lyrics
334         \description  "Typesets lyrics."
335         %% To get folded repeats right.
336         \consists Vertical_align_engraver 
337
338         \consistsend "Hara_kiri_engraver"
339         minimumVerticalExtent = ##f
340         extraVerticalExtent = ##f
341         verticalExtent = ##f 
342         
343         \accepts "LyricsVoice"
344 }
345
346
347 ChordNamesContext = \translator {
348         \type "Engraver_group_engraver"
349         \name ChordNames
350 \description "    Typesets chord names."
351         
352         \consists "Rest_swallow_translator" 
353         \consists "Output_property_engraver"    
354         \consists "Separating_line_group_engraver"
355         \consists "Chord_name_engraver"
356         \consists "Skip_event_swallow_translator"
357         \consistsend "Hara_kiri_engraver"
358         minimumVerticalExtent = #'(0 . 2.5)
359         extraVerticalExtent = ##f
360         verticalExtent = ##f 
361 }
362
363
364 HaraKiriStaffContext = \translator {
365         \StaffContext
366         \remove "Axis_group_engraver"
367         \consistsend "Hara_kiri_engraver"
368         \consists "Instrument_name_engraver"
369         \accepts "Voice"
370
371         % hara kiri & auto knee don't work together.
372         Beam \override #'auto-knee-gap = #'()
373 }
374
375 %{
376   The HaraKiriStaffContexts doesn't override \name,
377   so it is still named `Staff'.
378
379   %\translator { \HaraKiriStaffContext }
380 %}
381
382
383
384
385 ScoreContext = \translator {
386         \type Score_engraver
387         \name Score
388         localKeySignature = #'()
389
390         \description "This is the top level notation context.  No
391     other context can contain a @code{Score} context.  This context
392     handles the administration of time signatures.  It also makes sure
393     that items such as clefs, time signatures, and key-signatures are
394     aligned across staves.  It can contain @code{Lyrics},
395     @code{Staff}, @code{RhythmicStaff}, @code{GrandStaff},
396     @code{StaffGroup}, and @code{ChoirStaff} contexts.
397
398     You cannot explicitly instantiate a Score context (since it is
399     not contained in any other context).  It is instantiated
400     automatically when an output definition (a @code{\score} or
401     @code{\paper} block) is processed."
402         
403         \consists "Repeat_acknowledge_engraver"
404         \consists "Staff_collecting_engraver"
405
406         % move the alias along with the engraver.
407
408         %% TODO? add this alias from Timing_engraver::initialize() ? 
409         \consists "Timing_engraver"
410         \alias "Timing"
411         
412         \consists "Output_property_engraver"
413         \consists "System_start_delimiter_engraver"
414         \consists "Mark_engraver"       
415         \consists "Metronome_mark_engraver"     
416         \consists "Break_align_engraver"
417         \consists "Spacing_engraver"
418         \consists "Vertical_align_engraver"
419         \consists "Lyric_phrasing_engraver"
420         \consists "Bar_number_engraver"
421         \consists "Span_arpeggio_engraver"
422
423         \accepts "Staff"
424         \accepts "TabStaff"
425         \accepts "StaffContainer"
426         \accepts "StaffGroup"
427         \accepts "RhythmicStaff"        
428         \accepts "Lyrics"
429         \accepts "ChordNames"
430         \accepts "GrandStaff"
431         \accepts "ChoirStaff"
432         \accepts "PianoStaff"
433         \accepts "NoteNames"
434         \accepts "FiguredBass"  
435
436         soloText = #"Solo"
437         soloIIText = #"Solo II"
438         aDueText = #"a2"
439         soloADue = ##t
440         splitInterval = #'(0 . 1)
441         changeMoment = #`(,(ly:make-moment 0 0) . ,(ly:make-moment 1 512))
442         systemStartDelimiter =#'SystemStartBar
443
444
445         clefGlyph = #"clefs-G"
446         clefPosition = #-2
447         centralCPosition = #-6
448         
449         automaticPhrasing = ##t
450         automaticMelismata = ##t
451         
452         defaultBarType = #"|"
453         barNumberVisibility = #default-bar-number-visibility
454
455         explicitClefVisibility = #all-visible
456         explicitKeySignatureVisibility = #all-visible
457         autoBeamSettings = #default-auto-beam-settings
458         autoBeaming = ##t
459         scriptDefinitions = #default-script-alist
460
461         verticalAlignmentChildCallback = #Align_interface::alignment_callback
462
463         pedalSustainStrings = #'("Ped." "*Ped." "*")
464         pedalUnaCordaStrings = #'("una corda" "" "tre corde")
465
466         %% These are in ordinary italic font, including the *,
467         %% but they are unlikely to be used, 
468         %% as the default pedal-style for SostenutoPedal is 'mixed':
469         %% i.e.  Sost. Ped_____________________ 
470         pedalSostenutoStrings = #'("Sost. Ped." "*Sost. Ped." "*") 
471
472         tupletNumberFormatFunction = #denominator-tuplet-formatter
473         
474         subdivideBeams = ##f
475         extraNatural = ##t
476         autoAccidentals = #'(Staff (same-octave . 0))
477         autoCautionaries = #'()  
478
479        keyAccidentalOrder = #'(
480          (6 . -1) (2  . -1) (5 . -1 ) (1  . -1) (4  . -1) (0  . -1) (3  . -1)
481          (3  . 1) (0 . 1) (4 . 1) (1 . 1) (5 . 1) (2 . 1) (6 . 1)
482          (6 . -2) (2  . -2) (5 . -2 ) (1  . -2) (4  . -2) (0  . -2) (3 . -2)
483          (3  . 2) (0 . 2) (4 . 2) (2 . 2) (5 . 2) (2 . 2) (6 . 2)
484         )
485         breakAlignOrder = #'(
486           instrument-name
487           left-edge
488           ambitus
489           span-bar
490           breathing-sign
491           clef
492           key-signature
493           staff-bar
494           time-signature
495           custos
496         )
497         barCheckSynchronize = ##t
498
499         %% chord names:
500         chordNameFunction = #ignatzek-chord-names
501         majorSevenSymbol = #whiteTriangleMarkup
502         chordNameSeparator = #(make-simple-markup  "/")
503         chordNameExceptions = #ignatzekExceptions
504         chordNoteNamer = #'()
505         chordRootNamer = #note-name->markup
506         
507         %% tablature:
508         stringOneTopmost = ##t
509         highStringOne = ##t
510
511         %% One may change the strings tuning as following :
512         %% The lenght of the list must be equal to the number of string
513         stringTunings   = #guitar-tunings
514         tablatureFormat = #fret-number-tablature-format
515
516         %%
517         bassFigureFormatFunction = #make-bass-figure-markup
518         metronomeMarkFormatter = #make-metronome-markup
519
520         \grobdescriptions #all-grob-descriptions
521 }
522
523 OrchestralScoreContext= \translator {
524         \ScoreContext
525 }
526
527 EasyNotation =  \translator {
528         \ScoreContext
529         NoteHead \override #'molecule-callback = #Note_head::brew_ez_molecule
530 }
531
532
533
534 FiguredBassContext = \translator {
535         \type "Engraver_group_engraver"
536         \name FiguredBass 
537         \consists "Figured_bass_engraver"
538         \consists "Rest_swallow_translator"
539         \consists "Note_swallow_translator"
540         \consists "Separating_line_group_engraver"
541         
542         \consistsend "Hara_kiri_engraver"
543 }
544
545 TabVoiceContext =   \translator {
546       \VoiceContext
547       \name "TabVoice"
548       \denies "Thread"
549       \consists "Tab_note_heads_engraver"
550
551       Slur \override #'font-family       = #'roman
552       Slur \override #'molecule-callback = #hammer-molecule-callback
553       Slur \override #'direction    = #-1
554
555       % Draws all stems/beams out of the staff (and not in the middle of the staff !)
556       % This feature is now disabled because most of the tab does not use it.
557       %Beam \override #'damping = #100000
558       %Stem \override #'up-to-staff = ##t
559
560       % No accidental in tablature !
561       \remove Accidental_engraver
562 }
563
564 TabStaffContext = \translator {
565       \StaffContext
566       \alias "Staff"
567       \name "TabStaff"
568       \denies "Voice"
569
570       \description "Context for generating tablature. [DOCME]"
571       
572       \accepts "TabVoice"
573       
574       % 6 strings
575       StaffSymbol \override #'line-count  = #6
576       StaffSymbol \override #'staff-space = #1.5
577
578      % Don't draw stems over the tablature figures !
579       Stem \override #'avoid-note-head = ##t
580       
581       % No accidental in tablature !
582       \remove Accidental_engraver
583       \remove Key_engraver
584
585       % Special "TAB" clef
586       clefGlyph = #"clefs-tab"
587       clefPosition = #0
588 }
589