From 1442abd35fe6f3087bdb14fe5c65437404cc4ae8 Mon Sep 17 00:00:00 2001 From: Friedrich Beckmann Date: Sun, 12 Jul 2020 20:59:35 +0200 Subject: [PATCH] gui: clipboard CUT and COPY store same data with/without label clipboard store data with or without value labels depending on the setting in the data view. clipboard cut was always storing the raw data. With this patch copy and cut both store raw data or labels depending on the view setting. Closes: https://savannah.gnu.org/bugs/?58757 --- src/ui/gui/psppire-data-editor.c | 3 +++ src/ui/gui/psppire-data-editor.h | 1 + src/ui/gui/psppire-data-window.c | 4 +++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ui/gui/psppire-data-editor.c b/src/ui/gui/psppire-data-editor.c index e852b7d92b..d1b185c681 100644 --- a/src/ui/gui/psppire-data-editor.c +++ b/src/ui/gui/psppire-data-editor.c @@ -173,6 +173,7 @@ psppire_data_editor_set_property (GObject *object, case PROP_VALUE_LABELS: { gboolean l = g_value_get_boolean (value); + de->use_value_labels = l; g_object_set (de->data_sheet, "forward-conversion", l ? psppire_data_store_value_to_string_with_labels : @@ -207,6 +208,7 @@ psppire_data_editor_get_property (GObject *object, g_value_set_pointer (value, de->dict); break; case PROP_VALUE_LABELS: + g_value_set_boolean (value, de->use_value_labels); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -504,6 +506,7 @@ psppire_data_editor_init (PsppireDataEditor *de) gtk_box_pack_start (GTK_BOX (hbox), de->datum_entry, TRUE, TRUE, 0); de->split = FALSE; + de->use_value_labels = FALSE; de->data_sheet = psppire_data_sheet_new (); GtkWidget *data_button = ssw_sheet_get_button (SSW_SHEET (de->data_sheet)); diff --git a/src/ui/gui/psppire-data-editor.h b/src/ui/gui/psppire-data-editor.h index a5152bb759..7da3311333 100644 --- a/src/ui/gui/psppire-data-editor.h +++ b/src/ui/gui/psppire-data-editor.h @@ -70,6 +70,7 @@ struct _PsppireDataEditor GtkWidget *datum_entry; /* PsppireValueEntry for editing current cell. */ gboolean split; /* True if the sheets are in split view. */ + gboolean use_value_labels; /* True if labels instead of data are shown. */ }; struct _PsppireDataEditorClass diff --git a/src/ui/gui/psppire-data-window.c b/src/ui/gui/psppire-data-window.c index de4502ff82..2f31923af2 100644 --- a/src/ui/gui/psppire-data-window.c +++ b/src/ui/gui/psppire-data-window.c @@ -1087,8 +1087,10 @@ on_cut (PsppireDataWindow *dw) for (x = sel.start_x ; x <= sel.end_x; ++x) { const struct variable * var = psppire_dict_get_variable (dict, x); + gboolean use_value_label = FALSE; + g_object_get (dw->data_editor, "value-labels", &use_value_label, NULL); gchar *s = psppire_data_store_get_string (dw->data_editor->data_store, - y, var, FALSE); + y, var, use_value_label); g_string_append (str, s); if (x < sel.end_x) g_string_append (str, "\t"); -- 2.30.2