X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fscript-column.cc;h=94aa8908e70a1dfc3c2dfc791358491edb99e9d9;hb=7d7589bdf70cb227b032220bae87eda2045ccc8e;hp=4e2dd3edc487a4c27e6d8b4bdd34b916611044d3;hpb=4bb29573149a0ffa1f881c5e38a0fe68e9e76b67;p=lilypond.git diff --git a/lily/script-column.cc b/lily/script-column.cc index 4e2dd3edc4..94aa8908e7 100644 --- a/lily/script-column.cc +++ b/lily/script-column.cc @@ -1,7 +1,7 @@ /* This file is part of LilyPond, the GNU music typesetter. - Copyright (C) 1999--2011 Han-Wen Nienhuys + Copyright (C) 1999--2015 Han-Wen Nienhuys LilyPond is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -39,14 +39,15 @@ Script_column::add_side_positioned (Grob *me, Grob *script) return; Pointer_group_interface::add_grob (me, ly_symbol2scm ("scripts"), script); + script->set_object ("script-column", me->self_scm ()); } LY_DEFINE (ly_grob_script_priority_less, "ly:grob-script-priority-less", 2, 0, 0, (SCM a, SCM b), "Compare two grobs by script priority. For internal use.") { - Grob *i1 = unsmob_grob (a); - Grob *i2 = unsmob_grob (b); + Grob *i1 = unsmob (a); + Grob *i2 = unsmob (b); SCM p1 = i1->get_property ("script-priority"); SCM p2 = i2->get_property ("script-priority"); @@ -58,7 +59,7 @@ MAKE_SCHEME_CALLBACK (Script_column, row_before_line_breaking, 1); SCM Script_column::row_before_line_breaking (SCM smob) { - Grob *me = unsmob_grob (smob); + Grob *me = unsmob (smob); vector horizontal_grobs; extract_grob_set (me, "scripts", scripts); @@ -71,8 +72,8 @@ Script_column::row_before_line_breaking (SCM smob) /* Don't want to consider scripts horizontally next to notes. */ - if (Accidental_placement::has_interface (sc) - || Arpeggio::has_interface (sc)) + if (has_interface (sc) + || has_interface (sc)) { affect_all_grobs.push_back (sc); } @@ -101,7 +102,7 @@ MAKE_SCHEME_CALLBACK (Script_column, before_line_breaking, 1); SCM Script_column::before_line_breaking (SCM smob) { - Grob *me = unsmob_grob (smob); + Grob *me = unsmob (smob); vector staff_sided; extract_grob_set (me, "scripts", scripts); @@ -132,8 +133,7 @@ Script_column::order_grobs (vector grobs) scripts_drul[d] = scm_cons (g->self_scm (), scripts_drul[d]); } - Direction d = DOWN; - do + for (DOWN_and_UP (d)) { SCM ss = scm_reverse_x (scripts_drul[d], SCM_EOL); ss = scm_stable_sort_x (ss, ly_grob_script_priority_less_proc); @@ -147,17 +147,18 @@ Script_column::order_grobs (vector grobs) for (SCM s = ss; scm_is_pair (s); s = scm_cdr (s), last = g, last_initial_outside_staff = initial_outside_staff) { - g = unsmob_grob (scm_car (s)); + g = unsmob (scm_car (s)); initial_outside_staff = g->get_property ("outside-staff-priority"); if (last) //not the first grob in the list { SCM last_outside_staff = last->get_property ("outside-staff-priority"); /* - if outside_staff_priority is missing for previous grob, just - use it as a support for the current grob + if outside_staff_priority is missing for previous grob, + use all the scripts so far as support for the current grob */ if (!scm_is_number (last_outside_staff)) - Side_position_interface::add_support (g, last); + for (SCM t = ss; !scm_is_eq (t, s); t = scm_cdr (t)) + Side_position_interface::add_support (g, unsmob (scm_car (t))); /* if outside_staff_priority is missing or is equal to original outside_staff_priority of previous grob, set new @@ -172,7 +173,6 @@ Script_column::order_grobs (vector grobs) } } } - while (flip (&d) != DOWN); } ADD_INTERFACE (Script_column, @@ -180,5 +180,5 @@ ADD_INTERFACE (Script_column, " @code{script-priority} and @code{outside-staff-priority}.", /* properties */ - "" + "scripts " );