3 #include <gtksourceview/gtksource.h>
9 #include "psppire-dialog.h"
10 #include "psppire-selector.h"
11 #include "psppire-buttonbox.h"
12 #include "psppire-keypad.h"
13 #include "psppire-acr.h"
14 #include "psppire-dictview.h"
15 #include "psppire-var-view.h"
16 #include "psppire-val-chooser.h"
17 #include "psppire-checkbox-treeview.h"
19 #include "psppire-dialog-action-aggregate.h"
20 #include "psppire-dialog-action-autorecode.h"
21 #include "psppire-dialog-action-barchart.h"
22 #include "psppire-dialog-action-binomial.h"
23 #include "psppire-dialog-action-chisquare.h"
24 #include "psppire-dialog-action-compute.h"
25 #include "psppire-dialog-action-comments.h"
26 #include "psppire-dialog-action-correlation.h"
27 #include "psppire-dialog-action-count.h"
28 #include "psppire-dialog-action-crosstabs.h"
29 #include "psppire-dialog-action-descriptives.h"
30 #include "psppire-dialog-action-examine.h"
31 #include "psppire-dialog-action-flip.h"
32 #include "psppire-dialog-action-factor.h"
33 #include "psppire-dialog-action-frequencies.h"
34 #include "psppire-dialog-action-histogram.h"
35 #include "psppire-dialog-action-indep-samps.h"
36 #include "psppire-dialog-action-k-related.h"
37 #include "psppire-dialog-action-1sks.h"
38 #include "psppire-dialog-action-kmeans.h"
39 #include "psppire-dialog-action-logistic.h"
40 #include "psppire-dialog-action-means.h"
41 #include "psppire-dialog-action-paired.h"
42 #include "psppire-dialog-action-oneway.h"
43 #include "psppire-means-layer.h"
44 #include "psppire-dialog-action-rank.h"
45 #include "psppire-dialog-action-recode-same.h"
46 #include "psppire-dialog-action-recode-different.h"
47 #include "psppire-dialog-action-regression.h"
48 #include "psppire-dialog-action-reliability.h"
49 #include "psppire-dialog-action-roc.h"
50 #include "psppire-dialog-action-runs.h"
51 #include "psppire-dialog-action-scatterplot.h"
52 #include "psppire-dialog-action-select.h"
53 #include "psppire-dialog-action-sort.h"
54 #include "psppire-dialog-action-split.h"
55 #include "psppire-dialog-action-tt1s.h"
56 #include "psppire-dialog-action-two-sample.h"
57 #include "psppire-dialog-action-univariate.h"
58 #include "psppire-dialog-action-var-info.h"
59 #include "psppire-dialog-action-weight.h"
60 #include "psppire-value-entry.h"
62 static volatile GType kludge;
65 typedef GType (*get_type_func)(void);
67 static const get_type_func dialog_action_types[]=
69 psppire_dialog_action_1sks_get_type,
70 psppire_dialog_action_autorecode_get_type,
71 psppire_dialog_action_aggregate_get_type,
72 psppire_dialog_action_binomial_get_type,
73 psppire_dialog_action_barchart_get_type,
74 psppire_dialog_action_chisquare_get_type,
75 psppire_dialog_action_compute_get_type,
76 psppire_dialog_action_comments_get_type,
77 psppire_dialog_action_correlation_get_type,
78 psppire_dialog_action_count_get_type,
79 psppire_dialog_action_crosstabs_get_type,
80 psppire_dialog_action_descriptives_get_type,
81 psppire_dialog_action_examine_get_type,
82 psppire_dialog_action_factor_get_type,
83 psppire_dialog_action_flip_get_type,
84 psppire_dialog_action_frequencies_get_type,
85 psppire_dialog_action_histogram_get_type,
86 psppire_dialog_action_logistic_get_type,
87 psppire_dialog_action_kmeans_get_type,
88 psppire_dialog_action_k_related_get_type,
89 psppire_dialog_action_means_get_type,
90 psppire_dialog_action_oneway_get_type,
91 psppire_dialog_action_paired_get_type,
92 psppire_dialog_action_indep_samps_get_type,
93 psppire_dialog_action_var_info_get_type,
94 psppire_dialog_action_rank_get_type,
95 psppire_dialog_action_recode_same_get_type,
96 psppire_dialog_action_recode_different_get_type,
97 psppire_dialog_action_reliability_get_type,
98 psppire_dialog_action_regression_get_type,
99 psppire_dialog_action_roc_get_type,
100 psppire_dialog_action_runs_get_type,
101 psppire_dialog_action_scatterplot_get_type,
102 psppire_dialog_action_select_get_type,
103 psppire_dialog_action_sort_get_type,
104 psppire_dialog_action_split_get_type,
105 psppire_dialog_action_tt1s_get_type,
106 psppire_dialog_action_two_sample_get_type,
107 psppire_dialog_action_weight_get_type,
108 psppire_dialog_action_univariate_get_type
113 preregister_actions (void)
116 for (i = 0; i < sizeof (dialog_action_types) / sizeof (dialog_action_types[0]); ++i)
118 get_type_func x = dialog_action_types[i];
125 tx_string_to_double (const GValue *src, GValue *dest)
127 const gchar *str = g_value_get_string (src);
128 gdouble dble = g_strtod (str, NULL);
129 g_value_set_double (dest, dble);
134 tx_string_to_int (const GValue *src, GValue *dest)
136 const gchar *str = g_value_get_string (src);
138 g_value_set_int (dest, x);
142 enum_to_string (const GValue *src, GValue *dest)
144 gint n = g_value_get_enum (src);
145 GType t = G_VALUE_TYPE (src);
146 GEnumClass *ec = g_type_class_ref (t);
147 GEnumValue *ev = g_enum_get_value (ec, n);
149 g_value_set_string (dest, gettext (ev->value_nick));
154 GType align_enum_type;
155 GType measure_enum_type;
156 GType role_enum_type;
159 extern const GEnumValue align[];
160 extern const GEnumValue measure[];
161 extern const GEnumValue role[];
166 preregister_misc (void)
168 align_enum_type = g_enum_register_static ("PsppAlignment", align);
169 measure_enum_type = g_enum_register_static ("PsppMeasure", measure);
170 role_enum_type = g_enum_register_static ("PsppRole", role);
172 g_value_register_transform_func (G_TYPE_STRING, G_TYPE_DOUBLE, tx_string_to_double);
173 g_value_register_transform_func (G_TYPE_STRING, G_TYPE_INT, tx_string_to_int);
175 g_value_register_transform_func (measure_enum_type, G_TYPE_STRING, enum_to_string);
176 g_value_register_transform_func (align_enum_type, G_TYPE_STRING, enum_to_string);
177 g_value_register_transform_func (role_enum_type, G_TYPE_STRING, enum_to_string);
181 /* Any custom widgets which are to be used in GtkBuilder ui files
182 need to be preregistered, otherwise GtkBuilder refuses to
183 acknowledge their existence. */
185 preregister_widgets (void)
187 psppire_val_chooser_get_type ();
188 psppire_dialog_get_type ();
189 psppire_selector_get_type ();
190 psppire_buttonbox_get_type ();
191 psppire_keypad_get_type ();
192 psppire_acr_get_type ();
193 psppire_dict_view_get_type ();
194 psppire_var_view_get_type ();
195 psppire_value_entry_get_type ();
196 psppire_checkbox_treeview_get_type ();
197 psppire_means_layer_get_type ();
199 preregister_actions ();
202 /* This seems to be necessary on Cygwin.
203 It ought not to be necessary. Having it here can't do any harm. */
204 kludge = gtk_source_view_get_type ();