1 /* PSPPIRE - a graphical user interface for PSPP.
2 Copyright (C) 2008, 2009, 2010 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>
23 #include "data/any-reader.h"
24 #include "data/procedure.h"
25 #include "language/syntax-string-source.h"
26 #include "libpspp/message.h"
27 #include "ui/gui/about.h"
28 #include "ui/gui/comments-dialog.h"
29 #include "ui/gui/compute-dialog.h"
30 #include "ui/gui/correlation-dialog.h"
31 #include "ui/gui/crosstabs-dialog.h"
32 #include "ui/gui/descriptives-dialog.h"
33 #include "ui/gui/examine-dialog.h"
34 #include "ui/gui/executor.h"
35 #include "ui/gui/factor-dialog.h"
36 #include "ui/gui/find-dialog.h"
37 #include "ui/gui/frequencies-dialog.h"
38 #include "ui/gui/goto-case-dialog.h"
39 #include "ui/gui/helper.h"
40 #include "ui/gui/oneway-anova-dialog.h"
41 #include "ui/gui/psppire-data-window.h"
42 #include "ui/gui/psppire-syntax-window.h"
43 #include "ui/gui/psppire-window.h"
44 #include "ui/gui/psppire.h"
45 #include "ui/gui/rank-dialog.h"
46 #include "ui/gui/recode-dialog.h"
47 #include "ui/gui/regression-dialog.h"
48 #include "ui/gui/reliability-dialog.h"
49 #include "ui/gui/roc-dialog.h"
50 #include "ui/gui/select-cases-dialog.h"
51 #include "ui/gui/sort-cases-dialog.h"
52 #include "ui/gui/split-file-dialog.h"
53 #include "ui/gui/t-test-independent-samples-dialog.h"
54 #include "ui/gui/t-test-one-sample.h"
55 #include "ui/gui/t-test-paired-samples.h"
56 #include "ui/gui/text-data-import-dialog.h"
57 #include "ui/gui/transpose-dialog.h"
58 #include "ui/gui/variable-info-dialog.h"
59 #include "ui/gui/weight-cases-dialog.h"
60 #include "ui/syntax-gen.h"
63 #define _(msgid) gettext (msgid)
64 #define N_(msgid) msgid
68 static void psppire_data_window_base_finalize (PsppireDataWindowClass *, gpointer);
69 static void psppire_data_window_base_init (PsppireDataWindowClass *class);
70 static void psppire_data_window_class_init (PsppireDataWindowClass *class);
71 static void psppire_data_window_init (PsppireDataWindow *data_editor);
74 static void psppire_data_window_iface_init (PsppireWindowIface *iface);
78 psppire_data_window_get_type (void)
80 static GType psppire_data_window_type = 0;
82 if (!psppire_data_window_type)
84 static const GTypeInfo psppire_data_window_info =
86 sizeof (PsppireDataWindowClass),
87 (GBaseInitFunc) psppire_data_window_base_init,
88 (GBaseFinalizeFunc) psppire_data_window_base_finalize,
89 (GClassInitFunc)psppire_data_window_class_init,
90 (GClassFinalizeFunc) NULL,
92 sizeof (PsppireDataWindow),
94 (GInstanceInitFunc) psppire_data_window_init,
97 static const GInterfaceInfo window_interface_info =
99 (GInterfaceInitFunc) psppire_data_window_iface_init,
104 psppire_data_window_type =
105 g_type_register_static (PSPPIRE_TYPE_WINDOW, "PsppireDataWindow",
106 &psppire_data_window_info, 0);
109 g_type_add_interface_static (psppire_data_window_type,
110 PSPPIRE_TYPE_WINDOW_MODEL,
111 &window_interface_info);
114 return psppire_data_window_type;
117 static GObjectClass *parent_class ;
120 psppire_data_window_finalize (GObject *object)
122 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (object);
124 g_object_unref (de->builder);
126 if (G_OBJECT_CLASS (parent_class)->finalize)
127 (*G_OBJECT_CLASS (parent_class)->finalize) (object);
132 psppire_data_window_class_init (PsppireDataWindowClass *class)
134 parent_class = g_type_class_peek_parent (class);
139 psppire_data_window_base_init (PsppireDataWindowClass *class)
141 GObjectClass *object_class = G_OBJECT_CLASS (class);
143 object_class->finalize = psppire_data_window_finalize;
149 psppire_data_window_base_finalize (PsppireDataWindowClass *class,
158 extern PsppireVarStore *the_var_store;
159 extern struct dataset *the_dataset;
160 extern PsppireDataStore *the_data_store ;
162 extern GtkRecentManager *the_recent_mgr;
165 set_paste_menuitem_sensitivity (PsppireDataWindow *de, gboolean x)
167 GtkAction *edit_paste = get_action_assert (de->builder, "edit_paste");
169 gtk_action_set_sensitive (edit_paste, x);
173 set_cut_copy_menuitem_sensitivity (PsppireDataWindow *de, gboolean x)
175 GtkAction *edit_copy = get_action_assert (de->builder, "edit_copy");
176 GtkAction *edit_cut = get_action_assert (de->builder, "edit_cut");
178 gtk_action_set_sensitive (edit_copy, x);
179 gtk_action_set_sensitive (edit_cut, x);
182 /* Run the EXECUTE command. */
184 execute (GtkMenuItem *mi, gpointer data)
186 struct getl_interface *sss = create_syntax_string_source ("EXECUTE.");
188 execute_syntax (sss);
192 transformation_change_callback (bool transformations_pending,
195 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
197 GtkUIManager *uim = GTK_UI_MANAGER (get_object_assert (de->builder, "uimanager1", GTK_TYPE_UI_MANAGER));
199 GtkWidget *menuitem =
200 gtk_ui_manager_get_widget (uim,"/ui/menubar/transform/transform_run-pending");
202 GtkWidget *status_label =
203 get_widget_assert (de->builder, "case-counter-area");
205 gtk_widget_set_sensitive (menuitem, transformations_pending);
208 if ( transformations_pending)
209 gtk_label_set_text (GTK_LABEL (status_label),
210 _("Transformations Pending"));
212 gtk_label_set_text (GTK_LABEL (status_label), "");
215 /* Callback for when the dictionary changes its filter variable */
217 on_filter_change (GObject *o, gint filter_index, gpointer data)
219 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
221 GtkWidget *filter_status_area =
222 get_widget_assert (de->builder, "filter-use-status-area");
224 if ( filter_index == -1 )
226 gtk_label_set_text (GTK_LABEL (filter_status_area), _("Filter off"));
230 PsppireVarStore *vs = NULL;
231 PsppireDict *dict = NULL;
232 struct variable *var ;
235 g_object_get (de->data_editor, "var-store", &vs, NULL);
236 g_object_get (vs, "dictionary", &dict, NULL);
238 var = psppire_dict_get_variable (dict, filter_index);
240 text = g_strdup_printf (_("Filter by %s"), var_get_name (var));
242 gtk_label_set_text (GTK_LABEL (filter_status_area), text);
248 /* Callback for when the dictionary changes its split variables */
250 on_split_change (PsppireDict *dict, gpointer data)
252 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
254 size_t n_split_vars = dict_get_split_cnt (dict->dict);
256 GtkWidget *split_status_area =
257 get_widget_assert (de->builder, "split-file-status-area");
259 if ( n_split_vars == 0 )
261 gtk_label_set_text (GTK_LABEL (split_status_area), _("No Split"));
267 const struct variable *const * split_vars =
268 dict_get_split_vars (dict->dict);
270 text = g_string_new (_("Split by "));
272 for (i = 0 ; i < n_split_vars - 1; ++i )
274 g_string_append_printf (text, "%s, ", var_get_name (split_vars[i]));
276 g_string_append (text, var_get_name (split_vars[i]));
278 gtk_label_set_text (GTK_LABEL (split_status_area), text->str);
280 g_string_free (text, TRUE);
287 /* Callback for when the dictionary changes its weights */
289 on_weight_change (GObject *o, gint weight_index, gpointer data)
291 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
293 GtkWidget *weight_status_area =
294 get_widget_assert (de->builder, "weight-status-area");
296 if ( weight_index == -1 )
298 gtk_label_set_text (GTK_LABEL (weight_status_area), _("Weights off"));
302 struct variable *var ;
303 PsppireVarStore *vs = NULL;
304 PsppireDict *dict = NULL;
307 g_object_get (de->data_editor, "var-store", &vs, NULL);
308 g_object_get (vs, "dictionary", &dict, NULL);
310 var = psppire_dict_get_variable (dict, weight_index);
312 text = g_strdup_printf (_("Weight by %s"), var_get_name (var));
314 gtk_label_set_text (GTK_LABEL (weight_status_area), text);
322 dump_rm (GtkRecentManager *rm)
324 GList *items = gtk_recent_manager_get_items (rm);
328 g_print ("Recent Items:\n");
329 for (i = items; i; i = i->next)
331 GtkRecentInfo *ri = i->data;
333 g_print ("Item: %s (Mime: %s) (Desc: %s) (URI: %s)\n",
334 gtk_recent_info_get_short_name (ri),
335 gtk_recent_info_get_mime_type (ri),
336 gtk_recent_info_get_description (ri),
337 gtk_recent_info_get_uri (ri)
341 gtk_recent_info_unref (ri);
350 load_file (PsppireWindow *de, const gchar *file_name)
352 gchar *native_file_name;
353 struct getl_interface *sss;
354 struct string filename;
356 ds_init_empty (&filename);
359 convert_glib_filename_to_system_filename (file_name, NULL);
361 syntax_gen_string (&filename, ss_cstr (native_file_name));
363 g_free (native_file_name);
365 sss = create_syntax_string_source ("GET FILE=%s.",
366 ds_cstr (&filename));
368 ds_destroy (&filename);
370 if (execute_syntax (sss) )
377 sysfile_chooser_dialog (PsppireWindow *toplevel)
380 gtk_file_chooser_dialog_new (_("Open"),
381 GTK_WINDOW (toplevel),
382 GTK_FILE_CHOOSER_ACTION_OPEN,
383 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
384 GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
387 GtkFileFilter *filter;
389 filter = gtk_file_filter_new ();
390 gtk_file_filter_set_name (filter, _("Data and Syntax Files"));
391 gtk_file_filter_add_pattern (filter, "*.sav");
392 gtk_file_filter_add_pattern (filter, "*.SAV");
393 gtk_file_filter_add_pattern (filter, "*.por");
394 gtk_file_filter_add_pattern (filter, "*.POR");
395 gtk_file_filter_add_pattern (filter, "*.sps");
396 gtk_file_filter_add_pattern (filter, "*.SPS");
397 gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
399 filter = gtk_file_filter_new ();
400 gtk_file_filter_set_name (filter, _("System Files (*.sav)"));
401 gtk_file_filter_add_pattern (filter, "*.sav");
402 gtk_file_filter_add_pattern (filter, "*.SAV");
403 gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
405 filter = gtk_file_filter_new ();
406 gtk_file_filter_set_name (filter, _("Portable Files (*.por) "));
407 gtk_file_filter_add_pattern (filter, "*.por");
408 gtk_file_filter_add_pattern (filter, "*.POR");
409 gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
411 filter = gtk_file_filter_new ();
412 gtk_file_filter_set_name (filter, _("Syntax Files (*.sps) "));
413 gtk_file_filter_add_pattern (filter, "*.sps");
414 gtk_file_filter_add_pattern (filter, "*.SPS");
415 gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
417 filter = gtk_file_filter_new ();
418 gtk_file_filter_set_name (filter, _("All Files"));
419 gtk_file_filter_add_pattern (filter, "*");
420 gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
424 gchar *filename = NULL;
425 g_object_get (toplevel, "filename", &filename, NULL);
427 if ( ! g_path_is_absolute (filename))
430 g_build_filename (g_get_current_dir (), filename, NULL);
431 dir_name = g_path_get_dirname (path);
436 dir_name = g_path_get_dirname (filename);
438 gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog),
446 /* Callback for the data_open action.
447 Prompts for a filename and opens it */
449 open_window (GtkAction *action, PsppireWindow *de)
451 GtkWidget *dialog = sysfile_chooser_dialog (de);
453 switch (gtk_dialog_run (GTK_DIALOG (dialog)))
455 case GTK_RESPONSE_ACCEPT:
458 gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
460 if (any_reader_may_open (name))
461 psppire_window_load (de, name);
463 open_syntax_window (name);
472 gtk_widget_destroy (dialog);
475 /* Returns true if NAME has a suffix which might denote a PSPP file */
477 name_has_suffix (const gchar *name)
479 if ( g_str_has_suffix (name, ".sav"))
481 if ( g_str_has_suffix (name, ".SAV"))
483 if ( g_str_has_suffix (name, ".por"))
485 if ( g_str_has_suffix (name, ".POR"))
492 /* Save DE to file */
494 save_file (PsppireWindow *w)
496 gchar *native_file_name = NULL;
497 gchar *file_name = NULL;
499 struct getl_interface *sss;
500 struct string filename ;
501 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (w);
503 g_object_get (w, "filename", &file_name, NULL);
505 fnx = g_string_new (file_name);
507 if ( ! name_has_suffix (fnx->str))
509 if ( de->save_as_portable)
510 g_string_append (fnx, ".por");
512 g_string_append (fnx, ".sav");
515 ds_init_empty (&filename);
518 convert_glib_filename_to_system_filename (fnx->str, NULL);
520 g_string_free (fnx, TRUE);
522 syntax_gen_string (&filename, ss_cstr (native_file_name));
523 g_free (native_file_name);
525 if ( de->save_as_portable )
527 sss = create_syntax_string_source ("EXPORT OUTFILE=%s.",
528 ds_cstr (&filename));
532 sss = create_syntax_string_source ("SAVE OUTFILE=%s.",
533 ds_cstr (&filename));
536 ds_destroy (&filename);
538 execute_syntax (sss);
543 insert_case (GtkAction *action, gpointer data)
545 PsppireDataWindow *dw = PSPPIRE_DATA_WINDOW (data);
546 psppire_data_editor_insert_case (dw->data_editor);
550 on_insert_variable (GtkAction *action, gpointer data)
552 PsppireDataWindow *dw = PSPPIRE_DATA_WINDOW (data);
553 psppire_data_editor_insert_variable (dw->data_editor);
558 display_dict (PsppireDataWindow *de)
561 struct getl_interface *sss =
562 create_syntax_string_source ("DISPLAY DICTIONARY.");
564 execute_syntax (sss);
568 sysfile_info (PsppireDataWindow *de)
570 GtkWidget *dialog = sysfile_chooser_dialog (PSPPIRE_WINDOW (de));
572 if ( GTK_RESPONSE_ACCEPT == gtk_dialog_run (GTK_DIALOG (dialog)))
574 struct string filename;
575 struct getl_interface *sss;
577 gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
579 gchar *native_file_name =
580 convert_glib_filename_to_system_filename (file_name, NULL);
582 ds_init_empty (&filename);
584 syntax_gen_string (&filename, ss_cstr (native_file_name));
586 g_free (native_file_name);
588 sss = create_syntax_string_source ("SYSFILE INFO %s.",
589 ds_cstr (&filename));
590 execute_syntax (sss);
593 gtk_widget_destroy (dialog);
597 /* Callback for data_save_as action. Prompt for a filename and save */
599 data_save_as_dialog (PsppireDataWindow *de)
601 GtkWidget *button_sys;
603 gtk_file_chooser_dialog_new (_("Save"),
605 GTK_FILE_CHOOSER_ACTION_SAVE,
606 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
607 GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
610 GtkFileFilter *filter = gtk_file_filter_new ();
611 gtk_file_filter_set_name (filter, _("System Files (*.sav)"));
612 gtk_file_filter_add_pattern (filter, "*.sav");
613 gtk_file_filter_add_pattern (filter, "*.SAV");
614 gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
616 filter = gtk_file_filter_new ();
617 gtk_file_filter_set_name (filter, _("Portable Files (*.por) "));
618 gtk_file_filter_add_pattern (filter, "*.por");
619 gtk_file_filter_add_pattern (filter, "*.POR");
620 gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
622 filter = gtk_file_filter_new ();
623 gtk_file_filter_set_name (filter, _("All Files"));
624 gtk_file_filter_add_pattern (filter, "*");
625 gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
628 GtkWidget *button_por;
629 GtkWidget *vbox = gtk_vbox_new (TRUE, 5);
631 gtk_radio_button_new_with_label (NULL, _("System File"));
634 gtk_radio_button_new_with_label
635 (gtk_radio_button_get_group (GTK_RADIO_BUTTON(button_sys)),
638 psppire_box_pack_start_defaults (GTK_BOX (vbox), button_sys);
639 psppire_box_pack_start_defaults (GTK_BOX (vbox), button_por);
641 gtk_widget_show_all (vbox);
643 gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER(dialog), vbox);
646 switch (gtk_dialog_run (GTK_DIALOG (dialog)))
648 case GTK_RESPONSE_ACCEPT:
653 gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog))
656 de->save_as_portable =
657 ! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button_sys));
659 if ( ! name_has_suffix (filename->str))
661 if ( de->save_as_portable)
662 g_string_append (filename, ".por");
664 g_string_append (filename, ".sav");
667 psppire_window_set_filename (PSPPIRE_WINDOW (de), filename->str);
669 save_file (PSPPIRE_WINDOW (de));
671 g_string_free (filename, TRUE);
678 gtk_widget_destroy (dialog);
682 /* Callback for data_save action.
685 data_save (PsppireWindow *de)
687 const gchar *fn = psppire_window_get_filename (de);
690 psppire_window_save (de);
692 data_save_as_dialog (PSPPIRE_DATA_WINDOW (de));
696 /* Callback for data_new action.
697 Performs the NEW FILE command */
699 new_file (GtkAction *action, PsppireDataWindow *de)
701 struct getl_interface *sss =
702 create_syntax_string_source ("NEW FILE.");
704 execute_syntax (sss);
706 psppire_window_set_filename (PSPPIRE_WINDOW (de), NULL);
712 on_edit_paste (GtkAction *a, gpointer data)
714 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
716 psppire_data_editor_clip_paste (de->data_editor);
720 on_edit_copy (GtkMenuItem *m, gpointer data)
722 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
724 psppire_data_editor_clip_copy (de->data_editor);
730 on_edit_cut (GtkMenuItem *m, gpointer data)
732 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
734 psppire_data_editor_clip_cut (de->data_editor);
739 status_bar_activate (GtkToggleAction *action, gpointer data)
741 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
742 GtkWidget *statusbar = get_widget_assert (de->builder, "status-bar");
744 if ( gtk_toggle_action_get_active (action) )
745 gtk_widget_show (statusbar);
747 gtk_widget_hide (statusbar);
752 grid_lines_activate (GtkToggleAction *action, gpointer data)
754 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
755 const gboolean grid_visible = gtk_toggle_action_get_active (action);
757 psppire_data_editor_show_grid (de->data_editor, grid_visible);
761 data_view_activate (GtkCheckMenuItem *menuitem, gpointer data)
763 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
765 gtk_notebook_set_current_page (GTK_NOTEBOOK (de->data_editor), PSPPIRE_DATA_EDITOR_DATA_VIEW);
770 variable_view_activate (GtkCheckMenuItem *menuitem, gpointer data)
772 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
774 gtk_notebook_set_current_page (GTK_NOTEBOOK (de->data_editor), PSPPIRE_DATA_EDITOR_VARIABLE_VIEW);
779 fonts_activate (GtkMenuItem *menuitem, gpointer data)
781 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
782 GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (de));
783 PangoFontDescription *current_font;
786 gtk_font_selection_dialog_new (_("Font Selection"));
789 current_font = GTK_WIDGET(de->data_editor)->style->font_desc;
790 font_name = pango_font_description_to_string (current_font);
792 gtk_font_selection_dialog_set_font_name (GTK_FONT_SELECTION_DIALOG (dialog), font_name);
796 gtk_window_set_transient_for (GTK_WINDOW (dialog),
797 GTK_WINDOW (toplevel));
799 if ( GTK_RESPONSE_OK == gtk_dialog_run (GTK_DIALOG (dialog)) )
801 const gchar *font = gtk_font_selection_dialog_get_font_name
802 (GTK_FONT_SELECTION_DIALOG (dialog));
804 PangoFontDescription* font_desc =
805 pango_font_description_from_string (font);
807 psppire_data_editor_set_font (de->data_editor, font_desc);
810 gtk_widget_hide (dialog);
815 /* Callback for the value labels action */
817 toggle_value_labels (GtkToggleAction *ta, gpointer data)
819 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
821 g_object_set (de->data_editor, "value-labels", gtk_toggle_action_get_active (ta), NULL);
825 toggle_split_window (GtkToggleAction *ta, gpointer data)
827 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
829 psppire_data_editor_split_window (de->data_editor,
830 gtk_toggle_action_get_active (ta));
835 file_quit (GtkCheckMenuItem *menuitem, gpointer data)
837 /* FIXME: Need to be more intelligent here.
838 Give the user the opportunity to save any unsaved data.
840 g_object_unref (the_data_store);
848 create_data_sheet_variable_popup_menu (PsppireDataWindow *de)
850 GtkWidget *menu = gtk_menu_new ();
852 GtkWidget *sort_ascending =
853 gtk_action_create_menu_item (gtk_action_new ("sort-up",
856 "gtk-sort-ascending"));
858 GtkWidget *sort_descending =
859 gtk_action_create_menu_item (gtk_action_new ("sort-down",
860 _("Sort Descending"),
862 "gtk-sort-descending"));
864 GtkWidget *insert_variable =
865 gtk_menu_item_new_with_label (_("Insert Variable"));
867 GtkWidget *clear_variable =
868 gtk_menu_item_new_with_label (_("Clear"));
871 gtk_action_connect_proxy (de->delete_variables,
875 gtk_menu_shell_append (GTK_MENU_SHELL (menu), insert_variable);
878 gtk_menu_shell_append (GTK_MENU_SHELL (menu),
879 gtk_separator_menu_item_new ());
882 gtk_menu_shell_append (GTK_MENU_SHELL (menu), clear_variable);
885 gtk_menu_shell_append (GTK_MENU_SHELL (menu),
886 gtk_separator_menu_item_new ());
889 gtk_menu_shell_append (GTK_MENU_SHELL (menu), sort_ascending);
892 g_signal_connect_swapped (sort_ascending, "activate",
893 G_CALLBACK (psppire_data_editor_sort_ascending),
896 g_signal_connect_swapped (sort_descending, "activate",
897 G_CALLBACK (psppire_data_editor_sort_descending),
900 g_signal_connect_swapped (insert_variable, "activate",
901 G_CALLBACK (gtk_action_activate),
902 de->insert_variable);
905 gtk_menu_shell_append (GTK_MENU_SHELL (menu), sort_descending);
907 gtk_widget_show_all (menu);
914 create_data_sheet_cases_popup_menu (PsppireDataWindow *de)
916 GtkWidget *menu = gtk_menu_new ();
918 GtkWidget *insert_case =
919 gtk_menu_item_new_with_label (_("Insert Case"));
921 GtkWidget *delete_case =
922 gtk_menu_item_new_with_label (_("Clear"));
925 gtk_action_connect_proxy (de->delete_cases,
929 gtk_menu_shell_append (GTK_MENU_SHELL (menu), insert_case);
931 g_signal_connect_swapped (insert_case, "activate",
932 G_CALLBACK (gtk_action_activate),
936 gtk_menu_shell_append (GTK_MENU_SHELL (menu),
937 gtk_separator_menu_item_new ());
940 gtk_menu_shell_append (GTK_MENU_SHELL (menu), delete_case);
943 gtk_widget_show_all (menu);
950 create_var_sheet_variable_popup_menu (PsppireDataWindow *de)
952 GtkWidget *menu = gtk_menu_new ();
954 GtkWidget *insert_variable =
955 gtk_menu_item_new_with_label (_("Insert Variable"));
957 GtkWidget *delete_variable =
958 gtk_menu_item_new_with_label (_("Clear"));
961 gtk_action_connect_proxy (de->delete_variables,
965 gtk_menu_shell_append (GTK_MENU_SHELL (menu), insert_variable);
967 g_signal_connect_swapped (insert_variable, "activate",
968 G_CALLBACK (gtk_action_activate),
969 de->insert_variable);
972 gtk_menu_shell_append (GTK_MENU_SHELL (menu),
973 gtk_separator_menu_item_new ());
976 gtk_menu_shell_append (GTK_MENU_SHELL (menu), delete_variable);
979 gtk_widget_show_all (menu);
986 on_recent_data_select (GtkMenuShell *menushell,
987 PsppireWindow *window)
992 gtk_recent_chooser_get_current_uri (GTK_RECENT_CHOOSER (menushell));
994 file = g_filename_from_uri (uri, NULL, NULL);
998 psppire_window_load (window, file);
1004 on_recent_files_select (GtkMenuShell *menushell, gpointer user_data)
1011 gtk_recent_chooser_get_current_uri (GTK_RECENT_CHOOSER (menushell));
1013 file = g_filename_from_uri (uri, NULL, NULL);
1017 se = psppire_syntax_window_new ();
1019 if ( psppire_window_load (PSPPIRE_WINDOW (se), file) )
1020 gtk_widget_show (se);
1022 gtk_widget_destroy (se);
1029 enable_delete_cases (GtkWidget *w, gint case_num, gpointer data)
1031 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
1033 gtk_action_set_visible (de->delete_cases, case_num != -1);
1038 enable_delete_variables (GtkWidget *w, gint var, gpointer data)
1040 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
1042 gtk_action_set_visible (de->delete_variables, var != -1);
1045 /* Callback for when the datasheet/varsheet is selected */
1047 on_switch_sheet (GtkNotebook *notebook,
1048 GtkNotebookPage *page,
1052 PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (user_data);
1054 GtkUIManager *uim = GTK_UI_MANAGER (get_object_assert (de->builder, "uimanager1", GTK_TYPE_UI_MANAGER));
1056 GtkWidget *view_data =
1057 gtk_ui_manager_get_widget (uim,"/ui/menubar/view/view_data");
1059 GtkWidget *view_variables =
1060 gtk_ui_manager_get_widget (uim,"/ui/menubar/view/view_variables");
1064 case PSPPIRE_DATA_EDITOR_VARIABLE_VIEW:
1065 gtk_widget_hide (view_variables);
1066 gtk_widget_show (view_data);
1067 gtk_action_set_sensitive (de->insert_variable, TRUE);
1068 gtk_action_set_sensitive (de->insert_case, FALSE);
1069 gtk_action_set_sensitive (de->invoke_goto_dialog, FALSE);
1071 case PSPPIRE_DATA_EDITOR_DATA_VIEW:
1072 gtk_widget_show (view_variables);
1073 gtk_widget_hide (view_data);
1074 gtk_action_set_sensitive (de->invoke_goto_dialog, TRUE);
1075 gtk_action_set_sensitive (de->insert_case, TRUE);
1078 g_assert_not_reached ();
1083 update_paste_menuitem (de, page_num);
1090 set_unsaved (gpointer w)
1092 psppire_window_set_unsaved (PSPPIRE_WINDOW (w));
1096 psppire_data_window_init (PsppireDataWindow *de)
1098 PsppireVarStore *vs;
1099 PsppireDict *dict = NULL;
1105 GtkWidget *box = gtk_vbox_new (FALSE, 0);
1106 de->builder = builder_new ("data-editor.ui");
1108 menubar = get_widget_assert (de->builder, "menubar");
1109 hb = get_widget_assert (de->builder, "handlebox1");
1110 sb = get_widget_assert (de->builder, "status-bar");
1113 PSPPIRE_DATA_EDITOR (psppire_data_editor_new (the_var_store, the_data_store));
1115 g_signal_connect_swapped (the_data_store, "case-changed",
1116 G_CALLBACK (set_unsaved), de);
1118 g_signal_connect_swapped (the_data_store, "case-inserted",
1119 G_CALLBACK (set_unsaved), de);
1121 g_signal_connect_swapped (the_data_store, "cases-deleted",
1122 G_CALLBACK (set_unsaved), de);
1124 dataset_set_callback (the_dataset, set_unsaved, de);
1126 connect_help (de->builder);
1128 gtk_box_pack_start (GTK_BOX (box), menubar, FALSE, TRUE, 0);
1129 gtk_box_pack_start (GTK_BOX (box), hb, FALSE, TRUE, 0);
1130 gtk_box_pack_start (GTK_BOX (box), GTK_WIDGET (de->data_editor), TRUE, TRUE, 0);
1131 gtk_box_pack_start (GTK_BOX (box), sb, FALSE, TRUE, 0);
1133 gtk_container_add (GTK_CONTAINER (de), box);
1135 set_cut_copy_menuitem_sensitivity (de, FALSE);
1137 g_signal_connect_swapped (de->data_editor, "data-selection-changed",
1138 G_CALLBACK (set_cut_copy_menuitem_sensitivity), de);
1141 set_paste_menuitem_sensitivity (de, FALSE);
1143 g_signal_connect_swapped (de->data_editor, "data-available-changed",
1144 G_CALLBACK (set_paste_menuitem_sensitivity), de);
1146 dataset_add_transform_change_callback (the_dataset,
1147 transformation_change_callback,
1153 g_assert(vs); /* Traps a possible bug in w32 build */
1155 g_object_get (vs, "dictionary", &dict, NULL);
1157 g_signal_connect (dict, "weight-changed",
1158 G_CALLBACK (on_weight_change),
1161 g_signal_connect (dict, "filter-changed",
1162 G_CALLBACK (on_filter_change),
1165 g_signal_connect (dict, "split-changed",
1166 G_CALLBACK (on_split_change),
1170 g_signal_connect (get_action_assert (de->builder, "edit_copy"),
1172 G_CALLBACK (on_edit_copy), de);
1174 g_signal_connect (get_action_assert (de->builder, "edit_cut"),
1176 G_CALLBACK (on_edit_cut), de);
1183 GtkAction *action_data_new =
1184 get_action_assert (de->builder, "file_new_data");
1186 g_object_set (action_data_new,
1187 "tooltip", _("New data file"),
1188 "stock-id", "gtk-new",
1191 g_signal_connect (action_data_new, "activate",
1192 G_CALLBACK (new_file), de);
1198 GtkAction *invoke_text_import_assistant =
1199 get_action_assert (de->builder, "file_import-text");
1201 g_object_set (invoke_text_import_assistant,
1202 "tooltip", _("Import text data file"),
1203 "stock-id", "gtk-convert",
1206 g_signal_connect (invoke_text_import_assistant, "activate",
1207 G_CALLBACK (text_data_import_assistant), de);
1213 GtkAction *action_data_save = get_action_assert (de->builder, "file_save");
1215 g_signal_connect_swapped (action_data_save, "activate",
1216 G_CALLBACK (data_save), de);
1221 GtkAction *action_data_open = get_action_assert (de->builder, "file_open");
1223 g_signal_connect (action_data_open, "activate",
1224 G_CALLBACK (open_window), de);
1228 GtkAction *action_data_save_as =
1229 get_action_assert (de->builder, "file_save_as");
1231 g_object_set (action_data_save_as,
1232 "tooltip", _("Save data to file"),
1233 "stock-id", "gtk-save-as",
1236 g_signal_connect_swapped (action_data_save_as, "activate",
1237 G_CALLBACK (data_save_as_dialog), de);
1242 GtkAction *action_info_working_file =
1243 get_action_assert (de->builder, "file_information_working-file");
1246 g_signal_connect_swapped (action_info_working_file, "activate",
1247 G_CALLBACK (display_dict), de);
1252 GtkAction *action_info_external_file =
1253 get_action_assert (de->builder, "file_information_external-file");
1256 g_signal_connect_swapped (action_info_external_file, "activate",
1257 G_CALLBACK (sysfile_info), de);
1263 g_signal_connect (get_action_assert (de->builder, "edit_paste"), "activate",
1264 G_CALLBACK (on_edit_paste),
1268 de->insert_case = get_action_assert (de->builder, "edit_insert-case");
1269 g_signal_connect (de->insert_case, "activate",
1270 G_CALLBACK (insert_case),
1276 de->insert_variable = get_action_assert (de->builder, "action_insert-variable");
1278 g_signal_connect (de->insert_variable, "activate",
1279 G_CALLBACK (on_insert_variable),
1285 de->invoke_goto_dialog = get_action_assert (de->builder, "edit_goto-case");
1286 g_signal_connect (de->invoke_goto_dialog, "activate", G_CALLBACK (goto_case_dialog), de);
1290 GtkAction *value_labels_action = get_action_assert (de->builder, "view_value-labels");
1291 g_signal_connect (value_labels_action, "toggled",
1292 G_CALLBACK (toggle_value_labels), de);
1297 get_action_assert (de->builder, "edit_clear-cases");
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 get_action_assert (de->builder, "edit_clear-variables");
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);
1335 GtkAction *invoke_transpose_dialog =
1336 get_action_assert (de->builder, "data_transpose");
1339 g_object_set (invoke_transpose_dialog,
1340 "tooltip", _("Transpose the cases with the variables"),
1341 "stock-id", "pspp-transpose",
1344 g_signal_connect (invoke_transpose_dialog, "activate",
1345 G_CALLBACK (transpose_dialog), de);
1350 GtkAction *invoke_sort_cases_dialog =
1351 get_action_assert (de->builder, "data_sort-cases");
1354 g_object_set (invoke_sort_cases_dialog,
1355 "tooltip", _("Sort cases in the active file"),
1356 "stock-id", "gtk-sort-ascending",
1359 g_signal_connect (invoke_sort_cases_dialog, "activate",
1360 G_CALLBACK (sort_cases_dialog), de);
1366 GtkAction *invoke_compute_dialog =
1367 get_action_assert (de->builder, "transform_compute");
1369 g_object_set (invoke_compute_dialog,
1370 "tooltip", _("Compute new values for a variable"),
1371 "stock-id", "pspp-compute",
1374 g_signal_connect (invoke_compute_dialog, "activate",
1375 G_CALLBACK (compute_dialog), de);
1379 GtkAction *invoke_find_dialog = get_action_assert (de->builder, "edit_find");
1381 g_signal_connect (invoke_find_dialog, "activate",
1382 G_CALLBACK (find_dialog), de);
1387 GtkAction *invoke_split_file_dialog = get_action_assert (de->builder, "data_split-file");
1389 g_signal_connect (invoke_split_file_dialog, "activate",
1390 G_CALLBACK (split_file_dialog), de);
1395 GtkAction *invoke_weight_cases_dialog = get_action_assert (de->builder, "data_weight-cases");
1397 g_signal_connect (invoke_weight_cases_dialog, "activate",
1398 G_CALLBACK (weight_cases_dialog), de);
1404 GtkAction *invoke_variable_info_dialog = get_action_assert (de->builder, "utilities_variables");
1406 g_signal_connect (invoke_variable_info_dialog, "activate",
1407 G_CALLBACK (variable_info_dialog), de);
1413 GtkAction *invoke_oneway_anova_dialog =
1414 get_action_assert (de->builder, "oneway-anova");
1416 g_object_set (invoke_oneway_anova_dialog,
1417 "tooltip", _("Perform one way analysis of variance"),
1420 g_signal_connect (invoke_oneway_anova_dialog, "activate",
1421 G_CALLBACK (oneway_anova_dialog), de);
1426 GtkAction *invoke_t_test_independent_samples_dialog =
1427 get_action_assert (de->builder, "indep-t-test");
1430 g_object_set (invoke_t_test_independent_samples_dialog,
1432 _("Calculate T Test for samples from independent groups"),
1435 g_signal_connect (invoke_t_test_independent_samples_dialog, "activate",
1436 G_CALLBACK (t_test_independent_samples_dialog), de);
1441 GtkAction *invoke_t_test_paired_samples_dialog =
1442 get_action_assert (de->builder, "paired-t-test");
1444 g_object_set (invoke_t_test_paired_samples_dialog,
1446 _("Calculate T Test for paired samples"),
1449 g_signal_connect (invoke_t_test_paired_samples_dialog, "activate",
1450 G_CALLBACK (t_test_paired_samples_dialog), de);
1455 GtkAction *invoke_t_test_one_sample_dialog =
1456 get_action_assert (de->builder, "one-sample-t-test");
1458 g_object_set (invoke_t_test_one_sample_dialog,
1460 _("Calculate T Test for sample from a single distribution"),
1463 g_signal_connect (invoke_t_test_one_sample_dialog, "activate",
1464 G_CALLBACK (t_test_one_sample_dialog), de);
1469 GtkAction *invoke_comments_dialog =
1470 get_action_assert (de->builder, "utilities_comments");
1473 g_object_set (invoke_comments_dialog,
1475 _("Commentary text for the data file"),
1478 g_signal_connect (invoke_comments_dialog, "activate",
1479 G_CALLBACK (comments_dialog), de);
1485 GtkAction *invoke_rank_dialog =
1486 get_action_assert (de->builder, "transform_rank");
1488 g_object_set (invoke_rank_dialog,
1489 "stock-id", "pspp-rank-cases",
1490 "tooltip", _("Rank Cases"),
1493 g_signal_connect (invoke_rank_dialog, "activate",
1494 G_CALLBACK (rank_dialog), de);
1499 GtkAction *invoke_recode_same_dialog =
1500 get_action_assert (de->builder, "transform_recode-same");
1502 g_object_set (invoke_recode_same_dialog,
1503 "stock-id", "pspp-recode-same",
1504 "tooltip", _("Recode values into the same variables"),
1507 g_signal_connect (invoke_recode_same_dialog, "activate",
1508 G_CALLBACK (recode_same_dialog), de);
1513 GtkAction *invoke_recode_different_dialog =
1514 get_action_assert (de->builder, "transform_recode-different");
1516 g_object_set (invoke_recode_different_dialog,
1517 "stock-id", "pspp-recode-different",
1518 "tooltip", _("Recode values into different variables"),
1521 g_signal_connect (invoke_recode_different_dialog, "activate",
1522 G_CALLBACK (recode_different_dialog), de);
1527 GtkAction *invoke_descriptives_dialog =
1528 get_action_assert (de->builder, "analyze_descriptives");
1530 g_object_set (invoke_descriptives_dialog,
1531 "tooltip", _("Calculate descriptive statistics (mean, variance, ...)"),
1532 "stock-id", "pspp-descriptives",
1535 g_signal_connect (invoke_descriptives_dialog, "activate",
1536 G_CALLBACK (descriptives_dialog), de);
1541 GtkAction *invoke_frequencies_dialog =
1542 get_action_assert (de->builder, "analyze_frequencies");
1544 g_object_set (invoke_frequencies_dialog,
1545 "tooltip", _("Generate frequency statistics"),
1546 "stock-id", "pspp-frequencies",
1549 g_signal_connect (invoke_frequencies_dialog, "activate",
1550 G_CALLBACK (frequencies_dialog), de);
1555 GtkAction *invoke_crosstabs_dialog =
1556 get_action_assert (de->builder, "crosstabs");
1558 g_object_set (invoke_crosstabs_dialog,
1559 "tooltip", _("Generate crosstabulations"),
1560 "stock-id", "pspp-crosstabs",
1563 g_signal_connect (invoke_crosstabs_dialog, "activate",
1564 G_CALLBACK (crosstabs_dialog), de);
1570 GtkAction *invoke_examine_dialog =
1571 get_action_assert (de->builder, "analyze_explore");
1573 g_object_set (invoke_examine_dialog,
1574 "tooltip", _("Examine Data by Factors"),
1575 "stock-id", "pspp-examine",
1578 g_signal_connect (invoke_examine_dialog, "activate",
1579 G_CALLBACK (examine_dialog), de);
1584 GtkAction *invoke_regression_dialog =
1585 get_action_assert (de->builder, "linear-regression");
1587 g_object_set (invoke_regression_dialog,
1588 "tooltip", _("Estimate parameters of the linear model"),
1589 "stock-id", "pspp-regression",
1593 g_signal_connect (invoke_regression_dialog, "activate",
1594 G_CALLBACK (regression_dialog), de);
1598 GtkAction *invoke_reliability_dialog =
1599 get_action_assert (de->builder, "reliability");
1601 g_object_set (invoke_reliability_dialog,
1602 "tooltip", _("Reliability Analysis"),
1603 "stock-id", "pspp-reliability",
1607 g_signal_connect (invoke_reliability_dialog, "activate",
1608 G_CALLBACK (reliability_dialog), de);
1612 GtkAction *invoke_roc_dialog =
1613 get_action_assert (de->builder, "roc-curve");
1615 g_object_set (invoke_roc_dialog,
1616 "tooltip", _("ROC Curve"),
1617 "stock-id", "pspp-roc",
1621 g_signal_connect (invoke_roc_dialog, "activate",
1622 G_CALLBACK (roc_dialog), de);
1626 GtkAction *invoke_correlation_dialog =
1627 get_action_assert (de->builder, "correlation");
1629 g_object_set (invoke_correlation_dialog,
1630 "tooltip", _("Bivariate Correlation"),
1631 "stock-id", "pspp-correlation",
1635 g_signal_connect (invoke_correlation_dialog, "activate",
1636 G_CALLBACK (correlation_dialog), de);
1640 GtkAction *invoke_factor_dialog =
1641 get_action_assert (de->builder, "factor-analysis");
1643 g_object_set (invoke_factor_dialog,
1644 "tooltip", _("Principal Axis Factoring and Principal Components Analysis"),
1645 "stock-id", "pspp-factor",
1649 g_signal_connect (invoke_factor_dialog, "activate",
1650 G_CALLBACK (factor_dialog), de);
1655 GtkUIManager *uim = GTK_UI_MANAGER (get_object_assert (de->builder, "uimanager1", GTK_TYPE_UI_MANAGER));
1657 GtkWidget *recent_data =
1658 gtk_ui_manager_get_widget (uim,"/ui/menubar/file/file_recent-data");
1660 GtkWidget *recent_files =
1661 gtk_ui_manager_get_widget (uim,"/ui/menubar/file/file_recent-files");
1664 GtkWidget *menu_data =
1665 gtk_recent_chooser_menu_new_for_manager (the_recent_mgr);
1667 GtkWidget *menu_files =
1668 gtk_recent_chooser_menu_new_for_manager (the_recent_mgr);
1671 GtkRecentFilter *filter = gtk_recent_filter_new ();
1673 gtk_recent_filter_add_pattern (filter, "*.sav");
1674 gtk_recent_filter_add_pattern (filter, "*.SAV");
1675 gtk_recent_filter_add_pattern (filter, "*.por");
1676 gtk_recent_filter_add_pattern (filter, "*.POR");
1678 gtk_recent_chooser_set_sort_type (GTK_RECENT_CHOOSER (menu_data), GTK_RECENT_SORT_MRU);
1680 gtk_recent_chooser_add_filter (GTK_RECENT_CHOOSER (menu_data), filter);
1683 gtk_menu_item_set_submenu (GTK_MENU_ITEM (recent_data), menu_data);
1686 g_signal_connect (menu_data, "selection-done",
1687 G_CALLBACK (on_recent_data_select),
1691 GtkRecentFilter *filter = gtk_recent_filter_new ();
1693 gtk_recent_filter_add_pattern (filter, "*.sps");
1694 gtk_recent_filter_add_pattern (filter, "*.SPS");
1696 gtk_recent_chooser_set_sort_type (GTK_RECENT_CHOOSER (menu_files), GTK_RECENT_SORT_MRU);
1698 gtk_recent_chooser_add_filter (GTK_RECENT_CHOOSER (menu_files), filter);
1701 gtk_menu_item_set_submenu (GTK_MENU_ITEM (recent_files), menu_files);
1703 g_signal_connect (menu_files, "selection-done",
1704 G_CALLBACK (on_recent_files_select),
1709 g_signal_connect (get_action_assert (de->builder,"file_new_syntax"),
1711 G_CALLBACK (create_syntax_window),
1716 GtkAction *abt = get_action_assert (de->builder, "help_about");
1717 g_object_set (abt, "stock-id", "gtk-about", NULL);
1718 g_signal_connect (abt,
1720 G_CALLBACK (about_new),
1725 g_signal_connect (get_action_assert (de->builder,"help_reference"),
1727 G_CALLBACK (reference_manual),
1731 g_signal_connect (de->data_editor,
1733 G_CALLBACK (enable_delete_cases),
1736 g_signal_connect (de->data_editor,
1737 "variables-selected",
1738 G_CALLBACK (enable_delete_variables),
1742 g_signal_connect (de->data_editor,
1744 G_CALLBACK (on_switch_sheet), de);
1746 gtk_notebook_set_current_page (GTK_NOTEBOOK (de->data_editor), PSPPIRE_DATA_EDITOR_VARIABLE_VIEW);
1747 gtk_notebook_set_current_page (GTK_NOTEBOOK (de->data_editor), PSPPIRE_DATA_EDITOR_DATA_VIEW);
1749 g_signal_connect (get_action_assert (de->builder, "view_statusbar"),
1751 G_CALLBACK (status_bar_activate), de);
1754 g_signal_connect (get_action_assert (de->builder, "view_gridlines"),
1756 G_CALLBACK (grid_lines_activate), de);
1760 g_signal_connect (get_action_assert (de->builder, "view_data"),
1762 G_CALLBACK (data_view_activate), de);
1764 g_signal_connect (get_action_assert (de->builder, "view_variables"),
1766 G_CALLBACK (variable_view_activate), de);
1770 GtkAction *font_action =
1771 get_action_assert (de->builder, "view_fonts");
1773 g_object_set (font_action,
1774 "stock-id", "gtk-select-font",
1777 g_signal_connect (font_action,
1779 G_CALLBACK (fonts_activate), de);
1784 g_signal_connect (get_action_assert (de->builder, "file_quit"),
1786 G_CALLBACK (file_quit), de);
1788 g_signal_connect (get_action_assert (de->builder, "transform_run-pending"),
1790 G_CALLBACK (execute), de);
1793 g_signal_connect (get_action_assert (de->builder, "windows_minimise_all"),
1795 G_CALLBACK (psppire_window_minimise_all), NULL);
1799 GtkAction *split_window_action =
1800 get_action_assert (de->builder, "windows_split");
1802 g_object_set (split_window_action,
1803 "tooltip", _("Split the window vertically and horizontally"),
1804 "stock-id", "pspp-split-window",
1807 g_signal_connect (split_window_action, "toggled",
1808 G_CALLBACK (toggle_split_window),
1813 GtkUIManager *uim = GTK_UI_MANAGER (get_object_assert (de->builder, "uimanager1", GTK_TYPE_UI_MANAGER));
1815 PSPPIRE_WINDOW (de)->menu =
1816 GTK_MENU_SHELL (gtk_ui_manager_get_widget (uim,"/ui/menubar/windows/windows_minimise_all")->parent);
1820 GtkMenu *data_sheet_variable_popup_menu =
1821 GTK_MENU (create_data_sheet_variable_popup_menu (de));
1823 GtkMenu *var_sheet_variable_popup_menu =
1824 GTK_MENU (create_var_sheet_variable_popup_menu (de));
1826 GtkMenu *data_sheet_cases_popup_menu =
1827 GTK_MENU (create_data_sheet_cases_popup_menu (de));
1829 g_object_set (de->data_editor,
1830 "datasheet-column-menu", data_sheet_variable_popup_menu,
1831 "datasheet-row-menu", data_sheet_cases_popup_menu,
1832 "varsheet-row-menu", var_sheet_variable_popup_menu,
1836 gtk_widget_show (GTK_WIDGET (de->data_editor));
1837 gtk_widget_show (box);
1842 psppire_data_window_new (void)
1844 return GTK_WIDGET (g_object_new (psppire_data_window_get_type (),
1845 "description", _("Data Editor"),
1855 psppire_data_window_iface_init (PsppireWindowIface *iface)
1857 iface->save = save_file;
1858 iface->load = load_file;