New Dialog: Non Parametric | K Indepdendent Samples
authorJohn Darrington <john@darrington.wattle.id.au>
Sat, 13 May 2017 17:26:17 +0000 (19:26 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Mon, 15 May 2017 14:25:21 +0000 (16:25 +0200)
NEWS
src/ui/gui/automake.mk
src/ui/gui/data-editor.ui
src/ui/gui/k-independent.ui [new file with mode: 0644]
src/ui/gui/psppire-data-window.c
src/ui/gui/psppire-dialog-action-k-independent.c [new file with mode: 0644]
src/ui/gui/psppire-dialog-action-k-independent.h [new file with mode: 0644]
src/ui/gui/psppire-value-entry.c
src/ui/gui/widgets.c

diff --git a/NEWS b/NEWS
index 9a83b21c9d188945a1630764749cefa235313e49..a755a85cbd90984c862fa568a18a1d693b0fb29e 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -15,8 +15,6 @@ Changes from 0.10.2 to 0.10.4:
 
  * Some inappropriate properties in selection dialogs have been corrected.
 
- * The graphical user interface has a new menu: Edit|Options
-
  * A bug which could cause the HTML driver to go into a tight loop
    has been fixed.
 
@@ -31,6 +29,12 @@ Changes from 0.10.2 to 0.10.4:
 
  * Gtk+3.14.5 or later must now be used when building.
 
+ * Graphical user interface changes:
+
+ ** There is a new menu: Edit|Options
+
+ ** The Non Parametric Statistics Menu has a new item: "K Independent Samples".
+
  * The AUTORECODE command now accepts an optional / before INTO.
 
  * The short form of the VECTOR command can now create string variables.
index 3b752c5c3af6656202dce31e93cc55700d0ccba2..b19cccfe61ed8c133500240010c44d50b806c2f4 100644 (file)
@@ -20,6 +20,7 @@ UI_FILES = \
        src/ui/gui/frequencies.ui \
        src/ui/gui/histogram.ui \
        src/ui/gui/indep-samples.ui \
+       src/ui/gui/k-independent.ui \
        src/ui/gui/k-means.ui \
        src/ui/gui/k-related.ui \
        src/ui/gui/ks-one-sample.ui \
@@ -228,6 +229,8 @@ src_ui_gui_psppire_SOURCES = \
        src/ui/gui/psppire-dialog-action-kmeans.h \
        src/ui/gui/psppire-dialog-action-logistic.c \
        src/ui/gui/psppire-dialog-action-logistic.h \
+       src/ui/gui/psppire-dialog-action-k-independent.c \
+       src/ui/gui/psppire-dialog-action-k-independent.h \
        src/ui/gui/psppire-dialog-action-k-related.c \
        src/ui/gui/psppire-dialog-action-k-related.h \
        src/ui/gui/psppire-dialog-action-means.c \
index 9bd7415754d2c6c28a22d3d6ebf41b94375a3a7e..0b0f5911dc0a399c0c6190f102f573947ddc4196 100644 (file)
              <attribute name="label" translatable="yes">_K Related Samples...</attribute>
              <attribute name="action">win.PsppireDialogActionKRelated</attribute>
            </item>
+           <item>
+             <attribute name="label" translatable="yes">K _Independent Samples...</attribute>
+             <attribute name="action">win.PsppireDialogActionKIndependent</attribute>
+           </item>
          </section>
        </submenu>
        <item>
diff --git a/src/ui/gui/k-independent.ui b/src/ui/gui/k-independent.ui
new file mode 100644 (file)
index 0000000..60ed095
--- /dev/null
@@ -0,0 +1,442 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.18.3 -->
+<interface>
+  <requires lib="gtk+" version="3.4.2"/>
+  <requires lib="psppire" version="2054.17080"/>
+  <object class="GtkAdjustment" id="lower-limit-adjustment">
+    <property name="page-size">0</property>
+    <property name="step_increment">1</property>
+  </object>
+
+  <object class="GtkAdjustment" id="upper-limit-adjustment">
+    <property name="page-size">0</property>
+    <property name="step_increment">1</property>
+  </object>
+
+  <object class="PsppireDialog" id="define-groups-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">Define Groups</property>
+    <property name="modal">True</property>
+    <child>
+      <object class="GtkBox" id="dialog-hbox2">
+        <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="margin_left">5</property>
+        <property name="margin_right">5</property>
+        <property name="margin_top">5</property>
+        <property name="margin_bottom">5</property>
+        <property name="spacing">2</property>
+        <child>
+          <object class="GtkGrid" id="table2">
+            <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="hexpand">True</property>
+            <property name="vexpand">True</property>
+            <property name="row_spacing">5</property>
+            <property name="column_spacing">5</property>
+            <property name="row_homogeneous">True</property>
+            <child>
+              <object class="GtkLabel" id="label2">
+                <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="label" translatable="yes">_Upper limit:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">upper-limit-entry</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="dglabel1">
+                <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="label" translatable="yes">_Lower limit:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">lower-limit-entry</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="PsppireValueEntry" id="upper-limit-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="hexpand">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="PsppireValueEntry" id="lower-limit-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>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">0</property>
+              </packing>
+            </child>
+          </object>
+        </child>
+
+
+       
+        <child>
+          <object class="PsppireButtonbox" id="psppire-vbuttonbox1">
+            <property name="orientation">vertical</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="orientation">vertical</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>
+  <object class="PsppireDialog" id="k-independent-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">Tests for Several Independent Samples</property>
+    <property name="modal">True</property>
+    <child>
+      <object class="GtkBox" id="dialog-hbox15">
+        <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="spacing">2</property>
+        <child>
+          <object class="GtkGrid" id="table4">
+            <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="margin_start">5</property>
+            <property name="margin_top">5</property>
+            <property name="margin_bottom">5</property>
+            <child>
+              <object class="GtkBox" id="vbox30">
+                <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>
+                <child>
+                  <object class="GtkLabel" id="label36">
+                    <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="xalign">0</property>
+                    <property name="label" translatable="yes">_Grouping Variable:</property>
+                    <property name="use_underline">True</property>
+                    <property name="mnemonic_widget">k-independent-entry</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkEntry" id="k-independent-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="invisible_char">●</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">2</property>
+                <property name="top_attach">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkBox" id="vbox29">
+                <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="hexpand">True</property>
+                <property name="vexpand">True</property>
+                <property name="orientation">vertical</property>
+                <child>
+                  <object class="GtkLabel" id="label35">
+                    <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="xalign">0</property>
+                    <property name="label" translatable="yes">Test _Variable List:</property>
+                    <property name="use_underline">True</property>
+                    <property name="mnemonic_widget">k-independent-treeview2</property>
+                    <property name="track_visited_links">False</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object 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="shadow_type">etched-in</property>
+                    <child>
+                      <object class="PsppireVarView" id="k-independent-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="border_width">0</property>
+                        <property name="headers_visible">False</property>
+                        <property name="headers_clickable">False</property>
+                        <child internal-child="selection">
+                          <object class="GtkTreeSelection" id="psppire-var-view-selection1"/>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">2</property>
+                <property name="top_attach">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="PsppireSelector" id="k-independent-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>
+                <property name="source_widget">k-independent-treeview1</property>
+                <property name="dest_widget">k-independent-entry</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="PsppireSelector" id="k-independent-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="valign">center</property>
+                <property name="border_width">5</property>
+                <property name="source_widget">k-independent-treeview1</property>
+                <property name="dest_widget">k-independent-treeview2</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkScrolledWindow" id="scrolledwindow2">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                <property name="hscrollbar_policy">never</property>
+                <property name="shadow_type">etched-in</property>
+                <child>
+                  <object class="PsppireDictView" id="k-independent-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="border_width">0</property>
+                    <property name="headers_visible">False</property>
+                    <property name="headers_clickable">False</property>
+                    <child internal-child="selection">
+                      <object class="GtkTreeSelection" id="psppire-dictview-selection1"/>
+                    </child>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">0</property>
+                <property name="height">4</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButtonBox" id="vbuttonbox11">
+                <property name="orientation">vertical</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="margin_top">5</property>
+               <property name="margin_bottom">5</property>
+               <property name="layout_style">center</property>
+                <child>
+                  <object class="GtkButton" id="define-groups-button">
+                    <property name="label" translatable="yes">_Define Groups</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>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">0</property>
+                 </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">2</property>
+                <property name="top_attach">2</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkBox" id="hbox2">
+                <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="valign">center</property>
+                <property name="hexpand">True</property>
+                <property name="spacing">5</property>
+                <child>
+                  <object class="GtkFrame" id="frame2">
+                    <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="hexpand">True</property>
+                    <property name="label_xalign">0</property>
+                    <child>
+                      <object class="GtkButtonBox" id="vbuttonbox1">
+                        <property name="orientation">vertical</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="margin_start">12</property>
+                        <child>
+                          <object class="GtkCheckButton" id="kruskal-wallis">
+                            <property name="label" translatable="yes">_Kruskal-Wallis H</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">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkCheckButton" id="median">
+                            <property name="label" translatable="yes">_Median</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">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </object>
+                    </child>
+                    <child type="label">
+                      <object class="GtkLabel" id="label1">
+                        <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="label" translatable="yes">Test Type</property>
+                        <property name="use_markup">True</property>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">2</property>
+                <property name="top_attach">3</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEventBox" id="eventbox1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <child>
+                  <placeholder/>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">2</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="PsppireButtonbox" id="psppire-vbuttonbox2">
+            <property name="orientation">vertical</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>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="pack_type">end</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
index 99c0c6ac69b331e06698c4930a501b3b669b2e09..15fe2e9fe956616965ef5c5f98adeca2b1c37b51 100644 (file)
@@ -67,6 +67,7 @@
 #include "psppire-dialog-action-frequencies.h"
 #include "psppire-dialog-action-histogram.h"
 #include "psppire-dialog-action-indep-samps.h"
+#include "psppire-dialog-action-k-independent.h"
 #include "psppire-dialog-action-k-related.h"
 #include "psppire-dialog-action-kmeans.h"
 #include "psppire-dialog-action-logistic.h"
@@ -1499,6 +1500,7 @@ psppire_data_window_finish_init (PsppireDataWindow *de,
   connect_dialog_action (PSPPIRE_TYPE_DIALOG_ACTION_1SKS, de);
   connect_dialog_action (PSPPIRE_TYPE_DIALOG_ACTION_TWO_SAMPLE, de);
   connect_dialog_action (PSPPIRE_TYPE_DIALOG_ACTION_K_RELATED, de);
+  connect_dialog_action (PSPPIRE_TYPE_DIALOG_ACTION_K_INDEPENDENT, de);
 
   {
     GSimpleAction *file_import_action = g_simple_action_new ("file-import", NULL);
diff --git a/src/ui/gui/psppire-dialog-action-k-independent.c b/src/ui/gui/psppire-dialog-action-k-independent.c
new file mode 100644 (file)
index 0000000..0a578ca
--- /dev/null
@@ -0,0 +1,224 @@
+/* PSPPIRE - a graphical user interface for PSPP.
+   Copyright (C) 2017 Free Software Foundation
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>. */
+
+
+#include <config.h>
+
+#include "psppire-dialog-action-k-independent.h"
+
+#include "psppire-var-view.h"
+#include "psppire-value-entry.h"
+#include "psppire-acr.h"
+
+#include "psppire-dialog.h"
+#include "builder-wrapper.h"
+#include "helper.h"
+
+
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
+#define N_(msgid) msgid
+
+
+
+static void psppire_dialog_action_k_independent_init            (PsppireDialogActionKIndependent      *act);
+static void psppire_dialog_action_k_independent_class_init      (PsppireDialogActionKIndependentClass *class);
+
+G_DEFINE_TYPE (PsppireDialogActionKIndependent, psppire_dialog_action_k_independent, PSPPIRE_TYPE_DIALOG_ACTION);
+
+const static char *keyword[n_KIDS] =
+  {
+    "KRUSKAL-WALLIS",
+    "MEDIAN"
+  };
+
+static char *
+generate_syntax (const PsppireDialogAction *act)
+{
+  gchar *text;
+  PsppireDialogActionKIndependent *kid = PSPPIRE_DIALOG_ACTION_K_INDEPENDENT (act);
+
+  GString *string = g_string_new ("NPAR TEST");
+  int i;
+  for (i = 0; i < n_KIDS; ++i)
+    {
+      g_string_append (string, "\n\t");
+
+      if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (kid->checkbutton[i])))
+       {
+         g_string_append_printf (string, "/%s = ", keyword[i]);
+         psppire_var_view_append_names (PSPPIRE_VAR_VIEW (kid->vars_treeview),
+                                        0, string);
+
+         g_string_append (string, " BY ");
+
+         g_string_append (string,
+                          gtk_entry_get_text (GTK_ENTRY (kid->groupvar_entry)));
+
+
+         g_string_append_printf (string, " (%g, %g)",
+                                 kid->lower_limit_value.f,
+                                 kid->upper_limit_value.f);
+       }
+    }
+  
+  g_string_append (string, ".\n");
+
+  text = string->str;
+
+  g_string_free (string, FALSE);
+
+  return text;
+}
+
+
+static gboolean
+dialog_state_valid (gpointer data)
+{
+  PsppireDialogActionKIndependent *kid = PSPPIRE_DIALOG_ACTION_K_INDEPENDENT (data);
+
+  GtkTreeModel *vars =
+    gtk_tree_view_get_model (GTK_TREE_VIEW (kid->vars_treeview));
+
+  GtkTreeIter notused;
+
+  if ( !gtk_tree_model_get_iter_first (vars, &notused) )
+    return FALSE;
+
+  if ( 0 == strcmp ("", gtk_entry_get_text (GTK_ENTRY (kid->groupvar_entry))))
+    return FALSE;
+
+  gboolean method_set = FALSE;
+  gint i;
+  for (i = 0; i < n_KIDS; ++i)
+    {
+      if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (kid->checkbutton[i])))
+       method_set = TRUE;
+    }
+
+  return method_set;
+}
+
+static void
+refresh (PsppireDialogAction *rd_)
+{
+  PsppireDialogActionKIndependent *kid = PSPPIRE_DIALOG_ACTION_K_INDEPENDENT (rd_);
+
+  GtkTreeModel *model =
+    gtk_tree_view_get_model (GTK_TREE_VIEW (kid->vars_treeview));
+
+  gtk_entry_set_text (GTK_ENTRY (kid->groupvar_entry), "");
+
+  gtk_list_store_clear (GTK_LIST_STORE (model));
+
+  gint i;
+  for (i = 0; i < n_KIDS; ++i)
+    {
+      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (kid->checkbutton[i]),
+                                   FALSE);
+    }
+}
+
+static void
+run_define_groups_dialog (PsppireDialogActionKIndependent *kid)
+{
+  if (kid->lower_limit_value.f != SYSMIS)
+    psppire_value_entry_set_value (PSPPIRE_VALUE_ENTRY (kid->lower_limit_entry),
+                                  &kid->lower_limit_value, 0);
+
+  if (kid->upper_limit_value.f != SYSMIS)
+    psppire_value_entry_set_value (PSPPIRE_VALUE_ENTRY (kid->upper_limit_entry),
+                                  &kid->upper_limit_value, 0);
+
+  if (PSPPIRE_RESPONSE_CONTINUE == psppire_dialog_run (kid->subdialog))
+    {
+      psppire_value_entry_get_value (PSPPIRE_VALUE_ENTRY (kid->lower_limit_entry),
+                                    &kid->lower_limit_value, 0);
+
+      psppire_value_entry_get_value (PSPPIRE_VALUE_ENTRY (kid->upper_limit_entry),
+                                    &kid->upper_limit_value, 0);
+    }
+}
+
+
+static void
+set_value_entry_variable (PsppireDialogActionKIndependent *kid, GtkEntry *entry)
+{
+  PsppireDialogAction *da = PSPPIRE_DIALOG_ACTION (kid);
+  const gchar *text = gtk_entry_get_text (entry);
+
+  const struct variable *v = da->dict ?
+    psppire_dict_lookup_var (da->dict, text) : NULL;
+
+  psppire_value_entry_set_variable (kid->lower_limit_entry, v);
+  psppire_value_entry_set_variable (kid->upper_limit_entry, v);
+}
+
+
+static void
+psppire_dialog_action_k_independent_activate (PsppireDialogAction *a)
+{
+  PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
+  PsppireDialogActionKIndependent *kid = PSPPIRE_DIALOG_ACTION_K_INDEPENDENT (a);
+
+  GHashTable *thing = psppire_dialog_action_get_hash_table (pda);
+  GtkBuilder *xml = g_hash_table_lookup (thing, a);
+  if (!xml)
+    {
+      xml = builder_new ("k-independent.ui");
+      g_hash_table_insert (thing, a, xml);
+
+      pda->dialog = get_widget_assert   (xml, "k-independent-dialog");
+      pda->source = get_widget_assert   (xml, "k-independent-treeview1");
+
+      kid->vars_treeview =  get_widget_assert (xml, "k-independent-treeview2");
+      kid->groupvar_entry = get_widget_assert (xml, "k-independent-entry");
+
+      kid->subdialog = get_widget_assert (xml, "define-groups-dialog");
+
+      kid->lower_limit_entry = get_widget_assert (xml, "lower-limit-entry");
+      kid->upper_limit_entry = get_widget_assert (xml, "upper-limit-entry");
+
+      kid->checkbutton[KID_KRUSKAL_WALLIS] = get_widget_assert (xml,
+                                                               "kruskal-wallis");
+
+      kid->checkbutton[KID_MEDIAN] = get_widget_assert (xml, "median");
+
+      g_signal_connect_swapped (get_widget_assert (xml, "define-groups-button"),
+                               "clicked",
+                               G_CALLBACK (run_define_groups_dialog), kid);
+
+      g_signal_connect_swapped (kid->groupvar_entry, "changed",
+                               G_CALLBACK (set_value_entry_variable), kid);
+    }
+
+  psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid);
+  psppire_dialog_action_set_refresh (pda, refresh);
+}
+
+static void
+psppire_dialog_action_k_independent_class_init (PsppireDialogActionKIndependentClass *class)
+{
+  psppire_dialog_action_set_activation (class, psppire_dialog_action_k_independent_activate);
+  PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax;
+}
+
+static void
+psppire_dialog_action_k_independent_init (PsppireDialogActionKIndependent *kid)
+{
+  kid->lower_limit_value.f = SYSMIS;
+  kid->upper_limit_value.f = SYSMIS;
+}
diff --git a/src/ui/gui/psppire-dialog-action-k-independent.h b/src/ui/gui/psppire-dialog-action-k-independent.h
new file mode 100644 (file)
index 0000000..aa0177b
--- /dev/null
@@ -0,0 +1,93 @@
+/* PSPPIRE - a graphical user interface for PSPP.
+   Copyright (C) 2017  Free Software Foundation
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>. */
+
+
+#include <glib-object.h>
+#include <glib.h>
+
+#include "psppire-dialog-action.h"
+
+#ifndef __PSPPIRE_DIALOG_ACTION_K_INDEPENDENT_H__
+#define __PSPPIRE_DIALOG_ACTION_K_INDEPENDENT_H__
+
+G_BEGIN_DECLS
+
+
+#define PSPPIRE_TYPE_DIALOG_ACTION_K_INDEPENDENT (psppire_dialog_action_k_independent_get_type ())
+
+#define PSPPIRE_DIALOG_ACTION_K_INDEPENDENT(obj)       \
+                     (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+                                                 PSPPIRE_TYPE_DIALOG_ACTION_K_INDEPENDENT, PsppireDialogActionKIndependent))
+
+#define PSPPIRE_DIALOG_ACTION_K_INDEPENDENT_CLASS(klass) \
+                     (G_TYPE_CHECK_CLASS_CAST ((klass), \
+                                PSPPIRE_TYPE_DIALOG_ACTION_K_INDEPENDENT, \
+                                 PsppireDialogActionKIndependentClass))
+
+
+#define PSPPIRE_IS_DIALOG_ACTION_K_INDEPENDENT(obj) \
+                    (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PSPPIRE_TYPE_DIALOG_ACTION_K_INDEPENDENT))
+
+#define PSPPIRE_IS_DIALOG_ACTION_K_INDEPENDENT_CLASS(klass) \
+                     (G_TYPE_CHECK_CLASS_TYPE ((klass), PSPPIRE_TYPE_DIALOG_ACTION_K_INDEPENDENT))
+
+
+#define PSPPIRE_DIALOG_ACTION_K_INDEPENDENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+                                  PSPPIRE_TYPE_DIALOG_ACTION_K_INDEPENDENT, \
+                                  PsppireDialogActionKIndependentClass))
+
+typedef struct _PsppireDialogActionKIndependent       PsppireDialogActionKIndependent;
+typedef struct _PsppireDialogActionKIndependentClass  PsppireDialogActionKIndependentClass;
+
+
+enum
+  {
+    KID_KRUSKAL_WALLIS,
+    KID_MEDIAN,
+    n_KIDS
+  };
+
+struct _PsppireDialogActionKIndependent
+{
+  PsppireDialogAction parent;
+
+  /*< private >*/
+  GtkWidget *checkbutton[n_KIDS];
+
+  GtkWidget *vars_treeview;
+  GtkWidget *groupvar_entry;
+
+  GtkWidget *subdialog;
+
+  GtkWidget *lower_limit_entry;
+  GtkWidget *upper_limit_entry;
+
+  union value lower_limit_value;
+  union value upper_limit_value;
+};
+
+
+struct _PsppireDialogActionKIndependentClass
+{
+  PsppireDialogActionClass parent_class;
+};
+
+
+GType psppire_dialog_action_k_independent_get_type (void) ;
+
+G_END_DECLS
+
+#endif /* __PSPPIRE_DIALOG_ACTION_K_INDEPENDENT_H__ */
index c45db101bb7c2f958e357acd81824ba97c315631..a21f10b84b9bba0ce736524d5789040422881d08 100644 (file)
@@ -442,6 +442,10 @@ psppire_value_entry_set_value (PsppireValueEntry *obj,
   gchar *string;
 
   obj->cur_value = NULL;
+
+  if (value == NULL)
+    return;
+
   if (obj->show_value_label)
     {
       struct val_lab *vl = val_labs_lookup (obj->val_labs, value);
index 37d13bf9723198f4d8a664de2370d207f2b9f240..01496cf7970339d78ec918fc884dc7085613f620 100644 (file)
@@ -33,6 +33,7 @@
 #include "psppire-dialog-action-histogram.h"
 #include "psppire-dialog-action-indep-samps.h"
 #include "psppire-dialog-action-k-related.h"
+#include "psppire-dialog-action-k-independent.h"
 #include "psppire-dialog-action-1sks.h"
 #include "psppire-dialog-action-kmeans.h"
 #include "psppire-dialog-action-logistic.h"
@@ -84,6 +85,7 @@ static const get_type_func dialog_action_types[]=
   psppire_dialog_action_histogram_get_type,
   psppire_dialog_action_logistic_get_type,
   psppire_dialog_action_kmeans_get_type,
+  psppire_dialog_action_k_independent_get_type,
   psppire_dialog_action_k_related_get_type,
   psppire_dialog_action_means_get_type,
   psppire_dialog_action_oneway_get_type,