- case COL_WIDTH:
- r_min = fmt->d + 1;
- r_max = (psppire_variable_get_type(pv) == ALPHA) ? 255 : 40;
- break;
- case COL_DECIMALS:
- r_min = 0 ;
- r_max = min(fmt->w - 1, 16);
- break;
- case COL_COLUMNS:
- r_min = 1;
- r_max = 255 ; /* Is this a sensible value ? */
- break;
- default:
- g_assert_not_reached();
+ GtkSpinButton *spinButton ;
+ const gint current_value = atoi (s);
+ GtkObject *adj ;
+
+ const struct fmt_spec *fmt = var_get_write_format (var);
+ switch (column)
+ {
+ case COL_WIDTH:
+ r_min = MAX (fmt->d + 1, fmt_min_output_width (fmt->type));
+ r_max = fmt_max_output_width (fmt->type);
+ break;
+ case COL_DECIMALS:
+ r_min = 0 ;
+ r_max = fmt_max_output_decimals (fmt->type, fmt->w);
+ break;
+ case COL_COLUMNS:
+ r_min = 1;
+ r_max = 255 ; /* Is this a sensible value ? */
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+
+ adj = gtk_adjustment_new (current_value,
+ r_min, r_max,
+ 1.0, 1.0, 1.0 /* steps */
+ );
+
+ gtk_sheet_change_entry (sheet, GTK_TYPE_SPIN_BUTTON);
+
+ spinButton =
+ GTK_SPIN_BUTTON (gtk_sheet_get_entry (sheet));
+
+ gtk_spin_button_set_adjustment (spinButton, GTK_ADJUSTMENT (adj));
+ gtk_spin_button_set_digits (spinButton, 0);