X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fcrosstabs-dialog.c;h=fa3930dc7248b3e6522f4a9d4ee2c9ef6b6fefc4;hb=698f289d1ecf1620aa5429599f2e76db23cff452;hp=2b93a77b657afdfd2cdbb78657669c56ae11bb7b;hpb=93b5d67c0fdc08137f308f332fede32543e7bc8e;p=pspp diff --git a/src/ui/gui/crosstabs-dialog.c b/src/ui/gui/crosstabs-dialog.c index 2b93a77b65..fa3930dc72 100644 --- a/src/ui/gui/crosstabs-dialog.c +++ b/src/ui/gui/crosstabs-dialog.c @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2008 Free Software Foundation + Copyright (C) 2008, 2010, 2011, 2012 Free Software Foundation 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 @@ -23,14 +23,14 @@ #include #include -#include #include #include #include #include "executor.h" #include #include -#include +#include +#include "helper.h" #include "gettext.h" #define _(msgid) gettext (msgid) @@ -109,12 +109,6 @@ static const struct checkbox_entry_item cells[] = #undef CS }; -enum - { - LABEL, - NO_LABEL, - NO_VAL_LABEL, - }; struct format_options { gboolean avalue; @@ -141,9 +135,6 @@ struct crosstabs_dialog GtkWidget *stat_view; GtkWidget *cell_view; - GtkToggleButton *label; - GtkToggleButton *no_label; - GtkToggleButton *no_val_label; struct format_options current_opts; }; @@ -160,9 +151,6 @@ static void on_format_clicked (struct crosstabs_dialog *cd) { int ret; - gboolean lab; - gboolean no_lab; - gboolean no_val_lab; if (cd->current_opts.avalue) { @@ -176,14 +164,6 @@ on_format_clicked (struct crosstabs_dialog *cd) { gtk_toggle_button_set_active (cd->pivot_button, TRUE); } - lab = gtk_toggle_button_get_active (cd->label); - no_lab = gtk_toggle_button_get_active (cd->no_label); - no_val_lab = gtk_toggle_button_get_active (cd->no_val_label); - if (!lab) - if (!no_lab) - if (!no_val_lab) - gtk_toggle_button_set_active (cd->label, TRUE); - ret = psppire_dialog_run (PSPPIRE_DIALOG (cd->format_dialog)); @@ -196,12 +176,6 @@ on_format_clicked (struct crosstabs_dialog *cd) cd->current_opts.pivot = (gtk_toggle_button_get_active (cd->pivot_button) == TRUE) ? TRUE : FALSE; } - else - { - gtk_toggle_button_set_active (cd->label, lab); - gtk_toggle_button_set_active (cd->no_label, no_lab); - gtk_toggle_button_set_active (cd->no_val_label, no_val_lab); - } } static void @@ -275,19 +249,6 @@ generate_syntax (const struct crosstabs_dialog *cd) g_string_append (string, "DVALUE"); } g_string_append (string, " "); - if (gtk_toggle_button_get_active (cd->label)) - { - g_string_append (string, "LABELS"); - } - else if (gtk_toggle_button_get_active (cd->no_label)) - { - g_string_append (string, "NOLABELS"); - } - else if (gtk_toggle_button_get_active (cd->no_val_label)) - { - g_string_append (string, "NOVALLABS"); - } - g_string_append (string, " "); if (cd->current_opts.table) g_string_append (string, "TABLES"); else @@ -383,7 +344,7 @@ dialog_state_valid (gpointer data) /* Pops up the Crosstabs dialog box */ void -crosstabs_dialog (GObject *o, gpointer data) +crosstabs_dialog (PsppireDataWindow *de) { gint response; struct crosstabs_dialog cd; @@ -392,8 +353,6 @@ crosstabs_dialog (GObject *o, gpointer data) PsppireVarStore *vs = NULL; PsppireDict *dict = NULL; - PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data); - GtkWidget *dialog = get_widget_assert (xml, "crosstabs-dialog"); GtkWidget *source = get_widget_assert (xml, "dict-treeview"); @@ -431,9 +390,6 @@ crosstabs_dialog (GObject *o, gpointer data) cd.format_dialog = get_widget_assert (xml, "format-dialog"); cd.table_button = GTK_TOGGLE_BUTTON (get_widget_assert (xml, "print-tables")); cd.pivot_button = GTK_TOGGLE_BUTTON (get_widget_assert (xml, "pivot")); - cd.label = GTK_TOGGLE_BUTTON (get_widget_assert (xml, "radiobutton1")); - cd.no_label = GTK_TOGGLE_BUTTON (get_widget_assert (xml, "radiobutton2")); - cd.no_val_label = GTK_TOGGLE_BUTTON (get_widget_assert (xml, "radiobutton3")); cd.stat_dialog = get_widget_assert (xml, "stat-dialog"); cd.cell_dialog = get_widget_assert (xml, "cell-dialog"); @@ -466,23 +422,10 @@ crosstabs_dialog (GObject *o, gpointer data) switch (response) { case GTK_RESPONSE_OK: - { - gchar *syntax = generate_syntax (&cd); - - struct getl_interface *sss = create_syntax_string_source (syntax); - execute_syntax (sss); - - g_free (syntax); - } + g_free (execute_syntax_string (de, generate_syntax (&cd))); break; case PSPPIRE_RESPONSE_PASTE: - { - gchar *syntax = generate_syntax (&cd); - - paste_syntax_in_new_window (syntax); - - g_free (syntax); - } + g_free (paste_syntax_to_window (generate_syntax (&cd))); break; default: break;