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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 Script_engraver::Script_engraver (Context *c) | 72 Script_engraver::Script_engraver (Context *c) |
73 : Engraver (c) | 73 : Engraver (c) |
74 { | 74 { |
75 } | 75 } |
76 | 76 |
77 void | 77 void |
78 Script_engraver::listen_articulation (Stream_event *ev) | 78 Script_engraver::listen_articulation (Stream_event *ev) |
79 { | 79 { |
80 /* Discard double articulations for part-combining. */ | 80 /* Discard double articulations for part-combining. */ |
81 for (vsize i = 0; i < scripts_.size (); i++) | 81 for (vsize i = 0; i < scripts_.size (); i++) |
82 if (ly_is_equal (scripts_[i].event_ | 82 if (ly_is_equal (get_property (scripts_[i].event_ |
83 ->get_property ("articulation-type"), | 83 , "articulation-type"), |
84 ev->get_property ("articulation-type"))) | 84 get_property (ev, "articulation-type"))) |
85 return; | 85 return; |
86 | 86 |
87 Script_tuple t; | 87 Script_tuple t; |
88 t.event_ = ev; | 88 t.event_ = ev; |
89 scripts_.push_back (t); | 89 scripts_.push_back (t); |
90 } | 90 } |
91 | 91 |
92 void | 92 void |
93 copy_property (Grob *g, SCM sym, SCM alist) | 93 copy_property (Grob *g, SCM sym, SCM alist) |
94 { | 94 { |
95 if (scm_is_null (g->get_property (sym))) | 95 if (scm_is_null (get_property (g, sym))) |
96 { | 96 { |
97 SCM entry = scm_assoc (sym, alist); | 97 SCM entry = scm_assoc (sym, alist); |
98 if (scm_is_pair (entry)) | 98 if (scm_is_pair (entry)) |
99 g->set_property (sym, scm_cdr (entry)); | 99 set_property (g, sym, scm_cdr (entry)); |
100 } | 100 } |
101 } | 101 } |
102 | 102 |
103 /* Add the properties, one by one for each Script. A little memory | 103 /* Add the properties, one by one for each Script. A little memory |
104 could be saved by tacking the props onto the Script grob (i.e. make | 104 could be saved by tacking the props onto the Script grob (i.e. make |
105 ScriptStaccato , ScriptMarcato, etc. ). | 105 ScriptStaccato , ScriptMarcato, etc. ). |
106 */ | 106 */ |
107 void | 107 void |
108 make_script_from_event (Grob *p, Context *tg, SCM art_type, size_t index) | 108 make_script_from_event (Grob *p, Context *tg, SCM art_type, size_t index) |
109 { | 109 { |
110 SCM alist = tg->get_property ("scriptDefinitions"); | 110 SCM alist = get_property (tg, "scriptDefinitions"); |
111 SCM art = scm_assoc (art_type, alist); | 111 SCM art = scm_assoc (art_type, alist); |
112 | 112 |
113 if (scm_is_false (art)) | 113 if (scm_is_false (art)) |
114 { | 114 { |
115 /* FIXME: */ | 115 /* FIXME: */ |
116 warning (_ ("do not know how to interpret articulation:")); | 116 warning (_ ("do not know how to interpret articulation:")); |
117 warning (_ (" scheme encoding: ")); | 117 warning (_ (" scheme encoding: ")); |
118 scm_write (art_type, scm_current_error_port ()); | 118 scm_write (art_type, scm_current_error_port ()); |
119 message (""); | 119 message (""); |
120 return; | 120 return; |
(...skipping 14 matching lines...) Expand all Loading... |
135 | 135 |
136 if (scm_is_eq (sym, ly_symbol2scm ("script-priority"))) | 136 if (scm_is_eq (sym, ly_symbol2scm ("script-priority"))) |
137 { | 137 { |
138 priority_found = true; | 138 priority_found = true; |
139 /* Make sure they're in order of user input by adding index i. | 139 /* Make sure they're in order of user input by adding index i. |
140 Don't use the direction in this priority. Smaller means closer | 140 Don't use the direction in this priority. Smaller means closer |
141 to the head. */ | 141 to the head. */ |
142 val = scm_sum (val, scm_from_size_t (index)); | 142 val = scm_sum (val, scm_from_size_t (index)); |
143 } | 143 } |
144 | 144 |
145 SCM preset = p->get_property_data (sym); | 145 SCM preset = get_property_data (p, sym); |
146 if (scm_is_null (val) | 146 if (scm_is_null (val) |
147 || scm_is_false (scm_call_1 (type, preset))) | 147 || scm_is_false (scm_call_1 (type, preset))) |
148 p->set_property (sym, val); | 148 set_property (p, sym, val); |
149 } | 149 } |
150 | 150 |
151 if (!priority_found) | 151 if (!priority_found) |
152 { | 152 { |
153 p->set_property ("script-priority", scm_from_size_t (index)); | 153 set_property (p, "script-priority", scm_from_size_t (index)); |
154 } | 154 } |
155 } | 155 } |
156 | 156 |
157 void | 157 void |
158 Script_engraver::process_music () | 158 Script_engraver::process_music () |
159 { | 159 { |
160 for (vsize i = 0; i < scripts_.size (); i++) | 160 for (vsize i = 0; i < scripts_.size (); i++) |
161 { | 161 { |
162 Stream_event *ev = scripts_[i].event_; | 162 Stream_event *ev = scripts_[i].event_; |
163 | 163 |
164 Grob *p = make_item ("Script", ev->self_scm ()); | 164 Grob *p = make_item ("Script", ev->self_scm ()); |
165 | 165 |
166 make_script_from_event (p, context (), | 166 make_script_from_event (p, context (), |
167 ev->get_property ("articulation-type"), | 167 get_property (ev, "articulation-type"), |
168 i); | 168 i); |
169 | 169 |
170 scripts_[i].script_ = p; | 170 scripts_[i].script_ = p; |
171 | 171 |
172 SCM force_dir = ev->get_property ("direction"); | 172 SCM force_dir = get_property (ev, "direction"); |
173 if (is_direction (force_dir) && to_dir (force_dir)) | 173 if (is_direction (force_dir) && to_dir (force_dir)) |
174 p->set_property ("direction", force_dir); | 174 set_property (p, "direction", force_dir); |
175 } | 175 } |
176 } | 176 } |
177 | 177 |
178 void | 178 void |
179 Script_engraver::acknowledge_stem (Grob_info info) | 179 Script_engraver::acknowledge_stem (Grob_info info) |
180 { | 180 { |
181 for (vsize i = 0; i < scripts_.size (); i++) | 181 for (vsize i = 0; i < scripts_.size (); i++) |
182 { | 182 { |
183 Grob *e = scripts_[i].script_; | 183 Grob *e = scripts_[i].script_; |
184 | 184 |
185 if (to_dir (e->get_property ("side-relative-direction"))) | 185 if (to_dir (get_property (e, "side-relative-direction"))) |
186 e->set_object ("direction-source", info.grob ()->self_scm ()); | 186 set_object (e, "direction-source", info.grob ()->self_scm ()); |
187 | 187 |
188 Side_position_interface::add_support (e, info.grob ()); | 188 Side_position_interface::add_support (e, info.grob ()); |
189 } | 189 } |
190 } | 190 } |
191 | 191 |
192 void | 192 void |
193 Script_engraver::acknowledge_stem_tremolo (Grob_info info) | 193 Script_engraver::acknowledge_stem_tremolo (Grob_info info) |
194 { | 194 { |
195 for (vsize i = 0; i < scripts_.size (); i++) | 195 for (vsize i = 0; i < scripts_.size (); i++) |
196 { | 196 { |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 | 292 |
293 /* create */ | 293 /* create */ |
294 "Script ", | 294 "Script ", |
295 | 295 |
296 /* read */ | 296 /* read */ |
297 "scriptDefinitions ", | 297 "scriptDefinitions ", |
298 | 298 |
299 /* write */ | 299 /* write */ |
300 "" | 300 "" |
301 ); | 301 ); |
LEFT | RIGHT |