Oneway GUI: Add dialog box for the posthoc tests.
authorAyhan Yalçınsoy <ayhanyalcinsoy@pisilinux.org>
Tue, 16 Apr 2019 17:02:21 +0000 (19:02 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Tue, 16 Apr 2019 17:08:38 +0000 (19:08 +0200)
NEWS
src/ui/gui/oneway.ui
src/ui/gui/psppire-dialog-action-oneway.c
src/ui/gui/psppire-dialog-action-oneway.h

diff --git a/NEWS b/NEWS
index e535638d3646991b4aed406ebd018bf56b6c032d..c252290add5267fedb96d3360b17ae0206b9d42f 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -22,6 +22,9 @@ Changes from 1.2.0 to 1.3.0:
  * A bug where the GUI would crash when T-TEST was executed whilst
    a filter was set has been fixed.
 
+ * The GUI now has a sub-dialog for posthoc tests of the oneway
+   anova test.
+
 Changes from 1.0.1 to 1.2.0:
 
  * New experimental command SAVE DATA COLLECTION to save MDD files.
index 615ba2f38027fd1c89a5d2a6d5b77d6b01515c86..0187024c434555fec8389c3db2807b9cca20e0ef 100644 (file)
       </object>
     </child>
   </object>
+<!--Posthoc dialog-->
+  <object class="PsppireDialog" id="posthoc-dialog">
+    <property name="can_focus">False</property>
+    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+    <property name="title" translatable="yes">One-Way ANOVA: Post-Hoc</property>
+    <property name="modal">True</property>
+    <child>
+      <object class="GtkBox" id="dialog-hbox4">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">2</property>
+        <child>
+          <object class="GtkBox" id="vbox3">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+            <property name="orientation">vertical</property>
+            <property name="homogeneous">True</property>
+            <child>
+              <object class="GtkCheckButton" id="bonferroni-button">
+                <property name="label" translatable="yes">Bonferroni</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</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>
+                <property name="xalign">0.5</property>
+                <property name="draw_indicator">True</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkCheckButton" id="gh-button">
+                <property name="label" translatable="yes">Games Howell</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</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>
+                <property name="xalign">0.5</property>
+                <property name="draw_indicator">True</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkCheckButton" id="lsd-button">
+                <property name="label" translatable="yes">Fisher's LSD</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</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>
+                <property name="xalign">0.5</property>
+                <property name="draw_indicator">True</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkCheckButton" id="scheffe-button">
+                <property name="label" translatable="yes">Scheffé</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</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>
+                <property name="xalign">0.5</property>
+                <property name="draw_indicator">True</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">3</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkCheckButton" id="sidak-button">
+                <property name="label" translatable="yes">Šidák</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</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>
+                <property name="xalign">0.5</property>
+                <property name="draw_indicator">True</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">4</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkCheckButton" id="tukey-button">
+                <property name="label" translatable="yes">Tukey HSD</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</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>
+                <property name="xalign">0.5</property>
+                <property name="draw_indicator">True</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">5</property>
+              </packing>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="PsppireButtonbox" id="psppire-hbuttonbox1">
+            <property name="orientation">horizontal</property>
+            <property name="visible">True</property>
+            <property name="can_focus">False</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="layout_style">spread</property>
+            <property name="buttons">PSPPIRE_BUTTON_CONTINUE_MASK | PSPPIRE_BUTTON_CANCEL_MASK | PSPPIRE_BUTTON_HELP_MASK</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>
+<!--Posthoc dioalog finished-->
   <object class="PsppireDialog" id="oneway-anova-dialog">
     <property name="can_focus">False</property>
     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                     <property name="position">0</property>
                   </packing>
                 </child>
+
                 <child>
                   <object class="GtkButtonBox" id="vbuttonbox2">
                     <property name="orientation">vertical</property>
                     <property name="can_focus">False</property>
                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                     <property name="hexpand">True</property>
+<!--Added Post-hoc button-->
+                    <child>
+                      <object class="GtkButton" id="posthoc-button">
+                        <property name="label" translatable="yes">Post-Hoc...</property>
+                        <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="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="contrasts-button">
                         <property name="label" translatable="yes">_Contrasts...</property>
                       <packing>
                         <property name="expand">False</property>
                         <property name="fill">False</property>
-                        <property name="position">0</property>
+                        <property name="position">1</property>
                       </packing>
                     </child>
                   </object>
index 77512977a9049f230bd393be8d108bb99da4566d..e66ec4a4981cce2a693332816257b461dd85e61b 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPPIRE - a graphical user interface for PSPP.
-   Copyright (C) 2012, 2013, 2014  Free Software Foundation
+   Copyright (C) 2012, 2013, 2014, 2019  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
 #define _(msgid) gettext (msgid)
 #define N_(msgid) msgid
 
+#define     POSTHOC_BONFERRONI  0x01
+#define     POSTHOC_GH          0x02
+#define     POSTHOC_LSD         0x04
+#define     POSTHOC_SCHEFFE     0x08
+#define     POSTHOC_SIDAK       0x10
+#define     POSTHOC_TUKEY       0x20
 
 static void next (GtkWidget *widget, PsppireDialogActionOneway *);
 static void prev (GtkWidget *widget, PsppireDialogActionOneway *);
+static void run_posthoc_dialog (PsppireDialogActionOneway *ow);
 static void run_contrasts_dialog (PsppireDialogActionOneway *csd);
 static void push_new_store (GArray *contrast_stack, PsppireDialogActionOneway *csd);
 
@@ -65,7 +72,7 @@ generate_syntax (const PsppireDialogAction *act)
 
   ds_put_cstr (&dss, gtk_entry_get_text (GTK_ENTRY (ow->factor_entry)));
 
-  if (descriptives || homogeneity )
+  if (descriptives || homogeneity)
     {
       ds_put_cstr (&dss, "\n\t/STATISTICS=");
       if (descriptives)
@@ -73,7 +80,22 @@ generate_syntax (const PsppireDialogAction *act)
       if (homogeneity)
        ds_put_cstr (&dss, "HOMOGENEITY ");
     }
-
+  if (ow->posthoc)
+    {
+      ds_put_cstr (&dss, "\n\t/POSTHOC=");
+      if ( ow->posthoc & POSTHOC_BONFERRONI)
+       ds_put_cstr (&dss, "BONFERRONI ");
+      if ( ow->posthoc & POSTHOC_GH)
+       ds_put_cstr (&dss, "GH ");
+      if ( ow->posthoc & POSTHOC_LSD)
+       ds_put_cstr (&dss, "LSD ");
+      if ( ow->posthoc & POSTHOC_SCHEFFE)
+       ds_put_cstr (&dss, "SCHEFFE ");
+      if ( ow->posthoc & POSTHOC_SIDAK)
+       ds_put_cstr (&dss, "SIDAK ");
+      if ( ow->posthoc & POSTHOC_TUKEY)
+       ds_put_cstr (&dss, "TUKEY ");
+      }
   for (i = 0 ; i < ow->contrasts_array->len ; ++i )
     {
       GtkListStore *ls = g_array_index (ow->contrasts_array, GtkListStore*, i);
@@ -226,8 +248,9 @@ psppire_dialog_action_oneway_activate (PsppireDialogAction *a, GVariant *param)
 
   GtkBuilder *xml = builder_new ( "oneway.ui");
 
-  GtkWidget *contrasts_button =
-    get_widget_assert (xml, "contrasts-button");
+  GtkWidget *contrasts_button = get_widget_assert (xml, "contrasts-button");
+/* Posthoc button */
+  GtkWidget *posthoc_button= get_widget_assert (xml, "posthoc-button");
   GtkEntry *entry = GTK_ENTRY (get_widget_assert (xml, "entry1"));
 
   pda->dialog = get_widget_assert   (xml, "oneway-anova-dialog");
@@ -239,6 +262,20 @@ psppire_dialog_action_oneway_activate (PsppireDialogAction *a, GVariant *param)
   act->descriptives =  get_widget_assert (xml, "checkbutton1");
   act->homogeneity =  get_widget_assert (xml, "checkbutton2");
 
+/* Posthoc tests dialog */
+  act->posthoc_dialog = get_widget_assert (xml, "posthoc-dialog");
+
+  act->bonferroni_button = get_widget_assert (xml, "bonferroni-button");
+  act->gh_button = get_widget_assert (xml, "gh-button");
+  act->lsd_button = get_widget_assert (xml, "lsd-button");
+  act->scheffe_button = get_widget_assert (xml, "scheffe-button");
+  act->sidak_button = get_widget_assert (xml, "sidak-button");
+  act->tukey_button = get_widget_assert (xml, "tukey-button");
+
+  g_signal_connect_swapped (posthoc_button, "clicked",
+                   G_CALLBACK (run_posthoc_dialog), act);
+
+/* Contrast dialog */
   act->contrasts_dialog = get_widget_assert (xml, "contrasts-dialog");
 
   act->next = get_widget_assert (xml, "next-button");
@@ -280,11 +317,56 @@ psppire_dialog_action_oneway_init (PsppireDialogActionOneway *act)
 {
   act->contrasts_array = NULL;
   act->c = -1;
-
+  act->posthoc = 0;
 }
+/* Posthoc dialog */
+static void
+run_posthoc_dialog (PsppireDialogActionOneway *ow)
+{
+  gint response;
+
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ow->bonferroni_button),
+                               ow->posthoc & POSTHOC_BONFERRONI);
+
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ow->gh_button),
+                               ow->posthoc & POSTHOC_GH);
+
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ow->lsd_button),
+                               ow->posthoc & POSTHOC_LSD);
 
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ow->scheffe_button),
+                               ow->posthoc & POSTHOC_SCHEFFE);
 
-\f
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ow->sidak_button),
+                               ow->posthoc & POSTHOC_SIDAK);
+
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ow->tukey_button),
+                               ow->posthoc & POSTHOC_TUKEY);
+
+  response = psppire_dialog_run (PSPPIRE_DIALOG (ow->posthoc_dialog));
+
+  if ( response == PSPPIRE_RESPONSE_CONTINUE )
+    {
+      ow->posthoc= 0;
+      if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ow->bonferroni_button) ))
+       ow->posthoc |= POSTHOC_BONFERRONI;
+
+      if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ow->gh_button) ))
+       ow->posthoc |= POSTHOC_GH;
+
+      if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ow->lsd_button) ))
+       ow->posthoc |= POSTHOC_LSD;
+
+      if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ow->scheffe_button) ))
+       ow->posthoc |= POSTHOC_SCHEFFE;
+
+      if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ow->sidak_button) ))
+       ow->posthoc |= POSTHOC_SIDAK;
+
+      if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ow->tukey_button) ))
+       ow->posthoc |= POSTHOC_TUKEY;
+    }
+}\f
 
 static void
 run_contrasts_dialog (PsppireDialogActionOneway *csd)
index 4483728524de09c60e59731aebcff8d725ffe0d0..f14b7c8eb4faa6e30c105997735d8dda9a2d31e4 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPPIRE - a graphical user interface for PSPP.
-   Copyright (C) 2013  Free Software Foundation
+   Copyright (C) 2013, 2019  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
@@ -63,7 +63,18 @@ struct _PsppireDialogActionOneway
   GtkWidget *descriptives;
   GtkWidget *homogeneity;
 
+/* Post-Hoc dialog */
+  GtkWidget *posthoc_dialog;
 
+  GtkWidget *bonferroni_button;
+  GtkWidget *gh_button;
+  GtkWidget *lsd_button;
+  GtkWidget *scheffe_button;
+  GtkWidget *sidak_button;
+  GtkWidget *tukey_button;
+  guint posthoc;
+
+/* Contrasts dialog */
   GtkWidget *contrasts_dialog;
 
   GtkWidget *next;
@@ -72,7 +83,6 @@ struct _PsppireDialogActionOneway
   GtkWidget *vars_treeview;
   GtkWidget *factor_entry;
 
-
   /* Gets copied into contrasts when "Continue"
      is clicked */
   GArray *temp_contrasts;
@@ -82,7 +92,6 @@ struct _PsppireDialogActionOneway
 
 
   GArray *contrasts_array;
-
   GtkWidget *ctotal;
   GtkWidget *stack_label;
 };