]> git.donarmstrong.com Git - lilypond.git/blob - ly/engraver-init.ly
(try_music): new file, handle
[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 "Slash_repeat_engraver"
172         \consists "Melisma_engraver"
173
174 %{
175  Must come before text_engraver, but after note_column engraver.
176
177 %}
178         \consists "Text_engraver"
179         \consists "Dynamic_engraver"
180         \consists "Fingering_engraver"
181
182         \consists "Script_engraver"
183         \consists "Script_column_engraver"
184         \consists "Rhythmic_column_engraver"
185         \consists "Phrasing_slur_engraver"
186         \consists "Cluster_engraver"
187         \consists "Slur_engraver"
188         \consists "Tie_engraver"
189         \consists "New_tie_engraver"
190         \consists "Tuplet_engraver"
191         \consists "A2_engraver"
192
193         \consists "Skip_event_swallow_translator"
194         \accepts Thread % bug if you leave out this!
195 }
196
197 ThreadContext = \translator{
198         \type Engraver_group_engraver
199         \name Thread
200         localKeySignature = #'()
201 \description "
202     Handles note heads, and is contained in the Voice context.  You
203     have to instantiate this explicitly if you want to adjust the
204     style of individual note heads.
205 "
206         \consists "Font_size_engraver"  
207         \consists "Thread_devnull_engraver"
208         \consists "Note_heads_engraver"
209         \consists "Rest_engraver"
210
211         % why here ? 
212         \consists "Note_head_line_engraver"
213         \consists "Output_property_engraver"    
214
215 }
216
217
218
219 GrandStaffContext=\translator{
220         \type "Engraver_group_engraver"
221         \name GrandStaff
222         localKeySignature = #'()
223         
224         \description " A group of staffs, with a brace on the left
225     side, grouping the staves together.  The bar lines of the
226     contained staves are connected vertically.  "
227
228         \consists "Span_bar_engraver"
229         \consists "Span_arpeggio_engraver"
230         \consists "System_start_delimiter_engraver"
231         systemStartDelimiter = #'SystemStartBrace
232
233         \accepts "Staff"
234 }
235
236 PianoStaffContext = \translator{
237         \GrandStaffContext
238         \name "PianoStaff"
239         \alias "GrandStaff"
240 \description "
241     Just like @code{GrandStaff} but with @code{minVerticalAlign} set
242     equal to @code{maxVerticalAlign} so that interstaff beaming and
243     slurring can be used."
244         verticalAlignmentChildCallback = #Align_interface::fixed_distance_alignment_callback
245         VerticalAlignment \override #'forced-distance = #12
246         VerticalAlignment \override #'self-alignment-Y = #0
247
248         \consists "Vertical_align_engraver"
249         \consists "Instrument_name_engraver"
250         
251         instrument = #'()
252         instr = #'()
253         
254 %       \consistsend "Axis_group_engraver"
255 }
256
257 InnerStaffGroupContext= \translator {
258         \type "Engraver_group_engraver"
259         \name InnerStaffGroup
260         localKeySignature = #'()
261
262         \consists "Span_bar_engraver"
263         \consists "Span_arpeggio_engraver"
264         \consists "Output_property_engraver"    
265         systemStartDelimiter = #'SystemStartBracket
266
267         \consists "System_start_delimiter_engraver"
268         \accepts "Staff"
269         \accepts "RhythmicStaff"
270         \accepts "GrandStaff"
271         \accepts "PianoStaff"
272         \accepts "TabStaff"     
273         \accepts "Lyrics"
274         \accepts "ChordNames"
275 }
276
277 StaffGroupContext = \translator {
278         \InnerStaffGroupContext
279         \name StaffGroup
280         
281         \description
282
283         " Groups staffs while adding a bracket on the left side,
284         grouping the staves together.  The bar lines of the contained
285         staves are connected vertically.
286 "
287         
288         \accepts "InnerChoirStaff"
289         \accepts "ChoirStaff"
290         \accepts "InnerStaffGroup"
291         \accepts "FiguredBass"
292 }
293
294
295 % UGH! JUNKME
296 LyricsVoiceContext= \translator{
297         \type "Engraver_group_engraver"
298         \consistsend "Hara_kiri_engraver"
299         minimumVerticalExtent = #'(-1.2 . 1.2)
300         extraVerticalExtent = ##f
301         verticalExtent = ##f
302
303         \description "
304     Corresponds to a voice with lyrics.  Handles the printing of a
305     single line of lyrics.
306 "
307         
308         \name LyricsVoice 
309         \consists "Separating_line_group_engraver"
310         \consists "Lyric_engraver"
311         \consists "Extender_engraver"
312         \consists "Hyphen_engraver"
313         \consists "Stanza_number_engraver"
314         \consists "Skip_event_swallow_translator"
315         phrasingPunctuation = #".,:!?\""
316         
317 }
318 NoteNamesContext = \translator {
319         \type "Engraver_group_engraver"
320         \name NoteNames
321         \consistsend "Axis_group_engraver"
322
323         minimumVerticalExtent = ##f
324         extraVerticalExtent = ##f
325         verticalExtent = ##f 
326
327         
328         \consists "Note_name_engraver"
329         \consists "Separating_line_group_engraver"
330 }
331
332 LyricsContext = \translator {
333         \type "Engraver_group_engraver"
334         \name Lyrics
335         \description  "Typesets lyrics."
336         %% To get folded repeats right.
337         \consists Vertical_align_engraver 
338
339         \consistsend "Hara_kiri_engraver"
340         minimumVerticalExtent = ##f
341         extraVerticalExtent = ##f
342         verticalExtent = ##f 
343         
344         \accepts "LyricsVoice"
345 }
346
347
348 ChordNamesContext = \translator {
349         \type "Engraver_group_engraver"
350         \name ChordNames
351 \description "    Typesets chord names."
352         
353         \consists "Rest_swallow_translator" 
354         \consists "Output_property_engraver"    
355         \consists "Separating_line_group_engraver"
356         \consists "Chord_name_engraver"
357         \consists "Skip_event_swallow_translator"
358         \consistsend "Hara_kiri_engraver"
359         minimumVerticalExtent = #'(0 . 2.5)
360         extraVerticalExtent = ##f
361         verticalExtent = ##f 
362 }
363
364
365 HaraKiriStaffContext = \translator {
366         \StaffContext
367         \remove "Axis_group_engraver"
368         \consistsend "Hara_kiri_engraver"
369         \consists "Instrument_name_engraver"
370         \accepts "Voice"
371
372         % hara kiri & auto knee don't work together.
373         Beam \override #'auto-knee-gap = #'()
374 }
375
376 %{
377   The HaraKiriStaffContexts doesn't override \name,
378   so it is still named `Staff'.
379
380   %\translator { \HaraKiriStaffContext }
381 %}
382
383
384
385
386 ScoreContext = \translator {
387         \type Score_engraver
388         \name Score
389         localKeySignature = #'()
390
391         \description "This is the top level notation context.  No
392     other context can contain a @code{Score} context.  This context
393     handles the administration of time signatures.  It also makes sure
394     that items such as clefs, time signatures, and key-signatures are
395     aligned across staves.
396
397     You cannot explicitly instantiate a Score context (since it is
398     not contained in any other context).  It is instantiated
399     automatically when an output definition (a @code{\score} or
400     @code{\paper} block) is processed."
401         
402         \consists "Repeat_acknowledge_engraver"
403         \consists "Staff_collecting_engraver"
404
405         % move the alias along with the engraver.
406
407         %% TODO? add this alias from Timing_engraver::initialize() ? 
408         \consists "Timing_engraver"
409         \alias "Timing"
410         
411         \consists "Output_property_engraver"
412         \consists "System_start_delimiter_engraver"
413         \consists "Mark_engraver"       
414         \consists "Metronome_mark_engraver"     
415         \consists "Break_align_engraver"
416         \consists "Spacing_engraver"
417         \consists "Vertical_align_engraver"
418         \consists "Lyric_phrasing_engraver"
419         \consists "Bar_number_engraver"
420         \consists "Span_arpeggio_engraver"
421
422         \accepts "Staff"
423         \accepts "TabStaff"
424         \accepts "StaffContainer"
425         \accepts "StaffGroup"
426         \accepts "RhythmicStaff"        
427         \accepts "Lyrics"
428         \accepts "ChordNames"
429         \accepts "GrandStaff"
430         \accepts "ChoirStaff"
431         \accepts "PianoStaff"
432         \accepts "NoteNames"
433         \accepts "FiguredBass"  
434
435         soloText = #"Solo"
436         soloIIText = #"Solo II"
437         aDueText = #"a2"
438         soloADue = ##t
439         splitInterval = #'(0 . 1)
440         changeMoment = #`(,(ly:make-moment 0 0) . ,(ly:make-moment 1 512))
441         systemStartDelimiter =#'SystemStartBar
442
443
444         clefGlyph = #"clefs-G"
445         clefPosition = #-2
446         centralCPosition = #-6
447         
448         automaticPhrasing = ##t
449         automaticMelismata = ##t
450         
451         defaultBarType = #"|"
452         barNumberVisibility = #default-bar-number-visibility
453
454         explicitClefVisibility = #all-visible
455         explicitKeySignatureVisibility = #all-visible
456         autoBeamSettings = #default-auto-beam-settings
457         autoBeaming = ##t
458         scriptDefinitions = #default-script-alist
459
460         verticalAlignmentChildCallback = #Align_interface::alignment_callback
461
462         pedalSustainStrings = #'("Ped." "*Ped." "*")
463         pedalUnaCordaStrings = #'("una corda" "" "tre corde")
464
465         %% These are in ordinary italic font, including the *,
466         %% but they are unlikely to be used, 
467         %% as the default pedal-style for SostenutoPedal is 'mixed':
468         %% i.e.  Sost. Ped_____________________ 
469         pedalSostenutoStrings = #'("Sost. Ped." "*Sost. Ped." "*") 
470
471         tupletNumberFormatFunction = #denominator-tuplet-formatter
472         
473         subdivideBeams = ##f
474         extraNatural = ##t
475         autoAccidentals = #'(Staff (same-octave . 0))
476         autoCautionaries = #'()  
477
478        keyAccidentalOrder = #'(
479          (6 . -1) (2  . -1) (5 . -1 ) (1  . -1) (4  . -1) (0  . -1) (3  . -1)
480          (3  . 1) (0 . 1) (4 . 1) (1 . 1) (5 . 1) (2 . 1) (6 . 1)
481          (6 . -2) (2  . -2) (5 . -2 ) (1  . -2) (4  . -2) (0  . -2) (3 . -2)
482          (3  . 2) (0 . 2) (4 . 2) (2 . 2) (5 . 2) (2 . 2) (6 . 2)
483         )
484         breakAlignOrder = #'(
485           instrument-name
486           left-edge
487           ambitus
488           span-bar
489           breathing-sign
490           clef
491           key-signature
492           staff-bar
493           time-signature
494           custos
495         )
496         barCheckSynchronize = ##t
497
498         %% chord names:
499         chordNameFunction = #ignatzek-chord-names
500         majorSevenSymbol = #whiteTriangleMarkup
501         chordNameSeparator = #(make-simple-markup  "/")
502         chordNameExceptions = #ignatzekExceptions
503         chordNoteNamer = #'()
504         chordRootNamer = #note-name->markup
505         
506         %% tablature:
507         stringOneTopmost = ##t
508         highStringOne = ##t
509
510         %% One may change the strings tuning as following :
511         %% The lenght of the list must be equal to the number of string
512         stringTunings   = #guitar-tunings
513         tablatureFormat = #fret-number-tablature-format
514
515         %%
516         bassFigureFormatFunction = #make-bass-figure-markup
517         metronomeMarkFormatter = #make-metronome-markup
518
519         \grobdescriptions #all-grob-descriptions
520 }
521
522 OrchestralScoreContext= \translator {
523         \ScoreContext
524 }
525
526 EasyNotation =  \translator {
527         \ScoreContext
528         NoteHead \override #'molecule-callback = #Note_head::brew_ez_molecule
529 }
530
531
532
533 FiguredBassContext = \translator {
534         \type "Engraver_group_engraver"
535         \name FiguredBass 
536         \consists "Figured_bass_engraver"
537         \consists "Rest_swallow_translator"
538         \consists "Note_swallow_translator"
539         \consists "Separating_line_group_engraver"
540         
541         \consistsend "Hara_kiri_engraver"
542 }
543
544 TabVoiceContext =   \translator {
545       \VoiceContext
546       \name "TabVoice"
547       \denies "Thread"
548       \consists "Tab_note_heads_engraver"
549
550       Slur \override #'font-family       = #'roman
551       Slur \override #'molecule-callback = #hammer-molecule-callback
552       Slur \override #'direction    = #-1
553
554       % Draws all stems/beams out of the staff (and not in the middle of the staff !)
555       % This feature is now disabled because most of the tab does not use it.
556       %Beam \override #'damping = #100000
557       %Stem \override #'up-to-staff = ##t
558
559       % No accidental in tablature !
560       \remove Accidental_engraver
561 }
562
563 TabStaffContext = \translator {
564       \StaffContext
565       \alias "Staff"
566       \name "TabStaff"
567       \denies "Voice"
568
569       \description "Context for generating tablature. [DOCME]"
570       
571       \accepts "TabVoice"
572       
573       % 6 strings
574       StaffSymbol \override #'line-count  = #6
575       StaffSymbol \override #'staff-space = #1.5
576
577      % Don't draw stems over the tablature figures !
578       Stem \override #'avoid-note-head = ##t
579       
580       % No accidental in tablature !
581       \remove Accidental_engraver
582       \remove Key_engraver
583
584       % Special "TAB" clef
585       clefGlyph = #"clefs-tab"
586       clefPosition = #0
587 }
588