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) 1998--2015 Jan Nieuwenhuizen <janneke@gnu.org> | 4 Copyright (C) 1998--2015 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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 } | 310 } |
311 else | 311 else |
312 { | 312 { |
313 r.translate_axis (staff_space-r.extent (Y_AXIS).at (UP), Y_AXIS); | 313 r.translate_axis (staff_space-r.extent (Y_AXIS).at (UP), Y_AXIS); |
314 } | 314 } |
315 symbols_width += r.extent (X_AXIS).length (); | 315 symbols_width += r.extent (X_AXIS).length (); |
316 mols = scm_cons (r.smobbed_copy (), mols); | 316 mols = scm_cons (r.smobbed_copy (), mols); |
317 symbol_count++; | 317 symbol_count++; |
318 } | 318 } |
319 | 319 |
320 /* Make outer padding this much bigger. */ | 320 /* |
| 321 When symbols spread to fullest extent, outer padding is this much |
| 322 bigger. |
| 323 */ |
321 Real outer_padding_factor = 1.5; | 324 Real outer_padding_factor = 1.5; |
| 325 /* Widest gap between symbols; to be limited by max-symbol-separation */ |
322 Real inner_padding = (space - symbols_width) | 326 Real inner_padding = (space - symbols_width) |
323 / (2 * outer_padding_factor + (symbol_count - 1)); | 327 / (2 * outer_padding_factor + (symbol_count - 1)); |
324 if (inner_padding < 0) | 328 if (inner_padding < 0) |
325 inner_padding = 1.0; | 329 inner_padding = 1.0; |
326 | 330 |
| 331 Real max_separation = max (robust_scm2double (me->get_property ("max-symbol-se
paration"), 8.0), |
| 332 1.0); |
| 333 |
| 334 inner_padding = min (inner_padding, max_separation); |
| 335 Real left_offset = (space - symbols_width - (inner_padding * (symbol_count - 1
))) |
| 336 / 2; |
| 337 |
327 Stencil mol; | 338 Stencil mol; |
328 for (SCM s = mols; scm_is_pair (s); s = scm_cdr (s)) | 339 for (SCM s = mols; scm_is_pair (s); s = scm_cdr (s)) |
329 mol.add_at_edge (X_AXIS, LEFT, *unsmob<Stencil> (scm_car (s)), | 340 mol.add_at_edge (X_AXIS, LEFT, *unsmob<Stencil> (scm_car (s)), |
330 inner_padding); | 341 inner_padding); |
331 mol.align_to (X_AXIS, LEFT); | 342 mol.align_to (X_AXIS, LEFT); |
332 mol.translate_axis (outer_padding_factor * inner_padding, X_AXIS); | 343 mol.translate_axis (left_offset, X_AXIS); |
333 | 344 |
334 return mol; | 345 return mol; |
335 } | 346 } |
336 | 347 |
337 void | 348 void |
338 Multi_measure_rest::add_column (Grob *me, Item *c) | 349 Multi_measure_rest::add_column (Grob *me, Item *c) |
339 { | 350 { |
340 add_bound_item (dynamic_cast<Spanner *> (me), c); | 351 add_bound_item (dynamic_cast<Spanner *> (me), c); |
341 } | 352 } |
342 | 353 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 return SCM_UNSPECIFIED; | 436 return SCM_UNSPECIFIED; |
426 } | 437 } |
427 | 438 |
428 ADD_INTERFACE (Multi_measure_rest, | 439 ADD_INTERFACE (Multi_measure_rest, |
429 "A rest that spans a whole number of measures.", | 440 "A rest that spans a whole number of measures.", |
430 | 441 |
431 /* properties */ | 442 /* properties */ |
432 "bound-padding " | 443 "bound-padding " |
433 "expand-limit " | 444 "expand-limit " |
434 "hair-thickness " | 445 "hair-thickness " |
| 446 "max-symbol-separation " |
435 "measure-count " | 447 "measure-count " |
436 "minimum-length " | 448 "minimum-length " |
437 "round-up-exceptions " | 449 "round-up-exceptions " |
438 "round-up-to-longer-rest " | 450 "round-up-to-longer-rest " |
439 "space-increment " | 451 "space-increment " |
440 "spacing-pair " | 452 "spacing-pair " |
441 "thick-thickness " | 453 "thick-thickness " |
442 "usable-duration-logs " | 454 "usable-duration-logs " |
443 ); | 455 ); |
OLD | NEW |