Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(318)

Side by Side Diff: lily/slur.cc

Issue 6498077: Approximates cross-staff slurs in VerticalAxisGroup vertical-skylines. Base URL: http://git.savannah.gnu.org/gitweb/?p=lilypond.git/trunk/
Patch Set: Builds cross-staff-stub skylines directly into VerticalAxisGroup skylines Created 12 years, 7 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
OLDNEW
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) 1996--2012 Han-Wen Nienhuys <hanwen@xs4all.nl> 4 Copyright (C) 1996--2012 Han-Wen Nienhuys <hanwen@xs4all.nl>
5 Jan Nieuwenhuizen <janneke@gnu.org> 5 Jan Nieuwenhuizen <janneke@gnu.org>
6 6
7 LilyPond is free software: you can redistribute it and/or modify 7 LilyPond is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or 9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version. 10 (at your option) any later version.
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 Pointer_group_interface::add_grob (me, ly_symbol2scm ("note-columns"), n); 244 Pointer_group_interface::add_grob (me, ly_symbol2scm ("note-columns"), n);
245 add_bound_item (dynamic_cast<Spanner *> (me), n); 245 add_bound_item (dynamic_cast<Spanner *> (me), n);
246 } 246 }
247 247
248 void 248 void
249 Slur::add_extra_encompass (Grob *me, Grob *n) 249 Slur::add_extra_encompass (Grob *me, Grob *n)
250 { 250 {
251 Pointer_group_interface::add_grob (me, ly_symbol2scm ("encompass-objects"), n) ; 251 Pointer_group_interface::add_grob (me, ly_symbol2scm ("encompass-objects"), n) ;
252 } 252 }
253 253
254 void
255 Slur::main_to_stub (Grob *main, Grob *stub)
256 {
257 extract_grob_set (main, "note-columns", nc);
258 for (vsize i = 0; i < nc.size (); i++)
259 add_column (stub, nc[i]);
260
261 extract_grob_set (main, "encompass-objects", eo);
262 for (vsize i = 0; i < eo.size (); i++)
263 add_extra_encompass (stub, eo[i]);
264
265 stub->set_object ("surrogate", main->self_scm ());
266
267 dynamic_cast<Spanner *> (stub)->set_bound
268 (LEFT, dynamic_cast<Spanner *> (main)->get_bound (LEFT));
269 dynamic_cast<Spanner *> (stub)->set_bound
270 (RIGHT, dynamic_cast<Spanner *> (main)->get_bound (RIGHT));
271 }
272
273 MAKE_SCHEME_CALLBACK (Slur, direction_from_shadowed_slur, 1);
274 SCM
275 Slur::direction_from_shadowed_slur (SCM smob)
276 {
277 Grob *me = unsmob_grob (smob);
278 if (Grob *slur = unsmob_grob (me->get_object ("surrogate")))
279 return scm_from_int (get_grob_direction (slur));
280
281 me->programming_error ("Cannot determine SlurStub direction");
282
283 return scm_from_int (UP);
284 }
285
254 MAKE_SCHEME_CALLBACK_WITH_OPTARGS (Slur, pure_outside_slur_callback, 4, 1, ""); 286 MAKE_SCHEME_CALLBACK_WITH_OPTARGS (Slur, pure_outside_slur_callback, 4, 1, "");
255 SCM 287 SCM
256 Slur::pure_outside_slur_callback (SCM grob, SCM start_scm, SCM end_scm, SCM offs et_scm) 288 Slur::pure_outside_slur_callback (SCM grob, SCM start_scm, SCM end_scm, SCM offs et_scm)
257 { 289 {
258 int start = robust_scm2int (start_scm, 0); 290 int start = robust_scm2int (start_scm, 0);
259 int end = robust_scm2int (end_scm, 0); 291 int end = robust_scm2int (end_scm, 0);
260 Grob *script = unsmob_grob (grob); 292 Grob *script = unsmob_grob (grob);
261 Grob *slur = unsmob_grob (script->get_object ("slur")); 293 Grob *slur = unsmob_grob (script->get_object ("slur"));
262 if (!slur) 294 if (!slur)
263 return offset_scm; 295 return offset_scm;
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 { 412 {
381 Box b; 413 Box b;
382 b.add_point (curve.curve_point (i * 1.0 / box_count)); 414 b.add_point (curve.curve_point (i * 1.0 / box_count));
383 b.add_point (curve.curve_point ((i + 1) * 1.0 / box_count)); 415 b.add_point (curve.curve_point ((i + 1) * 1.0 / box_count));
384 boxes.push_back (b); 416 boxes.push_back (b);
385 } 417 }
386 418
387 return Skyline_pair (boxes, X_AXIS).smobbed_copy (); 419 return Skyline_pair (boxes, X_AXIS).smobbed_copy ();
388 } 420 }
389 421
422 MAKE_SCHEME_CALLBACK (Slur, extremal_stub_vertical_skylines, 1);
423 SCM
424 Slur::extremal_stub_vertical_skylines (SCM smob)
425 {
426 Grob *me = unsmob_grob (smob);
427 vector<int> vais;
428 extract_grob_set (me, "note-columns", note_columns);
429 for (vsize i = 0; i < note_columns.size (); i++)
430 vais.push_back (Grob::get_vertical_axis_group_index (note_columns[i]));
431
432 vector_sort (vais, less<int> ());
433 int my_vai = Grob::get_vertical_axis_group_index (me);
434 if (!(my_vai == vais[0] || my_vai == vais.back ()))
435 return Skyline_pair ().smobbed_copy ();
436
437 Skyline_pair sky = *Skyline_pair::unsmob (vertical_skylines (smob));
438 if (my_vai == vais[0])
439 sky[DOWN] = Skyline ();
440 else
441 sky[UP] = Skyline ();
442
443 return sky.smobbed_copy ();
444 }
445
390 /* 446 /*
391 * Used by Slur_engraver:: and Phrasing_slur_engraver:: 447 * Used by Slur_engraver:: and Phrasing_slur_engraver::
392 */ 448 */
393 void 449 void
394 Slur::auxiliary_acknowledge_extra_object (Grob_info const &info, 450 Slur::auxiliary_acknowledge_extra_object (Grob_info const &info,
395 vector<Grob *> &slurs, 451 vector<Grob *> &slurs,
396 vector<Grob *> &end_slurs) 452 vector<Grob *> &end_slurs)
397 { 453 {
398 if (slurs.empty () && end_slurs.empty ()) 454 if (slurs.empty () && end_slurs.empty ())
399 return; 455 return;
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 "direction " 613 "direction "
558 "eccentricity " 614 "eccentricity "
559 "encompass-objects " 615 "encompass-objects "
560 "height-limit " 616 "height-limit "
561 "inspect-quants " 617 "inspect-quants "
562 "inspect-index " 618 "inspect-index "
563 "line-thickness " 619 "line-thickness "
564 "note-columns " 620 "note-columns "
565 "positions " 621 "positions "
566 "ratio " 622 "ratio "
567 "thickness " 623 "thickness "
dak 2012/09/02 15:59:00 No entry for "surrogate"?
MikeSol 2012/09/02 16:45:14 scm/define-grob-interfaces.scm
568 ); 624 );
569 625
OLDNEW

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b