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--2019 Han-Wen Nienhuys <hanwen@xs4all.nl> | 4 Copyright (C) 1996--2019 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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 SCM | 342 SCM |
343 Slur::calc_control_points (SCM smob) | 343 Slur::calc_control_points (SCM smob) |
344 { | 344 { |
345 Spanner *me = unsmob<Spanner> (smob); | 345 Spanner *me = unsmob<Spanner> (smob); |
346 | 346 |
347 Slur_score_state state; | 347 Slur_score_state state; |
348 state.fill (me); | 348 state.fill (me); |
349 | 349 |
350 if (!state.valid_) | 350 if (!state.valid_) |
351 return SCM_EOL; | 351 return SCM_EOL; |
352 if (!state.configurations_.size ()) | 352 if (state.configurations_.empty ()) |
353 { | 353 { |
354 me->warning ("no viable slur configuration found"); | 354 me->warning ("no viable slur configuration found"); |
355 return SCM_EOL; | 355 return SCM_EOL; |
356 } | 356 } |
357 | 357 |
358 state.generate_curves (); | 358 state.generate_curves (); |
359 | 359 |
360 SCM end_ys = me->get_property ("positions"); | 360 SCM end_ys = me->get_property ("positions"); |
361 SCM inspect_quants = me->get_property ("inspect-quants"); | 361 SCM inspect_quants = me->get_property ("inspect-quants"); |
362 bool debug_slurs = to_boolean (me->layout () | 362 bool debug_slurs = to_boolean (me->layout () |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 y = head->extent (common_[Y_AXIS], Y_AXIS)[dir_]; | 541 y = head->extent (common_[Y_AXIS], Y_AXIS)[dir_]; |
542 y += dir_ * 0.5 * staff_space_; | 542 y += dir_ * 0.5 * staff_space_; |
543 | 543 |
544 y = move_away_from_staffline (y, head); | 544 y = move_away_from_staffline (y, head); |
545 | 545 |
546 Grob *fh = Note_column::first_head (extremes_[d].note_column_); | 546 Grob *fh = Note_column::first_head (extremes_[d].note_column_); |
547 x | 547 x |
548 = (fh ? fh->extent (common_[X_AXIS], X_AXIS) | 548 = (fh ? fh->extent (common_[X_AXIS], X_AXIS) |
549 : extremes_[d].bound_->extent (common_[X_AXIS], X_AXIS)) | 549 : extremes_[d].bound_->extent (common_[X_AXIS], X_AXIS)) |
550 .linear_combination (CENTER); | 550 .linear_combination (CENTER); |
551 if (isinf (x) || isnan (x)) | 551 if (!isfinite (x)) |
552 x = extremes_[d].note_column_->extent (common_[X_AXIS], X_AXIS).line
ar_combination (CENTER); | 552 x = extremes_[d].note_column_->extent (common_[X_AXIS], X_AXIS) |
553 if (isinf (y) || isnan (y)) | 553 .linear_combination (CENTER); |
554 y = extremes_[d].note_column_->extent (common_[Y_AXIS], Y_AXIS).line
ar_combination (CENTER); | 554 if (!isfinite (y)) |
| 555 y = extremes_[d].note_column_->extent (common_[Y_AXIS], Y_AXIS) |
| 556 .linear_combination (CENTER); |
555 } | 557 } |
556 else if (head) | 558 else if (head) |
557 { | 559 { |
558 y = head->extent (common_[Y_AXIS], Y_AXIS) | 560 y = head->extent (common_[Y_AXIS], Y_AXIS) |
559 .linear_combination (0.5*dir_); | 561 .linear_combination (0.5*dir_); |
560 | 562 |
561 // Don't "move_away_from_staffline" because that makes it | 563 // Don't "move_away_from_staffline" because that makes it |
562 // harder to recognize the specific attachment point | 564 // harder to recognize the specific attachment point |
563 x = head->extent (common_[X_AXIS], X_AXIS)[-d]; | 565 x = head->extent (common_[X_AXIS], X_AXIS)[-d]; |
564 } | 566 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 base_attachment[d] = Offset (x, y); | 602 base_attachment[d] = Offset (x, y); |
601 } | 603 } |
602 } | 604 } |
603 | 605 |
604 for (LEFT_and_RIGHT (d)) | 606 for (LEFT_and_RIGHT (d)) |
605 { | 607 { |
606 for (int a = X_AXIS; a < NO_AXES; a++) | 608 for (int a = X_AXIS; a < NO_AXES; a++) |
607 { | 609 { |
608 Real &b = base_attachment[d][Axis (a)]; | 610 Real &b = base_attachment[d][Axis (a)]; |
609 | 611 |
610 if (isinf (b) || isnan (b)) | 612 if (!isfinite (b)) |
611 { | 613 { |
612 programming_error ("slur attachment is inf/nan"); | 614 programming_error ("slur attachment is inf/nan"); |
613 b = 0.0; | 615 b = 0.0; |
614 } | 616 } |
615 } | 617 } |
616 } | 618 } |
617 | 619 |
618 return base_attachment; | 620 return base_attachment; |
619 } | 621 } |
620 | 622 |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
877 type_ = g->get_property ("avoid-slur"); | 879 type_ = g->get_property ("avoid-slur"); |
878 } | 880 } |
879 | 881 |
880 Extra_collision_info::Extra_collision_info () | 882 Extra_collision_info::Extra_collision_info () |
881 { | 883 { |
882 idx_ = 0.0; | 884 idx_ = 0.0; |
883 penalty_ = 0.; | 885 penalty_ = 0.; |
884 grob_ = 0; | 886 grob_ = 0; |
885 type_ = SCM_EOL; | 887 type_ = SCM_EOL; |
886 } | 888 } |
LEFT | RIGHT |