X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fscript-column.cc;h=4e2dd3edc487a4c27e6d8b4bdd34b916611044d3;hb=b430c32d29caa72a7ae3f679f1f62066c1ebfa95;hp=460d8fdf2f2c4cbfde6482ae36186215bce05d2d;hpb=e8b7d01a24772a60b20e300209eb5be96ea0a895;p=lilypond.git diff --git a/lily/script-column.cc b/lily/script-column.cc index 460d8fdf2f..4e2dd3edc4 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--2009 Han-Wen Nienhuys + Copyright (C) 1999--2011 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 @@ -29,7 +29,7 @@ #include -typedef map > Grob_scripts_map; +typedef map > Grob_scripts_map; void Script_column::add_side_positioned (Grob *me, Grob *script) @@ -42,8 +42,8 @@ Script_column::add_side_positioned (Grob *me, Grob *script) } 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.") + 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); @@ -59,7 +59,7 @@ SCM Script_column::row_before_line_breaking (SCM smob) { Grob *me = unsmob_grob (smob); - vector horizontal_grobs; + vector horizontal_grobs; extract_grob_set (me, "scripts", scripts); Grob_scripts_map head_scripts_map; @@ -69,25 +69,25 @@ Script_column::row_before_line_breaking (SCM smob) Grob *sc = scripts[i]; /* - Don't want to consider scripts horizontally next to notes. + Don't want to consider scripts horizontally next to notes. */ if (Accidental_placement::has_interface (sc) - || Arpeggio::has_interface (sc)) - { - affect_all_grobs.push_back (sc); - } - else if (sc->get_property_data ("Y-offset") != - Side_position_interface::y_aligned_side_proc) - { - head_scripts_map[sc->get_parent (Y_AXIS)].push_back (sc); - } + || Arpeggio::has_interface (sc)) + { + affect_all_grobs.push_back (sc); + } + else if (sc->get_property_data ("Y-offset") + != Side_position_interface::y_aligned_side_proc) + { + head_scripts_map[sc->get_parent (Y_AXIS)].push_back (sc); + } } for (Grob_scripts_map::const_iterator i (head_scripts_map.begin ()); i != head_scripts_map.end (); i++) { - vector grobs = (*i).second; + vector grobs = (*i).second; // this isn't right in all cases, but in general a safe assumption. concat (grobs, affect_all_grobs); @@ -97,24 +97,23 @@ Script_column::row_before_line_breaking (SCM smob) return SCM_UNSPECIFIED; } - MAKE_SCHEME_CALLBACK (Script_column, before_line_breaking, 1); SCM Script_column::before_line_breaking (SCM smob) { Grob *me = unsmob_grob (smob); - vector staff_sided; + vector staff_sided; extract_grob_set (me, "scripts", scripts); for (vsize i = 0; i < scripts.size (); i++) { Grob *sc = scripts[i]; /* - Don't want to consider scripts horizontally next to notes. + Don't want to consider scripts horizontally next to notes. */ - if (sc->get_property_data ("X-offset") != - Side_position_interface::x_aligned_side_proc) - staff_sided.push_back (sc); + if (sc->get_property_data ("X-offset") + != Side_position_interface::x_aligned_side_proc) + staff_sided.push_back (sc); } order_grobs (staff_sided); @@ -122,7 +121,7 @@ Script_column::before_line_breaking (SCM smob) } void -Script_column::order_grobs (vector grobs) +Script_column::order_grobs (vector grobs) { Drul_array scripts_drul (SCM_EOL, SCM_EOL); for (vsize i = 0; i < grobs.size (); i++) @@ -147,40 +146,39 @@ Script_column::order_grobs (vector grobs) // loop over all grobs in script column (already sorted by script_priority) 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_grob (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"); + 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 (!scm_is_number (last_outside_staff)) - Side_position_interface::add_support (g, last); + if (!scm_is_number (last_outside_staff)) + Side_position_interface::add_support (g, last); /* if outside_staff_priority is missing or is equal to original outside_staff_priority of previous grob, set new outside_staff_priority to just higher than outside_staff_priority of previous grob in order to preserve ordering. */ - else if ((!scm_is_number (initial_outside_staff)) || - (fabs (scm_to_double (initial_outside_staff) - - robust_scm2double (last_initial_outside_staff, 0)) < 0.001)) + else if ((!scm_is_number (initial_outside_staff)) + || (fabs (scm_to_double (initial_outside_staff) + - robust_scm2double (last_initial_outside_staff, 0)) < 0.001)) g->set_property ("outside-staff-priority", - scm_from_double ( - scm_to_double (last_outside_staff) + 0.1)); - } - } + scm_from_double (scm_to_double (last_outside_staff) + 0.1)); + } + } } while (flip (&d) != DOWN); } ADD_INTERFACE (Script_column, - "An interface that sorts scripts according to their" - " @code{script-priority} and @code{outside-staff-priority}.", + "An interface that sorts scripts according to their" + " @code{script-priority} and @code{outside-staff-priority}.", - /* properties */ - "" - ); + /* properties */ + "" + );