1 /* PSPPIRE - a graphical user interface for PSPP.
2 Copyright (C) 2008, 2009 Free Software Foundation
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 #include <gtk/gtksignal.h>
20 #include <gtk/gtkbox.h>
24 #include "text-data-import-dialog.h"
27 #include <ui/syntax-gen.h>
28 #include <language/syntax-string-source.h>
29 #include <libpspp/message.h>
32 #include <data/procedure.h>
35 #include "psppire-window.h"
36 #include "psppire-data-window.h"
37 #include "psppire-syntax-window.h"
41 #include "goto-case-dialog.h"
42 #include "weight-cases-dialog.h"
43 #include "split-file-dialog.h"
44 #include "transpose-dialog.h"
45 #include "sort-cases-dialog.h"
46 #include "select-cases-dialog.h"
47 #include "compute-dialog.h"
48 #include "find-dialog.h"
49 #include "rank-dialog.h"
50 #include "recode-dialog.h"
51 #include "comments-dialog.h"
52 #include "variable-info-dialog.h"
53 #include "descriptives-dialog.h"
54 #include "crosstabs-dialog.h"
55 #include "frequencies-dialog.h"
56 #include "examine-dialog.h"
57 #include "regression-dialog.h"
58 #include "reliability-dialog.h"
59 #include "oneway-anova-dialog.h"
60 #include "t-test-independent-samples-dialog.h"
61 #include "t-test-one-sample.h"
62 #include "t-test-paired-samples.h"
66 #define _(msgid) gettext (msgid)
67 #define N_(msgid) msgid
71 static void psppire_data_window_base_finalize (PsppireDataWindowClass *, gpointer);
72 static void psppire_data_window_base_init (PsppireDataWindowClass *class);
73 static void psppire_data_window_class_init (PsppireDataWindowClass *class);
74 static void psppire_data_window_init (PsppireDataWindow *data_editor);
77 static void psppire_data_window_iface_init (PsppireWindowIface *iface);
81 psppire_data_window_get_type (void)
83 static GType psppire_data_window_type = 0;
85 if (!psppire_data_window_type)
87 static const GTypeInfo psppire_data_window_info =
89 sizeof (PsppireDataWindowClass),
90 (GBaseInitFunc) psppire_data_window_base_init,
91 (GBaseFinalizeFunc) psppire_data_window_base_finalize,
92 (GClassInitFunc)psppire_data_window_class_init,
93 (GClassFinalizeFunc) NULL,
95 sizeof (PsppireDataWindow),
97 (GInstanceInitFunc) psppire_data_window_init,
100 static const GInterfaceInfo window_interface_info =
102 (GInterfaceInitFunc) psppire_data_window_iface_init,
107 psppire_data_window_type =
108 g_type_register_static (PSPPIRE_TYPE_WINDOW, "PsppireDataWindow",
109 &psppire_data_window_info, 0);
112 g_type_add_interface_static (psppire_data_window_type,
113 PSPPIRE_TYPE_WINDOW_MODEL,
114 &window_interface_info);
117 return psppire_data_window_type;
120 static GObjectClass *parent_class ;
123 psppire_data_window_finalize (GObject *object)
125 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (object);
127 g_object_unref (de->builder);
129 if (G_OBJECT_CLASS (parent_class)->finalize)
130 (*G_OBJECT_CLASS (parent_class)->finalize) (object);
135 psppire_data_window_class_init (PsppireDataWindowClass *class)
137 parent_class = g_type_class_peek_parent (class);
142 psppire_data_window_base_init (PsppireDataWindowClass *class)
144 GObjectClass *object_class = G_OBJECT_CLASS (class);
146 object_class->finalize = psppire_data_window_finalize;
152 psppire_data_window_base_finalize (PsppireDataWindowClass *class,
161 extern PsppireVarStore *the_var_store;
162 extern struct dataset *the_dataset;
163 extern PsppireDataStore *the_data_store ;
165 extern GtkRecentManager *the_recent_mgr;
168 set_paste_menuitem_sensitivity (PsppireDataWindow *de, gboolean x)
170 GtkAction *edit_paste = get_action_assert (de->builder, "edit_paste");
172 gtk_action_set_sensitive (edit_paste, x);
176 set_cut_copy_menuitem_sensitivity (PsppireDataWindow *de, gboolean x)
178 GtkAction *edit_copy = get_action_assert (de->builder, "edit_copy");
179 GtkAction *edit_cut = get_action_assert (de->builder, "edit_cut");
181 gtk_action_set_sensitive (edit_copy, x);
182 gtk_action_set_sensitive (edit_cut, x);
185 /* Run the EXECUTE command. */
187 execute (GtkMenuItem *mi, gpointer data)
189 struct getl_interface *sss = create_syntax_string_source ("EXECUTE.");
191 execute_syntax (sss);
195 transformation_change_callback (bool transformations_pending,
198 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
200 GtkUIManager *uim = GTK_UI_MANAGER (get_object_assert (de->builder, "uimanager1", GTK_TYPE_UI_MANAGER));
202 GtkWidget *menuitem =
203 gtk_ui_manager_get_widget (uim,"/ui/menubar/transform/transform_run-pending");
205 GtkWidget *status_label =
206 get_widget_assert (de->builder, "case-counter-area");
208 gtk_widget_set_sensitive (menuitem, transformations_pending);
211 if ( transformations_pending)
212 gtk_label_set_text (GTK_LABEL (status_label),
213 _("Transformations Pending"));
215 gtk_label_set_text (GTK_LABEL (status_label), "");
218 /* Callback for when the dictionary changes its filter variable */
220 on_filter_change (GObject *o, gint filter_index, gpointer data)
222 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
224 GtkWidget *filter_status_area =
225 get_widget_assert (de->builder, "filter-use-status-area");
227 if ( filter_index == -1 )
229 gtk_label_set_text (GTK_LABEL (filter_status_area), _("Filter off"));
233 PsppireVarStore *vs = NULL;
234 struct variable *var ;
237 g_object_get (de->data_editor, "var-store", &vs, NULL);
239 var = psppire_dict_get_variable (vs->dict, filter_index);
241 text = g_strdup_printf (_("Filter by %s"), var_get_name (var));
243 gtk_label_set_text (GTK_LABEL (filter_status_area), text);
249 /* Callback for when the dictionary changes its split variables */
251 on_split_change (PsppireDict *dict, gpointer data)
253 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
255 size_t n_split_vars = dict_get_split_cnt (dict->dict);
257 GtkWidget *split_status_area =
258 get_widget_assert (de->builder, "split-file-status-area");
260 if ( n_split_vars == 0 )
262 gtk_label_set_text (GTK_LABEL (split_status_area), _("No Split"));
268 const struct variable *const * split_vars =
269 dict_get_split_vars (dict->dict);
271 text = g_string_new (_("Split by "));
273 for (i = 0 ; i < n_split_vars - 1; ++i )
275 g_string_append_printf (text, "%s, ", var_get_name (split_vars[i]));
277 g_string_append (text, var_get_name (split_vars[i]));
279 gtk_label_set_text (GTK_LABEL (split_status_area), text->str);
281 g_string_free (text, TRUE);
288 /* Callback for when the dictionary changes its weights */
290 on_weight_change (GObject *o, gint weight_index, gpointer data)
292 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
294 GtkWidget *weight_status_area =
295 get_widget_assert (de->builder, "weight-status-area");
297 if ( weight_index == -1 )
299 gtk_label_set_text (GTK_LABEL (weight_status_area), _("Weights off"));
303 struct variable *var ;
304 PsppireVarStore *vs = NULL;
307 g_object_get (de->data_editor, "var-store", &vs, NULL);
309 var = psppire_dict_get_variable (vs->dict, weight_index);
311 text = g_strdup_printf (_("Weight by %s"), var_get_name (var));
313 gtk_label_set_text (GTK_LABEL (weight_status_area), text);
321 dump_rm (GtkRecentManager *rm)
323 GList *items = gtk_recent_manager_get_items (rm);
327 g_print ("Recent Items:\n");
328 for (i = items; i; i = i->next)
330 GtkRecentInfo *ri = i->data;
332 g_print ("Item: %s (Mime: %s) (Desc: %s) (URI: %s)\n",
333 gtk_recent_info_get_short_name (ri),
334 gtk_recent_info_get_mime_type (ri),
335 gtk_recent_info_get_description (ri),
336 gtk_recent_info_get_uri (ri)
340 gtk_recent_info_unref (ri);
349 load_file (PsppireWindow *de, const gchar *file_name)
351 gchar *native_file_name;
352 struct getl_interface *sss;
353 struct string filename;
355 ds_init_empty (&filename);
358 convert_glib_filename_to_system_filename (file_name, NULL);
360 syntax_gen_string (&filename, ss_cstr (native_file_name));
362 g_free (native_file_name);
364 sss = create_syntax_string_source ("GET FILE=%s.",
365 ds_cstr (&filename));
367 ds_destroy (&filename);
369 if (execute_syntax (sss) )
376 sysfile_chooser_dialog (PsppireWindow *toplevel)
379 gtk_file_chooser_dialog_new (_("Open"),
380 GTK_WINDOW (toplevel),
381 GTK_FILE_CHOOSER_ACTION_OPEN,
382 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
383 GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
386 GtkFileFilter *filter = gtk_file_filter_new ();
387 gtk_file_filter_set_name (filter, _("System Files (*.sav)"));
388 gtk_file_filter_add_pattern (filter, "*.sav");
389 gtk_file_filter_add_pattern (filter, "*.SAV");
390 gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
392 filter = gtk_file_filter_new ();
393 gtk_file_filter_set_name (filter, _("Portable Files (*.por) "));
394 gtk_file_filter_add_pattern (filter, "*.por");
395 gtk_file_filter_add_pattern (filter, "*.POR");
396 gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
398 filter = gtk_file_filter_new ();
399 gtk_file_filter_set_name (filter, _("All Files"));
400 gtk_file_filter_add_pattern (filter, "*");
401 gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
405 gchar *filename = NULL;
406 g_object_get (toplevel, "filename", &filename, NULL);
408 if ( ! g_path_is_absolute (filename))
411 g_build_filename (g_get_current_dir (), filename, NULL);
412 dir_name = g_path_get_dirname (path);
417 dir_name = g_path_get_dirname (filename);
419 gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog),
427 /* Callback for the data_open action.
428 Prompts for a filename and opens it */
430 open_data_dialog (GtkAction *action, PsppireWindow *de)
432 GtkWidget *dialog = sysfile_chooser_dialog (de);
434 switch (gtk_dialog_run (GTK_DIALOG (dialog)))
436 case GTK_RESPONSE_ACCEPT:
439 gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
441 psppire_window_load (de, name);
450 gtk_widget_destroy (dialog);
453 /* Returns true if NAME has a suffix which might denote a PSPP file */
455 name_has_suffix (const gchar *name)
457 if ( g_str_has_suffix (name, ".sav"))
459 if ( g_str_has_suffix (name, ".SAV"))
461 if ( g_str_has_suffix (name, ".por"))
463 if ( g_str_has_suffix (name, ".POR"))
470 /* Save DE to file */
472 save_file (PsppireWindow *w)
474 gchar *native_file_name = NULL;
475 gchar *file_name = NULL;
477 struct getl_interface *sss;
478 struct string filename ;
479 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (w);
481 g_object_get (w, "filename", &file_name, NULL);
483 fnx = g_string_new (file_name);
485 if ( ! name_has_suffix (fnx->str))
487 if ( de->save_as_portable)
488 g_string_append (fnx, ".por");
490 g_string_append (fnx, ".sav");
493 ds_init_empty (&filename);
496 convert_glib_filename_to_system_filename (fnx->str, NULL);
498 g_string_free (fnx, TRUE);
500 syntax_gen_string (&filename, ss_cstr (native_file_name));
501 g_free (native_file_name);
503 if ( de->save_as_portable )
505 sss = create_syntax_string_source ("EXPORT OUTFILE=%s.",
506 ds_cstr (&filename));
510 sss = create_syntax_string_source ("SAVE OUTFILE=%s.",
511 ds_cstr (&filename));
514 ds_destroy (&filename);
516 execute_syntax (sss);
521 insert_case (GtkAction *action, gpointer data)
523 PsppireDataWindow *dw = PSPPIRE_DATA_WINDOW (data);
524 psppire_data_editor_insert_case (dw->data_editor);
528 on_insert_variable (GtkAction *action, gpointer data)
530 PsppireDataEditor *de = PSPPIRE_DATA_EDITOR (data);
531 psppire_data_editor_insert_variable (de);
536 display_dict (PsppireDataWindow *de)
539 struct getl_interface *sss =
540 create_syntax_string_source ("DISPLAY DICTIONARY.");
542 execute_syntax (sss);
546 sysfile_info (PsppireDataWindow *de)
548 GtkWidget *dialog = sysfile_chooser_dialog (PSPPIRE_WINDOW (de));
550 if ( GTK_RESPONSE_ACCEPT == gtk_dialog_run (GTK_DIALOG (dialog)))
552 struct string filename;
553 struct getl_interface *sss;
555 gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
557 gchar *native_file_name =
558 convert_glib_filename_to_system_filename (file_name, NULL);
560 ds_init_empty (&filename);
562 syntax_gen_string (&filename, ss_cstr (native_file_name));
564 g_free (native_file_name);
566 sss = create_syntax_string_source ("SYSFILE INFO %s.",
567 ds_cstr (&filename));
568 execute_syntax (sss);
571 gtk_widget_destroy (dialog);
575 /* Callback for data_save_as action. Prompt for a filename and save */
577 data_save_as_dialog (PsppireDataWindow *de)
579 GtkWidget *button_sys;
581 gtk_file_chooser_dialog_new (_("Save"),
583 GTK_FILE_CHOOSER_ACTION_SAVE,
584 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
585 GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
588 GtkFileFilter *filter = gtk_file_filter_new ();
589 gtk_file_filter_set_name (filter, _("System Files (*.sav)"));
590 gtk_file_filter_add_pattern (filter, "*.sav");
591 gtk_file_filter_add_pattern (filter, "*.SAV");
592 gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
594 filter = gtk_file_filter_new ();
595 gtk_file_filter_set_name (filter, _("Portable Files (*.por) "));
596 gtk_file_filter_add_pattern (filter, "*.por");
597 gtk_file_filter_add_pattern (filter, "*.POR");
598 gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
600 filter = gtk_file_filter_new ();
601 gtk_file_filter_set_name (filter, _("All Files"));
602 gtk_file_filter_add_pattern (filter, "*");
603 gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
606 GtkWidget *button_por;
607 GtkWidget *vbox = gtk_vbox_new (TRUE, 5);
609 gtk_radio_button_new_with_label (NULL, _("System File"));
612 gtk_radio_button_new_with_label
613 (gtk_radio_button_get_group (GTK_RADIO_BUTTON(button_sys)),
616 gtk_box_pack_start_defaults (GTK_BOX (vbox), button_sys);
617 gtk_box_pack_start_defaults (GTK_BOX (vbox), button_por);
619 gtk_widget_show_all (vbox);
621 gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER(dialog), vbox);
624 switch (gtk_dialog_run (GTK_DIALOG (dialog)))
626 case GTK_RESPONSE_ACCEPT:
631 gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog))
634 de->save_as_portable =
635 ! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button_sys));
637 if ( ! name_has_suffix (filename->str))
639 if ( de->save_as_portable)
640 g_string_append (filename, ".por");
642 g_string_append (filename, ".sav");
645 psppire_window_set_filename (PSPPIRE_WINDOW (de), filename->str);
647 save_file (PSPPIRE_WINDOW (de));
649 g_string_free (filename, TRUE);
656 gtk_widget_destroy (dialog);
660 /* Callback for data_save action.
663 data_save (PsppireWindow *de)
665 const gchar *fn = psppire_window_get_filename (de);
668 psppire_window_save (de);
670 data_save_as_dialog (PSPPIRE_DATA_WINDOW (de));
674 /* Callback for data_new action.
675 Performs the NEW FILE command */
677 new_file (GtkAction *action, PsppireDataWindow *de)
679 struct getl_interface *sss =
680 create_syntax_string_source ("NEW FILE.");
682 execute_syntax (sss);
684 psppire_window_set_filename (PSPPIRE_WINDOW (de), NULL);
690 on_edit_paste (GtkAction *a, gpointer data)
692 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
694 psppire_data_editor_clip_paste (de->data_editor);
698 on_edit_copy (GtkMenuItem *m, gpointer data)
700 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
702 psppire_data_editor_clip_copy (de->data_editor);
708 on_edit_cut (GtkMenuItem *m, gpointer data)
710 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
712 psppire_data_editor_clip_cut (de->data_editor);
717 status_bar_activate (GtkToggleAction *action, gpointer data)
719 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
720 GtkWidget *statusbar = get_widget_assert (de->builder, "status-bar");
722 if ( gtk_toggle_action_get_active (action) )
723 gtk_widget_show (statusbar);
725 gtk_widget_hide (statusbar);
730 grid_lines_activate (GtkToggleAction *action, gpointer data)
732 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
733 const gboolean grid_visible = gtk_toggle_action_get_active (action);
735 psppire_data_editor_show_grid (de->data_editor, grid_visible);
739 data_view_activate (GtkCheckMenuItem *menuitem, gpointer data)
741 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
743 gtk_notebook_set_current_page (GTK_NOTEBOOK (de->data_editor), PSPPIRE_DATA_EDITOR_DATA_VIEW);
748 variable_view_activate (GtkCheckMenuItem *menuitem, gpointer data)
750 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
752 gtk_notebook_set_current_page (GTK_NOTEBOOK (de->data_editor), PSPPIRE_DATA_EDITOR_VARIABLE_VIEW);
757 fonts_activate (GtkMenuItem *menuitem, gpointer data)
759 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
760 GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (de));
761 PangoFontDescription *current_font;
764 gtk_font_selection_dialog_new (_("Font Selection"));
767 current_font = GTK_WIDGET(de->data_editor)->style->font_desc;
768 font_name = pango_font_description_to_string (current_font);
770 gtk_font_selection_dialog_set_font_name (GTK_FONT_SELECTION_DIALOG (dialog), font_name);
774 gtk_window_set_transient_for (GTK_WINDOW (dialog),
775 GTK_WINDOW (toplevel));
777 if ( GTK_RESPONSE_OK == gtk_dialog_run (GTK_DIALOG (dialog)) )
779 const gchar *font = gtk_font_selection_dialog_get_font_name
780 (GTK_FONT_SELECTION_DIALOG (dialog));
782 PangoFontDescription* font_desc =
783 pango_font_description_from_string (font);
785 psppire_data_editor_set_font (de->data_editor, font_desc);
788 gtk_widget_hide (dialog);
793 /* Callback for the value labels action */
795 toggle_value_labels (GtkToggleAction *ta, gpointer data)
797 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
799 g_object_set (de->data_editor, "value-labels", gtk_toggle_action_get_active (ta), NULL);
803 toggle_split_window (GtkToggleAction *ta, gpointer data)
805 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
807 psppire_data_editor_split_window (de->data_editor,
808 gtk_toggle_action_get_active (ta));
813 file_quit (GtkCheckMenuItem *menuitem, gpointer data)
815 /* FIXME: Need to be more intelligent here.
816 Give the user the opportunity to save any unsaved data.
818 g_object_unref (the_data_store);
826 create_data_sheet_variable_popup_menu (PsppireDataWindow *de)
828 GtkWidget *menu = gtk_menu_new ();
830 GtkWidget *sort_ascending =
831 gtk_action_create_menu_item (gtk_action_new ("sort-up",
834 "gtk-sort-ascending"));
836 GtkWidget *sort_descending =
837 gtk_action_create_menu_item (gtk_action_new ("sort-down",
838 _("Sort Descending"),
840 "gtk-sort-descending"));
842 GtkWidget *insert_variable =
843 gtk_menu_item_new_with_label (_("Insert Variable"));
845 GtkWidget *clear_variable =
846 gtk_menu_item_new_with_label (_("Clear"));
849 gtk_action_connect_proxy (de->delete_variables,
853 gtk_menu_shell_append (GTK_MENU_SHELL (menu), insert_variable);
856 gtk_menu_shell_append (GTK_MENU_SHELL (menu),
857 gtk_separator_menu_item_new ());
860 gtk_menu_shell_append (GTK_MENU_SHELL (menu), clear_variable);
863 gtk_menu_shell_append (GTK_MENU_SHELL (menu),
864 gtk_separator_menu_item_new ());
867 gtk_menu_shell_append (GTK_MENU_SHELL (menu), sort_ascending);
870 g_signal_connect_swapped (sort_ascending, "activate",
871 G_CALLBACK (psppire_data_editor_sort_ascending),
874 g_signal_connect_swapped (sort_descending, "activate",
875 G_CALLBACK (psppire_data_editor_sort_descending),
878 g_signal_connect_swapped (insert_variable, "activate",
879 G_CALLBACK (gtk_action_activate),
880 de->insert_variable);
883 gtk_menu_shell_append (GTK_MENU_SHELL (menu), sort_descending);
885 gtk_widget_show_all (menu);
892 create_data_sheet_cases_popup_menu (PsppireDataWindow *de)
894 GtkWidget *menu = gtk_menu_new ();
896 GtkWidget *insert_case =
897 gtk_menu_item_new_with_label (_("Insert Case"));
899 GtkWidget *delete_case =
900 gtk_menu_item_new_with_label (_("Clear"));
903 gtk_action_connect_proxy (de->delete_cases,
907 gtk_menu_shell_append (GTK_MENU_SHELL (menu), insert_case);
909 g_signal_connect_swapped (insert_case, "activate",
910 G_CALLBACK (gtk_action_activate),
914 gtk_menu_shell_append (GTK_MENU_SHELL (menu),
915 gtk_separator_menu_item_new ());
918 gtk_menu_shell_append (GTK_MENU_SHELL (menu), delete_case);
921 gtk_widget_show_all (menu);
928 create_var_sheet_variable_popup_menu (PsppireDataWindow *de)
930 GtkWidget *menu = gtk_menu_new ();
932 GtkWidget *insert_variable =
933 gtk_menu_item_new_with_label (_("Insert Variable"));
935 GtkWidget *delete_variable =
936 gtk_menu_item_new_with_label (_("Clear"));
939 gtk_action_connect_proxy (de->delete_variables,
943 gtk_menu_shell_append (GTK_MENU_SHELL (menu), insert_variable);
945 g_signal_connect_swapped (insert_variable, "activate",
946 G_CALLBACK (gtk_action_activate),
947 de->insert_variable);
950 gtk_menu_shell_append (GTK_MENU_SHELL (menu),
951 gtk_separator_menu_item_new ());
954 gtk_menu_shell_append (GTK_MENU_SHELL (menu), delete_variable);
957 gtk_widget_show_all (menu);
964 on_recent_data_select (GtkMenuShell *menushell,
965 PsppireWindow *window)
970 gtk_recent_chooser_get_current_uri (GTK_RECENT_CHOOSER (menushell));
972 file = g_filename_from_uri (uri, NULL, NULL);
976 psppire_window_load (window, file);
982 on_recent_files_select (GtkMenuShell *menushell, gpointer user_data)
989 gtk_recent_chooser_get_current_uri (GTK_RECENT_CHOOSER (menushell));
991 file = g_filename_from_uri (uri, NULL, NULL);
995 se = psppire_syntax_window_new ();
997 if ( psppire_window_load (PSPPIRE_WINDOW (se), file) )
998 gtk_widget_show (se);
1000 gtk_widget_destroy (se);
1007 enable_delete_cases (GtkWidget *w, gint case_num, gpointer data)
1009 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
1011 gtk_action_set_visible (de->delete_cases, case_num != -1);
1016 enable_delete_variables (GtkWidget *w, gint var, gpointer data)
1018 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
1020 gtk_action_set_visible (de->delete_variables, var != -1);
1023 /* Callback for when the datasheet/varsheet is selected */
1025 on_switch_sheet (GtkNotebook *notebook,
1026 GtkNotebookPage *page,
1030 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (user_data);
1032 GtkUIManager *uim = GTK_UI_MANAGER (get_object_assert (de->builder, "uimanager1", GTK_TYPE_UI_MANAGER));
1034 GtkWidget *view_data =
1035 gtk_ui_manager_get_widget (uim,"/ui/menubar/view/view_data");
1037 GtkWidget *view_variables =
1038 gtk_ui_manager_get_widget (uim,"/ui/menubar/view/view_variables");
1042 case PSPPIRE_DATA_EDITOR_VARIABLE_VIEW:
1043 gtk_widget_hide (view_variables);
1044 gtk_widget_show (view_data);
1045 gtk_action_set_sensitive (de->insert_variable, TRUE);
1046 gtk_action_set_sensitive (de->insert_case, FALSE);
1047 gtk_action_set_sensitive (de->invoke_goto_dialog, FALSE);
1049 case PSPPIRE_DATA_EDITOR_DATA_VIEW:
1050 gtk_widget_show (view_variables);
1051 gtk_widget_hide (view_data);
1052 gtk_action_set_sensitive (de->invoke_goto_dialog, TRUE);
1053 gtk_action_set_sensitive (de->insert_case, TRUE);
1056 g_assert_not_reached ();
1061 update_paste_menuitem (de, page_num);
1067 resolve_action (GtkBuilder *builder, const gchar *action, const gchar *proxy)
1069 GtkWidget *pr = NULL;
1070 GtkAction *act = get_action_assert (builder, action);
1071 g_assert (GTK_IS_ACTION (act));
1074 pr = get_widget_assert (builder, proxy);
1077 gtk_action_connect_proxy (act, pr);
1084 set_unsaved (gpointer w)
1086 psppire_window_set_unsaved (PSPPIRE_WINDOW (w));
1090 psppire_data_window_init (PsppireDataWindow *de)
1092 PsppireVarStore *vs;
1098 GtkWidget *box = gtk_vbox_new (FALSE, 0);
1099 de->builder = builder_new ("data-editor.ui");
1101 menubar = get_widget_assert (de->builder, "menubar");
1102 hb = get_widget_assert (de->builder, "handlebox1");
1103 sb = get_widget_assert (de->builder, "status-bar");
1106 PSPPIRE_DATA_EDITOR (psppire_data_editor_new (the_var_store, the_data_store));
1108 g_signal_connect_swapped (the_data_store, "case-changed",
1109 G_CALLBACK (set_unsaved), de);
1111 g_signal_connect_swapped (the_data_store, "case-inserted",
1112 G_CALLBACK (set_unsaved), de);
1114 g_signal_connect_swapped (the_data_store, "cases-deleted",
1115 G_CALLBACK (set_unsaved), de);
1117 dataset_set_callback (the_dataset, set_unsaved, de);
1119 connect_help (de->builder);
1121 gtk_box_pack_start (GTK_BOX (box), menubar, FALSE, TRUE, 0);
1122 gtk_box_pack_start (GTK_BOX (box), hb, FALSE, TRUE, 0);
1123 gtk_box_pack_start (GTK_BOX (box), GTK_WIDGET (de->data_editor), TRUE, TRUE, 0);
1124 gtk_box_pack_start (GTK_BOX (box), sb, FALSE, TRUE, 0);
1126 gtk_container_add (GTK_CONTAINER (de), box);
1128 set_cut_copy_menuitem_sensitivity (de, FALSE);
1130 g_signal_connect_swapped (de->data_editor, "data-selection-changed",
1131 G_CALLBACK (set_cut_copy_menuitem_sensitivity), de);
1134 set_paste_menuitem_sensitivity (de, FALSE);
1136 g_signal_connect_swapped (de->data_editor, "data-available-changed",
1137 G_CALLBACK (set_paste_menuitem_sensitivity), de);
1139 dataset_add_transform_change_callback (the_dataset,
1140 transformation_change_callback,
1146 g_assert(vs); /* Traps a possible bug in w32 build */
1148 g_signal_connect (vs->dict, "weight-changed",
1149 G_CALLBACK (on_weight_change),
1152 g_signal_connect (vs->dict, "filter-changed",
1153 G_CALLBACK (on_filter_change),
1156 g_signal_connect (vs->dict, "split-changed",
1157 G_CALLBACK (on_split_change),
1161 g_signal_connect (get_action_assert (de->builder, "edit_copy"),
1163 G_CALLBACK (on_edit_copy), de);
1165 g_signal_connect (get_action_assert (de->builder, "edit_cut"),
1167 G_CALLBACK (on_edit_cut), de);
1172 GtkWidget *toolbarbutton = get_widget_assert (de->builder, "button-open");
1174 GtkAction *action_data_open =
1175 resolve_action (de->builder, "file_open_data", NULL);
1177 g_object_set (action_data_open,
1178 "tooltip", _("Open a data file"),
1179 "stock-id", "gtk-open",
1182 g_signal_connect (action_data_open, "activate",
1183 G_CALLBACK (open_data_dialog), de);
1185 g_signal_connect_swapped (toolbarbutton, "clicked",
1186 G_CALLBACK (gtk_action_activate), action_data_open);
1192 GtkAction *action_data_new =
1193 resolve_action (de->builder, "file_new_data", NULL);
1195 g_object_set (action_data_new,
1196 "tooltip", _("New data file"),
1197 "stock-id", "gtk-new",
1200 g_signal_connect (action_data_new, "activate",
1201 G_CALLBACK (new_file), de);
1207 GtkAction *invoke_text_import_assistant =
1208 resolve_action (de->builder, "file_import-text", NULL);
1210 g_object_set (invoke_text_import_assistant,
1211 "tooltip", _("Import text data file"),
1212 "stock-id", "gtk-convert",
1215 g_signal_connect (invoke_text_import_assistant, "activate",
1216 G_CALLBACK (text_data_import_assistant), de);
1222 GtkAction *action_data_save =
1223 resolve_action (de->builder, "file_save", "button-save");
1226 g_object_set (action_data_save,
1227 "tooltip", _("Save data to file"),
1228 "stock-id", "gtk-save",
1231 g_signal_connect_swapped (action_data_save, "activate",
1232 G_CALLBACK (data_save), de);
1239 GtkAction *action_data_save_as =
1240 resolve_action (de->builder, "file_save_as", NULL);
1242 g_object_set (action_data_save_as,
1243 "label", _("Save As"),
1244 "tooltip", _("Save data to file"),
1245 "stock-id", "gtk-save-as",
1248 g_signal_connect_swapped (action_data_save_as, "activate",
1249 G_CALLBACK (data_save_as_dialog), de);
1254 GtkAction *action_info_working_file =
1255 resolve_action (de->builder,
1256 "file_information_working-file", NULL);
1259 g_signal_connect_swapped (action_info_working_file, "activate",
1260 G_CALLBACK (display_dict), de);
1265 GtkAction *action_info_external_file =
1266 resolve_action (de->builder,
1267 "file_information_external-file", NULL);
1270 g_signal_connect_swapped (action_info_external_file, "activate",
1271 G_CALLBACK (sysfile_info), de);
1277 GtkAction *value_labels_action =
1278 resolve_action (de->builder,
1279 "view_value-labels", "togglebutton-value-labels");
1281 g_object_set (value_labels_action,
1282 "tooltip", _("Show/hide value labels"),
1283 "stock-id", "pspp-value-labels",
1286 g_signal_connect (value_labels_action, "toggled",
1287 G_CALLBACK (toggle_value_labels), de);
1291 g_signal_connect (get_action_assert (de->builder, "edit_paste"), "activate",
1292 G_CALLBACK (on_edit_paste),
1297 resolve_action (de->builder, "edit_clear-cases", NULL);
1300 g_object_set (de->delete_cases,
1301 "label", _("Clear"),
1302 "tooltip", _("Delete the cases at the selected position(s)"),
1303 "stock-id", "gtk-clear",
1306 g_signal_connect_swapped (de->delete_cases, "activate",
1307 G_CALLBACK (psppire_data_editor_delete_cases),
1310 gtk_action_set_visible (de->delete_cases, FALSE);
1315 de->delete_variables =
1316 resolve_action (de->builder, "edit_clear-variables", NULL);
1318 g_object_set (de->delete_variables,
1319 "label", _("Clear"),
1320 "tooltip", _("Delete the variables at the selected position(s)"),
1321 "stock-id", "gtk-clear",
1325 g_signal_connect_swapped (de->delete_variables, "activate",
1326 G_CALLBACK (psppire_data_editor_delete_variables),
1329 gtk_action_set_visible (de->delete_variables, FALSE);
1333 de->insert_variable =
1334 resolve_action (de->builder, "edit_insert-variable",
1335 "button-insert-variable");
1337 g_object_set (de->insert_variable,
1338 "tooltip", _("Create a new variable at the current position"),
1339 "stock-id", "pspp-insert-variable",
1342 g_signal_connect (de->insert_variable, "activate",
1343 G_CALLBACK (on_insert_variable), de->data_editor);
1350 resolve_action (de->builder, "edit_insert-case", "button-insert-case");
1352 g_object_set (de->insert_case,
1353 "tooltip", _("Create a new case at the current position"),
1354 "stock-id", "pspp-insert-case",
1357 g_signal_connect (de->insert_case, "activate",
1358 G_CALLBACK (insert_case), de);
1364 de->invoke_goto_dialog =
1365 resolve_action (de->builder, "edit_goto-case", "button-goto-case");
1368 g_object_set (de->invoke_goto_dialog,
1369 "tooltip", _("Jump to a Case in the Data Sheet"),
1370 "stock-id", "gtk-jump-to",
1373 g_signal_connect (de->invoke_goto_dialog, "activate",
1374 G_CALLBACK (goto_case_dialog), de);
1379 GtkAction *invoke_weight_cases_dialog =
1380 resolve_action (de->builder, "data_weight-cases", "button-weight-cases");
1383 g_object_set (invoke_weight_cases_dialog,
1384 "stock-id", "pspp-weight-cases",
1385 "tooltip", _("Weight cases by variable"),
1388 g_signal_connect (invoke_weight_cases_dialog, "activate",
1389 G_CALLBACK (weight_cases_dialog), de);
1394 GtkAction *invoke_transpose_dialog =
1395 resolve_action (de->builder, "data_transpose", NULL);
1398 g_object_set (invoke_transpose_dialog,
1399 "tooltip", _("Transpose the cases with the variables"),
1400 "stock-id", "pspp-transpose",
1403 g_signal_connect (invoke_transpose_dialog, "activate",
1404 G_CALLBACK (transpose_dialog), de);
1409 GtkAction *invoke_split_file_dialog =
1410 resolve_action (de->builder, "data_split-file", "button-split-file");
1412 g_object_set (invoke_split_file_dialog,
1413 "tooltip", _("Split the active file"),
1414 "stock-id", "pspp-split-file",
1417 g_signal_connect (invoke_split_file_dialog, "activate",
1418 G_CALLBACK (split_file_dialog), de);
1423 GtkAction *invoke_sort_cases_dialog =
1424 resolve_action (de->builder, "data_sort-cases", NULL);
1427 g_object_set (invoke_sort_cases_dialog,
1428 "tooltip", _("Sort cases in the active file"),
1429 "stock-id", "gtk-sort-ascending",
1432 g_signal_connect (invoke_sort_cases_dialog, "activate",
1433 G_CALLBACK (sort_cases_dialog), de);
1438 GtkAction *invoke_select_cases_dialog =
1439 resolve_action (de->builder, "data_select-cases", "button-select-cases");
1441 g_object_set (invoke_select_cases_dialog,
1442 "tooltip", _("Select cases from the active file"),
1443 "stock-id", "pspp-select-cases",
1446 g_signal_connect (invoke_select_cases_dialog, "activate",
1447 G_CALLBACK (select_cases_dialog), de);
1452 GtkAction *invoke_compute_dialog =
1453 resolve_action (de->builder, "transform_compute", NULL);
1455 g_object_set (invoke_compute_dialog,
1456 "tooltip", _("Compute new values for a variable"),
1457 "stock-id", "pspp-compute",
1460 g_signal_connect (invoke_compute_dialog, "activate",
1461 G_CALLBACK (compute_dialog), de);
1466 GtkAction *invoke_oneway_anova_dialog =
1467 resolve_action (de->builder, "oneway-anova", NULL);
1469 g_object_set (invoke_oneway_anova_dialog,
1470 "tooltip", _("Perform one way analysis of variance"),
1473 g_signal_connect (invoke_oneway_anova_dialog, "activate",
1474 G_CALLBACK (oneway_anova_dialog), de);
1479 GtkAction *invoke_t_test_independent_samples_dialog =
1480 resolve_action (de->builder, "indep-t-test", NULL);
1483 g_object_set (invoke_t_test_independent_samples_dialog,
1485 _("Calculate T Test for samples from independent groups"),
1488 g_signal_connect (invoke_t_test_independent_samples_dialog, "activate",
1489 G_CALLBACK (t_test_independent_samples_dialog), de);
1494 GtkAction *invoke_t_test_paired_samples_dialog =
1495 resolve_action (de->builder, "paired-t-test", NULL);
1497 g_object_set (invoke_t_test_paired_samples_dialog,
1499 _("Calculate T Test for paired samples"),
1502 g_signal_connect (invoke_t_test_paired_samples_dialog, "activate",
1503 G_CALLBACK (t_test_paired_samples_dialog), de);
1508 GtkAction *invoke_t_test_one_sample_dialog =
1509 resolve_action (de->builder, "one-sample-t-test", NULL);
1511 g_object_set (invoke_t_test_one_sample_dialog,
1513 _("Calculate T Test for sample from a single distribution"),
1516 g_signal_connect (invoke_t_test_one_sample_dialog, "activate",
1517 G_CALLBACK (t_test_one_sample_dialog), de);
1522 GtkAction *invoke_comments_dialog =
1523 resolve_action (de->builder, "utilities_comments", NULL);
1526 g_object_set (invoke_comments_dialog,
1528 _("Commentary text for the data file"),
1531 g_signal_connect (invoke_comments_dialog, "activate",
1532 G_CALLBACK (comments_dialog), de);
1538 GtkAction *invoke_find_dialog =
1539 resolve_action (de->builder, "edit_find", "button-find");
1541 g_object_set (invoke_find_dialog, "stock-id", "gtk-find", NULL);
1543 g_signal_connect (invoke_find_dialog, "activate",
1544 G_CALLBACK (find_dialog), de);
1549 GtkAction *invoke_rank_dialog =
1550 resolve_action (de->builder, "transform_rank", NULL);
1552 g_object_set (invoke_rank_dialog,
1553 "stock-id", "pspp-rank-cases",
1554 "tooltip", _("Rank Cases"),
1557 g_signal_connect (invoke_rank_dialog, "activate",
1558 G_CALLBACK (rank_dialog), de);
1563 GtkAction *invoke_recode_same_dialog =
1564 resolve_action (de->builder, "transform_recode-same", NULL);
1566 g_object_set (invoke_recode_same_dialog,
1567 "stock-id", "pspp-recode-same",
1568 "tooltip", _("Recode values into the same variables"),
1571 g_signal_connect (invoke_recode_same_dialog, "activate",
1572 G_CALLBACK (recode_same_dialog), de);
1577 GtkAction *invoke_recode_different_dialog =
1578 resolve_action (de->builder, "transform_recode-different", NULL);
1580 g_object_set (invoke_recode_different_dialog,
1581 "stock-id", "pspp-recode-different",
1582 "tooltip", _("Recode values into different variables"),
1585 g_signal_connect (invoke_recode_different_dialog, "activate",
1586 G_CALLBACK (recode_different_dialog), de);
1591 GtkAction *invoke_variable_info_dialog =
1592 resolve_action (de->builder, "utilities_variables", "button-goto-variable");
1594 g_object_set (invoke_variable_info_dialog,
1595 "stock-id", "pspp-goto-variable",
1596 "tooltip", _("Jump to variable"),
1599 g_signal_connect (invoke_variable_info_dialog, "activate",
1600 G_CALLBACK (variable_info_dialog), de);
1605 GtkAction *invoke_descriptives_dialog =
1606 resolve_action (de->builder, "analyze_descriptives", NULL);
1608 g_object_set (invoke_descriptives_dialog,
1609 "tooltip", _("Calculate descriptive statistics (mean, variance, ...)"),
1610 "stock-id", "pspp-descriptives",
1613 g_signal_connect (invoke_descriptives_dialog, "activate",
1614 G_CALLBACK (descriptives_dialog), de);
1619 GtkAction *invoke_frequencies_dialog =
1620 resolve_action (de->builder, "analyze_frequencies", NULL);
1622 g_object_set (invoke_frequencies_dialog,
1623 "tooltip", _("Generate frequency statistics"),
1624 "stock-id", "pspp-frequencies",
1627 g_signal_connect (invoke_frequencies_dialog, "activate",
1628 G_CALLBACK (frequencies_dialog), de);
1633 GtkAction *invoke_crosstabs_dialog =
1634 resolve_action (de->builder, "crosstabs", NULL);
1636 g_object_set (invoke_crosstabs_dialog,
1637 "tooltip", _("Generate crosstabulations"),
1638 "stock-id", "pspp-crosstabs",
1641 g_signal_connect (invoke_crosstabs_dialog, "activate",
1642 G_CALLBACK (crosstabs_dialog), de);
1648 GtkAction *invoke_examine_dialog =
1649 resolve_action (de->builder, "analyze_explore", NULL);
1651 g_object_set (invoke_examine_dialog,
1652 "tooltip", _("Examine Data by Factors"),
1653 "stock-id", "pspp-examine",
1656 g_signal_connect (invoke_examine_dialog, "activate",
1657 G_CALLBACK (examine_dialog), de);
1662 GtkAction *invoke_regression_dialog =
1663 resolve_action (de->builder, "linear-regression", NULL);
1665 g_object_set (invoke_regression_dialog,
1666 "tooltip", _("Estimate parameters of the linear model"),
1667 "stock-id", "pspp-regression",
1671 g_signal_connect (invoke_regression_dialog, "activate",
1672 G_CALLBACK (regression_dialog), de);
1676 GtkAction *invoke_reliability_dialog =
1677 resolve_action (de->builder, "reliability", NULL);
1679 g_object_set (invoke_reliability_dialog,
1680 "tooltip", _("Reliability Analysis"),
1681 "stock-id", "pspp-reliability",
1685 g_signal_connect (invoke_reliability_dialog, "activate",
1686 G_CALLBACK (reliability_dialog), de);
1691 GtkUIManager *uim = GTK_UI_MANAGER (get_object_assert (de->builder, "uimanager1", GTK_TYPE_UI_MANAGER));
1693 GtkWidget *recent_data =
1694 gtk_ui_manager_get_widget (uim,"/ui/menubar/file/file_recent-data");
1696 GtkWidget *recent_files =
1697 gtk_ui_manager_get_widget (uim,"/ui/menubar/file/file_recent-files");
1700 GtkWidget *menu_data =
1701 gtk_recent_chooser_menu_new_for_manager (the_recent_mgr);
1703 GtkWidget *menu_files =
1704 gtk_recent_chooser_menu_new_for_manager (the_recent_mgr);
1707 GtkRecentFilter *filter = gtk_recent_filter_new ();
1709 gtk_recent_filter_add_pattern (filter, "*.sav");
1710 gtk_recent_filter_add_pattern (filter, "*.SAV");
1711 gtk_recent_filter_add_pattern (filter, "*.por");
1712 gtk_recent_filter_add_pattern (filter, "*.POR");
1714 gtk_recent_chooser_set_sort_type (GTK_RECENT_CHOOSER (menu_data), GTK_RECENT_SORT_MRU);
1716 gtk_recent_chooser_add_filter (GTK_RECENT_CHOOSER (menu_data), filter);
1719 gtk_menu_item_set_submenu (GTK_MENU_ITEM (recent_data), menu_data);
1722 g_signal_connect (menu_data, "selection-done",
1723 G_CALLBACK (on_recent_data_select),
1727 GtkRecentFilter *filter = gtk_recent_filter_new ();
1729 gtk_recent_filter_add_pattern (filter, "*.sps");
1730 gtk_recent_filter_add_pattern (filter, "*.SPS");
1732 gtk_recent_chooser_set_sort_type (GTK_RECENT_CHOOSER (menu_files), GTK_RECENT_SORT_MRU);
1734 gtk_recent_chooser_add_filter (GTK_RECENT_CHOOSER (menu_files), filter);
1737 gtk_menu_item_set_submenu (GTK_MENU_ITEM (recent_files), menu_files);
1739 g_signal_connect (menu_files, "selection-done",
1740 G_CALLBACK (on_recent_files_select),
1745 g_signal_connect (get_action_assert (de->builder,"file_new_syntax"),
1747 G_CALLBACK (create_syntax_window),
1750 g_signal_connect (get_action_assert (de->builder,"file_open_syntax"),
1752 G_CALLBACK (open_syntax_window),
1756 GtkAction *abt = get_action_assert (de->builder, "help_about");
1757 g_object_set (abt, "stock-id", "gtk-about", NULL);
1758 g_signal_connect (abt,
1760 G_CALLBACK (about_new),
1765 g_signal_connect (get_action_assert (de->builder,"help_reference"),
1767 G_CALLBACK (reference_manual),
1771 g_signal_connect (de->data_editor,
1773 G_CALLBACK (enable_delete_cases),
1776 g_signal_connect (de->data_editor,
1777 "variables-selected",
1778 G_CALLBACK (enable_delete_variables),
1782 g_signal_connect (de->data_editor,
1784 G_CALLBACK (on_switch_sheet), de);
1786 gtk_notebook_set_current_page (GTK_NOTEBOOK (de->data_editor), PSPPIRE_DATA_EDITOR_VARIABLE_VIEW);
1787 gtk_notebook_set_current_page (GTK_NOTEBOOK (de->data_editor), PSPPIRE_DATA_EDITOR_DATA_VIEW);
1789 g_signal_connect (get_action_assert (de->builder, "view_statusbar"),
1791 G_CALLBACK (status_bar_activate), de);
1794 g_signal_connect (get_action_assert (de->builder, "view_gridlines"),
1796 G_CALLBACK (grid_lines_activate), de);
1800 g_signal_connect (get_action_assert (de->builder, "view_data"),
1802 G_CALLBACK (data_view_activate), de);
1804 g_signal_connect (get_action_assert (de->builder, "view_variables"),
1806 G_CALLBACK (variable_view_activate), de);
1810 GtkAction *font_action =
1811 resolve_action (de->builder, "view_fonts", NULL);
1813 g_object_set (font_action,
1814 "stock-id", "gtk-select-font",
1817 g_signal_connect (font_action,
1819 G_CALLBACK (fonts_activate), de);
1824 g_signal_connect (get_action_assert (de->builder, "file_quit"),
1826 G_CALLBACK (file_quit), de);
1828 g_signal_connect (get_action_assert (de->builder, "transform_run-pending"),
1830 G_CALLBACK (execute), de);
1833 g_signal_connect (get_action_assert (de->builder, "windows_minimise_all"),
1835 G_CALLBACK (psppire_window_minimise_all), NULL);
1839 GtkAction *split_window_action =
1840 resolve_action (de->builder, "windows_split", NULL);
1842 g_object_set (split_window_action,
1843 "tooltip", _("Split the window vertically and horizontally"),
1844 "stock-id", "pspp-split-window",
1847 g_signal_connect (split_window_action, "toggled",
1848 G_CALLBACK (toggle_split_window),
1853 GtkUIManager *uim = GTK_UI_MANAGER (get_object_assert (de->builder, "uimanager1", GTK_TYPE_UI_MANAGER));
1855 PSPPIRE_WINDOW (de)->menu =
1856 GTK_MENU_SHELL (gtk_ui_manager_get_widget (uim,"/ui/menubar/windows/windows_minimise_all")->parent);
1860 GtkMenu *data_sheet_variable_popup_menu =
1861 GTK_MENU (create_data_sheet_variable_popup_menu (de));
1863 GtkMenu *var_sheet_variable_popup_menu =
1864 GTK_MENU (create_var_sheet_variable_popup_menu (de));
1866 GtkMenu *data_sheet_cases_popup_menu =
1867 GTK_MENU (create_data_sheet_cases_popup_menu (de));
1869 g_object_set (de->data_editor,
1870 "datasheet-column-menu", data_sheet_variable_popup_menu,
1871 "datasheet-row-menu", data_sheet_cases_popup_menu,
1872 "varsheet-row-menu", var_sheet_variable_popup_menu,
1876 gtk_widget_show (GTK_WIDGET (de->data_editor));
1877 gtk_widget_show (box);
1882 psppire_data_window_new (void)
1884 return GTK_WIDGET (g_object_new (psppire_data_window_get_type (),
1885 "description", _("Data Editor"),
1895 psppire_data_window_iface_init (PsppireWindowIface *iface)
1897 iface->save = save_file;
1898 iface->load = load_file;