This patch seems to fix the most obvious of the gui issues.

One of the things it fixes is what appears to be a bug in
datasheet_count_cases, so perhaps Ben wants to review it before I
check in.

J'

-- 
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://pgp.mit.edu or any PGP keyserver for public key.


Index: src/data/casereader.c
===================================================================
RCS file: /sources/pspp/pspp/src/data/Attic/casereader.c,v
retrieving revision 1.1.2.8
diff -b -w -U 3 -r1.1.2.8 casereader.c
--- src/data/casereader.c	7 May 2007 05:16:08 -0000	1.1.2.8
+++ src/data/casereader.c	24 May 2007 05:00:51 -0000
@@ -233,16 +233,19 @@
 {
   if (reader->case_cnt == CASENUMBER_MAX) 
     {
+      casenumber n_cases = 0;
       struct casereader *clone;
       struct ccase c;
 
-      reader->case_cnt = 0;
-
       clone = casereader_clone (reader);
+
       for (; casereader_read (clone, &c); case_destroy (&c)) 
-        reader->case_cnt++;
+        n_cases++;
+
       casereader_destroy (clone);
+      return n_cases;
     }
+
   return reader->case_cnt;
 }
 
Index: src/data/datasheet.c
===================================================================
RCS file: /sources/pspp/pspp/src/data/Attic/datasheet.c,v
retrieving revision 1.1.2.12
diff -b -w -U 3 -r1.1.2.12 datasheet.c
--- src/data/datasheet.c	4 May 2007 03:48:47 -0000	1.1.2.12
+++ src/data/datasheet.c	24 May 2007 05:00:52 -0000
@@ -167,8 +167,6 @@
     {
       size_t column_cnt;
       casenumber row_cnt;
-      unsigned long int column_start;
-      unsigned long int row_start;
       struct source_info *si;
 
       si = xmalloc (sizeof *si);
@@ -177,15 +175,21 @@
       row_cnt = source_get_backing_row_cnt (si->source);
       source_increase_use (si->source, column_cnt);
 
+      if ( column_cnt > 0 )
+	{
+	  unsigned long int column_start;
       column_start = axis_extend (ds->columns, column_cnt);
       axis_insert (ds->columns, 0, column_start, column_cnt);
       range_map_insert (&ds->sources, column_start, column_cnt,
                         &si->column_range);
+	}
 
+      if ( row_cnt > 0 )
+	{
+	  unsigned long int row_start;
       row_start = axis_extend (ds->rows, row_cnt);
       axis_insert (ds->rows, 0, row_start, row_cnt);
-
-      return ds;
+	}
     }
 
   return ds;
Index: src/data/procedure.c
===================================================================
RCS file: /sources/pspp/pspp/src/data/procedure.c,v
retrieving revision 1.25.2.5
diff -b -w -U 3 -r1.25.2.5 procedure.c
--- src/data/procedure.c	7 May 2007 05:16:08 -0000	1.25.2.5
+++ src/data/procedure.c	24 May 2007 05:00:52 -0000
@@ -340,6 +340,7 @@
       ds->discard_output = false; 
     }
   ds->sink = NULL;
+  if ( ds->replace_source) ds->replace_source (ds->source);
 
   caseinit_clear (ds->caseinit);
   caseinit_mark_as_preinited (ds->caseinit, ds->dict);
@@ -481,6 +482,7 @@
       dict_destroy (ds->dict);
       ds->dict = ds->permanent_dict;
       ds->permanent_dict = NULL;
+      if (ds->replace_dict) ds->replace_dict (ds->dict);
 
       trns_chain_destroy (ds->temporary_trns_chain);
       ds->temporary_trns_chain = NULL;
@@ -552,6 +554,7 @@
   
   casereader_destroy (ds->source);
   ds->source = NULL;
+  if ( ds->replace_source) ds->replace_source (NULL);
 
   proc_cancel_all_transformations (ds);
 }
@@ -570,6 +573,7 @@
 
   dict_destroy (ds->dict);
   ds->dict = dict;
+  if ( ds->replace_dict) ds->replace_dict (dict);
 
   proc_set_active_file_data (ds, source);
 }
@@ -581,6 +585,7 @@
 {
   casereader_destroy (ds->source);
   ds->source = reader;
+  if (ds->replace_source) ds->replace_source (reader);
 
   caseinit_clear (ds->caseinit);
   caseinit_mark_as_preinited (ds->caseinit, ds->dict);
Index: src/ui/gui/psppire.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/psppire.c,v
retrieving revision 1.35.2.2
diff -b -w -U 3 -r1.35.2.2 psppire.c
--- src/ui/gui/psppire.c	14 Apr 2007 05:04:23 -0000	1.35.2.2
+++ src/ui/gui/psppire.c	24 May 2007 05:00:53 -0000
@@ -1,3 +1,4 @@
+#include <data/casereader.h>
 /*
    PSPPIRE --- A Graphical User Interface for PSPP
    Copyright (C) 2004, 2005, 2006  Free Software Foundation
@@ -70,11 +71,12 @@
 
 
 static void
-replace_flexifile (struct casereader *s)
+replace_casereader (struct casereader *s)
 {
-  if ( NULL == s )
+  struct datasheet *datasheet = datasheet_create (s);
+
     psppire_case_file_replace_datasheet (the_data_store->case_file,
-					 datasheet_create (NULL));
+				       datasheet);
 }
 
 
@@ -120,7 +122,7 @@
 			  fn_getenv_default ("STAT_INCLUDE_PATH", include_path)
 			  );
 
-  the_dataset = create_dataset (replace_flexifile,
+  the_dataset = create_dataset (replace_casereader,
 				replace_dictionary);
 
   message_dialog_init (the_source_stream);
@@ -134,9 +136,13 @@
   /* Create the model for the var_sheet */
   the_var_store = psppire_var_store_new (dictionary);
 
-
   the_data_store = psppire_data_store_new (dictionary);
 
+
+  proc_set_active_file_data (the_dataset,
+			     datasheet_make_reader (the_data_store->case_file->datasheet));
+
+
   create_icon_factory ();
 
   new_data_window (NULL, NULL);

Attachment: signature.asc
Description: Digital signature

_______________________________________________
pspp-dev mailing list
pspp-dev@gnu.org
http://lists.gnu.org/mailman/listinfo/pspp-dev

Reply via email to