From 2dc6bd2fcac787b64d5ec6dcbf52b1a0c1e631e0 Mon Sep 17 00:00:00 2001 From: John Darrington Date: Wed, 25 Mar 2009 10:48:31 +0900 Subject: [PATCH] Added the "Display Data File Information" item. Added a menuitem to the File menu which calls either DISPLAY DICTIONARY or SYSFILE INFO per spss. --- src/ui/gui/data-editor.glade | 1718 +++++++++++++++--------------- src/ui/gui/psppire-data-window.c | 84 +- 2 files changed, 949 insertions(+), 853 deletions(-) diff --git a/src/ui/gui/data-editor.glade b/src/ui/gui/data-editor.glade index a922366b..bcc28f50 100644 --- a/src/ui/gui/data-editor.glade +++ b/src/ui/gui/data-editor.glade @@ -2,126 +2,35 @@ - - True + + True + + + True + _File + True + + - + True - _File + gtk-new True + True - - - - True - gtk-new - True - True - - - - - True - _Syntax - True - - - - - True - _Data - True - - - - - - - - - True - gtk-open - True - True - - - - - True - _Syntax - True - - - - - True - _Data - True - - - - - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - _Import Delimited Text Data - True - - - - - True - - - - - True - gtk-save - True - True - - + - + True - gtk-save-as - True - True - - - - - True - - - - - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Recently Used Da_ta + _Syntax True - - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Recently Used _Files - True - - - - - True - - - - + True - gtk-quit + _Data True - True @@ -129,97 +38,25 @@ - + True - _Edit + gtk-open True + True - - - - True - False - Insert Variable - True - - - - - True - False - Insert Cases - True - - - - - True - False - Go To Case - True - - - - - True - False - - - - - True - False - gtk-cut - True - True - - - - - True - False - gtk-copy - True - True - - - - - True - False - gtk-paste - True - True - - + - + True - False - Cl_ear Variables + _Syntax True - - True - False - _Clear Cases - True - - - - - True - - - - + True - False - gtk-find + _Data True - True @@ -227,63 +64,59 @@ - + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + _Import Delimited Text Data + True + + + + + True + + + + + True + gtk-save + True + True + + + + + True + gtk-save-as + True + True + + + + + True + + + + True - _View + D_isplay Data File Information True - - - - True - _Status Bar - True - True - - - - - True - - - - - True - _Fonts - True - - - - - True - _Grid Lines - True - True - - - - - True - Value _Labels - True - - - - - True - - + + True + True - + True - _Data + Working File True - + True - _Variables + External File True @@ -292,122 +125,377 @@ - + + True + + + + + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Recently Used Da_ta + True + + + + + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Recently Used _Files + True + + + + + True + + + + + True + gtk-quit + True + True + + + + + + + + + True + _Edit + True + + + + + True + False + Insert Variable + True + + + + + True + False + Insert Cases + True + + + + + True + False + Go To Case + True + + + + + True + False + + + + + True + False + gtk-cut + True + True + + + + + True + False + gtk-copy + True + True + + + + + True + False + gtk-paste + True + True + + + + + True + False + Cl_ear Variables + True + + + + + True + False + _Clear Cases + True + + + + + True + + + + + True + False + gtk-find + True + True + + + + + + + + + True + _View + True + + + + + True + _Status Bar + True + True + + + + + True + + + + + True + _Fonts + True + + + + + True + _Grid Lines + True + True + + + + + True + Value _Labels + True + + + + + True + + + + True _Data True - - - - - True - _Sort Cases - True - - - True - gtk-sort-ascending - - - - - - - True - False - _Transpose - True - - - - - True - False - - - - - True - S_plit File - True - - - - - True - False - Select _Cases - True - - - - - True - _Weight Cases - True - - + + + + + True + _Variables + True + + + + + + + + + True + _Data + True + + + + + True + _Sort Cases + True + + + True + gtk-sort-ascending - + + True + False + _Transpose + True + + + + + True + False + + + + + True + S_plit File + True + + + + + True + False + Select _Cases + True + + + + + True + _Weight Cases + True + + + + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + _Transform + True + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + _Compute + True + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Ran_k Cases + True + + + + + True + + + + + True + Recode into _Same Variables + True + + + + + True + Recode into _Different Variables + True + + + + + True + + + + + True + False + _Run Pending Transforms + True + + + + + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + _Analyze + True + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - _Transform + _Descriptive Statistics True - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - _Compute + _Frequencies True - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Ran_k Cases - True - - - - - True - - - - - True - Recode into _Same Variables + _Descriptives True - + True - Recode into _Different Variables + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + _Explore True - - True - - - - + True - False - _Run Pending Transforms + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + _Crosstabs True - @@ -415,149 +503,45 @@ - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - _Analyze + Compare _Means True - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - _Descriptive Statistics + _One Sample T Test True - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - _Frequencies - True - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - _Descriptives - True - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - _Explore - True - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - _Crosstabs - True - - - - - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Compare _Means - True - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - _One Sample T Test - True - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - _Independent Samples T Test - True - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - _Paired Samples T Test - True - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - One Way _ANOVA - True - - - - - - - - - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Bivariate _Correlation + _Independent Samples T Test True - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Linear _Regression + _Paired Samples T Test True - + + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - _Non-Parametric Statistics + One Way _ANOVA True - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - _Chi-Square - True - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - _Binomial - True - - - - @@ -565,29 +549,42 @@ - + + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Bivariate _Correlation + True + + + + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - _Utilities + Linear _Regression + True + + + + + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + _Non-Parametric Statistics True - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - _Variables + _Chi-Square True - + True - False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Data File _Comments + _Binomial True @@ -595,456 +592,487 @@ + + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + _Utilities + True + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - + True - _Windows + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + _Variables True - - - - - True - _Minimize All Windows - True - - - - - True - _Split - True - - - - - + True - _Help + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Data File _Comments True - - - - - True - _Reference Manual - True - - - True - gtk-help - - - - - - - True - _About - True - - - True - gtk-about - - - - - - - - - - True - GTK_SHADOW_OUT + + + + + + True + _Windows + True + + - + True - - - True - Open - gtk-open - - - False - - - - - True - Save - gtk-save - - - False - - - - - False - Print - gtk-print - - - False - - - - - False - Recall - gtk-missing-image - - - False - - - - - - - False - False - - - - - False - Undo - gtk-undo - - - False - - - - - False - Redo - gtk-redo - - - False - - - - - True - - - False - False - - - - - True - False - Go To Case - gtk-jump-to - - - False - - - - - True - Variables - True - gtk-missing-image - - - False - - - - - True - - - False - False - - - - - True - False - Find - gtk-find - - - False - - - - - True - - - False - False - - - - - True - False - Insert Case - True - gtk-missing-image - - - False - - - - - True - False - Insert Variable - True - gtk-missing-image - - - False - - - - - True - - - False - False - - - - - True - Split File - True - gtk-missing-image - - - False - - - - - True - Weight Cases - True - gtk-missing-image - - - False - - - - - True - False - Select Cases - True - gtk-missing-image - - - False - - - - + _Minimize All Windows + True + + + + + True + _Split + True + + + + + + + + + True + _Help + True + + + + + True + _Reference Manual + True + + True + gtk-help - - False - False - - - + + + + + True + _About + True + + True - Value Labels - True - gtk-missing-image - - - False - - - - - False - Use Sets - True + gtk-about - - False - - - - + + + + + + True + GTK_SHADOW_OUT + + + True + + + True + Open + gtk-open + + + False + + + + + True + Save + gtk-save + + + False + + + + + False + Print + gtk-print + + + False + + + + + False + Recall + gtk-missing-image + + + False + + + + + + + False + False + + + + + False + Undo + gtk-undo + + + False + + + + + False + Redo + gtk-redo + + + False + + + + + True + + + False + False + + + + + True + False + Go To Case + gtk-jump-to + + + False + + + + + True + Variables + True + gtk-missing-image + + + False + + + + + True + + + False + False + + + + + True + False + Find + gtk-find + + + False + + + + + True + + + False + False + + + + + True + False + Insert Case + True + gtk-missing-image + + + False + + + + + True + False + Insert Variable + True + gtk-missing-image + + + False + + + + + True + + + False + False + + + + + True + Split File + True + gtk-missing-image + + + False + + + + + True + Weight Cases + True + gtk-missing-image + + + False + + + + + True + False + Select Cases + True + gtk-missing-image + + + False + + + + + True + + + False + False + + + + + True + Value Labels + True + gtk-missing-image + + + False + + + + + False + Use Sets + True + + + False + + + + + + + True + 6 + + + True + 0 + GTK_SHADOW_IN + + True - 6 + Information Area - + True - 0 - GTK_SHADOW_IN - - - True - Information Area - - - True - True - - - - + True + + + + + + + True + 0 + GTK_SHADOW_IN + + + True + Processor Area - + True - 0 - GTK_SHADOW_IN - - - True - Processor Area - - - True - 35 - True - - - - + 35 + True - - False - False - 1 - + + + + + False + False + 1 + + + + + True + 0 + GTK_SHADOW_IN + + + True + Case Counter Area - + True - 0 - GTK_SHADOW_IN - - - True - Case Counter Area - - - True - 20 - True - - - - + 20 + True - - False - False - 3 - + + + + + False + False + 3 + + + + + True + 0 + GTK_SHADOW_IN + + + True + Filter Use Status Area - + True - 0 - GTK_SHADOW_IN - - - True - Filter Use Status Area - - - True - PANGO_ELLIPSIZE_START - 10 - True - - - - + PANGO_ELLIPSIZE_START + 10 + True - - False - False - 4 - + + + + + False + False + 4 + + + + + True + 0 + GTK_SHADOW_IN + + + True + Weight Status Area - + True - 0 - GTK_SHADOW_IN - - - True - Weight Status Area - - - True - PANGO_ELLIPSIZE_START - 15 - True - - - - + PANGO_ELLIPSIZE_START + 15 + True - - False - False - 5 - + + + + + False + False + 5 + + + + + True + 0 + GTK_SHADOW_IN + + + True + Split File Status Area - + True - 0 - GTK_SHADOW_IN - - - True - Split File Status Area - - - True - PANGO_ELLIPSIZE_START - 15 - True - - - - + PANGO_ELLIPSIZE_START + 15 + True - - False - False - 6 - + + + + False + False + 6 + + + diff --git a/src/ui/gui/psppire-data-window.c b/src/ui/gui/psppire-data-window.c index 8eb0a143..ce048e6a 100644 --- a/src/ui/gui/psppire-data-window.c +++ b/src/ui/gui/psppire-data-window.c @@ -370,15 +370,12 @@ load_file (PsppireWindow *de, const gchar *file_name) return FALSE; } - -/* Callback for the data_open action. - Prompts for a filename and opens it */ -static void -open_data_dialog (GtkAction *action, PsppireWindow *de) +static GtkWidget * +sysfile_chooser_dialog (PsppireWindow *toplevel) { GtkWidget *dialog = gtk_file_chooser_dialog_new (_("Open"), - GTK_WINDOW (de), + GTK_WINDOW (toplevel), GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, @@ -401,11 +398,10 @@ open_data_dialog (GtkAction *action, PsppireWindow *de) gtk_file_filter_add_pattern (filter, "*"); gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter); - { gchar *dir_name; gchar *filename = NULL; - g_object_get (de, "filename", &filename, NULL); + g_object_get (toplevel, "filename", &filename, NULL); dir_name = g_path_get_dirname (filename); gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), @@ -413,6 +409,16 @@ open_data_dialog (GtkAction *action, PsppireWindow *de) free (dir_name); } + return dialog; +} + +/* Callback for the data_open action. + Prompts for a filename and opens it */ +static void +open_data_dialog (GtkAction *action, PsppireWindow *de) +{ + GtkWidget *dialog = sysfile_chooser_dialog (de); + switch (gtk_dialog_run (GTK_DIALOG (dialog))) { case GTK_RESPONSE_ACCEPT: @@ -508,6 +514,46 @@ on_insert_variable (GtkAction *action, gpointer data) } +static void +display_dict (PsppireDataWindow *de) +{ + + struct getl_interface *sss = + create_syntax_string_source ("DISPLAY DICTIONARY."); + + execute_syntax (sss); +} + +static void +sysfile_info (PsppireDataWindow *de) +{ + GtkWidget *dialog = sysfile_chooser_dialog (PSPPIRE_WINDOW (de)); + + if ( GTK_RESPONSE_ACCEPT == gtk_dialog_run (GTK_DIALOG (dialog))) + { + struct string filename; + struct getl_interface *sss; + gchar *file_name = + gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)); + + gchar *native_file_name = + convert_glib_filename_to_system_filename (file_name, NULL); + + ds_init_empty (&filename); + + syntax_gen_string (&filename, ss_cstr (native_file_name)); + + g_free (native_file_name); + + sss = create_syntax_string_source ("SYSFILE INFO %s.", + ds_cstr (&filename)); + execute_syntax (sss); + } + + gtk_widget_destroy (dialog); +} + + /* Callback for data_save_as action. Prompt for a filename and save */ static void data_save_as_dialog (PsppireDataWindow *de) @@ -1186,6 +1232,28 @@ psppire_data_window_init (PsppireDataWindow *de) } + { + GtkAction *action_info_working_file = + resolve_action (de->builder, + "file_information_working-file", NULL); + + + g_signal_connect_swapped (action_info_working_file, "activate", + G_CALLBACK (display_dict), de); + } + + + { + GtkAction *action_info_external_file = + resolve_action (de->builder, + "file_information_external-file", NULL); + + + g_signal_connect_swapped (action_info_external_file, "activate", + G_CALLBACK (sysfile_info), de); + } + + { GtkAction *value_labels_action = -- 2.30.2