LEFT | RIGHT |
(no file at all) | |
1 /* | 1 /* |
2 This file is part of LilyPond, the GNU music typesetter. | 2 This file is part of LilyPond, the GNU music typesetter. |
3 | 3 |
4 Copyright (C) 1997--2020 Han-Wen Nienhuys <hanwen@xs4all.nl> | 4 Copyright (C) 1997--2020 Han-Wen Nienhuys <hanwen@xs4all.nl> |
5 | 5 |
6 LilyPond is free software: you can redistribute it and/or modify | 6 LilyPond is free software: you can redistribute it and/or modify |
7 it under the terms of the GNU General Public License as published by | 7 it under the terms of the GNU General Public License as published by |
8 the Free Software Foundation, either version 3 of the License, or | 8 the Free Software Foundation, either version 3 of the License, or |
9 (at your option) any later version. | 9 (at your option) any later version. |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 There is no real processing to a property: just lookup the | 30 There is no real processing to a property: just lookup the |
31 translation unit, and set the property. | 31 translation unit, and set the property. |
32 */ | 32 */ |
33 void | 33 void |
34 Property_iterator::process (Moment mom) | 34 Property_iterator::process (Moment mom) |
35 { | 35 { |
36 Context *o = get_outlet (); | 36 Context *o = get_outlet (); |
37 Music *m = get_music (); | 37 Music *m = get_music (); |
38 | 38 |
39 send_stream_event (o, "SetProperty", m->origin (), | 39 send_stream_event (o, "SetProperty", m->origin (), |
40 ly_symbol2scm ("symbol"), m->get_property ("symbol"), | 40 ly_symbol2scm ("symbol"), get_property (m, "symbol"), |
41 ly_symbol2scm ("value"), m->get_property ("value"), | 41 ly_symbol2scm ("value"), get_property (m, "value"), |
42 ly_symbol2scm ("once"), m->get_property ("once")); | 42 ly_symbol2scm ("once"), get_property (m, "once")); |
43 | 43 |
44 Simple_music_iterator::process (mom); | 44 Simple_music_iterator::process (mom); |
45 } | 45 } |
46 | 46 |
47 void | 47 void |
48 Property_unset_iterator::process (Moment mom) | 48 Property_unset_iterator::process (Moment mom) |
49 { | 49 { |
50 Context *o = get_outlet (); | 50 Context *o = get_outlet (); |
51 Music *m = get_music (); | 51 Music *m = get_music (); |
52 | 52 |
53 send_stream_event (o, "UnsetProperty", m->origin (), | 53 send_stream_event (o, "UnsetProperty", m->origin (), |
54 ly_symbol2scm ("symbol"), m->get_property ("symbol"), | 54 ly_symbol2scm ("symbol"), get_property (m, "symbol"), |
55 ly_symbol2scm ("once"), m->get_property ("once")); | 55 ly_symbol2scm ("once"), get_property (m, "once")); |
56 | 56 |
57 Simple_music_iterator::process (mom); | 57 Simple_music_iterator::process (mom); |
58 } | 58 } |
59 | 59 |
60 bool | 60 bool |
61 check_grob (Music *mus, SCM sym) | 61 check_grob (Music *mus, SCM sym) |
62 { | 62 { |
63 bool g = to_boolean (scm_object_property (sym, ly_symbol2scm ("is-grob?"))); | 63 bool g = to_boolean (scm_object_property (sym, ly_symbol2scm ("is-grob?"))); |
64 | 64 |
65 if (!g) | 65 if (!g) |
66 mus->origin ()->warning (_f ("not a grob name, `%s'", | 66 mus->origin ()->warning (_f ("not a grob name, `%s'", |
67 ly_symbol2string (sym))); | 67 ly_symbol2string (sym))); |
68 | 68 |
69 return g; | 69 return g; |
70 } | 70 } |
71 | 71 |
72 SCM | 72 SCM |
73 get_property_path (Music *m) | 73 get_property_path (Music *m) |
74 { | 74 { |
75 SCM grob_property_path = m->get_property ("grob-property-path"); | 75 SCM grob_property_path = get_property (m, "grob-property-path"); |
76 | 76 |
77 SCM eprop = m->get_property ("grob-property"); | 77 SCM eprop = get_property (m, "grob-property"); |
78 if (scm_is_symbol (eprop)) | 78 if (scm_is_symbol (eprop)) |
79 { | 79 { |
80 grob_property_path = scm_list_1 (eprop); | 80 grob_property_path = scm_list_1 (eprop); |
81 } | 81 } |
82 | 82 |
83 return grob_property_path; | 83 return grob_property_path; |
84 } | 84 } |
85 | 85 |
86 void | 86 void |
87 Push_property_iterator::process (Moment m) | 87 Push_property_iterator::process (Moment m) |
88 { | 88 { |
89 SCM sym = get_music ()->get_property ("symbol"); | 89 SCM sym = get_property (get_music (), "symbol"); |
90 if (check_grob (get_music (), sym)) | 90 if (check_grob (get_music (), sym)) |
91 { | 91 { |
92 SCM grob_property_path = get_property_path (get_music ()); | 92 SCM grob_property_path = get_property_path (get_music ()); |
93 SCM val = get_music ()->get_property ("grob-value"); | 93 SCM val = get_property (get_music (), "grob-value"); |
94 SCM once = get_music ()->get_property ("once"); | 94 SCM once = get_property (get_music (), "once"); |
95 | 95 |
96 if (to_boolean (get_music ()->get_property ("pop-first")) | 96 if (to_boolean (get_property (get_music (), "pop-first")) |
97 && !to_boolean (once)) | 97 && !to_boolean (once)) |
98 send_stream_event (get_outlet (), "Revert", get_music ()->origin (), | 98 send_stream_event (get_outlet (), "Revert", get_music ()->origin (), |
99 ly_symbol2scm ("symbol"), sym, | 99 ly_symbol2scm ("symbol"), sym, |
100 ly_symbol2scm ("property-path"), grob_property_path); | 100 ly_symbol2scm ("property-path"), grob_property_path); |
101 | 101 |
102 send_stream_event (get_outlet (), "Override", get_music ()->origin (), | 102 send_stream_event (get_outlet (), "Override", get_music ()->origin (), |
103 ly_symbol2scm ("symbol"), sym, | 103 ly_symbol2scm ("symbol"), sym, |
104 ly_symbol2scm ("property-path"), grob_property_path, | 104 ly_symbol2scm ("property-path"), grob_property_path, |
105 ly_symbol2scm ("once"), once, | 105 ly_symbol2scm ("once"), once, |
106 ly_symbol2scm ("value"), val); | 106 ly_symbol2scm ("value"), val); |
107 } | 107 } |
108 Simple_music_iterator::process (m); | 108 Simple_music_iterator::process (m); |
109 } | 109 } |
110 | 110 |
111 void | 111 void |
112 Pop_property_iterator::process (Moment mom) | 112 Pop_property_iterator::process (Moment mom) |
113 { | 113 { |
114 Music *m = get_music (); | 114 Music *m = get_music (); |
115 SCM sym = m->get_property ("symbol"); | 115 SCM sym = get_property (m, "symbol"); |
116 | 116 |
117 if (check_grob (m, sym)) | 117 if (check_grob (m, sym)) |
118 { | 118 { |
119 SCM grob_property_path = get_property_path (m); | 119 SCM grob_property_path = get_property_path (m); |
120 | 120 |
121 send_stream_event (get_outlet (), "Revert", m->origin (), | 121 send_stream_event (get_outlet (), "Revert", m->origin (), |
122 ly_symbol2scm ("symbol"), sym, | 122 ly_symbol2scm ("symbol"), sym, |
123 ly_symbol2scm ("once"), m->get_property ("once"), | 123 ly_symbol2scm ("once"), get_property (m, "once"), |
124 ly_symbol2scm ("property-path"), grob_property_path); | 124 ly_symbol2scm ("property-path"), grob_property_path); |
125 } | 125 } |
126 Simple_music_iterator::process (mom); | 126 Simple_music_iterator::process (mom); |
127 } | 127 } |
128 | 128 |
129 IMPLEMENT_CTOR_CALLBACK (Pop_property_iterator); | 129 IMPLEMENT_CTOR_CALLBACK (Pop_property_iterator); |
130 IMPLEMENT_CTOR_CALLBACK (Push_property_iterator); | 130 IMPLEMENT_CTOR_CALLBACK (Push_property_iterator); |
131 IMPLEMENT_CTOR_CALLBACK (Property_iterator); | 131 IMPLEMENT_CTOR_CALLBACK (Property_iterator); |
132 IMPLEMENT_CTOR_CALLBACK (Property_unset_iterator); | 132 IMPLEMENT_CTOR_CALLBACK (Property_unset_iterator); |
LEFT | RIGHT |