Made the variable sheet automatically add variables when clickes in a blank
authorJohn Darrington <john@darrington.wattle.id.au>
Sat, 29 Jul 2006 09:37:18 +0000 (09:37 +0000)
committerJohn Darrington <john@darrington.wattle.id.au>
Sat, 29 Jul 2006 09:37:18 +0000 (09:37 +0000)
row.

src/ui/gui/var-sheet.c

index 4358c78326e835e1d794c48808583241c2660f10..3145f13dc7159cc7d754dddbd91fcc9f8b240e97 100644 (file)
@@ -192,13 +192,15 @@ traverse_cell_callback (GtkSheet * sheet,
     }
 
   /* If the destination cell is outside the current  variables, then
-     accept the destination only as the name column of the first blank row
+     automatically create variables for the new rows.
   */
-  if ( *new_row > n_vars) 
-    return FALSE;
-  
-  if ( *new_row >= n_vars && *new_column != COL_NAME) 
-    return FALSE;
+  if ( (*new_row > n_vars) || 
+       (*new_row == n_vars && *new_column != COL_NAME) ) 
+    {
+      gint i;
+      for ( i = n_vars ; i <= *new_row; ++i )
+       psppire_dict_insert_variable(var_store->dict, i, NULL);
+    }
 
   return TRUE;
 }