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 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. |
11 | 11 |
12 LilyPond is distributed in the hope that it will be useful, | 12 LilyPond is distributed in the hope that it will be useful, |
13 but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 GNU General Public License for more details. | 15 GNU General Public License for more details. |
16 | 16 |
17 You should have received a copy of the GNU General Public License | 17 You should have received a copy of the GNU General Public License |
18 along with LilyPond. If not, see <http://www.gnu.org/licenses/>. | 18 along with LilyPond. If not, see <http://www.gnu.org/licenses/>. |
19 */ | 19 */ |
20 | 20 |
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 "accidental-interface.hh" | 26 #include "accidental-interface.hh" |
26 #include "beam.hh" | 27 #include "beam.hh" |
27 #include "clef.hh" | 28 #include "clef.hh" |
28 #include "directional-element-interface.hh" | 29 #include "directional-element-interface.hh" |
29 #include "dots.hh" | 30 #include "dots.hh" |
30 #include "libc-extension.hh" | 31 #include "libc-extension.hh" |
31 #include "main.hh" | 32 #include "main.hh" |
32 #include "misc.hh" | 33 #include "misc.hh" |
33 #include "note-column.hh" | 34 #include "note-column.hh" |
34 #include "output-def.hh" | 35 #include "output-def.hh" |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 break; | 420 break; |
420 | 421 |
421 queue.pop (); | 422 queue.pop (); |
422 best->run_next_scorer (*this); | 423 best->run_next_scorer (*this); |
423 queue.push (best); | 424 queue.push (best); |
424 } | 425 } |
425 | 426 |
426 return best; | 427 return best; |
427 } | 428 } |
428 | 429 |
429 Grob * | 430 Interval |
430 Slur_score_state::breakable_bound_item (Direction d) const | 431 Slur_score_state::breakable_bound_extent (Direction d) const |
431 { | 432 { |
432 Grob *col = slur_->get_bound (d)->get_column (); | 433 Grob *col = slur_->get_bound (d)->get_column (); |
| 434 Interval ret; |
| 435 ret.set_empty (); |
433 | 436 |
434 extract_grob_set (slur_, "encompass-objects", extra_encompasses); | 437 extract_grob_set (slur_, "encompass-objects", extra_encompasses); |
435 | 438 |
436 for (vsize i = 0; i < extra_encompasses.size (); i++) | 439 for (vsize i = 0; i < extra_encompasses.size (); i++) |
437 { | 440 { |
438 Item *item = dynamic_cast<Item *> (extra_encompasses[i]); | 441 Item *item = dynamic_cast<Item *> (extra_encompasses[i]); |
439 if (item && col == item->get_column ()) | 442 if (item && col == item->get_column ()) |
440 return item; | 443 ret.unite (robust_relative_extent (item, common_[X_AXIS], X_AXIS)); |
441 } | 444 } |
442 | 445 |
443 return 0; | 446 return ret; |
444 } | 447 } |
445 | 448 |
446 /* | 449 /* |
447 TODO: should analyse encompasses to determine sensible region, and | 450 TODO: should analyse encompasses to determine sensible region, and |
448 should limit slopes available. | 451 should limit slopes available. |
449 */ | 452 */ |
450 | 453 |
451 Drul_array<Real> | 454 Drul_array<Real> |
452 Slur_score_state::get_y_attachment_range () const | 455 Slur_score_state::get_y_attachment_range () const |
453 { | 456 { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 base_attachment[d] = Offset (x, y); | 526 base_attachment[d] = Offset (x, y); |
524 } | 527 } |
525 | 528 |
526 for (LEFT_and_RIGHT (d)) | 529 for (LEFT_and_RIGHT (d)) |
527 { | 530 { |
528 if (!extremes_[d].note_column_) | 531 if (!extremes_[d].note_column_) |
529 { | 532 { |
530 Real x = 0; | 533 Real x = 0; |
531 Real y = 0; | 534 Real y = 0; |
532 | 535 |
533 if (Grob *g = breakable_bound_item (d)) | 536 Interval ext = breakable_bound_extent (d); |
534 { | 537 if (ext.is_empty ()) |
535 x = robust_relative_extent (g, common_[X_AXIS], X_AXIS)[RIGHT]; | 538 ext = Axis_group_interface:: |
536 } | 539 generic_bound_extent (extremes_[d].bound_, |
537 else if (d == RIGHT) | 540 common_[X_AXIS], X_AXIS); |
538 x = robust_relative_extent (extremes_[d].bound_, common_[X_AXIS], X_
AXIS)[d]; | 541 x = ext[-d]; |
539 else | |
540 x = slur_->get_broken_left_end_align (); | |
541 | 542 |
542 Grob *col = (d == LEFT) ? columns_[0] : columns_.back (); | 543 Grob *col = (d == LEFT) ? columns_[0] : columns_.back (); |
543 | 544 |
544 if (extremes_[-d].bound_ != col) | 545 if (extremes_[-d].bound_ != col) |
545 { | 546 { |
546 y = robust_relative_extent (col, common_[Y_AXIS], Y_AXIS)[dir_]; | 547 y = robust_relative_extent (col, common_[Y_AXIS], Y_AXIS)[dir_]; |
547 y += dir_ * 0.5 * staff_space_; | 548 y += dir_ * 0.5 * staff_space_; |
548 | 549 |
549 if (get_grob_direction (col) == dir_ | 550 if (get_grob_direction (col) == dir_ |
550 && Note_column::get_stem (col) | 551 && Note_column::get_stem (col) |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
836 type_ = g->get_property ("avoid-slur"); | 837 type_ = g->get_property ("avoid-slur"); |
837 } | 838 } |
838 | 839 |
839 Extra_collision_info::Extra_collision_info () | 840 Extra_collision_info::Extra_collision_info () |
840 { | 841 { |
841 idx_ = 0.0; | 842 idx_ = 0.0; |
842 penalty_ = 0.; | 843 penalty_ = 0.; |
843 grob_ = 0; | 844 grob_ = 0; |
844 type_ = SCM_EOL; | 845 type_ = SCM_EOL; |
845 } | 846 } |
OLD | NEW |