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--2011 Han-Wen Nienhuys <hanwen@xs4all.nl> | 4 Copyright (C) 1997--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 |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "warn.hh" | 30 #include "warn.hh" |
31 | 31 |
32 MAKE_SCHEME_CALLBACK (Stem_tremolo, calc_slope, 1) | 32 MAKE_SCHEME_CALLBACK (Stem_tremolo, calc_slope, 1) |
33 SCM | 33 SCM |
34 Stem_tremolo::calc_slope (SCM smob) | 34 Stem_tremolo::calc_slope (SCM smob) |
35 { | 35 { |
36 Grob *me = unsmob_grob (smob); | 36 Grob *me = unsmob_grob (smob); |
37 Grob *stem = unsmob_grob (me->get_object ("stem")); | 37 Grob *stem = unsmob_grob (me->get_object ("stem")); |
38 Spanner *beam = Stem::get_beam (stem); | 38 Spanner *beam = Stem::get_beam (stem); |
39 | 39 |
| 40 /* We used to have tremolo slashes angled exactly like beams |
| 41 (if the note had a beam), but it turned out |
| 42 that it's not proper notation. |
| 43 |
40 if (beam) | 44 if (beam) |
41 { | 45 { |
42 Real dy = 0; | 46 Real dy = 0; |
43 SCM s = beam->get_property ("quantized-positions"); | 47 SCM s = beam->get_property ("quantized-positions"); |
44 if (is_number_pair (s)) | 48 if (is_number_pair (s)) |
45 dy = - scm_to_double (scm_car (s)) + scm_to_double (scm_cdr (s)); | 49 dy = - scm_to_double (scm_car (s)) + scm_to_double (scm_cdr (s)); |
46 | 50 |
47 Grob *s2 = Beam::last_normal_stem (beam); | 51 Grob *s2 = Beam::last_normal_stem (beam); |
48 Grob *s1 = Beam::first_normal_stem (beam); | 52 Grob *s1 = Beam::first_normal_stem (beam); |
49 ······ | 53 ······ |
50 Grob *common = s1->common_refpoint (s2, X_AXIS); | 54 Grob *common = s1->common_refpoint (s2, X_AXIS); |
51 Real dx = s2->relative_coordinate (common, X_AXIS) - | 55 Real dx = s2->relative_coordinate (common, X_AXIS) - |
52 s1->relative_coordinate (common, X_AXIS); | 56 s1->relative_coordinate (common, X_AXIS); |
53 | 57 |
54 return scm_from_double (dx ? dy / dx : 0); | 58 return scm_from_double (dx ? dy / dx : 0); |
55 } | 59 } |
56 else | 60 else |
57 /* down stems with flags should have more sloped trems (helps avoid | 61 */ |
58 flag/stem collisions without making the stem very long) */ | 62 |
59 return scm_from_double ( | 63 /* down stems with flags should have more sloped trems (helps avoid |
60 (Stem::duration_log (stem) >= 3 && get_grob_direction (stem) == DOWN) ? | 64 flag/stem collisions without making the stem very long) */ |
61 0.40 : 0.25); | 65 return scm_from_double ( |
| 66 (Stem::duration_log (stem) >= 3 && get_grob_direction (stem) == DOWN) ? |
| 67 0.40 : 0.25); |
62 } | 68 } |
63 | 69 |
64 MAKE_SCHEME_CALLBACK (Stem_tremolo, calc_width, 1) | 70 MAKE_SCHEME_CALLBACK (Stem_tremolo, calc_width, 1) |
65 SCM | 71 SCM |
66 Stem_tremolo::calc_width (SCM smob) | 72 Stem_tremolo::calc_width (SCM smob) |
67 { | 73 { |
68 Grob *me = unsmob_grob (smob); | 74 Grob *me = unsmob_grob (smob); |
69 Grob *stem = unsmob_grob (me->get_object ("stem")); | 75 Grob *stem = unsmob_grob (me->get_object ("stem")); |
70 Direction stemdir = get_grob_direction (stem); | 76 Direction stemdir = get_grob_direction (stem); |
71 bool beam = Stem::get_beam (stem); | 77 bool beam = Stem::get_beam (stem); |
72 bool flag = Stem::duration_log (stem) >= 3 && !beam; | 78 bool flag = Stem::duration_log (stem) >= 3 && !beam; |
73 | 79 |
74 /* beamed stems and up-stems with flags have shorter tremolos */ | 80 /* beamed stems and up-stems with flags have shorter tremolos */ |
75 return scm_from_double (((stemdir == UP && flag) || beam)? 1.0 : 1.5); | 81 return scm_from_double (((stemdir == UP && flag) || beam)? 1.0 : 1.5); |
76 } | 82 } |
77 | 83 |
78 MAKE_SCHEME_CALLBACK (Stem_tremolo, calc_style, 1) | 84 MAKE_SCHEME_CALLBACK (Stem_tremolo, calc_style, 1) |
79 SCM | 85 SCM |
80 Stem_tremolo::calc_style (SCM smob) | 86 Stem_tremolo::calc_style (SCM smob) |
81 { | 87 { |
| 88 /* We used to use rectangle tremolo style for beamed notes |
| 89 and flagged upstem notes, but it looks like it shouldn't |
| 90 be done that way. |
| 91 |
82 Grob *me = unsmob_grob (smob); | 92 Grob *me = unsmob_grob (smob); |
83 Grob *stem = unsmob_grob (me->get_object ("stem")); | 93 Grob *stem = unsmob_grob (me->get_object ("stem")); |
84 Direction stemdir = get_grob_direction (stem); | 94 Direction stemdir = get_grob_direction (stem); |
85 bool beam = Stem::get_beam (stem); | 95 bool beam = Stem::get_beam (stem); |
86 bool flag = Stem::duration_log (stem) >= 3 && !beam; | 96 bool flag = Stem::duration_log (stem) >= 3 && !beam; |
87 | 97 |
88 return ly_symbol2scm (((stemdir == UP && flag) || beam) ? "rectangle" : "defau
lt"); | 98 return ly_symbol2scm (((stemdir == UP && flag) || beam) ? "rectangle" : "defau
lt"); |
| 99 */ |
| 100 |
| 101 return ly_symbol2scm ("default"); |
89 } | 102 } |
90 | 103 |
91 Real | 104 Real |
92 Stem_tremolo::get_beam_translation (Grob *me) | 105 Stem_tremolo::get_beam_translation (Grob *me) |
93 { | 106 { |
94 Grob *stem = unsmob_grob (me->get_object ("stem")); | 107 Grob *stem = unsmob_grob (me->get_object ("stem")); |
95 Spanner *beam = Stem::get_beam (stem); | 108 Spanner *beam = Stem::get_beam (stem); |
96 | 109 |
97 return (beam && beam->is_live ()) | 110 return (beam && beam->is_live ()) |
98 ? Beam::get_beam_translation (beam) | 111 ? Beam::get_beam_translation (beam) |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 | 276 |
264 /* properties */ | 277 /* properties */ |
265 "beam-thickness " | 278 "beam-thickness " |
266 "beam-width " | 279 "beam-width " |
267 "flag-count " | 280 "flag-count " |
268 "length-fraction " | 281 "length-fraction " |
269 "stem " | 282 "stem " |
270 "style " | 283 "style " |
271 "slope " | 284 "slope " |
272 ); | 285 ); |
OLD | NEW |