Fix bug inserting rows and columns and rename state variable.
[pspp-builds.git] / src / ui / gui / psppire-data-editor.c
index be911ba6d69817d928264eb13effd969272d029b..990a134c423ff3c24090d04615b6d22b3b837d07 100644 (file)
@@ -23,8 +23,9 @@
 
 #include <language/syntax-string-source.h>
 #include "psppire-data-store.h"
+#include <libpspp/i18n.h>
 #include <ui/gui/sheet/psppire-axis.h>
-#include "helper.h"
+#include "executor.h"
 
 #include <gtk-contrib/gtkxpaned.h>
 #include <gettext.h>
@@ -743,7 +744,9 @@ update_data_ref_entry (const PsppireSheet *sheet,
          gchar *text = g_strdup_printf ("%d: %s", row + FIRST_CASE_NUMBER,
                                         var_get_name (var));
 
-         gchar *s = pspp_locale_to_utf8 (text, -1, 0);
+         gchar *s = recode_string (UTF8,
+                                   psppire_dict_encoding (data_store->dict),
+                                   text, -1);
 
          g_free (text);
 
@@ -1301,13 +1304,15 @@ psppire_data_editor_insert_variable (PsppireDataEditor *de)
   switch (gtk_notebook_get_current_page (GTK_NOTEBOOK (de)))
     {
     case PSPPIRE_DATA_EDITOR_DATA_VIEW:
-      if ( de->data_sheet[0]->state == PSPPIRE_SHEET_COLUMN_SELECTED )
+      if ( PSPPIRE_SHEET (de->data_sheet[0])->select_status
+          == PSPPIRE_SHEET_COLUMN_SELECTED )
        posn = PSPPIRE_SHEET (de->data_sheet[0])->range.col0;
       else
        posn = PSPPIRE_SHEET (de->data_sheet[0])->active_cell.col;
       break;
     case PSPPIRE_DATA_EDITOR_VARIABLE_VIEW:
-      if ( de->var_sheet->state == PSPPIRE_SHEET_ROW_SELECTED )
+      if ( PSPPIRE_SHEET (de->var_sheet)->select_status
+          == PSPPIRE_SHEET_ROW_SELECTED )
        posn = PSPPIRE_SHEET (de->var_sheet)->range.row0;
       else
        posn = PSPPIRE_SHEET (de->var_sheet)->active_cell.row;