src_ui_gui_psppiredir = $(pkgdatadir)
dist_src_ui_gui_psppire_DATA = \
- $(top_srcdir)/src/ui/gui/psppire.glade \
- $(top_srcdir)/src/ui/gui/syntax-editor.glade \
$(top_srcdir)/src/ui/gui/data-editor.glade \
- $(top_srcdir)/src/ui/gui/output-viewer.glade \
$(top_srcdir)/src/ui/gui/descriptives-dialog.glade \
+ $(top_srcdir)/src/ui/gui/output-viewer.glade \
+ $(top_srcdir)/src/ui/gui/psppire.glade \
+ $(top_srcdir)/src/ui/gui/syntax-editor.glade \
+ $(top_srcdir)/src/ui/gui/t-test.glade \
$(top_srcdir)/src/ui/gui/psppicon.png \
$(top_srcdir)/src/ui/gui/pspplogo.png \
$(top_srcdir)/src/ui/gui/icons/value-labels.png \
src/ui/gui/syntax-editor-source.h \
src/ui/gui/transpose-dialog.c \
src/ui/gui/transpose-dialog.h \
+ src/ui/gui/t-test-independent-samples-dialog.c \
+ src/ui/gui/t-test-independent-samples-dialog.h \
src/ui/gui/val-labs-dialog.c \
src/ui/gui/val-labs-dialog.h \
src/ui/gui/var-display.c \
#include "dict-display.h"
#include "clipboard.h"
+#include "t-test-independent-samples-dialog.h"
+
+
#define _(msgid) gettext (msgid)
#define N_(msgid) msgid
g_signal_connect (de->invoke_compute_dialog, "activate",
G_CALLBACK (compute_dialog), de);
+
+
+ de->invoke_t_test_independent_samples_dialog =
+ gtk_action_new ("t-test-independent-samples",
+ _("_Independent Samples T Test"),
+ _("Calculate T Test for samples from independent groups"),
+ NULL);
+
+ g_signal_connect (de->invoke_t_test_independent_samples_dialog, "activate",
+ G_CALLBACK (t_test_independent_samples_dialog), de);
+
+
de->invoke_comments_dialog =
gtk_action_new ("commments-dialog",
_("Data File Comments"),
get_widget_assert (de->xml, "transform_compute")
);
+ gtk_action_connect_proxy (de->invoke_t_test_independent_samples_dialog,
+ get_widget_assert (de->xml,
+ "indep-t-test")
+ );
+
+
gtk_action_connect_proxy (de->invoke_comments_dialog,
get_widget_assert (de->xml, "utilities_comments")
);
</widget>
</child>
<child>
- <widget class="GtkMenuItem" id="one-way-anova">
+ <widget class="GtkMenuItem" id="oneway-anova">
<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">One Way _ANOVA</property>
GtkAction *invoke_find_dialog;
GtkAction *invoke_descriptives_dialog;
+ GtkAction *invoke_t_test_independent_samples_dialog;
+
+
/* Actions which do things */
GtkAction *insert_variable;
GtkAction *insert_case;
g_signal_connect_swapped (dest, "activate", G_CALLBACK (refilter),
selector);
+ g_signal_connect_swapped (dest, "changed", G_CALLBACK (refilter),
+ selector);
+
g_signal_connect (dest, "focus-in-event", G_CALLBACK (on_entry_dest_select),
selector);
--- /dev/null
+/* PSPPIRE - a graphical user interface for PSPP.
+ Copyright (C) 2007 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 <glade/glade.h>
+#include <gtk/gtk.h>
+#include "t-test-independent-samples-dialog.h"
+#include "psppire-dict.h"
+#include "psppire-var-store.h"
+#include "helper.h"
+#include <gtksheet/gtksheet.h>
+#include "data-editor.h"
+#include "psppire-dialog.h"
+#include "dialog-common.h"
+#include "dict-display.h"
+#include "widget-io.h"
+
+#include <language/syntax-string-source.h>
+#include "syntax-editor.h"
+
+#include <gettext.h>
+#define _(msgid) gettext (msgid)
+#define N_(msgid) msgid
+
+
+struct tt_indep_samples_dialog
+{
+ GladeXML *xml; /* The xml that generated the widgets */
+ PsppireDict *dict;
+ gboolean groups_defined;
+ gboolean non_default_options;
+ gdouble confidence_interval;
+};
+
+
+static gchar *
+generate_syntax (const struct tt_indep_samples_dialog *d)
+{
+ gchar *text;
+ GtkWidget *entry =
+ get_widget_assert (d->xml, "indep-samples-t-test-entry");
+
+ GtkWidget *tv =
+ get_widget_assert (d->xml, "indep-samples-t-test-treeview2");
+
+ GString *str = g_string_new ("T-TEST /VARIABLES=");
+
+ append_variable_names (str, d->dict, GTK_TREE_VIEW (tv));
+
+ g_string_append (str, "\n\t/GROUPS=");
+
+ g_string_append (str, gtk_entry_get_text (GTK_ENTRY (entry)));
+
+ if ( d->groups_defined )
+ {
+ GtkWidget *entry1 = get_widget_assert (d->xml, "group1-entry");
+ GtkWidget *entry2 = get_widget_assert (d->xml, "group2-entry");
+
+ g_string_append (str, "(");
+ g_string_append (str, gtk_entry_get_text (GTK_ENTRY (entry1)));
+ g_string_append (str, ",");
+ g_string_append (str, gtk_entry_get_text (GTK_ENTRY (entry2)));
+ g_string_append (str, ")");
+ }
+
+ if ( d->non_default_options )
+ {
+ GtkToggleButton *analysis =
+ GTK_TOGGLE_BUTTON (get_widget_assert (d->xml, "radiobutton1"));
+
+ g_string_append (str, "\n\t");
+ g_string_append_printf (str, "/CRITERIA=CIN(%g)",
+ d->confidence_interval/100.0);
+
+
+ g_string_append (str, "\n\t");
+ g_string_append_printf (str, "/MISSING=%s",
+ gtk_toggle_button_get_active (analysis) ?
+ "ANALYSIS" : "LISTWISE");
+ }
+
+ g_string_append (str, ".\n");
+
+ text = str->str;
+
+ g_string_free (str, FALSE);
+
+ return text;
+}
+
+
+
+static void
+refresh (GladeXML *xml)
+{
+ GtkWidget *entry =
+ get_widget_assert (xml, "indep-samples-t-test-entry");
+
+ GtkWidget *tv =
+ get_widget_assert (xml, "indep-samples-t-test-treeview2");
+
+ GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (tv));
+
+ gtk_entry_set_text (GTK_ENTRY (entry), "");
+
+ gtk_list_store_clear (GTK_LIST_STORE (model));
+}
+
+
+static gboolean
+define_groups_state_valid (gpointer data)
+{
+ struct tt_indep_samples_dialog *d = data;
+
+ GtkWidget *entry1 = get_widget_assert (d->xml, "group1-entry");
+ GtkWidget *entry2 = get_widget_assert (d->xml, "group2-entry");
+
+ if ( 0 == strcmp ("", gtk_entry_get_text (GTK_ENTRY (entry1))))
+ return FALSE;
+
+ if ( 0 == strcmp ("", gtk_entry_get_text (GTK_ENTRY (entry2))))
+ return FALSE;
+
+ return TRUE;
+}
+
+static void
+run_define_groups (struct tt_indep_samples_dialog *ttd)
+{
+ gint response;
+ GtkWidget *dialog =
+ get_widget_assert (ttd->xml, "define-groups-dialog");
+
+
+ psppire_dialog_set_valid_predicate (PSPPIRE_DIALOG (dialog),
+ define_groups_state_valid, ttd);
+
+ response = psppire_dialog_run (PSPPIRE_DIALOG (dialog));
+
+ ttd->groups_defined = (response == PSPPIRE_RESPONSE_CONTINUE);
+}
+
+
+static void
+run_options (struct tt_indep_samples_dialog *ttd)
+{
+ gint response;
+ GtkWidget *dialog =
+ get_widget_assert (ttd->xml, "options-dialog");
+
+ GtkWidget *box =
+ get_widget_assert (ttd->xml, "vbox1");
+
+ GtkSpinButton *conf_percent = NULL;
+
+ GtkWidget *confidence =
+ widget_scanf (_("Confidence Interval: %2d %%"),
+ &conf_percent);
+
+ gtk_spin_button_set_value (conf_percent, ttd->confidence_interval);
+
+ gtk_widget_show (confidence);
+
+ gtk_box_pack_start_defaults (GTK_BOX (box), confidence);
+
+ response = psppire_dialog_run (PSPPIRE_DIALOG (dialog));
+
+ if ( response == PSPPIRE_RESPONSE_CONTINUE)
+ {
+ ttd->non_default_options = TRUE;
+ ttd->confidence_interval = gtk_spin_button_get_value (conf_percent);
+ }
+
+ gtk_container_remove (GTK_CONTAINER (box), confidence);
+}
+
+
+
+
+static gboolean
+dialog_state_valid (gpointer data)
+{
+ struct tt_indep_samples_dialog *tt_d = data;
+
+ GtkWidget *entry =
+ get_widget_assert (tt_d->xml, "indep-samples-t-test-entry");
+
+ GtkWidget *tv_vars =
+ get_widget_assert (tt_d->xml, "indep-samples-t-test-treeview2");
+
+ GtkTreeModel *vars = gtk_tree_view_get_model (GTK_TREE_VIEW (tv_vars));
+
+ GtkTreeIter notused;
+
+ if ( 0 == strcmp ("", gtk_entry_get_text (GTK_ENTRY (entry))))
+ return FALSE;
+
+
+ if ( 0 == gtk_tree_model_get_iter_first (vars, ¬used))
+ return FALSE;
+
+ return TRUE;
+}
+
+
+/* Pops up the dialog box */
+void
+t_test_independent_samples_dialog (GObject *o, gpointer data)
+{
+ struct tt_indep_samples_dialog tt_d;
+ gint response;
+ struct data_editor *de = data;
+
+ PsppireVarStore *vs;
+
+ GladeXML *xml = XML_NEW ("t-test.glade");
+
+ GtkWidget *dialog = get_widget_assert (xml,
+ "t-test-independent-samples-dialog");
+
+ GtkSheet *var_sheet =
+ GTK_SHEET (get_widget_assert (de->xml, "variable_sheet"));
+
+ GtkWidget *dict_view =
+ get_widget_assert (xml, "indep-samples-t-test-treeview1");
+
+ GtkWidget *test_variables_treeview =
+ get_widget_assert (xml, "indep-samples-t-test-treeview2");
+
+ GtkWidget *selector2 =
+ get_widget_assert (xml, "indep-samples-t-test-selector2");
+
+ GtkWidget *selector1 =
+ get_widget_assert (xml, "indep-samples-t-test-selector1");
+
+
+ GtkWidget *entry =
+ get_widget_assert (xml, "indep-samples-t-test-entry");
+
+ GtkWidget *define_groups_button =
+ get_widget_assert (xml, "define-groups-button");
+
+ GtkWidget *options_button =
+ get_widget_assert (xml, "options-button");
+
+ vs = PSPPIRE_VAR_STORE (gtk_sheet_get_model (var_sheet));
+
+ tt_d.xml = xml;
+ tt_d.dict = vs->dict;
+ tt_d.groups_defined = FALSE;
+ tt_d.non_default_options = FALSE;
+ tt_d.confidence_interval = 95.0;
+
+ gtk_window_set_transient_for (GTK_WINDOW (dialog), de->parent.window);
+
+ attach_dictionary_to_treeview (GTK_TREE_VIEW (dict_view),
+ vs->dict,
+ GTK_SELECTION_MULTIPLE, NULL);
+
+ set_dest_model (GTK_TREE_VIEW (test_variables_treeview), vs->dict);
+
+
+ psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector1),
+ dict_view, test_variables_treeview,
+ insert_source_row_into_tree_view,
+ NULL);
+
+
+ psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector2),
+ dict_view, entry,
+ insert_source_row_into_entry,
+ is_currently_in_entry);
+
+ g_signal_connect_swapped (define_groups_button, "clicked",
+ G_CALLBACK (run_define_groups), &tt_d);
+
+
+ g_signal_connect_swapped (options_button, "clicked",
+ G_CALLBACK (run_options), &tt_d);
+
+
+ g_signal_connect_swapped (dialog, "refresh", G_CALLBACK (refresh), xml);
+
+
+ psppire_dialog_set_valid_predicate (PSPPIRE_DIALOG (dialog),
+ dialog_state_valid, &tt_d);
+
+ response = psppire_dialog_run (PSPPIRE_DIALOG (dialog));
+
+ switch (response)
+ {
+ case GTK_RESPONSE_OK:
+ {
+ gchar *syntax = generate_syntax (&tt_d);
+ struct getl_interface *sss = create_syntax_string_source (syntax);
+ execute_syntax (sss);
+
+ g_free (syntax);
+ }
+ break;
+ case PSPPIRE_RESPONSE_PASTE:
+ {
+ gchar *syntax = generate_syntax (&tt_d);
+
+ struct syntax_editor *se =
+ (struct syntax_editor *) window_create (WINDOW_SYNTAX, NULL);
+
+ gtk_text_buffer_insert_at_cursor (se->buffer, syntax, -1);
+
+ g_free (syntax);
+ }
+ break;
+ default:
+ break;
+ }
+
+
+ g_object_unref (xml);
+}
+
+
--- /dev/null
+#ifndef T_TEST_INDEPENDENT_SAMPLES_DIALOG
+#define T_TEST_INDEPENDENT_SAMPLES_DIALOG
+
+void t_test_independent_samples_dialog (GObject *, gpointer) ;
+
+#endif
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
+<!--*- mode: xml -*-->
+<glade-interface>
+ <requires lib="psppire"/>
+ <widget class="PsppireDialog" id="t-test-independent-samples-dialog">
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="title">Independent-Samples T Test</property>
+ <property name="modal">True</property>
+ <child internal-child="hbox">
+ <widget class="GtkHBox" id="dialog-hbox15">
+ <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>
+ <widget class="GtkHBox" id="hbox23">
+ <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">5</property>
+ <child>
+ <widget class="GtkScrolledWindow" id="scrolledwindow14">
+ <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">GTK_POLICY_NEVER</property>
+ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
+ <child>
+ <widget class="GtkTreeView" id="indep-samples-t-test-treeview1">
+ <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">True</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkTable" id="table4">
+ <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">2</property>
+ <child>
+ <widget 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">GTK_BUTTONBOX_SPREAD</property>
+ <child>
+ <widget class="GtkButton" id="define-groups-button">
+ <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="label" translatable="yes">Define Groups</property>
+ <property name="response_id">0</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="options-button">
+ <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="label" translatable="yes">Options...</property>
+ <property name="response_id">0</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="y_options">GTK_FILL</property>
+ <property name="y_padding">5</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="PsppireSelector" id="indep-samples-t-test-selector1">
+ <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="border_width">5</property>
+ </widget>
+ <packing>
+ <property name="x_options"></property>
+ <property name="y_options">GTK_EXPAND</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="PsppireSelector" id="indep-samples-t-test-selector2">
+ <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="border_width">5</property>
+ </widget>
+ <packing>
+ <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>
+ <widget class="GtkVBox" id="vbox29">
+ <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>
+ <child>
+ <widget class="GtkLabel" id="label35">
+ <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="xalign">0</property>
+ <property name="label" translatable="yes">Test Variable(s):</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkScrolledWindow" id="scrolledwindow15">
+ <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">GTK_POLICY_AUTOMATIC</property>
+ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
+ <child>
+ <widget class="GtkTreeView" id="indep-samples-t-test-treeview2">
+ <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>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vbox30">
+ <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>
+ <child>
+ <widget class="GtkLabel" id="label36">
+ <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="xalign">0</property>
+ <property name="label" translatable="yes">Grouping Variable:</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkEntry" id="indep-samples-t-test-entry">
+ <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>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <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="y_options"></property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="PsppireVButtonBox" id="psppire-vbuttonbox2">
+ <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="border_width">5</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <widget class="PsppireDialog" id="define-groups-dialog">
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="title">Define Groups</property>
+ <property name="modal">True</property>
+ <child internal-child="hbox">
+ <widget class="GtkHBox" id="dialog-hbox2">
+ <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>
+ <widget 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">2</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">5</property>
+ <child>
+ <widget class="GtkLabel" id="label2">
+ <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">Group_2 value:</property>
+ <property name="use_underline">True</property>
+ </widget>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget 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">Group_1 value:</property>
+ <property name="use_underline">True</property>
+ </widget>
+ <packing>
+ <property name="x_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkEntry" id="group2-entry">
+ <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>
+ </widget>
+ <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>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkEntry" id="group1-entry">
+ <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>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">5</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="PsppireVButtonBox" id="psppire-vbuttonbox1">
+ <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="border_width">5</property>
+ <property name="buttons">PSPPIRE_BUTTON_CONTINUE_MASK | PSPPIRE_BUTTON_CANCEL_MASK | PSPPIRE_BUTTON_HELP_MASK</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <widget class="PsppireDialog" id="options-dialog">
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="title">Options</property>
+ <property name="modal">True</property>
+ <child internal-child="hbox">
+ <widget class="GtkHBox" id="dialog-hbox3">
+ <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>
+ <widget class="GtkVBox" id="vbox1">
+ <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>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <widget class="GtkFrame" id="frame1">
+ <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>
+ <child>
+ <widget class="GtkAlignment" id="alignment1">
+ <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>
+ <widget class="GtkVButtonBox" id="vbuttonbox1">
+ <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">GTK_BUTTONBOX_SPREAD</property>
+ <child>
+ <widget class="GtkRadioButton" id="radiobutton1">
+ <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="label" translatable="yes">Exclude cases _analysis by analysis</property>
+ <property name="use_underline">True</property>
+ <property name="response_id">0</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkRadioButton" id="radiobutton2">
+ <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="label" translatable="yes">Exclude cases _listwise</property>
+ <property name="use_underline">True</property>
+ <property name="response_id">0</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">radiobutton1</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget 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">Missing Values</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="type">label_item</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="pack_type">GTK_PACK_END</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="PsppireVButtonBox" id="psppire-vbuttonbox3">
+ <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="border_width">5</property>
+ <property name="homogeneous">True</property>
+ <property name="buttons">PSPPIRE_BUTTON_CONTINUE_MASK | PSPPIRE_BUTTON_CANCEL_MASK | PSPPIRE_BUTTON_HELP_MASK</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+</glade-interface>
#include <gl/gettext.h>
+/* Create a GtkLabel and pack it into BOX.
+ The label is created using part of the string at S, and the directives
+ at DIRS[DIR_IDX] and subsequent.
+ After this function returns, *S points to the first unused character.
+*/
static void
-ship_label (GtkBox *box, const char **s, const char_directive *dir)
+ship_label (GtkBox *box, const char **s,
+ const char_directives *dirs, size_t dir_idx)
{
GtkWidget *label ;
- gchar *text = g_strdup (*s);
+ GString *str = g_string_new (*s);
- if ( dir )
+ if ( dirs)
{
- text [ dir->dir_start - *s ] = '\0';
- *s = dir->dir_end;
+ char_directive dir = dirs->dir[dir_idx];
+ int n = 0;
+
+ while (dir_idx < dirs->count && dir.conversion == '%' )
+ {
+ g_string_erase (str, dir.dir_start - *s, 1);
+ dir = dirs->dir[++dir_idx];
+ n++;
+ }
+
+ g_string_truncate (str, dir.dir_start - *s - n);
+
+ if ( dir_idx >= dirs->count)
+ *s = NULL;
+ else
+ *s = dir.dir_end;
}
- label = gtk_label_new (text);
- g_free (text);
+ label = gtk_label_new (str->str);
+
+ g_string_free (str, TRUE);
gtk_box_pack_start (box, label, FALSE, FALSE, 0);
gtk_widget_show (label);
va_end (ap);
+
for (i = 0 ; i < d.count ; ++i )
{
char_directive dir = d.dir[i];
width = strtol (dir.width_start, (char **) &dir.width_end, 10);
if ( dir.dir_start > s )
- ship_label (GTK_BOX (hbox), &s, &dir);
+ ship_label (GTK_BOX (hbox), &s, &d, i);
if ( dir.conversion == '%')
{
- s++;
+ if (s) s++;
continue;
}
gtk_widget_show (*w);
}
- if ( *s )
- ship_label (GTK_BOX (hbox), &s, NULL);
+ if ( s && *s )
+ ship_label (GTK_BOX (hbox), &s, NULL, 0);
+
g_free (widgets);