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) 2000--2011 Han-Wen Nienhuys <hanwen@xs4all.nl> | 4 Copyright (C) 2000--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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 Align_interface::align_elements_to_minimum_distances (Grob *me, Axis a) | 301 Align_interface::align_elements_to_minimum_distances (Grob *me, Axis a) |
302 { | 302 { |
303 extract_grob_set (me, "elements", all_grobs); | 303 extract_grob_set (me, "elements", all_grobs); |
304 | 304 |
305 vector<Real> translates = get_minimum_translations (me, all_grobs, a); | 305 vector<Real> translates = get_minimum_translations (me, all_grobs, a); |
306 if (translates.size ()) | 306 if (translates.size ()) |
307 for (vsize j = 0; j < all_grobs.size (); j++) | 307 for (vsize j = 0; j < all_grobs.size (); j++) |
308 all_grobs[j]->translate_axis (translates[j], a); | 308 all_grobs[j]->translate_axis (translates[j], a); |
309 } | 309 } |
310 | 310 |
| 311 |
| 312 MAKE_SCHEME_CALLBACK (Align_interface, full_score_pure_minimum_translations, 1); |
| 313 SCM |
| 314 Align_interface::full_score_pure_minimum_translations (SCM smob) |
| 315 { |
| 316 Grob *me = unsmob_grob (smob); |
| 317 extract_grob_set (me, "elements", all_grobs); |
| 318 |
| 319 vector<Real> pure_minimum_translations = Align_interface::get_pure_minimum_tra
nslations (me, all_grobs, Y_AXIS, 0, INT_MAX); |
| 320 SCM l = SCM_EOL; |
| 321 SCM *tail = &l; |
| 322 for (vsize i = 0; i < pure_minimum_translations.size (); i++)·· |
| 323 { |
| 324 *tail = scm_cons (scm_from_double (pure_minimum_translations[i]), SCM_EOL)
; |
| 325 tail = SCM_CDRLOC (*tail); |
| 326 } |
| 327 return l; |
| 328 } |
| 329 |
| 330 vector<Real> |
| 331 float_list_to_vector (SCM l) |
| 332 { |
| 333 vector<Real> floats; |
| 334 for (SCM s = l; scm_is_pair (s); s = scm_cdr (s)) |
| 335 floats.push_back (robust_scm2double (scm_car (s), 0.0)); |
| 336 return floats; |
| 337 } |
| 338 |
311 Real | 339 Real |
312 Align_interface::get_pure_child_y_translation (Grob *me, Grob *ch, int start, in
t end) | 340 Align_interface::get_pure_child_y_translation (Grob *me, Grob *ch, int start, in
t end) |
313 { | 341 { |
314 extract_grob_set (me, "elements", all_grobs); | 342 extract_grob_set (me, "elements", all_grobs); |
315 vector<Real> translates = get_pure_minimum_translations (me, all_grobs, Y_AXIS
, start, end); | 343 vector<Real> translates = start == 0 && end == INT_MAX |
| 344 ? float_list_to_vector (me->get_object ("full-score-
pure-minimum-translations")) |
| 345 : get_pure_minimum_translations (me, all_grobs, Y_AX
IS, start, end); |
316 | 346 |
317 if (translates.size ()) | 347 if (translates.size ()) |
318 { | 348 { |
319 for (vsize i = 0; i < all_grobs.size (); i++) | 349 for (vsize i = 0; i < all_grobs.size (); i++) |
320 if (all_grobs[i] == ch) | 350 if (all_grobs[i] == ch) |
321 return translates[i]; | 351 return translates[i]; |
322 } | 352 } |
323 else | 353 else |
324 return 0; | 354 return 0; |
325 | 355 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 ADD_INTERFACE (Align_interface, | 392 ADD_INTERFACE (Align_interface, |
363 "Order grobs from top to bottom, left to right, right to left" | 393 "Order grobs from top to bottom, left to right, right to left" |
364 " or bottom to top. For vertical alignments of staves, the" | 394 " or bottom to top. For vertical alignments of staves, the" |
365 " @code{break-system-details} of the left" | 395 " @code{break-system-details} of the left" |
366 " @rinternals{NonMusicalPaperColumn} may be set to tune" | 396 " @rinternals{NonMusicalPaperColumn} may be set to tune" |
367 " vertical spacing.", | 397 " vertical spacing.", |
368 | 398 |
369 /* properties */ | 399 /* properties */ |
370 "align-dir " | 400 "align-dir " |
371 "axes " | 401 "axes " |
| 402 "full-score-pure-minimum-translations " |
372 "elements " | 403 "elements " |
373 "padding " | 404 "padding " |
374 "positioning-done " | 405 "positioning-done " |
375 "stacking-dir " | 406 "stacking-dir " |
376 ); | 407 ); |
OLD | NEW |