Left: | ||
Right: |
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) 1997--2012 Han-Wen Nienhuys <hanwen@xs4all.nl> | 4 Copyright (C) 1997--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. |
(...skipping 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1231 Grob *st = unsmob_grob (rest->get_object ("stem")); | 1231 Grob *st = unsmob_grob (rest->get_object ("stem")); |
1232 Grob *stem = st; | 1232 Grob *stem = st; |
1233 if (!stem) | 1233 if (!stem) |
1234 return scm_from_double (0.0); | 1234 return scm_from_double (0.0); |
1235 Grob *beam = unsmob_grob (stem->get_object ("beam")); | 1235 Grob *beam = unsmob_grob (stem->get_object ("beam")); |
1236 if (!beam | 1236 if (!beam |
1237 || !Beam::has_interface (beam) | 1237 || !Beam::has_interface (beam) |
1238 || !Beam::normal_stem_count (beam)) | 1238 || !Beam::normal_stem_count (beam)) |
1239 return scm_from_double (0.0); | 1239 return scm_from_double (0.0); |
1240 | 1240 |
1241 Grob *common_y = rest->common_refpoint (beam, Y_AXIS); | |
1242 | |
1241 Drul_array<Real> pos (robust_scm2drul (beam->get_property ("positions"), | 1243 Drul_array<Real> pos (robust_scm2drul (beam->get_property ("positions"), |
1242 Drul_array<Real> (0, 0))); | 1244 Drul_array<Real> (0, 0))); |
1243 | 1245 |
1246 Direction dir = LEFT; | |
1247 do | |
1248 pos[dir] += beam->relative_coordinate (common_y, Y_AXIS); | |
1249 while (flip (&dir) != LEFT); | |
1250 | |
1244 Real staff_space = Staff_symbol_referencer::staff_space (rest); | 1251 Real staff_space = Staff_symbol_referencer::staff_space (rest); |
1245 | 1252 |
1246 scale_drul (&pos, staff_space); | 1253 scale_drul (&pos, staff_space); |
1247 | 1254 |
1248 Real dy = pos[RIGHT] - pos[LEFT]; | 1255 Real dy = pos[RIGHT] - pos[LEFT]; |
1249 | 1256 |
1250 extract_grob_set (beam, "stems", stems); | 1257 extract_grob_set (beam, "stems", stems); |
1251 Grob *common = common_refpoint_of_array (stems, beam, X_AXIS); | 1258 Grob *common = common_refpoint_of_array (stems, beam, X_AXIS); |
1252 | 1259 |
1253 Interval x_span = robust_scm2interval (beam->get_property ("X-positions"), | 1260 Interval x_span = robust_scm2interval (beam->get_property ("X-positions"), |
(...skipping 12 matching lines...) Expand all Loading... | |
1266 /* | 1273 /* |
1267 TODO: this is not strictly correct for 16th knee beams. | 1274 TODO: this is not strictly correct for 16th knee beams. |
1268 */ | 1275 */ |
1269 int beam_count | 1276 int beam_count |
1270 = Stem::beam_multiplicity (stem).length () + 1; | 1277 = Stem::beam_multiplicity (stem).length () + 1; |
1271 | 1278 |
1272 Real height_of_my_beams = beam_thickness / 2 | 1279 Real height_of_my_beams = beam_thickness / 2 |
1273 + (beam_count - 1) * beam_translation; | 1280 + (beam_count - 1) * beam_translation; |
1274 Real beam_y = stem_y - d * height_of_my_beams; | 1281 Real beam_y = stem_y - d * height_of_my_beams; |
1275 | 1282 |
1276 Grob *common_y = rest->common_refpoint (beam, Y_AXIS); | |
1277 | 1283 |
1278 Interval rest_extent = rest->extent (rest, Y_AXIS); | 1284 Interval rest_extent = rest->extent (rest, Y_AXIS); |
1279 rest_extent.translate (offset + rest->get_parent (Y_AXIS)->relative_coordinate (common_y, Y_AXIS)); | 1285 rest_extent.translate (offset + rest->get_parent (Y_AXIS)->relative_coordinate (common_y, Y_AXIS)); |
1280 | 1286 |
1281 Real rest_dim = rest_extent[d]; | 1287 Real rest_dim = rest_extent[d]; |
1282 Real minimum_distance | 1288 Real minimum_distance |
1283 = staff_space * (robust_scm2double (stem->get_property ("stemlet-length"), 0 .0) | 1289 = staff_space * (robust_scm2double (stem->get_property ("stemlet-length"), 0 .0) |
1284 + robust_scm2double (rest->get_property ("minimum-distance" ), 0.0)); | 1290 + robust_scm2double (rest->get_property ("minimum-distance" ), 0.0)); |
1285 | 1291 |
1286 Real shift = d * min (d * (beam_y - d * minimum_distance - rest_dim), 0.0); | 1292 Real shift = d * min (d * (beam_y - d * minimum_distance - rest_dim), 0.0); |
(...skipping 22 matching lines...) Expand all Loading... | |
1309 SCM /* end */) | 1315 SCM /* end */) |
1310 { | 1316 { |
1311 Real amount = 0.0; | 1317 Real amount = 0.0; |
1312 | 1318 |
1313 Grob *me = unsmob_grob (smob); | 1319 Grob *me = unsmob_grob (smob); |
1314 Grob *stem = unsmob_grob (me->get_object ("stem")); | 1320 Grob *stem = unsmob_grob (me->get_object ("stem")); |
1315 if (!stem) | 1321 if (!stem) |
1316 return scm_from_double (amount); | 1322 return scm_from_double (amount); |
1317 Grob *beam = unsmob_grob (stem->get_object ("beam")); | 1323 Grob *beam = unsmob_grob (stem->get_object ("beam")); |
1318 if (!beam | 1324 if (!beam |
1319 || !Beam::normal_stem_count (beam)) | 1325 || !Beam::normal_stem_count (beam) |
1326 || beam->get_property_data ("direction") == ly_symbol2scm ("calculation-in -progress")) | |
Keith
2012/04/25 06:21:54
Mike, any idea why you added this?
It just adds to
mike7
2012/04/25 06:29:14
If this bit isn't there, a circular dependency cou
Milimetr88
2012/04/25 11:10:40
Isn't it a good idea to make a comment in the code
| |
1320 return scm_from_double (amount); | 1327 return scm_from_double (amount); |
1321 | 1328 |
1322 Real ss = Staff_symbol_referencer::staff_space (me); | 1329 Real ss = Staff_symbol_referencer::staff_space (me); |
1323 | 1330 |
1324 /* | 1331 /* |
1325 This gives the extrema of rest positions. | 1332 This gives the extrema of rest positions. |
1326 In general, beams are never typeset more than one staff space away | 1333 In general, beams are never typeset more than one staff space away |
1327 from the staff in either direction. | 1334 from the staff in either direction. |
1328 */ | 1335 */ |
1329 Grob *staff = Staff_symbol_referencer::get_staff_symbol (me); | 1336 Grob *staff = Staff_symbol_referencer::get_staff_symbol (me); |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1499 "least-squares-dy " | 1506 "least-squares-dy " |
1500 "neutral-direction " | 1507 "neutral-direction " |
1501 "normal-stems " | 1508 "normal-stems " |
1502 "positions " | 1509 "positions " |
1503 "quantized-positions " | 1510 "quantized-positions " |
1504 "shorten " | 1511 "shorten " |
1505 "skip-quanting " | 1512 "skip-quanting " |
1506 "stems " | 1513 "stems " |
1507 "X-positions " | 1514 "X-positions " |
1508 ); | 1515 ); |
OLD | NEW |