+ /* Resize each column to each possible new size. */
+ for (pos = 0; pos < n_columns; pos++)
+ for (width_idx = 0; width_idx < params->n_widths; width_idx++)
+ {
+ int owidth = caseproto_get_width (oproto, pos);
+ int width = params->widths[width_idx];
+ if (mc_include_state (mc))
+ {
+ struct resize_cb_aux aux;
+ struct caseproto *proto;
+ struct datasheet *ds;
+ size_t i;
+
+ mc_name_operation (mc, "resize column %zu (of %zu) "
+ "from width %d to %d",
+ pos, n_columns, owidth, width);
+ clone_model (ods, odata, &ds, data);
+
+ aux.old_width = owidth;
+ aux.new_width = width;
+ if (!datasheet_resize_column (ds, pos, width, resize_cb, &aux))
+ NOT_REACHED ();
+ proto = caseproto_set_width (caseproto_ref (oproto), pos, width);
+
+ for (i = 0; i < n_rows; i++)
+ {
+ union value *old_value = &data[i][pos];
+ union value new_value;
+ value_init (&new_value, width);
+ resize_cb (old_value, &new_value, &aux);
+ value_swap (old_value, &new_value);
+ value_destroy (&new_value, owidth);
+ }
+
+ check_datasheet (mc, ds, data, n_rows, proto);
+ release_data (n_rows, proto, data);
+ caseproto_unref (proto);
+ }
+ }
+