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 | 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 return scm_from_double (0.0); | 62 return scm_from_double (0.0); |
63 } | 63 } |
64 | 64 |
65 System *sys = dynamic_cast<System *> (me->get_system ()); | 65 System *sys = dynamic_cast<System *> (me->get_system ()); |
66 Direction dir = get_grob_direction (me->get_parent (Y_AXIS)); | 66 Direction dir = get_grob_direction (me->get_parent (Y_AXIS)); |
67 if (!dir) | 67 if (!dir) |
68 return scm_from_double (0.0); | 68 return scm_from_double (0.0); |
69 | 69 |
70 Grob *my_vertical_axis_group = Grob::get_vertical_axis_group (me); | 70 Grob *my_vertical_axis_group = Grob::get_vertical_axis_group (me); |
71 Drul_array<Grob *> vertical_axis_groups; | 71 Drul_array<Grob *> vertical_axis_groups; |
72 Direction d = DOWN; | 72 for (DOWN_and_UP (d)) |
73 do | |
74 vertical_axis_groups[d] = d == dir | 73 vertical_axis_groups[d] = d == dir |
75 ? sys->get_neighboring_staff (d, my_vertical_axis_
group, Interval_t<int> (me->spanned_rank_interval ())) | 74 ? sys->get_neighboring_staff (d, my_vertical_axis_
group, Interval_t<int> (me->spanned_rank_interval ())) |
76 : my_vertical_axis_group; | 75 : my_vertical_axis_group; |
77 while (flip (&d) != DOWN); | |
78 | 76 |
79 if (!vertical_axis_groups[dir]) | 77 if (!vertical_axis_groups[dir]) |
80 return scm_from_double (0.0); | 78 return scm_from_double (0.0); |
81 | 79 |
82 Drul_array<Grob *> span_bars (0, 0); | 80 Drul_array<Grob *> span_bars (0, 0); |
83 d = DOWN; | 81 for (DOWN_and_UP (d)) |
84 do | |
85 { | 82 { |
86 extract_grob_set (vertical_axis_groups[d], "elements", elts); | 83 extract_grob_set (vertical_axis_groups[d], "elements", elts); |
87 for (vsize i = elts.size (); i--;) | 84 for (vsize i = elts.size (); i--;) |
88 if (Bar_line::has_interface (elts[i]) | 85 if (Bar_line::has_interface (elts[i]) |
89 && dynamic_cast<Item *> (elts[i])->break_status_dir () == -1) | 86 && dynamic_cast<Item *> (elts[i])->break_status_dir () == -1) |
90 { | 87 { |
91 SCM hsb = elts[i]->get_property ("has-span-bar"); | 88 SCM hsb = elts[i]->get_property ("has-span-bar"); |
92 if (!scm_is_pair (hsb)) | 89 if (!scm_is_pair (hsb)) |
93 break; | 90 break; |
94 | 91 |
95 span_bars[d] = unsmob_grob ((d == UP ? scm_car : scm_cdr) (hsb)); | 92 span_bars[d] = unsmob_grob ((d == UP ? scm_car : scm_cdr) (hsb)); |
96 break; | 93 break; |
97 } | 94 } |
98 if (!span_bars[d]) | 95 if (!span_bars[d]) |
99 return scm_from_double (0.0); | 96 return scm_from_double (0.0); |
100 } | 97 } |
101 while (flip (&d) != DOWN); | |
102 | 98 |
103 if (span_bars[DOWN] != span_bars[UP]) | 99 if (span_bars[DOWN] != span_bars[UP]) |
104 return scm_from_double (0.0); | 100 return scm_from_double (0.0); |
105 | 101 |
106 return scm_from_double (robust_scm2double (me->get_property ("bound-padding"),
0.5) | 102 return scm_from_double (robust_scm2double (me->get_property ("bound-padding"),
0.5) |
107 / 2.0); | 103 / 2.0); |
108 } | 104 } |
109 | 105 |
110 MAKE_SCHEME_CALLBACK (Hairpin, print, 1); | 106 MAKE_SCHEME_CALLBACK (Hairpin, print, 1); |
111 SCM | 107 SCM |
112 Hairpin::print (SCM smob) | 108 Hairpin::print (SCM smob) |
113 { | 109 { |
114 Spanner *me = unsmob_spanner (smob); | 110 Spanner *me = unsmob_spanner (smob); |
115 | 111 |
116 SCM s = me->get_property ("grow-direction"); | 112 SCM s = me->get_property ("grow-direction"); |
117 if (!is_direction (s)) | 113 if (!is_direction (s)) |
118 { | 114 { |
119 me->suicide (); | 115 me->suicide (); |
120 return SCM_EOL; | 116 return SCM_EOL; |
121 } | 117 } |
122 | 118 |
123 Direction grow_dir = to_dir (s); | 119 Direction grow_dir = to_dir (s); |
124 Real padding = robust_scm2double (me->get_property ("bound-padding"), 0.5); | 120 Real padding = robust_scm2double (me->get_property ("bound-padding"), 0.5); |
125 | 121 |
126 Drul_array<bool> broken; | 122 Drul_array<bool> broken; |
127 Drul_array<Item *> bounds; | 123 Drul_array<Item *> bounds; |
128 Direction d = LEFT; | 124 for (LEFT_and_RIGHT (d)) |
129 do | |
130 { | 125 { |
131 bounds[d] = me->get_bound (d); | 126 bounds[d] = me->get_bound (d); |
132 broken[d] = bounds[d]->break_status_dir () != CENTER; | 127 broken[d] = bounds[d]->break_status_dir () != CENTER; |
133 } | 128 } |
134 while (flip (&d) != LEFT); | |
135 | 129 |
136 broken[RIGHT] = broken[RIGHT] && me->broken_neighbor (RIGHT); | 130 broken[RIGHT] = broken[RIGHT] && me->broken_neighbor (RIGHT); |
137 broken[RIGHT] = broken[RIGHT] && me->broken_neighbor (RIGHT)->is_live (); | 131 broken[RIGHT] = broken[RIGHT] && me->broken_neighbor (RIGHT)->is_live (); |
138 | 132 |
139 if (broken[RIGHT]) | 133 if (broken[RIGHT]) |
140 { | 134 { |
141 Spanner *next = me->broken_neighbor (RIGHT); | 135 Spanner *next = me->broken_neighbor (RIGHT); |
142 Stencil *s = next->get_stencil (); | 136 Stencil *s = next->get_stencil (); |
143 if (!s || s->is_empty ()) | 137 if (!s || s->is_empty ()) |
144 broken[RIGHT] = false; | 138 broken[RIGHT] = false; |
(...skipping 10 matching lines...) Expand all Loading... |
155 * Staff_symbol_referencer::staff_space (me); | 149 * Staff_symbol_referencer::staff_space (me); |
156 /* | 150 /* |
157 FIXME: 0.525 is still just a guess... | 151 FIXME: 0.525 is still just a guess... |
158 */ | 152 */ |
159 Real rad = height * 0.525; | 153 Real rad = height * 0.525; |
160 Real thick = 1.0; | 154 Real thick = 1.0; |
161 if (circled_tip) | 155 if (circled_tip) |
162 thick = robust_scm2double (me->get_property ("thickness"), 1.0) | 156 thick = robust_scm2double (me->get_property ("thickness"), 1.0) |
163 * Staff_symbol_referencer::line_thickness (me); | 157 * Staff_symbol_referencer::line_thickness (me); |
164 | 158 |
165 do | 159 for (LEFT_and_RIGHT (d)) |
166 { | 160 { |
167 Item *b = bounds[d]; | 161 Item *b = bounds[d]; |
168 Interval e = (Paper_column::has_interface (b) && b->break_status_dir ()) | 162 Interval e = (Paper_column::has_interface (b) && b->break_status_dir ()) |
169 ? Axis_group_interface::generic_bound_extent (b, common, X_AX
IS) | 163 ? Axis_group_interface::generic_bound_extent (b, common, X_AX
IS) |
170 : robust_relative_extent (b, common, X_AXIS); | 164 : robust_relative_extent (b, common, X_AXIS); |
171 | 165 |
172 x_points[d] = b->relative_coordinate (common, X_AXIS); | 166 x_points[d] = b->relative_coordinate (common, X_AXIS); |
173 if (broken [d]) | 167 if (broken [d]) |
174 { | 168 { |
175 if (d == LEFT) | 169 if (d == LEFT) |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 x_points[d] = e[-d]; | 241 x_points[d] = e[-d]; |
248 else | 242 else |
249 x_points[d] = e[d]; | 243 x_points[d] = e[d]; |
250 | 244 |
251 if (Item::is_non_musical (b)) | 245 if (Item::is_non_musical (b)) |
252 x_points[d] -= d * padding; | 246 x_points[d] -= d * padding; |
253 } | 247 } |
254 } | 248 } |
255 } | 249 } |
256 } | 250 } |
257 while (flip (&d) != LEFT); | |
258 | 251 |
259 Real width = x_points[RIGHT] - x_points[LEFT]; | 252 Real width = x_points[RIGHT] - x_points[LEFT]; |
260 | 253 |
261 if (width < 0) | 254 if (width < 0) |
262 { | 255 { |
263 me->warning (_ ((grow_dir < 0) ? "decrescendo too small" | 256 me->warning (_ ((grow_dir < 0) ? "decrescendo too small" |
264 : "crescendo too small")); | 257 : "crescendo too small")); |
265 width = 0; | 258 width = 0; |
266 } | 259 } |
267 | 260 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 | 329 |
337 /* properties */ | 330 /* properties */ |
338 "adjacent-spanners " | 331 "adjacent-spanners " |
339 "circled-tip " | 332 "circled-tip " |
340 "concurrent-hairpins " | 333 "concurrent-hairpins " |
341 "broken-bound-padding " | 334 "broken-bound-padding " |
342 "bound-padding " | 335 "bound-padding " |
343 "grow-direction " | 336 "grow-direction " |
344 "height " | 337 "height " |
345 ); | 338 ); |
OLD | NEW |