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) 1996--2012 Han-Wen Nienhuys <hanwen@xs4all.nl> | 4 Copyright (C) 1996--2012 Han-Wen Nienhuys <hanwen@xs4all.nl> |
5 Jan Nieuwenhuizen <janneke@gnu.org> | 5 Jan Nieuwenhuizen <janneke@gnu.org> |
6 | 6 |
7 TODO: This is way too hairy | 7 TODO: This is way too hairy |
8 | 8 |
9 TODO: fix naming. | 9 TODO: fix naming. |
10 | 10 |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 extpos[UP] = -inf; | 218 extpos[UP] = -inf; |
219 | 219 |
220 Drul_array<Grob *> exthead (0, 0); | 220 Drul_array<Grob *> exthead (0, 0); |
221 extract_grob_set (me, "note-heads", heads); | 221 extract_grob_set (me, "note-heads", heads); |
222 | 222 |
223 for (vsize i = heads.size (); i--;) | 223 for (vsize i = heads.size (); i--;) |
224 { | 224 { |
225 Grob *n = heads[i]; | 225 Grob *n = heads[i]; |
226 int p = Staff_symbol_referencer::get_rounded_position (n); | 226 int p = Staff_symbol_referencer::get_rounded_position (n); |
227 | 227 |
228 Direction d = LEFT; | 228 for (LEFT_and_RIGHT (d)) |
229 do | |
230 { | 229 { |
231 if (d * p > d * extpos[d]) | 230 if (d * p > d * extpos[d]) |
232 { | 231 { |
233 exthead[d] = n; | 232 exthead[d] = n; |
234 extpos[d] = p; | 233 extpos[d] = p; |
235 } | 234 } |
236 } | 235 } |
237 while (flip (&d) != DOWN); | |
238 } | 236 } |
239 return exthead; | 237 return exthead; |
240 } | 238 } |
241 | 239 |
242 /* The staff positions, in ascending order. | 240 /* The staff positions, in ascending order. |
243 * If FILTER, include the main column of noteheads only */ | 241 * If FILTER, include the main column of noteheads only */ |
244 vector<int> | 242 vector<int> |
245 Stem::note_head_positions (Grob *me, bool filter) | 243 Stem::note_head_positions (Grob *me, bool filter) |
246 { | 244 { |
247 vector<int> ps; | 245 vector<int> ps; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 Grob *beam = unsmob_grob (me->get_object ("beam")); | 310 Grob *beam = unsmob_grob (me->get_object ("beam")); |
313 | 311 |
314 Interval iv = internal_height (me, false); | 312 Interval iv = internal_height (me, false); |
315 | 313 |
316 if (!beam) | 314 if (!beam) |
317 return iv; | 315 return iv; |
318 if (calc_beam) | 316 if (calc_beam) |
319 { | 317 { |
320 Interval overshoot; | 318 Interval overshoot; |
321 Direction dir = get_grob_direction (me); | 319 Direction dir = get_grob_direction (me); |
322 Direction d = DOWN; | 320 for (DOWN_and_UP (d)) |
323 do | |
324 overshoot[d] = d == dir ? dir * infinity_f : iv[d]; | 321 overshoot[d] = d == dir ? dir * infinity_f : iv[d]; |
325 while (flip (&d) != DOWN); | |
326 | 322 |
327 vector<Interval> heights; | 323 vector<Interval> heights; |
328 vector<Grob *> my_stems; | 324 vector<Grob *> my_stems; |
329 extract_grob_set (beam, "normal-stems", normal_stems); | 325 extract_grob_set (beam, "normal-stems", normal_stems); |
330 for (vsize i = 0; i < normal_stems.size (); i++) | 326 for (vsize i = 0; i < normal_stems.size (); i++) |
331 if (get_grob_direction (normal_stems[i]) == dir) | 327 if (get_grob_direction (normal_stems[i]) == dir) |
332 { | 328 { |
333 if (normal_stems[i] != me) | 329 if (normal_stems[i] != me) |
334 heights.push_back (Stem::internal_pure_height (normal_stems[i], fa
lse)); | 330 heights.push_back (Stem::internal_pure_height (normal_stems[i], fa
lse)); |
335 else | 331 else |
(...skipping 27 matching lines...) Expand all Loading... |
363 } | 359 } |
364 | 360 |
365 return iv; | 361 return iv; |
366 } | 362 } |
367 | 363 |
368 void | 364 void |
369 Stem::cache_pure_height (Grob *me, Interval iv, Interval my_iv) | 365 Stem::cache_pure_height (Grob *me, Interval iv, Interval my_iv) |
370 { | 366 { |
371 Interval overshoot; | 367 Interval overshoot; |
372 Direction dir = get_grob_direction (me); | 368 Direction dir = get_grob_direction (me); |
373 Direction d = DOWN; | 369 for (DOWN_and_UP (d)) |
374 do | |
375 overshoot[d] = d == dir ? dir * infinity_f : my_iv[d]; | 370 overshoot[d] = d == dir ? dir * infinity_f : my_iv[d]; |
376 while (flip (&d) != DOWN); | |
377 | 371 |
378 iv.intersect (overshoot); | 372 iv.intersect (overshoot); |
379 dynamic_cast<Item *> (me)->cache_pure_height (iv); | 373 dynamic_cast<Item *> (me)->cache_pure_height (iv); |
380 } | 374 } |
381 | 375 |
382 MAKE_SCHEME_CALLBACK (Stem, calc_stem_end_position, 1) | 376 MAKE_SCHEME_CALLBACK (Stem, calc_stem_end_position, 1) |
383 SCM | 377 SCM |
384 Stem::calc_stem_end_position (SCM smob) | 378 Stem::calc_stem_end_position (SCM smob) |
385 { | 379 { |
386 Grob *me = unsmob_grob (smob); | 380 Grob *me = unsmob_grob (smob); |
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1151 ideal_y_ = shortest_y_ = 0; | 1145 ideal_y_ = shortest_y_ = 0; |
1152 dir_ = CENTER; | 1146 dir_ = CENTER; |
1153 } | 1147 } |
1154 | 1148 |
1155 void | 1149 void |
1156 Stem_info::scale (Real x) | 1150 Stem_info::scale (Real x) |
1157 { | 1151 { |
1158 ideal_y_ *= x; | 1152 ideal_y_ *= x; |
1159 shortest_y_ *= x; | 1153 shortest_y_ *= x; |
1160 } | 1154 } |
OLD | NEW |