X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fseparating-group-spanner.cc;h=d841599246fb8fd4c67235d09af00e339f100b06;hb=839133759fa353574cf9323ad9da4b39d5b4eb34;hp=992dba8d63b8dbaac975fcd252e310eee4c9e3bd;hpb=bfb10684605084baf1a898be8f42c0e463c5764a;p=lilypond.git diff --git a/lily/separating-group-spanner.cc b/lily/separating-group-spanner.cc index 992dba8d63..d841599246 100644 --- a/lily/separating-group-spanner.cc +++ b/lily/separating-group-spanner.cc @@ -17,14 +17,16 @@ void Separating_group_spanner::find_rods (Item * r, SCM next) { - Interval ri (Separation_item::my_width (r)); - if (ri.empty_b ()) - return; /* - This is an inner loop, however, in most cases, the interesting L - will just be the first entry of NEXT, making it linear in most of - the cases. */ + This is an inner loop: look for the first normal (unbroken) Left + grob. This looks like an inner loop (ie. quadratic total), but in + most cases, the interesting L will just be the first entry of + NEXT, making it linear in most of the cases. + */ + if (Separation_item::width (r).empty_b ()) + return; + for(; gh_pair_p (next); next = ly_cdr (next)) { Item *l = dynamic_cast (unsmob_grob (ly_car( next))); @@ -32,42 +34,40 @@ Separating_group_spanner::find_rods (Item * r, SCM next) if (lb) { - Interval li (Separation_item::my_width (lb)); - - if (!li.empty_b ()) + Interval li (Separation_item::width (lb)); + Interval ri (Separation_item::conditional_width (r, lb)); + if (!li.empty_b () && !ri.empty_b()) { Rod rod; rod.item_l_drul_[LEFT] = lb; rod.item_l_drul_[RIGHT] = r; - rod.distance_f_ = li[RIGHT] - ri[LEFT]; - - rod.columnize (); + rod.distance_ = li[RIGHT] - ri[LEFT]; rod.add_to_cols (); } } - Interval li (Separation_item::my_width (l)); - if (!li.empty_b ()) + Interval li (Separation_item::width (l)); + Interval ri (Separation_item::conditional_width (r, l)); + if (!li.empty_b () && !ri.empty_b()) { Rod rod; rod.item_l_drul_[LEFT] =l; rod.item_l_drul_[RIGHT]=r; - rod.distance_f_ = li[RIGHT] - ri[LEFT]; + rod.distance_ = li[RIGHT] - ri[LEFT]; - rod.columnize (); rod.add_to_cols (); - break; } - else - /* - this grob doesn't cause a constraint. We look further until we - find one that does. */ - ; + + /* + this grob doesn't cause a constraint. We look further until we + find one that does. + */ + } } @@ -105,25 +105,6 @@ Separating_group_spanner::set_spacing_rods (SCM smob) find_rods (rb, ly_cdr (s)); } -#if 0 - /* - TODO; restore this. - */ - /* - We've done our job, so we get lost. - */ - for (SCM s = me->get_grob_property ("elements"); gh_pair_p (s); s = ly_cdr (s)) - { - Item * it =dynamic_cast (unsmob_grob (ly_car (s))); - if (it && it->broken_b ()) - { - it->find_prebroken_piece (LEFT) ->suicide (); - it->find_prebroken_piece (RIGHT)->suicide (); - } - it->suicide (); - } - me->suicide (); -#endif return SCM_UNSPECIFIED ; }