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) 1998--2020 Jan Nieuwenhuizen <janneke@gnu.org> | 4 Copyright (C) 1998--2020 Jan Nieuwenhuizen <janneke@gnu.org> |
5 Han-Wen Nienhuys <hanwen@xs4all.nl> | 5 Han-Wen Nienhuys <hanwen@xs4all.nl> |
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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 for (vsize i = 0; i < friends.size (); ++i) | 91 for (vsize i = 0; i < friends.size (); ++i) |
92 if (friends[i]->is_live () && !request_suicide_alone (friends[i], start, end
)) | 92 if (friends[i]->is_live () && !request_suicide_alone (friends[i], start, end
)) |
93 return false; | 93 return false; |
94 | 94 |
95 return true; | 95 return true; |
96 } | 96 } |
97 | 97 |
98 bool | 98 bool |
99 Hara_kiri_group_spanner::request_suicide_alone (Grob *me, vsize start, vsize end
) | 99 Hara_kiri_group_spanner::request_suicide_alone (Grob *me, vsize start, vsize end
) |
100 { | 100 { |
101 if (!to_boolean (me->get_property ("remove-empty"))) | 101 if (!to_boolean (get_property (me, "remove-empty"))) |
102 return false; | 102 return false; |
103 | 103 |
104 bool remove_first = to_boolean (me->get_property ("remove-first")); | 104 bool remove_first = to_boolean (get_property (me, "remove-first")); |
105 if (!remove_first && start <= 0) | 105 if (!remove_first && start <= 0) |
106 return false; | 106 return false; |
107 | 107 |
108 SCM important = me->get_property ("important-column-ranks"); | 108 SCM important = get_property (me, "important-column-ranks"); |
109 if (scm_is_vector (important)) | 109 if (scm_is_vector (important)) |
110 { | 110 { |
111 vsize len = scm_c_vector_length (important); | 111 vsize len = scm_c_vector_length (important); |
112 if (find_in_range (important, 0, len, start, end)) | 112 if (find_in_range (important, 0, len, start, end)) |
113 return false; | 113 return false; |
114 } | 114 } |
115 else /* build the important-columns-cache */ | 115 else /* build the important-columns-cache */ |
116 { | 116 { |
117 extract_grob_set (me, "items-worth-living", worth); | 117 extract_grob_set (me, "items-worth-living", worth); |
118 vector<int> ranks; | 118 vector<int> ranks; |
119 | 119 |
120 for (vsize i = 0; i < worth.size (); i++) | 120 for (vsize i = 0; i < worth.size (); i++) |
121 { | 121 { |
122 Interval_t<int> iv = worth[i]->spanned_rank_interval (); | 122 Interval_t<int> iv = worth[i]->spanned_rank_interval (); |
123 for (int j = iv[LEFT]; j <= iv[RIGHT]; j++) | 123 for (int j = iv[LEFT]; j <= iv[RIGHT]; j++) |
124 ranks.push_back (j); | 124 ranks.push_back (j); |
125 } | 125 } |
126 vector_sort (ranks, std::less<int> ()); | 126 vector_sort (ranks, std::less<int> ()); |
127 uniq (ranks); | 127 uniq (ranks); |
128 | 128 |
129 SCM scm_vec = scm_c_make_vector (ranks.size (), SCM_EOL); | 129 SCM scm_vec = scm_c_make_vector (ranks.size (), SCM_EOL); |
130 for (vsize i = 0; i < ranks.size (); i++) | 130 for (vsize i = 0; i < ranks.size (); i++) |
131 scm_c_vector_set_x (scm_vec, i, scm_from_int (ranks[i])); | 131 scm_c_vector_set_x (scm_vec, i, scm_from_int (ranks[i])); |
132 me->set_property ("important-column-ranks", scm_vec); | 132 set_property (me, "important-column-ranks", scm_vec); |
133 | 133 |
134 return request_suicide (me, start, end); | 134 return request_suicide (me, start, end); |
135 } | 135 } |
136 | 136 |
137 return true; | 137 return true; |
138 } | 138 } |
139 | 139 |
140 void | 140 void |
141 Hara_kiri_group_spanner::consider_suicide (Grob *me) | 141 Hara_kiri_group_spanner::consider_suicide (Grob *me) |
142 { | 142 { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 | 200 |
201 /* properties */ | 201 /* properties */ |
202 "items-worth-living " | 202 "items-worth-living " |
203 "important-column-ranks " | 203 "important-column-ranks " |
204 "keep-alive-with " | 204 "keep-alive-with " |
205 "make-dead-when " | 205 "make-dead-when " |
206 "remove-empty " | 206 "remove-empty " |
207 "remove-first " | 207 "remove-first " |
208 "remove-layer " | 208 "remove-layer " |
209 ); | 209 ); |
OLD | NEW |