Added a menu entry and dialog box for the FACTOR command.
authorJohn Darrington <john@darrington.wattle.id.au>
Sun, 27 Dec 2009 17:25:26 +0000 (18:25 +0100)
committerJohn Darrington <john@darrington.wattle.id.au>
Sun, 27 Dec 2009 17:28:08 +0000 (18:28 +0100)
src/language/stats/factor.c
src/ui/gui/automake.mk
src/ui/gui/data-editor.glade
src/ui/gui/factor-dialog.c [new file with mode: 0644]
src/ui/gui/factor-dialog.h [new file with mode: 0644]
src/ui/gui/factor.ui [new file with mode: 0644]
src/ui/gui/psppire-data-window.c

index 9d3d944e8fd1ae7d929e17e5127640af45a5f375..706e1d0d3b06e28b7b3a7affcfa79dabb175d39d 100644 (file)
@@ -546,7 +546,7 @@ cmd_factor (struct lexer *lexer, struct dataset *ds)
     {
       lex_match (lexer, '/');
 
-#if FACTOR_FULLY_IMPLEMENTED
+
       if (lex_match_id (lexer, "PLOT"))
        {
           lex_match (lexer, '=');
@@ -555,9 +555,11 @@ cmd_factor (struct lexer *lexer, struct dataset *ds)
              if (lex_match_id (lexer, "EIGEN"))
                {
                }
+#if FACTOR_FULLY_IMPLEMENTED
              else if (lex_match_id (lexer, "ROTATION"))
                {
                }
+#endif
              else
                {
                  lex_error (lexer, NULL);
@@ -565,9 +567,7 @@ cmd_factor (struct lexer *lexer, struct dataset *ds)
                }
            }
        }
-      else
-#endif
-      if (lex_match_id (lexer, "METHOD"))
+      else if (lex_match_id (lexer, "METHOD"))
        {
           lex_match (lexer, '=');
           while (lex_token (lexer) != '.' && lex_token (lexer) != '/')
index b7d60a78edca7e250444598eb672aba525b63727..0a827a3a489876cba70598abcf2ee7fbc946a576 100644 (file)
@@ -58,6 +58,7 @@ UI_FILES = \
        src/ui/gui/crosstabs.ui \
        src/ui/gui/descriptives.ui \
        src/ui/gui/examine.ui \
+       src/ui/gui/factor.ui \
        src/ui/gui/find.ui \
        src/ui/gui/frequencies.ui \
        src/ui/gui/message-dialog.ui \
@@ -133,6 +134,8 @@ src_ui_gui_psppire_SOURCES = \
        src/ui/gui/executor.h \
        src/ui/gui/find-dialog.c \
        src/ui/gui/find-dialog.h \
+       src/ui/gui/factor-dialog.c \
+       src/ui/gui/factor-dialog.h \
        src/ui/gui/frequencies-dialog.c \
        src/ui/gui/frequencies-dialog.h \
        src/ui/gui/goto-case-dialog.c \
index 8efdc12b31ab4dd3d021c00e0835785701e37337..6c32014f0ae325da15b31c7665ece923f93d978c 100644 (file)
                 <property name="use_underline">True</property>
               </widget>
             </child>
+            <child>
+              <widget class="GtkMenuItem" id="factor-analysis">
+                <property name="visible">True</property>
+                <property name="label" translatable="yes">Factor _Analysis</property>
+                <property name="use_underline">True</property>
+              </widget>
+            </child>
             <child>
               <widget class="GtkMenuItem" id="reliability">
                 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
diff --git a/src/ui/gui/factor-dialog.c b/src/ui/gui/factor-dialog.c
new file mode 100644 (file)
index 0000000..1f543a6
--- /dev/null
@@ -0,0 +1,352 @@
+/* PSPPIRE - a graphical user interface for PSPP.
+   Copyright (C) 2009  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 "dialog-common.h"
+#include <language/syntax-string-source.h>
+#include <ui/syntax-gen.h>
+#include <libpspp/str.h>
+
+#include "factor-dialog.h"
+#include "psppire-selector.h"
+#include "psppire-dictview.h"
+#include "psppire-dialog.h"
+
+#include "psppire-data-window.h"
+#include "psppire-var-view.h"
+
+#include "widget-io.h"
+
+#include "executor.h"
+#include "helper.h"
+
+#include <gtk/gtk.h>
+
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
+#define N_(msgid) msgid
+
+
+struct extraction_parameters
+{
+  gdouble mineigen;
+  gint n_factors;
+  gint iterations;
+
+  gboolean explicit_nfactors;  
+  gboolean covariance;
+
+  gboolean scree;
+  gboolean unrotated;
+
+  gboolean paf;
+};
+
+
+static const struct extraction_parameters default_extraction_parameters = {1.0, 0, 25, FALSE, TRUE, FALSE, TRUE, FALSE};
+
+struct factor
+{
+  GtkBuilder *xml;
+  PsppireDict *dict;
+
+  GtkWidget *variables;
+  PsppireDataWindow *de ;
+
+  /* The Extraction subdialog */
+  GtkWidget *extraction_dialog;
+
+  GtkWidget *n_factors;
+  GtkWidget *mineigen;
+  GtkWidget *iterations;
+
+  GtkWidget *nfactors_toggle;
+  GtkWidget *mineigen_toggle;
+
+  GtkWidget *covariance_toggle;
+  GtkWidget *correlation_toggle;
+
+  GtkWidget *scree_button;
+  GtkWidget *unrotated_button;
+
+  GtkWidget *extraction_combo;
+
+  struct extraction_parameters extraction;
+};
+
+static void
+load_extraction_parameters (struct factor *fd, const struct extraction_parameters *p)
+{
+  gtk_spin_button_set_value (GTK_SPIN_BUTTON (fd->mineigen), p->mineigen);
+  gtk_spin_button_set_value (GTK_SPIN_BUTTON (fd->n_factors), p->n_factors);
+  gtk_spin_button_set_value (GTK_SPIN_BUTTON (fd->iterations), p->iterations);
+
+  if (p->explicit_nfactors)
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fd->nfactors_toggle), TRUE);
+  else
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fd->mineigen_toggle), TRUE);
+
+  if (p->covariance)
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fd->covariance_toggle), TRUE);
+  else
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fd->correlation_toggle), TRUE);
+
+
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fd->scree_button), p->scree);
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fd->unrotated_button), p->unrotated);
+
+  if ( p->paf )
+    gtk_combo_box_set_active (GTK_COMBO_BOX (fd->extraction_combo), 1);
+  else
+    gtk_combo_box_set_active (GTK_COMBO_BOX (fd->extraction_combo), 0);
+    
+}
+
+static void
+set_extraction_parameters (struct extraction_parameters *p, const struct factor *fd)
+{
+  p->mineigen = gtk_spin_button_get_value (GTK_SPIN_BUTTON (fd->mineigen));
+  p->n_factors = gtk_spin_button_get_value (GTK_SPIN_BUTTON (fd->n_factors));
+  p->iterations = gtk_spin_button_get_value (GTK_SPIN_BUTTON (fd->iterations));
+
+  p->explicit_nfactors = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (fd->nfactors_toggle));
+  p->covariance = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (fd->covariance_toggle));
+
+  p->scree = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (fd->scree_button));
+  p->unrotated = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (fd->unrotated_button));
+
+  p->paf = (gtk_combo_box_get_active (GTK_COMBO_BOX (fd->extraction_combo)) == 1);
+}
+
+static void run_extractions_subdialog (struct factor *fd)
+{
+  struct extraction_parameters *ex = &fd->extraction;
+
+  gint response = psppire_dialog_run (PSPPIRE_DIALOG (fd->extraction_dialog));
+
+  if ( response == PSPPIRE_RESPONSE_CONTINUE )
+    {
+      /* Set the parameters from their respective widgets */
+      set_extraction_parameters (ex, fd);
+    }
+  else
+    {
+      /* Cancelled.  Reset the widgets to their old state */
+      load_extraction_parameters (fd, ex);
+    }
+}
+
+
+static char * generate_syntax (const struct factor *rd);
+
+
+static void
+refresh (struct factor *fd)
+{
+  GtkTreeModel *liststore =
+    gtk_tree_view_get_model (GTK_TREE_VIEW (fd->variables));
+  gtk_list_store_clear (GTK_LIST_STORE (liststore));
+
+  load_extraction_parameters (fd, &default_extraction_parameters);
+}
+
+
+static gboolean
+dialog_state_valid (gpointer data)
+{
+  struct factor *fd = data;
+
+  GtkTreeModel *liststore = gtk_tree_view_get_model (GTK_TREE_VIEW (fd->variables));
+
+  if  (gtk_tree_model_iter_n_children (liststore, NULL) < 2)
+    return FALSE;
+
+  return TRUE;
+}
+
+static void
+on_show (struct factor *fd, GtkWidget *dialog)
+{
+  GtkTreeModel *liststore = gtk_tree_view_get_model (GTK_TREE_VIEW (fd->variables));
+
+  gint n_vars = gtk_tree_model_iter_n_children (liststore, NULL);
+
+  gtk_spin_button_set_range (GTK_SPIN_BUTTON (fd->n_factors), 1, n_vars - 1);
+}
+
+
+static void
+on_extract_toggle (GtkToggleButton *button, struct factor *f)
+{
+  gboolean active = gtk_toggle_button_get_active (button);
+
+  gtk_widget_set_sensitive (GTK_WIDGET (f->n_factors), active);
+  gtk_widget_set_sensitive (GTK_WIDGET (f->mineigen), ! active);
+}
+
+/* Pops up the Factor dialog box */
+void
+factor_dialog (GObject *o, gpointer data)
+{
+  struct factor fd;
+  gint response;
+
+  PsppireVarStore *vs;
+
+  GtkWidget *dialog ;
+  GtkWidget *source ;
+  GtkWidget *extraction_button ;
+
+  fd.xml = builder_new ("factor.ui");
+  
+  dialog = get_widget_assert   (fd.xml, "factor-dialog");
+  source = get_widget_assert   (fd.xml, "dict-view");
+  extraction_button = get_widget_assert (fd.xml, "button-extraction");
+
+  fd.extraction_dialog = get_widget_assert (fd.xml, "extractions-dialog");
+
+  fd.de = PSPPIRE_DATA_WINDOW (data);
+
+  g_signal_connect_swapped (dialog, "refresh", G_CALLBACK (refresh),  &fd);
+
+  {
+    GtkWidget *hbox = get_widget_assert (fd.xml, "hbox6");
+    GtkWidget *eigenvalue_extraction = widget_scanf (_("Eigenvalues over %4.2f times the mean eigenvalue"), &fd.mineigen);
+
+    fd.nfactors_toggle = get_widget_assert (fd.xml, "nfactors-radiobutton");
+    fd.mineigen_toggle = get_widget_assert (fd.xml, "mineigen-radiobutton");
+    fd.n_factors = get_widget_assert (fd.xml, "spinbutton-nfactors");
+    fd.iterations = get_widget_assert (fd.xml, "spinbutton-iterations");
+    fd.covariance_toggle = get_widget_assert (fd.xml,  "covariance-radiobutton");
+    fd.correlation_toggle = get_widget_assert (fd.xml, "correlations-radiobutton");
+
+    fd.scree_button = get_widget_assert (fd.xml, "scree-button");
+    fd.unrotated_button = get_widget_assert (fd.xml, "unrotated-button");
+    fd.extraction_combo = get_widget_assert (fd.xml, "combobox1");
+
+    gtk_container_add (GTK_CONTAINER (hbox), eigenvalue_extraction);
+
+    g_signal_connect (fd.nfactors_toggle, "toggled", G_CALLBACK (on_extract_toggle), &fd);
+
+    gtk_widget_show_all (eigenvalue_extraction);
+  }
+
+  g_signal_connect_swapped (extraction_button, "clicked", G_CALLBACK (run_extractions_subdialog), &fd);
+
+  g_signal_connect_swapped (fd.extraction_dialog, "show", G_CALLBACK (on_show), &fd);
+
+  fd.variables = get_widget_assert   (fd.xml, "psppire-var-view1");
+
+  g_object_get (fd.de->data_editor, "var-store", &vs, NULL);
+
+  gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (fd.de));
+  gtk_window_set_transient_for (GTK_WINDOW (fd.extraction_dialog), GTK_WINDOW (fd.de));
+
+  g_object_get (vs, "dictionary", &fd.dict, NULL);
+  g_object_set (source, "model", fd.dict, NULL);
+
+
+  psppire_dialog_set_valid_predicate (PSPPIRE_DIALOG (dialog),
+                                     dialog_state_valid, &fd);
+
+  psppire_selector_set_allow (PSPPIRE_SELECTOR (get_widget_assert (fd.xml, "dep-selector")),
+                             numeric_only);
+
+  response = psppire_dialog_run (PSPPIRE_DIALOG (dialog));
+
+  switch (response)
+    {
+    case GTK_RESPONSE_OK:
+      {
+       gchar *syntax = generate_syntax (&fd);
+
+       struct getl_interface *sss = create_syntax_string_source (syntax);
+       execute_syntax (sss);
+
+       g_free (syntax);
+      }
+      break;
+    case PSPPIRE_RESPONSE_PASTE:
+      {
+       gchar *syntax = generate_syntax (&fd);
+        paste_syntax_in_new_window (syntax);
+
+       g_free (syntax);
+      }
+      break;
+    default:
+      break;
+    }
+
+  g_object_unref (fd.xml);
+}
+
+
+\f
+
+static char *
+generate_syntax (const struct factor *rd)
+{
+  gchar *text;
+
+  GString *string = g_string_new ("FACTOR ");
+
+  g_string_append (string, "VARIABLES =  ");
+
+  psppire_var_view_append_names (PSPPIRE_VAR_VIEW (rd->variables), 0, string);
+
+  g_string_append (string, "\n\t/EXTRACTION =");
+  if ( rd->extraction.paf)
+    g_string_append (string, "PAF");
+  else
+    g_string_append (string, "PC");
+
+
+  g_string_append (string, "\n\t/METHOD = ");
+  if ( rd->extraction.covariance )
+    g_string_append (string, "COVARIANCE");
+  else
+    g_string_append (string, "CORRELATION");
+
+
+  g_string_append (string, "\n\t/CRITERIA = ");
+  if ( rd->extraction.explicit_nfactors )
+    g_string_append_printf (string, "FACTORS (%d)", rd->extraction.n_factors);
+  else
+    g_string_append_printf (string, "MINEIGEN (%g)", rd->extraction.mineigen);
+    
+
+  if ( rd->extraction.scree )
+    {
+      g_string_append (string, "\n\t/PLOT = ");
+      g_string_append (string, "EIGEN");
+    }
+
+  g_string_append (string, "\n\t/PRINT = ");
+  g_string_append (string, "INITIAL ");
+  if ( rd->extraction.unrotated )  
+    g_string_append (string, "EXTRACTION ");
+
+
+  g_string_append (string, ".\n");
+
+  text = string->str;
+
+  g_string_free (string, FALSE);
+
+  return text;
+}
diff --git a/src/ui/gui/factor-dialog.h b/src/ui/gui/factor-dialog.h
new file mode 100644 (file)
index 0000000..76b7ef9
--- /dev/null
@@ -0,0 +1,25 @@
+/* PSPPIRE - a graphical user interface for PSPP.
+   Copyright (C) 2009  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 __FACTOR_DIALOG_H
+#define __FACTOR_DIALOG_H
+
+
+#include <gtk/gtk.h>
+
+void factor_dialog (GObject *o, gpointer data);
+
+#endif
diff --git a/src/ui/gui/factor.ui b/src/ui/gui/factor.ui
new file mode 100644 (file)
index 0000000..2bf61b2
--- /dev/null
@@ -0,0 +1,520 @@
+<?xml version="1.0"?>
+<interface>
+  <requires lib="gtk+" version="2.16"/>
+  <!-- interface-requires psppire 0.0 -->
+  <!-- interface-naming-policy project-wide -->
+  <object class="GtkListStore" id="extraction-methods">
+    <columns>
+      <!-- column-name Method-Name -->
+      <column type="gchararray"/>
+    </columns>
+    <data>
+      <row>
+        <col id="0" translatable="yes">Principal Components Analysis</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Principal Axis Factoring</col>
+      </row>
+    </data>
+  </object>
+  <object class="PsppireDialog" id="factor-dialog">
+    <property name="title" translatable="yes">Factor Analysis</property>
+    <property name="modal">True</property>
+    <property name="orientation">Tabular</property>
+    <child internal-child="hbox">
+      <object class="GtkTable" id="dialog-hbox1">
+        <property name="visible">True</property>
+        <property name="n_rows">2</property>
+        <property name="n_columns">2</property>
+        <property name="row_spacing">5</property>
+        <child>
+          <object class="PsppireVButtonBox" id="psppire-vbuttonbox1">
+            <property name="visible">True</property>
+            <property name="border_width">5</property>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="right_attach">2</property>
+            <property name="x_options"></property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkHButtonBox" id="hbuttonbox1">
+            <property name="visible">True</property>
+            <property name="layout_style">spread</property>
+            <child>
+              <object class="GtkButton" id="button-descriptives">
+                <property name="label" translatable="yes">Descriptives...</property>
+                <property name="visible">False</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">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="button-extraction">
+                <property name="label" translatable="yes">Extraction...</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+          </object>
+          <packing>
+            <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="x_padding">5</property>
+            <property name="y_padding">5</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkHBox" id="hbox1">
+            <property name="visible">True</property>
+            <child>
+              <object class="GtkScrolledWindow" id="scrolledwindow1">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="hscrollbar_policy">never</property>
+                <property name="vscrollbar_policy">automatic</property>
+                <property name="shadow_type">in</property>
+                <child>
+                  <object class="PsppireDictView" id="dict-view">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="has_tooltip">True</property>
+                    <property name="border_width">5</property>
+                    <property name="headers_visible">False</property>
+                    <property name="headers_clickable">False</property>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkAlignment" id="alignment2">
+                <property name="visible">True</property>
+                <property name="xscale">0.5</property>
+                <property name="yscale">0</property>
+                <child>
+                  <object class="PsppireSelector" id="dep-selector">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="border_width">5</property>
+                    <property name="source_widget">dict-view</property>
+                    <property name="dest_widget">psppire-var-view1</property>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkFrame" id="frame1">
+                <property name="visible">True</property>
+                <property name="label_xalign">0</property>
+                <property name="shadow_type">none</property>
+                <child>
+                  <object class="GtkAlignment" id="alignment1">
+                    <property name="visible">True</property>
+                    <property name="left_padding">12</property>
+                    <child>
+                      <object class="GtkScrolledWindow" id="scrolledwindow2">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="hscrollbar_policy">never</property>
+                        <property name="vscrollbar_policy">automatic</property>
+                        <property name="shadow_type">in</property>
+                        <child>
+                          <object class="PsppireVarView" id="psppire-var-view1">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="border_width">5</property>
+                            <property name="headers_visible">False</property>
+                            <property name="headers_clickable">False</property>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+                <child type="label">
+                  <object class="GtkLabel" id="label1">
+                    <property name="visible">True</property>
+                    <property name="label" translatable="yes">Variables:</property>
+                    <property name="use_markup">True</property>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="position">2</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="x_padding">5</property>
+            <property name="y_padding">5</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </object>
+  <object class="PsppireDialog" id="extractions-dialog">
+    <property name="title" translatable="yes">Factor Analysis: Extraction</property>
+    <property name="modal">True</property>
+    <child internal-child="hbox">
+      <object class="GtkHBox" id="dialog-hbox4">
+        <property name="visible">True</property>
+        <property name="spacing">2</property>
+        <child>
+          <object class="GtkAlignment" id="alignment3">
+            <property name="visible">True</property>
+            <property name="top_padding">5</property>
+            <property name="bottom_padding">5</property>
+            <property name="left_padding">5</property>
+            <property name="right_padding">5</property>
+            <child>
+              <object class="GtkVBox" id="vbox1">
+                <property name="visible">True</property>
+                <property name="orientation">vertical</property>
+                <property name="spacing">5</property>
+                <child>
+                  <object class="GtkHBox" id="hbox3">
+                    <property name="visible">True</property>
+                    <child>
+                      <object class="GtkLabel" id="label5">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">Method: </property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkComboBox" id="combobox1">
+                        <property name="visible">True</property>
+                        <property name="model">extraction-methods</property>
+                        <property name="active">0</property>
+                        <child>
+                          <object class="GtkCellRendererText" id="renderer1"/>
+                          <attributes>
+                            <attribute name="text">0</attribute>
+                          </attributes>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkHBox" id="hbox2">
+                    <property name="visible">True</property>
+                    <property name="spacing">5</property>
+                    <child>
+                      <object class="GtkFrame" id="frame3">
+                        <property name="visible">True</property>
+                        <property name="label_xalign">0</property>
+                        <child>
+                          <object class="GtkAlignment" id="alignment4">
+                            <property name="visible">True</property>
+                            <property name="left_padding">12</property>
+                            <child>
+                              <object class="GtkVButtonBox" id="vbuttonbox1">
+                                <property name="visible">True</property>
+                                <property name="orientation">vertical</property>
+                                <property name="layout_style">spread</property>
+                                <child>
+                                  <object class="GtkRadioButton" id="correlations-radiobutton">
+                                    <property name="label" translatable="yes">Correlation matrix</property>
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="receives_default">False</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="GtkRadioButton" id="covariance-radiobutton">
+                                    <property name="label" translatable="yes">Covariance matrix</property>
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="receives_default">False</property>
+                                    <property name="draw_indicator">True</property>
+                                    <property name="group">correlations-radiobutton</property>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                    <property name="position">1</property>
+                                  </packing>
+                                </child>
+                              </object>
+                            </child>
+                          </object>
+                        </child>
+                        <child type="label">
+                          <object class="GtkLabel" id="label3">
+                            <property name="visible">True</property>
+                            <property name="label" translatable="yes">Analyse</property>
+                            <property name="use_markup">True</property>
+                          </object>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkFrame" id="frame4">
+                        <property name="visible">True</property>
+                        <property name="label_xalign">0</property>
+                        <child>
+                          <object class="GtkAlignment" id="alignment5">
+                            <property name="visible">True</property>
+                            <property name="left_padding">12</property>
+                            <child>
+                              <object class="GtkVButtonBox" id="vbuttonbox2">
+                                <property name="visible">True</property>
+                                <property name="orientation">vertical</property>
+                                <property name="layout_style">spread</property>
+                                <child>
+                                  <object class="GtkCheckButton" id="unrotated-button">
+                                    <property name="label" translatable="yes">Unrotatated factor solution</property>
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="receives_default">False</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="scree-button">
+                                    <property name="label" translatable="yes">Scree plot</property>
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="receives_default">False</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>
+                          </object>
+                        </child>
+                        <child type="label">
+                          <object class="GtkLabel" id="label4">
+                            <property name="visible">True</property>
+                            <property name="label" translatable="yes">Display</property>
+                            <property name="use_markup">True</property>
+                          </object>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="padding">5</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkFrame" id="frame2">
+                    <property name="visible">True</property>
+                    <property name="label_xalign">0</property>
+                    <child>
+                      <object class="GtkAlignment" id="alignment6">
+                        <property name="visible">True</property>
+                        <property name="left_padding">12</property>
+                        <child>
+                          <object class="GtkVBox" id="vbox2">
+                            <property name="visible">True</property>
+                            <property name="orientation">vertical</property>
+                            <child>
+                              <object class="GtkHBox" id="hbox6">
+                                <property name="visible">True</property>
+                                <child>
+                                  <object class="GtkRadioButton" id="mineigen-radiobutton">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="receives_default">False</property>
+                                    <property name="active">True</property>
+                                    <property name="draw_indicator">True</property>
+                                    <property name="group">nfactors-radiobutton</property>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                    <property name="position">0</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <placeholder/>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkHBox" id="hbox5">
+                                <property name="visible">True</property>
+                                <child>
+                                  <object class="GtkRadioButton" id="nfactors-radiobutton">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="receives_default">False</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="GtkLabel" id="label7">
+                                    <property name="visible">True</property>
+                                    <property name="xalign">0</property>
+                                    <property name="label" translatable="yes">Number of factors:</property>
+                                  </object>
+                                  <packing>
+                                    <property name="position">1</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkSpinButton" id="spinbutton-nfactors">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="invisible_char">&#x2022;</property>
+                                    <property name="adjustment">adjustment1</property>
+                                    <property name="numeric">True</property>
+                                  </object>
+                                  <packing>
+                                    <property name="position">2</property>
+                                  </packing>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
+                    <child type="label">
+                      <object class="GtkLabel" id="label2">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">Extract</property>
+                        <property name="use_markup">True</property>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="position">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkHBox" id="hbox4">
+                    <property name="visible">True</property>
+                    <child>
+                      <object class="GtkLabel" id="label6">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">Maximum iterations for convergence:</property>
+                      </object>
+                      <packing>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkSpinButton" id="spinbutton-iterations">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="invisible_char">&#x2022;</property>
+                        <property name="adjustment">adjustment2</property>
+                      </object>
+                      <packing>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="position">3</property>
+                  </packing>
+                </child>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="PsppireVButtonBox" id="psppire-vbuttonbox2">
+            <property name="visible">True</property>
+            <property name="border_width">5</property>
+            <property name="spacing">5</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="GtkAdjustment" id="adjustment1">
+    <property name="upper">100</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="adjustment2">
+    <property name="upper">100</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+</interface>
index e9a89465b4cf1c17cda74bd5356e9547cf5b296d..564d91b177898506e494d2a5b05454d7358c5d31 100644 (file)
@@ -58,6 +58,7 @@
 #include "reliability-dialog.h"
 #include "roc-dialog.h"
 #include "correlation-dialog.h"
+#include "factor-dialog.h"
 #include "oneway-anova-dialog.h"
 #include "t-test-independent-samples-dialog.h"
 #include "t-test-one-sample.h"
@@ -1722,6 +1723,20 @@ psppire_data_window_init (PsppireDataWindow *de)
                      G_CALLBACK (correlation_dialog), de);
   }
 
+  {
+    GtkAction *invoke_factor_dialog =
+      resolve_action (de->builder, "factor-analysis", NULL);
+
+    g_object_set (invoke_factor_dialog,
+                 "tooltip", _("Principal Axis Factoring and Principal Components Analysis"),
+                 "stock-id", "pspp-factor",
+                 NULL
+                 );
+
+    g_signal_connect (invoke_factor_dialog, "activate",
+                     G_CALLBACK (factor_dialog), de);
+  }
+
 
   {
     GtkUIManager *uim = GTK_UI_MANAGER (get_object_assert (de->builder, "uimanager1", GTK_TYPE_UI_MANAGER));