Move data-editor.c to psppire-data-window.c
authorJohn Darrington <john@darrington.wattle.id.au>
Tue, 30 Dec 2008 12:08:07 +0000 (21:08 +0900)
committerJohn Darrington <john@darrington.wattle.id.au>
Tue, 30 Dec 2008 12:08:07 +0000 (21:08 +0900)
Made data-editor.c into a widget (derived from GtkWindow), called
PsppireDataWindow.  Removed window-manager.c and window-manager.h

33 files changed:
src/ui/gui/automake.mk
src/ui/gui/comments-dialog.c
src/ui/gui/compute-dialog.c
src/ui/gui/crosstabs-dialog.c
src/ui/gui/data-editor.c [deleted file]
src/ui/gui/data-editor.h [deleted file]
src/ui/gui/descriptives-dialog.c
src/ui/gui/examine-dialog.c
src/ui/gui/find-dialog.c
src/ui/gui/frequencies-dialog.c
src/ui/gui/goto-case-dialog.c
src/ui/gui/oneway-anova-dialog.c
src/ui/gui/psppire-data-window.c [new file with mode: 0644]
src/ui/gui/psppire-data-window.h [new file with mode: 0644]
src/ui/gui/psppire-output-window.c
src/ui/gui/psppire-syntax-window.c
src/ui/gui/psppire-window.c
src/ui/gui/psppire.c
src/ui/gui/rank-dialog.c
src/ui/gui/recode-dialog.c
src/ui/gui/regression-dialog.c
src/ui/gui/select-cases-dialog.c
src/ui/gui/sort-cases-dialog.c
src/ui/gui/split-file-dialog.c
src/ui/gui/t-test-independent-samples-dialog.c
src/ui/gui/t-test-one-sample.c
src/ui/gui/t-test-paired-samples.c
src/ui/gui/text-data-import-dialog.c
src/ui/gui/transpose-dialog.c
src/ui/gui/variable-info-dialog.c
src/ui/gui/weight-cases-dialog.c
src/ui/gui/window-manager.c [deleted file]
src/ui/gui/window-manager.h [deleted file]

index 52bd049b9ac620425de485d1177c4c36ac6a2119..a458c0f435f6a84ef6248a902f9e576201536d75 100644 (file)
@@ -115,8 +115,6 @@ src_ui_gui_psppire_SOURCES = \
        src/ui/gui/frequencies-dialog.h \
        src/ui/gui/goto-case-dialog.c \
        src/ui/gui/goto-case-dialog.h \
-       src/ui/gui/data-editor.c \
-       src/ui/gui/data-editor.h \
        src/ui/gui/descriptives-dialog.c \
        src/ui/gui/descriptives-dialog.h \
        src/ui/gui/examine-dialog.c \
@@ -196,13 +194,14 @@ src_ui_gui_psppire_SOURCES = \
        src/ui/gui/weight-cases-dialog.h \
        src/ui/gui/widget-io.c \
        src/ui/gui/widget-io.h \
+       src/ui/gui/psppire-data-window.c \
+       src/ui/gui/psppire-data-window.h \
        src/ui/gui/psppire-output-window.c \
        src/ui/gui/psppire-output-window.h \
        src/ui/gui/psppire-window.c \
        src/ui/gui/psppire-window.h \
        src/ui/gui/psppire-syntax-window.c \
        src/ui/gui/psppire-syntax-window.h \
-       src/ui/gui/window-manager.c \
        src/ui/gui/window-manager.h
 
 nodist_src_ui_gui_psppire_SOURCES = \
index 6b2e800779ce4a300672c75853e4a7e949a1ccb4..9b521a7669fb1cfbe4f6f1063807078932e42880 100644 (file)
@@ -18,7 +18,8 @@
 
 #include "psppire-dialog.h"
 #include "helper.h"
-#include "data-editor.h"
+#include "psppire-data-window.h"
+#include "psppire-data-editor.h"
 #include <language/syntax-string-source.h>
 #include "psppire-syntax-window.h"
 #include "psppire-var-store.h"
@@ -95,7 +96,7 @@ comments_dialog (GObject *o, gpointer data)
 {
   GtkTextIter iter;
   gint response ;
-  struct data_editor *de = data;
+  PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
   struct comment_dialog cd;
 
   GladeXML *xml = XML_NEW ("psppire.glade");
@@ -109,7 +110,7 @@ comments_dialog (GObject *o, gpointer data)
 
   g_object_get (de->data_editor, "var-store", &vs, NULL);
 
-  gtk_window_set_transient_for (GTK_WINDOW (dialog), de->parent.window);
+  gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de));
 
   {
     PangoContext * context ;
index a887876fed39ca7ce034c9832760409a53eeab8d..17611ac8a9fcbc72f2078f8a153e067da774645e 100644 (file)
@@ -20,7 +20,7 @@
 #include "helper.h"
 #include "psppire-dialog.h"
 #include "psppire-keypad.h"
-#include "data-editor.h"
+#include "psppire-data-window.h"
 #include "psppire-var-store.h"
 #include "dialog-common.h"
 #include "dict-display.h"
@@ -365,7 +365,7 @@ void
 compute_dialog (GObject *o, gpointer data)
 {
   gint response;
-  struct data_editor *de = data;
+  PsppireDataWindow *de = data;
 
   PsppireVarStore *vs = NULL;
   struct compute_dialog scd;
@@ -394,7 +394,7 @@ compute_dialog (GObject *o, gpointer data)
   g_signal_connect (expression, "toggled",
                    G_CALLBACK(on_expression_toggle), &scd);
 
-  gtk_window_set_transient_for (GTK_WINDOW (dialog), de->parent.window);
+  gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de));
 
 
   attach_dictionary_to_treeview (GTK_TREE_VIEW (dict_view),
index 3c3bd9f42c2a26fdf979965b02fff56b423f0d33..dfe03e3c67d9ce75ad001c761c57565697a933c7 100644 (file)
@@ -23,7 +23,7 @@
 #include <stdlib.h>
 
 #include <language/syntax-string-source.h>
-#include <ui/gui/data-editor.h>
+#include <ui/gui/psppire-data-window.h>
 #include <ui/gui/dialog-common.h>
 #include <ui/gui/dict-display.h>
 #include <ui/gui/helper.h>
@@ -385,13 +385,15 @@ void
 crosstabs_dialog (GObject *o, gpointer data)
 {
   gint response;
-  struct data_editor *de = data;
-
   struct crosstabs_dialog cd;
 
   GladeXML *xml = XML_NEW ("crosstabs.glade");
+
   PsppireVarStore *vs = NULL;
 
+  PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
+
+
   GtkWidget *dialog = get_widget_assert   (xml, "crosstabs-dialog");
   GtkWidget *source = get_widget_assert   (xml, "dict-treeview");
   GtkWidget *dest_rows =   get_widget_assert   (xml, "rows");
@@ -419,7 +421,7 @@ crosstabs_dialog (GObject *o, gpointer data)
                                  cells
                                  );
 
-  gtk_window_set_transient_for (GTK_WINDOW (dialog), de->parent.window);
+  gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de));
 
   attach_dictionary_to_treeview (GTK_TREE_VIEW (source),
                                 vs->dict,
@@ -461,9 +463,9 @@ crosstabs_dialog (GObject *o, gpointer data)
   cd.current_opts.table = TRUE;
   cd.current_opts.pivot = TRUE;
 
-  gtk_window_set_transient_for (GTK_WINDOW (cd.format_dialog), de->parent.window);
-  gtk_window_set_transient_for (GTK_WINDOW (cd.cell_dialog), de->parent.window);
-  gtk_window_set_transient_for (GTK_WINDOW (cd.stat_dialog), de->parent.window);
+  gtk_window_set_transient_for (GTK_WINDOW (cd.format_dialog), GTK_WINDOW (de));
+  gtk_window_set_transient_for (GTK_WINDOW (cd.cell_dialog), GTK_WINDOW (de));
+  gtk_window_set_transient_for (GTK_WINDOW (cd.stat_dialog), GTK_WINDOW (de));
 
   g_signal_connect (dialog, "refresh", G_CALLBACK (refresh),  &cd);
 
diff --git a/src/ui/gui/data-editor.c b/src/ui/gui/data-editor.c
deleted file mode 100644 (file)
index f540592..0000000
+++ /dev/null
@@ -1,1699 +0,0 @@
-/* PSPPIRE - a graphical user interface for PSPP.
-   Copyright (C) 2006, 2007, 2008  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 <stdlib.h>
-#include <gettext.h>
-
-#include <glade/glade.h>
-#include <gtk/gtk.h>
-
-#include "window-manager.h"
-
-#include "psppire-data-editor.h"
-
-#include "helper.h"
-#include "about.h"
-#include <data/procedure.h>
-#include "psppire-dialog.h"
-#include "psppire-selector.h"
-#include "weight-cases-dialog.h"
-#include "split-file-dialog.h"
-#include "transpose-dialog.h"
-#include "sort-cases-dialog.h"
-#include "select-cases-dialog.h"
-#include "compute-dialog.h"
-#include "goto-case-dialog.h"
-#include "find-dialog.h"
-#include "rank-dialog.h"
-#include "recode-dialog.h"
-#include "comments-dialog.h"
-#include "variable-info-dialog.h"
-#include "descriptives-dialog.h"
-#include "crosstabs-dialog.h"
-#include "frequencies-dialog.h"
-#include "examine-dialog.h"
-#include "dict-display.h"
-#include "regression-dialog.h"
-#include "text-data-import-dialog.h"
-
-#include "oneway-anova-dialog.h"
-#include "t-test-independent-samples-dialog.h"
-#include "t-test-one-sample.h"
-#include "t-test-paired-samples.h"
-
-#define _(msgid) gettext (msgid)
-#define N_(msgid) msgid
-
-#include "data-editor.h"
-#include "psppire-syntax-window.h"
-#include <language/syntax-string-source.h>
-#include <language/command.h>
-#include <ui/syntax-gen.h>
-#include "window-manager.h"
-
-#include "psppire-data-store.h"
-#include "psppire-var-store.h"
-
-static void on_edit_copy (GtkMenuItem *, gpointer);
-static void on_edit_cut (GtkMenuItem *, gpointer);
-static void on_edit_paste (GtkAction *a, gpointer data);
-
-
-static GtkWidget * create_data_sheet_variable_popup_menu (struct data_editor *);
-
-static GtkWidget * create_var_sheet_variable_popup_menu (struct data_editor *);
-
-static GtkWidget * create_data_sheet_cases_popup_menu (struct data_editor *);
-
-static void register_data_editor_actions (struct data_editor *de);
-static void on_insert_variable (GtkAction *, gpointer data);
-static void insert_case (GtkAction *a, gpointer data);
-
-static void toggle_value_labels (GtkToggleAction *a, gpointer data);
-static void toggle_split_window (GtkToggleAction *ta, gpointer data);
-
-
-/* Callback for when the dictionary changes properties*/
-static void on_weight_change (GObject *, gint, gpointer);
-static void on_filter_change (GObject *, gint, gpointer);
-static void on_split_change (PsppireDict *, gpointer);
-
-static void on_switch_sheet (GtkNotebook *notebook,
-                           GtkNotebookPage *page,
-                           guint page_num,
-                           gpointer user_data);
-
-static void status_bar_activate (GtkCheckMenuItem *, gpointer);
-
-static void grid_lines_activate (GtkCheckMenuItem *, gpointer);
-
-static void data_view_activate (GtkCheckMenuItem *, gpointer);
-
-static void variable_view_activate (GtkCheckMenuItem *, gpointer );
-
-static void fonts_activate (GtkMenuItem *, gpointer);
-
-static void file_quit (GtkCheckMenuItem *, gpointer );
-
-static void
-enable_delete_cases (GtkWidget *w, gint case_num, gpointer data)
-{
-  struct data_editor *de = data;
-
-  gtk_action_set_visible (de->delete_cases, case_num != -1);
-}
-
-
-static void
-enable_delete_variables (GtkWidget *w, gint var, gpointer data)
-{
-  struct data_editor *de = data;
-
-  gtk_action_set_visible (de->delete_variables, var != -1);
-}
-
-
-
-/* Run the EXECUTE command. */
-static void
-execute (GtkMenuItem *mi, gpointer data)
-{
-  struct getl_interface *sss = create_syntax_string_source ("EXECUTE.");
-
-  execute_syntax (sss);
-}
-
-static void
-transformation_change_callback (bool transformations_pending,
-                               gpointer data)
-{
-  struct data_editor *de = data;
-  GtkWidget *menuitem =
-    get_widget_assert (de->xml, "transform_run-pending");
-  GtkWidget *status_label  =
-    get_widget_assert (de->xml, "case-counter-area");
-
-  gtk_widget_set_sensitive (menuitem, transformations_pending);
-
-
-  if ( transformations_pending)
-    gtk_label_set_text (GTK_LABEL (status_label),
-                       _("Transformations Pending"));
-  else
-    gtk_label_set_text (GTK_LABEL (status_label), "");
-}
-
-
-static void open_data_file (const gchar *, struct data_editor *);
-
-
-/* Puts FILE_NAME into the recent list.
-   If it's already in the list, it moves it to the top
-*/
-static void
-add_most_recent (const char *file_name)
-{
-#if RECENT_LISTS_AVAILABLE
-
-  GtkRecentManager *manager = gtk_recent_manager_get_default();
-  gchar *uri = g_filename_to_uri (file_name, NULL, NULL);
-
-  gtk_recent_manager_remove_item (manager, uri, NULL);
-
-  if ( ! gtk_recent_manager_add_item (manager, uri))
-    g_warning ("Could not add item %s to recent list\n",uri);
-
-  g_free (uri);
-#endif
-}
-
-
-
-#if RECENT_LISTS_AVAILABLE
-
-static void
-on_recent_data_select (GtkMenuShell *menushell,   gpointer user_data)
-{
-  gchar *file;
-  struct data_editor *de = user_data;
-
-  gchar *uri =
-    gtk_recent_chooser_get_current_uri (GTK_RECENT_CHOOSER (menushell));
-
-  file = g_filename_from_uri (uri, NULL, NULL);
-
-  g_free (uri);
-
-  open_data_file (file, de);
-
-  g_free (file);
-}
-
-static void
-on_recent_files_select (GtkMenuShell *menushell,   gpointer user_data)
-{
-  gchar *file;
-
-  GtkWidget *se ;
-
-  gchar *uri =
-    gtk_recent_chooser_get_current_uri (GTK_RECENT_CHOOSER (menushell));
-
-  file = g_filename_from_uri (uri, NULL, NULL);
-
-  g_free (uri);
-
-  se = psppire_syntax_window_new ();
-
-  psppire_syntax_window_load_from_file (PSPPIRE_SYNTAX_WINDOW (se), file, NULL);
-  gtk_widget_show (se);
-
-  g_free (file);
-}
-
-#endif
-
-
-static void
-update_paste_menuitems (GtkWidget *w, gboolean x, gpointer data)
-{
-  struct data_editor *de = data;
-
-  GtkWidget * edit_paste = get_widget_assert (de->xml, "edit_paste");
-
-  gtk_widget_set_sensitive (edit_paste, x);
-}
-
-static void
-update_cut_copy_menuitems (GtkWidget *w, gboolean x, gpointer data)
-{
-  struct data_editor *de = data;
-
-  GtkWidget * edit_copy = get_widget_assert (de->xml, "edit_copy");
-  GtkWidget * edit_cut = get_widget_assert (de->xml, "edit_cut");
-
-  gtk_widget_set_sensitive (edit_copy, x);
-  gtk_widget_set_sensitive (edit_cut, x);
-}
-
-extern PsppireVarStore *the_var_store;
-extern struct dataset *the_dataset;
-extern PsppireDataStore *the_data_store ;
-
-
-/*
-  Create a new data editor.
-*/
-struct data_editor *
-new_data_editor (void)
-{
-  struct data_editor *de ;
-  struct editor_window *e;
-  PsppireVarStore *vs;
-  GtkWidget *vbox ;
-
-  de = g_malloc0 (sizeof (*de));
-
-  e = (struct editor_window *) de;
-
-  de->xml = XML_NEW ("data-editor.glade");
-
-
-  vbox = get_widget_assert (de->xml, "vbox1");
-
-  de->data_editor = PSPPIRE_DATA_EDITOR (psppire_data_editor_new (the_var_store, the_data_store));
-
-  g_signal_connect (de->data_editor, "data-selection-changed",
-                   G_CALLBACK (update_cut_copy_menuitems), de);
-
-  g_signal_connect (de->data_editor, "data-available-changed",
-                   G_CALLBACK (update_paste_menuitems), de);
-
-
-  gtk_widget_show (GTK_WIDGET (de->data_editor));
-
-  gtk_container_add (GTK_CONTAINER (vbox), GTK_WIDGET (de->data_editor));
-  gtk_box_reorder_child (GTK_BOX (vbox) , GTK_WIDGET (de->data_editor), 2);
-  dataset_add_transform_change_callback (the_dataset,
-                                        transformation_change_callback,
-                                        de);
-
-  vs = the_var_store;
-
-  g_assert(vs); /* Traps a possible bug in w32 build */
-
-  g_signal_connect (vs->dict, "weight-changed",
-                   G_CALLBACK (on_weight_change),
-                   de);
-
-  g_signal_connect (vs->dict, "filter-changed",
-                   G_CALLBACK (on_filter_change),
-                   de);
-
-  g_signal_connect (vs->dict, "split-changed",
-                   G_CALLBACK (on_split_change),
-                   de);
-
-  connect_help (de->xml);
-
-
-
-  g_signal_connect (get_widget_assert (de->xml, "edit_copy"),
-                   "activate",
-                   G_CALLBACK (on_edit_copy), de);
-
-  g_signal_connect (get_widget_assert (de->xml, "edit_cut"),
-                   "activate",
-                   G_CALLBACK (on_edit_cut), de);
-
-
-  register_data_editor_actions (de);
-
-  de->toggle_value_labels =
-    gtk_toggle_action_new ("toggle-value-labels",
-                          _("_Labels"),
-                          _("Show/hide value labels"),
-                          "pspp-value-labels");
-
-  g_signal_connect (de->toggle_value_labels, "toggled",
-                   G_CALLBACK (toggle_value_labels), de);
-
-
-  gtk_action_connect_proxy (GTK_ACTION (de->toggle_value_labels),
-                           get_widget_assert (de->xml,
-                                              "togglebutton-value-labels"));
-
-
-  gtk_action_connect_proxy (GTK_ACTION (de->toggle_value_labels),
-                           get_widget_assert (de->xml,
-                                              "view_value-labels"));
-
-  de->delete_cases =
-    gtk_action_new ("clear-cases",
-                   _("Clear"),
-                   _("Delete the cases at the selected position(s)"),
-                   "pspp-clear-cases");
-
-  g_signal_connect_swapped (de->delete_cases, "activate",
-                   G_CALLBACK (psppire_data_editor_delete_cases),
-                   de->data_editor);
-
-  gtk_action_connect_proxy (de->delete_cases,
-                           get_widget_assert (de->xml, "edit_clear-cases"));
-
-  g_signal_connect (get_widget_assert (de->xml, "edit_paste"), "activate",
-                   G_CALLBACK (on_edit_paste),
-                   de);
-
-  gtk_action_set_visible (de->delete_cases, FALSE);
-
-  de->delete_variables =
-    gtk_action_new ("clear-variables",
-                   _("Clear"),
-                   _("Delete the variables at the selected position(s)"),
-                   "pspp-clear-variables");
-
-  g_signal_connect_swapped (de->delete_variables, "activate",
-                           G_CALLBACK (psppire_data_editor_delete_variables),
-                           de->data_editor);
-
-  gtk_action_connect_proxy (de->delete_variables,
-                           get_widget_assert (de->xml, "edit_clear-variables")
-                           );
-
-  gtk_action_set_visible (de->delete_variables, FALSE);
-
-  de->insert_variable =
-    gtk_action_new ("insert-variable",
-                   _("Insert _Variable"),
-                   _("Create a new variable at the current position"),
-                   "pspp-insert-variable");
-
-  g_signal_connect (de->insert_variable, "activate",
-                   G_CALLBACK (on_insert_variable), de->data_editor);
-
-
-  gtk_action_connect_proxy (de->insert_variable,
-                           get_widget_assert (de->xml, "button-insert-variable")
-                           );
-
-  gtk_action_connect_proxy (de->insert_variable,
-                           get_widget_assert (de->xml, "edit_insert-variable")
-                           );
-
-
-  de->insert_case =
-    gtk_action_new ("insert-case",
-                   _("Insert Ca_se"),
-                   _("Create a new case at the current position"),
-                   "pspp-insert-case");
-
-  g_signal_connect (de->insert_case, "activate",
-                   G_CALLBACK (insert_case), de);
-
-
-  gtk_action_connect_proxy (de->insert_case,
-                           get_widget_assert (de->xml, "button-insert-case")
-                           );
-
-
-  gtk_action_connect_proxy (de->insert_case,
-                           get_widget_assert (de->xml, "edit_insert-case")
-                           );
-
-
-
-  de->invoke_goto_dialog =
-    gtk_action_new ("goto-case-dialog",
-                   _("_Goto Case"),
-                   _("Jump to a Case in the Data Sheet"),
-                   "gtk-jump-to");
-
-
-  gtk_action_connect_proxy (de->invoke_goto_dialog,
-                           get_widget_assert (de->xml, "button-goto-case")
-                           );
-
-  gtk_action_connect_proxy (de->invoke_goto_dialog,
-                           get_widget_assert (de->xml, "edit_goto-case")
-                           );
-
-
-  g_signal_connect (de->invoke_goto_dialog, "activate",
-                   G_CALLBACK (goto_case_dialog), de);
-
-
-  de->invoke_weight_cases_dialog =
-    gtk_action_new ("weight-cases-dialog",
-                   _("_Weights"),
-                   _("Weight cases by variable"),
-                   "pspp-weight-cases");
-
-  g_signal_connect (de->invoke_weight_cases_dialog, "activate",
-                   G_CALLBACK (weight_cases_dialog), de);
-
-
-  de->invoke_transpose_dialog =
-    gtk_action_new ("transpose-dialog",
-                   _("_Transpose"),
-                   _("Transpose the cases with the variables"),
-                   NULL);
-
-
-  g_signal_connect (de->invoke_transpose_dialog, "activate",
-                   G_CALLBACK (transpose_dialog), de);
-
-
-
-  de->invoke_split_file_dialog =
-    gtk_action_new ("split-file-dialog",
-                   _("S_plit"),
-                   _("Split the active file"),
-                   "pspp-split-file");
-
-  g_signal_connect (de->invoke_split_file_dialog, "activate",
-                   G_CALLBACK (split_file_dialog), de);
-
-
-
-  de->invoke_sort_cases_dialog =
-    gtk_action_new ("sort-cases-dialog",
-                   _("_Sort"),
-                   _("Sort cases in the active file"),
-                   "pspp-sort-cases");
-
-  g_signal_connect (de->invoke_sort_cases_dialog, "activate",
-                   G_CALLBACK (sort_cases_dialog), de);
-
-  de->invoke_select_cases_dialog =
-    gtk_action_new ("select-cases-dialog",
-                   _("Select _Cases"),
-                   _("Select cases from the active file"),
-                   "pspp-select-cases");
-
-  g_signal_connect (de->invoke_select_cases_dialog, "activate",
-                   G_CALLBACK (select_cases_dialog), de);
-
-
-  de->invoke_compute_dialog =
-    gtk_action_new ("compute-dialog",
-                   _("_Compute"),
-                   _("Compute new values for a variable"),
-                   "pspp-compute");
-
-  g_signal_connect (de->invoke_compute_dialog, "activate",
-                   G_CALLBACK (compute_dialog), de);
-
-  de->invoke_oneway_anova_dialog =
-    gtk_action_new ("oneway-anova",
-                   _("Oneway _ANOVA"),
-                   _("Perform one way analysis of variance"),
-                   NULL);
-
-  g_signal_connect (de->invoke_oneway_anova_dialog, "activate",
-                   G_CALLBACK (oneway_anova_dialog), de);
-
-  de->invoke_t_test_independent_samples_dialog =
-    gtk_action_new ("t-test-independent-samples",
-                   _("_Independent Samples T Test"),
-                   _("Calculate T Test for samples from independent groups"),
-                   NULL);
-
-  g_signal_connect (de->invoke_t_test_independent_samples_dialog, "activate",
-                   G_CALLBACK (t_test_independent_samples_dialog), de);
-
-
-  de->invoke_t_test_paired_samples_dialog =
-    gtk_action_new ("t-test-paired-samples",
-                   _("_Paired Samples T Test"),
-                   _("Calculate T Test for paired samples"),
-                   NULL);
-
-  g_signal_connect (de->invoke_t_test_paired_samples_dialog, "activate",
-                   G_CALLBACK (t_test_paired_samples_dialog), de);
-
-
-  de->invoke_t_test_one_sample_dialog =
-    gtk_action_new ("t-test-one-sample",
-                   _("One _Sample T Test"),
-                   _("Calculate T Test for sample from a single distribution"),
-                   NULL);
-
-  g_signal_connect (de->invoke_t_test_one_sample_dialog, "activate",
-                   G_CALLBACK (t_test_one_sample_dialog), de);
-
-
-  de->invoke_comments_dialog =
-    gtk_action_new ("commments-dialog",
-                   _("Data File _Comments"),
-                   _("Commentary text for the data file"),
-                   NULL);
-
-  g_signal_connect (de->invoke_comments_dialog, "activate",
-                   G_CALLBACK (comments_dialog), de);
-
-  de->invoke_find_dialog  =
-    gtk_action_new ("find-dialog",
-                   _("_Find"),
-                   _("Find Case"),
-                   "gtk-find");
-
-  g_signal_connect (de->invoke_find_dialog, "activate",
-                   G_CALLBACK (find_dialog), de);
-
-
-  de->invoke_rank_dialog  =
-    gtk_action_new ("rank-dialog",
-                   _("Ran_k Cases"),
-                   _("Rank Cases"),
-                   "pspp-rank-cases");
-
-  g_signal_connect (de->invoke_rank_dialog, "activate",
-                   G_CALLBACK (rank_dialog), de);
-
-
-  de->invoke_recode_same_dialog  =
-    gtk_action_new ("recode-same-dialog",
-                   _("Recode into _Same Variables"),
-                   _("Recode values into the same Variables"),
-                   "pspp-recode-same");
-
-  g_signal_connect (de->invoke_recode_same_dialog, "activate",
-                   G_CALLBACK (recode_same_dialog), de);
-
-
-  de->invoke_recode_different_dialog  =
-    gtk_action_new ("recode-different-dialog",
-                   _("Recode into _Different Variables"),
-                   _("Recode values into different Variables"),
-                   "pspp-recode-different");
-
-  g_signal_connect (de->invoke_recode_different_dialog, "activate",
-                   G_CALLBACK (recode_different_dialog), de);
-
-
-  de->invoke_variable_info_dialog  =
-    gtk_action_new ("variable-info-dialog",
-                   _("_Variables"),
-                   _("Jump to Variable"),
-                   "pspp-goto-variable");
-
-  g_signal_connect (de->invoke_variable_info_dialog, "activate",
-                   G_CALLBACK (variable_info_dialog), de);
-
-  de->invoke_descriptives_dialog =
-    gtk_action_new ("descriptives-dialog",
-                   _("_Descriptives"),
-                   _("Calculate descriptive statistics (mean, variance, ...)"),
-                   "pspp-descriptives");
-
-  g_signal_connect (de->invoke_descriptives_dialog, "activate",
-                   G_CALLBACK (descriptives_dialog), de);
-
-
-  de->invoke_frequencies_dialog =
-    gtk_action_new ("frequencies-dialog",
-                   _("_Frequencies"),
-                   _("Generate frequency statistics"),
-                   "pspp-frequencies");
-
-  g_signal_connect (de->invoke_frequencies_dialog, "activate",
-                   G_CALLBACK (frequencies_dialog), de);
-
-  de->invoke_crosstabs_dialog =
-    gtk_action_new ("crosstabs-dialog",
-                   _("_Crosstabs"),
-                   _("Generate crosstabulations"),
-                   "pspp-crosstabs");
-
-  g_signal_connect (de->invoke_crosstabs_dialog, "activate",
-                   G_CALLBACK (crosstabs_dialog), de);
-
-
-  de->invoke_examine_dialog =
-    gtk_action_new ("examine-dialog",
-                   _("_Explore"),
-                   _("Examine Data by Factors"),
-                   "pspp-examine");
-
-  g_signal_connect (de->invoke_examine_dialog, "activate",
-                   G_CALLBACK (examine_dialog), de);
-
-
-  de->invoke_regression_dialog =
-    gtk_action_new ("regression-dialog",
-                   _("Linear _Regression"),
-                   _("Estimate parameters of the linear model"),
-                   "pspp-regression");
-
-  g_signal_connect (de->invoke_regression_dialog, "activate",
-                   G_CALLBACK (regression_dialog), de);
-
-  e->window = GTK_WINDOW (get_widget_assert (de->xml, "data_editor"));
-
-  g_signal_connect_swapped (get_widget_assert (de->xml,"file_new_data"),
-                           "activate",
-                           G_CALLBACK (gtk_action_activate),
-                           de->action_data_new);
-
-  g_signal_connect_swapped (get_widget_assert (de->xml,"file_open_data"),
-                           "activate",
-                           G_CALLBACK (gtk_action_activate),
-                           de->action_data_open);
-
-#if RECENT_LISTS_AVAILABLE
-  {
-    GtkRecentManager *rm = gtk_recent_manager_get_default ();
-    GtkWidget *recent_data = get_widget_assert (de->xml, "file_recent-data");
-    GtkWidget *recent_files = get_widget_assert (de->xml, "file_recent-files");
-    GtkWidget *recent_separator = get_widget_assert (de->xml, "file_separator1");
-
-    GtkWidget *menu = gtk_recent_chooser_menu_new_for_manager (rm);
-
-    GtkRecentFilter *filter = gtk_recent_filter_new ();
-
-    gtk_widget_show (recent_data);
-    gtk_widget_show (recent_files);
-    gtk_widget_show (recent_separator);
-
-    gtk_recent_filter_add_pattern (filter, "*.sav");
-    gtk_recent_filter_add_pattern (filter, "*.SAV");
-
-    gtk_recent_chooser_add_filter (GTK_RECENT_CHOOSER (menu), filter);
-
-    gtk_widget_set_sensitive (recent_data, TRUE);
-    g_signal_connect (menu, "selection-done",
-                     G_CALLBACK (on_recent_data_select), de);
-
-    gtk_menu_item_set_submenu (GTK_MENU_ITEM (recent_data), menu);
-
-
-    filter = gtk_recent_filter_new ();
-    menu = gtk_recent_chooser_menu_new_for_manager (rm);
-
-    gtk_recent_filter_add_pattern (filter, "*.sps");
-    gtk_recent_filter_add_pattern (filter, "*.SPS");
-
-    gtk_recent_chooser_add_filter (GTK_RECENT_CHOOSER (menu), filter);
-
-    gtk_widget_set_sensitive (recent_files, TRUE);
-    g_signal_connect (menu, "selection-done",
-                     G_CALLBACK (on_recent_files_select), de);
-
-    gtk_menu_item_set_submenu (GTK_MENU_ITEM (recent_files), menu);
-  }
-#endif
-
-  g_signal_connect (get_widget_assert (de->xml,"file_new_syntax"),
-                   "activate",
-                   G_CALLBACK (create_syntax_window),
-                   NULL);
-
-  g_signal_connect (get_widget_assert (de->xml,"file_open_syntax"),
-                   "activate",
-                   G_CALLBACK (open_syntax_window),
-                   e->window);
-
-  g_signal_connect_swapped (get_widget_assert (de->xml,"file_import-text"),
-                           "activate",
-                           G_CALLBACK (gtk_action_activate),
-                           de->invoke_text_import_assistant);
-
-  g_signal_connect_swapped (get_widget_assert (de->xml,"file_save"),
-                           "activate",
-                           G_CALLBACK (gtk_action_activate),
-                           de->action_data_save);
-
-  g_signal_connect_swapped (get_widget_assert (de->xml,"file_save_as"),
-                           "activate",
-                           G_CALLBACK (gtk_action_activate),
-                           de->action_data_save_as);
-
-  gtk_action_connect_proxy (de->invoke_find_dialog,
-                           get_widget_assert (de->xml, "edit_find")
-                           );
-
-  gtk_action_connect_proxy (de->invoke_find_dialog,
-                           get_widget_assert (de->xml, "button-find")
-                           );
-
-  gtk_action_connect_proxy (de->invoke_rank_dialog,
-                           get_widget_assert (de->xml, "transform_rank")
-                           );
-
-  gtk_action_connect_proxy (de->invoke_recode_same_dialog,
-                           get_widget_assert (de->xml,
-                                              "transform_recode-same")
-                           );
-
-  gtk_action_connect_proxy (de->invoke_recode_different_dialog,
-                           get_widget_assert (de->xml,
-                                              "transform_recode-different")
-                           );
-
-  gtk_action_connect_proxy (de->invoke_weight_cases_dialog,
-                           get_widget_assert (de->xml, "data_weight-cases")
-                           );
-
-  gtk_action_connect_proxy (de->invoke_transpose_dialog,
-                           get_widget_assert (de->xml, "data_transpose")
-                           );
-
-  gtk_action_connect_proxy (de->invoke_split_file_dialog,
-                           get_widget_assert (de->xml, "data_split-file")
-                           );
-
-  gtk_action_connect_proxy (de->invoke_sort_cases_dialog,
-                           get_widget_assert (de->xml, "data_sort-cases")
-                           );
-
-  gtk_action_connect_proxy (de->invoke_select_cases_dialog,
-                           get_widget_assert (de->xml, "data_select-cases")
-                           );
-
-  gtk_action_connect_proxy (de->invoke_compute_dialog,
-                           get_widget_assert (de->xml, "transform_compute")
-                           );
-
-  gtk_action_connect_proxy (de->invoke_t_test_independent_samples_dialog,
-                           get_widget_assert (de->xml,
-                                              "indep-t-test")
-                           );
-
-
-  gtk_action_connect_proxy (de->invoke_t_test_paired_samples_dialog,
-                           get_widget_assert (de->xml,
-                                              "paired-t-test")
-                           );
-
-
-  gtk_action_connect_proxy (de->invoke_t_test_one_sample_dialog,
-                           get_widget_assert (de->xml,
-                                              "one-sample-t-test")
-                           );
-
-
-  gtk_action_connect_proxy (de->invoke_oneway_anova_dialog,
-                           get_widget_assert (de->xml,
-                                              "oneway-anova")
-                           );
-
-
-  gtk_action_connect_proxy (de->invoke_comments_dialog,
-                           get_widget_assert (de->xml, "utilities_comments")
-                           );
-
-  gtk_action_connect_proxy (de->invoke_variable_info_dialog,
-                           get_widget_assert (de->xml, "utilities_variables")
-                           );
-
-  gtk_action_connect_proxy (de->invoke_descriptives_dialog,
-                           get_widget_assert (de->xml, "analyze_descriptives")
-                           );
-
-  gtk_action_connect_proxy (de->invoke_crosstabs_dialog,
-                           get_widget_assert (de->xml, "crosstabs")
-                           );
-
-  gtk_action_connect_proxy (de->invoke_frequencies_dialog,
-                           get_widget_assert (de->xml, "analyze_frequencies")
-                           );
-
-
-  gtk_action_connect_proxy (de->invoke_examine_dialog,
-                           get_widget_assert (de->xml, "analyze_explore")
-                           );
-
-  gtk_action_connect_proxy (de->invoke_regression_dialog,
-                           get_widget_assert (de->xml, "linear-regression")
-                           );
-
-  g_signal_connect (get_widget_assert (de->xml,"help_about"),
-                   "activate",
-                   G_CALLBACK (about_new),
-                   e->window);
-
-
-  g_signal_connect (get_widget_assert (de->xml,"help_reference"),
-                   "activate",
-                   G_CALLBACK (reference_manual),
-                   e->window);
-
-
-  g_signal_connect (de->data_editor,
-                   "cases-selected",
-                   G_CALLBACK (enable_delete_cases),
-                   de);
-
-
-  g_signal_connect (de->data_editor,
-                   "variables-selected",
-                   G_CALLBACK (enable_delete_variables),
-                   de);
-
-
-  g_signal_connect (GTK_NOTEBOOK (de->data_editor),
-                   "switch-page",
-                   G_CALLBACK (on_switch_sheet), de);
-
-  gtk_notebook_set_current_page (GTK_NOTEBOOK (de->data_editor), PSPPIRE_DATA_EDITOR_VARIABLE_VIEW);
-  gtk_notebook_set_current_page (GTK_NOTEBOOK (de->data_editor), PSPPIRE_DATA_EDITOR_DATA_VIEW);
-
-  g_signal_connect (get_widget_assert (de->xml, "view_statusbar"),
-                   "activate",
-                   G_CALLBACK (status_bar_activate), de);
-
-
-  g_signal_connect (get_widget_assert (de->xml, "view_gridlines"),
-                   "activate",
-                   G_CALLBACK (grid_lines_activate), de);
-
-
-
-  g_signal_connect (get_widget_assert (de->xml, "view_data"),
-                   "activate",
-                   G_CALLBACK (data_view_activate), de);
-
-  g_signal_connect (get_widget_assert (de->xml, "view_variables"),
-                   "activate",
-                   G_CALLBACK (variable_view_activate), de);
-
-
-
-  g_signal_connect (get_widget_assert (de->xml, "view_fonts"),
-                   "activate",
-                   G_CALLBACK (fonts_activate), de);
-
-
-
-
-  gtk_action_connect_proxy (de->action_data_open,
-                           get_widget_assert (de->xml, "button-open")
-                           );
-
-  gtk_action_connect_proxy (de->action_data_save,
-                           get_widget_assert (de->xml, "button-save")
-                           );
-
-  gtk_action_connect_proxy (de->invoke_variable_info_dialog,
-                           get_widget_assert (de->xml, "button-goto-variable")
-                           );
-
-  gtk_action_connect_proxy (de->invoke_weight_cases_dialog,
-                           get_widget_assert (de->xml, "button-weight-cases")
-                           );
-
-  gtk_action_connect_proxy (de->invoke_split_file_dialog,
-                           get_widget_assert (de->xml, "button-split-file")
-                           );
-
-  gtk_action_connect_proxy (de->invoke_select_cases_dialog,
-                           get_widget_assert (de->xml, "button-select-cases")
-                           );
-
-
-  g_signal_connect (get_widget_assert (de->xml, "file_quit"),
-                   "activate",
-                   G_CALLBACK (file_quit), de);
-
-  g_signal_connect (get_widget_assert (de->xml, "transform_run-pending"),
-                   "activate",
-                   G_CALLBACK (execute), de);
-
-
-  g_signal_connect (get_widget_assert (de->xml, "windows_minimise_all"),
-                   "activate",
-                   G_CALLBACK (minimise_all_windows), NULL);
-
-  de->toggle_split_window =
-    gtk_toggle_action_new ("toggle-split-window",
-                          _("_Split Window"),
-                          _("Split the window vertically and horizontally"),
-                          "pspp-split-window");
-
-  g_signal_connect (de->toggle_split_window, "toggled",
-                   G_CALLBACK (toggle_split_window),
-                   de);
-
-  gtk_action_connect_proxy (GTK_ACTION (de->toggle_split_window),
-                           get_widget_assert (de->xml,
-                                              "windows_split"));
-
-  de->data_sheet_variable_popup_menu =
-    GTK_MENU (create_data_sheet_variable_popup_menu (de));
-
-  de->var_sheet_variable_popup_menu =
-    GTK_MENU (create_var_sheet_variable_popup_menu (de));
-
-  de->data_sheet_cases_popup_menu =
-    GTK_MENU (create_data_sheet_cases_popup_menu (de));
-
-
-  g_object_set (de->data_editor,
-               "datasheet-column-menu", de->data_sheet_variable_popup_menu,
-               "datasheet-row-menu", de->data_sheet_cases_popup_menu,
-               "varsheet-row-menu", de->var_sheet_variable_popup_menu,
-               NULL);
-
-
-  return de;
-}
-
-
-void
-new_data_window (GtkMenuItem *menuitem, gpointer parent)
-{
-  window_create (WINDOW_DATA, NULL);
-}
-
-/* Callback for when the datasheet/varsheet is selected */
-static void
-on_switch_sheet (GtkNotebook *notebook,
-               GtkNotebookPage *page,
-               guint page_num,
-               gpointer user_data)
-{
-  struct data_editor *de = user_data;
-
-  GtkWidget *view_data = get_widget_assert (de->xml, "view_data");
-  GtkWidget *view_variables = get_widget_assert (de->xml, "view_variables");
-
-  switch (page_num)
-    {
-    case PSPPIRE_DATA_EDITOR_VARIABLE_VIEW:
-      gtk_widget_hide (view_variables);
-      gtk_widget_show (view_data);
-      gtk_action_set_sensitive (de->insert_variable, TRUE);
-      gtk_action_set_sensitive (de->insert_case, FALSE);
-      gtk_action_set_sensitive (de->invoke_goto_dialog, FALSE);
-      break;
-    case PSPPIRE_DATA_EDITOR_DATA_VIEW:
-      gtk_widget_show (view_variables);
-      gtk_widget_hide (view_data);
-      gtk_action_set_sensitive (de->invoke_goto_dialog, TRUE);
-      gtk_action_set_sensitive (de->insert_case, TRUE);
-      break;
-    default:
-      g_assert_not_reached ();
-      break;
-    }
-
-#if 0
-  update_paste_menuitem (de, page_num);
-#endif
-}
-
-
-static void
-status_bar_activate (GtkCheckMenuItem *menuitem, gpointer data)
-{
-  struct data_editor *de = data;
-  GtkWidget *statusbar = get_widget_assert (de->xml, "status-bar");
-
-  if ( gtk_check_menu_item_get_active (menuitem) )
-    gtk_widget_show (statusbar);
-  else
-    gtk_widget_hide (statusbar);
-}
-
-
-static void
-grid_lines_activate (GtkCheckMenuItem *menuitem, gpointer data)
-{
-  struct data_editor *de = data;
-  const gboolean grid_visible = gtk_check_menu_item_get_active (menuitem);
-
-  psppire_data_editor_show_grid (de->data_editor, grid_visible);
-}
-
-
-
-static void
-data_view_activate (GtkCheckMenuItem *menuitem, gpointer data)
-{
-  struct data_editor *de = data;
-
-  gtk_notebook_set_current_page (GTK_NOTEBOOK (de->data_editor), PSPPIRE_DATA_EDITOR_DATA_VIEW);
-}
-
-
-static void
-variable_view_activate (GtkCheckMenuItem *menuitem, gpointer data)
-{
-  struct data_editor *de = data;
-
-  gtk_notebook_set_current_page (GTK_NOTEBOOK (de->data_editor), PSPPIRE_DATA_EDITOR_VARIABLE_VIEW);
-}
-
-
-static void
-fonts_activate (GtkMenuItem *menuitem, gpointer data)
-{
-  struct data_editor *de = data;
-  PangoFontDescription *current_font;
-  gchar *font_name;
-  GtkWidget *dialog =
-    gtk_font_selection_dialog_new (_("Font Selection"));
-
-
-  current_font = GTK_WIDGET(de->data_editor)->style->font_desc;
-  font_name = pango_font_description_to_string (current_font);
-
-  gtk_font_selection_dialog_set_font_name (GTK_FONT_SELECTION_DIALOG (dialog), font_name);
-
-  g_free (font_name);
-
-  gtk_window_set_transient_for (GTK_WINDOW (dialog),
-                               GTK_WINDOW (get_widget_assert (de->xml,
-                                                              "data_editor")));
-  if ( GTK_RESPONSE_OK == gtk_dialog_run (GTK_DIALOG (dialog)) )
-    {
-      const gchar *font = gtk_font_selection_dialog_get_font_name
-       (GTK_FONT_SELECTION_DIALOG (dialog));
-
-      PangoFontDescription* font_desc =
-       pango_font_description_from_string (font);
-
-      psppire_data_editor_set_font (de->data_editor, font_desc);
-    }
-
-  gtk_widget_hide (dialog);
-}
-
-
-
-/* Callback for the value labels action */
-static void
-toggle_value_labels (GtkToggleAction *ta, gpointer data)
-{
-  struct data_editor *de = data;
-
-  g_object_set (de->data_editor, "value-labels", gtk_toggle_action_get_active (ta), NULL);
-}
-
-
-
-static void
-toggle_split_window (GtkToggleAction *ta, gpointer data)
-{
-  struct data_editor *de = data;
-
-  psppire_data_editor_split_window (de->data_editor,
-                                   gtk_toggle_action_get_active (ta));
-}
-
-
-
-
-static void
-file_quit (GtkCheckMenuItem *menuitem, gpointer data)
-{
-  /* FIXME: Need to be more intelligent here.
-     Give the user the opportunity to save any unsaved data.
-  */
-  g_object_unref (the_data_store);
-  gtk_main_quit ();
-}
-
-
-static void
-insert_case (GtkAction *action, gpointer data)
-{
-  struct data_editor *de = data;
-
-  psppire_data_editor_insert_case (de->data_editor);
-}
-
-static void
-on_insert_variable (GtkAction *action, gpointer data)
-{
-  PsppireDataEditor *de = PSPPIRE_DATA_EDITOR (data);
-  psppire_data_editor_insert_variable (de);
-}
-
-
-/* Callback for when the dictionary changes its split variables */
-static void
-on_split_change (PsppireDict *dict, gpointer data)
-{
-  struct data_editor *de = data;
-
-  size_t n_split_vars = dict_get_split_cnt (dict->dict);
-
-  GtkWidget *split_status_area =
-    get_widget_assert (de->xml, "split-file-status-area");
-
-  if ( n_split_vars == 0 )
-    {
-      gtk_label_set_text (GTK_LABEL (split_status_area), _("No Split"));
-    }
-  else
-    {
-      gint i;
-      GString *text;
-      const struct variable *const * split_vars =
-       dict_get_split_vars (dict->dict);
-
-      text = g_string_new (_("Split by "));
-
-      for (i = 0 ; i < n_split_vars - 1; ++i )
-       {
-         g_string_append_printf (text, "%s, ", var_get_name (split_vars[i]));
-       }
-      g_string_append (text, var_get_name (split_vars[i]));
-
-      gtk_label_set_text (GTK_LABEL (split_status_area), text->str);
-
-      g_string_free (text, TRUE);
-    }
-}
-
-
-/* Callback for when the dictionary changes its filter variable */
-static void
-on_filter_change (GObject *o, gint filter_index, gpointer data)
-{
-  struct data_editor *de = data;
-  GtkWidget *filter_status_area =
-    get_widget_assert (de->xml, "filter-use-status-area");
-
-  if ( filter_index == -1 )
-    {
-      gtk_label_set_text (GTK_LABEL (filter_status_area), _("Filter off"));
-    }
-  else
-    {
-      PsppireVarStore *vs = NULL;
-      struct variable *var ;
-      gchar *text ;
-
-      g_object_get (de->data_editor, "var-store", &vs, NULL);
-
-      var = psppire_dict_get_variable (vs->dict, filter_index);
-
-      text = g_strdup_printf (_("Filter by %s"), var_get_name (var));
-
-      gtk_label_set_text (GTK_LABEL (filter_status_area), text);
-
-      g_free (text);
-    }
-}
-
-/* Callback for when the dictionary changes its weights */
-static void
-on_weight_change (GObject *o, gint weight_index, gpointer data)
-{
-  struct data_editor *de = data;
-  GtkWidget *weight_status_area =
-    get_widget_assert (de->xml, "weight-status-area");
-
-  if ( weight_index == -1 )
-    {
-      gtk_label_set_text (GTK_LABEL (weight_status_area), _("Weights off"));
-    }
-  else
-    {
-      struct variable *var ;
-      PsppireVarStore *vs = NULL;
-      gchar *text;
-
-      g_object_get (de->data_editor, "var-store", &vs, NULL);
-
-      var = psppire_dict_get_variable (vs->dict, weight_index);
-
-      text = g_strdup_printf (_("Weight by %s"), var_get_name (var));
-
-      gtk_label_set_text (GTK_LABEL (weight_status_area), text);
-
-      g_free (text);
-    }
-}
-
-
-
-\f
-static void data_save_as_dialog (GtkAction *, struct data_editor *de);
-static void new_file (GtkAction *, struct editor_window *de);
-static void open_data_dialog (GtkAction *, struct data_editor *de);
-static void data_save (GtkAction *action, struct data_editor *e);
-
-
-/* Create the GtkActions and connect to their signals */
-static void
-register_data_editor_actions (struct data_editor *de)
-{
-  de->action_data_open =
-    gtk_action_new ("data-open-dialog",
-                   _("Open"),
-                   _("Open a data file"),
-                   "gtk-open");
-
-  g_signal_connect (de->action_data_open, "activate",
-                   G_CALLBACK (open_data_dialog), de);
-
-
-  de->action_data_save = gtk_action_new ("data-save",
-                                           _("Save"),
-                                           _("Save data to file"),
-                                           "gtk-save");
-
-  g_signal_connect (de->action_data_save, "activate",
-                   G_CALLBACK (data_save), de);
-
-
-
-  de->action_data_save_as = gtk_action_new ("data-save-as-dialog",
-                                           _("Save As"),
-                                           _("Save data to file"),
-                                           "gtk-save");
-
-  g_signal_connect (de->action_data_save_as, "activate",
-                   G_CALLBACK (data_save_as_dialog), de);
-
-  de->action_data_new =
-    gtk_action_new ("data-new",
-                   _("New"),
-                   _("New data file"),
-                   NULL);
-
-  g_signal_connect (de->action_data_new, "activate",
-                   G_CALLBACK (new_file), de);
-
-  de->invoke_text_import_assistant =
-    gtk_action_new ("file_import-text",
-                   _("_Import Text Data"),
-                   _("Import text data file"),
-                   "");
-
-  g_signal_connect (de->invoke_text_import_assistant, "activate",
-                   G_CALLBACK (text_data_import_assistant), de);
-}
-
-/* Returns true if NAME has a suffix which might denote a PSPP file */
-static gboolean
-name_has_suffix (const gchar *name)
-{
-  if ( g_str_has_suffix (name, ".sav"))
-    return TRUE;
-  if ( g_str_has_suffix (name, ".SAV"))
-    return TRUE;
-  if ( g_str_has_suffix (name, ".por"))
-    return TRUE;
-  if ( g_str_has_suffix (name, ".POR"))
-    return TRUE;
-
-  return FALSE;
-}
-
-/* Append SUFFIX to the filename of DE */
-static void
-append_filename_suffix (struct data_editor *de, const gchar *suffix)
-{
-  if ( ! name_has_suffix (de->file_name))
-    {
-      gchar *s = de->file_name;
-      de->file_name = g_strconcat (de->file_name, suffix, NULL);
-      g_free (s);
-    }
-}
-
-/* Save DE to file */
-static void
-save_file (struct data_editor *de)
-{
-  struct getl_interface *sss;
-  struct string file_name ;
-
-  g_assert (de->file_name);
-
-  ds_init_empty (&file_name);
-  syntax_gen_string (&file_name, ss_cstr (de->file_name));
-
-  if ( de->save_as_portable )
-    {
-      append_filename_suffix (de, ".por");
-      sss = create_syntax_string_source ("EXPORT OUTFILE=%s.",
-                                        ds_cstr (&file_name));
-    }
-  else
-    {
-      append_filename_suffix (de, ".sav");
-      sss = create_syntax_string_source ("SAVE OUTFILE=%s.",
-                                        ds_cstr (&file_name));
-    }
-
-  ds_destroy (&file_name);
-
-  execute_syntax (sss);
-}
-
-
-/* Callback for data_save action.
-   If there's an existing file name, then just save,
-   otherwise prompt for a file name, then save */
-static void
-data_save (GtkAction *action, struct data_editor *de)
-{
-  if ( de->file_name)
-    save_file (de);
-  else
-    data_save_as_dialog (action, de);
-}
-
-
-/* Callback for data_save_as action. Prompt for a filename and save */
-static void
-data_save_as_dialog (GtkAction *action, struct data_editor *de)
-{
-  struct editor_window *e = (struct editor_window *) de;
-
-  GtkWidget *button_sys;
-  GtkWidget *dialog =
-    gtk_file_chooser_dialog_new (_("Save"),
-                                GTK_WINDOW (e->window),
-                                GTK_FILE_CHOOSER_ACTION_SAVE,
-                                GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-                                GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
-                                NULL);
-
-  GtkFileFilter *filter = gtk_file_filter_new ();
-  gtk_file_filter_set_name (filter, _("System Files (*.sav)"));
-  gtk_file_filter_add_pattern (filter, "*.sav");
-  gtk_file_filter_add_pattern (filter, "*.SAV");
-  gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
-
-  filter = gtk_file_filter_new ();
-  gtk_file_filter_set_name (filter, _("Portable Files (*.por) "));
-  gtk_file_filter_add_pattern (filter, "*.por");
-  gtk_file_filter_add_pattern (filter, "*.POR");
-  gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
-
-  filter = gtk_file_filter_new ();
-  gtk_file_filter_set_name (filter, _("All Files"));
-  gtk_file_filter_add_pattern (filter, "*");
-  gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
-
-  {
-    GtkWidget *button_por;
-    GtkWidget *vbox = gtk_vbox_new (TRUE, 5);
-    button_sys =
-      gtk_radio_button_new_with_label (NULL, _("System File"));
-
-    button_por =
-      gtk_radio_button_new_with_label
-      (gtk_radio_button_get_group (GTK_RADIO_BUTTON(button_sys)),
-       _("Portable File"));
-
-    gtk_box_pack_start_defaults (GTK_BOX (vbox), button_sys);
-    gtk_box_pack_start_defaults (GTK_BOX (vbox), button_por);
-
-    gtk_widget_show_all (vbox);
-
-    gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER(dialog), vbox);
-  }
-
-  switch (gtk_dialog_run (GTK_DIALOG (dialog)))
-    {
-    case GTK_RESPONSE_ACCEPT:
-      {
-       g_free (de->file_name);
-
-       de->file_name =
-         gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
-
-       de->save_as_portable =
-         ! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button_sys));
-
-       if ( de->save_as_portable)
-         append_filename_suffix (de, ".por");
-       else
-         append_filename_suffix (de, ".sav");
-
-       save_file (de);
-
-       window_set_name_from_filename (e, de->file_name);
-      }
-      break;
-    default:
-      break;
-    }
-
-  gtk_widget_destroy (dialog);
-}
-
-
-/* Callback for data_new action.
-   Performs the NEW FILE command */
-static void
-new_file (GtkAction *action, struct editor_window *e)
-{
-  struct data_editor *de = (struct data_editor *) e;
-
-  struct getl_interface *sss =
-    create_syntax_string_source ("NEW FILE.");
-
-  execute_syntax (sss);
-
-  g_free (de->file_name);
-  de->file_name = NULL;
-
-  default_window_name (e);
-}
-
-
-static void
-open_data_file (const gchar *file_name, struct data_editor *de)
-{
-  struct getl_interface *sss;
-  struct string filename;
-
-  ds_init_empty (&filename);
-  syntax_gen_string (&filename, ss_cstr (file_name));
-
-  sss = create_syntax_string_source ("GET FILE=%s.",
-                                    ds_cstr (&filename));
-  ds_destroy (&filename);
-
-  if (execute_syntax (sss) )
-  {
-    window_set_name_from_filename ((struct editor_window *) de, file_name);
-    add_most_recent (file_name);
-  }
-}
-
-
-
-/* Callback for the data_open action.
-   Prompts for a filename and opens it */
-static void
-open_data_dialog (GtkAction *action, struct data_editor *de)
-{
-  struct editor_window *e = (struct editor_window *) de;
-
-  GtkWidget *dialog =
-    gtk_file_chooser_dialog_new (_("Open"),
-                                GTK_WINDOW (e->window),
-                                GTK_FILE_CHOOSER_ACTION_OPEN,
-                                GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-                                GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
-                                NULL);
-
-  GtkFileFilter *filter = gtk_file_filter_new ();
-  gtk_file_filter_set_name (filter, _("System Files (*.sav)"));
-  gtk_file_filter_add_pattern (filter, "*.sav");
-  gtk_file_filter_add_pattern (filter, "*.SAV");
-  gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
-
-  filter = gtk_file_filter_new ();
-  gtk_file_filter_set_name (filter, _("Portable Files (*.por) "));
-  gtk_file_filter_add_pattern (filter, "*.por");
-  gtk_file_filter_add_pattern (filter, "*.POR");
-  gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
-
-  filter = gtk_file_filter_new ();
-  gtk_file_filter_set_name (filter, _("All Files"));
-  gtk_file_filter_add_pattern (filter, "*");
-  gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
-
-
-  if ( de->file_name)
-    {
-      gchar *dir_name = g_path_get_dirname (de->file_name);
-      gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog),
-                                          dir_name);
-      free (dir_name);
-    }
-
-  switch (gtk_dialog_run (GTK_DIALOG (dialog)))
-    {
-    case GTK_RESPONSE_ACCEPT:
-      {
-       g_free (de->file_name);
-       de->file_name =
-         gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
-
-       open_data_file (de->file_name, de);
-      }
-      break;
-    default:
-      break;
-    }
-
-  gtk_widget_destroy (dialog);
-}
-
-
-static GtkWidget *
-create_data_sheet_variable_popup_menu (struct data_editor *de)
-{
-  GtkWidget *menu = gtk_menu_new ();
-
-  GtkWidget *sort_ascending =
-    gtk_menu_item_new_with_label (_("Sort Ascending"));
-
-  GtkWidget *sort_descending =
-    gtk_menu_item_new_with_label (_("Sort Descending"));
-
-  GtkWidget *insert_variable =
-    gtk_menu_item_new_with_label (_("Insert Variable"));
-
-  GtkWidget *clear_variable =
-    gtk_menu_item_new_with_label (_("Clear"));
-
-
-  gtk_action_connect_proxy (de->delete_variables,
-                           clear_variable );
-
-
-  gtk_menu_shell_append (GTK_MENU_SHELL (menu), insert_variable);
-
-
-  gtk_menu_shell_append (GTK_MENU_SHELL (menu),
-                        gtk_separator_menu_item_new ());
-
-
-  gtk_menu_shell_append (GTK_MENU_SHELL (menu), clear_variable);
-
-
-  gtk_menu_shell_append (GTK_MENU_SHELL (menu),
-                        gtk_separator_menu_item_new ());
-
-
-  gtk_menu_shell_append (GTK_MENU_SHELL (menu), sort_ascending);
-
-
-  g_signal_connect_swapped (G_OBJECT (sort_ascending), "activate",
-                           G_CALLBACK (psppire_data_editor_sort_ascending),
-                           de->data_editor);
-
-  g_signal_connect_swapped (G_OBJECT (sort_descending), "activate",
-                           G_CALLBACK (psppire_data_editor_sort_descending),
-                           de->data_editor);
-
-  g_signal_connect_swapped (G_OBJECT (insert_variable), "activate",
-                           G_CALLBACK (gtk_action_activate),
-                           de->insert_variable);
-
-
-  gtk_menu_shell_append (GTK_MENU_SHELL (menu), sort_descending);
-
-  gtk_widget_show_all (menu);
-
-  return menu;
-}
-
-
-static GtkWidget *
-create_data_sheet_cases_popup_menu (struct data_editor *de)
-{
-  GtkWidget *menu = gtk_menu_new ();
-
-  GtkWidget *insert_case =
-    gtk_menu_item_new_with_label (_("Insert Case"));
-
-  GtkWidget *delete_case =
-    gtk_menu_item_new_with_label (_("Clear"));
-
-
-  gtk_action_connect_proxy (de->delete_cases,
-                           delete_case);
-
-
-  gtk_menu_shell_append (GTK_MENU_SHELL (menu), insert_case);
-
-  g_signal_connect_swapped (G_OBJECT (insert_case), "activate",
-                           G_CALLBACK (gtk_action_activate),
-                           de->insert_case);
-
-
-  gtk_menu_shell_append (GTK_MENU_SHELL (menu),
-                        gtk_separator_menu_item_new ());
-
-
-  gtk_menu_shell_append (GTK_MENU_SHELL (menu), delete_case);
-
-
-  gtk_widget_show_all (menu);
-
-  return menu;
-}
-
-
-static GtkWidget *
-create_var_sheet_variable_popup_menu (struct data_editor *de)
-{
-  GtkWidget *menu = gtk_menu_new ();
-
-  GtkWidget *insert_variable =
-    gtk_menu_item_new_with_label (_("Insert Variable"));
-
-  GtkWidget *delete_variable =
-    gtk_menu_item_new_with_label (_("Clear"));
-
-
-  gtk_action_connect_proxy (de->delete_variables,
-                           delete_variable);
-
-
-  gtk_menu_shell_append (GTK_MENU_SHELL (menu), insert_variable);
-
-  g_signal_connect_swapped (G_OBJECT (insert_variable), "activate",
-                           G_CALLBACK (gtk_action_activate),
-                           de->insert_variable);
-
-
-  gtk_menu_shell_append (GTK_MENU_SHELL (menu),
-                        gtk_separator_menu_item_new ());
-
-
-  gtk_menu_shell_append (GTK_MENU_SHELL (menu), delete_variable);
-
-
-  gtk_widget_show_all (menu);
-
-  return menu;
-}
-
-
-
-\f
-
-static void
-on_edit_paste (GtkAction *a, gpointer data)
-{
-  struct data_editor *de = data;
-
-  psppire_data_editor_clip_paste (de->data_editor);
-}
-
-static void
-on_edit_copy (GtkMenuItem *m, gpointer data)
-{
-  struct data_editor *de = data;
-
-  psppire_data_editor_clip_copy (de->data_editor);
-}
-
-
-
-static void
-on_edit_cut (GtkMenuItem *m, gpointer data)
-{
-  struct data_editor *de = data;
-
-  psppire_data_editor_clip_cut (de->data_editor);
-}
diff --git a/src/ui/gui/data-editor.h b/src/ui/gui/data-editor.h
deleted file mode 100644 (file)
index af282e2..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-/* PSPPIRE - a graphical user interface for PSPP.
-   Copyright (C) 2006, 2007  Free Software Foundation
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation, either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>. */
-
-
-#ifndef DATA_EDITOR_H
-#define DATA_EDITOR_H
-
-#include <glade/glade.h>
-#include <gtk/gtk.h>
-#include "window-manager.h"
-#include "psppire-data-editor.h"
-
-struct data_editor
-{
-  struct editor_window parent;
-
-  GtkAction *action_data_new;
-  GtkAction *action_data_open;
-  GtkAction *action_data_save_as;
-  GtkAction *action_data_save;
-
-
-  GtkAction *invoke_text_import_assistant;
-
-  /* Actions which invoke dialog boxes */
-  GtkAction *invoke_weight_cases_dialog;
-  GtkAction *invoke_transpose_dialog;
-  GtkAction *invoke_split_file_dialog;
-  GtkAction *invoke_sort_cases_dialog;
-  GtkAction *invoke_compute_dialog;
-  GtkAction *invoke_comments_dialog;
-  GtkAction *invoke_select_cases_dialog;
-  GtkAction *invoke_goto_dialog;
-  GtkAction *invoke_variable_info_dialog;
-  GtkAction *invoke_find_dialog;
-  GtkAction *invoke_rank_dialog;
-  GtkAction *invoke_recode_same_dialog;
-  GtkAction *invoke_recode_different_dialog;
-
-  GtkAction *invoke_crosstabs_dialog;
-  GtkAction *invoke_descriptives_dialog;
-  GtkAction *invoke_frequencies_dialog;
-  GtkAction *invoke_examine_dialog;
-  GtkAction *invoke_regression_dialog;
-
-  GtkAction *invoke_t_test_independent_samples_dialog;
-  GtkAction *invoke_t_test_paired_samples_dialog;
-  GtkAction *invoke_oneway_anova_dialog;
-  GtkAction *invoke_t_test_one_sample_dialog;
-
-  GtkToggleAction *toggle_split_window;
-
-
-  /* Actions which do things */
-  GtkAction *insert_variable;
-  GtkAction *insert_case;
-  GtkAction *delete_variables;
-  GtkAction *delete_cases;
-
-  GtkToggleAction *toggle_value_labels;
-
-  GladeXML *xml;
-
-  GtkMenu *data_sheet_variable_popup_menu;
-  GtkMenu *data_sheet_cases_popup_menu;
-
-  GtkMenu *var_sheet_variable_popup_menu;
-
-  PsppireDataEditor *data_editor;
-
-  gboolean save_as_portable;
-
-  /* Name of the file this data is associated with (ie, was loaded from or
-     has been  saved to), in "filename encoding",  or NULL, if it's not
-     associated with any file */
-  gchar *file_name;
-};
-
-
-struct data_editor * new_data_editor (void);
-
-void new_data_window (GtkMenuItem *, gpointer);
-
-void data_editor_select_sheet (struct data_editor *de, gint page);
-
-#endif
index 9374622140fc80f81967201862b66176571acbbe..f909ed02328e166311a1401a08a92af7d300c741 100644 (file)
@@ -23,7 +23,7 @@
 #include <stdlib.h>
 
 #include <language/syntax-string-source.h>
-#include <ui/gui/data-editor.h>
+#include <ui/gui/psppire-data-window.h>
 #include <ui/gui/dialog-common.h>
 #include <ui/gui/dict-display.h>
 #include <ui/gui/helper.h>
@@ -202,7 +202,7 @@ void
 descriptives_dialog (GObject *o, gpointer data)
 {
   gint response;
-  struct data_editor *de = data;
+  PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
 
   struct descriptives_dialog scd;
 
@@ -221,7 +221,7 @@ descriptives_dialog (GObject *o, gpointer data)
 
   g_object_get (de->data_editor, "var-store", &vs, NULL);
 
-  gtk_window_set_transient_for (GTK_WINDOW (dialog), de->parent.window);
+  gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de));
 
   attach_dictionary_to_treeview (GTK_TREE_VIEW (source),
                                 vs->dict,
index 5f6a9bb844dff9d03d40c182bba9e8aca6f287a6..33f8b129e888ca0b375fd644d71a34dc564ad7dc 100644 (file)
@@ -22,7 +22,7 @@
 #include <stdlib.h>
 
 #include <language/syntax-string-source.h>
-#include <ui/gui/data-editor.h>
+#include <ui/gui/psppire-data-window.h>
 #include <ui/gui/dialog-common.h>
 #include <ui/gui/dict-display.h>
 #include <ui/gui/helper.h>
@@ -236,7 +236,7 @@ void
 examine_dialog (GObject *o, gpointer data)
 {
   gint response;
-  struct data_editor *de = data;
+  PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
 
   struct examine_dialog ex_d;
 
@@ -277,9 +277,9 @@ examine_dialog (GObject *o, gpointer data)
   ex_d.percentiles_button = GTK_TOGGLE_BUTTON
     (get_widget_assert (xml, "percentiles-button"));
 
-  gtk_window_set_transient_for (GTK_WINDOW (dialog), de->parent.window);
-  gtk_window_set_transient_for (GTK_WINDOW (ex_d.stats_dialog), de->parent.window);
-  gtk_window_set_transient_for (GTK_WINDOW (ex_d.opts_dialog), de->parent.window);
+  gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de));
+  gtk_window_set_transient_for (GTK_WINDOW (ex_d.stats_dialog), GTK_WINDOW (de));
+  gtk_window_set_transient_for (GTK_WINDOW (ex_d.opts_dialog), GTK_WINDOW (de));
 
   attach_dictionary_to_treeview (GTK_TREE_VIEW (source),
                                 vs->dict,
index 332e2d8e0c3141c0c95a6690f9c087fbec3af55e..ad9bf842efb447c9afa17927665a78da3bc9575e 100644 (file)
@@ -24,7 +24,7 @@ which match particular strings */
 #include "psppire-selector.h"
 #include "psppire-dialog.h"
 #include "helper.h"
-#include "data-editor.h"
+#include "psppire-data-window.h"
 #include "dict-display.h"
 #include <data/value.h>
 #include <data/format.h>
@@ -55,7 +55,7 @@ struct find_dialog
   GladeXML *xml;
   PsppireDict *dict;
   struct datasheet *data;
-  struct data_editor *de;
+  PsppireDataWindow *de;
   GtkWidget *variable_entry;
   GtkWidget *value_entry;
   GtkWidget *value_labels_checkbox;
@@ -186,7 +186,7 @@ value_labels_toggled (GtkToggleButton *tb, gpointer data)
 void
 find_dialog (GObject *o, gpointer data)
 {
-  struct data_editor *de = data;
+  PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
 
   struct find_dialog fd;
 
@@ -239,7 +239,7 @@ find_dialog (GObject *o, gpointer data)
 
 
 
-  gtk_window_set_transient_for (GTK_WINDOW (dialog), de->parent.window);
+  gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de));
 
 
   attach_dictionary_to_treeview (GTK_TREE_VIEW (source),
index 9d1215c4d0c2413c1e15de7f357b3dee8e267b05..cba8573d2860de40625e6565a055700ce6ffee37 100644 (file)
@@ -23,7 +23,7 @@
 #include <stdlib.h>
 
 #include <language/syntax-string-source.h>
-#include <ui/gui/data-editor.h>
+#include <ui/gui/psppire-data-window.h>
 #include <ui/gui/dialog-common.h>
 #include <ui/gui/dict-display.h>
 #include <ui/gui/helper.h>
@@ -307,7 +307,7 @@ void
 frequencies_dialog (GObject *o, gpointer data)
 {
   gint response;
-  struct data_editor *de = data;
+  PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
 
   struct frequencies_dialog fd;
 
@@ -331,7 +331,7 @@ frequencies_dialog (GObject *o, gpointer data)
                                  );
 
 
-  gtk_window_set_transient_for (GTK_WINDOW (dialog), de->parent.window);
+  gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de));
 
   attach_dictionary_to_treeview (GTK_TREE_VIEW (source),
                                 vs->dict,
@@ -369,7 +369,7 @@ frequencies_dialog (GObject *o, gpointer data)
   fd.current_opts.limit = 50;
 
 
-  gtk_window_set_transient_for (GTK_WINDOW (fd.format_dialog), de->parent.window);
+  gtk_window_set_transient_for (GTK_WINDOW (fd.format_dialog), GTK_WINDOW (de));
 
 
   g_signal_connect (dialog, "refresh", G_CALLBACK (refresh),  &fd);
index 86e80c5d8018691bb31c09e5f7bf5da97bf79687..57db586511f27992fc7b569da1564f0c6c479434 100644 (file)
 #include "goto-case-dialog.h"
 #include "helper.h"
 #include "psppire-dialog.h"
-#include "data-editor.h"
+#include "psppire-data-window.h"
 #include "psppire-data-store.h"
 
 
 static void
-refresh (const struct data_editor *de, GladeXML *xml)
+refresh (const PsppireDataWindow *de, GladeXML *xml)
 {
   PsppireDataStore *ds = NULL;
   casenumber case_count ;
@@ -44,12 +44,12 @@ goto_case_dialog (GObject *o, gpointer data)
 {
   gint response;
   GladeXML *xml = XML_NEW ("psppire.glade");
-  struct data_editor *de = data;
+  PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
 
   GtkWidget *dialog = get_widget_assert   (xml, "goto-case-dialog");
 
 
-  gtk_window_set_transient_for (GTK_WINDOW (dialog), de->parent.window);
+  gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de));
 
   refresh (de, xml);
 
index 4db1e5ff6bccf8ea484c568f06f774bdfb9806eb..505d9039b55deeef8e6703b2f833591faf5c3d24 100644 (file)
@@ -23,7 +23,7 @@
 #include "psppire-dict.h"
 #include "psppire-var-store.h"
 #include "helper.h"
-#include "data-editor.h"
+#include "psppire-data-window.h"
 #include "psppire-dialog.h"
 #include "dialog-common.h"
 #include "dict-display.h"
@@ -126,7 +126,7 @@ void
 oneway_anova_dialog (GObject *o, gpointer data)
 {
   gint response;
-  struct data_editor *de = data;
+  PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
 
   PsppireVarStore *vs = NULL;
 
@@ -168,7 +168,7 @@ oneway_anova_dialog (GObject *o, gpointer data)
   ow.dialog =
     GTK_WINDOW (get_widget_assert (xml, "oneway-anova-dialog"));
 
-  gtk_window_set_transient_for (ow.dialog, de->parent.window);
+  gtk_window_set_transient_for (ow.dialog, GTK_WINDOW (de));
 
   attach_dictionary_to_treeview (GTK_TREE_VIEW (dict_view),
                                 vs->dict,
@@ -222,7 +222,7 @@ oneway_anova_dialog (GObject *o, gpointer data)
     psppire_acr_set_entry (cd->acr, entry);
 
     gtk_window_set_transient_for (GTK_WINDOW (cd->contrasts_dialog),
-                                 de->parent.window);
+                                 GTK_WINDOW (de));
   }
 
   response = psppire_dialog_run (PSPPIRE_DIALOG (ow.dialog));
diff --git a/src/ui/gui/psppire-data-window.c b/src/ui/gui/psppire-data-window.c
new file mode 100644 (file)
index 0000000..5facbbd
--- /dev/null
@@ -0,0 +1,1727 @@
+/* PSPPIRE - a graphical user interface for PSPP.
+   Copyright (C) 2008  Free Software Foundation
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>. */
+
+#include <config.h>
+
+#include <gtk/gtksignal.h>
+#include <gtk/gtkbox.h>
+#include <glade/glade.h>
+#include "helper.h"
+
+#include "text-data-import-dialog.h"
+
+
+#include <ui/syntax-gen.h>
+#include <language/syntax-string-source.h>
+#include <libpspp/message.h>
+#include <stdlib.h>
+
+#include <data/procedure.h>
+
+#include "psppire-data-window.h"
+#include "psppire-syntax-window.h"
+
+#include "about.h"
+
+#include "goto-case-dialog.h"
+#include "weight-cases-dialog.h"
+#include "split-file-dialog.h"
+#include "transpose-dialog.h"
+#include "sort-cases-dialog.h"
+#include "select-cases-dialog.h"
+#include "compute-dialog.h"
+#include "find-dialog.h"
+#include "rank-dialog.h"
+#include "recode-dialog.h"
+#include "comments-dialog.h"
+#include "variable-info-dialog.h"
+#include "descriptives-dialog.h"
+#include "crosstabs-dialog.h"
+#include "frequencies-dialog.h"
+#include "examine-dialog.h"
+#include "dict-display.h"
+#include "regression-dialog.h"
+#include "oneway-anova-dialog.h"
+#include "t-test-independent-samples-dialog.h"
+#include "t-test-one-sample.h"
+#include "t-test-paired-samples.h"
+
+
+#include <gettext.h>
+#define _(msgid) gettext (msgid)
+#define N_(msgid) msgid
+
+
+
+static void psppire_data_window_base_finalize (PsppireDataWindowClass *, gpointer);
+static void psppire_data_window_base_init     (PsppireDataWindowClass *class);
+static void psppire_data_window_class_init    (PsppireDataWindowClass *class);
+static void psppire_data_window_init          (PsppireDataWindow      *data_editor);
+
+
+GType
+psppire_data_window_get_type (void)
+{
+  static GType psppire_data_window_type = 0;
+
+  if (!psppire_data_window_type)
+    {
+      static const GTypeInfo psppire_data_window_info =
+      {
+       sizeof (PsppireDataWindowClass),
+       (GBaseInitFunc) psppire_data_window_base_init,
+        (GBaseFinalizeFunc) psppire_data_window_base_finalize,
+       (GClassInitFunc)psppire_data_window_class_init,
+       (GClassFinalizeFunc) NULL,
+       NULL,
+        sizeof (PsppireDataWindow),
+       0,
+       (GInstanceInitFunc) psppire_data_window_init,
+      };
+
+      psppire_data_window_type =
+       g_type_register_static (PSPPIRE_WINDOW_TYPE, "PsppireDataWindow",
+                               &psppire_data_window_info, 0);
+    }
+
+  return psppire_data_window_type;
+}
+
+
+static void
+psppire_data_window_finalize (GObject *object)
+{
+  PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (object);
+
+  GObjectClass *class = G_OBJECT_GET_CLASS (object);
+
+  GObjectClass *parent_class = g_type_class_peek_parent (class);
+
+  g_object_unref (de->xml);
+
+
+  if (G_OBJECT_CLASS (parent_class)->finalize)
+    (*G_OBJECT_CLASS (parent_class)->finalize) (object);
+}
+
+
+static void
+psppire_data_window_class_init (PsppireDataWindowClass *class)
+{
+}
+
+
+static void
+psppire_data_window_base_init (PsppireDataWindowClass *class)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (class);
+
+  object_class->finalize = psppire_data_window_finalize;
+}
+
+
+
+static void
+psppire_data_window_base_finalize (PsppireDataWindowClass *class,
+                                    gpointer class_data)
+{
+}
+
+
+\f
+
+
+extern PsppireVarStore *the_var_store;
+extern struct dataset *the_dataset;
+extern PsppireDataStore *the_data_store ;
+
+
+static void
+update_paste_menuitems (GtkWidget *w, gboolean x, gpointer data)
+{
+  PsppireDataWindow  *de = PSPPIRE_DATA_WINDOW (data);
+
+  GtkWidget * edit_paste = get_widget_assert (de->xml, "edit_paste");
+
+  gtk_widget_set_sensitive (edit_paste, x);
+}
+
+static void
+update_cut_copy_menuitems (GtkWidget *w, gboolean x, gpointer data)
+{
+  PsppireDataWindow  *de = PSPPIRE_DATA_WINDOW (data);
+
+  GtkWidget * edit_copy = get_widget_assert (de->xml, "edit_copy");
+  GtkWidget * edit_cut = get_widget_assert (de->xml, "edit_cut");
+
+  gtk_widget_set_sensitive (edit_copy, x);
+  gtk_widget_set_sensitive (edit_cut, x);
+}
+
+/* Run the EXECUTE command. */
+static void
+execute (GtkMenuItem *mi, gpointer data)
+{
+  struct getl_interface *sss = create_syntax_string_source ("EXECUTE.");
+
+  execute_syntax (sss);
+}
+
+static void
+transformation_change_callback (bool transformations_pending,
+                               gpointer data)
+{
+  PsppireDataWindow  *de = PSPPIRE_DATA_WINDOW (data);
+
+  GtkWidget *menuitem =
+    get_widget_assert (de->xml, "transform_run-pending");
+  GtkWidget *status_label  =
+    get_widget_assert (de->xml, "case-counter-area");
+
+  gtk_widget_set_sensitive (menuitem, transformations_pending);
+
+
+  if ( transformations_pending)
+    gtk_label_set_text (GTK_LABEL (status_label),
+                       _("Transformations Pending"));
+  else
+    gtk_label_set_text (GTK_LABEL (status_label), "");
+}
+
+/* Callback for when the dictionary changes its filter variable */
+static void
+on_filter_change (GObject *o, gint filter_index, gpointer data)
+{
+  PsppireDataWindow  *de = PSPPIRE_DATA_WINDOW (data);
+
+  GtkWidget *filter_status_area =
+    get_widget_assert (de->xml, "filter-use-status-area");
+
+  if ( filter_index == -1 )
+    {
+      gtk_label_set_text (GTK_LABEL (filter_status_area), _("Filter off"));
+    }
+  else
+    {
+      PsppireVarStore *vs = NULL;
+      struct variable *var ;
+      gchar *text ;
+
+      g_object_get (de->data_editor, "var-store", &vs, NULL);
+
+      var = psppire_dict_get_variable (vs->dict, filter_index);
+
+      text = g_strdup_printf (_("Filter by %s"), var_get_name (var));
+
+      gtk_label_set_text (GTK_LABEL (filter_status_area), text);
+
+      g_free (text);
+    }
+}
+
+/* Callback for when the dictionary changes its split variables */
+static void
+on_split_change (PsppireDict *dict, gpointer data)
+{
+  PsppireDataWindow  *de = PSPPIRE_DATA_WINDOW (data);
+
+  size_t n_split_vars = dict_get_split_cnt (dict->dict);
+
+  GtkWidget *split_status_area =
+    get_widget_assert (de->xml, "split-file-status-area");
+
+  if ( n_split_vars == 0 )
+    {
+      gtk_label_set_text (GTK_LABEL (split_status_area), _("No Split"));
+    }
+  else
+    {
+      gint i;
+      GString *text;
+      const struct variable *const * split_vars =
+       dict_get_split_vars (dict->dict);
+
+      text = g_string_new (_("Split by "));
+
+      for (i = 0 ; i < n_split_vars - 1; ++i )
+       {
+         g_string_append_printf (text, "%s, ", var_get_name (split_vars[i]));
+       }
+      g_string_append (text, var_get_name (split_vars[i]));
+
+      gtk_label_set_text (GTK_LABEL (split_status_area), text->str);
+
+      g_string_free (text, TRUE);
+    }
+}
+
+
+
+
+/* Callback for when the dictionary changes its weights */
+static void
+on_weight_change (GObject *o, gint weight_index, gpointer data)
+{
+  PsppireDataWindow  *de = PSPPIRE_DATA_WINDOW (data);
+
+  GtkWidget *weight_status_area =
+    get_widget_assert (de->xml, "weight-status-area");
+
+  if ( weight_index == -1 )
+    {
+      gtk_label_set_text (GTK_LABEL (weight_status_area), _("Weights off"));
+    }
+  else
+    {
+      struct variable *var ;
+      PsppireVarStore *vs = NULL;
+      gchar *text;
+
+      g_object_get (de->data_editor, "var-store", &vs, NULL);
+
+      var = psppire_dict_get_variable (vs->dict, weight_index);
+
+      text = g_strdup_printf (_("Weight by %s"), var_get_name (var));
+
+      gtk_label_set_text (GTK_LABEL (weight_status_area), text);
+
+      g_free (text);
+    }
+}
+
+/* Puts FILE_NAME into the recent list.
+   If it's already in the list, it moves it to the top
+*/
+static void
+add_most_recent (const char *file_name)
+{
+#if RECENT_LISTS_AVAILABLE
+
+  GtkRecentManager *manager = gtk_recent_manager_get_default();
+  gchar *uri = g_filename_to_uri (file_name, NULL, NULL);
+
+  gtk_recent_manager_remove_item (manager, uri, NULL);
+
+  if ( ! gtk_recent_manager_add_item (manager, uri))
+    g_warning ("Could not add item %s to recent list\n",uri);
+
+  g_free (uri);
+#endif
+}
+
+static void
+open_data_file (const gchar *file_name, PsppireDataWindow *de)
+{
+  struct getl_interface *sss;
+  struct string filename;
+
+  ds_init_empty (&filename);
+  syntax_gen_string (&filename, ss_cstr (file_name));
+
+  sss = create_syntax_string_source ("GET FILE=%s.",
+                                    ds_cstr (&filename));
+  ds_destroy (&filename);
+
+  if (execute_syntax (sss) )
+  {
+    //    window_set_name_from_filename ((struct editor_window *) de, file_name);
+    add_most_recent (file_name);
+  }
+}
+
+
+/* Callback for the data_open action.
+   Prompts for a filename and opens it */
+static void
+open_data_dialog (GtkAction *action, PsppireDataWindow *de)
+{
+  GtkWidget *dialog =
+    gtk_file_chooser_dialog_new (_("Open"),
+                                GTK_WINDOW (de),
+                                GTK_FILE_CHOOSER_ACTION_OPEN,
+                                GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+                                GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
+                                NULL);
+
+  GtkFileFilter *filter = gtk_file_filter_new ();
+  gtk_file_filter_set_name (filter, _("System Files (*.sav)"));
+  gtk_file_filter_add_pattern (filter, "*.sav");
+  gtk_file_filter_add_pattern (filter, "*.SAV");
+  gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
+
+  filter = gtk_file_filter_new ();
+  gtk_file_filter_set_name (filter, _("Portable Files (*.por) "));
+  gtk_file_filter_add_pattern (filter, "*.por");
+  gtk_file_filter_add_pattern (filter, "*.POR");
+  gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
+
+  filter = gtk_file_filter_new ();
+  gtk_file_filter_set_name (filter, _("All Files"));
+  gtk_file_filter_add_pattern (filter, "*");
+  gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
+
+
+  if (de->file_name)
+    {
+      gchar *dir_name = g_path_get_dirname (de->file_name);
+      gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog),
+                                          dir_name);
+      free (dir_name);
+    }
+
+  switch (gtk_dialog_run (GTK_DIALOG (dialog)))
+    {
+    case GTK_RESPONSE_ACCEPT:
+      {
+       g_free (de->file_name);
+       de->file_name =
+         gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
+
+       open_data_file (de->file_name, de);
+      }
+      break;
+    default:
+      break;
+    }
+
+  gtk_widget_destroy (dialog);
+}
+
+/* Returns true if NAME has a suffix which might denote a PSPP file */
+static gboolean
+name_has_suffix (const gchar *name)
+{
+  if ( g_str_has_suffix (name, ".sav"))
+    return TRUE;
+  if ( g_str_has_suffix (name, ".SAV"))
+    return TRUE;
+  if ( g_str_has_suffix (name, ".por"))
+    return TRUE;
+  if ( g_str_has_suffix (name, ".POR"))
+    return TRUE;
+
+  return FALSE;
+}
+
+
+/* Append SUFFIX to the filename of DE */
+static void
+append_filename_suffix (PsppireDataWindow *de, const gchar *suffix)
+{
+  if ( ! name_has_suffix (de->file_name))
+    {
+      gchar *s = de->file_name;
+      de->file_name = g_strconcat (de->file_name, suffix, NULL);
+      g_free (s);
+    }
+}
+
+/* Save DE to file */
+static void
+save_file (PsppireDataWindow *de)
+{
+  struct getl_interface *sss;
+  struct string file_name ;
+
+  g_assert (de->file_name);
+
+  ds_init_empty (&file_name);
+  syntax_gen_string (&file_name, ss_cstr (de->file_name));
+
+  if ( de->save_as_portable )
+    {
+      append_filename_suffix (de, ".por");
+      sss = create_syntax_string_source ("EXPORT OUTFILE=%s.",
+                                        ds_cstr (&file_name));
+    }
+  else
+    {
+      append_filename_suffix (de, ".sav");
+      sss = create_syntax_string_source ("SAVE OUTFILE=%s.",
+                                        ds_cstr (&file_name));
+    }
+
+  ds_destroy (&file_name);
+
+  execute_syntax (sss);
+}
+
+
+static void
+insert_case (GtkAction *action, gpointer data)
+{
+  PsppireDataWindow *dw = PSPPIRE_DATA_WINDOW (data);
+
+  psppire_data_editor_insert_case (dw->data_editor);
+}
+
+static void
+on_insert_variable (GtkAction *action, gpointer data)
+{
+  PsppireDataEditor *de = PSPPIRE_DATA_EDITOR (data);
+  psppire_data_editor_insert_variable (de);
+}
+
+
+/* Callback for data_save_as action. Prompt for a filename and save */
+static void
+data_save_as_dialog (GtkAction *action, PsppireDataWindow *de)
+{
+  GtkWidget *button_sys;
+  GtkWidget *dialog =
+    gtk_file_chooser_dialog_new (_("Save"),
+                                GTK_WINDOW (de),
+                                GTK_FILE_CHOOSER_ACTION_SAVE,
+                                GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+                                GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
+                                NULL);
+
+  GtkFileFilter *filter = gtk_file_filter_new ();
+  gtk_file_filter_set_name (filter, _("System Files (*.sav)"));
+  gtk_file_filter_add_pattern (filter, "*.sav");
+  gtk_file_filter_add_pattern (filter, "*.SAV");
+  gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
+
+  filter = gtk_file_filter_new ();
+  gtk_file_filter_set_name (filter, _("Portable Files (*.por) "));
+  gtk_file_filter_add_pattern (filter, "*.por");
+  gtk_file_filter_add_pattern (filter, "*.POR");
+  gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
+
+  filter = gtk_file_filter_new ();
+  gtk_file_filter_set_name (filter, _("All Files"));
+  gtk_file_filter_add_pattern (filter, "*");
+  gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
+
+  {
+    GtkWidget *button_por;
+    GtkWidget *vbox = gtk_vbox_new (TRUE, 5);
+    button_sys =
+      gtk_radio_button_new_with_label (NULL, _("System File"));
+
+    button_por =
+      gtk_radio_button_new_with_label
+      (gtk_radio_button_get_group (GTK_RADIO_BUTTON(button_sys)),
+       _("Portable File"));
+
+    gtk_box_pack_start_defaults (GTK_BOX (vbox), button_sys);
+    gtk_box_pack_start_defaults (GTK_BOX (vbox), button_por);
+
+    gtk_widget_show_all (vbox);
+
+    gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER(dialog), vbox);
+  }
+
+  switch (gtk_dialog_run (GTK_DIALOG (dialog)))
+    {
+    case GTK_RESPONSE_ACCEPT:
+      {
+       g_free (de->file_name);
+
+       de->file_name =
+         gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
+
+       de->save_as_portable =
+         ! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button_sys));
+
+       if ( de->save_as_portable)
+         append_filename_suffix (de, ".por");
+       else
+         append_filename_suffix (de, ".sav");
+
+       save_file (de);
+
+       //      window_set_name_from_filename (e, de->file_name);
+      }
+      break;
+    default:
+      break;
+    }
+
+  gtk_widget_destroy (dialog);
+}
+
+
+/* Callback for data_save action.
+   If there's an existing file name, then just save,
+   otherwise prompt for a file name, then save */
+static void
+data_save (GtkAction *action, PsppireDataWindow *de)
+{
+  if ( de->file_name)
+    save_file (de);
+  else
+    data_save_as_dialog (action, de);
+}
+
+
+/* Callback for data_new action.
+   Performs the NEW FILE command */
+static void
+new_file (GtkAction *action, PsppireDataWindow *de)
+{
+  struct getl_interface *sss =
+    create_syntax_string_source ("NEW FILE.");
+
+  execute_syntax (sss);
+
+  g_free (de->file_name);
+  de->file_name = NULL;
+
+  //  default_window_name (de);
+}
+
+
+
+/* Create the GtkActions and connect to their signals */
+static void
+register_data_editor_actions (PsppireDataWindow *de)
+{
+  de->action_data_open =
+    gtk_action_new ("data-open-dialog",
+                   _("Open"),
+                   _("Open a data file"),
+                   "gtk-open");
+
+  g_signal_connect (de->action_data_open, "activate",
+                   G_CALLBACK (open_data_dialog), de);
+
+
+  de->action_data_save = gtk_action_new ("data-save",
+                                           _("Save"),
+                                           _("Save data to file"),
+                                           "gtk-save");
+
+  g_signal_connect (de->action_data_save, "activate",
+                   G_CALLBACK (data_save), de);
+
+
+  de->action_data_save_as = gtk_action_new ("data-save-as-dialog",
+                                           _("Save As"),
+                                           _("Save data to file"),
+                                           "gtk-save");
+
+  g_signal_connect (de->action_data_save_as, "activate",
+                   G_CALLBACK (data_save_as_dialog), de);
+
+  de->action_data_new =
+    gtk_action_new ("data-new",
+                   _("New"),
+                   _("New data file"),
+                   NULL);
+
+  g_signal_connect (de->action_data_new, "activate",
+                   G_CALLBACK (new_file), de);
+
+  de->invoke_text_import_assistant =
+    gtk_action_new ("file_import-text",
+                   _("_Import Text Data"),
+                   _("Import text data file"),
+                   "");
+
+  g_signal_connect (de->invoke_text_import_assistant, "activate",
+                   G_CALLBACK (text_data_import_assistant), de);
+}
+
+static void
+on_edit_paste (GtkAction *a, gpointer data)
+{
+  PsppireDataWindow  *de = PSPPIRE_DATA_WINDOW (data);
+
+  psppire_data_editor_clip_paste (de->data_editor);
+}
+
+static void
+on_edit_copy (GtkMenuItem *m, gpointer data)
+{
+  PsppireDataWindow  *de = PSPPIRE_DATA_WINDOW (data);
+
+  psppire_data_editor_clip_copy (de->data_editor);
+}
+
+
+
+static void
+on_edit_cut (GtkMenuItem *m, gpointer data)
+{
+  PsppireDataWindow  *de = PSPPIRE_DATA_WINDOW (data);
+
+  psppire_data_editor_clip_cut (de->data_editor);
+}
+
+
+static void
+status_bar_activate (GtkCheckMenuItem *menuitem, gpointer data)
+{
+  PsppireDataWindow  *de = PSPPIRE_DATA_WINDOW (data);
+  GtkWidget *statusbar = get_widget_assert (de->xml, "status-bar");
+
+  if ( gtk_check_menu_item_get_active (menuitem) )
+    gtk_widget_show (statusbar);
+  else
+    gtk_widget_hide (statusbar);
+}
+
+
+static void
+grid_lines_activate (GtkCheckMenuItem *menuitem, gpointer data)
+{
+  PsppireDataWindow  *de = PSPPIRE_DATA_WINDOW (data);
+  const gboolean grid_visible = gtk_check_menu_item_get_active (menuitem);
+
+  psppire_data_editor_show_grid (de->data_editor, grid_visible);
+}
+
+
+
+static void
+data_view_activate (GtkCheckMenuItem *menuitem, gpointer data)
+{
+  PsppireDataWindow  *de = PSPPIRE_DATA_WINDOW (data);
+
+  gtk_notebook_set_current_page (GTK_NOTEBOOK (de->data_editor), PSPPIRE_DATA_EDITOR_DATA_VIEW);
+}
+
+
+static void
+variable_view_activate (GtkCheckMenuItem *menuitem, gpointer data)
+{
+  PsppireDataWindow  *de = PSPPIRE_DATA_WINDOW (data);
+
+  gtk_notebook_set_current_page (GTK_NOTEBOOK (de->data_editor), PSPPIRE_DATA_EDITOR_VARIABLE_VIEW);
+}
+
+
+static void
+fonts_activate (GtkMenuItem *menuitem, gpointer data)
+{
+  PsppireDataWindow  *de = PSPPIRE_DATA_WINDOW (data);
+  PangoFontDescription *current_font;
+  gchar *font_name;
+  GtkWidget *dialog =
+    gtk_font_selection_dialog_new (_("Font Selection"));
+
+
+  current_font = GTK_WIDGET(de->data_editor)->style->font_desc;
+  font_name = pango_font_description_to_string (current_font);
+
+  gtk_font_selection_dialog_set_font_name (GTK_FONT_SELECTION_DIALOG (dialog), font_name);
+
+  g_free (font_name);
+
+  gtk_window_set_transient_for (GTK_WINDOW (dialog),
+                               GTK_WINDOW (get_widget_assert (de->xml,
+                                                              "data_editor")));
+  if ( GTK_RESPONSE_OK == gtk_dialog_run (GTK_DIALOG (dialog)) )
+    {
+      const gchar *font = gtk_font_selection_dialog_get_font_name
+       (GTK_FONT_SELECTION_DIALOG (dialog));
+
+      PangoFontDescription* font_desc =
+       pango_font_description_from_string (font);
+
+      psppire_data_editor_set_font (de->data_editor, font_desc);
+    }
+
+  gtk_widget_hide (dialog);
+}
+
+
+
+/* Callback for the value labels action */
+static void
+toggle_value_labels (GtkToggleAction *ta, gpointer data)
+{
+  PsppireDataWindow  *de = PSPPIRE_DATA_WINDOW (data);
+
+  g_object_set (de->data_editor, "value-labels", gtk_toggle_action_get_active (ta), NULL);
+}
+
+static void
+toggle_split_window (GtkToggleAction *ta, gpointer data)
+{
+  PsppireDataWindow  *de = PSPPIRE_DATA_WINDOW (data);
+
+  psppire_data_editor_split_window (de->data_editor,
+                                   gtk_toggle_action_get_active (ta));
+}
+
+
+static void
+file_quit (GtkCheckMenuItem *menuitem, gpointer data)
+{
+  /* FIXME: Need to be more intelligent here.
+     Give the user the opportunity to save any unsaved data.
+  */
+  g_object_unref (the_data_store);
+  gtk_main_quit ();
+}
+
+
+
+static GtkWidget *
+create_data_sheet_variable_popup_menu (PsppireDataWindow *de)
+{
+  GtkWidget *menu = gtk_menu_new ();
+
+  GtkWidget *sort_ascending =
+    gtk_menu_item_new_with_label (_("Sort Ascending"));
+
+  GtkWidget *sort_descending =
+    gtk_menu_item_new_with_label (_("Sort Descending"));
+
+  GtkWidget *insert_variable =
+    gtk_menu_item_new_with_label (_("Insert Variable"));
+
+  GtkWidget *clear_variable =
+    gtk_menu_item_new_with_label (_("Clear"));
+
+
+  gtk_action_connect_proxy (de->delete_variables,
+                           clear_variable );
+
+
+  gtk_menu_shell_append (GTK_MENU_SHELL (menu), insert_variable);
+
+
+  gtk_menu_shell_append (GTK_MENU_SHELL (menu),
+                        gtk_separator_menu_item_new ());
+
+
+  gtk_menu_shell_append (GTK_MENU_SHELL (menu), clear_variable);
+
+
+  gtk_menu_shell_append (GTK_MENU_SHELL (menu),
+                        gtk_separator_menu_item_new ());
+
+
+  gtk_menu_shell_append (GTK_MENU_SHELL (menu), sort_ascending);
+
+
+  g_signal_connect_swapped (G_OBJECT (sort_ascending), "activate",
+                           G_CALLBACK (psppire_data_editor_sort_ascending),
+                           de->data_editor);
+
+  g_signal_connect_swapped (G_OBJECT (sort_descending), "activate",
+                           G_CALLBACK (psppire_data_editor_sort_descending),
+                           de->data_editor);
+
+  g_signal_connect_swapped (G_OBJECT (insert_variable), "activate",
+                           G_CALLBACK (gtk_action_activate),
+                           de->insert_variable);
+
+
+  gtk_menu_shell_append (GTK_MENU_SHELL (menu), sort_descending);
+
+  gtk_widget_show_all (menu);
+
+  return menu;
+}
+
+
+static GtkWidget *
+create_data_sheet_cases_popup_menu (PsppireDataWindow *de)
+{
+  GtkWidget *menu = gtk_menu_new ();
+
+  GtkWidget *insert_case =
+    gtk_menu_item_new_with_label (_("Insert Case"));
+
+  GtkWidget *delete_case =
+    gtk_menu_item_new_with_label (_("Clear"));
+
+
+  gtk_action_connect_proxy (de->delete_cases,
+                           delete_case);
+
+
+  gtk_menu_shell_append (GTK_MENU_SHELL (menu), insert_case);
+
+  g_signal_connect_swapped (G_OBJECT (insert_case), "activate",
+                           G_CALLBACK (gtk_action_activate),
+                           de->insert_case);
+
+
+  gtk_menu_shell_append (GTK_MENU_SHELL (menu),
+                        gtk_separator_menu_item_new ());
+
+
+  gtk_menu_shell_append (GTK_MENU_SHELL (menu), delete_case);
+
+
+  gtk_widget_show_all (menu);
+
+  return menu;
+}
+
+
+static GtkWidget *
+create_var_sheet_variable_popup_menu (PsppireDataWindow *de)
+{
+  GtkWidget *menu = gtk_menu_new ();
+
+  GtkWidget *insert_variable =
+    gtk_menu_item_new_with_label (_("Insert Variable"));
+
+  GtkWidget *delete_variable =
+    gtk_menu_item_new_with_label (_("Clear"));
+
+
+  gtk_action_connect_proxy (de->delete_variables,
+                           delete_variable);
+
+
+  gtk_menu_shell_append (GTK_MENU_SHELL (menu), insert_variable);
+
+  g_signal_connect_swapped (G_OBJECT (insert_variable), "activate",
+                           G_CALLBACK (gtk_action_activate),
+                           de->insert_variable);
+
+
+  gtk_menu_shell_append (GTK_MENU_SHELL (menu),
+                        gtk_separator_menu_item_new ());
+
+
+  gtk_menu_shell_append (GTK_MENU_SHELL (menu), delete_variable);
+
+
+  gtk_widget_show_all (menu);
+
+  return menu;
+}
+
+
+#if RECENT_LISTS_AVAILABLE
+
+static void
+on_recent_data_select (GtkMenuShell *menushell,   gpointer user_data)
+{
+  gchar *file;
+  PsppireDataWindow  *de = PSPPIRE_DATA_WINDOW (user_data);
+
+  gchar *uri =
+    gtk_recent_chooser_get_current_uri (GTK_RECENT_CHOOSER (menushell));
+
+  file = g_filename_from_uri (uri, NULL, NULL);
+
+  g_free (uri);
+
+  open_data_file (file, de);
+
+  g_free (file);
+}
+
+static void
+on_recent_files_select (GtkMenuShell *menushell,   gpointer user_data)
+{
+  gchar *file;
+
+  GtkWidget *se ;
+
+  gchar *uri =
+    gtk_recent_chooser_get_current_uri (GTK_RECENT_CHOOSER (menushell));
+
+  file = g_filename_from_uri (uri, NULL, NULL);
+
+  g_free (uri);
+
+  se = psppire_syntax_window_new ();
+
+  psppire_syntax_window_load_from_file (PSPPIRE_SYNTAX_WINDOW (se), file, NULL);
+  gtk_widget_show (se);
+
+  g_free (file);
+}
+
+#endif
+
+static void
+enable_delete_cases (GtkWidget *w, gint case_num, gpointer data)
+{
+  PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
+
+  gtk_action_set_visible (de->delete_cases, case_num != -1);
+}
+
+
+static void
+enable_delete_variables (GtkWidget *w, gint var, gpointer data)
+{
+  PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
+
+  gtk_action_set_visible (de->delete_variables, var != -1);
+}
+
+/* Callback for when the datasheet/varsheet is selected */
+static void
+on_switch_sheet (GtkNotebook *notebook,
+               GtkNotebookPage *page,
+               guint page_num,
+               gpointer user_data)
+{
+  PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (user_data);
+
+  GtkWidget *view_data = get_widget_assert (de->xml, "view_data");
+  GtkWidget *view_variables = get_widget_assert (de->xml, "view_variables");
+
+  switch (page_num)
+    {
+    case PSPPIRE_DATA_EDITOR_VARIABLE_VIEW:
+      gtk_widget_hide (view_variables);
+      gtk_widget_show (view_data);
+      gtk_action_set_sensitive (de->insert_variable, TRUE);
+      gtk_action_set_sensitive (de->insert_case, FALSE);
+      gtk_action_set_sensitive (de->invoke_goto_dialog, FALSE);
+      break;
+    case PSPPIRE_DATA_EDITOR_DATA_VIEW:
+      gtk_widget_show (view_variables);
+      gtk_widget_hide (view_data);
+      gtk_action_set_sensitive (de->invoke_goto_dialog, TRUE);
+      gtk_action_set_sensitive (de->insert_case, TRUE);
+      break;
+    default:
+      g_assert_not_reached ();
+      break;
+    }
+
+#if 0
+  update_paste_menuitem (de, page_num);
+#endif
+}
+
+
+
+
+void
+create_data_window (void)
+{
+  GtkWidget *w = psppire_data_window_new ();
+  gtk_widget_show (w);
+}
+
+
+static void
+psppire_data_window_init (PsppireDataWindow *de)
+{
+  PsppireVarStore *vs;
+
+  GtkWidget *menubar;
+  GtkWidget *hb ;
+  GtkWidget *sb ;
+
+  GtkWidget *box = gtk_vbox_new (FALSE, 0);
+  de->xml = XML_NEW ("data-editor.glade");
+
+  menubar = get_widget_assert (de->xml, "menubar");
+  hb = get_widget_assert (de->xml, "handlebox1");
+  sb = get_widget_assert (de->xml, "status-bar");
+
+  de->data_editor =
+    PSPPIRE_DATA_EDITOR (psppire_data_editor_new (the_var_store, the_data_store));
+
+  connect_help (de->xml);
+
+  g_object_ref (menubar);
+  gtk_widget_unparent (menubar);
+
+  g_object_ref (hb);
+  gtk_widget_unparent (hb);
+
+  g_object_ref (sb);
+  gtk_widget_unparent (sb);
+
+  gtk_box_pack_start (GTK_BOX (box), menubar, FALSE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (box), hb, FALSE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (box), GTK_WIDGET (de->data_editor), TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (box), sb, FALSE, TRUE, 0);
+
+  gtk_container_add (GTK_CONTAINER (de), box);
+
+  g_signal_connect (de->data_editor, "data-selection-changed",
+                   G_CALLBACK (update_cut_copy_menuitems), de);
+
+  g_signal_connect (de->data_editor, "data-available-changed",
+                   G_CALLBACK (update_paste_menuitems), de);
+
+  dataset_add_transform_change_callback (the_dataset,
+                                        transformation_change_callback,
+                                        de);
+
+
+  vs = the_var_store;
+
+  g_assert(vs); /* Traps a possible bug in w32 build */
+
+  g_signal_connect (vs->dict, "weight-changed",
+                   G_CALLBACK (on_weight_change),
+                   de);
+
+  g_signal_connect (vs->dict, "filter-changed",
+                   G_CALLBACK (on_filter_change),
+                   de);
+
+  g_signal_connect (vs->dict, "split-changed",
+                   G_CALLBACK (on_split_change),
+                   de);
+
+
+  g_signal_connect (get_widget_assert (de->xml, "edit_copy"),
+                   "activate",
+                   G_CALLBACK (on_edit_copy), de);
+
+  g_signal_connect (get_widget_assert (de->xml, "edit_cut"),
+                   "activate",
+                   G_CALLBACK (on_edit_cut), de);
+
+
+  register_data_editor_actions (de);
+
+  de->toggle_value_labels =
+    gtk_toggle_action_new ("toggle-value-labels",
+                          _("_Labels"),
+                          _("Show/hide value labels"),
+                          "pspp-value-labels");
+
+  g_signal_connect (de->toggle_value_labels, "toggled",
+                   G_CALLBACK (toggle_value_labels), de);
+
+
+  gtk_action_connect_proxy (GTK_ACTION (de->toggle_value_labels),
+                           get_widget_assert (de->xml,
+                                              "togglebutton-value-labels"));
+
+
+  gtk_action_connect_proxy (GTK_ACTION (de->toggle_value_labels),
+                           get_widget_assert (de->xml,
+                                              "view_value-labels"));
+
+
+
+  de->delete_cases =
+    gtk_action_new ("clear-cases",
+                   _("Clear"),
+                   _("Delete the cases at the selected position(s)"),
+                   "pspp-clear-cases");
+
+  g_signal_connect_swapped (de->delete_cases, "activate",
+                   G_CALLBACK (psppire_data_editor_delete_cases),
+                   de->data_editor);
+
+  gtk_action_connect_proxy (de->delete_cases,
+                           get_widget_assert (de->xml, "edit_clear-cases"));
+
+  g_signal_connect (get_widget_assert (de->xml, "edit_paste"), "activate",
+                   G_CALLBACK (on_edit_paste),
+                   de);
+
+  gtk_action_set_visible (de->delete_cases, FALSE);
+
+  de->delete_variables =
+    gtk_action_new ("clear-variables",
+                   _("Clear"),
+                   _("Delete the variables at the selected position(s)"),
+                   "pspp-clear-variables");
+
+  g_signal_connect_swapped (de->delete_variables, "activate",
+                           G_CALLBACK (psppire_data_editor_delete_variables),
+                           de->data_editor);
+
+  gtk_action_connect_proxy (de->delete_variables,
+                           get_widget_assert (de->xml, "edit_clear-variables")
+                           );
+
+  gtk_action_set_visible (de->delete_variables, FALSE);
+
+  de->insert_variable =
+    gtk_action_new ("insert-variable",
+                   _("Insert _Variable"),
+                   _("Create a new variable at the current position"),
+                   "pspp-insert-variable");
+
+  g_signal_connect (de->insert_variable, "activate",
+                   G_CALLBACK (on_insert_variable), de->data_editor);
+
+
+  gtk_action_connect_proxy (de->insert_variable,
+                           get_widget_assert (de->xml, "button-insert-variable")
+                           );
+
+  gtk_action_connect_proxy (de->insert_variable,
+                           get_widget_assert (de->xml, "edit_insert-variable")
+                           );
+
+
+  de->insert_case =
+    gtk_action_new ("insert-case",
+                   _("Insert Ca_se"),
+                   _("Create a new case at the current position"),
+                   "pspp-insert-case");
+
+  g_signal_connect (de->insert_case, "activate",
+                   G_CALLBACK (insert_case), de);
+
+
+  gtk_action_connect_proxy (de->insert_case,
+                           get_widget_assert (de->xml, "button-insert-case")
+                           );
+
+
+  gtk_action_connect_proxy (de->insert_case,
+                           get_widget_assert (de->xml, "edit_insert-case")
+                           );
+
+
+  de->invoke_goto_dialog =
+    gtk_action_new ("goto-case-dialog",
+                   _("_Goto Case"),
+                   _("Jump to a Case in the Data Sheet"),
+                   "gtk-jump-to");
+
+
+  gtk_action_connect_proxy (de->invoke_goto_dialog,
+                           get_widget_assert (de->xml, "button-goto-case")
+                           );
+
+  gtk_action_connect_proxy (de->invoke_goto_dialog,
+                           get_widget_assert (de->xml, "edit_goto-case")
+                           );
+
+
+  g_signal_connect (de->invoke_goto_dialog, "activate",
+                   G_CALLBACK (goto_case_dialog), de);
+
+  de->invoke_weight_cases_dialog =
+    gtk_action_new ("weight-cases-dialog",
+                   _("_Weights"),
+                   _("Weight cases by variable"),
+                   "pspp-weight-cases");
+
+  g_signal_connect (de->invoke_weight_cases_dialog, "activate",
+                   G_CALLBACK (weight_cases_dialog), de);
+
+
+  de->invoke_transpose_dialog =
+    gtk_action_new ("transpose-dialog",
+                   _("_Transpose"),
+                   _("Transpose the cases with the variables"),
+                   NULL);
+
+
+  g_signal_connect (de->invoke_transpose_dialog, "activate",
+                   G_CALLBACK (transpose_dialog), de);
+
+
+
+  de->invoke_split_file_dialog =
+    gtk_action_new ("split-file-dialog",
+                   _("S_plit"),
+                   _("Split the active file"),
+                   "pspp-split-file");
+
+  g_signal_connect (de->invoke_split_file_dialog, "activate",
+                   G_CALLBACK (split_file_dialog), de);
+
+
+
+  de->invoke_sort_cases_dialog =
+    gtk_action_new ("sort-cases-dialog",
+                   _("_Sort"),
+                   _("Sort cases in the active file"),
+                   "pspp-sort-cases");
+
+  g_signal_connect (de->invoke_sort_cases_dialog, "activate",
+                   G_CALLBACK (sort_cases_dialog), de);
+
+  de->invoke_select_cases_dialog =
+    gtk_action_new ("select-cases-dialog",
+                   _("Select _Cases"),
+                   _("Select cases from the active file"),
+                   "pspp-select-cases");
+
+  g_signal_connect (de->invoke_select_cases_dialog, "activate",
+                   G_CALLBACK (select_cases_dialog), de);
+
+
+  de->invoke_compute_dialog =
+    gtk_action_new ("compute-dialog",
+                   _("_Compute"),
+                   _("Compute new values for a variable"),
+                   "pspp-compute");
+
+  g_signal_connect (de->invoke_compute_dialog, "activate",
+                   G_CALLBACK (compute_dialog), de);
+
+  de->invoke_oneway_anova_dialog =
+    gtk_action_new ("oneway-anova",
+                   _("Oneway _ANOVA"),
+                   _("Perform one way analysis of variance"),
+                   NULL);
+
+  g_signal_connect (de->invoke_oneway_anova_dialog, "activate",
+                   G_CALLBACK (oneway_anova_dialog), de);
+
+  de->invoke_t_test_independent_samples_dialog =
+    gtk_action_new ("t-test-independent-samples",
+                   _("_Independent Samples T Test"),
+                   _("Calculate T Test for samples from independent groups"),
+                   NULL);
+
+  g_signal_connect (de->invoke_t_test_independent_samples_dialog, "activate",
+                   G_CALLBACK (t_test_independent_samples_dialog), de);
+
+
+  de->invoke_t_test_paired_samples_dialog =
+    gtk_action_new ("t-test-paired-samples",
+                   _("_Paired Samples T Test"),
+                   _("Calculate T Test for paired samples"),
+                   NULL);
+
+  g_signal_connect (de->invoke_t_test_paired_samples_dialog, "activate",
+                   G_CALLBACK (t_test_paired_samples_dialog), de);
+
+
+  de->invoke_t_test_one_sample_dialog =
+    gtk_action_new ("t-test-one-sample",
+                   _("One _Sample T Test"),
+                   _("Calculate T Test for sample from a single distribution"),
+                   NULL);
+
+  g_signal_connect (de->invoke_t_test_one_sample_dialog, "activate",
+                   G_CALLBACK (t_test_one_sample_dialog), de);
+
+
+  de->invoke_comments_dialog =
+    gtk_action_new ("commments-dialog",
+                   _("Data File _Comments"),
+                   _("Commentary text for the data file"),
+                   NULL);
+
+  g_signal_connect (de->invoke_comments_dialog, "activate",
+                   G_CALLBACK (comments_dialog), de);
+
+  de->invoke_find_dialog  =
+    gtk_action_new ("find-dialog",
+                   _("_Find"),
+                   _("Find Case"),
+                   "gtk-find");
+
+  g_signal_connect (de->invoke_find_dialog, "activate",
+                   G_CALLBACK (find_dialog), de);
+
+
+  de->invoke_rank_dialog  =
+    gtk_action_new ("rank-dialog",
+                   _("Ran_k Cases"),
+                   _("Rank Cases"),
+                   "pspp-rank-cases");
+
+  g_signal_connect (de->invoke_rank_dialog, "activate",
+                   G_CALLBACK (rank_dialog), de);
+
+
+  de->invoke_recode_same_dialog  =
+    gtk_action_new ("recode-same-dialog",
+                   _("Recode into _Same Variables"),
+                   _("Recode values into the same Variables"),
+                   "pspp-recode-same");
+
+  g_signal_connect (de->invoke_recode_same_dialog, "activate",
+                   G_CALLBACK (recode_same_dialog), de);
+
+
+  de->invoke_recode_different_dialog  =
+    gtk_action_new ("recode-different-dialog",
+                   _("Recode into _Different Variables"),
+                   _("Recode values into different Variables"),
+                   "pspp-recode-different");
+
+  g_signal_connect (de->invoke_recode_different_dialog, "activate",
+                   G_CALLBACK (recode_different_dialog), de);
+
+
+  de->invoke_variable_info_dialog  =
+    gtk_action_new ("variable-info-dialog",
+                   _("_Variables"),
+                   _("Jump to Variable"),
+                   "pspp-goto-variable");
+
+  g_signal_connect (de->invoke_variable_info_dialog, "activate",
+                   G_CALLBACK (variable_info_dialog), de);
+
+  de->invoke_descriptives_dialog =
+    gtk_action_new ("descriptives-dialog",
+                   _("_Descriptives"),
+                   _("Calculate descriptive statistics (mean, variance, ...)"),
+                   "pspp-descriptives");
+
+  g_signal_connect (de->invoke_descriptives_dialog, "activate",
+                   G_CALLBACK (descriptives_dialog), de);
+
+
+  de->invoke_frequencies_dialog =
+    gtk_action_new ("frequencies-dialog",
+                   _("_Frequencies"),
+                   _("Generate frequency statistics"),
+                   "pspp-frequencies");
+
+  g_signal_connect (de->invoke_frequencies_dialog, "activate",
+                   G_CALLBACK (frequencies_dialog), de);
+
+  de->invoke_crosstabs_dialog =
+    gtk_action_new ("crosstabs-dialog",
+                   _("_Crosstabs"),
+                   _("Generate crosstabulations"),
+                   "pspp-crosstabs");
+
+  g_signal_connect (de->invoke_crosstabs_dialog, "activate",
+                   G_CALLBACK (crosstabs_dialog), de);
+
+
+  de->invoke_examine_dialog =
+    gtk_action_new ("examine-dialog",
+                   _("_Explore"),
+                   _("Examine Data by Factors"),
+                   "pspp-examine");
+
+  g_signal_connect (de->invoke_examine_dialog, "activate",
+                   G_CALLBACK (examine_dialog), de);
+
+
+  de->invoke_regression_dialog =
+    gtk_action_new ("regression-dialog",
+                   _("Linear _Regression"),
+                   _("Estimate parameters of the linear model"),
+                   "pspp-regression");
+
+  g_signal_connect (de->invoke_regression_dialog, "activate",
+                   G_CALLBACK (regression_dialog), de);
+
+  g_signal_connect_swapped (get_widget_assert (de->xml,"file_new_data"),
+                           "activate",
+                           G_CALLBACK (gtk_action_activate),
+                           de->action_data_new);
+
+  g_signal_connect_swapped (get_widget_assert (de->xml,"file_open_data"),
+                           "activate",
+                           G_CALLBACK (gtk_action_activate),
+                           de->action_data_open);
+
+#if RECENT_LISTS_AVAILABLE
+  {
+    GtkRecentManager *rm = gtk_recent_manager_get_default ();
+    GtkWidget *recent_data = get_widget_assert (de->xml, "file_recent-data");
+    GtkWidget *recent_files = get_widget_assert (de->xml, "file_recent-files");
+    GtkWidget *recent_separator = get_widget_assert (de->xml, "file_separator1");
+
+    GtkWidget *menu = gtk_recent_chooser_menu_new_for_manager (rm);
+
+    GtkRecentFilter *filter = gtk_recent_filter_new ();
+
+    gtk_widget_show (recent_data);
+    gtk_widget_show (recent_files);
+    gtk_widget_show (recent_separator);
+
+    gtk_recent_filter_add_pattern (filter, "*.sav");
+    gtk_recent_filter_add_pattern (filter, "*.SAV");
+
+    gtk_recent_chooser_add_filter (GTK_RECENT_CHOOSER (menu), filter);
+
+    gtk_widget_set_sensitive (recent_data, TRUE);
+    g_signal_connect (menu, "selection-done",
+                     G_CALLBACK (on_recent_data_select), de);
+
+    gtk_menu_item_set_submenu (GTK_MENU_ITEM (recent_data), menu);
+
+
+    filter = gtk_recent_filter_new ();
+    menu = gtk_recent_chooser_menu_new_for_manager (rm);
+
+    gtk_recent_filter_add_pattern (filter, "*.sps");
+    gtk_recent_filter_add_pattern (filter, "*.SPS");
+
+    gtk_recent_chooser_add_filter (GTK_RECENT_CHOOSER (menu), filter);
+
+    gtk_widget_set_sensitive (recent_files, TRUE);
+    g_signal_connect (menu, "selection-done",
+                     G_CALLBACK (on_recent_files_select), de);
+
+    gtk_menu_item_set_submenu (GTK_MENU_ITEM (recent_files), menu);
+  }
+#endif
+
+  g_signal_connect (get_widget_assert (de->xml,"file_new_syntax"),
+                   "activate",
+                   G_CALLBACK (create_syntax_window),
+                   NULL);
+
+  g_signal_connect (get_widget_assert (de->xml,"file_open_syntax"),
+                   "activate",
+                   G_CALLBACK (open_syntax_window),
+                   de);
+
+  g_signal_connect_swapped (get_widget_assert (de->xml,"file_import-text"),
+                           "activate",
+                           G_CALLBACK (gtk_action_activate),
+                           de->invoke_text_import_assistant);
+
+  g_signal_connect_swapped (get_widget_assert (de->xml,"file_save"),
+                           "activate",
+                           G_CALLBACK (gtk_action_activate),
+                           de->action_data_save);
+
+  g_signal_connect_swapped (get_widget_assert (de->xml,"file_save_as"),
+                           "activate",
+                           G_CALLBACK (gtk_action_activate),
+                           de->action_data_save_as);
+
+  gtk_action_connect_proxy (de->invoke_find_dialog,
+                           get_widget_assert (de->xml, "edit_find")
+                           );
+
+  gtk_action_connect_proxy (de->invoke_find_dialog,
+                           get_widget_assert (de->xml, "button-find")
+                           );
+
+  gtk_action_connect_proxy (de->invoke_rank_dialog,
+                           get_widget_assert (de->xml, "transform_rank")
+                           );
+
+  gtk_action_connect_proxy (de->invoke_recode_same_dialog,
+                           get_widget_assert (de->xml,
+                                              "transform_recode-same")
+                           );
+
+  gtk_action_connect_proxy (de->invoke_recode_different_dialog,
+                           get_widget_assert (de->xml,
+                                              "transform_recode-different")
+                           );
+
+  gtk_action_connect_proxy (de->invoke_weight_cases_dialog,
+                           get_widget_assert (de->xml, "data_weight-cases")
+                           );
+
+  gtk_action_connect_proxy (de->invoke_transpose_dialog,
+                           get_widget_assert (de->xml, "data_transpose")
+                           );
+
+  gtk_action_connect_proxy (de->invoke_split_file_dialog,
+                           get_widget_assert (de->xml, "data_split-file")
+                           );
+
+  gtk_action_connect_proxy (de->invoke_sort_cases_dialog,
+                           get_widget_assert (de->xml, "data_sort-cases")
+                           );
+
+  gtk_action_connect_proxy (de->invoke_select_cases_dialog,
+                           get_widget_assert (de->xml, "data_select-cases")
+                           );
+
+  gtk_action_connect_proxy (de->invoke_compute_dialog,
+                           get_widget_assert (de->xml, "transform_compute")
+                           );
+
+  gtk_action_connect_proxy (de->invoke_t_test_independent_samples_dialog,
+                           get_widget_assert (de->xml,
+                                              "indep-t-test")
+                           );
+
+
+  gtk_action_connect_proxy (de->invoke_t_test_paired_samples_dialog,
+                           get_widget_assert (de->xml,
+                                              "paired-t-test")
+                           );
+
+
+  gtk_action_connect_proxy (de->invoke_t_test_one_sample_dialog,
+                           get_widget_assert (de->xml,
+                                              "one-sample-t-test")
+                           );
+
+
+  gtk_action_connect_proxy (de->invoke_oneway_anova_dialog,
+                           get_widget_assert (de->xml,
+                                              "oneway-anova")
+                           );
+
+
+  gtk_action_connect_proxy (de->invoke_comments_dialog,
+                           get_widget_assert (de->xml, "utilities_comments")
+                           );
+
+  gtk_action_connect_proxy (de->invoke_variable_info_dialog,
+                           get_widget_assert (de->xml, "utilities_variables")
+                           );
+
+  gtk_action_connect_proxy (de->invoke_descriptives_dialog,
+                           get_widget_assert (de->xml, "analyze_descriptives")
+                           );
+
+  gtk_action_connect_proxy (de->invoke_crosstabs_dialog,
+                           get_widget_assert (de->xml, "crosstabs")
+                           );
+
+  gtk_action_connect_proxy (de->invoke_frequencies_dialog,
+                           get_widget_assert (de->xml, "analyze_frequencies")
+                           );
+
+
+  gtk_action_connect_proxy (de->invoke_examine_dialog,
+                           get_widget_assert (de->xml, "analyze_explore")
+                           );
+
+  gtk_action_connect_proxy (de->invoke_regression_dialog,
+                           get_widget_assert (de->xml, "linear-regression")
+                           );
+
+  g_signal_connect (get_widget_assert (de->xml,"help_about"),
+                   "activate",
+                   G_CALLBACK (about_new),
+                   de);
+
+
+  g_signal_connect (get_widget_assert (de->xml,"help_reference"),
+                   "activate",
+                   G_CALLBACK (reference_manual),
+                   de);
+
+
+  g_signal_connect (de->data_editor,
+                   "cases-selected",
+                   G_CALLBACK (enable_delete_cases),
+                   de);
+
+  g_signal_connect (de->data_editor,
+                   "variables-selected",
+                   G_CALLBACK (enable_delete_variables),
+                   de);
+
+
+  g_signal_connect (GTK_NOTEBOOK (de->data_editor),
+                   "switch-page",
+                   G_CALLBACK (on_switch_sheet), de);
+
+  gtk_notebook_set_current_page (GTK_NOTEBOOK (de->data_editor), PSPPIRE_DATA_EDITOR_VARIABLE_VIEW);
+  gtk_notebook_set_current_page (GTK_NOTEBOOK (de->data_editor), PSPPIRE_DATA_EDITOR_DATA_VIEW);
+
+  g_signal_connect (get_widget_assert (de->xml, "view_statusbar"),
+                   "activate",
+                   G_CALLBACK (status_bar_activate), de);
+
+
+  g_signal_connect (get_widget_assert (de->xml, "view_gridlines"),
+                   "activate",
+                   G_CALLBACK (grid_lines_activate), de);
+
+
+
+  g_signal_connect (get_widget_assert (de->xml, "view_data"),
+                   "activate",
+                   G_CALLBACK (data_view_activate), de);
+
+  g_signal_connect (get_widget_assert (de->xml, "view_variables"),
+                   "activate",
+                   G_CALLBACK (variable_view_activate), de);
+
+
+
+  g_signal_connect (get_widget_assert (de->xml, "view_fonts"),
+                   "activate",
+                   G_CALLBACK (fonts_activate), de);
+
+
+
+
+  gtk_action_connect_proxy (de->action_data_open,
+                           get_widget_assert (de->xml, "button-open")
+                           );
+
+  gtk_action_connect_proxy (de->action_data_save,
+                           get_widget_assert (de->xml, "button-save")
+                           );
+
+  gtk_action_connect_proxy (de->invoke_variable_info_dialog,
+                           get_widget_assert (de->xml, "button-goto-variable")
+                           );
+
+  gtk_action_connect_proxy (de->invoke_weight_cases_dialog,
+                           get_widget_assert (de->xml, "button-weight-cases")
+                           );
+
+  gtk_action_connect_proxy (de->invoke_split_file_dialog,
+                           get_widget_assert (de->xml, "button-split-file")
+                           );
+
+  gtk_action_connect_proxy (de->invoke_select_cases_dialog,
+                           get_widget_assert (de->xml, "button-select-cases")
+                           );
+
+
+  g_signal_connect (get_widget_assert (de->xml, "file_quit"),
+                   "activate",
+                   G_CALLBACK (file_quit), de);
+
+  g_signal_connect (get_widget_assert (de->xml, "transform_run-pending"),
+                   "activate",
+                   G_CALLBACK (execute), de);
+
+
+  g_signal_connect (get_widget_assert (de->xml, "windows_minimise_all"),
+                   "activate",
+                   G_CALLBACK (psppire_window_minimise_all), NULL);
+
+  de->toggle_split_window =
+    gtk_toggle_action_new ("toggle-split-window",
+                          _("_Split Window"),
+                          _("Split the window vertically and horizontally"),
+                          "pspp-split-window");
+
+  g_signal_connect (de->toggle_split_window, "toggled",
+                   G_CALLBACK (toggle_split_window),
+                   de);
+
+  gtk_action_connect_proxy (GTK_ACTION (de->toggle_split_window),
+                           get_widget_assert (de->xml,
+                                              "windows_split"));
+
+  de->data_sheet_variable_popup_menu =
+    GTK_MENU (create_data_sheet_variable_popup_menu (de));
+
+  de->var_sheet_variable_popup_menu =
+    GTK_MENU (create_var_sheet_variable_popup_menu (de));
+
+  de->data_sheet_cases_popup_menu =
+    GTK_MENU (create_data_sheet_cases_popup_menu (de));
+
+
+  g_object_set (de->data_editor,
+               "datasheet-column-menu", de->data_sheet_variable_popup_menu,
+               "datasheet-row-menu", de->data_sheet_cases_popup_menu,
+               "varsheet-row-menu", de->var_sheet_variable_popup_menu,
+               NULL);
+
+  gtk_widget_show (de->data_editor);
+  gtk_widget_show (box);
+}
+
+
+GtkWidget*
+psppire_data_window_new (void)
+{
+  return GTK_WIDGET (g_object_new (psppire_data_window_get_type (),
+                                  "usage", PSPPIRE_WINDOW_USAGE_DATA,
+                                  NULL));
+}
+
diff --git a/src/ui/gui/psppire-data-window.h b/src/ui/gui/psppire-data-window.h
new file mode 100644 (file)
index 0000000..13d59a0
--- /dev/null
@@ -0,0 +1,122 @@
+/* PSPPIRE - a graphical user interface for PSPP.
+   Copyright (C) 2008  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 __PSPPIRE_DATA_WINDOW_H__
+#define __PSPPIRE_DATA_WINDOW_H__
+
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gtk/gtkaction.h>
+#include "psppire-window.h"
+#include "psppire-data-editor.h"
+#include <glade/glade.h>
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define PSPPIRE_DATA_WINDOW_TYPE            (psppire_data_window_get_type ())
+#define PSPPIRE_DATA_WINDOW(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), PSPPIRE_DATA_WINDOW_TYPE, PsppireDataWindow))
+#define PSPPIRE_DATA_WINDOW_CLASS(class)    (G_TYPE_CHECK_CLASS_CAST ((class), \
+    PSPPIRE_DATA_WINDOW_TYPE, PsppireData_WindowClass))
+#define PSPPIRE_IS_DATA_WINDOW(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+    PSPPIRE_DATA_WINDOW_TYPE))
+#define PSPPIRE_IS_DATA_WINDOW_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
+    PSPPIRE_DATA_WINDOW_TYPE))
+
+
+typedef struct _PsppireDataWindow       PsppireDataWindow;
+typedef struct _PsppireDataWindowClass  PsppireDataWindowClass;
+
+
+struct _PsppireDataWindow
+{
+  PsppireWindow parent;
+
+  /* <private> */
+  PsppireDataEditor *data_editor;
+  GladeXML *xml;
+  GtkAction *action_data_new;
+  GtkAction *action_data_open;
+  GtkAction *action_data_save_as;
+  GtkAction *action_data_save;
+
+  GtkAction *invoke_text_import_assistant;
+
+  /* Actions which invoke dialog boxes */
+  GtkAction *invoke_weight_cases_dialog;
+  GtkAction *invoke_transpose_dialog;
+  GtkAction *invoke_split_file_dialog;
+  GtkAction *invoke_sort_cases_dialog;
+  GtkAction *invoke_compute_dialog;
+  GtkAction *invoke_comments_dialog;
+  GtkAction *invoke_select_cases_dialog;
+  GtkAction *invoke_goto_dialog;
+  GtkAction *invoke_variable_info_dialog;
+  GtkAction *invoke_find_dialog;
+  GtkAction *invoke_rank_dialog;
+  GtkAction *invoke_recode_same_dialog;
+  GtkAction *invoke_recode_different_dialog;
+
+  GtkAction *invoke_crosstabs_dialog;
+  GtkAction *invoke_descriptives_dialog;
+  GtkAction *invoke_frequencies_dialog;
+  GtkAction *invoke_examine_dialog;
+  GtkAction *invoke_regression_dialog;
+
+  GtkAction *invoke_t_test_independent_samples_dialog;
+  GtkAction *invoke_t_test_paired_samples_dialog;
+  GtkAction *invoke_oneway_anova_dialog;
+  GtkAction *invoke_t_test_one_sample_dialog;
+
+  GtkToggleAction *toggle_split_window;
+  GtkToggleAction *toggle_value_labels;
+
+
+  GtkAction *insert_variable;
+  GtkAction *insert_case;
+  GtkAction *delete_variables;
+  GtkAction *delete_cases;
+
+
+  GtkMenu *data_sheet_variable_popup_menu;
+  GtkMenu *data_sheet_cases_popup_menu;
+  GtkMenu *var_sheet_variable_popup_menu;
+
+
+  gboolean save_as_portable;
+
+  /* Name of the file this data is associated with (ie, was loaded from or
+     has been  saved to), in "filename encoding",  or NULL, if it's not
+     associated with any file */
+  gchar *file_name;
+};
+
+struct _PsppireDataWindowClass
+{
+  PsppireWindowClass parent_class;
+};
+
+GType      psppire_data_window_get_type        (void);
+GtkWidget* psppire_data_window_new             (void);
+
+void create_data_window (void);
+
+
+G_END_DECLS
+
+#endif /* __PSPPIRE_DATA_WINDOW_H__ */
index 1bb7a455780245d50c1b25a39cab7e76823e9b8b..4905aba55911b4a07f45a010ffb5cde5b284d1c4 100644 (file)
@@ -79,8 +79,6 @@ psppire_output_window_get_type (void)
 static void
 psppire_output_window_finalize (GObject *object)
 {
-  g_debug ("%s %p", __FUNCTION__, object);
-
   GObjectClass *class = G_OBJECT_GET_CLASS (object);
 
   GObjectClass *parent_class = g_type_class_peek_parent (class);
@@ -283,7 +281,7 @@ psppire_output_window_reload (void)
   if ( NULL == the_output_viewer )
     {
       the_output_viewer = PSPPIRE_OUTPUT_WINDOW (psppire_output_window_new ());
-      gtk_widget_show (the_output_viewer);
+      gtk_widget_show (GTK_WIDGET (the_output_viewer));
     }
 
   reload_viewer (the_output_viewer);
index 56a39b8526ccc4bb0fc9a994a75e3ce4279c7755..5b3267441dc50140f495ee2883531e555382688f 100644 (file)
@@ -27,7 +27,7 @@
 
 #include "psppire-syntax-window.h"
 
-#include "data-editor.h"
+#include "psppire-data-window.h"
 #include "about.h"
 #include "psppire-syntax-window.h"
 #include "syntax-editor-source.h"
@@ -77,16 +77,12 @@ psppire_syntax_window_get_type (void)
 static void
 psppire_syntax_window_finalize (GObject *object)
 {
-  g_debug ("%s %p", __FUNCTION__, object);
-
   GObjectClass *class = G_OBJECT_GET_CLASS (object);
 
   GObjectClass *parent_class = g_type_class_peek_parent (class);
 
-
   if (G_OBJECT_CLASS (parent_class)->finalize)
     (*G_OBJECT_CLASS (parent_class)->finalize) (object);
-
 }
 
 
@@ -527,7 +523,7 @@ psppire_syntax_window_init (PsppireSyntaxWindow *window)
 
   g_signal_connect (get_widget_assert (xml,"file_new_data"),
                    "activate",
-                   G_CALLBACK (new_data_window),
+                   G_CALLBACK (create_data_window),
                    window);
 
   g_signal_connect (get_widget_assert (xml,"help_about"),
index 909075b02e7ae610dabc84adf663013a5c44e9b5..8405dba7fd91e81a5413482b698038cfb889f491 100644 (file)
@@ -301,7 +301,7 @@ minimise_all  (gpointer key,
 {
   PsppireWindow *w = PSPPIRE_WINDOW (value);
 
-  gtk_window_iconify (w);
+  gtk_window_iconify (GTK_WINDOW (w));
 }
 
 
index 77d550a15e040af8258eb8bc42b7bca357aac4d9..e50ce2f0a3432187cbe4d4880c132f2c1fb4f2c9 100644 (file)
@@ -26,7 +26,7 @@
 #include <ui/command-line.h>
 #include "relocatable.h"
 
-#include "data-editor.h"
+#include "psppire-data-window.h"
 #include "psppire.h"
 
 #include <libpspp/getl.h>
@@ -141,7 +141,7 @@ initialize (struct command_line_processor *clp, int argc, char **argv)
 
   command_line_processor_parse (clp, argc, argv);
 
-  new_data_window (NULL, NULL);
+  create_data_window ();
 
   execute_syntax (create_syntax_string_source (""));
 }
index 86fabd14f8a865a7bffc682df8e567fd45901da6..c75f64f205d29abc680f1925d50860170a8c25b1 100644 (file)
@@ -22,7 +22,7 @@
 #include <stdlib.h>
 
 #include <language/syntax-string-source.h>
-#include <ui/gui/data-editor.h>
+#include <ui/gui/psppire-data-window.h>
 #include <ui/gui/dialog-common.h>
 #include <ui/gui/dict-display.h>
 #include <ui/gui/helper.h>
@@ -220,7 +220,7 @@ void
 rank_dialog (GObject *o, gpointer data)
 {
   gint response;
-  struct data_editor *de = data;
+  PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
 
   struct rank_dialog rd;
 
@@ -304,7 +304,7 @@ rank_dialog (GObject *o, gpointer data)
                    G_CALLBACK (on_ntiles_toggle),
                    rd.ntiles_entry);
 
-  gtk_window_set_transient_for (GTK_WINDOW (rd.dialog), de->parent.window);
+  gtk_window_set_transient_for (GTK_WINDOW (rd.dialog), GTK_WINDOW (de));
 
   attach_dictionary_to_treeview (GTK_TREE_VIEW (vars),
                                 vs->dict,
index af6cbfa0b6043bfab0bb77259ffef3d2f29431e0..da32620b126fbde4d7a346442043954308fdabd3 100644 (file)
@@ -27,7 +27,7 @@
 #include <gtk/gtk.h>
 
 #include <language/syntax-string-source.h>
-#include <ui/gui/data-editor.h>
+#include <ui/gui/psppire-data-window.h>
 #include <ui/gui/dialog-common.h>
 #include <ui/gui/dict-display.h>
 #include <ui/gui/helper.h>
@@ -470,14 +470,14 @@ toggle_sensitivity (GtkToggleButton *button, GtkWidget *target)
   gtk_widget_set_sensitive (target, state);
 }
 
-static void recode_dialog (struct data_editor *de, gboolean diff);
+static void recode_dialog (PsppireDataWindow *de, gboolean diff);
 
 
 /* Pops up the Recode Same version of the dialog box */
 void
 recode_same_dialog (GObject *o, gpointer data)
 {
-  struct data_editor *de = data;
+  PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
 
   recode_dialog (de, FALSE);
 }
@@ -486,7 +486,7 @@ recode_same_dialog (GObject *o, gpointer data)
 void
 recode_different_dialog (GObject *o, gpointer data)
 {
-  struct data_editor *de = data;
+  PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
 
   recode_dialog (de, TRUE);
 }
@@ -836,7 +836,7 @@ set_acr (struct recode_dialog *rd)
 }
 
 static void
-recode_dialog (struct data_editor *de, gboolean diff)
+recode_dialog (PsppireDataWindow *de, gboolean diff)
 {
   gint response;
 
@@ -883,7 +883,7 @@ recode_dialog (struct data_editor *de, gboolean diff)
 
   rd.different = diff;
 
-  gtk_window_set_transient_for (GTK_WINDOW (rd.dialog), de->parent.window);
+  gtk_window_set_transient_for (GTK_WINDOW (rd.dialog), GTK_WINDOW (de));
 
 
   attach_dictionary_to_treeview (GTK_TREE_VIEW (rd.dict_treeview),
@@ -994,7 +994,7 @@ recode_dialog (struct data_editor *de, gboolean diff)
       PSPPIRE_DIALOG (get_widget_assert (xml, "old-new-values-dialog"));
 
     gtk_window_set_transient_for (GTK_WINDOW (rd.old_and_new_dialog),
-                                 de->parent.window);
+                                 GTK_WINDOW (de));
 
     rd.acr = PSPPIRE_ACR (get_widget_assert (xml, "psppire-acr1"));
 
index a47d73456f35ba4434305bf23d4b1a4fe120edcd..4988261ae93e4c4f3770426d858cd76c1a03c7f3 100644 (file)
@@ -23,7 +23,7 @@
 #include <stdlib.h>
 
 #include <language/syntax-string-source.h>
-#include <ui/gui/data-editor.h>
+#include <ui/gui/psppire-data-window.h>
 #include <ui/gui/dialog-common.h>
 #include <ui/gui/dict-display.h>
 #include <ui/gui/helper.h>
@@ -223,11 +223,11 @@ void
 regression_dialog (GObject *o, gpointer data)
 {
   gint response;
-  struct data_editor *de = data;
-
   struct regression_dialog rd;
 
   GladeXML *xml = XML_NEW ("regression.glade");
+  PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
+
   PsppireVarStore *vs;
 
   GtkWidget *dialog = get_widget_assert   (xml, "regression-dialog");
@@ -251,7 +251,7 @@ regression_dialog (GObject *o, gpointer data)
                                  stats
                                  );
 
-  gtk_window_set_transient_for (GTK_WINDOW (dialog), de->parent.window);
+  gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de));
 
   attach_dictionary_to_treeview (GTK_TREE_VIEW (source),
                                 vs->dict,
@@ -286,8 +286,8 @@ regression_dialog (GObject *o, gpointer data)
   rd.current_opts.pred = FALSE;
   rd.current_opts.resid = FALSE;
 
-  gtk_window_set_transient_for (GTK_WINDOW (rd.save_dialog), de->parent.window);
-  gtk_window_set_transient_for (GTK_WINDOW (rd.stat_dialog), de->parent.window);
+  gtk_window_set_transient_for (GTK_WINDOW (rd.save_dialog), GTK_WINDOW (de));
+  gtk_window_set_transient_for (GTK_WINDOW (rd.stat_dialog), GTK_WINDOW (de));
 
   g_signal_connect (dialog, "refresh", G_CALLBACK (refresh),  &rd);
 
index 0056ca5e2acdc67e34386ef9261b836022ef27b3..9d711d31729624875aa76cafb72cdb47a9c65713 100644 (file)
@@ -21,7 +21,7 @@
 #include <glade/glade.h>
 #include "helper.h"
 #include "psppire-dialog.h"
-#include "data-editor.h"
+#include "psppire-data-window.h"
 #include "dialog-common.h"
 #include "dict-display.h"
 #include "widget-io.h"
@@ -241,7 +241,7 @@ select_cases_dialog (GObject *o, gpointer data)
   gint response;
   struct select_cases_dialog scd = {0,0,0,0,0,0};
   GtkWidget *dialog   ;
-  struct data_editor *de = data;
+  PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
   GtkWidget *entry = NULL;
   GtkWidget *selector ;
   GtkWidget *button_range;
@@ -320,7 +320,7 @@ select_cases_dialog (GObject *o, gpointer data)
 
 
   dialog = get_widget_assert (scd.xml, "select-cases-dialog");
-  gtk_window_set_transient_for (GTK_WINDOW (dialog), de->parent.window);
+  gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de));
 
   {
     GtkWidget *source = get_widget_assert   (scd.xml, "select-cases-treeview");
index 6c3f332db05eadd5ad7e645c5b7c3428cf6e8798..9e294861fe210a295346da63a5cf6b36e1623580 100644 (file)
@@ -19,7 +19,7 @@
 #include "sort-cases-dialog.h"
 #include "helper.h"
 #include "psppire-dialog.h"
-#include "data-editor.h"
+#include "psppire-data-window.h"
 #include "psppire-var-store.h"
 #include "dialog-common.h"
 #include "dict-display.h"
@@ -91,7 +91,7 @@ void
 sort_cases_dialog (GObject *o, gpointer data)
 {
   gint response;
-  struct data_editor *de = data;
+  PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
 
   struct sort_cases_dialog scd;
 
@@ -108,7 +108,7 @@ sort_cases_dialog (GObject *o, gpointer data)
 
   g_object_get (de->data_editor, "var-store", &vs, NULL);
 
-  gtk_window_set_transient_for (GTK_WINDOW (dialog), de->parent.window);
+  gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de));
 
   attach_dictionary_to_treeview (GTK_TREE_VIEW (source),
                                 vs->dict,
index 96ecf5a6ebfe65626da254b19ad651799a90b44d..f548a7aac297e57d38852017c246606b40c5c91a 100644 (file)
@@ -20,7 +20,7 @@
 #include "psppire-selector.h"
 #include "psppire-dialog.h"
 #include "helper.h"
-#include "data-editor.h"
+#include "psppire-data-window.h"
 #include "dict-display.h"
 #include <language/syntax-string-source.h>
 #include "psppire-syntax-window.h"
@@ -167,7 +167,7 @@ void
 split_file_dialog (GObject *o, gpointer data)
 {
   gint response;
-  struct data_editor *de = data;
+  PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
   struct split_file_dialog sfd;
   PsppireVarStore *vs ;
 
@@ -211,7 +211,7 @@ split_file_dialog (GObject *o, gpointer data)
 
   g_signal_connect (dialog, "refresh", G_CALLBACK (refresh),  &sfd);
 
-  gtk_window_set_transient_for (GTK_WINDOW (dialog), de->parent.window);
+  gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de));
 
   response = psppire_dialog_run (PSPPIRE_DIALOG (dialog));
 
index 032600128dcff2fc999fabf339a25dd67953cfcc..a54a94addccebf7bf758a1d4e848cf650d126338 100644 (file)
@@ -23,7 +23,7 @@
 #include "psppire-dict.h"
 #include "psppire-var-store.h"
 #include "helper.h"
-#include "data-editor.h"
+#include "psppire-data-window.h"
 #include "psppire-dialog.h"
 #include "dialog-common.h"
 #include "dict-display.h"
@@ -392,7 +392,7 @@ t_test_independent_samples_dialog (GObject *o, gpointer data)
 {
   struct tt_indep_samples_dialog tt_d;
   gint response;
-  struct data_editor *de = data;
+  PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
 
   PsppireVarStore *vs = NULL;
 
@@ -421,11 +421,11 @@ t_test_independent_samples_dialog (GObject *o, gpointer data)
 
   tt_d.define_groups_button = get_widget_assert (xml, "define-groups-button");
   tt_d.groups_entry = get_widget_assert (xml, "indep-samples-t-test-entry");
-  tt_d.opts = tt_options_dialog_create (xml, de->parent.window);
-  tt_d.grps = tt_groups_dialog_create (xml, de->parent.window);
+  tt_d.opts = tt_options_dialog_create (xml, GTK_WINDOW (de));
+  tt_d.grps = tt_groups_dialog_create (xml, GTK_WINDOW (de));
 
 
-  gtk_window_set_transient_for (GTK_WINDOW (tt_d.dialog), de->parent.window);
+  gtk_window_set_transient_for (GTK_WINDOW (tt_d.dialog), GTK_WINDOW (de));
 
   attach_dictionary_to_treeview (GTK_TREE_VIEW (dict_view),
                                 vs->dict,
index db08576f5dd1adac3e45348def6cb4fdecf3f43a..6ce649b935a108c1323e3558d8f2308b79655a9e 100644 (file)
@@ -23,7 +23,7 @@
 #include "psppire-dict.h"
 #include "psppire-var-store.h"
 #include "helper.h"
-#include "data-editor.h"
+#include "psppire-data-window.h"
 #include "psppire-dialog.h"
 #include "dialog-common.h"
 #include "dict-display.h"
@@ -124,7 +124,7 @@ t_test_one_sample_dialog (GObject *o, gpointer data)
 {
   struct tt_one_sample_dialog tt_d;
   gint response;
-  struct data_editor *de = data;
+  PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
 
   PsppireVarStore *vs = NULL;
 
@@ -145,9 +145,9 @@ t_test_one_sample_dialog (GObject *o, gpointer data)
   tt_d.dict = vs->dict;
   tt_d.vars_treeview = get_widget_assert (xml, "one-sample-t-test-treeview1");
   tt_d.test_value_entry = get_widget_assert (xml, "test-value-entry");
-  tt_d.opt = tt_options_dialog_create (xml, de->parent.window);
+  tt_d.opt = tt_options_dialog_create (xml, GTK_WINDOW (de));
 
-  gtk_window_set_transient_for (GTK_WINDOW (dialog), de->parent.window);
+  gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de));
 
   attach_dictionary_to_treeview (GTK_TREE_VIEW (dict_view),
                                 vs->dict,
index c0207949d901804053b6b4e4d75aece006fba501..b84bee9bfc90dff286c345c79a3dbfea546ef7b7 100644 (file)
@@ -20,7 +20,7 @@
 #include <glade/glade.h>
 #include <language/syntax-string-source.h>
 
-#include "data-editor.h"
+#include "psppire-data-window.h"
 
 #include "psppire-dict.h"
 #include "psppire-var-store.h"
@@ -183,7 +183,7 @@ t_test_paired_samples_dialog (GObject *o, gpointer data)
 {
   struct tt_paired_samples_dialog tt_d;
   gint response;
-  struct data_editor *de = data;
+  PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
 
   PsppireVarStore *vs = NULL;
 
@@ -203,9 +203,9 @@ t_test_paired_samples_dialog (GObject *o, gpointer data)
   tt_d.dict = vs->dict;
   tt_d.pairs_treeview =
    get_widget_assert (xml, "paired-samples-t-test-treeview2");
-  tt_d.opt = tt_options_dialog_create (xml, de->parent.window);
+  tt_d.opt = tt_options_dialog_create (xml, GTK_WINDOW (de));
 
-  gtk_window_set_transient_for (GTK_WINDOW (dialog), de->parent.window);
+  gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de));
 
 
   attach_dictionary_to_treeview (GTK_TREE_VIEW (dict_view),
index 1cab531be1537f58f315bb2986849ca4e34d1985..f749de38581f9a02640472d350f00fc311135e53 100644 (file)
@@ -39,7 +39,7 @@
 #include <libpspp/assertion.h>
 #include <libpspp/message.h>
 #include <ui/syntax-gen.h>
-#include <ui/gui/data-editor.h>
+#include <ui/gui/psppire-data-window.h>
 #include <ui/gui/dialog-common.h>
 #include <ui/gui/helper.h>
 #include <ui/gui/psppire-dialog.h>
@@ -63,7 +63,7 @@ text_data_import_assistant (GObject *o, gpointer de_)
   struct data_editor *de = de_;
 
   GtkWidget *dialog =
-    gtk_message_dialog_new  (de->parent.window,
+    gtk_message_dialog_new  (GTK_WINDOW (de),
                             GTK_DIALOG_MODAL,
                             GTK_MESSAGE_WARNING,
                             GTK_BUTTONS_CLOSE,
@@ -259,7 +259,7 @@ void
 text_data_import_assistant (GObject *o, gpointer de_)
 {
   struct data_editor *de = de_;
-  GtkWindow *parent_window = de->parent.window;
+  GtkWindow *parent_window = GTK_WINDOW (de);
   struct import_assistant *ia;
 
   ia = xzalloc (sizeof *ia);
@@ -2309,7 +2309,7 @@ pop_watch_cursor (struct import_assistant *ia)
 {
   if (--ia->asst.watch_cursor == 0)
     {
-      GtkWidget *widget = GTK_WIDGET (ia->asst.assistant);;
+      GtkWidget *widget = GTK_WIDGET (ia->asst.assistant);
       gdk_window_set_cursor (widget->window, NULL);
     }
 }
index 9945c9472f44add332ec725fa926368735a0118a..1a98a6a53b94c54f6db9eb0a6787affc808e0279 100644 (file)
@@ -20,7 +20,7 @@
 #include "psppire-selector.h"
 #include "psppire-dialog.h"
 #include "helper.h"
-#include "data-editor.h"
+#include "psppire-data-window.h"
 #include "dict-display.h"
 #include <language/syntax-string-source.h>
 #include "psppire-syntax-window.h"
@@ -80,7 +80,7 @@ void
 transpose_dialog (GObject *o, gpointer data)
 {
   gint response ;
-  struct data_editor *de = data;
+  PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
 
   GladeXML *xml = XML_NEW ("psppire.glade");
 
@@ -117,7 +117,7 @@ transpose_dialog (GObject *o, gpointer data)
 
   g_signal_connect (dialog, "refresh", G_CALLBACK (refresh),  xml);
 
-  gtk_window_set_transient_for (GTK_WINDOW (dialog), de->parent.window);
+  gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de));
 
   psppire_dialog_set_valid_predicate (PSPPIRE_DIALOG (dialog),
                                      dialog_state_valid, xml);
index dcd1b911fcbe79d71b746598ff12cba2558ce016..09b545bd6afb10b941b1c5efd02e6813c5f05f66 100644 (file)
@@ -23,7 +23,7 @@
 #include <data/variable.h>
 #include <data/format.h>
 #include <data/value-labels.h>
-#include "data-editor.h"
+#include "psppire-data-window.h"
 #include "psppire-dialog.h"
 #include "psppire-var-store.h"
 #include "helper.h"
@@ -164,7 +164,7 @@ static gchar * generate_syntax (GtkTreeView *treeview);
 void
 variable_info_dialog (GObject *o, gpointer data)
 {
-  struct data_editor *de = data;
+  PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
 
   gint response ;
 
@@ -178,7 +178,7 @@ variable_info_dialog (GObject *o, gpointer data)
 
   g_object_get (de->data_editor, "var-store", &vs, NULL);
 
-  gtk_window_set_transient_for (GTK_WINDOW (dialog), de->parent.window);
+  gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de));
 
   attach_dictionary_to_treeview (GTK_TREE_VIEW (treeview),
                                 vs->dict,
index 3b1db1b93a57272d4d8a37398745b7e6ba368f44..121a523dae5ec5b099444cd8df0b30a8b2aa1330 100644 (file)
@@ -20,7 +20,7 @@
 #include "psppire-selector.h"
 #include "psppire-dialog.h"
 #include "helper.h"
-#include "data-editor.h"
+#include "psppire-data-window.h"
 #include "dict-display.h"
 #include <language/syntax-string-source.h>
 #include "psppire-syntax-window.h"
@@ -104,7 +104,7 @@ void
 weight_cases_dialog (GObject *o, gpointer data)
 {
   gint response;
-  struct data_editor *de = data;
+  PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
   struct weight_cases_dialog wcd;
 
   GladeXML *xml = XML_NEW ("psppire.glade");
@@ -122,7 +122,7 @@ weight_cases_dialog (GObject *o, gpointer data)
 
   g_object_get (de->data_editor, "var-store", &vs,  NULL);
 
-  gtk_window_set_transient_for (GTK_WINDOW (dialog), de->parent.window);
+  gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de));
 
   g_signal_connect (radiobutton1, "toggled", G_CALLBACK (on_toggle), entry);
   g_signal_connect (selector, "selected", G_CALLBACK (on_select),
diff --git a/src/ui/gui/window-manager.c b/src/ui/gui/window-manager.c
deleted file mode 100644 (file)
index 065a4db..0000000
+++ /dev/null
@@ -1,198 +0,0 @@
-/* PSPPIRE - a graphical user interface for PSPP.
-   Copyright (C) 2006, 2007  Free Software Foundation
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation, either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>. */
-
-
-#include <config.h>
-
-#include "relocatable.h"
-
-#include <glib.h>
-#include "psppire-syntax-window.h"
-#include "data-editor.h"
-
-
-#include <gettext.h>
-#define _(msgid) gettext (msgid)
-#define N_(msgid) msgid
-
-
-#include "window-manager.h"
-
-
-
-/* A list of struct editor_windows */
-static GSList *window_list = NULL;
-
-
-static void
-deregister_window (GtkWindow *w, gpointer data)
-{
-  struct editor_window *e = data;
-
-  window_list = g_slist_remove (window_list, e);
-
-  if ( g_slist_length (window_list) == 0 )
-    gtk_main_quit ();
-};
-
-
-static void
-register_window (struct editor_window *e)
-{
-  window_list = g_slist_prepend (window_list, e);
-}
-
-
-static gint
-next_window_id (void)
-{
-  return g_slist_length (window_list);
-}
-
-void
-minimise_all_windows (void)
-{
-  const GSList *i = NULL;
-
-  for (i = window_list; i != NULL ; i = i->next)
-    {
-      struct editor_window *e = i->data;
-      gtk_window_iconify (e->window);
-    }
-}
-
-static void set_window_name (struct editor_window *e, const gchar *name );
-
-
-struct editor_window *
-window_create (enum window_type type, const gchar *name)
-{
-  struct editor_window *e;
-  switch (type)
-    {
-    case WINDOW_SYNTAX:
-      //e = (struct editor_window *) new_syntax_editor ();
-      break;
-    case WINDOW_DATA:
-      e = (struct editor_window *) new_data_editor ();
-      break;
-    case WINDOW_OUTPUT:
-      //e = (struct editor_window *) new_output_viewer ();
-      break;
-    default:
-      g_assert_not_reached ();
-    };
-
-  e->type = type;
-  e->name = NULL;
-
-  set_window_name (e, name);
-
-
-  gtk_window_set_icon_from_file (GTK_WINDOW (e->window),
-                                relocate (PKGDATADIR "/psppicon.png"), 0);
-
-  g_signal_connect (e->window, "destroy",
-                   G_CALLBACK (deregister_window), e);
-
-  register_window (e);
-
-  gtk_widget_show (GTK_WIDGET (e->window));
-
-  return e;
-}
-
-void
-default_window_name (struct editor_window *w)
-{
-  set_window_name (w, NULL);
-}
-
-static void
-set_window_name (struct editor_window *e,
-                const gchar *name )
-{
-  gchar *title ;
-  g_free (e->name);
-
-  e->name = NULL;
-
-  if ( name )
-    {
-      e->name =  g_strdup (name);
-      return;
-    }
-
-  switch (e->type )
-    {
-    case WINDOW_SYNTAX:
-      e->name = g_strdup_printf (_("Syntax%d"), next_window_id () );
-      title = g_strdup_printf (_("%s --- PSPP Syntax Editor"), e->name);
-      break;
-    case WINDOW_DATA:
-      e->name = g_strdup_printf (_("Untitled%d"), next_window_id () );
-      title = g_strdup_printf (_("%s --- PSPP Data Editor"), e->name);
-      break;
-    case WINDOW_OUTPUT:
-      e->name = g_strdup_printf (_("Output%d"), next_window_id () );
-      title = g_strdup_printf (_("%s --- PSPP Output"), e->name);
-      break;
-    default:
-      g_assert_not_reached ();
-    }
-
-  gtk_window_set_title (GTK_WINDOW (e->window), title);
-
-  g_free (title);
-}
-
-
-/* Set the name of this window based on FILENAME.
-   FILENAME is in "filename encoding" */
-void
-window_set_name_from_filename (struct editor_window *e,
-                              const gchar *fn)
-{
-  gchar *title;
-  gchar *filename = g_filename_to_utf8 (fn, -1, NULL, NULL, NULL);
-  gchar *basename = g_path_get_basename (filename);
-
-  set_window_name (e, filename);
-
-  switch (e->type)
-    {
-    case WINDOW_SYNTAX:
-      title = g_strdup_printf (_("%s --- PSPP Syntax Editor"), basename);
-      break;
-    case WINDOW_DATA:
-      title = g_strdup_printf (_("%s --- PSPP Data Editor"), basename);
-      break;
-    default:
-      g_assert_not_reached ();
-    }
-  g_free (basename);
-
-  gtk_window_set_title (GTK_WINDOW (e->window), title);
-
-  g_free (title);
-  g_free (filename);
-}
-
-const gchar *
-window_name (const struct editor_window *e)
-{
-  return e->name;
-}
diff --git a/src/ui/gui/window-manager.h b/src/ui/gui/window-manager.h
deleted file mode 100644 (file)
index 2bb2fd7..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/* PSPPIRE - a graphical user interface for PSPP.
-   Copyright (C) 2007  Free Software Foundation
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation, either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>. */
-
-
-#ifndef WINDOW_MANAGER_H
-#define WINDOW_MANAGER_H
-
-#include <gtk/gtk.h>
-
-enum window_type
-  {
-    WINDOW_DATA,
-    WINDOW_SYNTAX,
-    WINDOW_OUTPUT
-  };
-
-
-struct editor_window
- {
-  GtkWindow *window;      /* The top level window of the editor */
-  gchar *name;            /* The name of this editor (UTF-8) */
-  enum window_type type;
- } ;
-
-struct editor_window * window_create (enum window_type type,
-                                     const gchar *name);
-
-const gchar * window_name (const struct editor_window *);
-
-/* Set the name of this window based on FILENAME.
-   FILENAME is in "filename encoding" */
-void window_set_name_from_filename (struct editor_window *e,
-                                   const gchar *filename);
-
-void default_window_name (struct editor_window *w);
-
-void minimise_all_windows (void);
-
-
-#endif