--- /dev/null
+<?xml version="1.0"?>
+<interface>
+ <!-- interface-requires gtk+ 2.12 -->
+ <requires lib="psppire" version="2054.17080"/>
+ <!-- interface-naming-policy project-wide -->
+ <object class="PsppireDialog" id="logistic-dialog">
+ <property name="title" translatable="yes">Logistic Regression</property>
+ <property name="modal">True</property>
+ <child internal-child="hbox">
+ <object class="GtkHBox" id="dialog-hbox1">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkAlignment" id="alignment1">
+ <property name="visible">True</property>
+ <property name="top_padding">5</property>
+ <property name="left_padding">5</property>
+ <child>
+ <object class="GtkTable" id="table1">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="n_rows">3</property>
+ <property name="n_columns">3</property>
+ <child>
+ <object class="GtkHButtonBox" id="hbuttonbox1">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="layout_style">spread</property>
+ <child>
+ <object class="GtkButton" id="stat-button">
+ <property name="label" translatable="yes">S_tatistics...</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="save-button">
+ <property name="label" translatable="yes">_Save...</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="right_attach">3</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="y_options"></property>
+ <property name="y_padding">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="PsppireSelector" id="dep-selector">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="no_show_all">True</property>
+ <property name="border_width">5</property>
+ <property name="source_widget">dict-view</property>
+ <property name="dest_widget">dependent-entry</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="x_options"></property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="PsppireSelector" id="indep-selector">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="no_show_all">True</property>
+ <property name="border_width">5</property>
+ <property name="source_widget">dict-view</property>
+ <property name="dest_widget">indep-view</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options"></property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScrolledWindow" id="variables">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="hscrollbar_policy">never</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <property name="shadow_type">etched-in</property>
+ <child>
+ <object class="PsppireDictView" id="dict-view">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="headers_visible">False</property>
+ <property name="headers_clickable">False</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFrame" id="frame2">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkAlignment" id="alignment2">
+ <property name="visible">True</property>
+ <property name="left_padding">10</property>
+ <child>
+ <object class="GtkEntry" id="dependent-entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="label" translatable="yes">_Dependent</property>
+ <property name="use_markup">True</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFrame" id="frame3">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkAlignment" id="alignment4">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindow2">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="hscrollbar_policy">never</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <property name="shadow_type">etched-in</property>
+ <child>
+ <object class="PsppireVarView" id="indep-view">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="headers_visible">False</property>
+ <property name="headers_clickable">False</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="label" translatable="yes">_Independent</property>
+ <property name="use_markup">True</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">indep-view</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="PsppireVButtonBox" id="psppire-vbuttonbox1">
+ <property name="visible">True</property>
+ <property name="border_width">5</property>
+ <property name="orientation">vertical</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
--- /dev/null
+/* PSPPIRE - a graphical user interface for PSPP.
+ 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
+ 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-logistic.h"
+#include "psppire-value-entry.h"
+
+#include "dialog-common.h"
+#include "helper.h"
+#include <ui/syntax-gen.h>
+#include "psppire-var-view.h"
+
+#include "psppire-dialog.h"
+#include "builder-wrapper.h"
+#include "checkbox-treeview.h"
+#include "psppire-dict.h"
+#include "libpspp/str.h"
+
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
+#define N_(msgid) msgid
+
+
+static void
+psppire_dialog_action_logistic_class_init (PsppireDialogActionLogisticClass *class);
+
+G_DEFINE_TYPE (PsppireDialogActionLogistic, psppire_dialog_action_logistic, PSPPIRE_TYPE_DIALOG_ACTION);
+
+static gboolean
+dialog_state_valid (gpointer data)
+{
+ PsppireDialogActionLogistic *rd = PSPPIRE_DIALOG_ACTION_LOGISTIC (data);
+
+ const gchar *text = gtk_entry_get_text (GTK_ENTRY (rd->dep_var));
+
+ GtkTreeModel *indep_vars = gtk_tree_view_get_model (GTK_TREE_VIEW (rd->indep_vars));
+
+ GtkTreeIter notused;
+
+ return 0 != strcmp ("", text) &&
+ gtk_tree_model_get_iter_first (indep_vars, ¬used);
+}
+
+static void
+refresh (PsppireDialogAction *rd_)
+{
+ PsppireDialogActionLogistic *rd = PSPPIRE_DIALOG_ACTION_LOGISTIC (rd_);
+
+ GtkTreeModel *liststore = gtk_tree_view_get_model (GTK_TREE_VIEW (rd->indep_vars));
+ gtk_list_store_clear (GTK_LIST_STORE (liststore));
+
+ gtk_entry_set_text (GTK_ENTRY (rd->dep_var), "");
+}
+
+
+static void
+psppire_dialog_action_logistic_activate (GtkAction *a)
+{
+ PsppireDialogActionLogistic *act = PSPPIRE_DIALOG_ACTION_LOGISTIC (a);
+ PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
+
+ GtkBuilder *xml = builder_new ("logistic.ui");
+
+ pda->dialog = get_widget_assert (xml, "logistic-dialog");
+ pda->source = get_widget_assert (xml, "dict-view");
+
+ act->dep_var = get_widget_assert (xml, "dependent-entry");
+ act->indep_vars = get_widget_assert (xml, "indep-view");
+
+ g_object_unref (xml);
+
+ 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_logistic_parent_class)->activate)
+ PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_logistic_parent_class)->activate (pda);
+}
+
+
+
+static char *
+generate_syntax (PsppireDialogAction *a)
+{
+ PsppireDialogActionLogistic *rd = PSPPIRE_DIALOG_ACTION_LOGISTIC (a);
+ gchar *text = NULL;
+
+ GString *string = g_string_new ("LOGISTIC REGRESSION ");
+
+ const gchar *dep = gtk_entry_get_text (GTK_ENTRY (rd->dep_var));
+
+ g_string_append (string, dep);
+
+ g_string_append (string, " WITH ");
+
+ psppire_var_view_append_names (PSPPIRE_VAR_VIEW (rd->indep_vars), 0, string);
+
+ g_string_append (string, ".\n");
+
+ text = string->str;
+
+ g_string_free (string, FALSE);
+
+ return text;
+}
+
+static void
+psppire_dialog_action_logistic_class_init (PsppireDialogActionLogisticClass *class)
+{
+ GtkActionClass *action_class = GTK_ACTION_CLASS (class);
+
+ action_class->activate = psppire_dialog_action_logistic_activate;
+
+ PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax;
+}
+
+
+static void
+psppire_dialog_action_logistic_init (PsppireDialogActionLogistic *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_LOGISTIC_H__
+#define __PSPPIRE_DIALOG_ACTION_LOGISTIC_H__
+
+G_BEGIN_DECLS
+
+
+#define PSPPIRE_TYPE_DIALOG_ACTION_LOGISTIC (psppire_dialog_action_logistic_get_type ())
+
+#define PSPPIRE_DIALOG_ACTION_LOGISTIC(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ PSPPIRE_TYPE_DIALOG_ACTION_LOGISTIC, PsppireDialogActionLogistic))
+
+#define PSPPIRE_DIALOG_ACTION_LOGISTIC_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ PSPPIRE_TYPE_DIALOG_ACTION_LOGISTIC, \
+ PsppireDialogActionLogisticClass))
+
+
+#define PSPPIRE_IS_DIALOG_ACTION_LOGISTIC(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PSPPIRE_TYPE_DIALOG_ACTION_LOGISTIC))
+
+#define PSPPIRE_IS_DIALOG_ACTION_LOGISTIC_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), PSPPIRE_TYPE_DIALOG_ACTION_LOGISTIC))
+
+
+#define PSPPIRE_DIALOG_ACTION_LOGISTIC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ PSPPIRE_TYPE_DIALOG_ACTION_LOGISTIC, \
+ PsppireDialogActionLogisticClass))
+
+typedef struct _PsppireDialogActionLogistic PsppireDialogActionLogistic;
+typedef struct _PsppireDialogActionLogisticClass PsppireDialogActionLogisticClass;
+
+
+struct _PsppireDialogActionLogistic
+{
+ PsppireDialogAction parent;
+
+ /*< private >*/
+ gboolean dispose_has_run ;
+
+ GtkWidget *dep_var;
+ GtkWidget *indep_vars;
+};
+
+
+struct _PsppireDialogActionLogisticClass
+{
+ PsppireDialogActionClass parent_class;
+};
+
+
+GType psppire_dialog_action_logistic_get_type (void) ;
+
+G_END_DECLS
+
+#endif /* __PSPPIRE_DIALOG_ACTION_LOGISTIC_H__ */