Merge remote branch 'savannah/master'
authorJohn Darrington <john@darrington.wattle.id.au>
Fri, 8 Jul 2011 13:53:37 +0000 (15:53 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Fri, 8 Jul 2011 13:53:37 +0000 (15:53 +0200)
12 files changed:
src/data/ods-reader.c
src/language/stats/oneway.c
src/libpspp/inflate.c
src/libpspp/temp-file.c
src/ui/gui/automake.mk
src/ui/gui/autorecode-dialog.c [new file with mode: 0644]
src/ui/gui/autorecode-dialog.h [new file with mode: 0644]
src/ui/gui/autorecode.ui [new file with mode: 0644]
src/ui/gui/data-editor.ui
src/ui/gui/paired-dialog.c
src/ui/gui/psppire-data-window.c
tests/automake.mk

index 51ee5ac39ace8994901deed27ef1e236ef56591d..9bbfb479e2b9e8d02c1b6642e6ad81193b3a1e3c 100644 (file)
@@ -315,13 +315,14 @@ convert_xml_to_value (struct ccase *c, const struct variable *var,
     value_copy_str_rpad (v, var_get_width (var), xmv->text, ' ');
   else
     {
+      const char *text ;
       const struct fmt_spec *fmt = var_get_write_format (var);
       enum fmt_category fc  = fmt_get_category (fmt->type);
 
       assert ( fc != FMT_CAT_STRING);
 
-      const char *text = xmv->value ? CHAR_CAST (const char *, xmv->value):
-       CHAR_CAST (const char *, xmv->text);
+      text =
+        xmv->value ? CHAR_CAST (const char *, xmv->value) : CHAR_CAST (const char *, xmv->text);
 
       data_in (ss_cstr (text), "UTF-8",
               fmt->type,
@@ -344,12 +345,14 @@ ods_open_reader (struct spreadsheet_read_info *gri, struct dictionary **dict)
   int n_var_specs = 0;
 
   struct ods_reader *r = xzalloc (sizeof *r);
+  struct zip_member *content = NULL;
+  struct zip_reader *zreader ;
+  xmlChar *val_string = NULL;
 
   r->read_names = gri->read_names;
   ds_init_empty (&r->ods_errs);
 
-  struct zip_reader *zreader = zip_reader_create (gri->file_name, &r->ods_errs);
-  struct zip_member *content = NULL;
+  zreader = zip_reader_create (gri->file_name, &r->ods_errs);
 
   if ( NULL == zreader)
     {
@@ -473,7 +476,6 @@ ods_open_reader (struct spreadsheet_read_info *gri, struct dictionary **dict)
        }
     }
 
-  xmlChar *val_string = NULL;
   /* Read in the first row of data */
   while (1 == xmlTextReaderRead (r->xtr))
     {
index bdac117c7ce860b88b73fc1af24a7989eb1fa3bd..78bd215088d289b81e63a71a5ba5d511df4c61a9 100644 (file)
@@ -181,7 +181,7 @@ static double bonferroni_pinv (double std_err, double alpha, double df, int k, c
   return std_err * gsl_cdf_tdist_Pinv (1.0 - alpha / (2.0 * m), df);
 }
 
-static double sidak_pinv (double std_err, double alpha, double df, int k, const struct moments1 *mom_i, const struct moments1 *mom_j)
+static double sidak_pinv (double std_err, double alpha, double df, int k, const struct moments1 *mom_i UNUSED, const struct moments1 *mom_j UNUSED)
 {
   const double m = k * (k - 1) / 2;
   double lp = 1.0 - exp (log (1.0 - alpha) / m ) ;
@@ -271,21 +271,22 @@ static double scheffe_1tailsig (double ts, double df1, double df2)
 }
 
 
-static double tukey_test_stat (int k, const struct moments1 *mom_i, const struct moments1 *mom_j, double std_err)
+static double tukey_test_stat (int k UNUSED, const struct moments1 *mom_i, const struct moments1 *mom_j, double std_err)
 {
+  double ts;
   double n_i, mean_i, var_i;
   double n_j, mean_j, var_j;
 
   moments1_calculate (mom_i, &n_i, &mean_i, &var_i, 0, 0);  
   moments1_calculate (mom_j, &n_j, &mean_j, &var_j, 0, 0);
 
-  double ts =  (mean_i - mean_j) / std_err;
+  ts =  (mean_i - mean_j) / std_err;
   ts = fabs (ts) * sqrt (2.0);
 
   return ts;
 }
 
-static double lsd_test_stat (int k, const struct moments1 *mom_i, const struct moments1 *mom_j, double std_err)
+static double lsd_test_stat (int k UNUSED, const struct moments1 *mom_i, const struct moments1 *mom_j, double std_err)
 {
   double n_i, mean_i, var_i;
   double n_j, mean_j, var_j;
@@ -298,32 +299,35 @@ static double lsd_test_stat (int k, const struct moments1 *mom_i, const struct m
 
 static double scheffe_test_stat (int k, const struct moments1 *mom_i, const struct moments1 *mom_j, double std_err)
 {
+  double t;
   double n_i, mean_i, var_i;
   double n_j, mean_j, var_j;
 
   moments1_calculate (mom_i, &n_i, &mean_i, &var_i, 0, 0);  
   moments1_calculate (mom_j, &n_j, &mean_j, &var_j, 0, 0);
 
-  double t = (mean_i - mean_j) / std_err;
+  t = (mean_i - mean_j) / std_err;
   t = pow2 (t);
   t /= k - 1;
 
   return t;
 }
 
-static double gh_test_stat (int k, const struct moments1 *mom_i, const struct moments1 *mom_j, double std_err)
+static double gh_test_stat (int k UNUSED, const struct moments1 *mom_i, const struct moments1 *mom_j, double std_err UNUSED)
 {
+  double ts;
+  double thing;
   double n_i, mean_i, var_i;
   double n_j, mean_j, var_j;
 
   moments1_calculate (mom_i, &n_i, &mean_i, &var_i, 0, 0);  
   moments1_calculate (mom_j, &n_j, &mean_j, &var_j, 0, 0);
 
-  double thing = var_i / n_i + var_j / n_j;
+  thing = var_i / n_i + var_j / n_j;
   thing /= 2.0;
   thing = sqrt (thing);
 
-  double ts = (mean_i - mean_j) / thing;
+  ts = (mean_i - mean_j) / thing;
 
   return fabs (ts);
 }
@@ -1527,6 +1531,7 @@ show_comparisons (const struct oneway_spec *cmd, const struct oneway_workspace *
 
          for (j = 0 ; j < pvw->n_groups; ++j)
            {
+             double std_err;
              double weight_j, mean_j, var_j;
              double half_range;
              struct descriptive_data *dd_j = categoricals_get_user_data_by_category (cat, j);
@@ -1542,7 +1547,7 @@ show_comparisons (const struct oneway_spec *cmd, const struct oneway_workspace *
 
              tab_double  (t, 3, r + rx, 0, mean_i - mean_j, 0);
 
-             double std_err = pvw->mse;
+             std_err = pvw->mse;
              std_err *= weight_i + weight_j;
              std_err /= weight_i * weight_j;
              std_err = sqrt (std_err);
index 478747843b743869bd596fd39b97bba85e64cd7b..c4ad1cffc9022afb14ed8749d339dfcb66e909b6 100644 (file)
@@ -99,6 +99,7 @@ inflate_init (struct zip_member *zm)
 int
 inflate_read (struct zip_member *zm, void *buf, size_t n)
 {
+  int r;
   struct inflator *inf = zm->aux;
 
   if (inf->zss.avail_in == 0)
@@ -134,7 +135,7 @@ inflate_read (struct zip_member *zm, void *buf, size_t n)
   inf->zss.avail_out = n;
   inf->zss.next_out = buf;
 
-  int r = inflate (&inf->zss, Z_NO_FLUSH);
+  r = inflate (&inf->zss, Z_NO_FLUSH);
   if ( Z_OK == r)
     {
       return n - inf->zss.avail_out;
index 0391ec9c01f91ff1f3384e293c2d9b41102dabc0..9d3c392659753043667af822b9bbfe7bd3e1b0f0 100644 (file)
@@ -55,7 +55,7 @@ static void
 cleanup (void)
 {
   struct hmapx_node *node;
-  const char *fn;
+  char *fn;
 
   cleanup_temp_dir (temp_dir);
 
index f02f85bdcd80db6c54d808310ee843920c1a77c8..9f34620016931078dfd2875d484e72f1df27594e 100644 (file)
@@ -4,6 +4,7 @@ include $(top_srcdir)/src/ui/gui/sheet/automake.mk
 
 UI_FILES = \
        src/ui/gui/aggregate.ui \
+       src/ui/gui/autorecode.ui \
        src/ui/gui/binomial.ui \
        src/ui/gui/compute.ui \
        src/ui/gui/correlation.ui \
@@ -121,6 +122,8 @@ src_ui_gui_psppire_SOURCES = \
        src/ui/gui/psppire-hbuttonbox.c \
        src/ui/gui/psppire-vbuttonbox.c \
        src/ui/gui/psppire-acr.c \
+       src/ui/gui/autorecode-dialog.c \
+       src/ui/gui/autorecode-dialog.h \
        src/ui/gui/aggregate-dialog.c \
        src/ui/gui/aggregate-dialog.h \
        src/ui/gui/binomial-dialog.c \
diff --git a/src/ui/gui/autorecode-dialog.c b/src/ui/gui/autorecode-dialog.c
new file mode 100644 (file)
index 0000000..6780bc7
--- /dev/null
@@ -0,0 +1,404 @@
+/* PSPPIRE - a graphical user interface for PSPP.
+   Copyright (C) 2011  Free Software Foundation
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>. */
+
+#include <config.h>
+
+#include "dialog-common.h"
+#include "autorecode-dialog.h"
+#include "psppire-selector.h"
+#include "psppire-dictview.h"
+#include "psppire-var-ptr.h"
+#include "psppire-dialog.h"
+
+#include "psppire-data-window.h"
+#include "psppire-var-view.h"
+
+#include "executor.h"
+#include "helper.h"
+
+#include <gtk/gtk.h>
+
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
+#define N_(msgid) msgid
+
+/* Name-Label pair */
+struct nlp
+{
+  char *name;
+  char *label;
+};
+
+struct autorecode
+{
+  PsppireDict *dict;
+  GtkWidget *change_button;
+  GtkWidget *new_name_entry;
+  GtkWidget *var_view;
+
+  /* A hash table of struct nlp's indexed by variable */
+  GHashTable *varmap;
+
+  GtkWidget *ascending;
+  GtkWidget *group;
+  GtkWidget *blank;
+};
+
+static struct nlp *
+nlp_create (const char *name, const char *label)
+{
+  struct nlp *nlp = xmalloc (sizeof *nlp);
+
+  nlp->name = g_strdup (name);
+
+  nlp->label = NULL;
+
+  if ( label != NULL && 0 != strcmp ("", label))
+    nlp->label = g_strdup (label);
+
+  return nlp;
+}
+
+static void
+nlp_destroy (gpointer data)
+{
+  struct nlp *nlp = data ;
+  if ( ! nlp )
+    return;
+
+  g_free (nlp->name);
+  g_free (nlp->label);
+  g_free (nlp);
+}
+
+static void
+on_change_clicked (GObject *obj, gpointer data)
+{
+  struct autorecode *rd = data;
+  struct variable *var = NULL;
+  struct nlp *nlp;
+  GtkTreeModel *model = GTK_TREE_MODEL (PSPPIRE_VAR_VIEW (rd->var_view)->list);
+  GtkTreeIter iter;
+  GtkTreeSelection *selection =
+    gtk_tree_view_get_selection (GTK_TREE_VIEW (rd->var_view));
+
+  GList *rows = gtk_tree_selection_get_selected_rows (selection, &model);
+
+  const gchar *dest_var_name =
+    gtk_entry_get_text (GTK_ENTRY (rd->new_name_entry));
+
+  if ( NULL == rows || rows->next != NULL)
+    goto finish;
+
+  gtk_tree_model_get_iter (model, &iter, rows->data);
+
+  gtk_tree_model_get (model, &iter, 0, &var, -1);
+
+  g_hash_table_remove (rd->varmap, var);
+
+  nlp = nlp_create (dest_var_name, NULL);
+
+  g_hash_table_insert (rd->varmap, var, nlp);
+
+  gtk_tree_model_row_changed (model, rows->data, &iter);
+
+ finish:
+  g_list_foreach (rows, (GFunc) gtk_tree_path_free, NULL);
+  g_list_free (rows);
+}
+
+
+static char * generate_syntax (const struct autorecode *rd);
+
+
+static void
+refresh (PsppireDialog *dialog, struct autorecode *rd)
+{
+  GtkTreeModel *target_list = gtk_tree_view_get_model (GTK_TREE_VIEW (rd->var_view));
+
+  gtk_entry_set_text (GTK_ENTRY (rd->new_name_entry), "");
+  gtk_widget_set_sensitive  (rd->new_name_entry, FALSE);
+  gtk_widget_set_sensitive  (rd->change_button, FALSE);
+
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rd->ascending), TRUE);
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rd->group), FALSE);
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rd->blank), FALSE);
+
+  if (rd->varmap )
+    g_hash_table_remove_all (rd->varmap);
+
+  gtk_list_store_clear (GTK_LIST_STORE (target_list));
+}
+
+
+static gboolean
+dialog_state_valid (gpointer data)
+{
+  struct autorecode *rd = data;
+
+  GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (rd->var_view));
+
+  if (g_hash_table_size (rd->varmap) != gtk_tree_model_iter_n_children (model, NULL) )
+    return FALSE;
+
+ return TRUE;
+}
+
+
+static void
+on_entry_change (struct autorecode *rd)
+{
+  gboolean valid = TRUE;
+  const char *text = gtk_entry_get_text (GTK_ENTRY (rd->new_name_entry));
+
+  if ( 0 == strcmp ("", text))
+    valid = FALSE;
+  else if (psppire_dict_lookup_var (rd->dict, text))
+    valid = FALSE;
+  else
+    {
+      GHashTableIter iter;
+      gpointer key, value;
+
+      g_hash_table_iter_init (&iter, rd->varmap);
+      while (g_hash_table_iter_next (&iter, &key, &value)) 
+       {
+         struct nlp *nlp = value;
+         
+         if ( 0 == strcmp (nlp->name, text))
+           {
+             valid = FALSE;
+             break;
+           }
+
+       }
+    }
+
+  gtk_widget_set_sensitive  (rd->change_button, valid);
+}
+
+/* Callback which gets called when a new row is selected
+   in the variable treeview.
+   It sets the name and label entry widgets to reflect the
+   currently selected row.
+ */
+static void
+on_selection_change (GtkTreeSelection *selection, gpointer data)
+{
+  struct autorecode *rd = data;
+  GtkTreeModel *model = GTK_TREE_MODEL (PSPPIRE_VAR_VIEW (rd->var_view)->list);
+  GList *rows = gtk_tree_selection_get_selected_rows (selection, &model);
+
+  if ( rows && !rows->next)
+    {
+      /* Exactly one row is selected */
+      struct nlp *nlp;
+      struct variable *var;
+      gboolean ok;
+      GtkTreeIter iter;
+
+      gtk_widget_set_sensitive  (rd->new_name_entry, TRUE);
+      gtk_widget_set_sensitive  (rd->change_button, TRUE);      
+
+
+      ok = gtk_tree_model_get_iter (model, &iter, (GtkTreePath*) rows->data);
+
+      gtk_tree_model_get (model, &iter, 0, &var, -1);
+
+      nlp = g_hash_table_lookup (rd->varmap, var);
+
+      if (nlp)
+       gtk_entry_set_text (GTK_ENTRY (rd->new_name_entry), nlp->name ? nlp->name : "");
+      else
+       gtk_entry_set_text (GTK_ENTRY (rd->new_name_entry), "");
+    }
+  else
+    {
+      gtk_entry_set_text (GTK_ENTRY (rd->new_name_entry), "");
+      gtk_widget_set_sensitive  (rd->new_name_entry, FALSE);
+      gtk_widget_set_sensitive  (rd->change_button, FALSE);
+    }
+
+  g_list_foreach (rows, (GFunc) gtk_tree_path_free, NULL);
+  g_list_free (rows);
+}
+
+static void
+render_new_var_name (GtkTreeViewColumn *tree_column,
+                    GtkCellRenderer *cell,
+                    GtkTreeModel *tree_model,
+                    GtkTreeIter *iter,
+                    gpointer data)
+{
+  struct nlp *nlp = NULL;
+  struct autorecode *rd = data;
+
+  struct variable *var = NULL;
+
+  gtk_tree_model_get (tree_model, iter, 
+                     0, &var,
+                     -1);
+
+  nlp = g_hash_table_lookup (rd->varmap, var);
+
+  if ( nlp )
+    g_object_set (cell, "text", nlp->name, NULL);
+  else
+    g_object_set (cell, "text", "", NULL);
+}
+
+
+
+/* Pops up the Autorecode dialog box */
+void
+autorecode_dialog (PsppireDataWindow *de)
+{
+  struct autorecode rd;
+  gint response;
+
+  GtkBuilder *xml = builder_new ("autorecode.ui");
+  PsppireVarStore *vs;
+
+  GtkWidget *dialog = get_widget_assert   (xml, "autorecode-dialog");
+  GtkWidget *source = get_widget_assert   (xml, "dict-view");
+
+  rd.var_view = get_widget_assert   (xml, "var-view");
+
+  rd.new_name_entry = get_widget_assert (xml, "entry1");
+  rd.change_button = get_widget_assert (xml, "button1");
+  rd.ascending = get_widget_assert (xml, "radiobutton1");
+  rd.group = get_widget_assert (xml, "checkbutton1");
+  rd.blank = get_widget_assert (xml, "checkbutton2");
+
+    {
+      GtkTreeSelection *sel;
+
+      GtkCellRenderer *renderer = gtk_cell_renderer_text_new ();
+
+      GtkTreeViewColumn *col = gtk_tree_view_column_new_with_attributes (_("New"),
+                                                                        renderer,
+                                                                        "text", NULL,
+                                                                        NULL);
+
+      gtk_tree_view_column_set_cell_data_func (col, renderer,
+                                              render_new_var_name,
+                                              &rd, NULL);
+
+      gtk_tree_view_append_column (GTK_TREE_VIEW (rd.var_view), col);
+
+
+      col = gtk_tree_view_get_column (GTK_TREE_VIEW (rd.var_view), 0);
+
+      g_object_set (col, "title", _("Old"), NULL);
+
+      g_object_set (rd.var_view, "headers-visible", TRUE, NULL);
+
+      rd.varmap = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, nlp_destroy);
+
+
+      sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (rd.var_view));
+
+
+      g_signal_connect (sel, "changed",
+                       G_CALLBACK (on_selection_change), &rd);
+
+      g_signal_connect (rd.change_button, "clicked",
+                       G_CALLBACK (on_change_clicked),  &rd);
+
+      g_signal_connect_swapped (rd.new_name_entry, "changed",
+                       G_CALLBACK (on_entry_change),  &rd);
+
+    }
+
+  g_object_get (de->data_editor, "var-store", &vs, NULL);
+
+  gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de));
+
+  g_object_get (vs, "dictionary", &rd.dict, NULL);
+  g_object_set (source, "model", rd.dict, NULL);
+
+
+  g_signal_connect (dialog, "refresh", G_CALLBACK (refresh),  &rd);
+
+  psppire_dialog_set_valid_predicate (PSPPIRE_DIALOG (dialog),
+                                     dialog_state_valid, &rd);
+
+  response = psppire_dialog_run (PSPPIRE_DIALOG (dialog));
+
+
+  switch (response)
+    {
+    case GTK_RESPONSE_OK:
+      g_free (execute_syntax_string (de, generate_syntax (&rd)));
+      break;
+    case PSPPIRE_RESPONSE_PASTE:
+      g_free (paste_syntax_to_window (generate_syntax (&rd)));
+      break;
+    default:
+      break;
+    }
+
+  g_object_unref (xml);
+}
+
+
+\f
+
+static char *
+generate_syntax (const struct autorecode *rd)
+{
+  GHashTableIter iter;
+  gpointer key, value;
+  gchar *text;
+  GString *string = g_string_new ("AUTORECODE");
+
+  g_string_append (string, "\n\tVARIABLES =");
+
+  g_hash_table_iter_init (&iter, rd->varmap);
+  while (g_hash_table_iter_next (&iter, &key, &value)) 
+  {
+    struct variable *var = key;
+    g_string_append (string, " ");
+    g_string_append (string, var_get_name (var));
+  }
+
+  g_string_append (string, " INTO");
+
+  g_hash_table_iter_init (&iter, rd->varmap);
+  while (g_hash_table_iter_next (&iter, &key, &value)) 
+  {
+    struct nlp *nlp  = value;
+    g_string_append (string, " ");
+    g_string_append (string, nlp->name);
+  }
+
+  if ( ! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->ascending)))
+    g_string_append (string, "\n\t/DESCENDING");
+
+  if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->group)))
+    g_string_append (string, "\n\t/GROUP");
+
+  if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->blank)))
+    g_string_append (string, "\n\t/BLANK");
+
+  g_string_append (string, ".\n");
+
+  text = string->str;
+
+  g_string_free (string, FALSE);
+
+  return text;
+}
diff --git a/src/ui/gui/autorecode-dialog.h b/src/ui/gui/autorecode-dialog.h
new file mode 100644 (file)
index 0000000..7127b00
--- /dev/null
@@ -0,0 +1,24 @@
+/* PSPPIRE - a graphical user interface for PSPP.
+   Copyright (C) 2011  Free Software Foundation
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef AUTORECODE_H
+#define AUTORECODE_H 1
+
+#include "psppire-data-window.h"
+
+void autorecode_dialog (PsppireDataWindow *de);
+
+#endif
diff --git a/src/ui/gui/autorecode.ui b/src/ui/gui/autorecode.ui
new file mode 100644 (file)
index 0000000..9b4a2e8
--- /dev/null
@@ -0,0 +1,291 @@
+<?xml version="1.0"?>
+<interface>
+  <!-- interface-requires psppire 0.0 -->
+  <requires lib="gtk+" version="2.16"/>
+  <!-- interface-naming-policy project-wide -->
+  <object class="PsppireDialog" id="autorecode-dialog">
+    <property name="title" translatable="yes">Automatic Recode</property>
+    <property name="modal">True</property>
+    <child internal-child="hbox">
+      <object class="GtkHBox" id="dialog-hbox1">
+        <property name="visible">True</property>
+        <property name="spacing">2</property>
+        <child>
+          <object class="GtkVBox" id="vbox1">
+            <property name="visible">True</property>
+            <property name="orientation">vertical</property>
+            <child>
+              <object class="GtkTable" id="table1">
+                <property name="visible">True</property>
+                <property name="n_rows">3</property>
+                <property name="n_columns">3</property>
+                <property name="row_spacing">5</property>
+                <child>
+                  <object class="GtkScrolledWindow" id="scrolledwindow1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="hscrollbar_policy">never</property>
+                    <property name="vscrollbar_policy">automatic</property>
+                    <property name="shadow_type">in</property>
+                    <child>
+                      <object class="PsppireDictView" id="dict-view">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="has_tooltip">True</property>
+                        <property name="border_width">5</property>
+                        <property name="headers_visible">False</property>
+                        <property name="headers_clickable">False</property>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="bottom_attach">3</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="PsppireSelector" id="psppire-selector1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="border_width">5</property>
+                    <property name="source_widget">dict-view</property>
+                    <property name="dest_widget">var-view</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                    <property name="x_options"></property>
+                    <property name="y_options">GTK_EXPAND</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkFrame" id="frame1">
+                    <property name="visible">True</property>
+                    <property name="label_xalign">0</property>
+                    <property name="shadow_type">none</property>
+                    <child>
+                      <object class="GtkAlignment" id="alignment1">
+                        <property name="visible">True</property>
+                        <property name="left_padding">12</property>
+                        <child>
+                          <object class="GtkScrolledWindow" id="scrolledwindow2">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="hscrollbar_policy">automatic</property>
+                            <property name="vscrollbar_policy">automatic</property>
+                            <property name="shadow_type">in</property>
+                            <child>
+                              <object class="PsppireVarView" id="var-view">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="border_width">5</property>
+                                <property name="headers_clickable">False</property>
+                              </object>
+                            </child>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
+                    <child type="label">
+                      <object class="GtkLabel" id="label1">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">Variable -&gt; New Name</property>
+                        <property name="use_markup">True</property>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="left_attach">2</property>
+                    <property name="right_attach">3</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkFrame" id="frame2">
+                    <property name="visible">True</property>
+                    <property name="label_xalign">0</property>
+                    <child>
+                      <object class="GtkAlignment" id="alignment2">
+                        <property name="visible">True</property>
+                        <property name="left_padding">12</property>
+                        <child>
+                          <object class="GtkHButtonBox" id="hbuttonbox1">
+                            <property name="visible">True</property>
+                            <child>
+                              <object class="GtkRadioButton" id="radiobutton1">
+                                <property name="label" translatable="yes">_Lowest value</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="use_underline">True</property>
+                                <property name="active">True</property>
+                                <property name="draw_indicator">True</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkRadioButton" id="radiobutton2">
+                                <property name="label" translatable="yes">_Highest value</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="use_underline">True</property>
+                                <property name="active">True</property>
+                                <property name="draw_indicator">True</property>
+                                <property name="group">radiobutton1</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
+                    <child type="label">
+                      <object class="GtkLabel" id="label2">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">Recode starting from</property>
+                        <property name="use_markup">True</property>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="left_attach">2</property>
+                    <property name="right_attach">3</property>
+                    <property name="top_attach">2</property>
+                    <property name="bottom_attach">3</property>
+                    <property name="y_options"></property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkTable" id="table2">
+                    <property name="visible">True</property>
+                    <property name="n_rows">2</property>
+                    <property name="n_columns">2</property>
+                    <property name="column_spacing">3</property>
+                    <child>
+                      <object class="GtkLabel" id="label3">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">_New Name</property>
+                        <property name="use_underline">True</property>
+                        <property name="mnemonic_widget">entry1</property>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkEntry" id="entry1">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="invisible_char">&#x25CF;</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkButton" id="button1">
+                        <property name="label" translatable="yes">_Add New Name</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                        <property name="use_underline">True</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="top_attach">1</property>
+                        <property name="bottom_attach">2</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="left_attach">2</property>
+                    <property name="right_attach">3</property>
+                    <property name="top_attach">1</property>
+                    <property name="bottom_attach">2</property>
+                    <property name="y_options"></property>
+                  </packing>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+              </object>
+              <packing>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkVButtonBox" id="vbuttonbox1">
+                <property name="visible">True</property>
+                <property name="orientation">vertical</property>
+                <child>
+                  <object class="GtkCheckButton" id="checkbutton1">
+                    <property name="label" translatable="yes">_Use the same recoding scheme for all variables</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="use_underline">True</property>
+                    <property name="draw_indicator">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkCheckButton" id="checkbutton2">
+                    <property name="label" translatable="yes">Treat _blank string values as missing</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="use_underline">True</property>
+                    <property name="draw_indicator">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="PsppireVButtonBox" id="psppire-vbuttonbox1">
+            <property name="visible">True</property>
+            <property name="border_width">5</property>
+            <property name="default">PSPPIRE_BUTTON_GOTO_MASK</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="pack_type">end</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
index 83241ce556f82dc4c36edadc8c02966537d408f1..52a34131d3793db8d927b5a1178cd318325730bf 100644 (file)
             <property name="label" translatable="yes">Ran_k Cases...</property>
           </object>
         </child>
+        <child>
+          <object class="GtkAction" id="transform_autorecode">
+            <property name="name">transform_autorecode</property>
+            <property name="label" translatable="yes">Auto_matic Recode...</property>
+          </object>
+        </child>
         <child>
           <object class="GtkAction" id="transform_recode-same">
             <property name="name">transform_recode-same</property>
           <menuitem action="transform_compute"/>
           <menuitem action="transform_count"/>
           <menuitem action="transform_rank"/>
+          <menuitem action="transform_autorecode"/>
           <separator/>
           <menuitem action="transform_recode-same"/>
           <menuitem action="transform_recode-different"/>
index 451c95f36a2c8edbfb9cb4655421ea1370a7a806..39a8ae91f196eb588c580d00c27917d69c9c41ad 100644 (file)
@@ -143,16 +143,17 @@ two_sample_dialog_destroy (struct paired_samples_dialog *psd)
 struct paired_samples_dialog *
 two_sample_dialog_create (PsppireDataWindow *de)
 {
+  GtkWidget *dict_view ;
+  GtkWidget *selector ;
   struct paired_samples_dialog *tt_d = g_malloc (sizeof *tt_d);
 
   PsppireVarStore *vs = NULL;
 
   tt_d->xml = builder_new ("paired-samples.ui");
 
-  GtkWidget *dict_view =
-    get_widget_assert (tt_d->xml, "paired-samples-t-test-treeview1");
+  dict_view = get_widget_assert (tt_d->xml, "paired-samples-t-test-treeview1");
 
-  GtkWidget *selector = get_widget_assert (tt_d->xml, "psppire-selector3");
+  selector = get_widget_assert (tt_d->xml, "psppire-selector3");
 
   tt_d->dialog = get_widget_assert (tt_d->xml, "t-test-paired-samples-dialog");
 
index 647d073bf993d7cebdf27d45332597492680dd5f..0ed974e0b3553fc46a3b5baf6cfb2e380a1cb4c8 100644 (file)
@@ -25,6 +25,7 @@
 #include "libpspp/message.h"
 #include "libpspp/str.h"
 #include "ui/gui/aggregate-dialog.h"
+#include "ui/gui/autorecode-dialog.h"
 #include "ui/gui/binomial-dialog.h"
 #include "ui/gui/chi-square-dialog.h"
 #include "ui/gui/comments-dialog.h"
@@ -1068,6 +1069,8 @@ psppire_data_window_finish_init (PsppireDataWindow *de,
 
   connect_action (de, "transform_compute", G_CALLBACK (compute_dialog));
 
+  connect_action (de, "transform_autorecode", G_CALLBACK (autorecode_dialog));
+
   connect_action (de, "edit_find", G_CALLBACK (find_dialog));
 
   connect_action (de, "data_split-file", G_CALLBACK (split_file_dialog));
index dceb82f74be869328cb15ba222d56599b2d9c22d..1614f059aeaaf2af001681a5c108b9a9a47dc53e 100644 (file)
@@ -58,9 +58,6 @@ tests_libpspp_encoding_guesser_test_SOURCES = \
 tests_libpspp_encoding_guesser_test_LDADD = src/libpspp/libpspp.la gl/libgl.la
 
 tests_libpspp_heap_test_SOURCES = \
-       src/libpspp/heap.c \
-       src/libpspp/pool.c \
-       src/libpspp/temp-file.c \
        tests/libpspp/heap-test.c
 tests_libpspp_heap_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
 tests_libpspp_heap_test_LDADD = src/libpspp/libpspp.la gl/libgl.la
@@ -96,10 +93,6 @@ tests_libpspp_range_map_test_SOURCES = \
 tests_libpspp_range_map_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
 
 tests_libpspp_range_set_test_SOURCES = \
-       src/libpspp/bt.c \
-       src/libpspp/pool.c \
-       src/libpspp/range-set.c \
-       src/libpspp/temp-file.c \
        tests/libpspp/range-set-test.c
 tests_libpspp_range_set_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
 tests_libpspp_range_set_test_LDADD = src/libpspp/libpspp.la gl/libgl.la
@@ -109,23 +102,11 @@ tests_libpspp_str_test_SOURCES = \
 tests_libpspp_str_test_LDADD = src/libpspp/libpspp.la gl/libgl.la 
 
 tests_libpspp_string_map_test_SOURCES = \
-       src/libpspp/hash-functions.c \
-       src/libpspp/hmap.c \
-       src/libpspp/string-map.c \
-       src/libpspp/string-set.c \
        tests/libpspp/string-map-test.c
 tests_libpspp_string_map_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
 tests_libpspp_string_map_test_LDADD = src/libpspp/libpspp.la gl/libgl.la
 
 tests_libpspp_stringi_map_test_SOURCES = \
-       src/libpspp/hash-functions.c \
-       src/libpspp/hmap.c \
-       src/libpspp/pool.c \
-       src/libpspp/str.c \
-       src/libpspp/stringi-map.c \
-       src/libpspp/string-set.c \
-       src/libpspp/stringi-set.c \
-       src/libpspp/temp-file.c \
        tests/libpspp/stringi-map-test.c
 tests_libpspp_stringi_map_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
 tests_libpspp_stringi_map_test_LDADD = src/libpspp/libpspp.la gl/libgl.la
@@ -138,21 +119,11 @@ tests_libpspp_string_set_test_SOURCES = \
 tests_libpspp_string_set_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
 
 tests_libpspp_stringi_set_test_SOURCES = \
-       src/libpspp/hash-functions.c \
-       src/libpspp/hmap.c \
-       src/libpspp/pool.c \
-       src/libpspp/str.c \
-       src/libpspp/stringi-set.c \
-       src/libpspp/temp-file.c \
        tests/libpspp/stringi-set-test.c
 tests_libpspp_stringi_set_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
 tests_libpspp_stringi_set_test_LDADD = src/libpspp/libpspp.la gl/libgl.la
 
 tests_libpspp_tower_test_SOURCES = \
-       src/libpspp/abt.c \
-       src/libpspp/pool.c \
-       src/libpspp/temp-file.c \
-       src/libpspp/tower.c \
        tests/libpspp/tower-test.c
 tests_libpspp_tower_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
 tests_libpspp_tower_test_LDADD = src/libpspp/libpspp.la gl/libgl.la
@@ -161,25 +132,11 @@ tests_libpspp_u8_istream_test_SOURCES = tests/libpspp/u8-istream-test.c
 tests_libpspp_u8_istream_test_LDADD = src/libpspp/libpspp.la gl/libgl.la
 
 tests_libpspp_sparse_array_test_SOURCES = \
-       src/libpspp/sparse-array.c \
-       src/libpspp/pool.c \
-       tests/libpspp/sparse-array-test.c \
-       src/libpspp/temp-file.c
+       tests/libpspp/sparse-array-test.c 
 tests_libpspp_sparse_array_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
 tests_libpspp_sparse_array_test_LDADD = src/libpspp/libpspp.la gl/libgl.la
 
 tests_libpspp_sparse_xarray_test_SOURCES = \
-       src/libpspp/argv-parser.c \
-       src/libpspp/bt.c \
-       src/libpspp/deque.c \
-       src/libpspp/ext-array.c \
-       src/libpspp/model-checker.c \
-       src/libpspp/range-set.c \
-       src/libpspp/sparse-array.c \
-       src/libpspp/sparse-xarray.c \
-       src/libpspp/str.c \
-       src/libpspp/pool.c \
-       src/libpspp/temp-file.c \
        tests/libpspp/sparse-xarray-test.c
 tests_libpspp_sparse_xarray_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
 tests_libpspp_sparse_xarray_test_LDADD = src/libpspp/libpspp.la gl/libgl.la
@@ -203,10 +160,6 @@ tests_language_lexer_scan_test_SOURCES = \
        src/language/lexer/scan.c \
        src/language/lexer/segment.c \
        src/language/lexer/token.c \
-       src/libpspp/pool.c \
-       src/libpspp/prompt.c \
-       src/libpspp/str.c \
-       src/libpspp/temp-file.c \
        tests/language/lexer/scan-test.c
 tests_language_lexer_scan_test_CFLAGS = $(AM_CFLAGS)
 tests_language_lexer_scan_test_LDADD = \
@@ -218,10 +171,6 @@ tests_language_lexer_segment_test_SOURCES = \
        src/data/identifier.c \
        src/language/lexer/command-name.c \
        src/language/lexer/segment.c \
-       src/libpspp/pool.c \
-       src/libpspp/prompt.c \
-       src/libpspp/str.c \
-       src/libpspp/temp-file.c \
        tests/language/lexer/segment-test.c
 tests_language_lexer_segment_test_CFLAGS = $(AM_CFLAGS)
 tests_language_lexer_segment_test_LDADD = \
@@ -230,12 +179,6 @@ tests_language_lexer_segment_test_LDADD = \
 
 check_PROGRAMS += tests/libpspp/zip-test
 tests_libpspp_zip_test_SOURCES = \
-       src/libpspp/str.c \
-       src/libpspp/pool.c \
-       src/libpspp/temp-file.c \
-       src/libpspp/inflate.c \
-       src/libpspp/zip-reader.c \
-       src/libpspp/zip-writer.c \
        tests/libpspp/zip-test.c
 tests_libpspp_zip_test_CFLAGS = $(AM_CFLAGS)
 tests_libpspp_zip_test_LDADD = \