X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fline-of-score.cc;h=dc78eb09da95770d2acfbb9acd23f7754e53ec3a;hb=b542997680bb2d95c3a03a77468b67e04d30685f;hp=2f340aaf4f9098d6bf20f48e15f75066b45b3732;hpb=e7d84e6728ecfdf74d8f214486a29c2aca199819;p=lilypond.git diff --git a/lily/line-of-score.cc b/lily/line-of-score.cc index 2f340aaf4f..dc78eb09da 100644 --- a/lily/line-of-score.cc +++ b/lily/line-of-score.cc @@ -21,6 +21,7 @@ #include "all-font-metrics.hh" Line_of_score::Line_of_score() + : Spanner (SCM_EOL) { set_elt_pointer ("columns", SCM_EOL); set_elt_pointer ("all-elements", SCM_EOL); @@ -178,27 +179,6 @@ Line_of_score::add_column (Paper_column*p) typeset_element (p); } -Link_array -Line_of_score::column_l_arr ()const -{ - Link_array acs - = Pointer_group_interface__extract_elements (this, (Paper_column*) 0, "columns"); - bool bfound = false; - for (int i= acs.size (); i -- ; ) - { - bool brb = acs[i]->breakable_b(); - bfound = bfound || brb; - - /* - the last column should be breakable. Weed out any columns that - seem empty. We need to retain breakable columns, in case - someone forced a breakpoint. - */ - if (!bfound || !acs[i]->used_b ()) - acs.del (i); - } - return acs; -} void fixup_refpoints (SCM s) @@ -323,13 +303,13 @@ Line_of_score::broken_col_range (Item const*l, Item const*r) const r = r->column_l (); SCM s = get_elt_pointer ("columns"); - while (gh_car (s) != r->self_scm_) + while (gh_pair_p (s) && gh_car (s) != r->self_scm_) s = gh_cdr (s); - - s = gh_cdr (s); + if (gh_pair_p (s)) + s = gh_cdr (s); - while (gh_car (s) != l->self_scm_) + while (gh_pair_p (s) && gh_car (s) != l->self_scm_) { Paper_column *c = dynamic_cast (unsmob_element (gh_car (s))); @@ -343,5 +323,28 @@ Line_of_score::broken_col_range (Item const*l, Item const*r) const return ret; } +/** + Return all columns, but filter out any unused columns , since they might + disrupt the spacing problem. + */ +Link_array +Line_of_score::column_l_arr ()const +{ + Link_array acs + = Pointer_group_interface__extract_elements (this, (Paper_column*) 0, "columns"); + bool bfound = false; + for (int i= acs.size (); i -- ; ) + { + bool brb = acs[i]->breakable_b(); + bfound = bfound || brb; - + /* + the last column should be breakable. Weed out any columns that + seem empty. We need to retain breakable columns, in case + someone forced a breakpoint. + */ + if (!bfound || !acs[i]->used_b ()) + acs.del (i); + } + return acs; +}