lilypond-1.3.118
[lilypond.git] / input / test / pushproperty.ly
blob2d176934f1f0f113715791085ad81514ffee6d8f
1 \version "1.3.117";
3 %{
5 Look at ly/engraver.ly for inspiration on which XXXX
6 there are.
8 Generally, you can find interesting element properties associated with
9 \property in scm/generic-property.scm. For example, this file contains
11 (define generic-stem-properties
12 (cons 'stem-interface
13 (list
14 (list 'stemVerticalDirection dir? 'direction)
15 (list 'verticalDirection dir? 'direction)
16 (list 'stemLength number? 'length)
17 (list 'flagStyle string? 'flag-style)
18 )))
21 which means that setting \property stemVerticalDirection overrides
22 setting \property verticalDirection, and that both have the effect of
23 setting `direction' in Stem object. You can use \overrideproperty for
24 setting stem directions by doing.
27 \overrideproperty #'(Stem) #'direction #1
29 (#-1 if you want down).
31 A modest amount of memory is involved each time you do a
32 \overrideproperty. If you do \revertproperty in the right order (reversed
33 from \overrideproperty), then \revertproperty doesn't cost memory.
35 Correct:
37 \overrideproperty #'( ... ) #'symbolA #valueA
38 \overrideproperty #'( ... ) #'symbolB #valueB
39 \revertproperty #'( ... ) #'symbolB
40 \revertproperty #'( ... ) #'symbolA
42 Incorrect (\revertproperty costs memory):
44 \overrideproperty #'( ... ) #'symbolA #valueA
45 \overrideproperty #'( ... ) #'symbolB #valueB
46 \revertproperty #'( ... ) #'symbolA
47 \revertproperty #'( ... ) #'symbolB
49 You can use identifiers, eg.
51 slursUp = \context Voice \overrideproperty '(Slur)
52 #'direction #1
53 slursBoth = \context Voice \revertproperty '(Slur)
57 \score { \notes
58 \relative c' {
59 c4-.(
60 \property Voice.Dots \override #'direction = #-1
61 \property Voice.Stem \override #'direction = #-1
62 \property Voice.noteColumnProperties \override #'direction = #-1
63 \property Voice.Stem \override #'direction = #-1
65 ) c4-. (
66 ) c4-. (
67 \property Voice.Slur \override #'direction = #-1
68 ) c4-. (
70 \property Dots \revert #'direction
71 \property Stem \revert #'direction
72 \property Script \revert #'direction
73 \property Text \revert #'direction
75 ) c4-. () c4-.
78 \paper {
79 \translator { \VoiceContext
80 NoteHead \override #'font-relative-size = #-2