]> git.donarmstrong.com Git - lilypond.git/blobdiff - ly/engraver-init.ly
release commit
[lilypond.git] / ly / engraver-init.ly
index 7e23cf9e81a83ce49a54bd5226580bc960347861..23a1e1045ed1b388d32ef8860b7ffa9b314478a2 100644 (file)
@@ -1,4 +1,5 @@
-\version "1.7.3"
+\version "1.9.1"
+
 
 %
 % setup for Request->Element conversion. Guru-only
@@ -6,7 +7,12 @@
 
 StaffContext=\translator {
        \type "Engraver_group_engraver"
-       \name Staff 
+       \name Staff
+
+       \description "Handles clefs, bar lines, keys, accidentals.  It can contain
+@code{Voice} contexts."
+
+       
        \consists "Output_property_engraver"    
        
        \consists "Bar_engraver"
@@ -21,6 +27,8 @@ StaffContext=\translator {
          =  #Separating_group_spanner::set_spacing_rods_and_seqs
        \consists "Dot_column_engraver"
 
+       % perhaps move to Voice context?
+       \consists "Ottava_spanner_engraver"
        \consists "Clef_engraver"
        \consists "Key_engraver"
        \consists "Time_signature_engraver"
@@ -43,8 +51,8 @@ StaffContext=\translator {
        % weird effects when doing instrument names for
        % piano staves
 
-       instrument = ##f
-       instr = ##f
+       instrument = #'()
+       instr = #'()
          
        \accepts "Voice"
 }
@@ -65,7 +73,6 @@ StaffContainerContext = \translator {
 InnerChoirStaffContext = \translator {
        \type "Engraver_group_engraver"
        \name InnerChoirStaff
-       %% alignmentReference = #0 FIXME
        \consists "System_start_delimiter_engraver"
        systemStartDelimiter = #'SystemStartBracket
        localKeySignature = #'()
@@ -77,9 +84,14 @@ InnerChoirStaffContext = \translator {
        \accepts "Lyrics"
        \accepts "ChordNames"
 }
+
 ChoirStaffContext = \translator {
        \InnerChoirStaffContext
        \name ChoirStaff
+       
+       \description "Identical to @code{StaffGroup} except that the
+    contained staves are not connected vertically."
+       
        \accepts "InnerChoirStaff"
        \accepts "InnerStaffGroup"
 }
@@ -90,7 +102,10 @@ RhythmicStaffContext=\translator{
        
        \consists "Output_property_engraver"    
 
-
+\description  "
+    A context like @code{Staff} but for printing rhythms.  Pitches are
+    ignored; the notes are printed on one line.  
+"
        minimumVerticalExtent = ##f
        extraVerticalExtent = ##f
        verticalExtent = ##f 
@@ -124,6 +139,13 @@ VoiceContext = \translator {
        \type "Engraver_group_engraver"
        \name Voice
 
+\description "
+    Corresponds to a voice on a staff.  This context handles the
+    conversion of dynamic signs, stems, beams, super- and subscripts,
+    slurs, ties, and rests.
+
+    You have to instantiate this explicitly if you want to have
+    multiple voices on the same staff."
 
        localKeySignature = #'()
        \consists "Font_size_engraver"
@@ -136,6 +158,8 @@ VoiceContext = \translator {
        \consists "Text_spanner_engraver"
        \consists "Grob_pq_engraver"
 
+       \consists "Note_head_line_engraver"
+       \consists "Glissando_engraver"
        \consists "Ligature_bracket_engraver"
        \consists "Breathing_sign_engraver"
        % \consists "Rest_engraver"
@@ -146,6 +170,7 @@ VoiceContext = \translator {
        \consists "New_fingering_engraver"
        \consists "Chord_tremolo_engraver"
        \consists "Percent_repeat_engraver"
+       \consists "Slash_repeat_engraver"
        \consists "Melisma_engraver"
 
 %{
@@ -160,15 +185,13 @@ VoiceContext = \translator {
        \consists "Script_column_engraver"
        \consists "Rhythmic_column_engraver"
        \consists "Phrasing_slur_engraver"
-       \consists "Cluster_engraver"
+       \consists "Cluster_spanner_engraver"
        \consists "Slur_engraver"
        \consists "Tie_engraver"
-       \consists "New_tie_engraver"
-       \consists "Porrectus_engraver"
        \consists "Tuplet_engraver"
        \consists "A2_engraver"
 
-       \consists "Skip_req_swallow_translator"
+       \consists "Skip_event_swallow_translator"
        \accepts Thread % bug if you leave out this!
 }
 
@@ -176,16 +199,18 @@ ThreadContext = \translator{
        \type Engraver_group_engraver
        \name Thread
        localKeySignature = #'()
-
+\description "
+    Handles note heads, and is contained in the Voice context.  You
+    have to instantiate this explicitly if you want to adjust the
+    style of individual note heads.
+"
        \consists "Font_size_engraver"  
        \consists "Thread_devnull_engraver"
        \consists "Note_heads_engraver"
        \consists "Rest_engraver"
 
        % why here ? 
-       \consists "Note_head_line_engraver"
        \consists "Output_property_engraver"    
-
 }
 
 
@@ -194,6 +219,11 @@ GrandStaffContext=\translator{
        \type "Engraver_group_engraver"
        \name GrandStaff
        localKeySignature = #'()
+       
+       \description " A group of staffs, with a brace on the left
+    side, grouping the staves together.  The bar lines of the
+    contained staves are connected vertically.  "
+
        \consists "Span_bar_engraver"
        \consists "Span_arpeggio_engraver"
        \consists "System_start_delimiter_engraver"
@@ -206,7 +236,10 @@ PianoStaffContext = \translator{
        \GrandStaffContext
        \name "PianoStaff"
        \alias "GrandStaff"
-
+\description "
+    Just like @code{GrandStaff} but with @code{minVerticalAlign} set
+    equal to @code{maxVerticalAlign} so that interstaff beaming and
+    slurring can be used."
        verticalAlignmentChildCallback = #Align_interface::fixed_distance_alignment_callback
        VerticalAlignment \override #'forced-distance = #12
        VerticalAlignment \override #'self-alignment-Y = #0
@@ -239,9 +272,18 @@ InnerStaffGroupContext= \translator {
        \accepts "Lyrics"
        \accepts "ChordNames"
 }
+
 StaffGroupContext = \translator {
        \InnerStaffGroupContext
        \name StaffGroup
+       
+       \description
+
+       " Groups staffs while adding a bracket on the left side,
+       grouping the staves together.  The bar lines of the contained
+       staves are connected vertically.
+"
+       
        \accepts "InnerChoirStaff"
        \accepts "ChoirStaff"
        \accepts "InnerStaffGroup"
@@ -252,19 +294,25 @@ StaffGroupContext = \translator {
 % UGH! JUNKME
 LyricsVoiceContext= \translator{
        \type "Engraver_group_engraver"
-       \consistsend "Axis_group_engraver"
-       minimumVerticalExtent = #'(-1.2 . 1.2)
+       \consistsend "Hara_kiri_engraver"
+       minimumVerticalExtent = #'(-1.2 . 2.4)
        extraVerticalExtent = ##f
-       verticalExtent = ##f 
+       verticalExtent = ##f
+
+       \description "
+    Corresponds to a voice with lyrics.  Handles the printing of a
+    single line of lyrics.
+"
+       
        \name LyricsVoice 
        \consists "Separating_line_group_engraver"
        \consists "Lyric_engraver"
        \consists "Extender_engraver"
        \consists "Hyphen_engraver"
        \consists "Stanza_number_engraver"
-       \consists "Skip_req_swallow_translator"
+       \consists "Skip_event_swallow_translator"
        phrasingPunctuation = #".,:!?\""
-       
+       SeparationItem \set #'padding = #0.5
 }
 NoteNamesContext = \translator {
        \type "Engraver_group_engraver"
@@ -283,11 +331,11 @@ NoteNamesContext = \translator {
 LyricsContext = \translator {
        \type "Engraver_group_engraver"
        \name Lyrics
-       
+       \description  "Typesets lyrics."
        %% To get folded repeats right.
        \consists Vertical_align_engraver 
 
-       \consistsend "Axis_group_engraver"
+       \consistsend "Hara_kiri_engraver"
        minimumVerticalExtent = ##f
        extraVerticalExtent = ##f
        verticalExtent = ##f 
@@ -299,53 +347,51 @@ LyricsContext = \translator {
 ChordNamesContext = \translator {
        \type "Engraver_group_engraver"
        \name ChordNames
-
+\description "    Typesets chord names."
+       
+       \consists "Rest_swallow_translator" 
        \consists "Output_property_engraver"    
        \consists "Separating_line_group_engraver"
-       \consists "New_chord_name_engraver"
-       \consists "Skip_req_swallow_translator"
-       \consistsend "Axis_group_engraver"
-       minimumVerticalExtent = ##f
+       \consists "Chord_name_engraver"
+       \consists "Skip_event_swallow_translator"
+       \consistsend "Hara_kiri_engraver"
+       minimumVerticalExtent = #'(0 . 2.5)
        extraVerticalExtent = ##f
        verticalExtent = ##f 
 }
 
 
-
-StupidScore = \translator {
-       \type "Score_engraver"
-       \name Score
-       \consists "Note_heads_engraver"
-}
-
-
-
-
-HaraKiriStaffContext = \translator {
+RemoveEmptyStaffContext = \translator {
        \StaffContext
        \remove "Axis_group_engraver"
        \consistsend "Hara_kiri_engraver"
-       \consists "Instrument_name_engraver"
        \accepts "Voice"
 
        % hara kiri & auto knee don't work together.
        Beam \override #'auto-knee-gap = #'()
 }
 
-%{
-  The HaraKiriStaffContexts doesn't override \name,
-  so it is still named `Staff'.
-
-  %\translator { \HaraKiriStaffContext }
-%}
-
-
-
+RemoveEmptyStaffContext = \translator {
+       \RemoveEmptyStaffContext
+       \accepts "VaticanaVoice"
+       \accepts "GregorianTranscriptionVoice"
+}
 
 ScoreContext = \translator {
        \type Score_engraver
        \name Score
        localKeySignature = #'()
+
+       \description "This is the top level notation context.  No
+    other context can contain a @code{Score} context.  This context
+    handles the administration of time signatures.  It also makes sure
+    that items such as clefs, time signatures, and key-signatures are
+    aligned across staves.
+
+    You cannot explicitly instantiate a Score context (since it is
+    not contained in any other context).  It is instantiated
+    automatically when an output definition (a @code{\score} or
+    @code{\paper} block) is processed."
        
        \consists "Repeat_acknowledge_engraver"
        \consists "Staff_collecting_engraver"
@@ -359,6 +405,7 @@ ScoreContext = \translator {
        \consists "Output_property_engraver"
        \consists "System_start_delimiter_engraver"
        \consists "Mark_engraver"       
+       \consists "Metronome_mark_engraver"     
        \consists "Break_align_engraver"
        \consists "Spacing_engraver"
        \consists "Vertical_align_engraver"
@@ -368,16 +415,18 @@ ScoreContext = \translator {
 
        \accepts "Staff"
        \accepts "TabStaff"
+       \accepts "VaticanaStaff"
+       \accepts "GregorianTranscriptionStaff"
        \accepts "StaffContainer"
        \accepts "StaffGroup"
-       \accepts "RhythmicStaff"        
+       \accepts "RhythmicStaff"
        \accepts "Lyrics"
        \accepts "ChordNames"
        \accepts "GrandStaff"
        \accepts "ChoirStaff"
        \accepts "PianoStaff"
        \accepts "NoteNames"
-       \accepts "FiguredBass"  
+       \accepts "FiguredBass"
 
        soloText = #"Solo"
        soloIIText = #"Solo II"
@@ -388,8 +437,6 @@ ScoreContext = \translator {
        systemStartDelimiter =#'SystemStartBar
 
 
-       %% name, glyph id, clef position 
-       %% where is c0 in this clef?
        clefGlyph = #"clefs-G"
        clefPosition = #-2
        centralCPosition = #-6
@@ -399,32 +446,37 @@ ScoreContext = \translator {
        
        defaultBarType = #"|"
        barNumberVisibility = #default-bar-number-visibility
-
+       automaticBars = ##t
+       
        explicitClefVisibility = #all-visible
        explicitKeySignatureVisibility = #all-visible
-       autoBeamSettings = #auto-beam-settings
+       autoBeamSettings = #default-auto-beam-settings
        autoBeaming = ##t
        scriptDefinitions = #default-script-alist
 
        verticalAlignmentChildCallback = #Align_interface::alignment_callback
 
        pedalSustainStrings = #'("Ped." "*Ped." "*")
+       pedalSustainStyle = #'text
        pedalUnaCordaStrings = #'("una corda" "" "tre corde")
+       pedalUnaCordaStyle = #'text
 
        %% These are in ordinary italic font, including the *,
        %% but they are unlikely to be used, 
        %% as the default pedal-style for SostenutoPedal is 'mixed':
        %% i.e.  Sost. Ped_____________________ 
        pedalSostenutoStrings = #'("Sost. Ped." "*Sost. Ped." "*") 
+       pedalSostenutoStyle = #'mixed
 
+       
        tupletNumberFormatFunction = #denominator-tuplet-formatter
        
        subdivideBeams = ##f
+       allowBeamBreak = ##f
        extraNatural = ##t
        autoAccidentals = #'(Staff (same-octave . 0))
        autoCautionaries = #'()  
 
-
        keyAccidentalOrder = #'(
          (6 . -1) (2  . -1) (5 . -1 ) (1  . -1) (4  . -1) (0  . -1) (3  . -1)
         (3  . 1) (0 . 1) (4 . 1) (1 . 1) (5 . 1) (2 . 1) (6 . 1)
@@ -435,11 +487,10 @@ ScoreContext = \translator {
          instrument-name
          left-edge
          ambitus
-         span-bar
          breathing-sign
          clef
-         key-signature
          staff-bar
+         key-signature
          time-signature
          custos
        )
@@ -450,6 +501,24 @@ ScoreContext = \translator {
        majorSevenSymbol = #whiteTriangleMarkup
        chordNameSeparator = #(make-simple-markup  "/")
        chordNameExceptions = #ignatzekExceptions
+       chordNoteNamer = #'()
+       chordRootNamer = #note-name->markup
+
+       chordNameExceptionsFull = #fullJazzExceptions
+       chordNameExceptionsPartial = #partialJazzExceptions
+       
+       %% tablature:
+       stringOneTopmost = ##t
+       highStringOne = ##t
+
+       %% One may change the strings tuning as following :
+       %% The lenght of the list must be equal to the number of string
+       stringTunings   = #guitar-tunings
+       tablatureFormat = #fret-number-tablature-format
+
+       %%
+       bassFigureFormatFunction = #make-bass-figure-markup
+       metronomeMarkFormatter = #make-metronome-markup
 
        \grobdescriptions #all-grob-descriptions
 }
@@ -457,30 +526,33 @@ ScoreContext = \translator {
 OrchestralScoreContext= \translator {
        \ScoreContext
 }
+
 EasyNotation =  \translator {
        \ScoreContext
        NoteHead \override #'molecule-callback = #Note_head::brew_ez_molecule
 }
 
-% retain for compatibility reasons (FIXME: convert-ly)
-GraceContext = \translator {
-       \type "Engraver_group_engraver"
-}
+
 
 FiguredBassContext = \translator {
        \type "Engraver_group_engraver"
        \name FiguredBass 
-       \consists "Figured_bass_engraver"       
-       \consistsend "Axis_group_engraver"
+       \consists "Figured_bass_engraver"
+       \consists "Rest_swallow_translator"
+       \consists "Note_swallow_translator"
+       \consists "Separating_line_group_engraver"
+       
+       \consistsend "Hara_kiri_engraver"
 }
 
-
 TabVoiceContext =   \translator {
       \VoiceContext
       \name "TabVoice"
       \denies "Thread"
       \consists "Tab_note_heads_engraver"
-
+      \remove "Fingering_engraver"
+      \remove "New_fingering_engraver"
+      
       Slur \override #'font-family       = #'roman
       Slur \override #'molecule-callback = #hammer-molecule-callback
       Slur \override #'direction    = #-1
@@ -499,32 +571,178 @@ TabStaffContext = \translator {
       \alias "Staff"
       \name "TabStaff"
       \denies "Voice"
+
+      \description "Context for generating tablature. [DOCME]"
+      
       \accepts "TabVoice"
       
       % 6 strings
       StaffSymbol \override #'line-count  = #6
       StaffSymbol \override #'staff-space = #1.5
 
-      stringOneTopmost = ##t
-      highStringOne = ##t
-
-      % One may change the strings tuning as following :
-      % The lenght of the list must be equal to the number of string
-      %TabNoteHead \override #'string-tunings = #'(10 10 10 10 10 10)
-      
-      % Special "TAB" clef
-      clefGlyph = #"clefs-tab"
-      clefPosition = #0
-      
-      % Don't draw stems over the tablature figures !
+     % Don't draw stems over the tablature figures !
       Stem \override #'avoid-note-head = ##t
       
       % No accidental in tablature !
       \remove Accidental_engraver
       \remove Key_engraver
-      stringTunings   = #guitar-tunings
-      tablatureFormat = #fret-number-tablature-format
 
+      % Special "TAB" clef
+      clefGlyph = #"clefs-tab"
+      clefPosition = #0
+}
+
+% TODO: Gregorian Chant contexts should be moved to gregorian-init.ly,
+% but this does not work (is this a bug or intended behaviour?):
+%
+% If I try to do so, I get "error: unknown escaped string:
+% `\VaticanaStaffContext'" in params-init.ly.  If I also move
+% "\translator { \Vaticana*Context }" from params-init.ly to the end
+% of gregorian-init.ly, then I get "error: parse error, unexpected
+% TRANSLATOR: \translator { \VaticanaStaffContext }" in
+% gregorian-init.ly. --jr
+
+VaticanaVoiceContext = \translator {
+  \VoiceContext
+  \name "VaticanaVoice"
+  \alias "Voice"
+  \description "Same as @code{Voice} context, except that it is accommodated for tyepsetting Gregorian Chant in the notational style of Editio Vaticana."
+
+  % We can not remove Slur_engraver, since \addlyrics depends on it.
+  % Instead, we make the grob transparent.
+  % Unfortunately, this gives us a lot of warnings ("Degenerate bow:
+  % infinite steepness reqd"), since in ligatures, all note heads are in
+  % the same paper column such that the (transparent) slurs eventually may
+  % start and end in the same column.
+  Slur \override #'transparent = ##t
+
+  % We can not remove Stem_engraver, since slurs depend on stems.  If
+  % we try anyway, lily will crash in slur.scm:16:6: "Wrong type argument
+  % in position 1 (expecting grob): ()".
+  % As a workaround, we make the grob transparent.
+  Stem \set #'transparent = ##t
+
+  % Since we do not remove stems, but only make it transparent, we have
+  % to set the length to 0.0.  Otherwise, articulation marks (such as
+  % ictus, circulus or accentus) may be vertically placed quite away from
+  % the note head.
+  Stem \set #'length = #'0.0
+
+  \remove "Ligature_bracket_engraver"
+  \consists "Vaticana_ligature_engraver"
+
+  % Set default head for notes outside of \[ \].
+  NoteHead \set #'style = #'vaticana_punctum
+
+  % Put some space before and after divisiones.
+  % FIXME: This does not seem to show any effect.
+  Script \set #'padding = #0.5
+
+  % There are no beams in Gregorian Chant notation.
+  autobeaming = ##f
+
+  % Prepare TextSpanner for \episem{Initium|Finis} use.
+  TextSpanner \set #'style = #'line
+  TextSpanner \set #'edge-height = #'(0 . 0)
+  TextSpanner \set #'padding = #0.5
+  TextSpanner \set #'enclose-bounds = ##t
+  TextSpanner \set #'edge-text = #'("" . "")
+}
+
+VaticanaStaffContext = \translator {
+  \StaffContext
+  \name "VaticanaStaff"
+  \alias "Staff"
+  \denies "Voice"
+  \accepts "VaticanaVoice"
+  \description "Same as @code{Staff} context, except that it is accommodated for tyepsetting Gregorian Chant in the notational style of Editio Vaticana."
+
+  \remove "Time_signature_engraver"
+  \consists "Custos_engraver"
+
+  % We can not remove Bar_engraver; otherwise clefs and custodes will
+  % not show up any more among other line breaking issues.
+  % Instead, we make the grob transparent.
+  BarLine \set #'transparent = ##t
+
+  StaffSymbol \set #'line-count = #4
+
+  % FIXME: unit on StaffSymbol's width should be \linewidth.
+  % StaffSymbol \set #'width = #60.0
+
+  % Choose vaticana do clef on 3rd line as default.
+  clefGlyph = #"clefs-vaticana_do"
+  centralCPosition = #1
+  clefPosition = #1
+  clefOctavation = #0
+
+  % Select vaticana style font.
+  KeySignature \set #'style = #'vaticana
+  Accidental \set #'style = #'vaticana
+  Custos \set #'style = #'vaticana
+  Custos \set #'neutral-position = #3
+  Custos \set #'neutral-direction = #-1
+  Custos \set #'adjust-if-on-staffline = ##t
+
+  % Score.timing = ##f
+  % Score.barAlways = ##t
+}
+
+GregorianTranscriptionVoiceContext = \translator {
+  \VoiceContext
+  \name "GregorianTranscriptionVoice"
+  \alias "Voice"
+
+  % Removing ligature bracket engraver without replacing it by some
+  % other ligature engraver would cause a "Junking event: `LigatureEvent'"
+  % warning for every "\[" and "\]".  Therefore, we make the grob
+  % transparent instead.
+  LigatureBracket \set #'transparent = ##t
+
+  % We can not remove Slur_engraver, since \addlyrics depends on it.
+  % Instead, we make the grob transparent.
+  % Unfortunately, this gives us a lot of warnings ("Degenerate bow:
+  % infinite steepness reqd"), since in ligatures, all note heads are in
+  % the same paper column such that the (transparent) slurs eventually may
+  % start and end in the same column.
+  Slur \override #'transparent = ##t
+
+  % We can not remove Stem_engraver, since slurs depend on stems.  If
+  % we try anyway, lily will crash in slur.scm:16:6: "Wrong type argument
+  % in position 1 (expecting grob): ()".
+  % As a workaround, we make the grob transparent.
+  Stem \set #'transparent = ##t
+
+  % Since we do not remove stems, but only make it transparent, we have
+  % to set the length to 0.0.  Otherwise, articulation marks (such as
+  % ictus, circulus or accentus) may be vertically placed quite away from
+  % the note head.
+  Stem \set #'length = #'0.0
+
+  % Put some space before and after divisiones.
+  % FIXME: This does not seem to show any effect.
+  Script \set #'padding = #0.5
+
+  % There are no beams in Gregorian Chant notation.
+  autobeaming = ##f
+
+  % Prepare TextSpanner for \episem{Initium|Finis} use.
+  TextSpanner \set #'style = #'line
+  TextSpanner \set #'edge-height = #'(0 . 0)
+  TextSpanner \set #'padding = #0.5
+  TextSpanner \set #'enclose-bounds = ##t
+  TextSpanner \set #'edge-text = #'("" . "")
+}
 
+GregorianTranscriptionStaffContext = \translator {
+  \StaffContext
+  \name "GregorianTranscriptionStaff"
+  \alias "Staff"
+  \denies "Voice"
+  \accepts "GregorianTranscriptionVoice"
+
+  % We can not remove Bar_engraver; otherwise clefs and custodes will
+  % not show up any more among other line breaking issues.
+  % Instead, we make the grob transparent.
+  BarLine \set #'transparent = ##t
 }
-