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) 1997--2015 Han-Wen Nienhuys <hanwen@xs4all.nl> | 4 Copyright (C) 1997--2015 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 if (is_direction (stem->get_property_data ("direction"))) | 198 if (is_direction (stem->get_property_data ("direction"))) |
199 dir = to_dir (stem->get_property_data ("direction")); | 199 dir = to_dir (stem->get_property_data ("direction")); |
200 else | 200 else |
201 dir = to_dir (stem->get_property ("default-direction")); | 201 dir = to_dir (stem->get_property ("default-direction")); |
202 | 202 |
203 extract_grob_set (stem, "note-heads", heads); | 203 extract_grob_set (stem, "note-heads", heads); |
204 /* default position of Kievan heads with beams is down | 204 /* default position of Kievan heads with beams is down |
205 placing this here avoids warnings downstream */ | 205 placing this here avoids warnings downstream */ |
206 if (heads.size()) | 206 if (heads.size()) |
207 { | 207 { |
208 if (heads[0]->get_property ("style") == ly_symbol2scm ("kievan")) | 208 if (scm_is_eq (heads[0]->get_property ("style"), |
| 209 ly_symbol2scm ("kievan"))) |
209 { | 210 { |
210 if (dir == CENTER) | 211 if (dir == CENTER) |
211 dir = DOWN; | 212 dir = DOWN; |
212 } | 213 } |
213 } | 214 } |
214 } | 215 } |
215 } | 216 } |
216 | 217 |
217 if (count >= 1) | 218 if (count >= 1) |
218 { | 219 { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 | 252 |
252 int best_count = 0; | 253 int best_count = 0; |
253 int best_start = 0; | 254 int best_start = 0; |
254 for (int i = lslice[-left_dir]; | 255 for (int i = lslice[-left_dir]; |
255 (i - lslice[left_dir]) * left_dir <= 0; i += left_dir) | 256 (i - lslice[left_dir]) * left_dir <= 0; i += left_dir) |
256 { | 257 { |
257 int count = 0; | 258 int count = 0; |
258 for (SCM s = scm_car (right_beaming); scm_is_pair (s); s = scm_cdr (s)) | 259 for (SCM s = scm_car (right_beaming); scm_is_pair (s); s = scm_cdr (s)) |
259 { | 260 { |
260 int k = -right_dir * scm_to_int (scm_car (s)) + i; | 261 int k = -right_dir * scm_to_int (scm_car (s)) + i; |
261 if (scm_c_memq (scm_from_int (k), left_beaming) != SCM_BOOL_F) | 262 if (scm_is_true (scm_c_memq (scm_from_int (k), left_beaming))) |
262 count++; | 263 count++; |
263 } | 264 } |
264 | 265 |
265 if (count >= best_count) | 266 if (count >= best_count) |
266 { | 267 { |
267 best_count = count; | 268 best_count = count; |
268 best_start = i; | 269 best_start = i; |
269 } | 270 } |
270 } | 271 } |
271 | 272 |
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
956 */ | 957 */ |
957 if (is_knee (me)) | 958 if (is_knee (me)) |
958 return scm_from_int (0); | 959 return scm_from_int (0); |
959 | 960 |
960 Real forced_fraction = 1.0 * forced_stem_count (me) | 961 Real forced_fraction = 1.0 * forced_stem_count (me) |
961 / normal_stem_count (me); | 962 / normal_stem_count (me); |
962 | 963 |
963 int beam_count = get_beam_count (me); | 964 int beam_count = get_beam_count (me); |
964 | 965 |
965 SCM shorten_list = me->get_property ("beamed-stem-shorten"); | 966 SCM shorten_list = me->get_property ("beamed-stem-shorten"); |
966 if (shorten_list == SCM_EOL) | 967 if (scm_is_null (shorten_list)) |
967 return scm_from_int (0); | 968 return scm_from_int (0); |
968 | 969 |
969 Real staff_space = Staff_symbol_referencer::staff_space (me); | 970 Real staff_space = Staff_symbol_referencer::staff_space (me); |
970 | 971 |
971 SCM shorten_elt | 972 SCM shorten_elt |
972 = robust_list_ref (beam_count - 1, shorten_list); | 973 = robust_list_ref (beam_count - 1, shorten_list); |
973 Real shorten = scm_to_double (shorten_elt) * staff_space; | 974 Real shorten = scm_to_double (shorten_elt) * staff_space; |
974 | 975 |
975 shorten *= forced_fraction; | 976 shorten *= forced_fraction; |
976 | 977 |
(...skipping 21 matching lines...) Expand all Loading... |
998 Report slice containing the numbers that are both in (car BEAMING) | 999 Report slice containing the numbers that are both in (car BEAMING) |
999 and (cdr BEAMING) | 1000 and (cdr BEAMING) |
1000 */ | 1001 */ |
1001 Slice | 1002 Slice |
1002 where_are_the_whole_beams (SCM beaming) | 1003 where_are_the_whole_beams (SCM beaming) |
1003 { | 1004 { |
1004 Slice l; | 1005 Slice l; |
1005 | 1006 |
1006 for (SCM s = scm_car (beaming); scm_is_pair (s); s = scm_cdr (s)) | 1007 for (SCM s = scm_car (beaming); scm_is_pair (s); s = scm_cdr (s)) |
1007 { | 1008 { |
1008 if (scm_c_memq (scm_car (s), scm_cdr (beaming)) != SCM_BOOL_F) | 1009 if (scm_is_true (scm_c_memq (scm_car (s), scm_cdr (beaming)))) |
1009 | 1010 |
1010 l.add_point (scm_to_int (scm_car (s))); | 1011 l.add_point (scm_to_int (scm_car (s))); |
1011 } | 1012 } |
1012 | 1013 |
1013 return l; | 1014 return l; |
1014 } | 1015 } |
1015 | 1016 |
1016 /* Return the Y position of the stem-end, given the Y-left, Y-right | 1017 /* Return the Y position of the stem-end, given the Y-left, Y-right |
1017 in POS for stem S. This Y position is relative to S. */ | 1018 in POS for stem S. This Y position is relative to S. */ |
1018 Real | 1019 Real |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1134 | 1135 |
1135 for (vsize i = 0; i < stems.size (); i++) | 1136 for (vsize i = 0; i < stems.size (); i++) |
1136 { | 1137 { |
1137 /* | 1138 /* |
1138 Don't overwrite user settings. | 1139 Don't overwrite user settings. |
1139 */ | 1140 */ |
1140 for (LEFT_and_RIGHT (d)) | 1141 for (LEFT_and_RIGHT (d)) |
1141 { | 1142 { |
1142 Grob *stem = stems[i]; | 1143 Grob *stem = stems[i]; |
1143 SCM beaming_prop = stem->get_property ("beaming"); | 1144 SCM beaming_prop = stem->get_property ("beaming"); |
1144 if (beaming_prop == SCM_EOL | 1145 if (scm_is_null (beaming_prop) |
1145 || index_get_cell (beaming_prop, d) == SCM_EOL) | 1146 || scm_is_null (index_get_cell (beaming_prop, d))) |
1146 { | 1147 { |
1147 int count = beaming->beamlet_count (i, d); | 1148 int count = beaming->beamlet_count (i, d); |
1148 if (i > 0 | 1149 if (i > 0 |
1149 && i + 1 < stems.size () | 1150 && i + 1 < stems.size () |
1150 && Stem::is_invisible (stem)) | 1151 && Stem::is_invisible (stem)) |
1151 count = min (count, beaming->beamlet_count (i, -d)); | 1152 count = min (count, beaming->beamlet_count (i, -d)); |
1152 | 1153 |
1153 if ( ((i == 0 && d == LEFT) | 1154 if ( ((i == 0 && d == LEFT) |
1154 || (i == stems.size () - 1 && d == RIGHT)) | 1155 || (i == stems.size () - 1 && d == RIGHT)) |
1155 && stems.size () > 1 | 1156 && stems.size () > 1 |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1506 "least-squares-dy " | 1507 "least-squares-dy " |
1507 "neutral-direction " | 1508 "neutral-direction " |
1508 "normal-stems " | 1509 "normal-stems " |
1509 "positions " | 1510 "positions " |
1510 "quantized-positions " | 1511 "quantized-positions " |
1511 "shorten " | 1512 "shorten " |
1512 "skip-quanting " | 1513 "skip-quanting " |
1513 "stems " | 1514 "stems " |
1514 "X-positions " | 1515 "X-positions " |
1515 ); | 1516 ); |
LEFT | RIGHT |