From 864142ab6fde3ef24bbcb1eff951b41942151db4 Mon Sep 17 00:00:00 2001 From: John Darrington Date: Sun, 16 Apr 2017 07:59:51 +0200 Subject: [PATCH] Enable changing of width and decimals from var sheet --- src/ui/gui/psppire-data-editor.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/ui/gui/psppire-data-editor.c b/src/ui/gui/psppire-data-editor.c index 47e47651ee..06116de623 100644 --- a/src/ui/gui/psppire-data-editor.c +++ b/src/ui/gui/psppire-data-editor.c @@ -260,6 +260,32 @@ change_var_property (PsppireDict *dict, gint col, gint row, const GValue *value) dict_rename_var (dict->dict, var, g_value_get_string (value)); } break; + case DICT_TVM_COL_WIDTH: + { + gint width = g_value_get_int (value); + if (var_is_numeric (var)) + { + struct fmt_spec format = *var_get_print_format (var); + fmt_change_width (&format, width, FMT_FOR_OUTPUT); + var_set_both_formats (var, &format); + } + else + { + var_set_width (var, width); + } + } + break; + case DICT_TVM_COL_DECIMAL: + { + gint decimals = g_value_get_int (value); + if (decimals >= 0) + { + struct fmt_spec format = *var_get_print_format (var); + fmt_change_decimals (&format, decimals, FMT_FOR_OUTPUT); + var_set_both_formats (var, &format); + } + } + break; case DICT_TVM_COL_LABEL: var_set_label (var, g_value_get_string (value)); break; -- 2.30.2