LEFT | RIGHT |
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 LilyPond is free software: you can redistribute it and/or modify | 7 LilyPond is free software: you can redistribute it and/or modify |
8 it under the terms of the GNU General Public License as published by | 8 it under the terms of the GNU General Public License as published by |
9 the Free Software Foundation, either version 3 of the License, or | 9 the Free Software Foundation, either version 3 of the License, or |
10 (at your option) any later version. | 10 (at your option) any later version. |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "slur-scoring.hh" | 21 #include "slur-scoring.hh" |
22 | 22 |
23 #include <queue> | 23 #include <queue> |
24 | 24 |
25 #include "axis-group-interface.hh" | 25 #include "axis-group-interface.hh" |
26 #include "accidental-interface.hh" | 26 #include "accidental-interface.hh" |
27 #include "beam.hh" | 27 #include "beam.hh" |
28 #include "clef.hh" | 28 #include "clef.hh" |
29 #include "directional-element-interface.hh" | 29 #include "directional-element-interface.hh" |
30 #include "dots.hh" | 30 #include "dots.hh" |
| 31 #include "international.hh" |
31 #include "libc-extension.hh" | 32 #include "libc-extension.hh" |
32 #include "main.hh" | 33 #include "main.hh" |
33 #include "misc.hh" | 34 #include "misc.hh" |
34 #include "note-column.hh" | 35 #include "note-column.hh" |
35 #include "output-def.hh" | 36 #include "output-def.hh" |
36 #include "paper-column.hh" | 37 #include "paper-column.hh" |
37 #include "pitch.hh" | 38 #include "pitch.hh" |
38 #include "pointer-group-interface.hh" | 39 #include "pointer-group-interface.hh" |
39 #include "slur-configuration.hh" | 40 #include "slur-configuration.hh" |
40 #include "slur.hh" | 41 #include "slur.hh" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 Slur_score_state::get_encompass_info (Grob *col) const | 110 Slur_score_state::get_encompass_info (Grob *col) const |
110 { | 111 { |
111 Grob *stem = unsmob_grob (col->get_object ("stem")); | 112 Grob *stem = unsmob_grob (col->get_object ("stem")); |
112 Encompass_info ei; | 113 Encompass_info ei; |
113 | 114 |
114 if (!stem) | 115 if (!stem) |
115 { | 116 { |
116 programming_error ("no stem for note column"); | 117 programming_error ("no stem for note column"); |
117 ei.x_ = col->relative_coordinate (common_[X_AXIS], X_AXIS); | 118 ei.x_ = col->relative_coordinate (common_[X_AXIS], X_AXIS); |
118 ei.head_ = ei.stem_ = col->maybe_pure_extent (common_[Y_AXIS], | 119 ei.head_ = ei.stem_ = col->maybe_pure_extent (common_[Y_AXIS], |
119 Y_AXIS, stub_, 0, INT_MAX)[dir_]; | 120 Y_AXIS, stub_, spanned_rank_interval_[L
EFT], spanned_rank_interval_[RIGHT])[dir_]; |
120 return ei; | 121 return ei; |
121 } | 122 } |
122 Direction stem_dir = get_grob_direction (stem); | 123 Direction stem_dir = get_grob_direction (stem); |
123 | 124 |
124 if (Grob *head = Note_column::first_head (col)) | 125 if (Grob *head = Note_column::first_head (col)) |
125 ei.x_ = head->extent (common_[X_AXIS], X_AXIS).center (); | 126 ei.x_ = head->extent (common_[X_AXIS], X_AXIS).center (); |
126 else | 127 else |
127 ei.x_ = col->extent (common_[X_AXIS], X_AXIS).center (); | 128 ei.x_ = col->extent (common_[X_AXIS], X_AXIS).center (); |
128 | 129 |
129 Grob *h = Stem::extremal_heads (stem)[Direction (dir_)]; | 130 Grob *h = Stem::extremal_heads (stem)[Direction (dir_)]; |
130 if (!h) | 131 if (!h) |
131 { | 132 { |
132 ei.head_ = ei.stem_ = col->maybe_pure_extent (common_[Y_AXIS], Y_AXIS, stu
b_, 0, INT_MAX)[dir_]; | 133 ei.head_ = ei.stem_ = col->maybe_pure_extent (common_[Y_AXIS], Y_AXIS, stu
b_, spanned_rank_interval_[LEFT], spanned_rank_interval_[RIGHT])[dir_]; |
133 return ei; | 134 return ei; |
134 } | 135 } |
135 | 136 |
136 ei.head_ = h->maybe_pure_extent (common_[Y_AXIS], Y_AXIS, stub_, 0, INT_MAX)[d
ir_]; | 137 ei.head_ = h->maybe_pure_extent (common_[Y_AXIS], Y_AXIS, stub_, spanned_rank_
interval_[LEFT], spanned_rank_interval_[RIGHT])[dir_]; |
137 | 138 |
138 if ((stem_dir == dir_) | 139 if ((stem_dir == dir_) |
139 && !stem->maybe_pure_extent (stem, Y_AXIS, stub_, 0, INT_MAX).is_empty ()) | 140 && !stem->maybe_pure_extent (stem, Y_AXIS, stub_, spanned_rank_interval_[L
EFT], spanned_rank_interval_[RIGHT]).is_empty ()) |
140 { | 141 { |
141 ei.stem_ = stem->maybe_pure_extent (common_[Y_AXIS], Y_AXIS, stub_, 0, INT
_MAX)[dir_]; | 142 ei.stem_ = stem->maybe_pure_extent (common_[Y_AXIS], Y_AXIS, stub_, spanne
d_rank_interval_[LEFT], spanned_rank_interval_[RIGHT])[dir_]; |
142 if (Grob *b = Stem::get_beam (stem)) | 143 if (Grob *b = Stem::get_beam (stem)) |
143 ei.stem_ += stem_dir * 0.5 * Beam::get_beam_thickness (b); | 144 ei.stem_ += stem_dir * 0.5 * Beam::get_beam_thickness (b); |
144 | 145 |
145 Interval x = stem->extent (common_[X_AXIS], X_AXIS); | 146 Interval x = stem->extent (common_[X_AXIS], X_AXIS); |
146 ei.x_ = x.is_empty () | 147 ei.x_ = x.is_empty () |
147 ? stem->relative_coordinate (common_[X_AXIS], X_AXIS) | 148 ? stem->relative_coordinate (common_[X_AXIS], X_AXIS) |
148 : x.center (); | 149 : x.center (); |
149 } | 150 } |
150 else | 151 else |
151 ei.stem_ = ei.head_; | 152 ei.stem_ = ei.head_; |
(...skipping 17 matching lines...) Expand all Loading... |
169 extremes[d].stem_ = Note_column::get_stem (extremes[d].note_column_); | 170 extremes[d].stem_ = Note_column::get_stem (extremes[d].note_column_); |
170 extremes[d].flag_ = Note_column::get_flag (extremes[d].note_column_); | 171 extremes[d].flag_ = Note_column::get_flag (extremes[d].note_column_); |
171 | 172 |
172 if (extremes[d].stem_) | 173 if (extremes[d].stem_) |
173 { | 174 { |
174 extremes[d].stem_dir_ = get_grob_direction (extremes[d].stem_); | 175 extremes[d].stem_dir_ = get_grob_direction (extremes[d].stem_); |
175 | 176 |
176 for (int a = X_AXIS; a < NO_AXES; a++) | 177 for (int a = X_AXIS; a < NO_AXES; a++) |
177 { | 178 { |
178 Axis ax = Axis (a); | 179 Axis ax = Axis (a); |
179 Interval s = extremes[d].stem_->maybe_pure_extent (common_[ax]
, ax, stub_, 0, INT_MAX); | 180 Interval s = ax == Y_AXIS |
| 181 ? extremes[d].stem_->maybe_pure_extent (common_[a
x], ax, stub_, spanned_rank_interval_[LEFT], spanned_rank_interval_[RIGHT]) |
| 182 : extremes[d].stem_->extent (common_[ax], ax); |
180 if (extremes[d].flag_) | 183 if (extremes[d].flag_) |
181 s.unite (extremes[d].flag_->maybe_pure_extent (common_[ax],
ax, stub_, 0, INT_MAX)); | 184 s.unite (ax == Y_AXIS |
| 185 ? extremes[d].flag_->maybe_pure_extent (common_[ax]
, ax, stub_, spanned_rank_interval_[LEFT], spanned_rank_interval_[RIGHT]) |
| 186 : extremes[d].flag_->extent (common_[ax], ax)); |
182 if (s.is_empty ()) | 187 if (s.is_empty ()) |
183 { | 188 { |
184 /* | 189 /* |
185 do not issue warning. This happens for rests and | 190 do not issue warning. This happens for rests and |
186 whole notes. | 191 whole notes. |
187 */ | 192 */ |
188 s = Interval (0, 0) | 193 s = Interval (0, 0) |
189 + extremes[d].stem_->maybe_pure_coordinate (common_[ax
], ax, stub_, 0, INT_MAX); | 194 + (ax == Y_AXIS |
| 195 ? extremes[d].stem_->maybe_pure_coordinate (common_
[ax], ax, stub_, spanned_rank_interval_[LEFT], spanned_rank_interval_[RIGHT]) |
| 196 : extremes[d].stem_->relative_coordinate (common_[a
x], ax)); |
190 } | 197 } |
191 extremes[d].stem_extent_[ax] = s; | 198 extremes[d].stem_extent_[ax] = s; |
192 } | 199 } |
193 | 200 |
194 extremes[d].slur_head_ | 201 extremes[d].slur_head_ |
195 = Stem::extremal_heads (extremes[d].stem_)[dir]; | 202 = Stem::extremal_heads (extremes[d].stem_)[dir]; |
196 if (!extremes[d].slur_head_ | 203 if (!extremes[d].slur_head_ |
197 && Note_column::has_rests (extremes[d].bound_)) | 204 && Note_column::has_rests (extremes[d].bound_)) |
198 extremes[d].slur_head_ = Note_column::get_rest (extremes[d].boun
d_); | 205 extremes[d].slur_head_ = Note_column::get_rest (extremes[d].boun
d_); |
199 extremes[d].staff_ = Staff_symbol_referencer | 206 extremes[d].staff_ = Staff_symbol_referencer |
200 ::get_staff_symbol (extremes[d].stem_); | 207 ::get_staff_symbol (extremes[d].stem_); |
201 extremes[d].staff_space_ = Staff_symbol_referencer | 208 extremes[d].staff_space_ = Staff_symbol_referencer |
202 ::staff_space (extremes[d].stem_); | 209 ::staff_space (extremes[d].stem_); |
203 } | 210 } |
204 | 211 |
205 if (extremes[d].slur_head_) | 212 if (extremes[d].slur_head_) |
206 extremes[d].slur_head_x_extent_ | 213 extremes[d].slur_head_x_extent_ |
207 = extremes[d].slur_head_->extent (common_[X_AXIS], X_AXIS); | 214 = extremes[d].slur_head_->extent (common_[X_AXIS], X_AXIS); |
208 | 215 |
209 } | 216 } |
210 } | 217 } |
211 | 218 |
212 return extremes; | 219 return extremes; |
213 } | 220 } |
214 | 221 |
215 void | 222 void |
216 Slur_score_state::fill (Grob *me) | 223 Slur_score_state::fill (Grob *me) |
217 { | 224 { |
218 slur_ = dynamic_cast<Spanner *> (me); | 225 slur_ = dynamic_cast<Spanner *> (me); |
219 stub_ = slur_->internal_has_interface (ly_symbol2scm ("slur-stub-interface")); | 226 stub_ = slur_->internal_has_interface (ly_symbol2scm ("cross-staff-stub-interf
ace")); |
| 227 spanned_rank_interval_ = slur_->spanned_rank_interval (); |
220 | 228 |
221 columns_ | 229 columns_ |
222 = internal_extract_grob_array (me, ly_symbol2scm ("note-columns")); | 230 = internal_extract_grob_array (me, ly_symbol2scm ("note-columns")); |
223 | 231 |
224 if (columns_.empty ()) | 232 if (columns_.empty ()) |
225 { | 233 { |
226 me->suicide (); | 234 me->suicide (); |
227 return; | 235 return; |
228 } | 236 } |
229 | 237 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 encompass_infos_.push_back (get_encompass_info (columns_[i])); | 320 encompass_infos_.push_back (get_encompass_info (columns_[i])); |
313 | 321 |
314 valid_ = true; | 322 valid_ = true; |
315 | 323 |
316 musical_dy_ = 0.0; | 324 musical_dy_ = 0.0; |
317 for (LEFT_and_RIGHT (d)) | 325 for (LEFT_and_RIGHT (d)) |
318 { | 326 { |
319 if (!is_broken_ | 327 if (!is_broken_ |
320 && extremes_[d].slur_head_) | 328 && extremes_[d].slur_head_) |
321 musical_dy_ += d | 329 musical_dy_ += d |
322 * extremes_[d].slur_head_->maybe_pure_coordinate (common_
[Y_AXIS], Y_AXIS, stub_, 0, INT_MAX); | 330 * extremes_[d].slur_head_->maybe_pure_coordinate (common_
[Y_AXIS], Y_AXIS, stub_, spanned_rank_interval_[LEFT], spanned_rank_interval_[RI
GHT]); |
323 } | 331 } |
324 | 332 |
325 edge_has_beams_ | 333 edge_has_beams_ |
326 = (extremes_[LEFT].stem_ && Stem::get_beam (extremes_[LEFT].stem_)) | 334 = (extremes_[LEFT].stem_ && Stem::get_beam (extremes_[LEFT].stem_)) |
327 || (extremes_[RIGHT].stem_ && Stem::get_beam (extremes_[RIGHT].stem_)); | 335 || (extremes_[RIGHT].stem_ && Stem::get_beam (extremes_[RIGHT].stem_)); |
328 | 336 |
329 if (is_broken_) | 337 if (is_broken_) |
330 musical_dy_ = 0.0; | 338 musical_dy_ = 0.0; |
331 } | 339 } |
332 | 340 |
333 MAKE_SCHEME_CALLBACK (Slur, calc_control_points, 1) | 341 MAKE_SCHEME_CALLBACK (Slur, calc_control_points, 1) |
334 SCM | 342 SCM |
335 Slur::calc_control_points (SCM smob) | 343 Slur::calc_control_points (SCM smob) |
336 { | 344 { |
337 Spanner *me = unsmob_spanner (smob); | 345 Spanner *me = unsmob_spanner (smob); |
| 346 |
| 347 if (!to_boolean (me->get_property ("cross-staff")) |
| 348 && me->internal_has_interface (ly_symbol2scm ("cross-staff-stub-interface"
))) |
| 349 { |
| 350 me->suicide (); |
| 351 return SCM_EOL; |
| 352 } |
338 | 353 |
339 Slur_score_state state; | 354 Slur_score_state state; |
340 state.fill (me); | 355 state.fill (me); |
341 | 356 |
342 if (!state.valid_) | 357 if (!state.valid_) |
343 return SCM_EOL; | 358 return SCM_EOL; |
344 | 359 |
345 state.generate_curves (); | 360 state.generate_curves (); |
346 | 361 |
347 SCM end_ys = me->get_property ("positions"); | 362 SCM end_ys = me->get_property ("positions"); |
(...skipping 21 matching lines...) Expand all Loading... |
369 me->set_property ("annotation", ly_string2scm (total)); | 384 me->set_property ("annotation", ly_string2scm (total)); |
370 } | 385 } |
371 #endif | 386 #endif |
372 | 387 |
373 SCM controls = SCM_EOL; | 388 SCM controls = SCM_EOL; |
374 for (int i = 4; i--;) | 389 for (int i = 4; i--;) |
375 { | 390 { |
376 Offset o = best->curve_.control_[i] | 391 Offset o = best->curve_.control_[i] |
377 - Offset (me->relative_coordinate (state.common_[X_AXIS], X_AXI
S), | 392 - Offset (me->relative_coordinate (state.common_[X_AXIS], X_AXI
S), |
378 me->maybe_pure_coordinate (state.common_[Y_AXIS], Y_A
XIS, | 393 me->maybe_pure_coordinate (state.common_[Y_AXIS], Y_A
XIS, |
379 me->internal_has_interface (ly_symbol2scm ("slur-
stub-interface")), 0, INT_MAX)); | 394 state.stub_, state.spanned_rank_interval_[LEFT],
state.spanned_rank_interval_[RIGHT])); |
380 | 395 |
381 controls = scm_cons (ly_offset2scm (o), controls); | 396 controls = scm_cons (ly_offset2scm (o), controls); |
382 } | 397 } |
383 | 398 |
384 return controls; | 399 return controls; |
385 } | 400 } |
386 | 401 |
387 Slur_configuration * | 402 Slur_configuration * |
388 Slur_score_state::get_forced_configuration (Interval ys) const | 403 Slur_score_state::get_forced_configuration (Interval ys) const |
389 { | 404 { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 { | 476 { |
462 Drul_array<Real> end_ys; | 477 Drul_array<Real> end_ys; |
463 for (LEFT_and_RIGHT (d)) | 478 for (LEFT_and_RIGHT (d)) |
464 { | 479 { |
465 if (extremes_[d].note_column_) | 480 if (extremes_[d].note_column_) |
466 { | 481 { |
467 end_ys[d] = dir_ | 482 end_ys[d] = dir_ |
468 * max (max (dir_ * (base_attachments_[d][Y_AXIS] | 483 * max (max (dir_ * (base_attachments_[d][Y_AXIS] |
469 + parameters_.region_size_ * dir_), | 484 + parameters_.region_size_ * dir_), |
470 dir_ * (dir_ + extremes_[d].note_column_->mayb
e_pure_extent | 485 dir_ * (dir_ + extremes_[d].note_column_->mayb
e_pure_extent |
471 (common_[Y_AXIS], Y_AXIS, stu
b_, 0, INT_MAX)[dir_])), | 486 (common_[Y_AXIS], Y_AXIS, stu
b_, spanned_rank_interval_[LEFT], spanned_rank_interval_[RIGHT])[dir_])), |
472 dir_ * base_attachments_[-d][Y_AXIS]); | 487 dir_ * base_attachments_[-d][Y_AXIS]); |
473 } | 488 } |
474 else | 489 else |
475 end_ys[d] = base_attachments_[d][Y_AXIS] + parameters_.region_size_ * di
r_; | 490 end_ys[d] = base_attachments_[d][Y_AXIS] + parameters_.region_size_ * di
r_; |
476 } | 491 } |
477 | 492 |
478 return end_ys; | 493 return end_ys; |
479 } | 494 } |
480 | 495 |
481 bool | 496 bool |
(...skipping 29 matching lines...) Expand all Loading... |
511 */ | 526 */ |
512 if (stem | 527 if (stem |
513 && !Stem::is_invisible (stem) | 528 && !Stem::is_invisible (stem) |
514 && extremes_[d].stem_dir_ == dir_ | 529 && extremes_[d].stem_dir_ == dir_ |
515 && Stem::get_beaming (stem, -d) | 530 && Stem::get_beaming (stem, -d) |
516 && Stem::get_beam (stem) | 531 && Stem::get_beam (stem) |
517 && (!spanner_less (slur_, Stem::get_beam (stem)) | 532 && (!spanner_less (slur_, Stem::get_beam (stem)) |
518 || has_same_beam_)) | 533 || has_same_beam_)) |
519 y = extremes_[d].stem_extent_[Y_AXIS][dir_]; | 534 y = extremes_[d].stem_extent_[Y_AXIS][dir_]; |
520 else if (head) | 535 else if (head) |
521 y = head->maybe_pure_extent (common_[Y_AXIS], Y_AXIS, stub_, 0, INT_
MAX)[dir_]; | 536 y = head->maybe_pure_extent (common_[Y_AXIS], Y_AXIS, stub_, spanned
_rank_interval_[LEFT], spanned_rank_interval_[RIGHT])[dir_]; |
522 y += dir_ * 0.5 * staff_space_; | 537 y += dir_ * 0.5 * staff_space_; |
523 | 538 |
524 y = move_away_from_staffline (y, head); | 539 y = move_away_from_staffline (y, head); |
525 | 540 |
526 Grob *fh = Note_column::first_head (extremes_[d].note_column_); | 541 Grob *fh = Note_column::first_head (extremes_[d].note_column_); |
527 x | 542 x |
528 = (fh ? fh->extent (common_[X_AXIS], X_AXIS) | 543 = (fh ? fh->extent (common_[X_AXIS], X_AXIS) |
529 : extremes_[d].bound_->extent (common_[X_AXIS], X_AXIS)) | 544 : extremes_[d].bound_->extent (common_[X_AXIS], X_AXIS)) |
530 .linear_combination (CENTER); | 545 .linear_combination (CENTER); |
531 } | 546 } |
(...skipping 11 matching lines...) Expand all Loading... |
543 if (ext.is_empty ()) | 558 if (ext.is_empty ()) |
544 ext = Axis_group_interface:: | 559 ext = Axis_group_interface:: |
545 generic_bound_extent (extremes_[d].bound_, | 560 generic_bound_extent (extremes_[d].bound_, |
546 common_[X_AXIS], X_AXIS); | 561 common_[X_AXIS], X_AXIS); |
547 x = ext[-d]; | 562 x = ext[-d]; |
548 | 563 |
549 Grob *col = (d == LEFT) ? columns_[0] : columns_.back (); | 564 Grob *col = (d == LEFT) ? columns_[0] : columns_.back (); |
550 | 565 |
551 if (extremes_[-d].bound_ != col) | 566 if (extremes_[-d].bound_ != col) |
552 { | 567 { |
553 y = maybe_pure_robust_relative_extent (col, common_[Y_AXIS], Y_AXI
S, stub_, 0, INT_MAX)[dir_]; | 568 y = maybe_pure_robust_relative_extent (col, common_[Y_AXIS], Y_AXI
S, stub_, spanned_rank_interval_[LEFT], spanned_rank_interval_[RIGHT])[dir_]; |
554 y += dir_ * 0.5 * staff_space_; | 569 y += dir_ * 0.5 * staff_space_; |
555 | 570 |
556 if (get_grob_direction (col) == dir_ | 571 if (get_grob_direction (col) == dir_ |
557 && Note_column::get_stem (col) | 572 && Note_column::get_stem (col) |
558 && !Stem::is_invisible (Note_column::get_stem (col))) | 573 && !Stem::is_invisible (Note_column::get_stem (col))) |
559 y -= dir_ * 1.5 * staff_space_; | 574 y -= dir_ * 1.5 * staff_space_; |
560 } | 575 } |
561 else | 576 else |
562 y = base_attachment[-d][Y_AXIS]; | 577 y = base_attachment[-d][Y_AXIS]; |
563 | 578 |
(...skipping 26 matching lines...) Expand all Loading... |
590 { | 605 { |
591 if (!on_staff) | 606 if (!on_staff) |
592 return y; | 607 return y; |
593 | 608 |
594 Grob *staff_symbol = Staff_symbol_referencer::get_staff_symbol (on_staff); | 609 Grob *staff_symbol = Staff_symbol_referencer::get_staff_symbol (on_staff); |
595 if (!staff_symbol) | 610 if (!staff_symbol) |
596 return y; | 611 return y; |
597 | 612 |
598 Real pos | 613 Real pos |
599 = (y - staff_symbol->maybe_pure_coordinate (common_[Y_AXIS], | 614 = (y - staff_symbol->maybe_pure_coordinate (common_[Y_AXIS], |
600 Y_AXIS, stub_, 0, INT_MAX)) | 615 Y_AXIS, stub_, spanned_rank_interv
al_[LEFT], spanned_rank_interval_[RIGHT])) |
601 * 2.0 / staff_space_; | 616 * 2.0 / staff_space_; |
602 | 617 |
603 if (fabs (pos - my_round (pos)) < 0.2 | 618 if (fabs (pos - my_round (pos)) < 0.2 |
604 && Staff_symbol_referencer::on_staff_line (on_staff, (int) rint (pos))) | 619 && Staff_symbol_referencer::on_staff_line (on_staff, (int) rint (pos))) |
605 y += 1.5 * staff_space_ * dir_ / 10; | 620 y += 1.5 * staff_space_ * dir_ / 10; |
606 | 621 |
607 return y; | 622 return y; |
608 } | 623 } |
609 | 624 |
610 vector<Offset> | 625 vector<Offset> |
(...skipping 17 matching lines...) Expand all Loading... |
628 extract_grob_set (slur_, "encompass-objects", extra_encompasses); | 643 extract_grob_set (slur_, "encompass-objects", extra_encompasses); |
629 for (vsize i = 0; i < extra_encompasses.size (); i++) | 644 for (vsize i = 0; i < extra_encompasses.size (); i++) |
630 { | 645 { |
631 if (Slur::has_interface (extra_encompasses[i])) | 646 if (Slur::has_interface (extra_encompasses[i])) |
632 { | 647 { |
633 Grob *small_slur = extra_encompasses[i]; | 648 Grob *small_slur = extra_encompasses[i]; |
634 Bezier b = Slur::get_curve (small_slur); | 649 Bezier b = Slur::get_curve (small_slur); |
635 | 650 |
636 Offset z = b.curve_point (0.5); | 651 Offset z = b.curve_point (0.5); |
637 z += Offset (small_slur->relative_coordinate (common_[X_AXIS], X_AXIS)
, | 652 z += Offset (small_slur->relative_coordinate (common_[X_AXIS], X_AXIS)
, |
638 small_slur->maybe_pure_coordinate (common_[Y_AXIS], Y_AXI
S, stub_, 0, INT_MAX)); | 653 small_slur->maybe_pure_coordinate (common_[Y_AXIS], Y_AXI
S, stub_, spanned_rank_interval_[LEFT], spanned_rank_interval_[RIGHT])); |
639 | 654 |
640 z[Y_AXIS] += dir_ * parameters_.free_slur_distance_; | 655 z[Y_AXIS] += dir_ * parameters_.free_slur_distance_; |
641 avoid.push_back (z); | 656 avoid.push_back (z); |
642 } | 657 } |
643 else if (extra_encompasses[i]->get_property ("avoid-slur") == ly_symbol2sc
m ("inside")) | 658 else if (extra_encompasses[i]->get_property ("avoid-slur") == ly_symbol2sc
m ("inside")) |
644 { | 659 { |
645 Grob *g = extra_encompasses [i]; | 660 Grob *g = extra_encompasses [i]; |
646 Interval xe = g->extent (common_[X_AXIS], X_AXIS); | 661 Interval xe = g->extent (common_[X_AXIS], X_AXIS); |
647 Interval ye = g->maybe_pure_extent (common_[Y_AXIS], Y_AXIS, stub_, 0,
INT_MAX); | 662 Interval ye = g->maybe_pure_extent (common_[Y_AXIS], Y_AXIS, stub_, sp
anned_rank_interval_[LEFT], spanned_rank_interval_[RIGHT]); |
648 | 663 |
649 if (!xe.is_empty () | 664 if (!xe.is_empty () |
650 && !ye.is_empty ()) | 665 && !ye.is_empty ()) |
651 avoid.push_back (Offset (xe.center (), ye[dir_])); | 666 avoid.push_back (Offset (xe.center (), ye[dir_])); |
652 } | 667 } |
653 } | 668 } |
654 return avoid; | 669 return avoid; |
655 } | 670 } |
656 | 671 |
657 void | 672 void |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 extract_grob_set (slur_, "encompass-objects", encompasses); | 770 extract_grob_set (slur_, "encompass-objects", encompasses); |
756 vector<Extra_collision_info> collision_infos; | 771 vector<Extra_collision_info> collision_infos; |
757 for (vsize i = encompasses.size (); i--;) | 772 for (vsize i = encompasses.size (); i--;) |
758 { | 773 { |
759 if (Slur::has_interface (encompasses[i])) | 774 if (Slur::has_interface (encompasses[i])) |
760 { | 775 { |
761 Spanner *small_slur = dynamic_cast<Spanner *> (encompasses[i]); | 776 Spanner *small_slur = dynamic_cast<Spanner *> (encompasses[i]); |
762 Bezier b = Slur::get_curve (small_slur); | 777 Bezier b = Slur::get_curve (small_slur); |
763 | 778 |
764 Offset relative (small_slur->relative_coordinate (common_[X_AXIS], X_A
XIS), | 779 Offset relative (small_slur->relative_coordinate (common_[X_AXIS], X_A
XIS), |
765 small_slur->maybe_pure_coordinate (common_[Y_AXIS], Y
_AXIS, stub_, 0, INT_MAX)); | 780 small_slur->maybe_pure_coordinate (common_[Y_AXIS], Y
_AXIS, stub_, spanned_rank_interval_[LEFT], spanned_rank_interval_[RIGHT])); |
766 | 781 |
767 for (int k = 0; k < 3; k++) | 782 for (int k = 0; k < 3; k++) |
768 { | 783 { |
769 Direction hdir = Direction (k - 1); | 784 Direction hdir = Direction (k - 1); |
770 | 785 |
771 /* | 786 /* |
772 Only take bound into account if small slur starts | 787 Only take bound into account if small slur starts |
773 together with big slur. | 788 together with big slur. |
774 */ | 789 */ |
775 if (hdir && small_slur->get_bound (hdir) != slur_->get_bound (hdir
)) | 790 if (hdir && small_slur->get_bound (hdir) != slur_->get_bound (hdir
)) |
(...skipping 13 matching lines...) Expand all Loading... |
789 xext, | 804 xext, |
790 yext, | 805 yext, |
791 parameters_.extra_object_collision_pena
lty_); | 806 parameters_.extra_object_collision_pena
lty_); |
792 collision_infos.push_back (info); | 807 collision_infos.push_back (info); |
793 } | 808 } |
794 } | 809 } |
795 else | 810 else |
796 { | 811 { |
797 Grob *g = encompasses [i]; | 812 Grob *g = encompasses [i]; |
798 Interval xe = g->extent (common_[X_AXIS], X_AXIS); | 813 Interval xe = g->extent (common_[X_AXIS], X_AXIS); |
799 Interval ye = g->maybe_pure_extent (common_[Y_AXIS], Y_AXIS, stub_, 0,
INT_MAX); | 814 Interval ye = g->maybe_pure_extent (common_[Y_AXIS], Y_AXIS, stub_, sp
anned_rank_interval_[LEFT], spanned_rank_interval_[RIGHT]); |
800 if (Dots::has_interface (g)) | 815 if (Dots::has_interface (g)) |
801 ye.widen (0.2); | 816 ye.widen (0.2); |
802 | 817 |
803 Real xp = 0.0; | 818 Real xp = 0.0; |
804 Real penalty = parameters_.extra_object_collision_penalty_; | 819 Real penalty = parameters_.extra_object_collision_penalty_; |
805 if (Accidental_interface::has_interface (g)) | 820 if (Accidental_interface::has_interface (g)) |
806 { | 821 { |
807 penalty = parameters_.accidental_collision_; | 822 penalty = parameters_.accidental_collision_; |
808 | 823 |
809 Rational alt = ly_scm2rational (g->get_property ("alteration")); | 824 Rational alt = ly_scm2rational (g->get_property ("alteration")); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
843 type_ = g->get_property ("avoid-slur"); | 858 type_ = g->get_property ("avoid-slur"); |
844 } | 859 } |
845 | 860 |
846 Extra_collision_info::Extra_collision_info () | 861 Extra_collision_info::Extra_collision_info () |
847 { | 862 { |
848 idx_ = 0.0; | 863 idx_ = 0.0; |
849 penalty_ = 0.; | 864 penalty_ = 0.; |
850 grob_ = 0; | 865 grob_ = 0; |
851 type_ = SCM_EOL; | 866 type_ = SCM_EOL; |
852 } | 867 } |
LEFT | RIGHT |