X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fwidgets.c;h=25aff745c4f9913dba123c3331b00b0986987890;hb=1039e94d4e7c62e1ff4006bdd77fa04b21314fad;hp=ec9be3351611353a66e7280150c960a5d8abdfdd;hpb=691a034d7f2139076fa012739dffd40ef5db4a9b;p=pspp diff --git a/src/ui/gui/widgets.c b/src/ui/gui/widgets.c index ec9be33516..25aff745c4 100644 --- a/src/ui/gui/widgets.c +++ b/src/ui/gui/widgets.c @@ -1,4 +1,4 @@ -/* +/* PSPP - a program for statistical analysis. Copyright (C) 2017 Free Software Foundation, Inc. @@ -22,6 +22,7 @@ along with this program. If not, see . #include "widgets.h" +#include "gettext.h" #include "psppire-dialog.h" #include "psppire-selector.h" @@ -76,6 +77,12 @@ along with this program. If not, see . #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-var-info.h" +#include "psppire-variable-sheet.h" +#include + static volatile GType kludge; @@ -140,6 +147,62 @@ 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 @@ -150,7 +213,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 (); @@ -158,8 +221,14 @@ 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 (); + psppire_var_info_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. */