42 |
static PSPP_Dict *pspp_dictionary ; |
static PSPP_Dict *pspp_dictionary ; |
43 |
|
|
44 |
static gint last_populated_row = -1; |
static gint last_populated_row = -1; |
45 |
|
static gint n_variables; |
46 |
|
|
47 |
|
|
48 |
static void repopulate_columns(GtkSheet *sheet, PSPP_Dict *dict, |
static void repopulate_columns(GtkSheet *sheet, PSPP_Dict *dict, |
170 |
GtkSheetRange range; |
GtkSheetRange range; |
171 |
GtkSheet *sheet = GTK_SHEET(data); |
GtkSheet *sheet = GTK_SHEET(data); |
172 |
|
|
173 |
|
if ( column >= n_variables) |
174 |
|
{ |
175 |
|
g_warning |
176 |
|
("Sorry. Maximum of %d variables is all that\'s currently implemented\n", |
177 |
|
n_variables); |
178 |
|
return FALSE; |
179 |
|
} |
180 |
|
|
181 |
const struct variable *var = pspp_dict_get_var(dict, column); |
const struct variable *var = pspp_dict_get_var(dict, column); |
182 |
|
|
183 |
range.row0 = 0; range.rowi = gtk_sheet_get_rows_count(sheet) - 1; |
range.row0 = 0; range.rowi = gtk_sheet_get_rows_count(sheet) - 1; |
190 |
|
|
191 |
|
|
192 |
gtk_sheet_column_button_add_label(sheet, column, var->name); |
gtk_sheet_column_button_add_label(sheet, column, var->name); |
193 |
|
gtk_sheet_column_set_sensitivity(sheet, column, TRUE); |
194 |
|
|
195 |
|
|
196 |
gtk_sheet_set_column_width (sheet, column, |
gtk_sheet_set_column_width (sheet, column, |
218 |
gtk_sheet_set_column_width (sheet, col, |
gtk_sheet_set_column_width (sheet, col, |
219 |
columnWidthToPixels(sheet, col, |
columnWidthToPixels(sheet, col, |
220 |
var->display_width)); |
var->display_width)); |
221 |
|
gtk_sheet_column_set_sensitivity(sheet, col, TRUE); |
222 |
} |
} |
223 |
else |
else |
224 |
{ |
{ |
229 |
|
|
230 |
|
|
231 |
gtk_sheet_column_button_add_label (sheet, col, _("var")); |
gtk_sheet_column_button_add_label (sheet, col, _("var")); |
232 |
|
gtk_sheet_column_set_sensitivity(sheet, col, FALSE); |
233 |
|
|
234 |
/* Clear the column which relates to variables no longer valid, |
/* Clear the column which relates to variables no longer valid, |
235 |
and disable them |
and disable them |
442 |
GtkWidget *sheet; |
GtkWidget *sheet; |
443 |
gint i; |
gint i; |
444 |
|
|
445 |
const gint columns=10; |
n_variables = 10; |
446 |
const gint rows=46; |
const gint rows=46; |
447 |
|
|
448 |
GtkSheetRange entire_sheet= {0,0,0,0}; |
GtkSheetRange entire_sheet= {0,0,0,0}; |
449 |
entire_sheet.rowi = rows - 1; |
entire_sheet.rowi = rows - 1; |
450 |
entire_sheet.coli = columns - 1; |
entire_sheet.coli = n_variables - 1; |
451 |
|
|
452 |
sheet = gtk_sheet_new(rows, columns, "data sheet"); |
sheet = gtk_sheet_new(rows, n_variables, "data sheet"); |
453 |
|
|
454 |
gtk_sheet_set_coding(GTK_SHEET(sheet), |
gtk_sheet_set_coding(GTK_SHEET(sheet), |
455 |
value_encode_func, value_format_func, 0); |
value_encode_func, value_format_func, 0); |
457 |
g_signal_connect(sheet, "new_column_width", |
g_signal_connect(sheet, "new_column_width", |
458 |
G_CALLBACK(adjust_column_width), 0); |
G_CALLBACK(adjust_column_width), 0); |
459 |
|
|
460 |
for (i = 0 ; i < columns ; ++i ) |
gtk_sheet_columns_set_sensitivity(GTK_SHEET(sheet), FALSE); |
461 |
|
for (i = 0 ; i < n_variables ; ++i ) |
462 |
{ |
{ |
463 |
gtk_sheet_column_button_add_label (GTK_SHEET(sheet), i, _("var")); |
gtk_sheet_column_button_add_label (GTK_SHEET(sheet), i, _("var")); |
464 |
} |
} |