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) 2000--2020 Han-Wen Nienhuys <hanwen@xs4all.nl> | 4 Copyright (C) 2000--2020 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 22 matching lines...) Expand all Loading... |
33 #include "pointer-group-interface.hh" | 33 #include "pointer-group-interface.hh" |
34 #include "separation-item.hh" | 34 #include "separation-item.hh" |
35 #include "skyline-pair.hh" | 35 #include "skyline-pair.hh" |
36 #include "staff-grouper-interface.hh" | 36 #include "staff-grouper-interface.hh" |
37 #include "stem.hh" | 37 #include "stem.hh" |
38 #include "stencil.hh" | 38 #include "stencil.hh" |
39 #include "system.hh" | 39 #include "system.hh" |
40 #include "warn.hh" | 40 #include "warn.hh" |
41 #include "unpure-pure-container.hh" | 41 #include "unpure-pure-container.hh" |
42 | 42 |
| 43 using std::multimap; |
| 44 using std::pair; |
| 45 using std::string; |
| 46 using std::vector; |
| 47 |
43 static bool | 48 static bool |
44 pure_staff_priority_less (Grob *const &g1, Grob *const &g2); | 49 pure_staff_priority_less (Grob *const &g1, Grob *const &g2); |
45 | 50 |
46 Real Axis_group_interface::default_outside_staff_padding_ = 0.46; | 51 Real Axis_group_interface::default_outside_staff_padding_ = 0.46; |
47 | 52 |
48 Real | 53 Real |
49 Axis_group_interface::get_default_outside_staff_padding () | 54 Axis_group_interface::get_default_outside_staff_padding () |
50 { | 55 { |
51 return default_outside_staff_padding_; | 56 return default_outside_staff_padding_; |
52 } | 57 } |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 { | 266 { |
262 begin_line_staff_heights = begin_line_heights; | 267 begin_line_staff_heights = begin_line_heights; |
263 mid_line_staff_heights = mid_line_heights; | 268 mid_line_staff_heights = mid_line_heights; |
264 } | 269 } |
265 | 270 |
266 // TODO: consider a pure version of get_grob_direction? | 271 // TODO: consider a pure version of get_grob_direction? |
267 Direction d = to_dir (g->get_property_data ("direction")); | 272 Direction d = to_dir (g->get_property_data ("direction")); |
268 d = (d == CENTER) ? UP : d; | 273 d = (d == CENTER) ? UP : d; |
269 | 274 |
270 Interval_t<int> rank_span = g->spanned_rank_interval (); | 275 Interval_t<int> rank_span = g->spanned_rank_interval (); |
271 vsize first_break = lower_bound (ranks, (vsize)rank_span[LEFT], less<vsize
> ()); | 276 vsize first_break = lower_bound (ranks, (vsize)rank_span[LEFT], std::less<
vsize> ()); |
272 if (first_break > 0 && ranks[first_break] >= (vsize)rank_span[LEFT]) | 277 if (first_break > 0 && ranks[first_break] >= (vsize)rank_span[LEFT]) |
273 first_break--; | 278 first_break--; |
274 | 279 |
275 for (vsize j = first_break; j + 1 < ranks.size () && (int)ranks[j] <= rank
_span[RIGHT]; ++j) | 280 for (vsize j = first_break; j + 1 < ranks.size () && (int)ranks[j] <= rank
_span[RIGHT]; ++j) |
276 { | 281 { |
277 int start = ranks[j]; | 282 int start = ranks[j]; |
278 int end = ranks[j + 1]; | 283 int end = ranks[j + 1]; |
279 | 284 |
280 // Take grobs that are visible with respect to a slightly longer line. | 285 // Take grobs that are visible with respect to a slightly longer line. |
281 // Otherwise, we will never include grobs at breakpoints which aren't | 286 // Otherwise, we will never include grobs at breakpoints which aren't |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 scm_vector_set_x (mid_scm, scm_from_int (i), ly_interval2scm (mid_line_hei
ghts[i])); | 320 scm_vector_set_x (mid_scm, scm_from_int (i), ly_interval2scm (mid_line_hei
ghts[i])); |
316 } | 321 } |
317 | 322 |
318 return scm_cons (begin_scm, mid_scm); | 323 return scm_cons (begin_scm, mid_scm); |
319 } | 324 } |
320 | 325 |
321 Interval | 326 Interval |
322 Axis_group_interface::relative_pure_height (Grob *me, int start, int end) | 327 Axis_group_interface::relative_pure_height (Grob *me, int start, int end) |
323 { | 328 { |
324 /* It saves a _lot_ of time if we assume a VerticalAxisGroup is additive | 329 /* It saves a _lot_ of time if we assume a VerticalAxisGroup is additive |
325 (ie. height (i, k) = max (height (i, j) height (j, k)) for all i <= j <= k)
. | 330 (ie. height (i, k) = std::max (height (i, j) height (j, k)) for all i <= j
<= k). |
326 Unfortunately, it isn't always true, particularly if there is a | 331 Unfortunately, it isn't always true, particularly if there is a |
327 VerticalAlignment somewhere in the descendants. | 332 VerticalAlignment somewhere in the descendants. |
328 | 333 |
329 Usually, the only VerticalAlignment comes from Score. This makes it | 334 Usually, the only VerticalAlignment comes from Score. This makes it |
330 reasonably safe to assume that if our parent is a VerticalAlignment, | 335 reasonably safe to assume that if our parent is a VerticalAlignment, |
331 we can assume additivity and cache things nicely. */ | 336 we can assume additivity and cache things nicely. */ |
332 Grob *p = me->get_parent (Y_AXIS); | 337 Grob *p = me->get_parent (Y_AXIS); |
333 if (has_interface<Align_interface> (p)) | 338 if (has_interface<Align_interface> (p)) |
334 return Axis_group_interface::sum_partial_pure_heights (me, start, end); | 339 return Axis_group_interface::sum_partial_pure_heights (me, start, end); |
335 | 340 |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 vector<Real> const &other_padding, | 682 vector<Real> const &other_padding, |
678 vector<Real> const &other_horizon_padding, | 683 vector<Real> const &other_horizon_padding, |
679 Direction const dir) | 684 Direction const dir) |
680 { | 685 { |
681 assert (other_v_skylines.size () == other_padding.size ()); | 686 assert (other_v_skylines.size () == other_padding.size ()); |
682 assert (other_v_skylines.size () == other_horizon_padding.size ()); | 687 assert (other_v_skylines.size () == other_horizon_padding.size ()); |
683 vector<Interval> forbidden_intervals; | 688 vector<Interval> forbidden_intervals; |
684 for (vsize j = 0; j < other_v_skylines.size (); j++) | 689 for (vsize j = 0; j < other_v_skylines.size (); j++) |
685 { | 690 { |
686 Skyline_pair const &v_other = other_v_skylines[j]; | 691 Skyline_pair const &v_other = other_v_skylines[j]; |
687 Real pad = max (padding, other_padding[j]); | 692 Real pad = std::max (padding, other_padding[j]); |
688 Real horizon_pad = max (horizon_padding, other_horizon_padding[j]); | 693 Real horizon_pad = std::max (horizon_padding, other_horizon_padding[j]); |
689 | 694 |
690 // We need to push elt up by at least this much to be above v_other. | 695 // We need to push elt up by at least this much to be above v_other. |
691 Real up = (*v_skyline)[DOWN].distance (v_other[UP], horizon_pad) + pad; | 696 Real up = (*v_skyline)[DOWN].distance (v_other[UP], horizon_pad) + pad; |
692 // We need to push elt down by at least this much to be below v_other. | 697 // We need to push elt down by at least this much to be below v_other. |
693 Real down = (*v_skyline)[UP].distance (v_other[DOWN], horizon_pad) + pad; | 698 Real down = (*v_skyline)[UP].distance (v_other[DOWN], horizon_pad) + pad; |
694 | 699 |
695 forbidden_intervals.push_back (Interval (-down, up)); | 700 forbidden_intervals.push_back (Interval (-down, up)); |
696 } | 701 } |
697 | 702 |
698 Interval_set allowed_shifts | 703 Interval_set allowed_shifts |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
829 (*all_v_skylines)[dir], | 834 (*all_v_skylines)[dir], |
830 (*all_paddings)[dir], | 835 (*all_paddings)[dir], |
831 (*all_horizon_paddings)[dir], | 836 (*all_horizon_paddings)[dir], |
832 dir); | 837 dir); |
833 | 838 |
834 elt->set_property ("outside-staff-priority", SCM_BOOL_F); | 839 elt->set_property ("outside-staff-priority", SCM_BOOL_F); |
835 (*all_v_skylines)[dir].push_back (v_skylines); | 840 (*all_v_skylines)[dir].push_back (v_skylines); |
836 (*all_paddings)[dir].push_back (padding); | 841 (*all_paddings)[dir].push_back (padding); |
837 (*all_horizon_paddings)[dir].push_back (horizon_padding); | 842 (*all_horizon_paddings)[dir].push_back (horizon_padding); |
838 } | 843 } |
839 swap (elements, skipped_elements); | 844 std::swap (elements, skipped_elements); |
840 skipped_elements.clear (); | 845 skipped_elements.clear (); |
841 } | 846 } |
842 } | 847 } |
843 | 848 |
844 // If the Grob has a Y-ancestor with outside-staff-priority, return it. | 849 // If the Grob has a Y-ancestor with outside-staff-priority, return it. |
845 // Otherwise, return 0. | 850 // Otherwise, return 0. |
846 Grob * | 851 Grob * |
847 Axis_group_interface::outside_staff_ancestor (Grob *me) | 852 Axis_group_interface::outside_staff_ancestor (Grob *me) |
848 { | 853 { |
849 Grob *parent = me->get_parent (Y_AXIS); | 854 Grob *parent = me->get_parent (Y_AXIS); |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1051 "pure-relevant-items " | 1056 "pure-relevant-items " |
1052 "pure-relevant-spanners " | 1057 "pure-relevant-spanners " |
1053 "pure-Y-common " | 1058 "pure-Y-common " |
1054 "staff-affinity " | 1059 "staff-affinity " |
1055 "staff-grouper " | 1060 "staff-grouper " |
1056 "staff-staff-spacing " | 1061 "staff-staff-spacing " |
1057 "system-Y-offset " | 1062 "system-Y-offset " |
1058 "X-common " | 1063 "X-common " |
1059 "Y-common " | 1064 "Y-common " |
1060 ); | 1065 ); |
OLD | NEW |