]> git.donarmstrong.com Git - lilypond.git/blob - input/test/pushproperty.ly
release: 1.3.94
[lilypond.git] / input / test / pushproperty.ly
1 \version "1.3.93";
2
3 %{
4
5 Look at ly/engraver.ly for inspiration on which XXXX
6 there are.
7
8 Generally, you can find interesting element properties associated with
9 \property in scm/generic-property.scm. For example, this file contains
10
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         )))
19
20
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 \pushproperty for
24 setting stem directions by doing.
25
26
27         \pushproperty #'(Stem) #'direction #1
28
29 (#-1 if you want down).  
30
31 A modest amount of memory is involved each time you do a
32 \pushproperty. If you do \popproperty in the right order (reversed
33 from \pushproperty), then \popproperty doesn't cost memory.
34
35 Correct:
36
37         \pushproperty #'(  ... ) #'symbolA #valueA
38         \pushproperty #'(  ... ) #'symbolB #valueB
39         \popproperty #'(  ... ) #'symbolB 
40         \popproperty #'(  ... ) #'symbolA 
41
42 Incorrect (\popproperty costs memory):
43
44         \pushproperty #'(  ... ) #'symbolA #valueA
45         \pushproperty #'(  ... ) #'symbolB #valueB
46         \popproperty #'(  ... ) #'symbolA 
47         \popproperty #'(  ... ) #'symbolB 
48
49 You can use identifiers, eg.
50
51     slursUp = \context Voice \pushproperty '(Slur)
52             #'direction  #1
53     slursBoth = \context Voice \popproperty '(Slur)
54
55 %}
56
57 \score { \notes
58 \relative c' {
59         c4-.(
60         \property Voice.Dots \push #'direction =  #-1
61         \property Voice.Stem \push #'direction =  #-1
62         \property Voice.noteColumnProperties \push #'direction =  #-1
63         \property Voice.Stem \push #'direction =  #-1           
64         
65         ) c4-. (
66         ) c4-. (        
67          \property Voice.Slur \push #'direction =  #-1
68         ) c4-. (
69
70         \property Dots \pop  #'direction
71         \property Stem \pop #'direction
72         \property Script \pop #'direction
73         \property Text \pop #'direction
74
75          ) c4-.  () c4-. 
76 }
77
78 \paper {
79 \translator { \VoiceContext
80         NoteHead \push #'font-size =  #-2
81 }
82 }
83 }