X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fwidgets.c;h=7b308c0e3f6b7ac348c0a49865dbdff11100223b;hb=e50dabd2879fa0134bd726412c4229bdaf441c1a;hp=b6948d9414a46647ebf2a1cb394188e30a0b90d1;hpb=dc6d0e08956c6ad42cc943b7496a192c71bdbe02;p=pspp diff --git a/src/ui/gui/widgets.c b/src/ui/gui/widgets.c index b6948d9414..7b308c0e3f 100644 --- a/src/ui/gui/widgets.c +++ b/src/ui/gui/widgets.c @@ -1,9 +1,28 @@ +/* +PSPP - a program for statistical analysis. +Copyright (C) 2017 Free Software Foundation, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + #include -#include +#include #include "widgets.h" +#include "gettext.h" #include "psppire-dialog.h" #include "psppire-selector.h" @@ -33,6 +52,7 @@ #include "psppire-dialog-action-histogram.h" #include "psppire-dialog-action-indep-samps.h" #include "psppire-dialog-action-k-related.h" +#include "psppire-dialog-action-k-independent.h" #include "psppire-dialog-action-1sks.h" #include "psppire-dialog-action-kmeans.h" #include "psppire-dialog-action-logistic.h" @@ -57,6 +77,11 @@ #include "psppire-dialog-action-var-info.h" #include "psppire-dialog-action-weight.h" #include "psppire-value-entry.h" +#include "psppire-data-sheet.h" +#include "psppire-var-sheet-header.h" +#include "psppire-variable-sheet.h" +#include + static volatile GType kludge; @@ -84,6 +109,7 @@ static const get_type_func dialog_action_types[]= psppire_dialog_action_histogram_get_type, psppire_dialog_action_logistic_get_type, psppire_dialog_action_kmeans_get_type, + psppire_dialog_action_k_independent_get_type, psppire_dialog_action_k_related_get_type, psppire_dialog_action_means_get_type, psppire_dialog_action_oneway_get_type, @@ -120,9 +146,65 @@ preregister_actions (void) } +static void +tx_string_to_double (const GValue *src, GValue *dest) +{ + const gchar *str = g_value_get_string (src); + gdouble dble = g_strtod (str, NULL); + g_value_set_double (dest, dble); +} + + +static void +tx_string_to_int (const GValue *src, GValue *dest) +{ + const gchar *str = g_value_get_string (src); + gint x = atoi (str); + g_value_set_int (dest, x); +} + +static void +enum_to_string (const GValue *src, GValue *dest) +{ + gint n = g_value_get_enum (src); + GType t = G_VALUE_TYPE (src); + GEnumClass *ec = g_type_class_ref (t); + GEnumValue *ev = g_enum_get_value (ec, n); + + g_value_set_string (dest, gettext (ev->value_nick)); +} + + + +extern GType align_enum_type; +extern GType measure_enum_type; +extern GType role_enum_type; + + +extern const GEnumValue align[]; +extern const GEnumValue measure[]; +extern const GEnumValue role[]; + + + +static void +preregister_misc (void) +{ + align_enum_type = g_enum_register_static ("PsppAlignment", align); + measure_enum_type = g_enum_register_static ("PsppMeasure", measure); + role_enum_type = g_enum_register_static ("PsppRole", role); + + g_value_register_transform_func (G_TYPE_STRING, G_TYPE_DOUBLE, tx_string_to_double); + g_value_register_transform_func (G_TYPE_STRING, G_TYPE_INT, tx_string_to_int); + + g_value_register_transform_func (measure_enum_type, G_TYPE_STRING, enum_to_string); + g_value_register_transform_func (align_enum_type, G_TYPE_STRING, enum_to_string); + g_value_register_transform_func (role_enum_type, G_TYPE_STRING, enum_to_string); +} + /* Any custom widgets which are to be used in GtkBuilder ui files - need to be preregistered, otherwise GtkBuilder refuses to + need to be preregistered, otherwise GtkBuilder refuses to acknowledge their existence. */ void preregister_widgets (void) @@ -130,7 +212,7 @@ preregister_widgets (void) psppire_val_chooser_get_type (); psppire_dialog_get_type (); psppire_selector_get_type (); - psppire_buttonbox_get_type (); + psppire_button_box_get_type (); psppire_keypad_get_type (); psppire_acr_get_type (); psppire_dict_view_get_type (); @@ -138,8 +220,13 @@ preregister_widgets (void) psppire_value_entry_get_type (); psppire_checkbox_treeview_get_type (); psppire_means_layer_get_type (); + ssw_sheet_get_type (); + psppire_data_sheet_get_type (); + psppire_var_sheet_header_get_type (); + psppire_variable_sheet_get_type (); preregister_actions (); + preregister_misc (); /* This seems to be necessary on Cygwin. It ought not to be necessary. Having it here can't do any harm. */