25 |
#include <gtk/gtk.h> |
#include <gtk/gtk.h> |
26 |
#include "gtksheet.h" |
#include "gtksheet.h" |
27 |
|
|
28 |
#include "gsubject.h" |
#include "pspp-dict.h" |
29 |
|
|
30 |
#define _(A) A |
#define _(A) A |
31 |
#define N_(A) A |
#define N_(A) A |
33 |
static GdkColor colour_enabled; |
static GdkColor colour_enabled; |
34 |
static GdkColor colour_disabled; |
static GdkColor colour_disabled; |
35 |
|
|
36 |
extern GSubject *subject ; |
extern PSPP_Dict *pspp_dictionary ; |
37 |
|
|
38 |
|
|
39 |
/* Enable/Disable columns in the data sheet |
/* Enable/Disable columns in the data sheet |
65 |
} |
} |
66 |
|
|
67 |
|
|
68 |
gint |
static gint |
69 |
update_data_sheet(GObject *obj, gpointer data) |
update_data_sheet(GObject *obj, gpointer data) |
70 |
{ |
{ |
71 |
guint i; |
guint i; |
72 |
GSubject *subject = G_SUBJECT(obj); |
PSPP_Dict *dict = PSPP_DICT(obj); |
73 |
|
|
74 |
GtkSheet *sheet = GTK_SHEET(data); |
GtkSheet *sheet = GTK_SHEET(data); |
75 |
|
|
76 |
for ( i = 0 ; i < subject->array->len ; ++i ) |
for ( i = 0 ; i < dict->array->len ; ++i ) |
77 |
{ |
{ |
78 |
struct variable *var; |
struct variable *var; |
79 |
var = g_ptr_array_index(subject->array,i); |
var = g_ptr_array_index(dict->array, i); |
80 |
gtk_sheet_column_button_add_label (sheet,i,var->name); |
gtk_sheet_column_button_add_label (sheet, i, var->name); |
81 |
|
|
82 |
} |
} |
83 |
psppire_data_sheet_col_set_enable(sheet,0,i-1, TRUE); |
psppire_data_sheet_col_set_enable(sheet, 0, i-1, TRUE); |
84 |
|
|
85 |
|
|
86 |
return FALSE; |
return FALSE; |
102 |
entire_sheet.rowi = rows - 1; |
entire_sheet.rowi = rows - 1; |
103 |
entire_sheet.coli = columns - 1; |
entire_sheet.coli = columns - 1; |
104 |
|
|
105 |
|
sheet = gtk_sheet_new(rows, columns, "data sheet"); |
106 |
|
|
107 |
sheet = gtk_sheet_new(rows,columns,"data sheet"); |
g_signal_connect(pspp_dictionary, "changed", |
108 |
|
G_CALLBACK(update_data_sheet), sheet); |
|
g_signal_connect(subject,"subject_changed",G_CALLBACK(update_data_sheet),sheet); |
|
109 |
|
|
110 |
|
|
111 |
g_assert(gdk_color_parse("dark slate gray",&colour_disabled)); |
g_assert(gdk_color_parse("dark slate gray",&colour_disabled)); |
112 |
g_assert(gdk_color_parse("white",&colour_enabled)); |
g_assert(gdk_color_parse("white",&colour_enabled)); |
113 |
|
|
114 |
gdk_colormap_alloc_color(gdk_colormap_get_system(), |
gdk_colormap_alloc_color(gdk_colormap_get_system(), |
115 |
&colour_disabled,FALSE,TRUE); |
&colour_disabled, FALSE, TRUE); |
116 |
|
|
117 |
gdk_colormap_alloc_color(gdk_colormap_get_system(), |
gdk_colormap_alloc_color(gdk_colormap_get_system(), |
118 |
&colour_enabled,FALSE,TRUE); |
&colour_enabled, FALSE, TRUE); |
119 |
|
|
120 |
|
|
121 |
|
|