src/output/cairo.c (xr_chart_renderer): Set the chart size to 0.8 of the smallest...
[pspp] / src / ui / gui / widgets.c
1 /* 
2 PSPP - a program for statistical analysis.
3 Copyright (C) 2017 Free Software Foundation, Inc.
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 #include <config.h>
20
21 #include <gtksourceview/gtksource.h>
22
23 #include "widgets.h"
24
25
26 #include "psppire-dialog.h"
27 #include "psppire-selector.h"
28 #include "psppire-buttonbox.h"
29 #include "psppire-keypad.h"
30 #include "psppire-acr.h"
31 #include "psppire-dictview.h"
32 #include "psppire-var-view.h"
33 #include "psppire-val-chooser.h"
34 #include "psppire-checkbox-treeview.h"
35
36 #include "psppire-dialog-action-aggregate.h"
37 #include "psppire-dialog-action-autorecode.h"
38 #include "psppire-dialog-action-barchart.h"
39 #include "psppire-dialog-action-binomial.h"
40 #include "psppire-dialog-action-chisquare.h"
41 #include "psppire-dialog-action-compute.h"
42 #include "psppire-dialog-action-comments.h"
43 #include "psppire-dialog-action-correlation.h"
44 #include "psppire-dialog-action-count.h"
45 #include "psppire-dialog-action-crosstabs.h"
46 #include "psppire-dialog-action-descriptives.h"
47 #include "psppire-dialog-action-examine.h"
48 #include "psppire-dialog-action-flip.h"
49 #include "psppire-dialog-action-factor.h"
50 #include "psppire-dialog-action-frequencies.h"
51 #include "psppire-dialog-action-histogram.h"
52 #include "psppire-dialog-action-indep-samps.h"
53 #include "psppire-dialog-action-k-related.h"
54 #include "psppire-dialog-action-k-independent.h"
55 #include "psppire-dialog-action-1sks.h"
56 #include "psppire-dialog-action-kmeans.h"
57 #include "psppire-dialog-action-logistic.h"
58 #include "psppire-dialog-action-means.h"
59 #include "psppire-dialog-action-paired.h"
60 #include "psppire-dialog-action-oneway.h"
61 #include "psppire-means-layer.h"
62 #include "psppire-dialog-action-rank.h"
63 #include "psppire-dialog-action-recode-same.h"
64 #include "psppire-dialog-action-recode-different.h"
65 #include "psppire-dialog-action-regression.h"
66 #include "psppire-dialog-action-reliability.h"
67 #include "psppire-dialog-action-roc.h"
68 #include "psppire-dialog-action-runs.h"
69 #include "psppire-dialog-action-scatterplot.h"
70 #include "psppire-dialog-action-select.h"
71 #include "psppire-dialog-action-sort.h"
72 #include "psppire-dialog-action-split.h"
73 #include "psppire-dialog-action-tt1s.h"
74 #include "psppire-dialog-action-two-sample.h"
75 #include "psppire-dialog-action-univariate.h"
76 #include "psppire-dialog-action-var-info.h"
77 #include "psppire-dialog-action-weight.h"
78 #include "psppire-value-entry.h"
79
80 static  volatile GType kludge;
81
82
83 typedef GType (*get_type_func)(void);
84
85 static const get_type_func dialog_action_types[]=
86 {
87   psppire_dialog_action_1sks_get_type,
88   psppire_dialog_action_autorecode_get_type,
89   psppire_dialog_action_aggregate_get_type,
90   psppire_dialog_action_binomial_get_type,
91   psppire_dialog_action_barchart_get_type,
92   psppire_dialog_action_chisquare_get_type,
93   psppire_dialog_action_compute_get_type,
94   psppire_dialog_action_comments_get_type,
95   psppire_dialog_action_correlation_get_type,
96   psppire_dialog_action_count_get_type,
97   psppire_dialog_action_crosstabs_get_type,
98   psppire_dialog_action_descriptives_get_type,
99   psppire_dialog_action_examine_get_type,
100   psppire_dialog_action_factor_get_type,
101   psppire_dialog_action_flip_get_type,
102   psppire_dialog_action_frequencies_get_type,
103   psppire_dialog_action_histogram_get_type,
104   psppire_dialog_action_logistic_get_type,
105   psppire_dialog_action_kmeans_get_type,
106   psppire_dialog_action_k_independent_get_type,
107   psppire_dialog_action_k_related_get_type,
108   psppire_dialog_action_means_get_type,
109   psppire_dialog_action_oneway_get_type,
110   psppire_dialog_action_paired_get_type,
111   psppire_dialog_action_indep_samps_get_type,
112   psppire_dialog_action_var_info_get_type,
113   psppire_dialog_action_rank_get_type,
114   psppire_dialog_action_recode_same_get_type,
115   psppire_dialog_action_recode_different_get_type,
116   psppire_dialog_action_reliability_get_type,
117   psppire_dialog_action_regression_get_type,
118   psppire_dialog_action_roc_get_type,
119   psppire_dialog_action_runs_get_type,
120   psppire_dialog_action_scatterplot_get_type,
121   psppire_dialog_action_select_get_type,
122   psppire_dialog_action_sort_get_type,
123   psppire_dialog_action_split_get_type,
124   psppire_dialog_action_tt1s_get_type,
125   psppire_dialog_action_two_sample_get_type,
126   psppire_dialog_action_weight_get_type,
127   psppire_dialog_action_univariate_get_type
128 };
129
130
131 static void
132 preregister_actions (void)
133 {
134   int i;
135   for (i = 0; i < sizeof (dialog_action_types) / sizeof (dialog_action_types[0]); ++i)
136     {
137       get_type_func x = dialog_action_types[i];
138       x ();
139     }
140 }
141
142
143
144 /* Any custom widgets which are to be used in GtkBuilder ui files
145    need to be preregistered, otherwise GtkBuilder refuses to
146    acknowledge their existence. */
147 void
148 preregister_widgets (void)
149 {
150   psppire_val_chooser_get_type ();
151   psppire_dialog_get_type ();
152   psppire_selector_get_type ();
153   psppire_buttonbox_get_type ();
154   psppire_keypad_get_type ();
155   psppire_acr_get_type ();
156   psppire_dict_view_get_type ();
157   psppire_var_view_get_type ();
158   psppire_value_entry_get_type ();
159   psppire_checkbox_treeview_get_type ();
160   psppire_means_layer_get_type ();
161
162   preregister_actions ();
163
164   /* This seems to be necessary on Cygwin.
165      It ought not to be necessary.  Having it here can't do any harm. */
166   kludge = gtk_source_view_get_type ();
167 }