1 /* PSPPIRE - a graphical user interface for PSPP.
2 Copyright (C) 2011, 2012 Free Software Foundation
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #include "t-test-options.h"
22 #include "t-test-paired-samples.h"
24 #include "psppire-data-window.h"
25 #include "psppire-selector.h"
26 #include "psppire-var-view.h"
28 #include "psppire-dict.h"
30 #include "dialog-common.h"
31 #include "psppire-dialog.h"
37 #include "psppire-var-ptr.h"
39 #include "paired-dialog.h"
42 #define _(msgid) gettext (msgid)
43 #define N_(msgid) msgid
59 generate_syntax (const struct paired_samples_dialog *d, const struct tt_options_dialog *opt)
62 GString *str = g_string_new ("T-TEST \n\tPAIRS = ");
64 psppire_var_view_append_names (PSPPIRE_VAR_VIEW (d->pairs_treeview), 0, str);
66 g_string_append (str, " WITH ");
68 psppire_var_view_append_names (PSPPIRE_VAR_VIEW (d->pairs_treeview), 1, str);
70 g_string_append (str, " (PAIRED)");
71 g_string_append (str, "\n");
73 tt_options_dialog_append_syntax (opt, str);
75 g_string_append (str, ".\n");
78 g_string_free (str, FALSE);
83 /* Pops up the dialog box */
85 t_test_paired_samples_dialog (PsppireDataWindow *de)
88 struct paired_samples_dialog *tt_d = two_sample_dialog_create (de);
89 struct tt_options_dialog *opts = tt_options_dialog_create (GTK_WINDOW (de));
91 GtkWidget *bb = gtk_hbutton_box_new ();
92 GtkWidget *opt = gtk_button_new_with_mnemonic (_("O_ptions..."));
93 gtk_box_pack_start (GTK_BOX (bb), opt, TRUE, TRUE, 5);
95 gtk_widget_show_all (bb);
96 two_sample_dialog_add_widget (tt_d, bb);
98 g_signal_connect_swapped (opt, "clicked", G_CALLBACK (tt_options_dialog_run), opts);
100 tt_d->refresh = refresh;
104 gtk_window_set_title (GTK_WINDOW (tt_d->dialog), _("Paired Samples T Test"));
106 response = psppire_dialog_run (PSPPIRE_DIALOG (tt_d->dialog));
110 case GTK_RESPONSE_OK:
111 g_free (execute_syntax_string (de, generate_syntax (tt_d, opts)));
113 case PSPPIRE_RESPONSE_PASTE:
114 g_free (paste_syntax_to_window (generate_syntax (tt_d, opts)));
120 two_sample_dialog_destroy (tt_d);
121 tt_options_dialog_destroy (opts);