]> git.donarmstrong.com Git - lilypond.git/blob - ly/engraver-init.ly
72066fe251419141de86e400e95595de9892f75a
[lilypond.git] / ly / engraver-init.ly
1 \version "1.7.18"
2
3
4
5 %
6 % setup for Request->Element conversion. Guru-only
7 %
8
9 StaffContext=\translator {
10         \type "Engraver_group_engraver"
11         \name Staff
12
13         \description "Handles clefs, bar lines, keys, accidentals.  It can contain
14 @code{Voice} contexts."
15
16         
17         \consists "Output_property_engraver"    
18         
19         \consists "Bar_engraver"
20  % Bar_engraver must be first so default bars aren't overwritten
21 % with empty ones.
22         \consists "Font_size_engraver"
23
24 %       \consists "Repeat_engraver"
25         \consists "Volta_engraver"
26         \consists "Separating_line_group_engraver"      
27         SeparatingGroupSpanner \override #'spacing-procedure
28           =  #Separating_group_spanner::set_spacing_rods_and_seqs
29         \consists "Dot_column_engraver"
30
31         % perhaps move to Voice context?
32         \consists "Ottava_spanner_engraver"
33         \consists "Clef_engraver"
34         \consists "Key_engraver"
35         \consists "Time_signature_engraver"
36         \consists "Staff_symbol_engraver"
37         \consists "Collision_engraver"
38         \consists "Rest_collision_engraver"
39         \consists "Accidental_engraver"
40         \consists "Piano_pedal_engraver"
41         \consists "Instrument_name_engraver"
42         \consists "Grob_pq_engraver"
43         \consists "Forbid_line_break_engraver"
44         \consistsend "Axis_group_engraver"
45
46         minimumVerticalExtent = #'(-6 . 6)
47         extraVerticalExtent = ##f
48         verticalExtent = ##f 
49         localKeySignature = #'()
50
51         % explicitly set instrument, so we don't get 
52         % weird effects when doing instrument names for
53         % piano staves
54
55         instrument = #'()
56         instr = #'()
57           
58         \accepts "Voice"
59 }
60
61
62 StaffContainerContext = \translator {
63         \type Engraver_group_engraver
64         \consists "Axis_group_engraver"
65         minimumVerticalExtent = ##f
66         extraVerticalExtent = ##f
67         verticalExtent = ##f 
68         localKeySignature = #'()
69
70         \accepts Staff
71         \name StaffContainer
72 }
73
74 InnerChoirStaffContext = \translator {
75         \type "Engraver_group_engraver"
76         \name InnerChoirStaff
77         \consists "System_start_delimiter_engraver"
78         systemStartDelimiter = #'SystemStartBracket
79         localKeySignature = #'()
80
81         \accepts "Staff"
82         \accepts "RhythmicStaff"
83         \accepts "GrandStaff"
84         \accepts "PianoStaff"
85         \accepts "Lyrics"
86         \accepts "ChordNames"
87 }
88
89 ChoirStaffContext = \translator {
90         \InnerChoirStaffContext
91         \name ChoirStaff
92         
93         \description "Identical to @code{StaffGroup} except that the
94     contained staves are not connected vertically."
95         
96         \accepts "InnerChoirStaff"
97         \accepts "InnerStaffGroup"
98 }
99
100
101 RhythmicStaffContext=\translator{
102         \type "Engraver_group_engraver"
103         
104         \consists "Output_property_engraver"    
105
106 \description  "
107     A context like @code{Staff} but for printing rhythms.  Pitches are
108     ignored; the notes are printed on one line.  
109 "
110         minimumVerticalExtent = ##f
111         extraVerticalExtent = ##f
112         verticalExtent = ##f 
113         localKeySignature = #'()
114
115         \consists "Pitch_squash_engraver"
116         \consists "Separating_line_group_engraver"      
117         \name RhythmicStaff
118         \alias "Staff"
119         
120         BarLine \override #'bar-size = #4
121         VoltaBracket \override #'minimum-space =  #15  % urg, in \pt
122         VoltaBracket \override #'padding =  #5  % urg, in \pt
123         StaffSymbol \override #'line-count = #1 
124
125         Stem \override #'neutral-direction = #1
126         Beam \override #'neutral-direction = #1         
127 %       \consists "Repeat_engraver"
128         \consists "Dot_column_engraver"
129         \consists "Volta_engraver"
130         \consists "Bar_engraver"
131         \consists "Time_signature_engraver"
132         \consists "Staff_symbol_engraver"
133         \consists "Instrument_name_engraver"
134         \consistsend "Axis_group_engraver"
135         \accepts "Voice"
136 }
137
138
139 VoiceContext = \translator {
140         \type "Engraver_group_engraver"
141         \name Voice
142 \description "
143     Corresponds to a voice on a staff.  This context handles the
144     conversion of dynamic signs, stems, beams, super- and subscripts,
145     slurs, ties, and rests.
146
147     You have to instantiate this explicitly if you want to have
148     multiple voices on the same staff."
149
150         localKeySignature = #'()
151         \consists "Font_size_engraver"
152         
153         % must come before all
154         \consists "Voice_devnull_engraver"
155         \consists "Output_property_engraver"    
156         \consists "Arpeggio_engraver"
157         \consists "Multi_measure_rest_engraver"
158         \consists "Text_spanner_engraver"
159         \consists "Grob_pq_engraver"
160
161         \consists "Ligature_bracket_engraver"
162         \consists "Breathing_sign_engraver"
163         % \consists "Rest_engraver"
164         \consists "Stem_engraver"
165         \consists "Beam_engraver"
166         \consists "Grace_beam_engraver"
167         \consists "Auto_beam_engraver"
168         \consists "New_fingering_engraver"
169         \consists "Chord_tremolo_engraver"
170         \consists "Percent_repeat_engraver"
171         \consists "Melisma_engraver"
172
173 %{
174  Must come before text_engraver, but after note_column engraver.
175
176 %}
177         \consists "Text_engraver"
178         \consists "Dynamic_engraver"
179         \consists "Fingering_engraver"
180
181         \consists "Script_engraver"
182         \consists "Script_column_engraver"
183         \consists "Rhythmic_column_engraver"
184         \consists "Phrasing_slur_engraver"
185         \consists "Cluster_engraver"
186         \consists "Slur_engraver"
187         \consists "Tie_engraver"
188         \consists "New_tie_engraver"
189         \consists "Tuplet_engraver"
190         \consists "A2_engraver"
191
192         \consists "Skip_event_swallow_translator"
193         \accepts Thread % bug if you leave out this!
194 }
195
196 ThreadContext = \translator{
197         \type Engraver_group_engraver
198         \name Thread
199         localKeySignature = #'()
200 \description "
201     Handles note heads, and is contained in the Voice context.  You
202     have to instantiate this explicitly if you want to adjust the
203     style of individual note heads.
204 "
205         \consists "Font_size_engraver"  
206         \consists "Thread_devnull_engraver"
207         \consists "Note_heads_engraver"
208         \consists "Rest_engraver"
209
210         % why here ? 
211         \consists "Note_head_line_engraver"
212         \consists "Output_property_engraver"    
213
214 }
215
216
217
218 GrandStaffContext=\translator{
219         \type "Engraver_group_engraver"
220         \name GrandStaff
221         localKeySignature = #'()
222         
223         \description " A group of staffs, with a brace on the left
224     side, grouping the staves together.  The bar lines of the
225     contained staves are connected vertically.  "
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         
280         \description
281
282         " Groups staffs while adding a bracket on the left side,
283         grouping the staves together.  The bar lines of the contained
284         staves are connected vertically.
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.
395
396     You cannot explicitly instantiate a Score context (since it is
397     not contained in any other context).  It is instantiated
398     automatically when an output definition (a @code{\score} or
399     @code{\paper} block) is processed."
400         
401         \consists "Repeat_acknowledge_engraver"
402         \consists "Staff_collecting_engraver"
403
404         % move the alias along with the engraver.
405
406         %% TODO? add this alias from Timing_engraver::initialize() ? 
407         \consists "Timing_engraver"
408         \alias "Timing"
409         
410         \consists "Output_property_engraver"
411         \consists "System_start_delimiter_engraver"
412         \consists "Mark_engraver"       
413         \consists "Metronome_mark_engraver"     
414         \consists "Break_align_engraver"
415         \consists "Spacing_engraver"
416         \consists "Vertical_align_engraver"
417         \consists "Lyric_phrasing_engraver"
418         \consists "Bar_number_engraver"
419         \consists "Span_arpeggio_engraver"
420
421         \accepts "Staff"
422         \accepts "TabStaff"
423         \accepts "StaffContainer"
424         \accepts "StaffGroup"
425         \accepts "RhythmicStaff"        
426         \accepts "Lyrics"
427         \accepts "ChordNames"
428         \accepts "GrandStaff"
429         \accepts "ChoirStaff"
430         \accepts "PianoStaff"
431         \accepts "NoteNames"
432         \accepts "FiguredBass"  
433
434         soloText = #"Solo"
435         soloIIText = #"Solo II"
436         aDueText = #"a2"
437         soloADue = ##t
438         splitInterval = #'(0 . 1)
439         changeMoment = #`(,(ly:make-moment 0 0) . ,(ly:make-moment 1 512))
440         systemStartDelimiter =#'SystemStartBar
441
442
443         clefGlyph = #"clefs-G"
444         clefPosition = #-2
445         centralCPosition = #-6
446         
447         automaticPhrasing = ##t
448         automaticMelismata = ##t
449         
450         defaultBarType = #"|"
451         barNumberVisibility = #default-bar-number-visibility
452
453         explicitClefVisibility = #all-visible
454         explicitKeySignatureVisibility = #all-visible
455         autoBeamSettings = #default-auto-beam-settings
456         autoBeaming = ##t
457         scriptDefinitions = #default-script-alist
458
459         verticalAlignmentChildCallback = #Align_interface::alignment_callback
460
461         pedalSustainStrings = #'("Ped." "*Ped." "*")
462         pedalUnaCordaStrings = #'("una corda" "" "tre corde")
463
464         %% These are in ordinary italic font, including the *,
465         %% but they are unlikely to be used, 
466         %% as the default pedal-style for SostenutoPedal is 'mixed':
467         %% i.e.  Sost. Ped_____________________ 
468         pedalSostenutoStrings = #'("Sost. Ped." "*Sost. Ped." "*") 
469
470         tupletNumberFormatFunction = #denominator-tuplet-formatter
471         
472         subdivideBeams = ##f
473         extraNatural = ##t
474         autoAccidentals = #'(Staff (same-octave . 0))
475         autoCautionaries = #'()  
476
477        keyAccidentalOrder = #'(
478          (6 . -1) (2  . -1) (5 . -1 ) (1  . -1) (4  . -1) (0  . -1) (3  . -1)
479          (3  . 1) (0 . 1) (4 . 1) (1 . 1) (5 . 1) (2 . 1) (6 . 1)
480          (6 . -2) (2  . -2) (5 . -2 ) (1  . -2) (4  . -2) (0  . -2) (3 . -2)
481          (3  . 2) (0 . 2) (4 . 2) (2 . 2) (5 . 2) (2 . 2) (6 . 2)
482         )
483         breakAlignOrder = #'(
484           instrument-name
485           left-edge
486           ambitus
487           span-bar
488           breathing-sign
489           clef
490           key-signature
491           staff-bar
492           time-signature
493           custos
494         )
495         barCheckSynchronize = ##t
496
497         %% chord names:
498         chordNameFunction = #ignatzek-chord-names
499         majorSevenSymbol = #whiteTriangleMarkup
500         chordNameSeparator = #(make-simple-markup  "/")
501         chordNameExceptions = #ignatzekExceptions
502         chordNoteNamer = #'()
503         chordRootNamer = #note-name->markup
504         
505         %% tablature:
506         stringOneTopmost = ##t
507         highStringOne = ##t
508
509         %% One may change the strings tuning as following :
510         %% The lenght of the list must be equal to the number of string
511         stringTunings   = #guitar-tunings
512         tablatureFormat = #fret-number-tablature-format
513
514         %%
515         bassFigureFormatFunction = #make-bass-figure-markup
516         metronomeMarkFormatter = #make-metronome-markup
517
518         \grobdescriptions #all-grob-descriptions
519 }
520
521 OrchestralScoreContext= \translator {
522         \ScoreContext
523 }
524
525 EasyNotation =  \translator {
526         \ScoreContext
527         NoteHead \override #'molecule-callback = #Note_head::brew_ez_molecule
528 }
529
530
531
532 FiguredBassContext = \translator {
533         \type "Engraver_group_engraver"
534         \name FiguredBass 
535         \consists "Figured_bass_engraver"
536         \consists "Rest_swallow_translator"
537         \consists "Note_swallow_translator"
538         \consists "Separating_line_group_engraver"
539         
540         \consistsend "Hara_kiri_engraver"
541 }
542
543 TabVoiceContext =   \translator {
544       \VoiceContext
545       \name "TabVoice"
546       \denies "Thread"
547       \consists "Tab_note_heads_engraver"
548
549       Slur \override #'font-family       = #'roman
550       Slur \override #'molecule-callback = #hammer-molecule-callback
551       Slur \override #'direction    = #-1
552
553       % Draws all stems/beams out of the staff (and not in the middle of the staff !)
554       % This feature is now disabled because most of the tab does not use it.
555       %Beam \override #'damping = #100000
556       %Stem \override #'up-to-staff = ##t
557
558       % No accidental in tablature !
559       \remove Accidental_engraver
560 }
561
562 TabStaffContext = \translator {
563       \StaffContext
564       \alias "Staff"
565       \name "TabStaff"
566       \denies "Voice"
567
568       \description "Context for generating tablature. [DOCME]"
569       
570       \accepts "TabVoice"
571       
572       % 6 strings
573       StaffSymbol \override #'line-count  = #6
574       StaffSymbol \override #'staff-space = #1.5
575
576      % Don't draw stems over the tablature figures !
577       Stem \override #'avoid-note-head = ##t
578       
579       % No accidental in tablature !
580       \remove Accidental_engraver
581       \remove Key_engraver
582
583       % Special "TAB" clef
584       clefGlyph = #"clefs-tab"
585       clefPosition = #0
586 }
587