LEFT | RIGHT |
(no file at all) | |
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--2020 Han-Wen Nienhuys <hanwen@xs4all.nl> | 4 Copyright (C) 1997--2020 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 21 matching lines...) Expand all Loading... |
32 #include "text-interface.hh" | 32 #include "text-interface.hh" |
33 #include "note-column.hh" | 33 #include "note-column.hh" |
34 #include "system.hh" | 34 #include "system.hh" |
35 #include "warn.hh" | 35 #include "warn.hh" |
36 | 36 |
37 MAKE_SCHEME_CALLBACK (Hairpin, pure_height, 3); | 37 MAKE_SCHEME_CALLBACK (Hairpin, pure_height, 3); |
38 SCM | 38 SCM |
39 Hairpin::pure_height (SCM smob, SCM, SCM) | 39 Hairpin::pure_height (SCM smob, SCM, SCM) |
40 { | 40 { |
41 Grob *me = unsmob<Grob> (smob); | 41 Grob *me = unsmob<Grob> (smob); |
42 Real height = robust_scm2double (me->get_property ("height"), 0.0) | 42 Real height = robust_scm2double (get_property (me, "height"), 0.0) |
43 * Staff_symbol_referencer::staff_space (me); | 43 * Staff_symbol_referencer::staff_space (me); |
44 | 44 |
45 Real thickness = robust_scm2double (me->get_property ("thickness"), 1) | 45 Real thickness = robust_scm2double (get_property (me, "thickness"), 1) |
46 * Staff_symbol_referencer::line_thickness (me); | 46 * Staff_symbol_referencer::line_thickness (me); |
47 | 47 |
48 height += thickness / 2; | 48 height += thickness / 2; |
49 return ly_interval2scm (Interval (-height, height)); | 49 return ly_interval2scm (Interval (-height, height)); |
50 } | 50 } |
51 | 51 |
52 MAKE_SCHEME_CALLBACK (Hairpin, broken_bound_padding, 1); | 52 MAKE_SCHEME_CALLBACK (Hairpin, broken_bound_padding, 1); |
53 SCM | 53 SCM |
54 Hairpin::broken_bound_padding (SCM smob) | 54 Hairpin::broken_bound_padding (SCM smob) |
55 { | 55 { |
(...skipping 21 matching lines...) Expand all Loading... |
77 return scm_from_double (0.0); | 77 return scm_from_double (0.0); |
78 | 78 |
79 Drul_array<Grob *> span_bars (0, 0); | 79 Drul_array<Grob *> span_bars (0, 0); |
80 for (DOWN_and_UP (d)) | 80 for (DOWN_and_UP (d)) |
81 { | 81 { |
82 extract_grob_set (vertical_axis_groups[d], "elements", elts); | 82 extract_grob_set (vertical_axis_groups[d], "elements", elts); |
83 for (vsize i = elts.size (); i--;) | 83 for (vsize i = elts.size (); i--;) |
84 if (elts[i]->internal_has_interface (ly_symbol2scm ("bar-line-interface"
)) | 84 if (elts[i]->internal_has_interface (ly_symbol2scm ("bar-line-interface"
)) |
85 && dynamic_cast<Item *> (elts[i])->break_status_dir () == -1) | 85 && dynamic_cast<Item *> (elts[i])->break_status_dir () == -1) |
86 { | 86 { |
87 SCM hsb = elts[i]->get_property ("has-span-bar"); | 87 SCM hsb = get_property (elts[i], "has-span-bar"); |
88 if (!scm_is_pair (hsb)) | 88 if (!scm_is_pair (hsb)) |
89 break; | 89 break; |
90 | 90 |
91 span_bars[d] = unsmob<Grob> ((d == UP ? scm_car : scm_cdr) (hsb)); | 91 span_bars[d] = unsmob<Grob> ((d == UP ? scm_car : scm_cdr) (hsb)); |
92 break; | 92 break; |
93 } | 93 } |
94 | 94 |
95 if (!span_bars[d]) | 95 if (!span_bars[d]) |
96 return scm_from_double (0.0); | 96 return scm_from_double (0.0); |
97 } | 97 } |
98 | 98 |
99 if (span_bars[DOWN] != span_bars[UP]) | 99 if (span_bars[DOWN] != span_bars[UP]) |
100 return scm_from_double (0.0); | 100 return scm_from_double (0.0); |
101 | 101 |
102 return scm_from_double (robust_scm2double (me->get_property ("bound-padding"),
0.5) | 102 return scm_from_double (robust_scm2double (get_property (me, "bound-padding"),
0.5) |
103 / 2.0); | 103 / 2.0); |
104 } | 104 } |
105 | 105 |
106 MAKE_SCHEME_CALLBACK (Hairpin, print, 1); | 106 MAKE_SCHEME_CALLBACK (Hairpin, print, 1); |
107 SCM | 107 SCM |
108 Hairpin::print (SCM smob) | 108 Hairpin::print (SCM smob) |
109 { | 109 { |
110 Spanner *me = unsmob<Spanner> (smob); | 110 Spanner *me = unsmob<Spanner> (smob); |
111 | 111 |
112 SCM s = me->get_property ("grow-direction"); | 112 SCM s = get_property (me, "grow-direction"); |
113 if (!is_direction (s)) | 113 if (!is_direction (s)) |
114 { | 114 { |
115 me->suicide (); | 115 me->suicide (); |
116 return SCM_EOL; | 116 return SCM_EOL; |
117 } | 117 } |
118 | 118 |
119 Direction grow_dir = to_dir (s); | 119 Direction grow_dir = to_dir (s); |
120 Real padding = robust_scm2double (me->get_property ("bound-padding"), 0.5); | 120 Real padding = robust_scm2double (get_property (me, "bound-padding"), 0.5); |
121 | 121 |
122 Drul_array<bool> broken; | 122 Drul_array<bool> broken; |
123 Drul_array<Item *> bounds; | 123 Drul_array<Item *> bounds; |
124 for (LEFT_and_RIGHT (d)) | 124 for (LEFT_and_RIGHT (d)) |
125 { | 125 { |
126 bounds[d] = me->get_bound (d); | 126 bounds[d] = me->get_bound (d); |
127 broken[d] = bounds[d]->break_status_dir () != CENTER; | 127 broken[d] = bounds[d]->break_status_dir () != CENTER; |
128 } | 128 } |
129 | 129 |
130 if (broken[RIGHT]) | 130 if (broken[RIGHT]) |
131 { | 131 { |
132 Spanner *next = me->broken_neighbor (RIGHT); | 132 Spanner *next = me->broken_neighbor (RIGHT); |
133 // Hairpin-parts suicide in after-line-breaking if they need not be drawn | 133 // Hairpin-parts suicide in after-line-breaking if they need not be drawn |
134 if (next) | 134 if (next) |
135 { | 135 { |
136 (void) next->get_property ("after-line-breaking"); | 136 (void) get_property (next, "after-line-breaking"); |
137 broken[RIGHT] = next->is_live (); | 137 broken[RIGHT] = next->is_live (); |
138 } | 138 } |
139 else | 139 else |
140 broken[RIGHT] = false; | 140 broken[RIGHT] = false; |
141 } | 141 } |
142 | 142 |
143 Grob *common = bounds[LEFT]->common_refpoint (bounds[RIGHT], X_AXIS); | 143 Grob *common = bounds[LEFT]->common_refpoint (bounds[RIGHT], X_AXIS); |
144 Drul_array<Real> x_points; | 144 Drul_array<Real> x_points; |
145 | 145 |
146 /* | 146 /* |
147 Use the height and thickness of the hairpin when making a circled tip | 147 Use the height and thickness of the hairpin when making a circled tip |
148 */ | 148 */ |
149 bool circled_tip = ly_scm2bool (me->get_property ("circled-tip")); | 149 bool circled_tip = ly_scm2bool (get_property (me, "circled-tip")); |
150 Real height = robust_scm2double (me->get_property ("height"), 0.2) | 150 Real height = robust_scm2double (get_property (me, "height"), 0.2) |
151 * Staff_symbol_referencer::staff_space (me); | 151 * Staff_symbol_referencer::staff_space (me); |
152 /* | 152 /* |
153 FIXME: 0.525 is still just a guess... | 153 FIXME: 0.525 is still just a guess... |
154 */ | 154 */ |
155 Real rad = height * 0.525; | 155 Real rad = height * 0.525; |
156 Real thick = 1.0; | 156 Real thick = 1.0; |
157 if (circled_tip) | 157 if (circled_tip) |
158 thick = robust_scm2double (me->get_property ("thickness"), 1.0) | 158 thick = robust_scm2double (get_property (me, "thickness"), 1.0) |
159 * Staff_symbol_referencer::line_thickness (me); | 159 * Staff_symbol_referencer::line_thickness (me); |
160 Drul_array<Real> shorten = robust_scm2interval (me->get_property ("shorten-pai
r"), | 160 Drul_array<Real> shorten = robust_scm2interval (get_property (me, "shorten-pai
r"), |
161 Interval (0, 0)); | 161 Interval (0, 0)); |
162 | 162 |
163 for (LEFT_and_RIGHT (d)) | 163 for (LEFT_and_RIGHT (d)) |
164 { | 164 { |
165 Item *b = bounds[d]; | 165 Item *b = bounds[d]; |
166 Interval e = Axis_group_interface::generic_bound_extent (b, common, X_AXIS
); | 166 Interval e = Axis_group_interface::generic_bound_extent (b, common, X_AXIS
); |
167 | 167 |
168 x_points[d] = b->relative_coordinate (common, X_AXIS); | 168 x_points[d] = b->relative_coordinate (common, X_AXIS); |
169 if (broken [d]) | 169 if (broken [d]) |
170 { | 170 { |
171 if (d == LEFT) | 171 if (d == LEFT) |
172 x_points[d] = e[-d]; | 172 x_points[d] = e[-d]; |
173 else | 173 else |
174 { | 174 { |
175 Real broken_bound_padding | 175 Real broken_bound_padding |
176 = robust_scm2double (me->get_property ("broken-bound-padding"),
0.0); | 176 = robust_scm2double (get_property (me, "broken-bound-padding"),
0.0); |
177 extract_grob_set (me, "concurrent-hairpins", chp); | 177 extract_grob_set (me, "concurrent-hairpins", chp); |
178 for (vsize i = 0; i < chp.size (); i++) | 178 for (vsize i = 0; i < chp.size (); i++) |
179 { | 179 { |
180 Spanner *span_elt = dynamic_cast<Spanner *> (chp[i]); | 180 Spanner *span_elt = dynamic_cast<Spanner *> (chp[i]); |
181 if (span_elt->get_bound (RIGHT)->break_status_dir () == LEFT) | 181 if (span_elt->get_bound (RIGHT)->break_status_dir () == LEFT) |
182 broken_bound_padding = std::max (broken_bound_padding, | 182 broken_bound_padding = std::max (broken_bound_padding, |
183 robust_scm2double (span_elt
->get_property ("broken-bound-padding"), 0.0)); | 183 robust_scm2double (get_prop
erty (span_elt, "broken-bound-padding"), 0.0)); |
184 } | 184 } |
185 x_points[d] -= d * broken_bound_padding; | 185 x_points[d] -= d * broken_bound_padding; |
186 } | 186 } |
187 } | 187 } |
188 else | 188 else |
189 { | 189 { |
190 if (has_interface<Text_interface> (b)) | 190 if (has_interface<Text_interface> (b)) |
191 { | 191 { |
192 if (!e.is_empty ()) | 192 if (!e.is_empty ()) |
193 x_points[d] = e[-d] - d * padding; | 193 x_points[d] = e[-d] - d * padding; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 /* properties */ | 338 /* properties */ |
339 "adjacent-spanners " | 339 "adjacent-spanners " |
340 "circled-tip " | 340 "circled-tip " |
341 "concurrent-hairpins " | 341 "concurrent-hairpins " |
342 "broken-bound-padding " | 342 "broken-bound-padding " |
343 "bound-padding " | 343 "bound-padding " |
344 "grow-direction " | 344 "grow-direction " |
345 "height " | 345 "height " |
346 "shorten-pair " | 346 "shorten-pair " |
347 ); | 347 ); |
LEFT | RIGHT |