src/ui/gui/psppire-dialog-action-kmeans.h \
src/ui/gui/psppire-dialog-action-var-info.c \
src/ui/gui/psppire-dialog-action-var-info.h \
+ src/ui/gui/psppire-dialog-action-roc.c \
+ src/ui/gui/psppire-dialog-action-roc.h \
src/ui/gui/psppire-dict.c \
src/ui/gui/psppire-dict.h \
src/ui/gui/psppire-dictview.c \
src/ui/gui/regression-dialog.h \
src/ui/gui/reliability-dialog.c \
src/ui/gui/reliability-dialog.h \
- src/ui/gui/roc-dialog.c \
- src/ui/gui/roc-dialog.h \
src/ui/gui/runs-dialog.c \
src/ui/gui/runs-dialog.h \
src/ui/gui/select-cases-dialog.c \
</object>
</child>
<child>
- <object class="GtkAction" id="roc-curve">
+ <object class="PsppireDialogActionRoc" id="roc-curve">
<property name="name">roc-curve</property>
+ <property name="manager">uimanager1</property>
<property name="label" translatable="yes">ROC Cur_ve...</property>
</object>
</child>
#include "ui/gui/recode-dialog.h"
#include "ui/gui/regression-dialog.h"
#include "ui/gui/reliability-dialog.h"
-#include "ui/gui/roc-dialog.h"
#include "ui/gui/select-cases-dialog.h"
#include "ui/gui/sort-cases-dialog.h"
#include "ui/gui/split-file-dialog.h"
connect_action (de, "reliability", G_CALLBACK (reliability_dialog));
- connect_action (de, "roc-curve", G_CALLBACK (roc_dialog));
-
connect_action (de, "analyze_explore", G_CALLBACK (examine_dialog));
connect_action (de, "univariate", G_CALLBACK (univariate_dialog));
--- /dev/null
+/* PSPPIRE - a graphical user interface for PSPP.
+ Copyright (C) 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 "psppire-dialog-action-roc.h"
+
+#include "dialog-common.h"
+#include <ui/syntax-gen.h>
+#include "psppire-var-view.h"
+
+#include "psppire-dialog.h"
+#include "builder-wrapper.h"
+
+#include "psppire-dict.h"
+#include "libpspp/str.h"
+
+static void
+psppire_dialog_action_roc_class_init (PsppireDialogActionRocClass *class);
+
+G_DEFINE_TYPE (PsppireDialogActionRoc, psppire_dialog_action_roc, PSPPIRE_TYPE_DIALOG_ACTION);
+
+static gboolean
+dialog_state_valid (gpointer data)
+{
+ PsppireDialogActionRoc *rd = data;
+ const gchar *text;
+
+ GtkTreeModel *liststore =
+ gtk_tree_view_get_model (GTK_TREE_VIEW (rd->test_variables));
+
+ if (gtk_tree_model_iter_n_children (liststore, NULL) < 1)
+ return FALSE;
+
+
+ text = gtk_entry_get_text (GTK_ENTRY (rd->state_variable));
+ if ( 0 == strcmp ("", text))
+ return FALSE;
+
+
+ text = gtk_entry_get_text (GTK_ENTRY (rd->state_value));
+ if ( 0 == strcmp ("", text))
+ return FALSE;
+
+
+ return TRUE;
+}
+
+static void
+on_curve_button_toggle (GtkCheckButton *curve, PsppireDialogActionRoc *rd)
+{
+ if ( !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (curve)))
+ {
+ if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->reference)))
+ g_object_set (rd->reference, "inconsistent", TRUE, NULL);
+ g_object_set (rd->reference, "sensitive", FALSE, NULL);
+ }
+ else
+ {
+ g_object_set (rd->reference, "inconsistent", FALSE, NULL);
+ g_object_set (rd->reference, "sensitive", TRUE, NULL);
+ }
+}
+
+static void
+refresh (PsppireDialogActionRoc *rd)
+{
+ GtkTreeModel *liststore =
+ gtk_tree_view_get_model (GTK_TREE_VIEW (rd->test_variables));
+ gtk_list_store_clear (GTK_LIST_STORE (liststore));
+
+ gtk_entry_set_text (GTK_ENTRY (rd->state_variable), "");
+ gtk_entry_set_text (GTK_ENTRY (rd->state_value), "");
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rd->curve), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rd->reference), FALSE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rd->standard_error), FALSE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rd->coordinates), FALSE);
+}
+
+static void
+psppire_dialog_action_roc_activate (GtkAction *a)
+{
+ PsppireDialogActionRoc *act = PSPPIRE_DIALOG_ACTION_ROC (a);
+ PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
+
+ GtkBuilder *xml = builder_new ("roc.ui");
+ pda->dialog = get_widget_assert (xml, "roc-dialog");
+ pda->source = get_widget_assert (xml, "dict-view");
+ pda->source = get_widget_assert (xml, "dict-view");
+
+ act->test_variables = get_widget_assert (xml, "psppire-var-view1");
+ act->state_variable = get_widget_assert (xml, "entry1");
+ act->state_value = get_widget_assert (xml, "entry2");
+
+ act->curve = get_widget_assert (xml, "curve");
+ act->reference = get_widget_assert (xml, "reference-line");
+ act->standard_error = get_widget_assert (xml, "standard-error");
+ act->coordinates = get_widget_assert (xml, "co-ordinates");
+
+ g_object_unref (xml);
+
+ g_signal_connect (act->curve, "toggled",
+ G_CALLBACK (on_curve_button_toggle), act);
+
+ psppire_dialog_action_set_refresh (pda, refresh);
+
+ psppire_dialog_action_set_valid_predicate (pda,
+ dialog_state_valid);
+
+ if (PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_roc_parent_class)->activate)
+ PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_roc_parent_class)->activate (pda);
+}
+
+
+
+static char *
+generate_syntax (PsppireDialogAction *a)
+{
+ PsppireDialogActionRoc *rd = PSPPIRE_DIALOG_ACTION_ROC (a);
+ gchar *text;
+ const gchar *var_name = gtk_entry_get_text (GTK_ENTRY (rd->state_variable));
+ GString *string = g_string_new ("ROC");
+
+ psppire_var_view_append_names (PSPPIRE_VAR_VIEW (rd->test_variables), 0, string);
+
+ g_string_append (string, " BY ");
+
+ g_string_append (string, var_name);
+
+ g_string_append (string, " (");
+ {
+ const gchar *value = gtk_entry_get_text (GTK_ENTRY (rd->state_value));
+
+ const struct variable *var = psppire_dict_lookup_var (PSPPIRE_DIALOG_ACTION(rd)->dict, var_name);
+
+ g_return_val_if_fail (var, NULL);
+
+ if ( var_is_alpha (var))
+ {
+ struct string str;
+ ds_init_empty (&str);
+ syntax_gen_string (&str, ss_cstr (value));
+ g_string_append (string, ds_cstr (&str));
+ ds_destroy (&str);
+ }
+ else
+ g_string_append (string, value);
+ }
+ g_string_append (string, ")");
+
+
+ /* The /PLOT subcommand */
+ g_string_append (string, "\n\t/PLOT ");
+ if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->curve)))
+ {
+ g_string_append (string, "CURVE");
+ if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->reference)))
+ g_string_append (string, " (REFERENCE)");
+ }
+ else
+ g_string_append (string, "NONE");
+
+
+ /* The /PRINT subcommand */
+ if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->standard_error)) ||
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->coordinates)) )
+ {
+ g_string_append (string, "\n\t/PRINT");
+
+ if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->standard_error)))
+ g_string_append (string, " SE");
+
+ if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->coordinates)))
+ g_string_append (string, " COORDINATES");
+ }
+
+ g_string_append (string, ".\n");
+
+ text = string->str;
+
+ g_string_free (string, FALSE);
+
+ return text;
+}
+
+static void
+psppire_dialog_action_roc_class_init (PsppireDialogActionRocClass *class)
+{
+ GtkActionClass *action_class = GTK_ACTION_CLASS (class);
+
+ action_class->activate = psppire_dialog_action_roc_activate;
+
+ PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax;
+}
+
+
+static void
+psppire_dialog_action_roc_init (PsppireDialogActionRoc *act)
+{
+}
+
--- /dev/null
+/* PSPPIRE - a graphical user interface for PSPP.
+ Copyright (C) 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 <glib-object.h>
+#include <glib.h>
+
+#include "psppire-dialog-action.h"
+
+#ifndef __PSPPIRE_DIALOG_ACTION_ROC_H__
+#define __PSPPIRE_DIALOG_ACTION_ROC_H__
+
+G_BEGIN_DECLS
+
+
+#define PSPPIRE_TYPE_DIALOG_ACTION_ROC (psppire_dialog_action_roc_get_type ())
+
+#define PSPPIRE_DIALOG_ACTION_ROC(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ PSPPIRE_TYPE_DIALOG_ACTION_ROC, PsppireDialogActionRoc))
+
+#define PSPPIRE_DIALOG_ACTION_ROC_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ PSPPIRE_TYPE_DIALOG_ACTION_ROC, \
+ PsppireDialogActionRocClass))
+
+
+#define PSPPIRE_IS_DIALOG_ACTION_ROC(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PSPPIRE_TYPE_DIALOG_ACTION_ROC))
+
+#define PSPPIRE_IS_DIALOG_ACTION_ROC_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), PSPPIRE_TYPE_DIALOG_ACTION_ROC))
+
+
+#define PSPPIRE_DIALOG_ACTION_ROC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ PSPPIRE_TYPE_DIALOG_ACTION_ROC, \
+ PsppireDialogActionRocClass))
+
+typedef struct _PsppireDialogActionRoc PsppireDialogActionRoc;
+typedef struct _PsppireDialogActionRocClass PsppireDialogActionRocClass;
+
+
+struct _PsppireDialogActionRoc
+{
+ PsppireDialogAction parent;
+
+ /*< private >*/
+ gboolean dispose_has_run ;
+
+
+ GtkWidget *test_variables;
+ GtkWidget *state_variable;
+ GtkWidget *state_value ;
+
+ GtkWidget *curve ;
+ GtkWidget *reference ;
+ GtkWidget *standard_error;
+ GtkWidget *coordinates ;
+};
+
+
+struct _PsppireDialogActionRocClass
+{
+ PsppireDialogActionClass parent_class;
+};
+
+
+GType psppire_dialog_action_roc_get_type (void) ;
+
+G_END_DECLS
+
+#endif /* __PSPPIRE_DIALOG_ACTION_ROC_H__ */
+++ /dev/null
-/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 2009, 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
- 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 "dialog-common.h"
-#include <ui/syntax-gen.h>
-#include <libpspp/str.h>
-
-#include "roc-dialog.h"
-#include "psppire-selector.h"
-#include "psppire-dictview.h"
-#include "psppire-dialog.h"
-
-#include "psppire-data-window.h"
-#include "psppire-var-view.h"
-
-#include "executor.h"
-#include "builder-wrapper.h"
-#include "helper.h"
-
-#include <gtk/gtk.h>
-
-#include "gettext.h"
-#define _(msgid) gettext (msgid)
-#define N_(msgid) msgid
-
-
-struct roc
-{
- PsppireDict *dict;
-
- GtkWidget *test_variables;
- GtkWidget *state_variable;
- GtkWidget *state_value;
-
- GtkWidget *curve;
- GtkWidget *reference;
- GtkWidget *standard_error;
- GtkWidget *coordinates;
-};
-
-
-static char * generate_syntax (const struct roc *rd);
-
-
-static void
-refresh (struct roc *rd)
-{
- GtkTreeModel *liststore =
- gtk_tree_view_get_model (GTK_TREE_VIEW (rd->test_variables));
- gtk_list_store_clear (GTK_LIST_STORE (liststore));
-
- gtk_entry_set_text (GTK_ENTRY (rd->state_variable), "");
- gtk_entry_set_text (GTK_ENTRY (rd->state_value), "");
-
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rd->curve), TRUE);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rd->reference), FALSE);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rd->standard_error), FALSE);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rd->coordinates), FALSE);
-}
-
-
-static gboolean
-dialog_state_valid (gpointer data)
-{
- struct roc *rd = data;
- const gchar *text;
-
- GtkTreeModel *liststore =
- gtk_tree_view_get_model (GTK_TREE_VIEW (rd->test_variables));
-
- if (gtk_tree_model_iter_n_children (liststore, NULL) < 1)
- return FALSE;
-
-
- text = gtk_entry_get_text (GTK_ENTRY (rd->state_variable));
- if ( 0 == strcmp ("", text))
- return FALSE;
-
-
- text = gtk_entry_get_text (GTK_ENTRY (rd->state_value));
- if ( 0 == strcmp ("", text))
- return FALSE;
-
-
- return TRUE;
-}
-
-static void
-on_curve_button_toggle (GtkCheckButton *curve, struct roc *rd)
-{
- if ( !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (curve)))
- {
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->reference)))
- g_object_set (rd->reference, "inconsistent", TRUE, NULL);
- g_object_set (rd->reference, "sensitive", FALSE, NULL);
- }
- else
- {
- g_object_set (rd->reference, "inconsistent", FALSE, NULL);
- g_object_set (rd->reference, "sensitive", TRUE, NULL);
- }
-}
-
-
-/* Pops up the Roc dialog box */
-void
-roc_dialog (PsppireDataWindow *de)
-{
- struct roc rd;
- gint response;
-
- GtkBuilder *xml = builder_new ("roc.ui");
- PsppireVarStore *vs;
-
- GtkWidget *dialog = get_widget_assert (xml, "roc-dialog");
- GtkWidget *source = get_widget_assert (xml, "dict-view");
-
- rd.test_variables = get_widget_assert (xml, "psppire-var-view1");
- rd.state_variable = get_widget_assert (xml, "entry1");
- rd.state_value = get_widget_assert (xml, "entry2");
-
- rd.curve = get_widget_assert (xml, "curve");
- rd.reference = get_widget_assert (xml, "reference-line");
- rd.standard_error = get_widget_assert (xml, "standard-error");
- rd.coordinates = get_widget_assert (xml, "co-ordinates");
-
-
- g_object_get (de->data_editor, "var-store", &vs, NULL);
-
- gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de));
-
- g_object_get (vs, "dictionary", &rd.dict, NULL);
- g_object_set (source, "model", rd.dict, NULL);
-
- g_signal_connect (rd.curve, "toggled", G_CALLBACK (on_curve_button_toggle), &rd);
-
- g_signal_connect_swapped (dialog, "refresh", G_CALLBACK (refresh), &rd);
-
- psppire_dialog_set_valid_predicate (PSPPIRE_DIALOG (dialog),
- dialog_state_valid, &rd);
-
- psppire_selector_set_allow (PSPPIRE_SELECTOR (get_widget_assert (xml, "dep-selector")),
- numeric_only);
-
- response = psppire_dialog_run (PSPPIRE_DIALOG (dialog));
-
- switch (response)
- {
- case GTK_RESPONSE_OK:
- g_free (execute_syntax_string (de, generate_syntax (&rd)));
- break;
- case PSPPIRE_RESPONSE_PASTE:
- g_free (paste_syntax_to_window (generate_syntax (&rd)));
- break;
- default:
- break;
- }
-
- g_object_unref (xml);
-}
-
-
-\f
-
-static char *
-generate_syntax (const struct roc *rd)
-{
- gchar *text;
- const gchar *var_name = gtk_entry_get_text (GTK_ENTRY (rd->state_variable));
- GString *string = g_string_new ("ROC");
-
- psppire_var_view_append_names (PSPPIRE_VAR_VIEW (rd->test_variables), 0, string);
-
- g_string_append (string, " BY ");
-
- g_string_append (string, var_name);
-
- g_string_append (string, " (");
- {
- const gchar *value = gtk_entry_get_text (GTK_ENTRY (rd->state_value));
-
- const struct variable *var = psppire_dict_lookup_var (rd->dict, var_name);
-
- g_return_val_if_fail (var, NULL);
-
- if ( var_is_alpha (var))
- {
- struct string xx;
- ds_init_empty (&xx);
- syntax_gen_string (&xx, ss_cstr (value));
- g_string_append (string, ds_cstr (&xx));
- ds_destroy (&xx);
- }
- else
- g_string_append (string, value);
- }
- g_string_append (string, ")");
-
-
- /* The /PLOT subcommand */
- g_string_append (string, "\n\t/PLOT ");
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->curve)))
- {
- g_string_append (string, "CURVE");
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->reference)))
- g_string_append (string, " (REFERENCE)");
- }
- else
- g_string_append (string, "NONE");
-
-
- /* The /PRINT subcommand */
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->standard_error)) ||
- gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->coordinates)) )
- {
- g_string_append (string, "\n\t/PRINT");
-
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->standard_error)))
- g_string_append (string, " SE");
-
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->coordinates)))
- g_string_append (string, " COORDINATES");
- }
-
- g_string_append (string, ".\n");
-
- text = string->str;
-
- g_string_free (string, FALSE);
-
- return text;
-}
+++ /dev/null
-/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 2009 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 __ROC_DIALOG_H
-#define __ROC_DIALOG_H
-
-
-#include "psppire-data-window.h"
-
-void roc_dialog (PsppireDataWindow * data);
-
-#endif
#include "psppire-dialog-action-correlation.h"
#include "psppire-dialog-action-descriptives.h"
#include "psppire-dialog-action-kmeans.h"
+#include "psppire-dialog-action-roc.h"
#include "psppire-dialog-action-var-info.h"
psppire_dialog_action_descriptives_get_type ();
psppire_dialog_action_kmeans_get_type ();
psppire_dialog_action_var_info_get_type ();
+ psppire_dialog_action_roc_get_type ();
}