Left: | ||
Right: |
OLD | NEW |
---|---|
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--2012 Han-Wen Nienhuys <hanwen@xs4all.nl> | 4 Copyright (C) 1997--2012 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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
212 } | 212 } |
213 | 213 |
214 vsize old_slurs = slurs_.size (); | 214 vsize old_slurs = slurs_.size (); |
215 for (vsize i = start_events_.size (); i--;) | 215 for (vsize i = start_events_.size (); i--;) |
216 { | 216 { |
217 Stream_event *ev = start_events_[i]; | 217 Stream_event *ev = start_events_[i]; |
218 string id = robust_scm2string (ev->get_property ("spanner-id"), ""); | 218 string id = robust_scm2string (ev->get_property ("spanner-id"), ""); |
219 Direction updown = to_dir (ev->get_property ("direction")); | 219 Direction updown = to_dir (ev->get_property ("direction")); |
220 | 220 |
221 bool completed; | 221 bool completed; |
222 for (vsize j = 0; !(completed = (j == slurs_.size ())); j++) | 222 for (vsize j = slurs_.size (); !(completed = (j-- == 0));) |
223 { | 223 { |
224 // Check if we already have a slur with the same spanner-id. | 224 // Check if we already have a slur with the same spanner-id. |
225 if (id == robust_scm2string (slurs_[j]->get_property ("spanner-id"), " ")) | 225 if (id == robust_scm2string (slurs_[j]->get_property ("spanner-id"), " ")) |
226 { | 226 { |
227 if (j < old_slurs) | 227 if (j < old_slurs) |
228 { | 228 { |
229 // We already have an old slur, so give a warning | 229 // We already have an old slur, so give a warning |
230 // and completely ignore the new slur. | 230 // and completely ignore the new slur. |
231 ev->origin ()->warning (_ ("already have slur")); | 231 ev->origin ()->warning (_ ("already have slur")); |
232 start_events_.erase (start_events_.begin () + i); | 232 start_events_.erase (start_events_.begin () + i); |
233 break; | 233 break; |
234 } | 234 } |
235 | 235 |
236 // If this slur event has no direction, it will not | 236 // If this slur event has no direction, it will not |
237 // contribute anything new to the existing slur(s), so | 237 // contribute anything new to the existing slur(s), so |
238 // we can ignore it. This is not entirely accurate: | 238 // we can ignore it. |
239 // tweaks or context properties like those set with | |
240 // \slurUp can still override a neutral direction, so | |
241 // when encountering a slur event with "opposite" | |
242 // direction first, then one with neutral direction, we | |
243 // only let the "opposite" direction remain, while if | |
244 // the order is the other way round, a double slur | |
245 // results since the direction of the first slur is no | |
246 // longer attributable to a "neutral" slur event. A | |
247 // mixture of neutral and directed events is nothing | |
248 // that the partcombiner should crank out, and it would | |
249 // be decidedly strange for manual input. | |
250 | 239 |
251 if (!updown) | 240 if (!updown) |
252 break; | 241 break; |
253 | 242 |
243 Stream_event *c = unsmob_stream_event (slurs_[j]->get_property ("c ause")); | |
244 | |
245 if (!c) { | |
246 slurs_[j]->programming_error ("slur without a cause"); | |
247 continue; | |
248 } | |
249 | |
250 Direction slur_dir = to_dir (c->get_property ("direction")); | |
251 | |
254 // If the existing slur does not have a direction yet, | 252 // If the existing slur does not have a direction yet, |
255 // give it ours | 253 // we'd rather take the new one. |
256 | |
257 Direction slur_dir = to_dir (slurs_[j]->get_property ("direction") ); | |
258 | 254 |
259 if (!slur_dir) | 255 if (!slur_dir) |
260 { | 256 { |
261 set_grob_direction (slurs_[j], updown); | 257 » » slurs_[j]->suicide (); |
Trevor Daniels
2012/07/19 09:30:15
no tabs please
| |
262 break; | 258 slurs_.erase (slurs_.begin () + j); |
259 » » continue; | |
Trevor Daniels
2012/07/19 09:30:15
no tabs please
| |
263 } | 260 } |
264 | 261 |
265 // If the existing slur has the same direction as ours, drop ours | 262 // If the existing slur has the same direction as ours, drop ours |
266 | 263 |
267 if (slur_dir == updown) | 264 if (slur_dir == updown) |
268 break; | 265 break; |
269 } | 266 } |
270 } | 267 } |
271 // If the loop completed, our slur is new | 268 // If the loop completed, our slur is new |
272 if (completed) | 269 if (completed) |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
335 /* create */ | 332 /* create */ |
336 "Slur ", | 333 "Slur ", |
337 | 334 |
338 /* read */ | 335 /* read */ |
339 "slurMelismaBusy " | 336 "slurMelismaBusy " |
340 "doubleSlurs ", | 337 "doubleSlurs ", |
341 | 338 |
342 /* write */ | 339 /* write */ |
343 "" | 340 "" |
344 ); | 341 ); |
OLD | NEW |