1 |
/* |
/* |
2 |
PSPPIRE --- A Graphical User Interface for PSPP |
PSPPIRE --- A Graphical User Interface for PSPP |
3 |
Copyright (C) 2004,2005 Free Software Foundation |
Copyright (C) 2004,2005 Free Software Foundation |
4 |
Written by John Darrington |
Written by John Darrington |
5 |
|
|
6 |
This program is free software; you can redistribute it and/or modify |
This program is free software; you can redistribute it and/or modify |
7 |
it under the terms of the GNU General Public License as published by |
it under the terms of the GNU General Public License as published by |
8 |
the Free Software Foundation; either version 2 of the License, or |
the Free Software Foundation; either version 2 of the License, or |
9 |
(at your option) any later version. |
(at your option) any later version. |
10 |
|
|
11 |
This program is distributed in the hope that it will be useful, |
This program is distributed in the hope that it will be useful, |
12 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
GNU General Public License for more details. |
GNU General Public License for more details. |
15 |
|
|
16 |
You should have received a copy of the GNU General Public License |
You should have received a copy of the GNU General Public License |
17 |
along with this program; if not, write to the Free Software |
along with this program; if not, write to the Free Software |
18 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
19 |
02110-1301, USA. */ |
02110-1301, USA. */ |
20 |
|
|
21 |
|
|
22 |
/* This module creates the Variable Sheet used for inputing the |
/* This module creates the Variable Sheet used for inputing the |
401 |
gint r; |
gint r; |
402 |
|
|
403 |
/* |
/* |
404 |
gtk_sheet_freeze (sheet); |
gtk_sheet_freeze (sheet); |
405 |
*/ |
*/ |
406 |
for ( r = from ; r <= to ; ++r ) |
for ( r = from ; r <= to ; ++r ) |
407 |
{ |
{ |
409 |
populate_row_from_var(sheet, var, r); |
populate_row_from_var(sheet, var, r); |
410 |
} |
} |
411 |
/* |
/* |
412 |
gtk_sheet_thaw (sheet); |
gtk_sheet_thaw (sheet); |
413 |
*/ |
*/ |
414 |
} |
} |
415 |
|
|
500 |
g_assert(G_IS_PSPP_DICT(pspp_dictionary)); |
g_assert(G_IS_PSPP_DICT(pspp_dictionary)); |
501 |
|
|
502 |
struct variable *old_var = pspp_dict_get_var(pspp_dictionary, row); |
struct variable *old_var = pspp_dict_get_var(pspp_dictionary, row); |
503 |
|
|
504 |
|
struct fmt_spec *fmt_write ; |
505 |
|
struct fmt_spec *fmt_print ; |
506 |
|
|
507 |
|
if ( old_var) |
508 |
|
{ |
509 |
|
fmt_write = &old_var->write; |
510 |
|
fmt_print = &old_var->print; |
511 |
|
} |
512 |
|
|
513 |
switch (col) |
switch (col) |
514 |
{ |
{ |
532 |
&& |
&& |
533 |
/* Allow changes of case */ |
/* Allow changes of case */ |
534 |
( !old_var || |
( !old_var || |
535 |
0 != strncasecmp(old_var->name, name)) |
0 != strncasecmp(old_var->name, name)) |
536 |
) |
) |
537 |
{ |
{ |
538 |
g_print("Duplicate variable name\n"); |
g_print("Duplicate variable name\n"); |
550 |
pspp_dict_var_changed(pspp_dictionary, row); |
pspp_dict_var_changed(pspp_dictionary, row); |
551 |
break; |
break; |
552 |
case COL_WIDTH: |
case COL_WIDTH: |
553 |
old_var->width = atoi(gtk_sheet_cell_get_text(sheet, row, col)); |
fmt_write->w = fmt_print->w = |
554 |
|
atoi(gtk_sheet_cell_get_text(sheet, row, col)); |
555 |
|
pspp_dict_var_changed(pspp_dictionary, row); |
556 |
|
break; |
557 |
|
case COL_DECIMALS: |
558 |
|
fmt_write->d = fmt_print->d = |
559 |
|
atoi(gtk_sheet_cell_get_text(sheet, row, col)); |
560 |
pspp_dict_var_changed(pspp_dictionary, row); |
pspp_dict_var_changed(pspp_dictionary, row); |
561 |
break; |
break; |
562 |
case COL_LABEL: |
case COL_LABEL: |
570 |
} |
} |
571 |
} |
} |
572 |
break; |
break; |
573 |
|
} |
574 |
|
|
575 |
} |
if ( old_var ) |
576 |
|
{ |
577 |
|
check_output_specifier(fmt_write,true); |
578 |
|
check_output_specifier(fmt_print,true); |
579 |
|
} |
580 |
|
|
581 |
if ( row > last_populated_row ) |
if ( row > last_populated_row ) |
582 |
last_populated_row = row ; |
last_populated_row = row ; |
609 |
|
|
610 |
|
|
611 |
/* Associate a dictionary with the var sheet. |
/* Associate a dictionary with the var sheet. |
612 |
*/ |
*/ |
613 |
void |
void |
614 |
psppire_var_sheet_set_dictionary(GtkWidget *sheet, PSPP_Dict *d) |
psppire_var_sheet_set_dictionary(GtkWidget *sheet, PSPP_Dict *d) |
615 |
{ |
{ |