pspp-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pspp-cvs] pspp/src/ui/gui ChangeLog automake.mk data-edit...


From: John Darrington
Subject: [Pspp-cvs] pspp/src/ui/gui ChangeLog automake.mk data-edit...
Date: Mon, 10 Dec 2007 10:21:06 +0000

CVSROOT:        /sources/pspp
Module name:    pspp
Changes by:     John Darrington <jmd>   07/12/10 10:21:06

Modified files:
        src/ui/gui     : ChangeLog automake.mk data-editor.c 
                         data-editor.h 
                         t-test-independent-samples-dialog.c 
                         t-test.glade 
Added files:
        src/ui/gui     : t-test-one-sample.c t-test-one-sample.h 
                         t-test-options.c t-test-options.h 

Log message:
        Added the One Sample T Test dialog

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/ChangeLog?cvsroot=pspp&r1=1.99&r2=1.100
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/automake.mk?cvsroot=pspp&r1=1.42&r2=1.43
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/data-editor.c?cvsroot=pspp&r1=1.56&r2=1.57
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/data-editor.h?cvsroot=pspp&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/t-test-independent-samples-dialog.c?cvsroot=pspp&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/t-test.glade?cvsroot=pspp&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/t-test-one-sample.c?cvsroot=pspp&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/t-test-one-sample.h?cvsroot=pspp&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/t-test-options.c?cvsroot=pspp&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/t-test-options.h?cvsroot=pspp&rev=1.1

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/ChangeLog,v
retrieving revision 1.99
retrieving revision 1.100
diff -u -b -r1.99 -r1.100
--- ChangeLog   7 Dec 2007 04:11:25 -0000       1.99
+++ ChangeLog   10 Dec 2007 10:21:05 -0000      1.100
@@ -1,3 +1,16 @@
+2007-12-08  John Darrington <address@hidden>
+
+       * data-editor.h data-editor.c: Added hooks for one sample t-test
+
+       * t-test-one-sample.c t-test-one-sample.h (new files): Implemented
+       a dialog box for the One Sample T Test.
+
+       * t-test-independent-samples-dialog.c: Factored out the options sub
+       dialog (see following).
+
+       * t-test-options.c t-test-options.h (new files):  New module
+        implementing the options sub-dialog for T tests.
+
 2007-12-07  John Darrington <address@hidden>
 
        * frequencies-dialog.c: Made the options subdialog transient

Index: automake.mk
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/automake.mk,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -b -r1.42 -r1.43
--- automake.mk 1 Dec 2007 04:42:19 -0000       1.42
+++ automake.mk 10 Dec 2007 10:21:05 -0000      1.43
@@ -157,6 +157,10 @@
        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/t-test-one-sample.c \
+       src/ui/gui/t-test-one-sample.h \
+       src/ui/gui/t-test-options.c \
+       src/ui/gui/t-test-options.h \
        src/ui/gui/val-labs-dialog.c \
        src/ui/gui/val-labs-dialog.h \
        src/ui/gui/var-display.c \

Index: data-editor.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/data-editor.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -b -r1.56 -r1.57
--- data-editor.c       1 Dec 2007 04:42:19 -0000       1.56
+++ data-editor.c       10 Dec 2007 10:21:05 -0000      1.57
@@ -49,6 +49,7 @@
 
 #include "oneway-anova-dialog.h"
 #include "t-test-independent-samples-dialog.h"
+#include "t-test-one-sample.h"
 
 #define _(msgid) gettext (msgid)
 #define N_(msgid) msgid
@@ -612,6 +613,16 @@
                    G_CALLBACK (t_test_independent_samples_dialog), de);
 
 
+  de->invoke_t_test_one_sample_dialog =
+    gtk_action_new ("t-test-one-sample",
+                   _("One _Sample T Test"),
+                   _("Calculate T Test for sample from a single distribution"),
+                   NULL);
+
+  g_signal_connect (de->invoke_t_test_one_sample_dialog, "activate",
+                   G_CALLBACK (t_test_one_sample_dialog), de);
+
+
   de->invoke_comments_dialog =
     gtk_action_new ("commments-dialog",
                    _("Data File Comments"),
@@ -818,6 +829,12 @@
                            );
 
 
+  gtk_action_connect_proxy (de->invoke_t_test_one_sample_dialog,
+                           get_widget_assert (de->xml,
+                                              "one-sample-t-test")
+                           );
+
+
   gtk_action_connect_proxy (de->invoke_oneway_anova_dialog,
                            get_widget_assert (de->xml,
                                               "oneway-anova")

Index: data-editor.h
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/data-editor.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- data-editor.h       1 Dec 2007 04:42:20 -0000       1.26
+++ data-editor.h       10 Dec 2007 10:21:05 -0000      1.27
@@ -51,6 +51,7 @@
 
   GtkAction *invoke_t_test_independent_samples_dialog;
   GtkAction *invoke_oneway_anova_dialog;
+  GtkAction *invoke_t_test_one_sample_dialog;
 
 
   /* Actions which do things */

Index: t-test-independent-samples-dialog.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/t-test-independent-samples-dialog.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- t-test-independent-samples-dialog.c 12 Oct 2007 05:05:32 -0000      1.4
+++ t-test-independent-samples-dialog.c 10 Dec 2007 10:21:05 -0000      1.5
@@ -29,6 +29,7 @@
 #include "dialog-common.h"
 #include "dict-display.h"
 #include "widget-io.h"
+#include "t-test-options.h"
 
 #include <language/syntax-string-source.h>
 #include "syntax-editor.h"
@@ -44,8 +45,8 @@
   GtkWidget *dialog;
   PsppireDict *dict;
   gboolean groups_defined;
-  gboolean non_default_options;
-  gdouble confidence_interval;
+
+  struct tt_options_dialog *opts;
 };
 
 
@@ -79,21 +80,8 @@
       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");
-    }
+  tt_options_dialog_append_syntax (d->opts, str);
 
   g_string_append (str, ".\n");
 
@@ -159,43 +147,6 @@
 }
 
 
-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);
-
-  gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (ttd->dialog));
-
-  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)
@@ -250,7 +201,6 @@
   GtkWidget *selector1 =
     get_widget_assert (xml, "indep-samples-t-test-selector1");
 
-
   GtkWidget *entry =
     get_widget_assert (xml, "indep-samples-t-test-entry");
 
@@ -266,8 +216,7 @@
   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;
+  tt_d.opts = tt_options_dialog_create (xml, de->parent.window);
 
   gtk_window_set_transient_for (GTK_WINDOW (tt_d.dialog), de->parent.window);
 
@@ -294,7 +243,7 @@
 
 
   g_signal_connect_swapped (options_button, "clicked",
-                           G_CALLBACK (run_options), &tt_d);
+                           G_CALLBACK (tt_options_dialog_run), tt_d.opts);
 
 
   g_signal_connect_swapped (tt_d.dialog, "refresh", G_CALLBACK (refresh),  
xml);
@@ -332,7 +281,7 @@
       break;
     }
 
-
+  tt_options_dialog_destroy (tt_d.opts);
   g_object_unref (xml);
 }
 

Index: t-test.glade
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/t-test.glade,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- t-test.glade        10 Oct 2007 10:22:29 -0000      1.1
+++ t-test.glade        10 Dec 2007 10:21:06 -0000      1.2
@@ -43,18 +43,15 @@
                 <property name="n_rows">3</property>
                 <property name="n_columns">2</property>
                 <child>
-                  <widget class="GtkHButtonBox" id="hbuttonbox1">
+                  <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>
-                    <property 
name="layout_style">GTK_BUTTONBOX_SPREAD</property>
                     <child>
-                      <widget class="GtkButton" id="define-groups-button">
+                      <widget class="GtkLabel" id="label36">
                         <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>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">Grouping 
Variable:</property>
                       </widget>
                       <packing>
                         <property name="expand">False</property>
@@ -62,54 +59,21 @@
                       </packing>
                     </child>
                     <child>
-                      <widget class="GtkButton" id="options-button">
+                      <widget class="GtkEntry" id="indep-samples-t-test-entry">
                         <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="left_attach">1</property>
                     <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>
@@ -157,15 +121,45 @@
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkVBox" id="vbox30">
+                  <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="GtkLabel" id="label36">
+                  <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="xalign">0</property>
-                        <property name="label" translatable="yes">Grouping 
Variable:</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="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>
                       </widget>
                       <packing>
                         <property name="expand">False</property>
@@ -173,22 +167,26 @@
                       </packing>
                     </child>
                     <child>
-                      <widget class="GtkEntry" id="indep-samples-t-test-entry">
+                      <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>
                       </widget>
                       <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
                         <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>
+                    <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>
               </widget>
@@ -231,16 +229,27 @@
             <property name="n_columns">2</property>
             <property name="column_spacing">5</property>
             <child>
-              <widget class="GtkLabel" id="label2">
+              <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>
-                <property name="label" translatable="yes">Group_2 
value:</property>
-                <property name="use_underline">True</property>
               </widget>
               <packing>
+                <property name="left_attach">1</property>
+                <property name="right_attach">2</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>
-                <property name="x_options"></property>
               </packing>
             </child>
             <child>
@@ -255,27 +264,16 @@
               </packing>
             </child>
             <child>
-              <widget class="GtkEntry" id="group2-entry">
+              <widget class="GtkLabel" id="label2">
                 <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">Group_2 
value:</property>
+                <property name="use_underline">True</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>
+                <property name="x_options"></property>
               </packing>
             </child>
           </widget>
@@ -320,7 +318,6 @@
               <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>
@@ -338,7 +335,6 @@
                             <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>
@@ -350,7 +346,6 @@
                             <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>
@@ -400,4 +395,178 @@
       </widget>
     </child>
   </widget>
+  <widget class="PsppireDialog" id="t-test-one-sample-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">One - Sample T Test</property>
+    <property name="modal">True</property>
+    <property name="orientation">PSPPIRE_TABULAR</property>
+    <child internal-child="hbox">
+      <widget class="GtkTable" id="dialog-hbox5">
+        <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">4</property>
+        <child>
+          <widget class="GtkAlignment" id="alignment3">
+            <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="yalign">0.059999998658895493</property>
+            <property name="yscale">0</property>
+            <child>
+              <widget class="PsppireSelector" id="psppire-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="no_show_all">True</property>
+                <property name="border_width">5</property>
+              </widget>
+            </child>
+          </widget>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="right_attach">2</property>
+            <property name="bottom_attach">2</property>
+          </packing>
+        </child>
+        <child>
+          <widget class="GtkButton" id="button1">
+            <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>
+          </widget>
+          <packing>
+            <property name="left_attach">3</property>
+            <property name="right_attach">4</property>
+            <property name="top_attach">1</property>
+            <property name="bottom_attach">2</property>
+            <property name="y_options"></property>
+            <property name="x_padding">5</property>
+            <property name="y_padding">5</property>
+          </packing>
+        </child>
+        <child>
+          <widget class="GtkHBox" id="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>
+            <child>
+              <widget class="GtkLabel" id="label7">
+                <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 Value: 
</property>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkEntry" id="test-value-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="expand">False</property>
+                <property name="fill">False</property>
+                <property name="padding">5</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </widget>
+          <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>
+            <property name="y_options"></property>
+          </packing>
+        </child>
+        <child>
+          <widget class="GtkScrolledWindow" id="scrolledwindow4">
+            <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="one-sample-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="bottom_attach">2</property>
+            <property name="x_padding">5</property>
+            <property name="y_padding">5</property>
+          </packing>
+        </child>
+        <child>
+          <widget 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="shadow_type">GTK_SHADOW_NONE</property>
+            <child>
+              <widget class="GtkAlignment" id="alignment2">
+                <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="GtkScrolledWindow" id="scrolledwindow3">
+                    <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="one-sample-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>
+                      </widget>
+                    </child>
+                  </widget>
+                </child>
+              </widget>
+            </child>
+            <child>
+              <widget class="GtkLabel" id="label6">
+                <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">Test 
Variable(s):</property>
+                <property name="use_markup">True</property>
+              </widget>
+              <packing>
+                <property name="type">label_item</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="left_attach">2</property>
+            <property name="right_attach">3</property>
+          </packing>
+        </child>
+        <child>
+          <widget class="PsppireVButtonBox" id="psppire-vbuttonbox5">
+            <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="left_attach">3</property>
+            <property name="right_attach">4</property>
+          </packing>
+        </child>
+      </widget>
+    </child>
+  </widget>
 </glade-interface>

Index: t-test-one-sample.c
===================================================================
RCS file: t-test-one-sample.c
diff -N t-test-one-sample.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ t-test-one-sample.c 10 Dec 2007 10:21:05 -0000      1.1
@@ -0,0 +1,214 @@
+/* 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 <config.h>
+#include <glade/glade.h>
+#include <gtk/gtk.h>
+#include "t-test-one-sample.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 "t-test-options.h"
+#include <language/syntax-string-source.h>
+#include "syntax-editor.h"
+
+#include <gettext.h>
+#define _(msgid) gettext (msgid)
+#define N_(msgid) msgid
+
+
+struct tt_one_sample_dialog
+{
+  PsppireDict *dict;
+  GtkWidget *vars_treeview;
+  GtkWidget *test_value_entry;
+  struct tt_options_dialog *opt;
+};
+
+
+static gchar *
+generate_syntax (const struct tt_one_sample_dialog *d)
+{
+  gchar *text;
+
+  GString *str = g_string_new ("T-TEST ");
+
+  g_string_append_printf (str, "/TESTVAL=%s",
+                         gtk_entry_get_text (GTK_ENTRY (d->test_value_entry)));
+
+  g_string_append (str, "\n\t/VARIABLES=");
+
+  append_variable_names (str, d->dict, GTK_TREE_VIEW (d->vars_treeview));
+
+  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
+refresh (const struct tt_one_sample_dialog *d)
+{
+  GtkTreeModel *model =
+    gtk_tree_view_get_model (GTK_TREE_VIEW (d->vars_treeview));
+
+  gtk_entry_set_text (GTK_ENTRY (d->test_value_entry), "");
+
+  gtk_list_store_clear (GTK_LIST_STORE (model));
+}
+
+
+
+static gboolean
+dialog_state_valid (gpointer data)
+{
+  gchar *s = NULL;
+  const gchar *text;
+  struct tt_one_sample_dialog *tt_d = data;
+
+  GtkTreeModel *vars =
+    gtk_tree_view_get_model (GTK_TREE_VIEW (tt_d->vars_treeview));
+
+  GtkTreeIter notused;
+
+  text = gtk_entry_get_text (GTK_ENTRY (tt_d->test_value_entry));
+
+  if ( 0 == strcmp ("", text))
+    return FALSE;
+
+  /* Check to see if the entry is numeric */
+  g_strtod (text, &s);
+
+  if (s - text != strlen (text))
+    return FALSE;
+
+
+  if ( 0 == gtk_tree_model_get_iter_first (vars, &notused))
+    return FALSE;
+
+  return TRUE;
+}
+
+
+/* Pops up the dialog box */
+void
+t_test_one_sample_dialog (GObject *o, gpointer data)
+{
+  struct tt_one_sample_dialog tt_d;
+  gint response;
+  struct data_editor *de = data;
+
+  PsppireVarStore *vs;
+
+  GladeXML *xml = XML_NEW ("t-test.glade");
+
+  GtkSheet *var_sheet =
+    GTK_SHEET (get_widget_assert (de->xml, "variable_sheet"));
+
+  GtkWidget *dict_view =
+    get_widget_assert (xml, "one-sample-t-test-treeview2");
+
+  GtkWidget *options_button =
+    get_widget_assert (xml, "button1");
+
+  GtkWidget *selector = get_widget_assert (xml, "psppire-selector1");
+
+  GtkWidget *dialog = get_widget_assert (xml, "t-test-one-sample-dialog");
+
+  vs = PSPPIRE_VAR_STORE (gtk_sheet_get_model (var_sheet));
+
+  tt_d.dict = vs->dict;
+  tt_d.vars_treeview = get_widget_assert (xml, "one-sample-t-test-treeview1");
+  tt_d.test_value_entry = get_widget_assert (xml, "test-value-entry");
+  tt_d.opt = tt_options_dialog_create (xml, de->parent.window);
+
+  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,
+                                var_is_numeric);
+
+  set_dest_model (GTK_TREE_VIEW (tt_d.vars_treeview), vs->dict);
+
+
+  psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector),
+                                dict_view, tt_d.vars_treeview,
+                                insert_source_row_into_tree_view,
+                                NULL);
+
+
+  g_signal_connect_swapped (dialog, "refresh",
+                           G_CALLBACK (refresh),  &tt_d);
+
+
+  g_signal_connect_swapped (options_button, "clicked",
+                           G_CALLBACK (tt_options_dialog_run), tt_d.opt);
+
+  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);
+  tt_options_dialog_destroy (tt_d.opt);
+}
+
+

Index: t-test-one-sample.h
===================================================================
RCS file: t-test-one-sample.h
diff -N t-test-one-sample.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ t-test-one-sample.h 10 Dec 2007 10:21:05 -0000      1.1
@@ -0,0 +1,6 @@
+#ifndef T_TEST_ONE_SAMPLE_DIALOG
+#define T_TEST_ONE_SAMPLE_DIALOG
+
+void t_test_one_sample_dialog (GObject *, gpointer) ;
+
+#endif

Index: t-test-options.c
===================================================================
RCS file: t-test-options.c
diff -N t-test-options.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ t-test-options.c    10 Dec 2007 10:21:05 -0000      1.1
@@ -0,0 +1,130 @@
+/* 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 <config.h>
+#include <gtk/gtk.h>
+
+#include "psppire-dialog.h"
+#include <gl/xalloc.h>
+#include "helper.h"
+#include "t-test-options.h"
+
+#include "widget-io.h"
+
+#include <gettext.h>
+#define _(msgid) gettext (msgid)
+#define N_(msgid) msgid
+
+
+enum exclude_mode
+  {
+    EXCL_ANALYSIS,
+    EXCL_LISTWISE
+  };
+
+struct tt_options_dialog
+{
+  GtkWidget *dialog;
+  GtkWidget *box;
+  GtkWidget *confidence;
+  GtkSpinButton *conf_percent;
+  GtkToggleButton *analysis;
+  GtkToggleButton *listwise;
+
+  gdouble confidence_interval;
+  gboolean non_default_options;
+  enum exclude_mode excl;
+};
+
+struct tt_options_dialog *
+tt_options_dialog_create (GladeXML *xml, GtkWindow *parent)
+{
+  struct tt_options_dialog *tto = xmalloc (sizeof (*tto));
+
+  tto->confidence =
+    widget_scanf (_("Confidence Interval: %2d %%"),
+                 &tto->conf_percent);
+
+  tto->dialog = get_widget_assert (xml, "options-dialog");
+
+  tto->box =   get_widget_assert (xml, "vbox1");
+
+  tto->analysis = GTK_TOGGLE_BUTTON (get_widget_assert (xml, "radiobutton1"));
+  tto->listwise = GTK_TOGGLE_BUTTON (get_widget_assert (xml, "radiobutton2"));
+
+  gtk_widget_show (tto->confidence);
+
+  gtk_box_pack_start_defaults (GTK_BOX (tto->box), tto->confidence);
+
+  gtk_window_set_transient_for (parent, GTK_WINDOW (tto->dialog));
+
+  tto->confidence_interval = 95;
+  tto->excl = EXCL_ANALYSIS;
+
+  return tto;
+}
+
+
+void
+tt_options_dialog_destroy (struct tt_options_dialog *tto)
+{
+  gtk_container_remove (GTK_CONTAINER (tto->box), tto->confidence);
+  g_free (tto);
+}
+
+
+void
+tt_options_dialog_run (struct tt_options_dialog *tto)
+{
+  gint response;
+
+  if ( tto->excl == EXCL_ANALYSIS)
+    gtk_toggle_button_set_active (tto->analysis, TRUE);
+  else
+    gtk_toggle_button_set_active (tto->listwise, TRUE);
+
+  gtk_spin_button_set_value (tto->conf_percent, tto->confidence_interval);
+
+  response = psppire_dialog_run (PSPPIRE_DIALOG (tto->dialog));
+
+  if ( response == PSPPIRE_RESPONSE_CONTINUE)
+    {
+      tto->non_default_options = TRUE;
+
+      tto->confidence_interval = gtk_spin_button_get_value (tto->conf_percent);
+      if ( gtk_toggle_button_get_active (tto->analysis) )
+       tto->excl = EXCL_ANALYSIS;
+      else
+       tto->excl = EXCL_LISTWISE;
+    }
+}
+
+void
+tt_options_dialog_append_syntax (struct tt_options_dialog *tto, GString *str)
+{
+  g_string_append (str, "\t/MISSING=");
+
+  if ( tto->excl == EXCL_ANALYSIS )
+    g_string_append (str, "ANALYSIS");
+  else
+    g_string_append (str, "LISTWISE");
+
+
+  g_string_append_printf (str, "\n\t/CRITERIA=CIN(%g)",
+                         tto->confidence_interval/100.0);
+}

Index: t-test-options.h
===================================================================
RCS file: t-test-options.h
diff -N t-test-options.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ t-test-options.h    10 Dec 2007 10:21:05 -0000      1.1
@@ -0,0 +1,35 @@
+/* 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/>.
+*/
+
+#ifndef T_TEST_OPTIONS_DIALOG
+#define T_TEST_OPTIONS_DIALOG
+
+
+struct tt_options_dialog;
+
+
+void tt_options_dialog_run (struct tt_options_dialog *);
+
+struct tt_options_dialog * tt_options_dialog_create (GladeXML *, GtkWindow *);
+
+void tt_options_dialog_destroy (struct tt_options_dialog *);
+
+
+void tt_options_dialog_append_syntax (struct tt_options_dialog *, GString *);
+
+
+#endif




reply via email to

[Prev in Thread] Current Thread [Next in Thread]