src/ui/gui/missing-val-dialog.h \
src/ui/gui/oneway-anova-dialog.c \
src/ui/gui/oneway-anova-dialog.h \
- src/ui/gui/paired-dialog.c \
- src/ui/gui/paired-dialog.h \
src/ui/gui/psppire.c \
src/ui/gui/psppire.h \
src/ui/gui/psppire-acr.h \
src/ui/gui/psppire-dialog-action-k-related.h \
src/ui/gui/psppire-dialog-action-means.c \
src/ui/gui/psppire-dialog-action-means.h \
+ src/ui/gui/psppire-dialog-action-paired.c \
+ src/ui/gui/psppire-dialog-action-paired.h \
src/ui/gui/psppire-dialog-action-rank.c \
src/ui/gui/psppire-dialog-action-rank.h \
src/ui/gui/psppire-dialog-action-regression.c \
src/ui/gui/psppire-dialog-action-sort.h \
src/ui/gui/psppire-dialog-action-tt1s.c \
src/ui/gui/psppire-dialog-action-tt1s.h \
+ src/ui/gui/psppire-dialog-action-two-sample.c \
+ src/ui/gui/psppire-dialog-action-two-sample.h \
src/ui/gui/psppire-dialog-action-univariate.c \
src/ui/gui/psppire-dialog-action-univariate.h \
src/ui/gui/psppire-dialog-action-var-info.c \
src/ui/gui/text-data-import-dialog.h \
src/ui/gui/t-test-options.c \
src/ui/gui/t-test-options.h \
- src/ui/gui/t-test-paired-samples.c \
- src/ui/gui/t-test-paired-samples.h \
- src/ui/gui/npar-two-sample-related.c \
- src/ui/gui/npar-two-sample-related.h \
src/ui/gui/val-labs-dialog.c \
src/ui/gui/val-labs-dialog.h \
src/ui/gui/var-display.c \
</object>
</child>
<child>
- <object class="GtkAction" id="paired-t-test">
+ <object class="PsppireDialogActionPaired" id="paired-t-test">
<property name="name">paired-t-test</property>
+ <property name="manager">uimanager1</property>
<property name="label" translatable="yes">_Paired Samples T Test...</property>
</object>
</child>
</object>
</child>
<child>
- <object class="GtkAction" id="two-related-samples">
+ <object class="PsppireDialogActionTwoSample" id="two-related-samples">
<property name="name">"two-related-samples"></property>
+ <property name="manager">uimanager1</property>
<property name="label" translatable="yes">2 _Related Samples...</property>
</object>
</child>
+++ /dev/null
-/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 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
- 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 <http://www.gnu.org/licenses/>.
-*/
-
-#include <config.h>
-#include <gtk/gtk.h>
-
-#include "psppire-data-window.h"
-#include "psppire-selector.h"
-#include "psppire-var-view.h"
-
-#include "psppire-dict.h"
-
-#include "dialog-common.h"
-#include "psppire-dialog.h"
-
-#include "executor.h"
-
-#include "helper.h"
-
-#include "psppire-var-ptr.h"
-
-#include "paired-dialog.h"
-#include "npar-two-sample-related.h"
-
-#include <gettext.h>
-#define _(msgid) gettext (msgid)
-#define N_(msgid) msgid
-
-enum test
- {
- NT_WILCOXON,
- NT_SIGN,
- NT_MCNEMAR,
- n_Tests
- };
-
-struct ts_test
-{
- GtkWidget *button;
- char syntax[16];
-};
-
-
-static void
-refresh (void *aux)
-{
- int i;
- struct ts_test *tst = aux;
-
- for (i = 0 ; i < n_Tests; ++i)
- {
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (tst[i].button), FALSE);
- }
-}
-
-
-static gboolean
-valid (void *aux)
-{
- int i;
- struct ts_test *tst = aux;
-
- for (i = 0 ; i < n_Tests; ++i)
- {
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (tst[i].button)))
- return TRUE;
- }
-
- return FALSE;
-}
-
-
-
-static gchar *
-generate_syntax (struct paired_samples_dialog *psd, const struct ts_test *test)
-{
- int i;
- gchar *text = NULL;
- GString *str = g_string_new ("NPAR TEST");
-
- for (i = 0 ; i < n_Tests; ++i)
- {
- if (! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (test[i].button)))
- continue;
-
- g_string_append (str, "\n\t");
- g_string_append (str, test[i].syntax);
-
- psppire_var_view_append_names (PSPPIRE_VAR_VIEW (psd->pairs_treeview), 0, str);
-
- g_string_append (str, " WITH ");
-
- psppire_var_view_append_names (PSPPIRE_VAR_VIEW (psd->pairs_treeview), 1, str);
-
- g_string_append (str, " (PAIRED)");
- }
-
- g_string_append (str, ".\n");
-
- text = str->str;
- g_string_free (str, FALSE);
-
- return text;
-}
-
-/* Pops up the dialog box */
-void
-two_related_dialog (PsppireDataWindow *de)
-{
- gint response;
- struct ts_test nts[n_Tests];
- struct paired_samples_dialog *tt_d = two_sample_dialog_create (de);
-
- GtkWidget *frame = gtk_frame_new (_("Test Type"));
- GtkWidget *bb = gtk_vbutton_box_new ();
-
- strcpy (nts[NT_WILCOXON].syntax, "/WILCOXON");
- strcpy (nts[NT_SIGN].syntax, "/SIGN");
- strcpy (nts[NT_MCNEMAR].syntax, "/MCNEMAR");
-
- nts[NT_WILCOXON].button = gtk_check_button_new_with_mnemonic (_("_Wilcoxon"));
- nts[NT_SIGN].button = gtk_check_button_new_with_mnemonic (_("_Sign"));
- nts[NT_MCNEMAR].button = gtk_check_button_new_with_mnemonic (_("_McNemar"));
-
- gtk_box_pack_start (GTK_BOX (bb), nts[NT_WILCOXON].button, FALSE, FALSE, 5);
- gtk_box_pack_start (GTK_BOX (bb), nts[NT_SIGN].button, FALSE, FALSE, 5);
- gtk_box_pack_start (GTK_BOX (bb), nts[NT_MCNEMAR].button, FALSE, FALSE, 5);
-
- gtk_container_add (GTK_CONTAINER (frame), bb);
-
- gtk_widget_show_all (frame);
- two_sample_dialog_add_widget (tt_d, frame);
-
- tt_d->refresh = refresh;
- tt_d->valid = valid;
- tt_d->aux = nts;
-
- gtk_window_set_title (GTK_WINDOW (tt_d->dialog), _("Two-Related-Samples Tests"));
-
- response = psppire_dialog_run (PSPPIRE_DIALOG (tt_d->dialog));
-
- switch (response)
- {
- case GTK_RESPONSE_OK:
- g_free (execute_syntax_string (de, generate_syntax (tt_d, nts)));
- break;
- case PSPPIRE_RESPONSE_PASTE:
- g_free (paste_syntax_to_window (generate_syntax (tt_d, nts)));
- break;
- default:
- break;
- }
-
- two_sample_dialog_destroy (tt_d);
-}
+++ /dev/null
-/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 2011 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
- 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 <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef NPAR_PAIRED_H
-#define NPAR_PAIRED_H 1
-
-#include "psppire-data-window.h"
-
-/* Pops up the dialog box */
-void two_related_dialog (PsppireDataWindow *de);
-
-#endif
+++ /dev/null
-/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 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
- 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 <http://www.gnu.org/licenses/>.
-*/
-
-#include <config.h>
-
-#include <gtk/gtk.h>
-
-
-#include "paired-dialog.h"
-
-#include "psppire-data-window.h"
-#include "psppire-selector.h"
-#include "psppire-var-view.h"
-
-#include "psppire-dict.h"
-
-#include "dialog-common.h"
-#include "psppire-dialog.h"
-
-#include "psppire-var-ptr.h"
-
-
-#include "builder-wrapper.h"
-
-
-
-static void
-refresh (struct paired_samples_dialog *tt_d)
-{
- gtk_list_store_clear (GTK_LIST_STORE (tt_d->list_store));
-
- if (tt_d->refresh)
- tt_d->refresh (tt_d->aux);
-}
-
-static gboolean
-dialog_state_valid (gpointer data)
-{
- struct variable *v = NULL;
- struct paired_samples_dialog *tt_d = data;
- GtkTreeIter dest_iter;
-
- gint n_rows = gtk_tree_model_iter_n_children (tt_d->list_store, NULL);
-
- if ( n_rows == 0 )
- return FALSE;
-
- /* Get the last row */
- gtk_tree_model_iter_nth_child (tt_d->list_store, &dest_iter,
- NULL, n_rows - 1);
-
- /* Get the last (2nd) column */
- gtk_tree_model_get (tt_d->list_store, &dest_iter, 1, &v, -1);
-
-
- if (v == NULL)
- return FALSE;
-
- if ( NULL == tt_d->valid)
- return TRUE;
-
- return tt_d->valid (tt_d->aux);
-}
-
-
-
-static void
-select_as_pair_member (GtkTreeIter source_iter,
- GtkWidget *dest,
- GtkTreeModel *source_model,
- gpointer data)
-{
- struct variable *v;
- struct variable *v1;
- gint n_rows;
- GtkTreeIter dest_iter;
- struct paired_samples_dialog *tt_d = data;
-
-
- gtk_tree_model_get (source_model, &source_iter,
- DICT_TVM_COL_VAR, &v, -1);
-
- n_rows = gtk_tree_model_iter_n_children (tt_d->list_store, NULL);
-
- if ( n_rows > 0 )
- {
-
- gtk_tree_model_iter_nth_child (tt_d->list_store,
- &dest_iter, NULL, n_rows - 1);
-
- gtk_tree_model_get (tt_d->list_store, &dest_iter, 1, &v1, -1);
- }
- else
- v1 = NULL;
-
- if ( n_rows == 0 || v1 != NULL)
- {
- gtk_list_store_append (GTK_LIST_STORE (tt_d->list_store), &dest_iter);
-
- gtk_list_store_set (GTK_LIST_STORE (tt_d->list_store), &dest_iter,
- 0, v,
- 1, NULL,
- -1);
- }
- else
- {
- gtk_list_store_set (GTK_LIST_STORE (tt_d->list_store), &dest_iter,
- 1, v,
- -1);
-
- }
-}
-
-void
-two_sample_dialog_add_widget (struct paired_samples_dialog *psd, GtkWidget *w)
-{
- GtkWidget *box = get_widget_assert (psd->xml, "vbox3");
- gtk_box_pack_start (GTK_BOX (box), w, FALSE, FALSE, 5);
-}
-
-void
-two_sample_dialog_destroy (struct paired_samples_dialog *psd)
-{
- g_object_unref (psd->xml);
- free (psd);
-}
-
-struct paired_samples_dialog *
-two_sample_dialog_create (PsppireDataWindow *de)
-{
- GtkWidget *dict_view ;
- GtkWidget *selector ;
- struct paired_samples_dialog *tt_d = g_malloc (sizeof *tt_d);
-
- tt_d->xml = builder_new ("paired-samples.ui");
-
- dict_view = get_widget_assert (tt_d->xml, "paired-samples-t-test-treeview1");
-
- selector = get_widget_assert (tt_d->xml, "psppire-selector3");
-
- tt_d->dialog = get_widget_assert (tt_d->xml, "t-test-paired-samples-dialog");
-
- g_object_get (de->data_editor, "dictionary", &tt_d->dict, NULL);
- tt_d->pairs_treeview =
- get_widget_assert (tt_d->xml, "paired-samples-t-test-treeview2");
-
- gtk_window_set_transient_for (GTK_WINDOW (tt_d->dialog), GTK_WINDOW (de));
-
-
- g_object_set (dict_view, "model", tt_d->dict,
- "predicate",
- var_is_numeric, NULL);
-
-
- tt_d->list_store = gtk_tree_view_get_model (GTK_TREE_VIEW (tt_d->pairs_treeview));
-
- psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector),
- select_as_pair_member,
- tt_d);
-
- g_signal_connect_swapped (tt_d->dialog, "refresh",
- G_CALLBACK (refresh), tt_d);
-
- psppire_dialog_set_valid_predicate (PSPPIRE_DIALOG (tt_d->dialog),
- dialog_state_valid, tt_d);
-
- return tt_d;
-}
+++ /dev/null
-#ifndef PAIRED_DIALOG_H
-#define PAIRED_DIALOG_H 1
-
-#include "psppire-data-window.h"
-#include "psppire-dict.h"
-
-#include <gtk/gtk.h>
-
-typedef void refresh_f (void *aux);
-typedef gboolean valid_f (void *aux);
-
-struct paired_samples_dialog
-{
- PsppireDict *dict;
- GtkWidget *pairs_treeview;
- GtkTreeModel *list_store;
- GtkWidget *dialog;
- GtkBuilder *xml;
-
- refresh_f *refresh;
- valid_f *valid;
- void *aux;
-};
-
-
-struct paired_samples_dialog *two_sample_dialog_create (PsppireDataWindow *de);
-void two_sample_dialog_destroy (struct paired_samples_dialog *psd);
-void two_sample_dialog_add_widget (struct paired_samples_dialog *psd, GtkWidget *w);
-
-
-#endif
#include "ui/gui/help-menu.h"
#include "ui/gui/helper.h"
#include "ui/gui/helper.h"
-#include "ui/gui/npar-two-sample-related.h"
#include "ui/gui/oneway-anova-dialog.h"
#include "ui/gui/psppire-data-window.h"
#include "ui/gui/psppire-dialog-action.h"
#include "ui/gui/recode-dialog.h"
#include "ui/gui/select-cases-dialog.h"
#include "ui/gui/split-file-dialog.h"
-#include "ui/gui/t-test-paired-samples.h"
#include "ui/gui/text-data-import-dialog.h"
#include "ui/gui/weight-cases-dialog.h"
#include "ui/syntax-gen.h"
connect_action (de, "data_split-file", G_CALLBACK (split_file_dialog));
connect_action (de, "data_weight-cases", G_CALLBACK (weight_cases_dialog));
connect_action (de, "oneway-anova", G_CALLBACK (oneway_anova_dialog));
- connect_action (de, "paired-t-test", G_CALLBACK (t_test_paired_samples_dialog));
connect_action (de, "utilities_comments", G_CALLBACK (comments_dialog));
connect_action (de, "transform_recode-same", G_CALLBACK (recode_same_dialog));
connect_action (de, "transform_recode-different", G_CALLBACK (recode_different_dialog));
- connect_action (de, "two-related-samples", G_CALLBACK (two_related_dialog));
{
GtkWidget *recent_data =
--- /dev/null
+/* PSPPIRE - a graphical user interface for PSPP.
+ Copyright (C) 2012, 2013 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
+ 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 <http://www.gnu.org/licenses/>. */
+
+
+#include <config.h>
+
+#include "psppire-dialog-action-paired.h"
+
+#include "psppire-var-view.h"
+
+#include "psppire-selector.h"
+#include "psppire-dialog.h"
+#include "builder-wrapper.h"
+
+#include "t-test-options.h"
+
+#include <gettext.h>
+#define _(msgid) gettext (msgid)
+#define N_(msgid) msgid
+
+
+static void psppire_dialog_action_paired_init (PsppireDialogActionPaired *act);
+static void psppire_dialog_action_paired_class_init (PsppireDialogActionPairedClass *class);
+
+G_DEFINE_TYPE (PsppireDialogActionPaired, psppire_dialog_action_paired, PSPPIRE_TYPE_DIALOG_ACTION);
+
+
+static gboolean
+dialog_state_valid (gpointer data)
+{
+ PsppireDialogActionPaired *pd = PSPPIRE_DIALOG_ACTION_PAIRED (data);
+ gint n_rows = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (pd->list_store), NULL);
+ struct variable *v = NULL;
+ GtkTreeIter dest_iter;
+
+ if ( n_rows == 0 )
+ return FALSE;
+
+ /* Get the last row */
+ gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (pd->list_store), &dest_iter,
+ NULL, n_rows - 1);
+
+ /* Get the last (2nd) column */
+ gtk_tree_model_get (GTK_TREE_MODEL (pd->list_store), &dest_iter, 1, &v, -1);
+
+ if (v == NULL)
+ return FALSE;
+
+ /* if ( NULL == pd->valid) */
+ /* return TRUE; */
+
+ return TRUE;
+ // return pd->valid (pd->aux);
+}
+
+static void
+refresh (PsppireDialogAction *rd_)
+{
+ PsppireDialogActionPaired *pd = PSPPIRE_DIALOG_ACTION_PAIRED (rd_);
+
+ gtk_list_store_clear (GTK_LIST_STORE (pd->list_store));
+}
+
+
+static void
+select_as_pair_member (GtkTreeIter source_iter,
+ GtkWidget *dest,
+ GtkTreeModel *source_model,
+ gpointer data)
+{
+ struct variable *v;
+ struct variable *v1;
+ gint n_rows;
+ GtkTreeIter dest_iter;
+ PsppireDialogActionPaired *tt_d = PSPPIRE_DIALOG_ACTION_PAIRED (data);
+
+
+ gtk_tree_model_get (source_model, &source_iter,
+ DICT_TVM_COL_VAR, &v, -1);
+
+ n_rows = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (tt_d->list_store), NULL);
+
+ if ( n_rows > 0 )
+ {
+
+ gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (tt_d->list_store),
+ &dest_iter, NULL, n_rows - 1);
+
+ gtk_tree_model_get (GTK_TREE_MODEL (tt_d->list_store), &dest_iter, 1, &v1, -1);
+ }
+ else
+ v1 = NULL;
+
+ if ( n_rows == 0 || v1 != NULL)
+ {
+ gtk_list_store_append (tt_d->list_store, &dest_iter);
+
+ gtk_list_store_set (tt_d->list_store, &dest_iter,
+ 0, v,
+ 1, NULL,
+ -1);
+ }
+ else
+ {
+ gtk_list_store_set (tt_d->list_store, &dest_iter,
+ 1, v,
+ -1);
+ }
+}
+
+
+
+static gchar *
+generate_syntax (PsppireDialogAction *pda)
+{
+ PsppireDialogActionPaired *d = PSPPIRE_DIALOG_ACTION_PAIRED (pda);
+ gchar *text = NULL;
+ GString *str = g_string_new ("T-TEST \n\tPAIRS = ");
+
+ psppire_var_view_append_names (PSPPIRE_VAR_VIEW (d->pairs_treeview), 0, str);
+
+ g_string_append (str, " WITH ");
+
+ psppire_var_view_append_names (PSPPIRE_VAR_VIEW (d->pairs_treeview), 1, str);
+
+ g_string_append (str, " (PAIRED)");
+ g_string_append (str, "\n");
+
+ tt_options_dialog_append_syntax (d->opt, str);
+
+ g_string_append (str, ".\n");
+
+ text = str->str;
+ g_string_free (str, FALSE);
+
+ return text;
+}
+
+static void
+psppire_dialog_action_paired_activate (GtkAction *a)
+{
+ PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
+ PsppireDialogActionPaired *act = PSPPIRE_DIALOG_ACTION_PAIRED (a);
+
+ GtkBuilder *xml = builder_new ("paired-samples.ui");
+ GtkWidget *selector = get_widget_assert (xml, "psppire-selector3");
+ GtkWidget *bb = gtk_hbutton_box_new ();
+ GtkWidget *button = gtk_button_new_with_mnemonic (_("O_ptions..."));
+ GtkWidget *box = get_widget_assert (xml, "vbox3");
+
+
+ pda->dialog = get_widget_assert (xml, "t-test-paired-samples-dialog");
+ pda->source = get_widget_assert (xml, "paired-samples-t-test-treeview1");
+
+ gtk_window_set_title (GTK_WINDOW (pda->dialog), _("Paired Samples T Test"));
+
+ act->pairs_treeview = get_widget_assert (xml, "paired-samples-t-test-treeview2");
+ act->list_store = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (act->pairs_treeview)));
+
+ act->opt = tt_options_dialog_create (GTK_WINDOW (pda->toplevel));
+
+
+ g_signal_connect_swapped (button, "clicked", G_CALLBACK (tt_options_dialog_run), act->opt);
+
+
+ gtk_box_pack_start (GTK_BOX (bb), button, TRUE, TRUE, 5);
+ gtk_box_pack_start (GTK_BOX (box), bb, FALSE, FALSE, 5);
+ gtk_widget_show_all (box);
+
+
+ psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid);
+ psppire_dialog_action_set_refresh (pda, refresh);
+
+ g_object_set (pda->source,
+ "predicate", var_is_numeric,
+ NULL);
+
+ psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector),
+ select_as_pair_member,
+ act);
+
+ g_object_unref (xml);
+
+ if (PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_paired_parent_class)->activate)
+ PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_paired_parent_class)->activate (pda);
+}
+
+static void
+psppire_dialog_action_paired_finalize (GObject *o)
+{
+ PsppireDialogActionPaired *act = PSPPIRE_DIALOG_ACTION_PAIRED (o);
+ tt_options_dialog_destroy (act->opt);
+}
+
+static void
+psppire_dialog_action_paired_class_init (PsppireDialogActionPairedClass *class)
+{
+ GtkActionClass *action_class = GTK_ACTION_CLASS (class);
+ GObjectClass *object_class = G_OBJECT_CLASS (class);
+
+ action_class->activate = psppire_dialog_action_paired_activate;
+ PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax;
+
+ object_class->finalize = psppire_dialog_action_paired_finalize;
+}
+
+
+static void
+psppire_dialog_action_paired_init (PsppireDialogActionPaired *act)
+{
+ act->opt = NULL;
+}
+
--- /dev/null
+/* PSPPIRE - a graphical user interface for PSPP.
+ Copyright (C) 2013 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
+ 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 <http://www.gnu.org/licenses/>. */
+
+
+#include <glib-object.h>
+#include <glib.h>
+
+#include "psppire-dialog-action.h"
+
+#ifndef __PSPPIRE_DIALOG_ACTION_PAIRED_H__
+#define __PSPPIRE_DIALOG_ACTION_PAIRED_H__
+
+G_BEGIN_DECLS
+
+
+#define PSPPIRE_TYPE_DIALOG_ACTION_PAIRED (psppire_dialog_action_paired_get_type ())
+
+#define PSPPIRE_DIALOG_ACTION_PAIRED(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ PSPPIRE_TYPE_DIALOG_ACTION_PAIRED, PsppireDialogActionPaired))
+
+#define PSPPIRE_DIALOG_ACTION_PAIRED_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ PSPPIRE_TYPE_DIALOG_ACTION_PAIRED, \
+ PsppireDialogActionPairedClass))
+
+
+#define PSPPIRE_IS_DIALOG_ACTION_PAIRED(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PSPPIRE_TYPE_DIALOG_ACTION_PAIRED))
+
+#define PSPPIRE_IS_DIALOG_ACTION_PAIRED_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), PSPPIRE_TYPE_DIALOG_ACTION_PAIRED))
+
+
+#define PSPPIRE_DIALOG_ACTION_PAIRED_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ PSPPIRE_TYPE_DIALOG_ACTION_PAIRED, \
+ PsppireDialogActionPairedClass))
+
+typedef struct _PsppireDialogActionPaired PsppireDialogActionPaired;
+typedef struct _PsppireDialogActionPairedClass PsppireDialogActionPairedClass;
+
+
+struct tt_options_dialog;
+
+struct _PsppireDialogActionPaired
+{
+ PsppireDialogAction parent;
+
+ /*< private >*/
+ gboolean dispose_has_run;
+
+ GtkWidget *pairs_treeview ;
+ GtkListStore *list_store ;
+ struct tt_options_dialog *opt;
+};
+
+
+
+
+struct _PsppireDialogActionPairedClass
+{
+ PsppireDialogActionClass parent_class;
+};
+
+
+GType psppire_dialog_action_paired_get_type (void) ;
+
+G_END_DECLS
+
+#endif /* __PSPPIRE_DIALOG_ACTION_PAIRED_H__ */
--- /dev/null
+/* PSPPIRE - a graphical user interface for PSPP.
+ Copyright (C) 2012, 2013 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
+ 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 <http://www.gnu.org/licenses/>. */
+
+
+#include <config.h>
+
+#include "psppire-dialog-action-two-sample.h"
+
+#include "psppire-var-view.h"
+
+#include "psppire-selector.h"
+#include "psppire-dialog.h"
+#include "builder-wrapper.h"
+
+#include <gettext.h>
+#define _(msgid) gettext (msgid)
+#define N_(msgid) msgid
+
+
+static void psppire_dialog_action_two_sample_init (PsppireDialogActionTwoSample *act);
+static void psppire_dialog_action_two_sample_class_init (PsppireDialogActionTwoSampleClass *class);
+
+G_DEFINE_TYPE (PsppireDialogActionTwoSample, psppire_dialog_action_two_sample, PSPPIRE_TYPE_DIALOG_ACTION);
+
+
+static gboolean
+dialog_state_valid (gpointer data)
+{
+ PsppireDialogActionTwoSample *pd = PSPPIRE_DIALOG_ACTION_TWO_SAMPLE (data);
+ gint n_rows = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (pd->list_store), NULL);
+ struct variable *v = NULL;
+ GtkTreeIter dest_iter;
+
+ if ( n_rows == 0 )
+ return FALSE;
+
+ /* Get the last row */
+ gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (pd->list_store), &dest_iter,
+ NULL, n_rows - 1);
+
+ /* Get the last (2nd) column */
+ gtk_tree_model_get (GTK_TREE_MODEL (pd->list_store), &dest_iter, 1, &v, -1);
+
+ if (v == NULL)
+ return FALSE;
+
+
+ /* Now check that at least one toggle button is selected */
+
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (pd->nts[NT_WILCOXON].button)))
+ return TRUE;
+
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (pd->nts[NT_SIGN].button)))
+ return TRUE;
+
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (pd->nts[NT_MCNEMAR].button)))
+ return TRUE;
+
+ return FALSE;
+}
+
+static void
+refresh (PsppireDialogAction *rd_)
+{
+ PsppireDialogActionTwoSample *pd = PSPPIRE_DIALOG_ACTION_TWO_SAMPLE (rd_);
+
+ gtk_list_store_clear (GTK_LIST_STORE (pd->list_store));
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pd->nts[NT_WILCOXON].button), FALSE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pd->nts[NT_SIGN].button), FALSE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pd->nts[NT_MCNEMAR].button), FALSE);
+}
+
+
+static void
+select_as_pair_member (GtkTreeIter source_iter,
+ GtkWidget *dest,
+ GtkTreeModel *source_model,
+ gpointer data)
+{
+ struct variable *v;
+ struct variable *v1;
+ gint n_rows;
+ GtkTreeIter dest_iter;
+ PsppireDialogActionTwoSample *tt_d = PSPPIRE_DIALOG_ACTION_TWO_SAMPLE (data);
+
+
+ gtk_tree_model_get (source_model, &source_iter,
+ DICT_TVM_COL_VAR, &v, -1);
+
+ n_rows = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (tt_d->list_store), NULL);
+
+ if ( n_rows > 0 )
+ {
+
+ gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (tt_d->list_store),
+ &dest_iter, NULL, n_rows - 1);
+
+ gtk_tree_model_get (GTK_TREE_MODEL (tt_d->list_store), &dest_iter, 1, &v1, -1);
+ }
+ else
+ v1 = NULL;
+
+ if ( n_rows == 0 || v1 != NULL)
+ {
+ gtk_list_store_append (tt_d->list_store, &dest_iter);
+
+ gtk_list_store_set (tt_d->list_store, &dest_iter,
+ 0, v,
+ 1, NULL,
+ -1);
+ }
+ else
+ {
+ gtk_list_store_set (tt_d->list_store, &dest_iter,
+ 1, v,
+ -1);
+ }
+}
+
+
+
+static gchar *
+generate_syntax (PsppireDialogAction *pda)
+{
+ gint i;
+
+ PsppireDialogActionTwoSample *d = PSPPIRE_DIALOG_ACTION_TWO_SAMPLE (pda);
+ gchar *text = NULL;
+
+ GString *str = g_string_new ("NPAR TEST");
+
+ for (i = 0 ; i < n_Tests; ++i)
+ {
+ if (! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (d->nts[i].button)))
+ continue;
+
+ g_string_append (str, "\n\t");
+ g_string_append (str, d->nts[i].syntax);
+
+ psppire_var_view_append_names (PSPPIRE_VAR_VIEW (d->pairs_treeview), 0, str);
+
+ g_string_append (str, " WITH ");
+
+ psppire_var_view_append_names (PSPPIRE_VAR_VIEW (d->pairs_treeview), 1, str);
+
+ g_string_append (str, " (PAIRED)");
+ }
+
+ g_string_append (str, ".\n");
+
+ text = str->str;
+ g_string_free (str, FALSE);
+
+ return text;
+}
+
+static void
+psppire_dialog_action_two_sample_activate (GtkAction *a)
+{
+ PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
+ PsppireDialogActionTwoSample *act = PSPPIRE_DIALOG_ACTION_TWO_SAMPLE (a);
+
+ GtkBuilder *xml = builder_new ("paired-samples.ui");
+ GtkWidget *selector = get_widget_assert (xml, "psppire-selector3");
+
+ pda->dialog = get_widget_assert (xml, "t-test-paired-samples-dialog");
+ pda->source = get_widget_assert (xml, "paired-samples-t-test-treeview1");
+
+ gtk_window_set_title (GTK_WINDOW (pda->dialog), _("Two-Related-Samples Tests"));
+
+ act->pairs_treeview = get_widget_assert (xml, "paired-samples-t-test-treeview2");
+ act->list_store = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (act->pairs_treeview)));
+
+ {
+ /* NPAR Specific options */
+ GtkWidget *frame = gtk_frame_new (_("Test Type"));
+ GtkWidget *bb = gtk_vbutton_box_new ();
+ GtkWidget *box = get_widget_assert (xml, "vbox3");
+
+
+ strcpy (act->nts[NT_WILCOXON].syntax, "/WILCOXON");
+ strcpy (act->nts[NT_SIGN].syntax, "/SIGN");
+ strcpy (act->nts[NT_MCNEMAR].syntax, "/MCNEMAR");
+
+ act->nts[NT_WILCOXON].button = gtk_check_button_new_with_mnemonic (_("_Wilcoxon"));
+ act->nts[NT_SIGN].button = gtk_check_button_new_with_mnemonic (_("_Sign"));
+ act->nts[NT_MCNEMAR].button = gtk_check_button_new_with_mnemonic (_("_McNemar"));
+
+ gtk_box_pack_start (GTK_BOX (bb), act->nts[NT_WILCOXON].button, FALSE, FALSE, 5);
+ gtk_box_pack_start (GTK_BOX (bb), act->nts[NT_SIGN].button, FALSE, FALSE, 5);
+ gtk_box_pack_start (GTK_BOX (bb), act->nts[NT_MCNEMAR].button, FALSE, FALSE, 5);
+
+ gtk_container_add (GTK_CONTAINER (frame), bb);
+
+ gtk_widget_show_all (frame);
+
+ gtk_box_pack_start (GTK_BOX (box), frame, FALSE, FALSE, 5);
+ }
+
+ psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid);
+ psppire_dialog_action_set_refresh (pda, refresh);
+
+ g_object_set (pda->source,
+ "predicate", var_is_numeric,
+ NULL);
+
+ psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector),
+ select_as_pair_member,
+ act);
+
+ g_object_unref (xml);
+
+ if (PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_two_sample_parent_class)->activate)
+ PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_two_sample_parent_class)->activate (pda);
+}
+
+static void
+psppire_dialog_action_two_sample_class_init (PsppireDialogActionTwoSampleClass *class)
+{
+ GtkActionClass *action_class = GTK_ACTION_CLASS (class);
+
+ action_class->activate = psppire_dialog_action_two_sample_activate;
+ PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax;
+}
+
+
+static void
+psppire_dialog_action_two_sample_init (PsppireDialogActionTwoSample *act)
+{
+}
+
--- /dev/null
+/* PSPPIRE - a graphical user interface for PSPP.
+ Copyright (C) 2013 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
+ 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 <http://www.gnu.org/licenses/>. */
+
+
+#include <glib-object.h>
+#include <glib.h>
+
+#include "psppire-dialog-action.h"
+
+#ifndef __PSPPIRE_DIALOG_ACTION_TWO_SAMPLE_H__
+#define __PSPPIRE_DIALOG_ACTION_TWO_SAMPLE_H__
+
+G_BEGIN_DECLS
+
+
+#define PSPPIRE_TYPE_DIALOG_ACTION_TWO_SAMPLE (psppire_dialog_action_two_sample_get_type ())
+
+#define PSPPIRE_DIALOG_ACTION_TWO_SAMPLE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ PSPPIRE_TYPE_DIALOG_ACTION_TWO_SAMPLE, PsppireDialogActionTwoSample))
+
+#define PSPPIRE_DIALOG_ACTION_TWO_SAMPLE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ PSPPIRE_TYPE_DIALOG_ACTION_TWO_SAMPLE, \
+ PsppireDialogActionTwoSampleClass))
+
+
+#define PSPPIRE_IS_DIALOG_ACTION_TWO_SAMPLE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PSPPIRE_TYPE_DIALOG_ACTION_TWO_SAMPLE))
+
+#define PSPPIRE_IS_DIALOG_ACTION_TWO_SAMPLE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), PSPPIRE_TYPE_DIALOG_ACTION_TWO_SAMPLE))
+
+
+#define PSPPIRE_DIALOG_ACTION_TWO_SAMPLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ PSPPIRE_TYPE_DIALOG_ACTION_TWO_SAMPLE, \
+ PsppireDialogActionTwoSampleClass))
+
+typedef struct _PsppireDialogActionTwoSample PsppireDialogActionTwoSample;
+typedef struct _PsppireDialogActionTwoSampleClass PsppireDialogActionTwoSampleClass;
+
+
+enum test
+ {
+ NT_WILCOXON,
+ NT_SIGN,
+ NT_MCNEMAR,
+ n_Tests
+ };
+
+struct ts_test
+{
+ GtkWidget *button;
+ char syntax[16];
+};
+
+struct _PsppireDialogActionTwoSample
+{
+ PsppireDialogAction parent;
+
+ /*< private >*/
+ gboolean dispose_has_run;
+
+ GtkWidget *pairs_treeview ;
+ GtkListStore *list_store ;
+ struct ts_test nts[n_Tests];
+};
+
+
+struct _PsppireDialogActionTwoSampleClass
+{
+ PsppireDialogActionClass parent_class;
+};
+
+
+GType psppire_dialog_action_two_sample_get_type (void) ;
+
+G_END_DECLS
+
+#endif /* __PSPPIRE_DIALOG_ACTION_TWO_SAMPLE_H__ */
gint
psppire_dialog_run (PsppireDialog *dialog)
{
+ gchar *title = NULL;
+ g_object_get (dialog, "title", &title, NULL);
+
+ if (title == NULL)
+ g_warning ("PsppireDialog %s has no title", gtk_widget_get_name (GTK_WIDGET (dialog)));
+
if ( dialog->contents_are_valid != NULL )
gtk_container_foreach (GTK_CONTAINER (dialog->box),
connect_notify_signal,
+++ /dev/null
-/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 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
- 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 <http://www.gnu.org/licenses/>.
-*/
-
-#include <config.h>
-#include <gtk/gtk.h>
-
-#include "t-test-options.h"
-#include "t-test-paired-samples.h"
-
-#include "psppire-data-window.h"
-#include "psppire-selector.h"
-#include "psppire-var-view.h"
-
-#include "psppire-dict.h"
-
-#include "dialog-common.h"
-#include "psppire-dialog.h"
-
-#include "executor.h"
-
-#include "helper.h"
-
-#include "psppire-var-ptr.h"
-
-#include "paired-dialog.h"
-
-#include <gettext.h>
-#define _(msgid) gettext (msgid)
-#define N_(msgid) msgid
-
-
-static void
-refresh (void *aux)
-{
-}
-
-
-static gboolean
-valid (void *aux)
-{
- return TRUE;
-}
-
-static gchar *
-generate_syntax (const struct paired_samples_dialog *d, const struct tt_options_dialog *opt)
-{
- gchar *text = NULL;
- GString *str = g_string_new ("T-TEST \n\tPAIRS = ");
-
- psppire_var_view_append_names (PSPPIRE_VAR_VIEW (d->pairs_treeview), 0, str);
-
- g_string_append (str, " WITH ");
-
- psppire_var_view_append_names (PSPPIRE_VAR_VIEW (d->pairs_treeview), 1, str);
-
- g_string_append (str, " (PAIRED)");
- g_string_append (str, "\n");
-
- tt_options_dialog_append_syntax (opt, str);
-
- g_string_append (str, ".\n");
-
- text = str->str;
- g_string_free (str, FALSE);
-
- return text;
-}
-
-/* Pops up the dialog box */
-void
-t_test_paired_samples_dialog (PsppireDataWindow *de)
-{
- gint response;
- struct paired_samples_dialog *tt_d = two_sample_dialog_create (de);
- struct tt_options_dialog *opts = tt_options_dialog_create (GTK_WINDOW (de));
-
- GtkWidget *bb = gtk_hbutton_box_new ();
- GtkWidget *opt = gtk_button_new_with_mnemonic (_("O_ptions..."));
- gtk_box_pack_start (GTK_BOX (bb), opt, TRUE, TRUE, 5);
-
- gtk_widget_show_all (bb);
- two_sample_dialog_add_widget (tt_d, bb);
-
- g_signal_connect_swapped (opt, "clicked", G_CALLBACK (tt_options_dialog_run), opts);
-
- tt_d->refresh = refresh;
- tt_d->valid = valid;
- tt_d->aux = opts;
-
- gtk_window_set_title (GTK_WINDOW (tt_d->dialog), _("Paired Samples T Test"));
-
- response = psppire_dialog_run (PSPPIRE_DIALOG (tt_d->dialog));
-
- switch (response)
- {
- case GTK_RESPONSE_OK:
- g_free (execute_syntax_string (de, generate_syntax (tt_d, opts)));
- break;
- case PSPPIRE_RESPONSE_PASTE:
- g_free (paste_syntax_to_window (generate_syntax (tt_d, opts)));
- break;
- default:
- break;
- }
-
- two_sample_dialog_destroy (tt_d);
- tt_options_dialog_destroy (opts);
-}
+++ /dev/null
-#ifndef T_TEST_PAIRED_SAMPLES_DIALOG
-#define T_TEST_PAIRED_SAMPLES_DIALOG
-
-#include "psppire-data-window.h"
-
-void t_test_paired_samples_dialog (PsppireDataWindow *) ;
-
-#endif
#include "psppire-dialog-action-kmeans.h"
#include "psppire-dialog-action-logistic.h"
#include "psppire-dialog-action-means.h"
+#include "psppire-dialog-action-paired.h"
#include "psppire-means-layer.h"
#include "psppire-dialog-action-rank.h"
#include "psppire-dialog-action-regression.h"
#include "psppire-dialog-action-runs.h"
#include "psppire-dialog-action-sort.h"
#include "psppire-dialog-action-tt1s.h"
+#include "psppire-dialog-action-two-sample.h"
#include "psppire-dialog-action-univariate.h"
#include "psppire-dialog-action-var-info.h"
#include "psppire-value-entry.h"
psppire_dialog_action_kmeans_get_type ();
psppire_dialog_action_k_related_get_type ();
psppire_dialog_action_means_get_type ();
+ psppire_dialog_action_paired_get_type ();
psppire_dialog_action_indep_samps_get_type ();
psppire_means_layer_get_type ();
psppire_dialog_action_var_info_get_type ();
psppire_dialog_action_runs_get_type ();
psppire_dialog_action_sort_get_type ();
psppire_dialog_action_tt1s_get_type ();
+ psppire_dialog_action_two_sample_get_type ();
psppire_dialog_action_univariate_get_type ();
/* This seems to be necessary on Cygwin.