-/*
- Compute the column of the right-items. This is a big function,
-since RIGHT-ITEMS may span more columns (eg. if a clef if inserted,
-this will add a new columns to RIGHT-ITEMS. Here we look at the
-columns, and return the left-most. If there are multiple columns, we
-prune RIGHT-ITEMS.
-
- */
-Item *
-Note_spacing::right_column (Grob*me)
-{
- if (!me->is_live ())
- return 0;
-
- SCM right = me->get_property ("right-items");
- Item *mincol = 0;
- int min_rank = INT_MAX;
- bool prune = false;
- for (SCM s = right ; scm_is_pair (s) ; s = scm_cdr (s))
- {
- Item * ri = unsmob_item (scm_car (s));
-
- Item * col = ri->get_column ();
- int rank = Paper_column::get_rank (col);
-
- if (rank < min_rank)
- {
- min_rank = rank;
- if (mincol)
- prune = true;
-
- mincol = col;
- }
- }
-
- if (prune)
- {
- // I'm a lazy bum. We could do this in-place.
- SCM newright = SCM_EOL;
- for (SCM s = right ; scm_is_pair (s) ; s =scm_cdr (s))
- {
- if (unsmob_item (scm_car (s))->get_column () == mincol)
- newright = scm_cons (scm_car (s), newright);
- }
-
- me->set_property ("right-items", newright);
- }
-
- if (!mincol)
- {
- /*
- int r = Paper_column::get_rank (dynamic_cast<Item*>(me)->get_column ());
- programming_error (_f ("Spacing wish column %d has no right item.", r));
- */
-
- return 0;
- }
-
- return mincol;
-}