- Spanner* span_p = clone()->access_Spanner ();
- left = break_cols[i-1];
- right = break_cols[i];
- if (!right->line_l())
- right = right->find_prebroken_piece(LEFT);
- if (!left->line_l())
- left = left->find_prebroken_piece(RIGHT);
-
- assert (left&&right && left->line_l() == right->line_l());
-
- span_p->set_bounds(LEFT,left);
- span_p->set_bounds(RIGHT,right);
-
- pscore_l_->typeset_broken_spanner (span_p);
- broken_into_l_arr.push (span_p);
+ Link_array<Item> break_points = pscore_->system_->broken_col_range (left,right);
+
+ break_points.insert (left,0);
+ break_points.push (right);
+
+ for (int i=1; i < break_points.size (); i++)
+ {
+ Drul_array<Item*> bounds;
+ bounds[LEFT] = break_points[i-1];
+ bounds[RIGHT] = break_points[i];
+ Direction d = LEFT;
+ do
+ {
+ if (!bounds[d]->get_system ())
+ bounds[d] = bounds[d]->find_prebroken_piece (- d);
+ }
+ while ((flip (&d))!= LEFT);
+
+ if (!bounds[LEFT] || ! bounds[RIGHT])
+ {
+ programming_error ("bounds of this piece aren't breakable. ");
+ continue;
+ }
+
+ Spanner *span = dynamic_cast<Spanner*> (clone ());
+ span->set_bound (LEFT,bounds[LEFT]);
+ span->set_bound (RIGHT,bounds[RIGHT]);
+
+ if (!bounds[LEFT]->get_system ()
+
+ || !bounds[RIGHT]->get_system ()
+ || bounds[LEFT]->get_system () != bounds[RIGHT]->get_system ())
+ {
+ programming_error ("bounds of spanner are invalid");
+ span->suicide ();
+ }
+ else
+ {
+ bounds[LEFT]->get_system ()->typeset_grob (span);
+ broken_intos_.push (span);
+ }
+ }