X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fpsppire-data-editor.c;h=a3431349b186ecb4749c1d18859f7db7fc56ff72;hb=22827c506cf2ff5933e34e178da911346bab7ed3;hp=66ec49930a1878430b0729887dd968f5898e9f12;hpb=193090d0821d84eee24d5d340c91bc069bb55827;p=pspp diff --git a/src/ui/gui/psppire-data-editor.c b/src/ui/gui/psppire-data-editor.c index 66ec49930a..a3431349b1 100644 --- a/src/ui/gui/psppire-data-editor.c +++ b/src/ui/gui/psppire-data-editor.c @@ -20,7 +20,6 @@ #include "ui/gui/psppire-data-editor.h" #include -#include #include "data/datasheet.h" #include "data/value-labels.h" @@ -41,7 +40,7 @@ #include "ui/gui/psppire-data-sheet.h" -#include "ui/gui/efficient-sheet/src/ssw-sheet.h" +#include #include #define _(msgid) gettext (msgid) @@ -168,7 +167,16 @@ psppire_data_editor_set_property (GObject *object, g_object_set (de->var_sheet, "data-model", de->dict, NULL); break; + case PROP_VALUE_LABELS: + { + gboolean l = g_value_get_boolean (value); + g_object_set (de->data_sheet, "forward-conversion", + l ? + psppire_data_store_value_to_string_with_labels : + psppire_data_store_value_to_string, + NULL); + } break; default: @@ -210,7 +218,6 @@ psppire_data_editor_switch_page (GtkNotebook *notebook, guint page_num) { GTK_NOTEBOOK_CLASS (parent_class)->switch_page (notebook, w, page_num); - } static void @@ -218,7 +225,6 @@ psppire_data_editor_set_focus_child (GtkContainer *container, GtkWidget *widget) { GTK_CONTAINER_CLASS (parent_class)->set_focus_child (container, widget); - } static void @@ -339,8 +345,25 @@ refresh_entry (PsppireDataEditor *de) } static void -on_datum_entry_activate (PsppireValueEntry *entry, PsppireDataEditor *de) +on_datum_entry_activate (GtkEntry *entry, PsppireDataEditor *de) { + gint row, col; + if (ssw_sheet_get_active_cell (SSW_SHEET (de->data_sheet), &col, &row)) + { + union value val; + const struct variable *var = psppire_dict_get_variable (de->dict, col); + if (var == NULL) + return; + + int width = var_get_width (var); + value_init (&val, width); + if (psppire_value_entry_get_value (PSPPIRE_VALUE_ENTRY (de->datum_entry), + &val, width)) + { + psppire_data_store_set_value (de->data_store, row, var, &val); + } + value_destroy (&val, width); + } } @@ -501,7 +524,6 @@ psppire_data_editor_init (PsppireDataEditor *de) g_free (fontname); set_font_recursively (GTK_WIDGET (de), de->font); } - } GtkWidget*