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) 1998--2011 Han-Wen Nienhuys <hanwen@xs4all.nl> | 4 Copyright (C) 1998--2011 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 |
11 LilyPond is distributed in the hope that it will be useful, | 11 LilyPond is distributed in the hope that it will be useful, |
12 but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 GNU General Public License for more details. | 14 GNU General Public License for more details. |
15 | 15 |
16 You should have received a copy of the GNU General Public License | 16 You should have received a copy of the GNU General Public License |
17 along with LilyPond. If not, see <http://www.gnu.org/licenses/>. | 17 along with LilyPond. If not, see <http://www.gnu.org/licenses/>. |
18 */ | 18 */ |
19 | 19 |
20 #include "side-position-interface.hh" | 20 #include "side-position-interface.hh" |
21 | 21 |
22 #include <cmath> // ceil. | 22 #include <cmath> // ceil. |
23 #include <algorithm> | 23 #include <algorithm> |
24 | 24 |
25 using namespace std; | 25 using namespace std; |
26 | 26 |
| 27 #include "accidental-interface.hh" |
27 #include "axis-group-interface.hh" | 28 #include "axis-group-interface.hh" |
28 #include "directional-element-interface.hh" | 29 #include "directional-element-interface.hh" |
29 #include "grob.hh" | 30 #include "grob.hh" |
30 #include "grob-array.hh" | 31 #include "grob-array.hh" |
31 #include "main.hh" | 32 #include "main.hh" |
32 #include "misc.hh" | 33 #include "misc.hh" |
33 #include "note-head.hh" | 34 #include "note-head.hh" |
34 #include "pointer-group-interface.hh" | 35 #include "pointer-group-interface.hh" |
35 #include "staff-symbol-referencer.hh" | 36 #include "staff-symbol-referencer.hh" |
36 #include "staff-symbol.hh" | 37 #include "staff-symbol.hh" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 + me->maybe_pure_extent (me, ax, pure, start, end); | 182 + me->maybe_pure_extent (me, ax, pure, start, end); |
182 else | 183 else |
183 off[ax] = me->maybe_pure_extent (common[ax], ax, pure, start, end); | 184 off[ax] = me->maybe_pure_extent (common[ax], ax, pure, start, end); |
184 } | 185 } |
185 | 186 |
186 if (off[X_AXIS].is_empty () || off[Y_AXIS].is_empty ()) | 187 if (off[X_AXIS].is_empty () || off[Y_AXIS].is_empty ()) |
187 return scm_from_double (0.0); | 188 return scm_from_double (0.0); |
188 | 189 |
189 my_min_h = off[a][dir]; | 190 my_min_h = off[a][dir]; |
190 | 191 |
191 Skyline my_dim (off, 0.2, other_axis (a), -dir); | 192 Real skyline_padding = 0.1; |
| 193 |
| 194 Skyline my_dim (off, skyline_padding, other_axis (a), -dir); |
192 my_dim.set_minimum_height (my_min_h); | 195 my_dim.set_minimum_height (my_min_h); |
193 | 196 |
194 bool include_staff | 197 bool include_staff |
195 = staff_symbol | 198 = staff_symbol |
196 && a == Y_AXIS | 199 && a == Y_AXIS |
197 && scm_is_number (me->get_property ("staff-padding")) | 200 && scm_is_number (me->get_property ("staff-padding")) |
198 && !to_boolean (me->get_property ("quantize-position")); | 201 && !to_boolean (me->get_property ("quantize-position")); |
199 | 202 |
200 vector<Box> boxes; | 203 vector<Box> boxes; |
201 Real min_h = dir == LEFT ? infinity_f : -infinity_f; | 204 Real min_h = dir == LEFT ? infinity_f : -infinity_f; |
202 for (vsize i = 0; i < support.size (); i++) | 205 for (vsize i = 0; i < support.size (); i++) |
203 { | 206 { |
204 Grob *e = support[i]; | 207 Grob *e = support[i]; |
205 | 208 |
206 // In the case of a stem, we will find a note head as well | 209 // In the case of a stem, we will find a note head as well |
207 // ignoring the stem solves cyclic dependencies if the stem is | 210 // ignoring the stem solves cyclic dependencies if the stem is |
208 // attached to a cross-staff beam. | 211 // attached to a cross-staff beam. |
209 if (a == Y_AXIS | 212 if (a == Y_AXIS |
210 && Stem::has_interface (e) | 213 && Stem::has_interface (e) |
211 && dir == - get_grob_direction (e)) | 214 && dir == - get_grob_direction (e)) |
212 continue; | 215 continue; |
213 | 216 |
214 if (e) | 217 if (e) |
215 { | 218 { |
216 Box b; | 219 if (Accidental_interface::has_interface (e)) |
217 for (Axis ax = X_AXIS; ax < NO_AXES; incr (ax)) | 220 { |
218 b[ax] = e->maybe_pure_extent (common[ax], ax, pure, start, end); | 221 vector<Box> bs = Accidental_interface::accurate_boxes (e, common); |
219 | 222 boxes.insert (boxes.end (), bs.begin (), bs.end ()); |
220 if (b[X_AXIS].is_empty () || b[Y_AXIS].is_empty ()) | 223 } |
221 continue; | 224 else |
222 | 225 { |
223 boxes.push_back (b); | 226 Box b; |
224 min_h = minmax (dir, b[a][-dir], min_h); | 227 for (Axis ax = X_AXIS; ax < NO_AXES; incr (ax)) |
225 } | 228 b[ax] = e->maybe_pure_extent (common[ax], ax, pure, start, end); |
226 } | 229 |
227 | 230 if (b[X_AXIS].is_empty () || b[Y_AXIS].is_empty ()) |
228 Skyline dim (boxes, 0.2, other_axis (a), dir); | 231 continue; |
| 232 |
| 233 boxes.push_back (b); |
| 234 min_h = minmax (dir, b[a][-dir], min_h); |
| 235 } |
| 236 } |
| 237 } |
| 238 |
| 239 Skyline dim (boxes, skyline_padding, other_axis (a), dir); |
229 if (!boxes.size ()) | 240 if (!boxes.size ()) |
230 dim.set_minimum_height (0.0); | 241 dim.set_minimum_height (0.0); |
231 else | 242 else |
232 dim.set_minimum_height (min_h); | 243 dim.set_minimum_height (min_h); |
233 | 244 |
234 if (include_staff) | 245 if (include_staff) |
235 { | 246 { |
236 Interval staff_extents; | 247 Interval staff_extents; |
237 common[Y_AXIS] = staff_symbol->common_refpoint (common[Y_AXIS], Y_AXIS); | 248 common[Y_AXIS] = staff_symbol->common_refpoint (common[Y_AXIS], Y_AXIS); |
238 staff_extents = staff_symbol->maybe_pure_extent (common[Y_AXIS], Y_AXIS, p
ure, start, end); | 249 staff_extents = staff_symbol->maybe_pure_extent (common[Y_AXIS], Y_AXIS, p
ure, start, end); |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 "direction " | 471 "direction " |
461 "minimum-space " | 472 "minimum-space " |
462 "padding " | 473 "padding " |
463 "quantize-position " | 474 "quantize-position " |
464 "side-axis " | 475 "side-axis " |
465 "side-support-elements " | 476 "side-support-elements " |
466 "slur-padding " | 477 "slur-padding " |
467 "staff-padding " | 478 "staff-padding " |
468 "use-skylines " | 479 "use-skylines " |
469 ); | 480 ); |
LEFT | RIGHT |