pspp-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pspp-cvs] pspp/src data/ChangeLog data/datasheet.c data/d...


From: John Darrington
Subject: [Pspp-cvs] pspp/src data/ChangeLog data/datasheet.c data/d...
Date: Wed, 18 Jul 2007 00:50:59 +0000

CVSROOT:        /sources/pspp
Module name:    pspp
Changes by:     John Darrington <jmd>   07/07/18 00:50:59

Modified files:
        src/data       : ChangeLog datasheet.c dictionary.c dictionary.h 
                         vardict.h variable.c 
        src/ui/gui     : ChangeLog helper.c helper.h psppire-case-file.c 
                         psppire-case-file.h psppire-data-store.c 
                         psppire-dict.c psppire-dict.h 
                         psppire-var-store.c 

Log message:
        Added the ability to resize string variables from the GUI.  Thanks to 
        Ben for his comments.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/ChangeLog?cvsroot=pspp&r1=1.134&r2=1.135
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/datasheet.c?cvsroot=pspp&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/dictionary.c?cvsroot=pspp&r1=1.39&r2=1.40
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/dictionary.h?cvsroot=pspp&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/vardict.h?cvsroot=pspp&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/variable.c?cvsroot=pspp&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/ChangeLog?cvsroot=pspp&r1=1.70&r2=1.71
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/helper.c?cvsroot=pspp&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/helper.h?cvsroot=pspp&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/psppire-case-file.c?cvsroot=pspp&r1=1.25&r2=1.26
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/psppire-case-file.h?cvsroot=pspp&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/psppire-data-store.c?cvsroot=pspp&r1=1.48&r2=1.49
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/psppire-dict.c?cvsroot=pspp&r1=1.30&r2=1.31
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/psppire-dict.h?cvsroot=pspp&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/psppire-var-store.c?cvsroot=pspp&r1=1.26&r2=1.27

Patches:
Index: data/ChangeLog
===================================================================
RCS file: /sources/pspp/pspp/src/data/ChangeLog,v
retrieving revision 1.134
retrieving revision 1.135
diff -u -b -r1.134 -r1.135
--- data/ChangeLog      14 Jul 2007 05:47:46 -0000      1.134
+++ data/ChangeLog      18 Jul 2007 00:50:58 -0000      1.135
@@ -1,3 +1,16 @@
+2007-07-18 John Darrington <address@hidden>
+
+       * datasheet.c (datasheet_delete_columns): Added assertion to check
+       we're not deleting outside the range of the sheet.  
+
+       
+       * dictionary.c dictionary.h variable.c: Added the ability for string
+       variables to be resized.
+       
+       * vardict.h: Added some prototypes (moved from dictionary.h) as
+       these should only be called by variable.c
+
+
 2007-07-14 John Darrington <address@hidden>
 
        * sfm-reader.c: Respect case_cnt field in file header.

Index: data/datasheet.c
===================================================================
RCS file: /sources/pspp/pspp/src/data/datasheet.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- data/datasheet.c    7 Jul 2007 06:14:08 -0000       1.6
+++ data/datasheet.c    18 Jul 2007 00:50:58 -0000      1.7
@@ -354,6 +354,8 @@
 {
   size_t lcol;
 
+  assert ( start + cnt <= axis_get_size (ds->columns) );
+
   /* Free up columns for reuse. */
   for (lcol = start; lcol < start + cnt; lcol++)
     {

Index: data/dictionary.c
===================================================================
RCS file: /sources/pspp/pspp/src/data/dictionary.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -b -r1.39 -r1.40
--- data/dictionary.c   7 Jul 2007 06:14:08 -0000       1.39
+++ data/dictionary.c   18 Jul 2007 00:50:58 -0000      1.40
@@ -156,14 +156,22 @@
 
   while (d->var_cnt > 0 )
     {
-      var_clear_vardict (d->var[d->var_cnt - 1]);
-      var_destroy (d->var[d->var_cnt -1]);
+      struct variable *v = d->var[d->var_cnt - 1];
+      int dict_index = var_get_dict_index (v);
+      int case_index = var_get_case_index (v);
+      int val_cnt = var_get_value_cnt (v);
+
+      var_clear_vardict (v);
+      var_destroy (v);
 
       d->var_cnt--;
 
       if (d->callbacks &&  d->callbacks->var_deleted )
-       d->callbacks->var_deleted (d, d->var_cnt, d->cb_data);
+       d->callbacks->var_deleted (d,
+                                  dict_index, case_index, val_cnt,
+                                  d->cb_data);
     }
+
   free (d->var);
   d->var = NULL;
   d->var_cnt = d->var_cap = 0;
@@ -418,7 +426,7 @@
     d->callbacks->var_changed (d, dict_index, d->cb_data);
 }
 
-/* Sets the case_index in V's vardict to DICT_INDEX. */
+/* Sets the case_index in V's vardict to CASE_INDEX. */
 static void
 set_var_case_index (struct variable *v, int case_index)
 {
@@ -455,6 +463,8 @@
 dict_delete_var (struct dictionary *d, struct variable *v)
 {
   int dict_index = var_get_dict_index (v);
+  const int case_index = var_get_case_index (v);
+  const int val_cnt = var_get_value_cnt (v);
 
   assert (dict_contains_var (d, v));
 
@@ -487,7 +497,7 @@
   var_destroy (v);
 
   if (d->callbacks &&  d->callbacks->var_deleted )
-    d->callbacks->var_deleted (d, dict_index, d->cb_data);
+    d->callbacks->var_deleted (d, dict_index, case_index, val_cnt, d->cb_data);
 }
 
 /* Deletes the COUNT variables listed in VARS from D.  This is
@@ -834,6 +844,33 @@
     }
 }
 
+
+/*
+   Reassigns case indices for D, increasing each index above START by
+   the value PADDING.
+*/
+static void
+dict_pad_values (struct dictionary *d, int start, int padding)
+{
+  size_t i;
+
+  if ( padding <= 0 ) 
+       return;
+
+  for (i = 0; i < d->var_cnt; ++i)
+    {
+      struct variable *v = d->var[i];
+
+      int index = var_get_case_index (v);
+
+      if ( index >= start)
+       set_var_case_index (v, index + padding);
+    }
+
+  d->next_value_idx += padding;
+}
+
+
 /* Returns the number of values that would be used by a case if
    dict_compact_values() were called. */
 size_t
@@ -1388,3 +1425,23 @@
        d->callbacks->var_changed (d, var_get_dict_index (v), d->cb_data);
     }
 }
+
+
+/* Called from variable.c to notify the dictionary that the variable's width
+   has changed */
+void
+dict_var_resized (const struct variable *v, int delta)
+{
+  if ( var_has_vardict (v))
+    {
+      const struct vardict_info *vdi = var_get_vardict (v);
+      struct dictionary *d;
+
+      d = vdi->dict;
+
+      dict_pad_values (d, var_get_case_index(v) + 1, delta);
+
+      if ( d->callbacks && d->callbacks->var_resized )
+       d->callbacks->var_resized (d, var_get_dict_index (v), delta, 
d->cb_data);
+    }
+}

Index: data/dictionary.h
===================================================================
RCS file: /sources/pspp/pspp/src/data/dictionary.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- data/dictionary.h   7 Jul 2007 06:14:08 -0000       1.16
+++ data/dictionary.h   18 Jul 2007 00:50:58 -0000      1.17
@@ -29,8 +29,9 @@
 struct dict_callbacks
  {
   void (*var_added) (struct dictionary *, int, void *);
-  void (*var_deleted) (struct dictionary *, int, void *);
+  void (*var_deleted) (struct dictionary *, int, int, int, void *);
   void (*var_changed) (struct dictionary *, int, void *);
+  void (*var_resized) (struct dictionary *, int, int, void *);
   void (*weight_changed) (struct dictionary *, int, void *);
   void (*filter_changed) (struct dictionary *, int, void *);
   void (*split_changed) (struct dictionary *, void *);
@@ -148,7 +149,4 @@
 
 void dict_assign_short_names (struct dictionary *);
 
-/* Called only from variable.c */
-void dict_var_changed (const struct variable *v);
-
 #endif /* dictionary.h */

Index: data/vardict.h
===================================================================
RCS file: /sources/pspp/pspp/src/data/vardict.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- data/vardict.h      7 Jul 2007 06:14:10 -0000       1.5
+++ data/vardict.h      18 Jul 2007 00:50:58 -0000      1.6
@@ -36,4 +36,9 @@
 bool var_has_vardict (const struct variable *);
 void var_clear_vardict (struct variable *);
 
+
+/* Called only from variable.c, but defined in dictionary.c */
+void dict_var_changed (const struct variable *v);
+void dict_var_resized (const struct variable *v, int delta);
+
 #endif /* data/vardict.h */

Index: data/variable.c
===================================================================
RCS file: /sources/pspp/pspp/src/data/variable.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- data/variable.c     7 Jul 2007 06:14:10 -0000       1.26
+++ data/variable.c     18 Jul 2007 00:50:58 -0000      1.27
@@ -29,6 +29,7 @@
 #include "value-labels.h"
 #include "vardict.h"
 
+#include <libpspp/misc.h>
 #include <libpspp/alloc.h>
 #include <libpspp/assertion.h>
 #include <libpspp/compiler.h>
@@ -349,6 +350,7 @@
 void
 var_set_width (struct variable *v, int new_width)
 {
+  const int old_width = v->width;
   enum var_type new_type = var_type_from_width (new_width);
 
   if (mv_is_resizable (&v->miss, new_width))
@@ -382,6 +384,14 @@
 
   v->width = new_width;
 
+  {
+    const int old_val_count = value_cnt_from_width (old_width);
+    const int new_val_count = value_cnt_from_width (new_width);
+
+    if ( old_val_count != new_val_count)
+        dict_var_resized (v, new_val_count - old_val_count);
+  }
+
   dict_var_changed (v);
 }
 

Index: ui/gui/ChangeLog
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/ChangeLog,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -b -r1.70 -r1.71
--- ui/gui/ChangeLog    16 Jul 2007 05:07:02 -0000      1.70
+++ ui/gui/ChangeLog    18 Jul 2007 00:50:58 -0000      1.71
@@ -1,3 +1,13 @@
+2007-07-18  John Darrington <address@hidden>
+
+       * psppire-case-file.c psppire-case-file.h psppire-data-store.c 
+       psppire-dict.c psppire-dict.h psppire-var-store.c : Added the
+       ability to resize string variables.  Fixed associated problems
+       inserting/deleting variables.   
+       
+       * helper.c helper.h (marshaller_VOID__INT_INT_INT): New marshaller
+       function.
+       
 2007-07-16  John Darrington <address@hidden>
 
        * data-editor.c: File Open dialog remembers directory.  Thanks to 

Index: ui/gui/helper.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/helper.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- ui/gui/helper.c     7 Jul 2007 06:14:27 -0000       1.20
+++ ui/gui/helper.c     18 Jul 2007 00:50:58 -0000      1.21
@@ -20,6 +20,8 @@
 */
 #include <config.h>
 
+#include       <glib-object.h>
+
 #include <glib.h>
 #include "helper.h"
 #include "message-dialog.h"
@@ -208,3 +210,49 @@
 }
 
 
+
+#ifdef G_ENABLE_DEBUG
+# define g_marshal_value_peek_int(v)      g_value_get_int (v)
+#else
+# define g_marshal_value_peek_int(v)      (v)->data[0].v_int
+#endif
+
+
+/* VOID:INT,INT,INT */
+void
+marshaller_VOID__INT_INT_INT (GClosure     *closure,
+                        GValue       *return_value,
+                        guint         n_param_values,
+                        const GValue *param_values,
+                        gpointer      invocation_hint,
+                        gpointer      marshal_data)
+{
+  typedef void (*GMarshalFunc_VOID__INT_INT_INT) (gpointer     data1,
+                                                 gint         arg_1,
+                                                 gint         arg_2,
+                                                 gint         arg_3,
+                                                 gpointer     data2);
+  register GMarshalFunc_VOID__INT_INT_INT callback;
+  register GCClosure *cc = (GCClosure*) closure;
+  register gpointer data1, data2;
+
+  g_return_if_fail (n_param_values == 4);
+
+  if (G_CCLOSURE_SWAP_DATA (closure))
+    {
+      data1 = closure->data;
+      data2 = g_value_peek_pointer (param_values + 0);
+    }
+  else
+    {
+      data1 = g_value_peek_pointer (param_values + 0);
+      data2 = closure->data;
+    }
+  callback = (GMarshalFunc_VOID__INT_INT_INT) (marshal_data ? marshal_data : 
cc->callback);
+
+  callback (data1,
+            g_marshal_value_peek_int (param_values + 1),
+            g_marshal_value_peek_int (param_values + 2),
+            g_marshal_value_peek_int (param_values + 3),
+            data2);
+}

Index: ui/gui/helper.h
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/helper.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- ui/gui/helper.h     7 Jul 2007 06:14:27 -0000       1.14
+++ ui/gui/helper.h     18 Jul 2007 00:50:59 -0000      1.15
@@ -61,5 +61,12 @@
    glade_xml_new (relocate(PKGDATADIR "/" FILE), NULL, NULL)
 
 
+void marshaller_VOID__INT_INT_INT (GClosure     *closure,
+                                  GValue       *return_value,
+                                  guint         n_param_values,
+                                  const GValue *param_values,
+                                  gpointer      invocation_hint,
+                                  gpointer      marshal_data);
+
 
 #endif

Index: ui/gui/psppire-case-file.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/psppire-case-file.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- ui/gui/psppire-case-file.c  8 Jul 2007 10:49:30 -0000       1.25
+++ ui/gui/psppire-case-file.c  18 Jul 2007 00:50:59 -0000      1.26
@@ -341,25 +341,33 @@
 
 
 /* Resize the cases in the casefile, by inserting N_VALUES into every
-   one of them. */
+   one of them at the position immediately preceeding WHERE.
+*/
 gboolean
 psppire_case_file_insert_values (PsppireCaseFile *cf,
-                                gint n_values, gint before)
+                                gint n_values, gint where)
 {
-  union value *values;
   g_return_val_if_fail (cf, FALSE);
   g_return_val_if_fail (cf->accessible, FALSE);
 
+  if ( n_values == 0 )
+    return FALSE;
+
+  g_assert (n_values > 0);
+
   if ( ! cf->datasheet )
     cf->datasheet = datasheet_create (NULL);
 
-  values = xcalloc (n_values, sizeof *values);
-  datasheet_insert_columns (cf->datasheet, values, n_values, before);
+  {
+    union value *values = xcalloc (n_values, sizeof *values);
+    datasheet_insert_columns (cf->datasheet, values, n_values, where);
   free (values);
+  }
 
   return TRUE;
 }
 
+
 /* Fills C with the CASENUMth case.
    Returns true on success, false otherwise.
  */

Index: ui/gui/psppire-case-file.h
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/psppire-case-file.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- ui/gui/psppire-case-file.h  8 Jul 2007 10:49:30 -0000       1.17
+++ ui/gui/psppire-case-file.h  18 Jul 2007 00:50:59 -0000      1.18
@@ -93,7 +93,7 @@
 gboolean psppire_case_file_delete_cases (PsppireCaseFile *cf, casenumber 
n_rows,
                                        casenumber first);
 
-gboolean psppire_case_file_insert_values (PsppireCaseFile *cf, gint n_values, 
gint before);
+gboolean psppire_case_file_insert_values (PsppireCaseFile *cf, gint n_values, 
gint where);
 
 struct case_ordering;
 

Index: ui/gui/psppire-data-store.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/psppire-data-store.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -b -r1.48 -r1.49
--- ui/gui/psppire-data-store.c 13 Jul 2007 06:39:05 -0000      1.48
+++ ui/gui/psppire-data-store.c 18 Jul 2007 00:50:59 -0000      1.49
@@ -282,30 +282,27 @@
 }
 
 
+/*
+   A callback which occurs after a variable has been deleted.
+ */
 static void
-delete_variables_callback (GObject *obj, gint var_num, gint n_vars, gpointer 
data)
+delete_variable_callback (GObject *obj, gint dict_index,
+                         gint case_index, gint val_cnt,
+                         gpointer data)
 {
-  PsppireDataStore *store ;
+  PsppireDataStore *store  = PSPPIRE_DATA_STORE (data);
 
-  g_return_if_fail (data);
-
-  store  = PSPPIRE_DATA_STORE (data);
-
-  g_sheet_model_columns_deleted (G_SHEET_MODEL (store), var_num, n_vars);
+  g_sheet_model_columns_deleted (G_SHEET_MODEL (store), dict_index, 1);
 
   g_sheet_column_columns_changed (G_SHEET_COLUMN (store),
-                                  var_num, -1);
+                                  dict_index, -1);
 }
 
 
 static void
 variable_changed_callback (GObject *obj, gint var_num, gpointer data)
 {
-  PsppireDataStore *store;
-
-  g_return_if_fail (data);
-
-  store  = PSPPIRE_DATA_STORE (data);
+  PsppireDataStore *store  = PSPPIRE_DATA_STORE (data);
 
   g_sheet_column_columns_changed (G_SHEET_COLUMN (store),
                                  var_num, 1);
@@ -353,13 +350,16 @@
 dict_size_change_callback (GObject *obj,
                          gint posn, gint adjustment, gpointer data)
 {
-  PsppireDataStore *store ;
+  PsppireDataStore *store  = PSPPIRE_DATA_STORE (data);
 
-  g_return_if_fail (data);
+  const struct variable *v = psppire_dict_get_variable (store->dict, posn);
 
-  store  = PSPPIRE_DATA_STORE (data);
+  const gint new_val_width = value_cnt_from_width (var_get_width (v));
 
-  psppire_case_file_insert_values (store->case_file, adjustment, posn);
+  if ( adjustment > 0 )
+    psppire_case_file_insert_values (store->case_file, adjustment,
+                                    new_val_width - adjustment +
+                                    var_get_case_index(v));
 }
 
 
@@ -432,15 +432,14 @@
                   G_CALLBACK (insert_variable_callback),
                   data_store);
 
-  g_signal_connect (dict, "variables-deleted",
-                  G_CALLBACK (delete_variables_callback),
+  g_signal_connect (dict, "variable-deleted",
+                  G_CALLBACK (delete_variable_callback),
                   data_store);
 
   g_signal_connect (dict, "variable-changed",
                   G_CALLBACK (variable_changed_callback),
                   data_store);
 
-
   g_signal_connect (dict, "dict-size-changed",
                    G_CALLBACK (dict_size_change_callback),
                    data_store);

Index: ui/gui/psppire-dict.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/psppire-dict.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- ui/gui/psppire-dict.c       7 Jul 2007 06:14:29 -0000       1.30
+++ ui/gui/psppire-dict.c       18 Jul 2007 00:50:59 -0000      1.31
@@ -45,7 +45,7 @@
 enum  {VARIABLE_CHANGED,
        VARIABLE_RESIZED,
        VARIABLE_INSERTED,
-       VARIABLES_DELETED,
+       VARIABLE_DELETED,
        WEIGHT_CHANGED,
        FILTER_CHANGED,
        SPLIT_CHANGED,
@@ -131,15 +131,16 @@
                  G_TYPE_INT);
 
 
-  signals [VARIABLES_DELETED] =
-    g_signal_new ("variables_deleted",
+  signals [VARIABLE_DELETED] =
+    g_signal_new ("variable-deleted",
                  G_TYPE_FROM_CLASS (class),
                  G_SIGNAL_RUN_FIRST,
                  0,
                  NULL, NULL,
-                 gtkextra_VOID__INT_INT,
+                 marshaller_VOID__INT_INT_INT,
                  G_TYPE_NONE,
-                 2,
+                 3,
+                 G_TYPE_INT,
                  G_TYPE_INT,
                  G_TYPE_INT);
 
@@ -211,9 +212,11 @@
 }
 
 static void
-delcb (struct dictionary *d, int idx, void *pd)
+delcb (struct dictionary *d, int dict_idx, int case_idx, int value_cnt,
+       void *pd)
 {
-  g_signal_emit (pd, signals [VARIABLES_DELETED], 0, idx, 1);
+  g_signal_emit (pd, signals [VARIABLE_DELETED], 0,
+                dict_idx, case_idx, value_cnt );
 }
 
 static void
@@ -223,6 +226,12 @@
 }
 
 static void
+resize_cb (struct dictionary *d, int idx, int delta, void *pd)
+{
+  g_signal_emit (pd, signals [VARIABLE_RESIZED], 0, idx, delta);
+}
+
+static void
 weight_changed_callback (struct dictionary *d, int idx, void *pd)
 {
   g_signal_emit (pd, signals [WEIGHT_CHANGED], 0, idx);
@@ -246,6 +255,7 @@
     addcb,
     delcb,
     mutcb,
+    resize_cb,
     weight_changed_callback,
     filter_changed_callback,
     split_changed_callback
@@ -346,7 +356,6 @@
       var = dict_get_var (d->dict, first);
       dict_delete_var (d->dict, var);
     }
-  dict_compact_values (d->dict);
 }
 
 
@@ -467,8 +476,6 @@
   if ( old_size == new_size )
     return ;
 
-  dict_compact_values (d->dict);
-
   fv = var_get_case_index (pv);
 
   g_signal_emit (d, signals [VARIABLE_RESIZED], 0,
@@ -764,3 +771,29 @@
 {
   return dict_get_weight (dict->dict);
 }
+
+
+
+#if DEBUGGING
+void
+psppire_dict_dump (const PsppireDict *dict)
+{
+  gint i;
+  const struct dictionary *d = dict->dict;
+
+  int *map = dict_get_compacted_dict_index_to_case_index (d);
+
+  for (i = 0; i < dict_get_var_cnt (d); ++i)
+    {
+      const struct variable *v = psppire_dict_get_variable (dict, i);
+      int di = var_get_dict_index (v);
+      g_print ("\"%s\" idx=%d, fv=%d(%d), size=%d\n",
+              var_get_name(v),
+              di,
+              var_get_case_index(v),
+              map[di],
+              value_cnt_from_width(var_get_width(v)));
+
+    }
+}
+#endif

Index: ui/gui/psppire-dict.h
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/psppire-dict.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- ui/gui/psppire-dict.h       7 Jul 2007 06:14:29 -0000       1.18
+++ ui/gui/psppire-dict.h       18 Jul 2007 00:50:59 -0000      1.19
@@ -57,7 +57,6 @@
 struct _PsppireDictClass
 {
   GObjectClass parent_class;
-
 };
 
 
@@ -103,6 +102,9 @@
 
 struct variable * psppire_dict_get_weight_variable (const PsppireDict *);
 
+#if DEBUGGING
+void psppire_dict_dump (const PsppireDict *);
+#endif
 
 G_END_DECLS
 

Index: ui/gui/psppire-var-store.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/psppire-var-store.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- ui/gui/psppire-var-store.c  8 Jul 2007 10:49:31 -0000       1.26
+++ ui/gui/psppire-var-store.c  18 Jul 2007 00:50:59 -0000      1.27
@@ -271,11 +271,11 @@
 
 
 static void
-var_delete_callback (GtkWidget *w, gint first, gint n, gpointer data)
+var_delete_callback (GtkWidget *w, gint dict_idx, gint case_idx, gint val_cnt, 
gpointer data)
 {
   GSheetModel *model = G_SHEET_MODEL (data);
 
-  g_sheet_model_rows_deleted (model, first, n);
+  g_sheet_model_rows_deleted (model, dict_idx, 1);
 }
 
 
@@ -308,7 +308,7 @@
   g_signal_connect (dict, "variable-changed", G_CALLBACK (var_change_callback),
                   var_store);
 
-  g_signal_connect (dict, "variables-deleted", G_CALLBACK 
(var_delete_callback),
+  g_signal_connect (dict, "variable-deleted", G_CALLBACK (var_delete_callback),
                   var_store);
 
   g_signal_connect (dict, "variable-inserted", G_CALLBACK 
(var_insert_callback),




reply via email to

[Prev in Thread] Current Thread [Next in Thread]