src/ui/gui/psppire-dialog-action-runs.h \
src/ui/gui/psppire-dialog-action-sort.c \
src/ui/gui/psppire-dialog-action-sort.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/psppire-dialog-action-var-info.h \
src/ui/gui/psppire-dict.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/univariate-dialog.c \
- src/ui/gui/univariate-dialog.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="univariate">
+ <object class="PsppireDialogActionUnivariate" id="univariate">
<property name="name">univariate</property>
+ <property name="manager">uimanager1</property>
<property name="label" translatable="yes">_Univariate Analysis...</property>
<property name="visible">False</property>
</object>
#include "ui/gui/t-test-one-sample.h"
#include "ui/gui/t-test-paired-samples.h"
#include "ui/gui/text-data-import-dialog.h"
-#include "ui/gui/univariate-dialog.h"
#include "ui/gui/weight-cases-dialog.h"
#include "ui/syntax-gen.h"
enable_save (de);
connect_action (de, "file_new_data", G_CALLBACK (create_data_window));
-
connect_action (de, "file_import", G_CALLBACK (text_data_import_assistant));
-
connect_action (de, "file_save", G_CALLBACK (psppire_window_save));
-
connect_action (de, "file_open", G_CALLBACK (psppire_window_open));
-
connect_action (de, "file_save_as", G_CALLBACK (psppire_window_save_as));
-
connect_action (de, "rename_dataset", G_CALLBACK (on_rename_dataset));
-
connect_action (de, "file_information_working-file", G_CALLBACK (display_dict));
-
connect_action (de, "file_information_external-file", G_CALLBACK (sysfile_info));
g_signal_connect_swapped (get_action_assert (de->builder, "view_value-labels"), "toggled", G_CALLBACK (toggle_value_labels), de);
connect_action (de, "transform_count", G_CALLBACK (count_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, "univariate", G_CALLBACK (univariate_dialog));
connect_action (de, "ks-one-sample", G_CALLBACK (ks_one_sample_dialog));
connect_action (de, "k-related-samples", G_CALLBACK (k_related_dialog));
connect_action (de, "two-related-samples", G_CALLBACK (two_related_dialog));
--- /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-univariate.h"
+
+#include "psppire-var-view.h"
+
+#include "psppire-dialog.h"
+#include "builder-wrapper.h"
+
+static void psppire_dialog_action_univariate_init (PsppireDialogActionUnivariate *act);
+static void psppire_dialog_action_univariate_class_init (PsppireDialogActionUnivariateClass *class);
+
+G_DEFINE_TYPE (PsppireDialogActionUnivariate, psppire_dialog_action_univariate, PSPPIRE_TYPE_DIALOG_ACTION);
+
+static char *
+generate_syntax (PsppireDialogAction *act)
+{
+ PsppireDialogActionUnivariate *uvd = PSPPIRE_DIALOG_ACTION_UNIVARIATE (act);
+
+ gchar *text = NULL;
+ GString *str = g_string_new ("GLM ");
+
+ g_string_append (str, gtk_entry_get_text (GTK_ENTRY (uvd->dep_entry)));
+
+ g_string_append (str, " BY ");
+
+ psppire_var_view_append_names (PSPPIRE_VAR_VIEW (uvd->factor_list), 0, str);
+
+ g_string_append (str, ".\n");
+
+ text = str->str;
+
+ g_string_free (str, FALSE);
+
+ return text;
+}
+
+
+static gboolean
+dialog_state_valid (gpointer data)
+{
+ PsppireDialogActionUnivariate *ud = PSPPIRE_DIALOG_ACTION_UNIVARIATE (data);
+ GtkTreeModel *vars;
+ GtkTreeIter notused;
+
+ if ( 0 == strcmp ("", gtk_entry_get_text (GTK_ENTRY (ud->dep_entry))))
+ return false;
+
+ vars =
+ gtk_tree_view_get_model (GTK_TREE_VIEW (ud->factor_list));
+
+ return gtk_tree_model_get_iter_first (vars, ¬used);
+}
+
+static void
+refresh (PsppireDialogAction *rd_)
+{
+ PsppireDialogActionUnivariate *uv = PSPPIRE_DIALOG_ACTION_UNIVARIATE (rd_);
+ GtkTreeModel *liststore ;
+
+ gtk_entry_set_text (GTK_ENTRY (uv->dep_entry), "");
+
+ liststore = gtk_tree_view_get_model (GTK_TREE_VIEW (uv->factor_list));
+
+ gtk_list_store_clear (GTK_LIST_STORE (liststore));
+}
+
+static void
+psppire_dialog_action_univariate_activate (GtkAction *a)
+{
+ PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
+ PsppireDialogActionUnivariate *act = PSPPIRE_DIALOG_ACTION_UNIVARIATE (a);
+
+ GtkBuilder *xml = builder_new ("univariate.ui");
+ pda->dialog = get_widget_assert (xml, "univariate-dialog");
+ pda->source = get_widget_assert (xml, "dict-view");
+
+ act->dep_entry = get_widget_assert (xml, "dep-entry");
+ act->factor_list = get_widget_assert (xml, "factors-view");
+
+ psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid);
+ psppire_dialog_action_set_refresh (pda, refresh);
+
+ g_object_unref (xml);
+
+ if (PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_univariate_parent_class)->activate)
+ PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_univariate_parent_class)->activate (pda);
+}
+
+static void
+psppire_dialog_action_univariate_class_init (PsppireDialogActionUnivariateClass *class)
+{
+ GtkActionClass *action_class = GTK_ACTION_CLASS (class);
+
+ action_class->activate = psppire_dialog_action_univariate_activate;
+ PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax;
+}
+
+
+static void
+psppire_dialog_action_univariate_init (PsppireDialogActionUnivariate *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_UNIVARIATE_H__
+#define __PSPPIRE_DIALOG_ACTION_UNIVARIATE_H__
+
+G_BEGIN_DECLS
+
+
+#define PSPPIRE_TYPE_DIALOG_ACTION_UNIVARIATE (psppire_dialog_action_univariate_get_type ())
+
+#define PSPPIRE_DIALOG_ACTION_UNIVARIATE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ PSPPIRE_TYPE_DIALOG_ACTION_UNIVARIATE, PsppireDialogActionUnivariate))
+
+#define PSPPIRE_DIALOG_ACTION_UNIVARIATE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ PSPPIRE_TYPE_DIALOG_ACTION_UNIVARIATE, \
+ PsppireDialogActionUnivariateClass))
+
+
+#define PSPPIRE_IS_DIALOG_ACTION_UNIVARIATE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PSPPIRE_TYPE_DIALOG_ACTION_UNIVARIATE))
+
+#define PSPPIRE_IS_DIALOG_ACTION_UNIVARIATE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), PSPPIRE_TYPE_DIALOG_ACTION_UNIVARIATE))
+
+
+#define PSPPIRE_DIALOG_ACTION_UNIVARIATE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ PSPPIRE_TYPE_DIALOG_ACTION_UNIVARIATE, \
+ PsppireDialogActionUnivariateClass))
+
+typedef struct _PsppireDialogActionUnivariate PsppireDialogActionUnivariate;
+typedef struct _PsppireDialogActionUnivariateClass PsppireDialogActionUnivariateClass;
+
+
+struct _PsppireDialogActionUnivariate
+{
+ PsppireDialogAction parent;
+
+ /*< private >*/
+ gboolean dispose_has_run ;
+
+ /* Entry box for the dependent variable */
+ GtkWidget *dep_entry;
+ GtkWidget *factor_list;
+};
+
+
+struct _PsppireDialogActionUnivariateClass
+{
+ PsppireDialogActionClass parent_class;
+};
+
+
+GType psppire_dialog_action_univariate_get_type (void) ;
+
+G_END_DECLS
+
+#endif /* __PSPPIRE_DIALOG_ACTION_UNIVARIATE_H__ */
+++ /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 <ui/gui/builder-wrapper.h>
-#include "psppire-dialog.h"
-#include "dict-display.h"
-
-#include "psppire-var-view.h"
-#include "psppire-selector.h"
-#include "psppire-dictview.h"
-#include <ui/gui/dialog-common.h>
-
-#include "executor.h"
-#include "helper.h"
-
-#include "univariate-dialog.h"
-
-struct uni_dialog
-{
- struct dictionary *dict;
-
- /* Entry box for the dependent variable */
- GtkWidget *dep_entry;
-
- GtkWidget *factor_list;
-};
-
-
-/* Dialog is valid iff at least one variable has been selected in both
- the dependent variable box and the factor list. */
-static gboolean
-dialog_state_valid (gpointer data)
-{
- struct uni_dialog *uv_d = data;
- GtkTreeModel *vars;
- GtkTreeIter notused;
-
- if ( 0 == strcmp ("", gtk_entry_get_text (GTK_ENTRY (uv_d->dep_entry))))
- return false;
-
- vars =
- gtk_tree_view_get_model (GTK_TREE_VIEW (uv_d->factor_list));
-
- return gtk_tree_model_get_iter_first (vars, ¬used);
-}
-
-/* Reset the dialog to its default state */
-static void
-refresh (PsppireDialog *dialog, struct uni_dialog *uv_d)
-{
- GtkTreeModel *liststore ;
-
- gtk_entry_set_text (GTK_ENTRY (uv_d->dep_entry), "");
-
- liststore = gtk_tree_view_get_model (GTK_TREE_VIEW (uv_d->factor_list));
-
- gtk_list_store_clear (GTK_LIST_STORE (liststore));
-}
-
-
-static char *
-generate_syntax (const struct uni_dialog *uvd)
-{
- gchar *text = NULL;
- GString *str = g_string_new ("GLM ");
-
-
- g_string_append (str, gtk_entry_get_text (GTK_ENTRY (uvd->dep_entry)));
-
-
- g_string_append (str, " BY ");
-
- psppire_var_view_append_names (PSPPIRE_VAR_VIEW (uvd->factor_list), 0, str);
-
-
- g_string_append (str, ".");
-
- text = str->str;
-
- g_string_free (str, FALSE);
-
- return text;
-}
-
-void
-univariate_dialog (PsppireDataWindow * de)
-{
- struct uni_dialog uv_d;
-
- gint response;
-
- GtkBuilder *xml = builder_new ("univariate.ui");
-
- GtkWidget *dialog = get_widget_assert (xml, "univariate-dialog");
- GtkWidget *source = get_widget_assert (xml, "dict-view");
-
- GtkWidget *dep_selector = get_widget_assert (xml, "dep-selector");
- GtkWidget *factor_selector = get_widget_assert (xml, "factor-selector");
-
-
- uv_d.dep_entry = get_widget_assert (xml, "dep-entry");
- uv_d.factor_list = get_widget_assert (xml, "factors-view");
-
- gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de));
- g_signal_connect (dialog, "refresh", G_CALLBACK (refresh), &uv_d);
-
- psppire_dialog_set_valid_predicate (PSPPIRE_DIALOG (dialog),
- dialog_state_valid, &uv_d);
-
-
- g_object_get (de->data_editor, "dictionary", &uv_d.dict, NULL);
- g_object_set (source, "model", uv_d.dict, NULL);
-
- psppire_selector_set_allow (PSPPIRE_SELECTOR (dep_selector),
- numeric_only);
-
- psppire_selector_set_filter_func (PSPPIRE_SELECTOR (dep_selector),
- is_currently_in_entry);
-
-
- psppire_selector_set_filter_func (PSPPIRE_SELECTOR (factor_selector),
- is_currently_in_varview);
-
- response = psppire_dialog_run (PSPPIRE_DIALOG (dialog));
-
-
- switch (response)
- {
- case GTK_RESPONSE_OK:
- g_free (execute_syntax_string (de, generate_syntax (&uv_d)));
- break;
- case PSPPIRE_RESPONSE_PASTE:
- g_free (paste_syntax_to_window (generate_syntax (&uv_d)));
- break;
- default:
- break;
- }
-
- g_object_unref (xml);
-}
-
-
+++ /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 __UNIVARIATE_DIALOG_H
-#define __UNIVARIATE_DIALOG_H
-
-#include "psppire-data-window.h"
-
-void univariate_dialog (PsppireDataWindow * data);
-
-#endif
#include "psppire-dialog-action-roc.h"
#include "psppire-dialog-action-runs.h"
#include "psppire-dialog-action-sort.h"
+#include "psppire-dialog-action-univariate.h"
#include "psppire-dialog-action-var-info.h"
#include "psppire-value-entry.h"
psppire_dialog_action_roc_get_type ();
psppire_dialog_action_runs_get_type ();
psppire_dialog_action_sort_get_type ();
+ psppire_dialog_action_univariate_get_type ();
/* This seems to be necessary on Cygwin.
It ought not to be necessary. Having it here can't do any harm. */