]> git.donarmstrong.com Git - lilypond.git/commitdiff
Add the Instrument_name_engraver also to all group contexts
authorReinhold Kainhofer <reinhold@kainhofer.com>
Tue, 25 Jan 2011 16:59:02 +0000 (17:59 +0100)
committerReinhold Kainhofer <reinhold@kainhofer.com>
Fri, 28 Jan 2011 13:46:54 +0000 (14:46 +0100)
Also, make sure it is not inherited from the parent (in particular
in nested staff groups).

Documentation/notation/staff.itely
input/regression/instrument-name-groups.ly [new file with mode: 0644]
ly/engraver-init.ly

index 01861c2a1470f5be0709edb9749b0077ace8377d..5d718aa1fd2fc8ad40aa512e416dcb4667e2150d 100644 (file)
@@ -857,7 +857,8 @@ format cue notes are also described.
 @cindex instrument names, short
 
 Instrument names can be printed on the left side of staves in the
-@code{Staff} and @code{PianoStaff} contexts.  The value of
+@code{Staff}, @code{PianoStaff}, @code{StaffGroup}, @code{GrandStaff}
+and @code{ChoirStaff} contexts.  The value of
 @code{instrumentName} is used for the first staff, and the value
 of @code{shortInstrumentName} is used for all succeeding staves.
 
@@ -935,7 +936,7 @@ these settings, see @ref{\paper variables for shifts and indents}.
 @cindex instrument names, adding to other contexts
 
 To add instrument names to other contexts (such as
-@code{GrandStaff}, @code{ChoirStaff}, or @code{StaffGroup}),
+@code{ChordNames} or @code{FiguredBass}),
 @code{Instrument_name_engraver} must be added to that context.
 For details, see @ref{Modifying context plug-ins}.
 
diff --git a/input/regression/instrument-name-groups.ly b/input/regression/instrument-name-groups.ly
new file mode 100644 (file)
index 0000000..e5f8cfc
--- /dev/null
@@ -0,0 +1,39 @@
+\version "2.13.47"
+\header {
+  texidoc="
+Instrument names can also be attached to staff groups.
+"
+}
+
+\paper {
+  left-margin = 3\cm
+}
+\layout {
+  ragged-right = ##t
+}
+
+
+\new StaffGroup \with { instrumentName = #"StaffGroup" } <<
+  \new PianoStaff \with { instrumentName = #"PianoStaff" } <<
+    \new Staff \with { instrumentName = #"Right" } { c''4 }
+    \new Staff \with { instrumentName = #"Left" } { \clef bass c4 }
+  >>
+
+  \new ChoirStaff \with { instrumentName = #"ChoirStaff" } <<
+    \new Staff { c''4 }
+    \new Staff { c''4 }
+    \new Staff { c''4 }
+  >>
+  \new GrandStaff \with { instrumentName = #"GrandStaff" } <<
+    \new Staff \with { instrumentName = #"I" } { c''4 }
+    \new Staff \with { instrumentName = #"II" } { \clef bass c4 }
+  >>
+  % Nested groups should not inherit the instrument name from the parent group
+  \new StaffGroup \with { instrumentName = #"nested group" } <<
+    \new Staff { c''4 }
+    \new StaffGroup <<
+      \new Staff { c''4 }
+      \new Staff { c''4 }
+    >>
+  >>
+>>
index 5f3383ce12295af7d7075a50ac237fe6f43db029..7de70d37329398ff5715045b1ce7fa4ef3f03c55 100644 (file)
   \consists "Font_size_engraver"
   \consists "Instrument_name_engraver"
 
+  %% explicitly set instrument, so it is not inherited from the parent
+  instrumentName = #'()
+  shortInstrumentName = #'()
+
   predefinedDiagramTable = #default-fret-table
 }
 
@@ -84,7 +88,6 @@
   %% explicitly set instrument, so we don't get
   %% weird effects when doing instrument names for
   %% piano staves
-
   instrumentName = #'()
   shortInstrumentName = #'()
 
   \consists "Vertical_align_engraver"
   topLevelAlignment = ##f
 
+  \consists "Instrument_name_engraver"
   \consists "System_start_delimiter_engraver"
   systemStartDelimiter = #'SystemStartBracket
+  %% explicitly set instrument, so it is not inherited from the parent
+  instrumentName = #'()
+  shortInstrumentName = #'()
   vocalName = #'()
   shortVocalName = #'()
 
@@ -175,6 +182,10 @@ contained staves are not connected vertically."
   \consists "Axis_group_engraver"
   \consists "Ledger_line_engraver"
 
+  %% explicitly set instrument, so it is not inherited from the parent
+  instrumentName = #'()
+  shortInstrumentName = #'()
+
   \accepts "Voice"
   \accepts "CueVoice"
   \defaultchild "Voice"
@@ -296,11 +307,15 @@ multiple voices on the same staff."
 side, grouping the staves together.  The bar lines of the
 contained staves are connected vertically."
 
+  \consists "Instrument_name_engraver"
   \consists "Span_bar_engraver"
   \consists "Span_arpeggio_engraver"
   \consists "System_start_delimiter_engraver"
   systemStartDelimiter = #'SystemStartBrace
   topLevelAlignment = ##f
+  %% explicitly set instrument, so it is not inherited from the parent
+  instrumentName = #'()
+  shortInstrumentName = #'()
 
   \defaultchild "Staff"
   \accepts "Staff"
@@ -314,10 +329,9 @@ contained staves are connected vertically."
   \name "PianoStaff"
   \alias "GrandStaff"
 
-  \description "Just like @code{GrandStaff} but with support for
-instrument names at the start of each system."
+  \description "Just like @code{GrandStaff}, but the staves are only removed
+together, never separately."
 
-  \consists "Instrument_name_engraver"
   \consists "Vertical_align_engraver"
   \consists "Keep_alive_together_engraver"
   topLevelAlignment = ##f
@@ -333,10 +347,14 @@ instrument names at the start of each system."
   \consists "Vertical_align_engraver"
   topLevelAlignment = ##f
 
+  \consists "Instrument_name_engraver"
   \consists "Span_bar_engraver"
   \consists "Span_arpeggio_engraver"
   \consists "Output_property_engraver"
   systemStartDelimiter = #'SystemStartBracket
+  %% explicitly set instrument, so it is not inherited from the parent
+  instrumentName = #'()
+  shortInstrumentName = #'()
 
   \consists "System_start_delimiter_engraver"
 
@@ -404,6 +422,9 @@ printing of a single line of lyrics."
   \consists "Instrument_name_engraver"
   \consists "Font_size_engraver"
   \consists "Hara_kiri_engraver"
+  %% explicitly set instrument, so it is not inherited from the parent
+  instrumentName = #'()
+  shortInstrumentName = #'()
 
   \override VerticalAxisGroup #'remove-first = ##t
   \override VerticalAxisGroup #'remove-empty = ##t