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) 2000--2020 Jan Nieuwenhuizen <janneke@gnu.org> | 4 Copyright (C) 2000--2020 Jan Nieuwenhuizen <janneke@gnu.org> |
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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 heads *= 1 / Staff_symbol_referencer::staff_space (me); | 110 heads *= 1 / Staff_symbol_referencer::staff_space (me); |
111 | 111 |
112 return ly_interval2scm (heads); | 112 return ly_interval2scm (heads); |
113 } | 113 } |
114 | 114 |
115 MAKE_SCHEME_CALLBACK (Arpeggio, print, 1); | 115 MAKE_SCHEME_CALLBACK (Arpeggio, print, 1); |
116 SCM | 116 SCM |
117 Arpeggio::print (SCM smob) | 117 Arpeggio::print (SCM smob) |
118 { | 118 { |
119 Grob *me = unsmob<Grob> (smob); | 119 Grob *me = unsmob<Grob> (smob); |
120 Interval heads = robust_scm2interval (me->get_property ("positions"), | 120 Interval heads = robust_scm2interval (get_property (me, "positions"), |
121 Interval ()) | 121 Interval ()) |
122 * Staff_symbol_referencer::staff_space (me); | 122 * Staff_symbol_referencer::staff_space (me); |
123 | 123 |
124 if (heads.is_empty () || heads.length () < 0.5) | 124 if (heads.is_empty () || heads.length () < 0.5) |
125 { | 125 { |
126 if (to_boolean (me->get_property ("transparent"))) | 126 if (to_boolean (get_property (me, "transparent"))) |
127 { | 127 { |
128 /* | 128 /* |
129 This is part of a cross-staff/-voice span-arpeggio, | 129 This is part of a cross-staff/-voice span-arpeggio, |
130 so we need to ensure `heads' is large enough to encompass | 130 so we need to ensure `heads' is large enough to encompass |
131 a single trill-element since the span-arpeggio depends on | 131 a single trill-element since the span-arpeggio depends on |
132 its children to prevent collisions. | 132 its children to prevent collisions. |
133 */ | 133 */ |
134 heads.unite (get_squiggle (me).extent (Y_AXIS)); | 134 heads.unite (get_squiggle (me).extent (Y_AXIS)); |
135 } | 135 } |
136 else | 136 else |
137 { | 137 { |
138 me->warning (_ ("no heads for arpeggio found?")); | 138 me->warning (_ ("no heads for arpeggio found?")); |
139 me->suicide (); | 139 me->suicide (); |
140 return SCM_EOL; | 140 return SCM_EOL; |
141 } | 141 } |
142 } | 142 } |
143 | 143 |
144 SCM ad = me->get_property ("arpeggio-direction"); | 144 SCM ad = get_property (me, "arpeggio-direction"); |
145 Direction dir = CENTER; | 145 Direction dir = CENTER; |
146 if (is_direction (ad)) | 146 if (is_direction (ad)) |
147 dir = to_dir (ad); | 147 dir = to_dir (ad); |
148 | 148 |
149 Stencil mol; | 149 Stencil mol; |
150 Stencil squiggle (get_squiggle (me)); | 150 Stencil squiggle (get_squiggle (me)); |
151 | 151 |
152 /* | 152 /* |
153 Compensate for rounding error which may occur when a chord | 153 Compensate for rounding error which may occur when a chord |
154 reaches the center line, resulting in an extra squiggle | 154 reaches the center line, resulting in an extra squiggle |
(...skipping 23 matching lines...) Expand all Loading... |
178 } | 178 } |
179 | 179 |
180 /* Draws a vertical bracket to the left of a chord | 180 /* Draws a vertical bracket to the left of a chord |
181 Chris Jackson <chris@fluffhouse.org.uk> */ | 181 Chris Jackson <chris@fluffhouse.org.uk> */ |
182 | 182 |
183 MAKE_SCHEME_CALLBACK (Arpeggio, brew_chord_bracket, 1); | 183 MAKE_SCHEME_CALLBACK (Arpeggio, brew_chord_bracket, 1); |
184 SCM | 184 SCM |
185 Arpeggio::brew_chord_bracket (SCM smob) | 185 Arpeggio::brew_chord_bracket (SCM smob) |
186 { | 186 { |
187 Grob *me = unsmob<Grob> (smob); | 187 Grob *me = unsmob<Grob> (smob); |
188 Interval heads = robust_scm2interval (me->get_property ("positions"), | 188 Interval heads = robust_scm2interval (get_property (me, "positions"), |
189 Interval ()) | 189 Interval ()) |
190 * Staff_symbol_referencer::staff_space (me); | 190 * Staff_symbol_referencer::staff_space (me); |
191 | 191 |
192 Real th | 192 Real th |
193 = me->layout ()->get_dimension (ly_symbol2scm ("line-thickness")) | 193 = me->layout ()->get_dimension (ly_symbol2scm ("line-thickness")) |
194 * robust_scm2double (me->get_property ("thickness"), 1); | 194 * robust_scm2double (get_property (me, "thickness"), 1); |
195 Real sp = 1.5 * Staff_symbol_referencer::staff_space (me); | 195 Real sp = 1.5 * Staff_symbol_referencer::staff_space (me); |
196 Real dy = heads.length () + sp; | 196 Real dy = heads.length () + sp; |
197 Real x = robust_scm2double (me->get_property ("protrusion"), 0.4); | 197 Real x = robust_scm2double (get_property (me, "protrusion"), 0.4); |
198 | 198 |
199 Stencil mol (Lookup::bracket (Y_AXIS, Interval (0, dy), th, x, th)); | 199 Stencil mol (Lookup::bracket (Y_AXIS, Interval (0, dy), th, x, th)); |
200 mol.translate_axis (heads[LEFT] - sp / 2.0, Y_AXIS); | 200 mol.translate_axis (heads[LEFT] - sp / 2.0, Y_AXIS); |
201 return mol.smobbed_copy (); | 201 return mol.smobbed_copy (); |
202 } | 202 } |
203 | 203 |
204 MAKE_SCHEME_CALLBACK (Arpeggio, brew_chord_slur, 1); | 204 MAKE_SCHEME_CALLBACK (Arpeggio, brew_chord_slur, 1); |
205 SCM | 205 SCM |
206 Arpeggio::brew_chord_slur (SCM smob) | 206 Arpeggio::brew_chord_slur (SCM smob) |
207 { | 207 { |
208 Grob *me = unsmob<Grob> (smob); | 208 Grob *me = unsmob<Grob> (smob); |
209 SCM dash_definition = me->get_property ("dash-definition"); | 209 SCM dash_definition = get_property (me, "dash-definition"); |
210 Interval heads = robust_scm2interval (me->get_property ("positions"), | 210 Interval heads = robust_scm2interval (get_property (me, "positions"), |
211 Interval ()) | 211 Interval ()) |
212 * Staff_symbol_referencer::staff_space (me); | 212 * Staff_symbol_referencer::staff_space (me); |
213 | 213 |
214 Real lt | 214 Real lt |
215 = me->layout ()->get_dimension (ly_symbol2scm ("line-thickness")) | 215 = me->layout ()->get_dimension (ly_symbol2scm ("line-thickness")) |
216 * robust_scm2double (me->get_property ("line-thickness"), 1.0); | 216 * robust_scm2double (get_property (me, "line-thickness"), 1.0); |
217 Real th | 217 Real th |
218 = me->layout ()->get_dimension (ly_symbol2scm ("line-thickness")) | 218 = me->layout ()->get_dimension (ly_symbol2scm ("line-thickness")) |
219 * robust_scm2double (me->get_property ("thickness"), 1.0); | 219 * robust_scm2double (get_property (me, "thickness"), 1.0); |
220 Real dy = heads.length (); | 220 Real dy = heads.length (); |
221 | 221 |
222 Real height_limit = 1.5; | 222 Real height_limit = 1.5; |
223 Real ratio = .33; | 223 Real ratio = .33; |
224 Bezier curve = slur_shape (dy, height_limit, ratio); | 224 Bezier curve = slur_shape (dy, height_limit, ratio); |
225 curve.rotate (90.0); | 225 curve.rotate (90.0); |
226 | 226 |
227 Stencil mol (Lookup::slur (curve, th, lt, dash_definition)); | 227 Stencil mol (Lookup::slur (curve, th, lt, dash_definition)); |
228 mol.translate_axis (heads[LEFT], Y_AXIS); | 228 mol.translate_axis (heads[LEFT], Y_AXIS); |
229 return mol.smobbed_copy (); | 229 return mol.smobbed_copy (); |
230 } | 230 } |
231 | 231 |
232 /* | 232 /* |
233 We have to do a callback, because print () triggers a | 233 We have to do a callback, because print () triggers a |
234 vertical alignment if it is cross-staff. | 234 vertical alignment if it is cross-staff. |
235 */ | 235 */ |
236 MAKE_SCHEME_CALLBACK (Arpeggio, width, 1); | 236 MAKE_SCHEME_CALLBACK (Arpeggio, width, 1); |
237 SCM | 237 SCM |
238 Arpeggio::width (SCM smob) | 238 Arpeggio::width (SCM smob) |
239 { | 239 { |
240 Grob *me = unsmob<Grob> (smob); | 240 Grob *me = unsmob<Grob> (smob); |
241 return ly_interval2scm (get_squiggle (me).extent (X_AXIS)); | 241 return ly_interval2scm (get_squiggle (me).extent (X_AXIS)); |
242 } | 242 } |
243 | 243 |
244 MAKE_SCHEME_CALLBACK (Arpeggio, pure_height, 3); | 244 MAKE_SCHEME_CALLBACK (Arpeggio, pure_height, 3); |
245 SCM | 245 SCM |
246 Arpeggio::pure_height (SCM smob, SCM, SCM) | 246 Arpeggio::pure_height (SCM smob, SCM, SCM) |
247 { | 247 { |
248 Grob *me = unsmob<Grob> (smob); | 248 Grob *me = unsmob<Grob> (smob); |
249 if (to_boolean (me->get_property ("cross-staff"))) | 249 if (to_boolean (get_property (me, "cross-staff"))) |
250 return ly_interval2scm (Interval ()); | 250 return ly_interval2scm (Interval ()); |
251 | 251 |
252 return Grob::stencil_height (smob); | 252 return Grob::stencil_height (smob); |
253 } | 253 } |
254 | 254 |
255 ADD_INTERFACE (Arpeggio, | 255 ADD_INTERFACE (Arpeggio, |
256 "Functions and settings for drawing an arpeggio symbol.", | 256 "Functions and settings for drawing an arpeggio symbol.", |
257 | 257 |
258 /* properties */ | 258 /* properties */ |
259 "arpeggio-direction " | 259 "arpeggio-direction " |
260 "dash-definition " // TODO: make apply to non-slur arpeggios | 260 "dash-definition " // TODO: make apply to non-slur arpeggios |
261 "line-thickness " | 261 "line-thickness " |
262 "positions " | 262 "positions " |
263 "protrusion " | 263 "protrusion " |
264 "script-priority " // TODO: make around-note-interface | 264 "script-priority " // TODO: make around-note-interface |
265 "stems " | 265 "stems " |
266 "thickness " | 266 "thickness " |
267 ); | 267 ); |
268 | 268 |
LEFT | RIGHT |