]> git.donarmstrong.com Git - lilypond.git/blob - input/regression/context-mod-with.ly
Merge branch 'stable/2.16' into staging
[lilypond.git] / input / regression / context-mod-with.ly
1 \version "2.16.0"
2
3 \header  {
4 texidoc = "Context modifications can be stored into a variable as a
5 \with object. They can be later inserted into another \with block."
6 }
7
8 % Some sample modifications to be inserted into a \with block later on
9 ctxmod = \with {
10   \remove "Time_signature_engraver"
11   \consists "Ambitus_engraver"
12   \override StaffSymbol #'line-count = 4
13 }
14
15 \layout {
16   \context {
17     \Score
18     \remove "Mark_engraver"
19     \remove "Staff_collecting_engraver"
20   }
21   \context {
22     \Staff
23     \consists "Mark_engraver"
24     \consists "Staff_collecting_engraver"
25   }
26 }
27
28
29 music = \relative c'' { \key fis \minor c1 d e }
30
31 \score { <<
32   \override Score.RehearsalMark #'self-alignment-X = #LEFT
33   \override Score.RehearsalMark #'font-size = #-2
34   % No modifications:
35   \new Staff { \mark \markup { No modifications } \music }
36   \new Staff \with {
37     \remove "Time_signature_engraver"
38     \consists "Ambitus_engraver"
39     \override StaffSymbol #'line-count = 4
40   } {
41     \mark
42     \markup { "Remove time sig, add ambitus, set staff to 4 lines" }
43     \music }
44   % Some context modifications manually written in a \with block
45   \new Staff \with \ctxmod {
46     \mark \markup { "The same mods using a variable" } \music
47   }
48   % The same mods as direct value of \with
49   \new Staff \with { \ctxmod } {
50     \mark \markup { "The same mods using a variable and \with" }
51     \music
52   }
53   % Mods before a context mod in a with block are working:
54   \new Staff \with {
55     \remove "Clef_engraver"
56     \ctxmod
57   } {
58     \mark
59     \markup { "Remove clef and use variable to add other changes as above" }
60     \music
61   }
62   % Mods before and after a context mod in a with block are working:
63   \new Staff \with {
64     \remove "Clef_engraver"
65     \ctxmod
66     \remove "Key_engraver"
67   } { \mark \markup { "Also remove clef and key engravers" } \music }
68   % Mods can be inserted instead of a \with block (i.e. \with is not required)
69   \new Staff \ctxmod { \mark \markup { "The same mods as staff 2" } \music }
70   \new Staff { \mark \markup { "Back to default" } \music }
71 >>
72 }