From: John Darrington Date: Sat, 23 Dec 2006 09:03:44 +0000 (+0000) Subject: Cleaned up GUI, by objectifying the data editor. Removed a number of global variables. X-Git-Tag: v0.6.0~616 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a486e7cbf4f95d19bb208796e4c92a040cf48f65;p=pspp-builds.git Cleaned up GUI, by objectifying the data editor. Removed a number of global variables. --- diff --git a/AUTHORS b/AUTHORS index 0b1915dc..3322a0f2 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,14 +1,10 @@ - PSPP Authors - - * Ben Pfaff wrote most of the program and the manual. +* Ben Pfaff wrote most of the program and the manual. - * John Williams originally wrote the T-TEST procedure, which was - subsequently re-written by John Darrington. +* John Darrington wrote the graphical user interface, and the +T-TEST, ONEWAY, EXAMINE, RANK and NPAR TESTS commands, implemented +support for long variable names and made numerous revisions to other +modules. - * John Darrington wrote the T-TEST, ONEWAY, and EXAMINE - procedures, implemented support for long variable names and - made numerous revisions to other modules. - - * Jason Stover contributed statistical and numerical - functionality, including lib/gslextras. (Jason is also an - important contributor to libgsl used by PSPP.) +* Jason Stover contributed statistical and numerical +functionality, including lib/gslextras. (Jason is also an +important contributor to libgsl used by PSPP.) diff --git a/glade.patch b/glade.patch new file mode 100644 index 00000000..dc143a9d --- /dev/null +++ b/glade.patch @@ -0,0 +1,62 @@ +This patch mitigates a bug in glade-2, which silently deletes stock_ids, which it +thinks are not valid. You may have to apply this patch after editing data-editor.glade +with glade-2 +============== +--- src/ui/gui/data-editor.glade,old 2006-12-23 17:30:32.000000000 +0900 ++++ src/ui/gui/data-editor.glade 2006-12-23 17:30:36.000000000 +0900 +@@ -619,6 +619,7 @@ + True + False + Variables ++ pspp-goto-variable + + True + True +@@ -678,6 +679,7 @@ + True + False + Insert Case ++ pspp-insert-case + + True + True +@@ -696,6 +698,7 @@ + True + False + Insert Variable ++ pspp-insert-variable + + True + True +@@ -726,6 +729,7 @@ + True + False + Split File ++ pspp-split-file + + True + True +@@ -743,6 +747,7 @@ + True + False + Weight Cases ++ pspp-weight-cases + + True + True +@@ -760,6 +765,7 @@ + True + False + Select Cases ++ pspp-select-cases + + True + True +@@ -789,6 +795,7 @@ + + True + Value Labels ++ pspp-value-labels + + True + True diff --git a/src/data/value.h b/src/data/value.h index d3754d6c..97d07b46 100644 --- a/src/data/value.h +++ b/src/data/value.h @@ -22,6 +22,7 @@ #include #include #include "minmax.h" +#include /* Values. */ diff --git a/src/libpspp/automake.mk b/src/libpspp/automake.mk index 305a7c21..f4a3c95e 100644 --- a/src/libpspp/automake.mk +++ b/src/libpspp/automake.mk @@ -57,8 +57,9 @@ nodist_src_libpspp_libpspp_a_SOURCES = src/libpspp/version.c src/libpspp/version.c: @$(top_srcdir)/mkinstalldirs src/libpspp - echo "#include " > $@ - echo "#include \"version.h\"" > $@ + echo "/* -*- mode: c; buffer-read-only: t -*-" > $@ + echo " Generated by src/libpspp/automake.mk --- Do not edit. */">> $@ + echo "#include \"version.h\"" >> $@ echo "const char bare_version[] = \"@VERSION@\";" >> $@ echo "const char version[] = \"GNU @PACKAGE@ @VERSION@\";" >> $@ echo "const char stat_version[] = \"GNU @PACKAGE@ @VERSION@ \ @@ -70,5 +71,7 @@ src/libpspp/version.c: echo "const char include_path[] =\ \"./:~/.pspp/include:$(pkgdatadir)\";" >> $@ echo "const char locale_dir[] = \"$(datadir)/locale\";" >> $@ - + echo "const char *const authors[] = {" >> $@ + sed -e 's/^/ \"/' -e 's/$$/\",/' $(top_srcdir)/AUTHORS >> $@ + echo "0 };" >> $@ diff --git a/src/libpspp/version.h b/src/libpspp/version.h index 34658749..d2c0fe0a 100644 --- a/src/libpspp/version.h +++ b/src/libpspp/version.h @@ -44,4 +44,7 @@ extern const char include_path[]; /* Locale directory. */ extern const char locale_dir[]; +/* From the AUTHORS file */ +extern const char *const authors[]; + #endif /* !version_h */ diff --git a/src/ui/gui/about.c b/src/ui/gui/about.c new file mode 100644 index 00000000..258e96df --- /dev/null +++ b/src/ui/gui/about.c @@ -0,0 +1,36 @@ +#include +#include + +#include +#include "about.h" +#include "helper.h" + +void +about_new (GtkMenuItem *m, GtkWindow *parent) +{ + GladeXML *xml = glade_xml_new (PKGDATADIR "/psppire.glade", NULL, NULL); + + GtkWidget *about = get_widget_assert (xml, "aboutdialog1"); + + GdkPixbuf *pb = + gdk_pixbuf_new_from_file_at_size (PKGDATADIR "/pspplogo.png", 64, 64, 0); + + gtk_about_dialog_set_logo (GTK_ABOUT_DIALOG(about), pb); + + + gtk_window_set_icon_from_file (GTK_WINDOW(about), + PKGDATADIR "/psppicon.png", 0); + + + gtk_about_dialog_set_authors (GTK_ABOUT_DIALOG (about), authors); + + gtk_window_set_transient_for (GTK_WINDOW(about), parent); + + gtk_window_set_modal (GTK_WINDOW (about), TRUE); + + gtk_window_set_keep_above (GTK_WINDOW (about), TRUE); + + + gtk_widget_show (about); +} + diff --git a/src/ui/gui/about.h b/src/ui/gui/about.h new file mode 100644 index 00000000..4065a802 --- /dev/null +++ b/src/ui/gui/about.h @@ -0,0 +1,3 @@ + + +void about_new (GtkMenuItem *m, GtkWindow *parent); diff --git a/src/ui/gui/automake.mk b/src/ui/gui/automake.mk index ac5f7ed9..e35af365 100644 --- a/src/ui/gui/automake.mk +++ b/src/ui/gui/automake.mk @@ -28,6 +28,8 @@ src_ui_gui_psppiredir = $(pkgdatadir) dist_src_ui_gui_psppire_DATA = \ $(top_srcdir)/src/ui/gui/psppire.glade \ + $(top_srcdir)/src/ui/gui/syntax-editor.glade \ + $(top_srcdir)/src/ui/gui/data-editor.glade \ $(top_srcdir)/src/ui/gui/psppicon.png \ $(top_srcdir)/src/ui/gui/pspplogo.png \ $(top_srcdir)/src/ui/gui/icons/value-labels.png \ @@ -40,17 +42,19 @@ dist_src_ui_gui_psppire_DATA = \ src_ui_gui_psppire_SOURCES = \ + src/ui/gui/about.c \ + src/ui/gui/about.h \ src/ui/gui/customentry.c \ src/ui/gui/customentry.h \ src/ui/gui/data-sheet.c \ src/ui/gui/data-sheet.h \ + src/ui/gui/data-editor.c \ + src/ui/gui/data-editor.h \ src/ui/gui/flexifile-factory.h \ src/ui/gui/flexifile-factory.c \ src/ui/gui/message-dialog.c \ src/ui/gui/message-dialog.h \ src/ui/gui/psppire.c \ - src/ui/gui/menu-actions.c \ - src/ui/gui/menu-actions.h \ src/ui/gui/helper.c \ src/ui/gui/helper.h \ src/ui/gui/missing-val-dialog.c \ @@ -76,4 +80,5 @@ src_ui_gui_psppire_SOURCES = \ src/ui/gui/var-sheet.c \ src/ui/gui/var-sheet.h \ src/ui/gui/var-type-dialog.c \ - src/ui/gui/var-type-dialog.h + src/ui/gui/var-type-dialog.h \ + src/ui/gui/window-manager.c diff --git a/src/ui/gui/data-editor.c b/src/ui/gui/data-editor.c new file mode 100644 index 00000000..b35f3f1a --- /dev/null +++ b/src/ui/gui/data-editor.c @@ -0,0 +1,483 @@ +/* + PSPPIRE --- A Graphical User Interface for PSPP + Copyright (C) 2006 Free Software Foundation + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ + +#include +#include +#include + +#include +#include + + +#include + +#include "helper.h" +#include "about.h" + +#define _(msgid) gettext (msgid) +#define N_(msgid) msgid + +#include "data-editor.h" +#include "syntax-editor.h" +#include "window-manager.h" + +#include "psppire-data-store.h" +#include "psppire-var-store.h" + +/* Switch between the VAR SHEET and the DATA SHEET */ +enum {PAGE_DATA_SHEET = 0, PAGE_VAR_SHEET}; + +static gboolean click2column (GtkWidget *w, gint col, gpointer data); + +static gboolean click2row (GtkWidget *w, gint row, gpointer data); + + +static void select_sheet (struct data_editor *de, guint page_num); + + +static void data_var_select (GtkNotebook *notebook, + GtkNotebookPage *page, + guint page_num, + gpointer user_data); + +static void status_bar_activate (GtkCheckMenuItem *, gpointer); + +static void grid_lines_activate (GtkCheckMenuItem *, gpointer); + +static void data_sheet_activate (GtkCheckMenuItem *, gpointer); + +static void variable_sheet_activate (GtkCheckMenuItem *, gpointer ); + +static void fonts_activate (GtkMenuItem *, gpointer); + +static void value_labels_activate (GtkCheckMenuItem *, gpointer); +static void value_labels_toggled (GtkToggleToolButton *, gpointer); + + +static void file_quit (GtkCheckMenuItem *, gpointer ); + + +/* + Create a new data editor. +*/ +struct data_editor * +new_data_editor (void) +{ + struct data_editor *de ; + struct editor_window *e; + + de = g_malloc (sizeof (*de)); + + e = (struct editor_window *) de; + + de->xml = glade_xml_new (PKGDATADIR "/data-editor.glade", NULL, NULL); + + e->window = get_widget_assert (de->xml, "data_editor"); + + g_signal_connect (get_widget_assert (de->xml,"file_new_data"), + "activate", + G_CALLBACK (new_data_window), + e->window); + + g_signal_connect (get_widget_assert (de->xml,"file_open_data"), + "activate", + G_CALLBACK (open_data_window), + e->window); + + g_signal_connect (get_widget_assert (de->xml,"file_new_syntax"), + "activate", + G_CALLBACK (new_syntax_window), + e->window); + + g_signal_connect (get_widget_assert (de->xml,"file_open_syntax"), + "activate", + G_CALLBACK (open_syntax_window), + e->window); + + g_signal_connect (get_widget_assert (de->xml,"help_about"), + "activate", + G_CALLBACK (about_new), + e->window); + + + g_signal_connect (get_widget_assert (de->xml,"data_sheet"), + "double-click-column", + G_CALLBACK (click2column), + de); + + + g_signal_connect (get_widget_assert (de->xml, "variable_sheet"), + "double-click-row", + GTK_SIGNAL_FUNC (click2row), + de); + + + g_signal_connect (get_widget_assert (de->xml, "notebook"), + "switch-page", + G_CALLBACK (data_var_select), de); + + + + g_signal_connect (get_widget_assert (de->xml, "view_statusbar"), + "activate", + G_CALLBACK (status_bar_activate), de); + + + g_signal_connect (get_widget_assert (de->xml, "view_gridlines"), + "activate", + G_CALLBACK (grid_lines_activate), de); + + + + g_signal_connect (get_widget_assert (de->xml, "view_data"), + "activate", + G_CALLBACK (data_sheet_activate), de); + + g_signal_connect (get_widget_assert (de->xml, "view_variables"), + "activate", + G_CALLBACK (variable_sheet_activate), de); + + + + g_signal_connect (get_widget_assert (de->xml, "view_fonts"), + "activate", + G_CALLBACK (fonts_activate), de); + + + + g_signal_connect (get_widget_assert (de->xml, "view_valuelabels"), + "activate", + G_CALLBACK (value_labels_activate), de); + + + g_signal_connect (get_widget_assert (de->xml, "togglebutton-value-labels"), + "toggled", + G_CALLBACK (value_labels_toggled), de); + + + g_signal_connect (get_widget_assert (de->xml, "file_quit"), + "activate", + G_CALLBACK (file_quit), de); + + + select_sheet (de, PAGE_DATA_SHEET); + + return de; +} + + +/* Callback which occurs when the var sheet's row title + button is double clicked */ +static gboolean +click2row (GtkWidget *w, gint row, gpointer data) +{ + struct data_editor *de = data; + + gint current_row, current_column; + + GtkWidget *data_sheet = get_widget_assert (de->xml, "data_sheet"); + + data_editor_select_sheet (de, PAGE_DATA_SHEET); + + gtk_sheet_get_active_cell (GTK_SHEET(data_sheet), + ¤t_row, ¤t_column); + + gtk_sheet_set_active_cell (GTK_SHEET(data_sheet), current_row, row); + + return FALSE; +} + + +/* Callback which occurs when the data sheet's column title + is double clicked */ +static gboolean +click2column (GtkWidget *w, gint col, gpointer data) +{ + struct data_editor *de = data; + + gint current_row, current_column; + + GtkWidget *var_sheet = get_widget_assert (de->xml, "variable_sheet"); + + data_editor_select_sheet (de, PAGE_VAR_SHEET); + + gtk_sheet_get_active_cell (GTK_SHEET(var_sheet), + ¤t_row, ¤t_column); + + gtk_sheet_set_active_cell (GTK_SHEET(var_sheet), col, current_column); + + return FALSE; +} + + + + +void +new_data_window (GtkMenuItem *menuitem, gpointer parent) +{ + window_create (WINDOW_DATA, NULL); +} + + +static void +select_sheet (struct data_editor *de, guint page_num) +{ + GtkWidget *insert_variable = get_widget_assert (de->xml, "insert-variable"); + GtkWidget *insert_cases = get_widget_assert (de->xml, "insert-cases"); + + GtkWidget *view_data = get_widget_assert (de->xml, "view_data"); + GtkWidget *view_variables = get_widget_assert (de->xml, "view_variables"); + + switch (page_num) + { + case PAGE_VAR_SHEET: + gtk_widget_hide (view_variables); + gtk_widget_show (view_data); + gtk_widget_set_sensitive (insert_variable, TRUE); + gtk_widget_set_sensitive (insert_cases, FALSE); + break; + case PAGE_DATA_SHEET: + gtk_widget_show (view_variables); + gtk_widget_hide (view_data); + gtk_widget_set_sensitive (insert_variable, FALSE); + gtk_widget_set_sensitive (insert_cases, TRUE); + break; + default: + g_assert_not_reached (); + break; + } +} + + +static void +data_var_select (GtkNotebook *notebook, + GtkNotebookPage *page, + guint page_num, + gpointer user_data) +{ + struct data_editor *de = user_data; + + select_sheet (de, page_num); +} + + + + +void +data_editor_select_sheet (struct data_editor *de, gint page) +{ + gtk_notebook_set_current_page + ( + GTK_NOTEBOOK (get_widget_assert (de->xml,"notebook")), page + ); +} + + +void +open_data_window (GtkMenuItem *menuitem, gpointer parent) +{ + bool finished = FALSE; + + GtkWidget *dialog; + + GtkFileFilter *filter ; + + dialog = gtk_file_chooser_dialog_new (_("Open"), + GTK_WINDOW (parent), + GTK_FILE_CHOOSER_ACTION_OPEN, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, + NULL); + + filter = gtk_file_filter_new (); + gtk_file_filter_set_name (filter, _("System Files (*.sav)")); + gtk_file_filter_add_pattern (filter, "*.sav"); + gtk_file_filter_add_pattern (filter, "*.SAV"); + gtk_file_chooser_add_filter (GTK_FILE_CHOOSER(dialog), filter); + + filter = gtk_file_filter_new (); + gtk_file_filter_set_name (filter, _("Portable Files (*.por) ")); + gtk_file_filter_add_pattern (filter, "*.por"); + gtk_file_filter_add_pattern (filter, "*.POR"); + gtk_file_chooser_add_filter (GTK_FILE_CHOOSER(dialog), filter); + + filter = gtk_file_filter_new (); + gtk_file_filter_set_name (filter, _("All Files")); + gtk_file_filter_add_pattern (filter, "*"); + gtk_file_chooser_add_filter (GTK_FILE_CHOOSER(dialog), filter); + + do { + + if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) + { + gchar *file_name = + gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)); + + g_free (file_name); + } + else + finished = TRUE; + + } while ( ! finished ) ; + + gtk_widget_destroy (dialog); +} + + + + +static void +status_bar_activate (GtkCheckMenuItem *menuitem, gpointer data) +{ + struct data_editor *de = data; + GtkWidget *statusbar = get_widget_assert (de->xml, "statusbar"); + + if ( gtk_check_menu_item_get_active (menuitem) ) + gtk_widget_show (statusbar); + else + gtk_widget_hide (statusbar); +} + + + + +static void +grid_lines_activate (GtkCheckMenuItem *menuitem, gpointer data) +{ + struct data_editor *de = data; + const bool grid_visible = gtk_check_menu_item_get_active (menuitem); + + gtk_sheet_show_grid (GTK_SHEET (get_widget_assert (de->xml, + "variable_sheet")), + grid_visible); + + gtk_sheet_show_grid (GTK_SHEET (get_widget_assert (de->xml, "data_sheet")), + grid_visible); +} + + + +static void +data_sheet_activate (GtkCheckMenuItem *menuitem, gpointer data) +{ + struct data_editor *de = data; + + data_editor_select_sheet (de, PAGE_DATA_SHEET); +} + + +static void +variable_sheet_activate (GtkCheckMenuItem *menuitem, gpointer data) +{ + struct data_editor *de = data; + + data_editor_select_sheet (de, PAGE_VAR_SHEET); +} + + +static void +fonts_activate (GtkMenuItem *menuitem, gpointer data) +{ + struct data_editor *de = data; + GtkWidget *dialog = + gtk_font_selection_dialog_new (_("Font Selection")); + + gtk_window_set_transient_for (GTK_WINDOW (dialog), + GTK_WINDOW (get_widget_assert (de->xml, + "data_editor"))); + if ( GTK_RESPONSE_OK == gtk_dialog_run (GTK_DIALOG (dialog)) ) + { + GtkSheet *data_sheet = + GTK_SHEET(get_widget_assert (de->xml, "data_sheet")); + + GtkSheet *var_sheet = + GTK_SHEET(get_widget_assert (de->xml, "variable_sheet")); + + PsppireDataStore *ds = PSPPIRE_DATA_STORE (gtk_sheet_get_model (data_sheet)); + PsppireVarStore *vs = PSPPIRE_VAR_STORE (gtk_sheet_get_model (var_sheet)); + + const gchar *font = gtk_font_selection_dialog_get_font_name + (GTK_FONT_SELECTION_DIALOG (dialog)); + + PangoFontDescription* font_desc = + pango_font_description_from_string (font); + + psppire_var_store_set_font (vs, font_desc); + psppire_data_store_set_font (ds, font_desc); + } + + gtk_widget_hide (dialog); +} + + +/* The next two callbacks are mutually co-operative */ + +/* Callback for the value labels menu item */ +static void +value_labels_activate (GtkCheckMenuItem *menuitem, gpointer data) +{ + struct data_editor *de = data; + + GtkSheet *data_sheet = GTK_SHEET (get_widget_assert (de->xml, "data_sheet")); + + GtkToggleToolButton *tb = + GTK_TOGGLE_TOOL_BUTTON (get_widget_assert (de->xml, + "togglebutton-value-labels")); + + PsppireDataStore *ds = PSPPIRE_DATA_STORE (gtk_sheet_get_model (data_sheet)); + + gboolean show_value_labels = gtk_check_menu_item_get_active (menuitem); + + gtk_toggle_tool_button_set_active (tb, show_value_labels); + + psppire_data_store_show_labels (ds, show_value_labels); +} + + +/* Callback for the value labels tooglebutton */ +static void +value_labels_toggled (GtkToggleToolButton *toggle_tool_button, + gpointer data) +{ + struct data_editor *de = data; + + GtkSheet *data_sheet = GTK_SHEET (get_widget_assert (de->xml, "data_sheet")); + + GtkCheckMenuItem *item = + GTK_CHECK_MENU_ITEM (get_widget_assert (de->xml, "view_valuelabels")); + + PsppireDataStore *ds = PSPPIRE_DATA_STORE (gtk_sheet_get_model (data_sheet)); + + gboolean show_value_labels = + gtk_toggle_tool_button_get_active (toggle_tool_button); + + gtk_check_menu_item_set_active (item, show_value_labels); + + psppire_data_store_show_labels (ds, show_value_labels); +} + + +static void +file_quit (GtkCheckMenuItem *menuitem, gpointer data) +{ + /* FIXME: Need to be more intelligent here. + Give the user the opportunity to save any unsaved data. + */ + gtk_main_quit (); +} diff --git a/src/ui/gui/data-editor.glade b/src/ui/gui/data-editor.glade new file mode 100644 index 00000000..6962555f --- /dev/null +++ b/src/ui/gui/data-editor.glade @@ -0,0 +1,2939 @@ + + + + + + + Psppire Data Editor + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + 975 + 480 + True + False + True + False + False + GDK_WINDOW_TYPE_HINT_NORMAL + GDK_GRAVITY_NORTH_WEST + True + False + + + + True + False + 0 + + + + True + GTK_PACK_DIRECTION_LTR + GTK_PACK_DIRECTION_LTR + + + + True + _File + True + + + + + + + True + gtk-new + True + + + + + + + True + _Syntax + True + + + + + + True + _Data + True + + + + + + + + + + True + gtk-open + True + + + + + + + True + _Syntax + True + + + + + + True + _Data + True + + + + + + + + + + True + False + gtk-save + True + + + + + + + True + False + gtk-save-as + True + + + + + + + True + + + + + + True + gtk-quit + True + + + + + + + + + + + True + False + _Edit + True + + + + + + + True + False + gtk-cut + True + + + + + + True + False + gtk-copy + True + + + + + + True + False + gtk-paste + True + + + + + + True + False + Paste _Variables + True + + + + + + True + Cl_ear + True + + + + + + + + True + + + + + + True + False + _Find + True + + + + True + gtk-find + 1 + 0.5 + 0.5 + 0 + 0 + + + + + + + + + + + + True + _View + True + + + + + + + True + Status Bar + True + True + + + + + + Toolbars + True + + + + + + True + + + + + + True + Fonts + True + + + + + + True + Grid Lines + True + True + + + + + + True + Value Labels + True + False + + + + + + True + + + + + + True + Data + True + + + + + + True + Variables + True + + + + + + + + + + True + False + _Data + True + + + + + + + True + False + Insert Variable + True + + + + + + + True + Insert Cases + True + + + + + + + True + Go To Case + True + + + + + True + gtk-jump-to + 1 + 0.5 + 0.5 + 0 + 0 + + + + + + + + True + + + + + + True + Sort Cases + True + + + + + + + True + False + Transpose + True + + + + + + True + False + Restructure + True + + + + + + True + False + Merge Files + True + + + + + + True + False + Aggregate + True + + + + + + True + + + + + + True + False + Split File + True + + + + + + True + False + Select Cases + True + + + + + + True + False + Weight Cases + True + + + + + + + + + + True + _Help + True + + + + + + + True + _About + True + + + + + + + + + + 0 + False + False + + + + + + True + GTK_SHADOW_OUT + GTK_POS_LEFT + GTK_POS_TOP + + + + True + GTK_ORIENTATION_HORIZONTAL + GTK_TOOLBAR_ICONS + True + True + + + + True + False + Open + gtk-open + True + True + False + + + False + True + + + + + + True + False + Save + gtk-save + True + True + False + + + + False + True + + + + + + True + False + Print + gtk-print + True + True + False + + + False + True + + + + + + True + True + True + True + + + False + False + + + + + + True + False + Undo + gtk-undo + True + True + False + + + False + True + + + + + + True + False + Redo + gtk-redo + True + True + False + + + False + True + + + + + + True + True + True + True + + + False + False + + + + + + True + False + Go To Case + gtk-jump-to + True + True + False + + + + False + True + + + + + + True + False + Variables + pspp-goto-variable + + True + True + True + False + + + False + True + + + + + + True + True + True + True + + + False + False + + + + + + True + False + Find + gtk-find + True + True + False + + + False + True + + + + + + True + True + True + True + + + False + False + + + + + + True + False + Insert Case + pspp-insert-case + + True + True + True + False + + + + False + True + + + + + + True + False + Insert Variable + pspp-insert-variable + + True + True + True + False + + + False + True + + + + + + True + True + True + True + + + False + False + + + + + + True + False + Split File + pspp-split-file + + True + True + True + False + + + False + True + + + + + + True + False + Weight Cases + pspp-weight-cases + + True + True + True + False + + + False + True + + + + + + True + False + Select Cases + pspp-select-cases + + True + True + True + False + + + False + True + + + + + + True + True + True + True + + + False + False + + + + + + True + Value Labels + pspp-value-labels + + True + True + True + False + False + + + + False + True + + + + + + True + False + Use Sets + + True + True + True + False + + + False + True + + + + + + + 0 + False + False + + + + + + True + True + True + True + GTK_POS_BOTTOM + True + True + + + + True + False + 0 + + + + True + 1 + 2 + False + 0 + 0 + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 0 + 1 + + + + + + + True + False + False + True + 0 + + True + * + False + 25 + + + 0 + 1 + 0 + 1 + fill + + + + + + 0 + False + False + + + + + + True + GTK_POLICY_ALWAYS + GTK_POLICY_ALWAYS + GTK_SHADOW_NONE + GTK_CORNER_TOP_LEFT + + + + True + psppire_data_sheet_create + 0 + 0 + Sun, 30 Oct 2005 08:53:47 GMT + + + + + 0 + True + True + + + + + False + True + + + + + + True + Data View + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + tab + + + + + + True + True + GTK_POLICY_ALWAYS + GTK_POLICY_ALWAYS + GTK_SHADOW_NONE + GTK_CORNER_TOP_LEFT + + + + True + psppire_variable_sheet_create + 0 + 0 + Sun, 30 Oct 2005 08:54:45 GMT + + + + + False + True + + + + + + True + Variable View + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + tab + + + + + 0 + True + True + + + + + + True + True + + + 0 + False + False + + + + + + + + 6 + Variable Type + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + True + 485 + False + False + True + True + True + GDK_WINDOW_TYPE_HINT_DIALOG + GDK_GRAVITY_NORTH_WEST + True + False + + + + 5 + True + False + 5 + + + + 13 + True + True + 0 + + + + True + True + Numeric + True + GTK_RELIEF_NORMAL + True + True + False + True + + + 0 + False + False + + + + + + True + True + Comma + True + GTK_RELIEF_NORMAL + True + False + False + True + radiobutton1 + + + 0 + False + False + + + + + + True + True + Dot + True + GTK_RELIEF_NORMAL + True + False + False + True + radiobutton1 + + + 0 + False + False + + + + + + True + True + Scientific notation + True + GTK_RELIEF_NORMAL + True + False + False + True + radiobutton1 + + + 0 + False + False + + + + + + True + True + Date + True + GTK_RELIEF_NORMAL + True + False + False + True + radiobutton1 + + + 0 + False + False + + + + + + True + True + Dollar + True + GTK_RELIEF_NORMAL + True + False + False + True + radiobutton1 + + + 0 + False + False + + + + + + True + True + Custom currency + True + GTK_RELIEF_NORMAL + True + False + False + True + radiobutton1 + + + 0 + False + False + + + + + + True + True + String + True + GTK_RELIEF_NORMAL + True + False + False + True + radiobutton1 + + + 0 + False + False + + + + + 0 + False + False + + + + + + True + False + 10 + + + + 20 + 194 + True + GTK_POLICY_NEVER + GTK_POLICY_ALWAYS + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + False + False + False + True + False + False + False + + + + + 0 + False + False + + + + + + False + 15 + + + + 1 + 120 + True + True + GTK_POLICY_NEVER + GTK_POLICY_NEVER + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + False + False + False + True + False + False + False + + + + + 0 + True + True + + + + + + True + 0 + 0.5 + GTK_SHADOW_ETCHED_IN + + + + True + 0.5 + 0.5 + 1 + 1 + 0 + 0 + 12 + 0 + + + + True + True + 0 + + + + True + positive + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + True + True + + + + + + True + negative + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + True + True + + + + + + + + + + True + Sample + False + True + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + label_item + + + + + 0 + True + True + GTK_PACK_END + + + + + 0 + True + True + + + + + + True + GTK_POLICY_NEVER + GTK_POLICY_ALWAYS + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + False + False + False + True + False + False + False + + + + + 0 + True + True + + + + + + 100 + 50 + True + 2 + 2 + False + 1 + 2 + + + + True + Decimal Places: + False + False + GTK_JUSTIFY_RIGHT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 1 + 2 + fill + + + + + + + 25 + True + True + True + 0 + + True + * + False + + + 1 + 2 + 0 + 1 + + + + + + + 25 + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 1 + 2 + + + + + + + True + False + 0 + + + + True + Width: + False + False + GTK_JUSTIFY_RIGHT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + GTK_PACK_END + + + + + 0 + 1 + 0 + 1 + fill + fill + + + + + 0 + True + True + + + + + 0 + True + False + + + + + + True + GTK_BUTTONBOX_START + 5 + + + + True + True + True + gtk-ok + True + GTK_RELIEF_NORMAL + True + + + + + + True + True + True + gtk-cancel + True + GTK_RELIEF_NORMAL + True + + + + + + + True + True + True + gtk-help + True + GTK_RELIEF_NORMAL + True + + + + + 0 + True + True + + + + + + + + Value Labels + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + True + False + False + True + True + True + GDK_WINDOW_TYPE_HINT_DIALOG + GDK_GRAVITY_NORTH_WEST + True + False + + + + 5 + True + False + 0 + + + + True + 0 + 0.5 + GTK_SHADOW_ETCHED_IN + + + + 8 + True + 0.5 + 0.5 + 1 + 1 + 0 + 0 + 12 + 0 + + + + True + 2 + 2 + False + 5 + 0 + + + + 5 + True + GTK_BUTTONBOX_DEFAULT_STYLE + 0 + + + + True + False + True + True + gtk-add + True + GTK_RELIEF_NORMAL + True + + + + + + True + False + True + True + gtk-apply + True + GTK_RELIEF_NORMAL + True + + + + + + True + False + True + True + gtk-remove + True + GTK_RELIEF_NORMAL + True + + + + + 0 + 1 + 1 + 2 + fill + + + + + + 5 + True + 2 + 2 + False + 4 + 5 + + + + True + Value: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 0 + 1 + fill + + + + + + + True + Value Label: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 1 + 2 + fill + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 1 + 2 + + + + + + + True + False + 0 + + + + 85 + True + True + True + True + 0 + + True + * + False + + + 1 + False + False + + + + + 1 + 2 + 0 + 1 + fill + fill + + + + + 0 + 2 + 0 + 1 + fill + + + + + + True + True + GTK_POLICY_NEVER + GTK_POLICY_AUTOMATIC + GTK_SHADOW_ETCHED_IN + GTK_CORNER_TOP_LEFT + + + + True + True + False + False + False + False + False + False + False + + + + + 1 + 2 + 1 + 2 + fill + fill + + + + + + + + + + True + Value Labels + False + True + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + label_item + + + + + 10 + True + True + + + + + + 5 + True + GTK_BUTTONBOX_START + 5 + + + + True + True + True + gtk-ok + True + GTK_RELIEF_NORMAL + True + + + + + + + True + True + True + gtk-cancel + True + GTK_RELIEF_NORMAL + True + + + + + + + True + True + True + gtk-help + True + GTK_RELIEF_NORMAL + True + + + + + 0 + False + False + GTK_PACK_END + + + + + + + + 10 + Missing Values + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + True + False + False + True + True + True + GDK_WINDOW_TYPE_HINT_DIALOG + GDK_GRAVITY_NORTH_WEST + True + False + + + + True + 2 + 2 + False + 0 + 0 + + + + 5 + True + GTK_BUTTONBOX_START + 5 + + + + True + True + True + gtk-ok + True + GTK_RELIEF_NORMAL + True + + + + + + + True + True + True + gtk-cancel + True + GTK_RELIEF_NORMAL + True + + + + + + + True + True + True + gtk-help + True + GTK_RELIEF_NORMAL + True + + + + + 1 + 2 + 0 + 1 + + + + + + True + False + 12 + + + + True + True + _No missing values + True + GTK_RELIEF_NORMAL + True + True + False + True + + + 0 + False + False + + + + + + True + False + 0 + + + + True + True + _Discrete missing values + True + GTK_RELIEF_NORMAL + False + False + False + True + no_missing + + + 0 + False + False + + + + + + True + False + 0 + + + + 5 + True + True + 5 + + + + 75 + True + True + True + True + 0 + + True + * + False + + + 0 + False + False + + + + + + 75 + True + True + True + True + 0 + + True + * + False + + + 0 + False + False + + + + + + 75 + True + True + True + True + 0 + + True + * + False + + + 0 + False + False + + + + + 20 + True + True + + + + + 0 + True + True + + + + + 0 + False + False + + + + + 0 + 1 + 0 + 1 + fill + + + + + + True + False + 0 + + + + True + True + _Range plus one optional discrete missing value + True + GTK_RELIEF_NORMAL + False + False + False + True + no_missing + + + 0 + False + False + + + + + + True + False + 5 + + + + True + False + 0 + + + + True + False + 0 + + + + True + _Low: + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + mv-low + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 20 + False + False + + + + + + 75 + True + True + True + True + 0 + + True + * + False + + + 0 + False + True + + + + + 0 + True + True + + + + + + True + False + 0 + + + + True + _High: + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + mv-high + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + 75 + True + True + True + True + 0 + + True + * + False + + + 5 + True + True + + + + + 20 + True + False + + + + + + + + + + + + + 0 + True + True + + + + + + True + False + 0 + + + + True + Di_screte value: + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + mv-discrete + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 20 + False + False + + + + + + 75 + True + True + True + True + 0 + + True + * + False + + + 0 + False + True + + + + + 0 + True + True + + + + + 0 + True + True + + + + + 0 + 2 + 1 + 2 + fill + + + + + + + + Go To Case + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + True + False + False + True + True + True + GDK_WINDOW_TYPE_HINT_DIALOG + GDK_GRAVITY_NORTH_WEST + True + False + False + + + + True + False + 0 + + + + True + GTK_BUTTONBOX_END + + + + True + True + True + gtk-ok + True + GTK_RELIEF_NORMAL + True + -5 + + + + + 0 + False + True + GTK_PACK_END + + + + + + True + False + 3 + + + + True + Case Number: + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + 50 + True + True + True + True + 0 + + True + * + False + + + 0 + True + True + + + + + 0 + True + True + + + + + + + + 10 + True + Sort Cases + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + True + True + False + True + True + True + GDK_WINDOW_TYPE_HINT_DIALOG + GDK_GRAVITY_NORTH_WEST + True + False + + + + True + False + 9 + + + + 10 + True + True + GTK_POLICY_NEVER + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + False + False + True + True + True + False + False + + + + + 0 + True + True + + + + + + True + 0.5 + 0.25 + 0.460000008345 + 0.0799999982119 + 0 + 0 + 0 + 0 + + + + True + True + GTK_RELIEF_NORMAL + True + + + + True + GTK_ARROW_RIGHT + GTK_SHADOW_OUT + 0.5 + 0.5 + 0 + 0 + + + + + + + 0 + True + True + + + + + + True + False + 4 + + + + 75 + True + 0 + 0.5 + GTK_SHADOW_ETCHED_IN + + + + 12 + 66 + True + True + 5 + + + + True + True + Ascending + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + False + False + + + + + + True + True + Descending + True + GTK_RELIEF_NORMAL + True + False + False + True + sort-cases-button-ascending + + + 0 + False + False + + + + + + + + True + Sort Order + False + True + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + label_item + + + + + 0 + False + True + GTK_PACK_END + + + + + + True + False + 0 + + + + True + Sort by: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + True + True + GTK_POLICY_NEVER + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + False + False + False + True + True + False + False + + + + + 0 + True + True + + + + + 0 + True + True + GTK_PACK_END + + + + + 0 + True + True + + + + + + True + GTK_BUTTONBOX_DEFAULT_STYLE + 0 + + + + True + True + True + gtk-ok + True + GTK_RELIEF_NORMAL + True + + + + + + True + False + True + True + gtk-paste + True + GTK_RELIEF_NORMAL + True + + + + + + True + True + True + gtk-refresh + True + GTK_RELIEF_NORMAL + True + + + + + + True + True + True + gtk-cancel + True + GTK_RELIEF_NORMAL + True + + + + + + True + True + True + gtk-help + True + GTK_RELIEF_NORMAL + True + + + + + 6 + True + False + + + + + + + diff --git a/src/ui/gui/data-editor.h b/src/ui/gui/data-editor.h new file mode 100644 index 00000000..d0c6d090 --- /dev/null +++ b/src/ui/gui/data-editor.h @@ -0,0 +1,44 @@ +/* + PSPPIRE --- A Graphical User Interface for PSPP + Copyright (C) 2006 Free Software Foundation + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ + + +#ifndef DATA_EDITOR_H +#define DATA_EDITOR_H + +#include +#include +#include "window-manager.h" + +struct data_editor +{ + struct editor_window parent; + GladeXML *xml; +}; + + +struct data_editor * new_data_editor (void); + +void new_data_window (GtkMenuItem *, gpointer); + +void open_data_window (GtkMenuItem *, gpointer); + +void data_editor_select_sheet(struct data_editor *de, gint page); + + +#endif diff --git a/src/ui/gui/data-sheet.c b/src/ui/gui/data-sheet.c index 03cf1c4f..6cd26bce 100644 --- a/src/ui/gui/data-sheet.c +++ b/src/ui/gui/data-sheet.c @@ -1,4 +1,4 @@ -/* +/* PSPPIRE --- A Graphical User Interface for PSPP Copyright (C) 2004, 2005, 2006 Free Software Foundation @@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + 02110-1301, USA. */ #include @@ -36,24 +36,27 @@ #include #include -#include "menu-actions.h" #include "data-sheet.h" - -extern GladeXML *xml; - -static gboolean -traverse_callback (GtkSheet * sheet, - gint row, gint col, +static gboolean +traverse_callback (GtkSheet * sheet, + gint row, gint col, gint *new_row, gint *new_column ) { gint case_count; - PsppireDataStore *data_store = PSPPIRE_DATA_STORE(gtk_sheet_get_model(sheet)); - const gint n_vars = psppire_dict_get_var_cnt(data_store->dict); + gint n_vars; + + PsppireDataStore *data_store = + PSPPIRE_DATA_STORE(gtk_sheet_get_model(sheet)); + - if ( *new_column >= n_vars ) + g_assert (data_store); + + n_vars = psppire_dict_get_var_cnt(data_store->dict); + + if ( *new_column >= n_vars ) return FALSE; case_count = psppire_case_file_get_case_count(data_store->case_file); @@ -62,7 +65,7 @@ traverse_callback (GtkSheet * sheet, { gint i; - for ( i = case_count ; i <= *new_row; ++i ) + for ( i = case_count ; i <= *new_row; ++i ) psppire_data_store_insert_new_case (data_store, i); return TRUE; @@ -73,28 +76,13 @@ traverse_callback (GtkSheet * sheet, -/* Callback which occurs when the column title is double clicked */ -static gboolean -click2column(GtkWidget *w, gint col, gpointer data) -{ - gint current_row, current_column; - GtkWidget *var_sheet = get_widget_assert(xml, "variable_sheet"); - - select_sheet(PAGE_VAR_SHEET); - - gtk_sheet_get_active_cell(GTK_SHEET(var_sheet), - ¤t_row, ¤t_column); - - gtk_sheet_set_active_cell(GTK_SHEET(var_sheet), col, current_column); - - return FALSE; -} - - /* Update the data_ref_entry with the reference of the active cell */ -gint +gint update_data_ref_entry(const GtkSheet *sheet, gint row, gint col) { + + GladeXML *data_editor_xml = NULL; /* FIXME !!!! */ + /* The entry where the reference to the current cell is displayed */ GtkEntry *cell_ref_entry; @@ -102,19 +90,20 @@ update_data_ref_entry(const GtkSheet *sheet, gint row, gint col) PsppireDataStore *data_store = PSPPIRE_DATA_STORE(gtk_sheet_get_model(sheet)); if (data_store) { - const struct variable *pv = + const struct variable *pv = psppire_dict_get_variable(data_store->dict, col); gchar *text ; gchar *s ; - if ( !xml) + if ( !data_editor_xml) return FALSE; - text = g_strdup_printf("%d: %s", row, + text = g_strdup_printf("%d: %s", row, pv ? var_get_name (pv) : ""); - - cell_ref_entry = GTK_ENTRY(get_widget_assert(xml, "cell_ref_entry")); + + cell_ref_entry = GTK_ENTRY(get_widget_assert (data_editor_xml, + "cell_ref_entry")); s = pspp_locale_to_utf8(text, -1, 0); @@ -128,11 +117,11 @@ update_data_ref_entry(const GtkSheet *sheet, gint row, gint col) return FALSE; } -extern PsppireDataStore *data_store ; +extern PsppireDataStore *the_data_store ; /* Return the width that an 'M' character would occupy when typeset in WIDGET */ -static guint +static guint calc_m_width(GtkWidget *widget, const PangoFontDescription *font_desc) { PangoRectangle rect; @@ -145,7 +134,7 @@ calc_m_width(GtkWidget *widget, const PangoFontDescription *font_desc) g_assert (layout); pango_layout_set_text (layout, "M", 1); - + pango_layout_set_font_description (layout, font_desc); pango_layout_get_extents (layout, NULL, &rect); @@ -173,10 +162,10 @@ psppire_data_sheet_create (gchar *widget_name, gchar *string1, gchar *string2, { GtkWidget *sheet; - sheet = gtk_sheet_new(G_SHEET_ROW(data_store), - G_SHEET_COLUMN(data_store), "data sheet", 0); + sheet = gtk_sheet_new(G_SHEET_ROW(the_data_store), + G_SHEET_COLUMN(the_data_store), "data sheet", 0); - data_store->width_of_m = calc_m_width(sheet, data_store->font_desc); + the_data_store->width_of_m = calc_m_width(sheet, the_data_store->font_desc); g_signal_connect (G_OBJECT (sheet), "activate", G_CALLBACK (update_data_ref_entry), @@ -186,14 +175,14 @@ psppire_data_sheet_create (gchar *widget_name, gchar *string1, gchar *string2, G_CALLBACK (traverse_callback), 0); - g_signal_connect (G_OBJECT (sheet), "double-click-column", - G_CALLBACK (click2column), - 0); - - g_signal_connect (G_OBJECT (data_store), "font-changed", + g_signal_connect (G_OBJECT (the_data_store), "font-changed", G_CALLBACK (font_change_callback), sheet); gtk_sheet_set_active_cell(GTK_SHEET(sheet), -1, -1); + + + gtk_sheet_set_model(sheet, G_SHEET_MODEL(the_data_store)); + gtk_widget_show(sheet); return sheet; diff --git a/src/ui/gui/menu-actions.c b/src/ui/gui/menu-actions.c deleted file mode 100644 index 265cd6c9..00000000 --- a/src/ui/gui/menu-actions.c +++ /dev/null @@ -1,734 +0,0 @@ -/* - PSPPIRE --- A Graphical User Interface for PSPP - Copyright (C) 2004, 2005, 2006 Free Software Foundation - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. */ - -#include -#include -#include -#define _(msgid) gettext (msgid) -#define N_(msgid) msgid - -#include - -#include -#include -#include -#include -#include - -#include -#include - -#include - -#include -#include "helper.h" -#include "menu-actions.h" - -#include "psppire-dict.h" - -#include "var-sheet.h" -#include "data-sheet.h" - -#include "psppire-var-store.h" -#include "psppire-data-store.h" - -#include "sort-cases-dialog.h" - - -extern GladeXML *xml; - - -extern PsppireDict *the_dictionary ; - -static struct file_handle *psppire_handle = 0; - -static const gchar handle_name[] = "psppire_handle"; - -static const gchar untitled[] = N_("Untitled"); - -static const gchar window_title[] = N_("PSPP Data Editor"); - - -/* Sets the title bar to TEXT */ -static void -psppire_set_window_title(const gchar *text) -{ - GtkWidget *data_editor = get_widget_assert(xml, "data_editor"); - - gchar *title = g_strdup_printf("%s --- %s", text, gettext(window_title)); - - gtk_window_set_title(GTK_WINDOW(data_editor), title); - - g_free(title); -} - -/* Clear the active file and set the data and var sheets to - reflect this. - */ -gboolean -clear_file(void) -{ - PsppireDataStore *data_store ; - GtkSheet *data_sheet = GTK_SHEET(get_widget_assert(xml, "data_sheet")); - GtkSheet *var_sheet = GTK_SHEET(get_widget_assert(xml, "variable_sheet")); - - gtk_sheet_set_active_cell(data_sheet, -1, -1); - gtk_sheet_set_active_cell(var_sheet, 0, 0); - - if ( GTK_WIDGET_REALIZED(GTK_WIDGET(data_sheet))) - gtk_sheet_unselect_range(data_sheet); - - if ( GTK_WIDGET_REALIZED(GTK_WIDGET(var_sheet))) - gtk_sheet_unselect_range(var_sheet); - - gtk_sheet_moveto(data_sheet, 0, 0, 0.0, 0.0); - gtk_sheet_moveto(var_sheet, 0, 0, 0.0, 0.0); - - data_store = PSPPIRE_DATA_STORE(gtk_sheet_get_model(data_sheet)); - - psppire_data_store_clear(data_store); - - psppire_set_window_title(gettext(untitled)); - - if (psppire_handle) - fh_free(psppire_handle); - psppire_handle = 0 ; - - return TRUE; -} - -void -on_new1_activate (GtkMenuItem *menuitem, - gpointer user_data) -{ - clear_file(); -} - - - -/* Load a system file. - Return TRUE if successfull -*/ -gboolean -load_system_file(const gchar *file_name) -{ - int var_cnt ; - - PsppireVarStore *var_store ; - PsppireDataStore *data_store ; - struct dictionary *new_dict; - struct sfm_read_info ri; - struct sfm_reader *reader ; - - GtkWidget *data_sheet = get_widget_assert(xml, "data_sheet"); - GtkWidget *var_sheet = get_widget_assert(xml, "variable_sheet"); - - g_assert(data_sheet); - g_assert(var_sheet); - - clear_file(); - - psppire_handle = - fh_create_file (handle_name, file_name, fh_default_properties()); - - if ( !psppire_handle ) - { - g_warning("Cannot read handle for reading system file \"%s\"\n", - file_name); - return FALSE; - } - - reader = sfm_open_reader (psppire_handle, &new_dict, &ri); - - if ( ! reader ) - return FALSE; - - /* FIXME: We need a better way of updating a dictionary than this */ - the_dictionary = psppire_dict_new_from_dict(new_dict); - - var_store = - PSPPIRE_VAR_STORE(gtk_sheet_get_model(GTK_SHEET(var_sheet))); - - psppire_var_store_set_dictionary(var_store, the_dictionary); - - - data_store = - PSPPIRE_DATA_STORE(gtk_sheet_get_model(GTK_SHEET(data_sheet))); - - psppire_data_store_set_dictionary(data_store, - the_dictionary); - - psppire_set_window_title(basename(file_name)); - - var_cnt = dict_get_next_value_idx(the_dictionary->dict); - if ( var_cnt == 0 ) - return FALSE; - - - for(;;) - { - struct ccase c; - case_create(&c, var_cnt); - if ( 0 == sfm_read_case (reader, &c) ) - { - case_destroy(&c); - break; - } - - if ( !psppire_case_file_append_case(data_store->case_file, &c) ) - { - g_warning("Cannot write case to casefile\n"); - break; - } - case_destroy(&c); - } - - sfm_close_reader(reader); - - psppire_case_file_get_case_count(data_store->case_file); - - return TRUE; -} - -void -open_data (GtkMenuItem *menuitem, - gpointer user_data) -{ - bool finished = FALSE; - - GtkWidget *dialog; - GtkWidget *data_editor = get_widget_assert(xml, "data_editor"); - GtkFileFilter *filter ; - - dialog = gtk_file_chooser_dialog_new (_("Open"), - GTK_WINDOW(data_editor), - GTK_FILE_CHOOSER_ACTION_OPEN, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, - NULL); - - filter = gtk_file_filter_new(); - gtk_file_filter_set_name(filter, _("System Files (*.sav)")); - gtk_file_filter_add_pattern(filter, "*.sav"); - gtk_file_filter_add_pattern(filter, "*.SAV"); - gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filter); - - filter = gtk_file_filter_new(); - gtk_file_filter_set_name(filter, _("Portable Files (*.por) ")); - gtk_file_filter_add_pattern(filter, "*.por"); - gtk_file_filter_add_pattern(filter, "*.POR"); - gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filter); - - filter = gtk_file_filter_new(); - gtk_file_filter_set_name(filter, _("All Files")); - gtk_file_filter_add_pattern(filter, "*"); - gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filter); - - do { - - if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) - { - gchar *file_name = - gtk_file_chooser_get_filename(GTK_FILE_CHOOSER (dialog)); - - finished = load_system_file(file_name) ; - - g_free(file_name); - } - else - finished = TRUE; - - } while ( ! finished ) ; - - gtk_widget_destroy (dialog); -} - - -void -on_data3_activate (GtkMenuItem *menuitem, - gpointer user_data) -{ - open_data(menuitem, user_data); -} - -void -on_data5_activate (GtkMenuItem *menuitem, - gpointer user_data) -{ - open_data(menuitem, user_data); -} - - -/* Re initialise HANDLE, by interrogating the user for a new file name */ -static gboolean -recreate_save_handle(struct file_handle **handle) -{ - gint response; - GtkWidget *dialog; - - GtkWidget *data_editor = get_widget_assert(xml, "data_editor"); - - dialog = gtk_file_chooser_dialog_new (_("Save Data As"), - GTK_WINDOW(data_editor), - GTK_FILE_CHOOSER_ACTION_SAVE, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, - NULL); - - response = gtk_dialog_run (GTK_DIALOG (dialog)); - - if (response == GTK_RESPONSE_ACCEPT) - { - char *file_name = gtk_file_chooser_get_filename - (GTK_FILE_CHOOSER (dialog)); - - - if ( *handle ) - fh_free(*handle); - - *handle = fh_create_file (handle_name, file_name, - fh_default_properties()); - - psppire_set_window_title(basename(file_name)); - - g_free (file_name); - } - - gtk_widget_destroy (dialog); - - return ( response == GTK_RESPONSE_ACCEPT ) ; -} - -void -on_save1_activate (GtkMenuItem *menuitem, - gpointer user_data) -{ - GtkSheet *data_sheet ; - PsppireDataStore *data_store ; - - if ( ! psppire_handle ) - { - if ( ! recreate_save_handle(&psppire_handle) ) - return; - } - - data_sheet = GTK_SHEET(get_widget_assert(xml, "data_sheet")); - data_store = PSPPIRE_DATA_STORE(gtk_sheet_get_model(data_sheet)); - - if ( psppire_handle ) - psppire_data_store_create_system_file(data_store, - psppire_handle); -} - - -void -on_save_as1_activate (GtkMenuItem *menuitem, - gpointer user_data) -{ - GtkSheet *data_sheet ; - PsppireDataStore *data_store ; - - if ( ! recreate_save_handle(&psppire_handle) ) - return ; - - if ( ! psppire_handle ) - return ; - - data_sheet = GTK_SHEET(get_widget_assert(xml, "data_sheet")); - data_store = PSPPIRE_DATA_STORE(gtk_sheet_get_model(data_sheet)); - - if ( psppire_handle ) - psppire_data_store_create_system_file(data_store, - psppire_handle); -} - - -void -on_quit1_activate (GtkMenuItem *menuitem, - gpointer user_data) -{ - gtk_main_quit(); -} - - -void -on_clear_activate (GtkMenuItem *menuitem, - gpointer user_data) -{ - GtkNotebook *notebook = GTK_NOTEBOOK(get_widget_assert(xml, "notebook1")); - gint page = -1; - - page = gtk_notebook_get_current_page(notebook); - - switch (page) - { - case PAGE_VAR_SHEET: - break; - case PAGE_DATA_SHEET: - { - GtkSheet *data_sheet = GTK_SHEET(get_widget_assert(xml, "data_sheet")); - PsppireDataStore *data_store = - PSPPIRE_DATA_STORE(gtk_sheet_get_model(data_sheet)); - - - switch ( data_sheet->state ) - { - case GTK_SHEET_ROW_SELECTED: - psppire_case_file_delete_cases(data_store->case_file, - data_sheet->range.rowi - - data_sheet->range.row0 + 1, - data_sheet->range.row0); - break; - case GTK_SHEET_COLUMN_SELECTED: - { - gint fv; - struct variable *pv = - psppire_dict_get_variable (the_dictionary, - data_sheet->range.col0); - - fv = var_get_case_index (pv); - - psppire_dict_delete_variables (the_dictionary, - data_sheet->range.col0, - 1); - - psppire_case_file_insert_values (data_store->case_file, - -1, fv); - } - break; - default: - gtk_sheet_cell_clear (data_sheet, - data_sheet->active_cell.row, - data_sheet->active_cell.col); - break; - } - - } - break; - } - -} - -void -on_about1_activate(GtkMenuItem *menuitem, - gpointer user_data) -{ - GtkWidget *about = get_widget_assert(xml, "aboutdialog1"); - - - GdkPixbuf *pb = gdk_pixbuf_new_from_file_at_size( "pspplogo.png", 64, 64, 0); - - gtk_about_dialog_set_logo(GTK_ABOUT_DIALOG(about), pb); - - gtk_widget_show(about); - - gtk_window_set_transient_for(GTK_WINDOW(about), - GTK_WINDOW(get_widget_assert(xml, "data_editor"))); -} - - -/* Set the value labels state from the toolbar's toggle button */ -void -on_togglebutton_value_labels_toggled(GtkToggleToolButton *toggle_tool_button, - gpointer user_data) -{ - GtkSheet *data_sheet = GTK_SHEET(get_widget_assert(xml, "data_sheet")); - GtkCheckMenuItem *item = - GTK_CHECK_MENU_ITEM(get_widget_assert(xml, "menuitem-value-labels")); - - PsppireDataStore *ds = PSPPIRE_DATA_STORE(gtk_sheet_get_model(data_sheet)); - - gboolean show_value_labels = gtk_toggle_tool_button_get_active(toggle_tool_button); - - gtk_check_menu_item_set_active(item, show_value_labels); - - psppire_data_store_show_labels(ds, show_value_labels); -} - -/* Set the value labels state from the view menu */ -void -on_value_labels_activate(GtkCheckMenuItem *menuitem, - gpointer user_data) -{ - GtkSheet *data_sheet = GTK_SHEET(get_widget_assert(xml, "data_sheet")); - GtkToggleToolButton *tb = - GTK_TOGGLE_TOOL_BUTTON(get_widget_assert(xml, "togglebutton-value-labels")); - - PsppireDataStore *ds = PSPPIRE_DATA_STORE(gtk_sheet_get_model(data_sheet)); - - gboolean show_value_labels = gtk_check_menu_item_get_active(menuitem); - - gtk_toggle_tool_button_set_active(tb, show_value_labels); - - psppire_data_store_show_labels(ds, show_value_labels); -} - -void -on_status_bar1_activate(GtkCheckMenuItem *menuitem, - gpointer user_data) -{ - - if ( gtk_check_menu_item_get_active(menuitem) ) - gtk_widget_show(get_widget_assert(xml, "statusbar1")); - else - gtk_widget_hide(get_widget_assert(xml, "statusbar1")); -} - -void -on_grid_lines1_activate(GtkCheckMenuItem *menuitem, - gpointer user_data) -{ - - const bool grid_visible = gtk_check_menu_item_get_active(menuitem); - - gtk_sheet_show_grid(GTK_SHEET(get_widget_assert(xml, "variable_sheet")), - grid_visible); - - gtk_sheet_show_grid(GTK_SHEET(get_widget_assert(xml, "data_sheet")), - grid_visible); -} - - -void -on_fonts1_activate(GtkMenuItem *menuitem, - gpointer user_data) -{ - static GtkWidget *dialog = 0 ; - if ( !dialog ) - dialog = gtk_font_selection_dialog_new(_("Font Selection")); - - gtk_window_set_transient_for(GTK_WINDOW(dialog), - GTK_WINDOW(get_widget_assert(xml, "data_editor"))); - - - if ( GTK_RESPONSE_OK == gtk_dialog_run(GTK_DIALOG(dialog)) ) - { - GtkSheet *data_sheet = - GTK_SHEET(get_widget_assert(xml, "data_sheet")); - - GtkSheet *var_sheet = - GTK_SHEET(get_widget_assert(xml, "variable_sheet")); - - PsppireDataStore *ds = PSPPIRE_DATA_STORE(gtk_sheet_get_model(data_sheet)); - PsppireVarStore *vs = PSPPIRE_VAR_STORE(gtk_sheet_get_model(var_sheet)); - - const gchar *font = gtk_font_selection_dialog_get_font_name - (GTK_FONT_SELECTION_DIALOG(dialog)); - - PangoFontDescription* font_desc = - pango_font_description_from_string(font); - - psppire_var_store_set_font(vs, font_desc); - psppire_data_store_set_font(ds, font_desc); - } - - gtk_widget_hide(dialog); - -} - - -static GtkWidget *menuitems[2]; -static GtkNotebook *notebook = 0; - -static void -switch_menus(gint page) -{ - GtkWidget *insert_variable = get_widget_assert(xml, "insert-variable"); - GtkWidget *insert_cases = get_widget_assert(xml, "insert-cases"); - - switch (page) - { - case PAGE_VAR_SHEET: - gtk_widget_hide(menuitems[PAGE_VAR_SHEET]); - gtk_widget_show(menuitems[PAGE_DATA_SHEET]); - gtk_widget_set_sensitive(insert_variable, TRUE); - gtk_widget_set_sensitive(insert_cases, FALSE); - break; - case PAGE_DATA_SHEET: - gtk_widget_show(menuitems[PAGE_VAR_SHEET]); - gtk_widget_hide(menuitems[PAGE_DATA_SHEET]); - gtk_widget_set_sensitive(insert_variable, FALSE); - gtk_widget_set_sensitive(insert_cases, TRUE); - break; - default: - g_assert_not_reached(); - break; - } -} - - -void -select_sheet(gint page) -{ - gtk_notebook_set_current_page(notebook, page); - switch_menus(page); -} - - - -static void -data_var_select(GtkNotebook *notebook, - GtkNotebookPage *page, - guint page_num, - gpointer user_data) -{ - switch_menus(page_num); -} - - -/* Initialised things on the variable sheet */ -void -var_data_selection_init(void) -{ - notebook = GTK_NOTEBOOK(get_widget_assert(xml, "notebook1")); - menuitems[PAGE_DATA_SHEET] = get_widget_assert(xml, "data1"); - menuitems[PAGE_VAR_SHEET] = get_widget_assert(xml, "variables1"); - - gtk_notebook_set_current_page(notebook, PAGE_DATA_SHEET); - gtk_widget_hide(menuitems[PAGE_DATA_SHEET]); - gtk_widget_show(menuitems[PAGE_VAR_SHEET]); - - - g_signal_connect(G_OBJECT(notebook), "switch-page", - G_CALLBACK(data_var_select), 0); - -} - - -void -on_data1_activate(GtkMenuItem *menuitem, - gpointer user_data) -{ - select_sheet(PAGE_DATA_SHEET); -} - - -void -on_variables1_activate(GtkMenuItem *menuitem, - gpointer user_data) -{ - select_sheet(PAGE_VAR_SHEET); -} - - - -void -on_go_to_case_activate(GtkMenuItem *menuitem, - gpointer user_data) -{ - GtkWidget *dialog = get_widget_assert(xml, "go_to_case_dialog"); - GtkEntry *entry = GTK_ENTRY(get_widget_assert(xml, "entry_go_to_case")); - GtkSheet *data_sheet = GTK_SHEET(get_widget_assert(xml, "data_sheet")); - - gint result = gtk_dialog_run(GTK_DIALOG(dialog)); - - - - switch (result) - { - case GTK_RESPONSE_OK: - { - gint row, column; - const gchar *text = gtk_entry_get_text(entry); - gint casenum = g_strtod(text, NULL); - - gtk_sheet_get_active_cell(data_sheet, &row, &column); - if ( column < 0 ) column = 0; - if ( row < 0 ) row = 0; - - gtk_sheet_set_active_cell(data_sheet, casenum, column); - } - break; - default: - break; - } - - gtk_widget_hide(dialog); - gtk_entry_set_text(entry, ""); -} - - - -void -on_sort_cases_activate (GtkMenuItem *menuitem, - gpointer user_data) -{ - gint response; - PsppireDataStore *data_store ; - - struct sort_criteria criteria; - static struct sort_cases_dialog *dialog ; - - GtkSheet *data_sheet = GTK_SHEET(get_widget_assert(xml, "data_sheet")); - - data_store = PSPPIRE_DATA_STORE(gtk_sheet_get_model(data_sheet)); - - if ( NULL == dialog) - dialog = sort_cases_dialog_create(xml); - - response = sort_cases_dialog_run(dialog, the_dictionary, &criteria); - - switch ( response) - { - case GTK_RESPONSE_OK: - psppire_case_file_sort(data_store->case_file, &criteria); - break; - } -} - - -static void -insert_case(void) -{ - gint row, col; - PsppireDataStore *data_store ; - GtkSheet *data_sheet = GTK_SHEET(get_widget_assert(xml, "data_sheet")); - - data_store = PSPPIRE_DATA_STORE(gtk_sheet_get_model(data_sheet)); - - gtk_sheet_get_active_cell(data_sheet, &row, &col); - - psppire_data_store_insert_new_case(data_store, row); -} - -void -on_insert_case_clicked (GtkButton *button, gpointer user_data) -{ - insert_case(); -} - -void -on_insert_cases (GtkMenuItem *menuitem, gpointer user_data) -{ - insert_case(); -} - - -void -on_insert_variable (GtkMenuItem *menuitem, gpointer user_data) -{ - gint row, col; - GtkSheet *var_sheet = GTK_SHEET(get_widget_assert(xml, "variable_sheet")); - - gtk_sheet_get_active_cell(var_sheet, &row, &col); - - psppire_dict_insert_variable(the_dictionary, row, NULL); -} - - diff --git a/src/ui/gui/menu-actions.h b/src/ui/gui/menu-actions.h deleted file mode 100644 index 281e1f0d..00000000 --- a/src/ui/gui/menu-actions.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - PSPPIRE --- A Graphical User Interface for PSPP - Copyright (C) 2004 Free Software Foundation - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. */ - -#ifndef MENU_ACTIONS_H -#define MENU_ACTIONS_H - -#include - - -void -on_new1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -void -on_open1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -void -on_save1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -void -on_save_as1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -void -on_quit1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -void -on_cut1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -void -on_copy1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -void -on_paste1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -void -on_delete1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -void -on_about1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -GtkWidget* -psppire_data_sheet_create (gchar *widget_name, gchar *string1, gchar *string2, - gint int1, gint int2); - -GtkWidget* -psppire_data_sheet_create (gchar *widget_name, gchar *string1, gchar *string2, - gint int1, gint int2); - -GtkWidget* -psppire_variable_sheet_create (gchar *widget_name, gchar *string1, gchar *string2, - gint int1, gint int2); - - -/* Switch between the VAR SHEET and the DATA SHEET */ -enum {PAGE_DATA_SHEET = 0, PAGE_VAR_SHEET}; - -gboolean load_system_file(const gchar *file_name); -gboolean clear_file(void); - -void select_sheet(gint page); -void var_data_selection_init(void); - - -#endif - - - diff --git a/src/ui/gui/message-dialog.c b/src/ui/gui/message-dialog.c index 8b910ce2..f550e8fc 100644 --- a/src/ui/gui/message-dialog.c +++ b/src/ui/gui/message-dialog.c @@ -39,10 +39,6 @@ #include "helper.h" -extern GladeXML *xml; - - - static void enqueue_msg (const struct msg *m); @@ -137,9 +133,7 @@ popup_message(const struct msg *m) break; }; - parent = GTK_WINDOW(get_widget_assert(xml, "data_editor")); - - dialog = gtk_message_dialog_new(parent, + dialog = gtk_message_dialog_new ( NULL, GTK_DIALOG_MODAL, message_type, GTK_BUTTONS_CLOSE, @@ -151,7 +145,7 @@ popup_message(const struct msg *m) m->where.line_number, m->text); - gtk_window_set_transient_for(GTK_WINDOW(dialog), parent); + gtk_window_set_keep_above (GTK_WINDOW(dialog), TRUE); gtk_dialog_run(GTK_DIALOG(dialog)); diff --git a/src/ui/gui/psppire.c b/src/ui/gui/psppire.c index ed4c790b..59dde1b0 100644 --- a/src/ui/gui/psppire.c +++ b/src/ui/gui/psppire.c @@ -23,6 +23,7 @@ #include +#include "data-editor.h" #include #include #include @@ -37,7 +38,6 @@ #include #include #include -#include "menu-actions.h" #include "psppire-dict.h" #include "psppire-var-store.h" #include "psppire-data-store.h" @@ -47,12 +47,7 @@ #include "message-dialog.h" #include "flexifile-factory.h" -GladeXML *xml; - - -PsppireDict *the_dictionary = 0; - -PsppireDataStore *data_store = 0; +PsppireDataStore *the_data_store = 0; static bool parse_command_line (int *argc, char ***argv, @@ -78,7 +73,7 @@ give_help(void) popup_message(&m); } -PsppireVarStore *var_store = 0; +PsppireVarStore *the_var_store = 0; void create_icon_factory (void); @@ -91,6 +86,8 @@ int main(int argc, char *argv[]) { struct casefile_factory *factory; + PsppireDict *dictionary = 0; + GtkWidget *data_editor ; GtkSheet *var_sheet ; @@ -139,7 +136,7 @@ main(int argc, char *argv[]) message_dialog_init (the_source_stream); - the_dictionary = + dictionary = psppire_dict_new_from_dict ( dataset_dict (the_dataset) ); @@ -147,46 +144,44 @@ main(int argc, char *argv[]) bind_textdomain_codeset(PACKAGE, "UTF-8"); /* Create the model for the var_sheet */ - var_store = psppire_var_store_new(the_dictionary); + the_var_store = psppire_var_store_new(dictionary); - data_store = psppire_data_store_new(the_dictionary); + + the_data_store = psppire_data_store_new (dictionary); create_icon_factory(); +#if 0 /* load the interface */ - xml = glade_xml_new(PKGDATADIR "/psppire.glade", NULL, NULL); + data_editor_xml = glade_xml_new(PKGDATADIR "/data-editor.glade", NULL, NULL); - if ( !xml ) return 1; + if ( !data_editor_xml ) return 1; - data_editor = get_widget_assert(xml, "data_editor"); - gtk_window_set_icon_from_file(GTK_WINDOW(data_editor), - PKGDATADIR "/psppicon.png",0); + data_editor = get_widget_assert(data_editor_xml, "data_editor"); /* connect the signals in the interface */ - glade_xml_signal_autoconnect(xml); - - var_sheet = GTK_SHEET(get_widget_assert(xml, "variable_sheet")); - data_sheet = GTK_SHEET(get_widget_assert(xml, "data_sheet")); + glade_xml_signal_autoconnect(data_editor_xml); - gtk_sheet_set_model(var_sheet, G_SHEET_MODEL(var_store)); + var_sheet = GTK_SHEET(get_widget_assert(data_editor_xml, "variable_sheet")); + data_sheet = GTK_SHEET(get_widget_assert(data_editor_xml, "data_sheet")); - gtk_sheet_set_model(data_sheet, G_SHEET_MODEL(data_store)); + gtk_sheet_set_model(var_sheet, G_SHEET_MODEL(the_var_store)); - if (filename) - gtk_init_add((GtkFunction)load_system_file, filename); - else - gtk_init_add((GtkFunction)clear_file, 0); + gtk_sheet_set_model(data_sheet, G_SHEET_MODEL(the_data_store)); var_data_selection_init(); { - GList *helps = glade_xml_get_widget_prefix(xml, "help_button_"); + GList *helps = glade_xml_get_widget_prefix(data_editor_xml, "help_button_"); GList *i; for ( i = g_list_first(helps); i ; i = g_list_next(i)) g_signal_connect(GTK_WIDGET(i->data), "clicked", give_help, 0); } +#endif + + new_data_window (NULL, NULL); /* start the event loop */ gtk_main(); diff --git a/src/ui/gui/psppire.glade b/src/ui/gui/psppire.glade index c98446b0..d8a9bbee 100644 --- a/src/ui/gui/psppire.glade +++ b/src/ui/gui/psppire.glade @@ -3,1032 +3,6 @@ - - True - Psppire Data Editor - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - 975 - 480 - True - False - True - False - False - GDK_WINDOW_TYPE_HINT_NORMAL - GDK_GRAVITY_NORTH_WEST - True - False - - - - True - False - 0 - - - - True - GTK_PACK_DIRECTION_LTR - GTK_PACK_DIRECTION_LTR - - - - True - _File - True - - - - - - - True - gtk-new - True - - - - - - - True - _Syntax - True - - - - - - - True - _Data - True - - - - - - - - - - True - gtk-open - True - - - - - - - True - _Syntax - True - - - - - - - True - _Data - True - - - - - - - - - - - True - gtk-save - True - - - - - - - True - gtk-save-as - True - - - - - - - True - - - - - - True - gtk-quit - True - - - - - - - - - - - True - _Edit - True - - - - - - - True - False - gtk-cut - True - - - - - - True - False - gtk-copy - True - - - - - - True - False - gtk-paste - True - - - - - - True - False - Paste _Variables - True - - - - - - True - Cl_ear - True - - - - - - - - True - - - - - - True - False - _Find - True - - - - True - gtk-find - 1 - 0.5 - 0.5 - 0 - 0 - - - - - - - - - - - - True - _View - True - - - - - - - True - Status Bar - True - True - - - - - - - Toolbars - True - - - - - - True - - - - - - True - Fonts - True - - - - - - - True - Grid Lines - True - True - - - - - - - True - Value Labels - True - False - - - - - - - True - - - - - - True - Data - True - - - - - - - True - Variables - True - - - - - - - - - - - True - _Data - True - - - - - - - True - False - Insert Variable - True - - - - - - - True - Insert Cases - True - - - - - - - True - Go To Case - True - - - - - True - gtk-jump-to - 1 - 0.5 - 0.5 - 0 - 0 - - - - - - - - True - - - - - - True - Sort Cases - True - - - - - - - True - False - Transpose - True - - - - - - True - False - Restructure - True - - - - - - True - False - Merge Files - True - - - - - - True - False - Aggregate - True - - - - - - True - - - - - - True - False - Split File - True - - - - - - True - False - Select Cases - True - - - - - - True - False - Weight Cases - True - - - - - - - - - - True - _Help - True - - - - - - - True - _About - True - - - - - - - - - - 0 - False - False - - - - - - True - GTK_SHADOW_OUT - GTK_POS_LEFT - GTK_POS_TOP - - - - True - GTK_ORIENTATION_HORIZONTAL - GTK_TOOLBAR_ICONS - True - True - - - - True - Open - gtk-open - True - True - False - - - False - True - - - - - - True - Save - gtk-save - True - True - False - - - - False - True - - - - - - True - Print - gtk-print - True - True - False - - - False - True - - - - - - True - True - True - True - - - False - False - - - - - - True - Undo - gtk-undo - True - True - False - - - False - True - - - - - - True - Redo - gtk-redo - True - True - False - - - False - True - - - - - - True - True - True - True - - - False - False - - - - - - True - Go To Case - gtk-jump-to - True - True - False - - - - False - True - - - - - - True - Variables - pspp-goto-variable - - True - True - True - False - - - False - True - - - - - - True - True - True - True - - - False - False - - - - - - True - Find - gtk-find - True - True - False - - - False - True - - - - - - True - True - True - True - - - False - False - - - - - - True - Insert Case - pspp-insert-case - - True - True - True - False - - - - False - True - - - - - - True - Insert Variable - pspp-insert-variable - - True - True - True - False - - - False - True - - - - - - True - True - True - True - - - False - False - - - - - - True - Split File - pspp-split-file - - True - True - True - False - - - False - True - - - - - - True - Weight Cases - pspp-weight-cases - - True - True - True - False - - - False - True - - - - - - True - Select Cases - pspp-select-cases - - True - True - True - False - - - False - True - - - - - - True - True - True - True - - - False - False - - - - - - True - Value Labels - pspp-value-labels - - True - True - True - False - False - - - - False - True - - - - - - True - False - Use Sets - - True - True - True - False - - - False - True - - - - - - - 0 - False - False - - - - - - True - True - True - True - GTK_POS_BOTTOM - True - True - - - - True - False - 0 - - - - True - 1 - 2 - False - 0 - 0 - - - - True - True - True - True - 0 - - True - * - False - - - 1 - 2 - 0 - 1 - - - - - - - True - False - False - True - 0 - - True - * - False - 25 - - - 0 - 1 - 0 - 1 - fill - - - - - - 0 - False - False - - - - - - True - GTK_POLICY_ALWAYS - GTK_POLICY_ALWAYS - GTK_SHADOW_NONE - GTK_CORNER_TOP_LEFT - - - - True - psppire_data_sheet_create - 0 - 0 - Sun, 30 Oct 2005 08:53:47 GMT - - - - - 0 - True - True - - - - - False - True - - - - - - True - Data View - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - tab - - - - - - True - True - GTK_POLICY_ALWAYS - GTK_POLICY_ALWAYS - GTK_SHADOW_NONE - GTK_CORNER_TOP_LEFT - - - - True - psppire_variable_sheet_create - 0 - 0 - Sun, 30 Oct 2005 08:54:45 GMT - - - - - False - True - - - - - - True - Variable View - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - tab - - - - - 0 - True - True - - - - - - True - True - - - 0 - False - False - - - - - - False PSPPire @@ -1057,2206 +31,4 @@ pspplogo.png - - 6 - Variable Type - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - True - 485 - False - False - True - True - True - GDK_WINDOW_TYPE_HINT_DIALOG - GDK_GRAVITY_NORTH_WEST - True - False - - - - 5 - True - False - 5 - - - - 13 - True - True - 0 - - - - True - True - Numeric - True - GTK_RELIEF_NORMAL - True - True - False - True - - - 0 - False - False - - - - - - True - True - Comma - True - GTK_RELIEF_NORMAL - True - False - False - True - radiobutton1 - - - 0 - False - False - - - - - - True - True - Dot - True - GTK_RELIEF_NORMAL - True - False - False - True - radiobutton1 - - - 0 - False - False - - - - - - True - True - Scientific notation - True - GTK_RELIEF_NORMAL - True - False - False - True - radiobutton1 - - - 0 - False - False - - - - - - True - True - Date - True - GTK_RELIEF_NORMAL - True - False - False - True - radiobutton1 - - - 0 - False - False - - - - - - True - True - Dollar - True - GTK_RELIEF_NORMAL - True - False - False - True - radiobutton1 - - - 0 - False - False - - - - - - True - True - Custom currency - True - GTK_RELIEF_NORMAL - True - False - False - True - radiobutton1 - - - 0 - False - False - - - - - - True - True - String - True - GTK_RELIEF_NORMAL - True - False - False - True - radiobutton1 - - - 0 - False - False - - - - - 0 - False - False - - - - - - True - False - 10 - - - - 20 - 194 - True - GTK_POLICY_NEVER - GTK_POLICY_ALWAYS - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - False - False - False - True - False - False - False - - - - - 0 - False - False - - - - - - False - 15 - - - - 1 - 120 - True - True - GTK_POLICY_NEVER - GTK_POLICY_NEVER - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - False - False - False - True - False - False - False - - - - - 0 - True - True - - - - - - True - 0 - 0.5 - GTK_SHADOW_ETCHED_IN - - - - True - 0.5 - 0.5 - 1 - 1 - 0 - 0 - 12 - 0 - - - - True - True - 0 - - - - True - positive - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - True - True - - - - - - True - negative - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - True - True - - - - - - - - - - True - Sample - False - True - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - label_item - - - - - 0 - True - True - GTK_PACK_END - - - - - 0 - True - True - - - - - - True - GTK_POLICY_NEVER - GTK_POLICY_ALWAYS - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - False - False - False - True - False - False - False - - - - - 0 - True - True - - - - - - 100 - 50 - True - 2 - 2 - False - 1 - 2 - - - - True - Decimal Places: - False - False - GTK_JUSTIFY_RIGHT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 1 - 2 - fill - - - - - - - 25 - True - True - True - 0 - - True - * - False - - - 1 - 2 - 0 - 1 - - - - - - - 25 - True - True - True - True - 0 - - True - * - False - - - 1 - 2 - 1 - 2 - - - - - - - True - False - 0 - - - - True - Width: - False - False - GTK_JUSTIFY_RIGHT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - GTK_PACK_END - - - - - 0 - 1 - 0 - 1 - fill - fill - - - - - 0 - True - True - - - - - 0 - True - False - - - - - - True - GTK_BUTTONBOX_START - 5 - - - - True - True - True - gtk-ok - True - GTK_RELIEF_NORMAL - True - - - - - - True - True - True - gtk-cancel - True - GTK_RELIEF_NORMAL - True - - - - - - - True - True - True - gtk-help - True - GTK_RELIEF_NORMAL - True - - - - - 0 - True - True - - - - - - - - Value Labels - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - True - False - False - True - True - True - GDK_WINDOW_TYPE_HINT_DIALOG - GDK_GRAVITY_NORTH_WEST - True - False - - - - 5 - True - False - 0 - - - - True - 0 - 0.5 - GTK_SHADOW_ETCHED_IN - - - - 8 - True - 0.5 - 0.5 - 1 - 1 - 0 - 0 - 12 - 0 - - - - True - 2 - 2 - False - 5 - 0 - - - - 5 - True - GTK_BUTTONBOX_DEFAULT_STYLE - 0 - - - - True - False - True - True - gtk-add - True - GTK_RELIEF_NORMAL - True - - - - - - True - False - True - True - gtk-apply - True - GTK_RELIEF_NORMAL - True - - - - - - True - False - True - True - gtk-remove - True - GTK_RELIEF_NORMAL - True - - - - - 0 - 1 - 1 - 2 - fill - - - - - - 5 - True - 2 - 2 - False - 4 - 5 - - - - True - Value: - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 0 - 1 - fill - - - - - - - True - Value Label: - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 1 - 2 - fill - - - - - - - True - True - True - True - 0 - - True - * - False - - - 1 - 2 - 1 - 2 - - - - - - - True - False - 0 - - - - 85 - True - True - True - True - 0 - - True - * - False - - - 1 - False - False - - - - - 1 - 2 - 0 - 1 - fill - fill - - - - - 0 - 2 - 0 - 1 - fill - - - - - - True - True - GTK_POLICY_NEVER - GTK_POLICY_AUTOMATIC - GTK_SHADOW_ETCHED_IN - GTK_CORNER_TOP_LEFT - - - - True - True - False - False - False - False - False - False - False - - - - - 1 - 2 - 1 - 2 - fill - fill - - - - - - - - - - True - Value Labels - False - True - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - label_item - - - - - 10 - True - True - - - - - - 5 - True - GTK_BUTTONBOX_START - 5 - - - - True - True - True - gtk-ok - True - GTK_RELIEF_NORMAL - True - - - - - - - True - True - True - gtk-cancel - True - GTK_RELIEF_NORMAL - True - - - - - - - True - True - True - gtk-help - True - GTK_RELIEF_NORMAL - True - - - - - 0 - False - False - GTK_PACK_END - - - - - - - - 10 - Missing Values - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - True - False - False - True - True - True - GDK_WINDOW_TYPE_HINT_DIALOG - GDK_GRAVITY_NORTH_WEST - True - False - - - - True - 2 - 2 - False - 0 - 0 - - - - 5 - True - GTK_BUTTONBOX_START - 5 - - - - True - True - True - gtk-ok - True - GTK_RELIEF_NORMAL - True - - - - - - - True - True - True - gtk-cancel - True - GTK_RELIEF_NORMAL - True - - - - - - - True - True - True - gtk-help - True - GTK_RELIEF_NORMAL - True - - - - - 1 - 2 - 0 - 1 - - - - - - True - False - 12 - - - - True - True - _No missing values - True - GTK_RELIEF_NORMAL - True - True - False - True - - - 0 - False - False - - - - - - True - False - 0 - - - - True - True - _Discrete missing values - True - GTK_RELIEF_NORMAL - False - False - False - True - no_missing - - - 0 - False - False - - - - - - True - False - 0 - - - - 5 - True - True - 5 - - - - 75 - True - True - True - True - 0 - - True - * - False - - - 0 - False - False - - - - - - 75 - True - True - True - True - 0 - - True - * - False - - - 0 - False - False - - - - - - 75 - True - True - True - True - 0 - - True - * - False - - - 0 - False - False - - - - - 20 - True - True - - - - - 0 - True - True - - - - - 0 - False - False - - - - - 0 - 1 - 0 - 1 - fill - - - - - - True - False - 0 - - - - True - True - _Range plus one optional discrete missing value - True - GTK_RELIEF_NORMAL - False - False - False - True - no_missing - - - 0 - False - False - - - - - - True - False - 5 - - - - True - False - 0 - - - - True - False - 0 - - - - True - _Low: - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - mv-low - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 20 - False - False - - - - - - 75 - True - True - True - True - 0 - - True - * - False - - - 0 - False - True - - - - - 0 - True - True - - - - - - True - False - 0 - - - - True - _High: - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - mv-high - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - 75 - True - True - True - True - 0 - - True - * - False - - - 5 - True - True - - - - - 20 - True - False - - - - - - - - - - - - - 0 - True - True - - - - - - True - False - 0 - - - - True - Di_screte value: - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - mv-discrete - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 20 - False - False - - - - - - 75 - True - True - True - True - 0 - - True - * - False - - - 0 - False - True - - - - - 0 - True - True - - - - - 0 - True - True - - - - - 0 - 2 - 1 - 2 - fill - - - - - - - - Go To Case - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - True - False - False - True - True - True - GDK_WINDOW_TYPE_HINT_DIALOG - GDK_GRAVITY_NORTH_WEST - True - False - False - - - - True - False - 0 - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - gtk-ok - True - GTK_RELIEF_NORMAL - True - -5 - - - - - 0 - False - True - GTK_PACK_END - - - - - - True - False - 3 - - - - True - Case Number: - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - 50 - True - True - True - True - 0 - - True - * - False - - - 0 - True - True - - - - - 0 - True - True - - - - - - - - 10 - True - Sort Cases - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - True - True - False - True - True - True - GDK_WINDOW_TYPE_HINT_DIALOG - GDK_GRAVITY_NORTH_WEST - True - False - - - - True - False - 9 - - - - 10 - True - True - GTK_POLICY_NEVER - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - False - False - True - True - True - False - False - - - - - 0 - True - True - - - - - - True - 0.5 - 0.25 - 0.460000008345 - 0.0799999982119 - 0 - 0 - 0 - 0 - - - - True - True - GTK_RELIEF_NORMAL - True - - - - True - GTK_ARROW_RIGHT - GTK_SHADOW_OUT - 0.5 - 0.5 - 0 - 0 - - - - - - - 0 - True - True - - - - - - True - False - 4 - - - - 75 - True - 0 - 0.5 - GTK_SHADOW_ETCHED_IN - - - - 12 - 66 - True - True - 5 - - - - True - True - Ascending - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 0 - False - False - - - - - - True - True - Descending - True - GTK_RELIEF_NORMAL - True - False - False - True - sort-cases-button-ascending - - - 0 - False - False - - - - - - - - True - Sort Order - False - True - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - label_item - - - - - 0 - False - True - GTK_PACK_END - - - - - - True - False - 0 - - - - True - Sort by: - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - True - GTK_POLICY_NEVER - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - False - False - False - True - True - False - False - - - - - 0 - True - True - - - - - 0 - True - True - GTK_PACK_END - - - - - 0 - True - True - - - - - - True - GTK_BUTTONBOX_DEFAULT_STYLE - 0 - - - - True - True - True - gtk-ok - True - GTK_RELIEF_NORMAL - True - - - - - - True - False - True - True - gtk-paste - True - GTK_RELIEF_NORMAL - True - - - - - - True - True - True - gtk-refresh - True - GTK_RELIEF_NORMAL - True - - - - - - True - True - True - gtk-cancel - True - GTK_RELIEF_NORMAL - True - - - - - - True - True - True - gtk-help - True - GTK_RELIEF_NORMAL - True - - - - - 6 - True - False - - - - - - - - 640 - 480 - True - Psppire Syntax Editor - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - True - False - True - False - False - GDK_WINDOW_TYPE_HINT_NORMAL - GDK_GRAVITY_NORTH_WEST - True - False - - - - True - False - 0 - - - - True - GTK_PACK_DIRECTION_LTR - GTK_PACK_DIRECTION_LTR - - - - True - _File - True - - - - - - - True - gtk-new - True - - - - - - - True - _Syntax - True - - - - - - True - _Data - True - - - - - - - - - - True - gtk-open - True - - - - - - - True - _Syntax - True - - - - - - - True - _Data - True - - - - - - - - - - - True - gtk-save - True - - - - - - True - gtk-save-as - True - - - - - - True - - - - - - True - gtk-quit - True - - - - - - - - - - True - _Edit - True - - - - - - - True - gtk-cut - True - - - - - - True - gtk-copy - True - - - - - - True - gtk-paste - True - - - - - - True - gtk-delete - True - - - - - - - - - - True - _Run - True - - - - - - - True - All - True - - - - - - True - Selection - True - - - - - - True - Current Line - True - - - - - - True - To End - True - - - - - - - - - - True - _Help - True - - - - - - - True - _About - True - - - - - - - - - 0 - False - False - - - - - - True - True - GTK_POLICY_ALWAYS - GTK_POLICY_ALWAYS - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - True - False - True - GTK_JUSTIFY_LEFT - GTK_WRAP_NONE - True - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - 0 - True - True - - - - - - True - True - - - 0 - False - False - - - - - - diff --git a/src/ui/gui/syntax-editor-source.c b/src/ui/gui/syntax-editor-source.c index 53478d20..dcb644a3 100644 --- a/src/ui/gui/syntax-editor-source.c +++ b/src/ui/gui/syntax-editor-source.c @@ -52,7 +52,7 @@ name (const struct getl_interface *i) const struct syntax_editor_source *ses = (const struct syntax_editor_source *) i; - return ses->se->name; + return window_name ((struct window_editor *) ses->se); } diff --git a/src/ui/gui/syntax-editor.c b/src/ui/gui/syntax-editor.c index 20f6e1b0..05a4c885 100644 --- a/src/ui/gui/syntax-editor.c +++ b/src/ui/gui/syntax-editor.c @@ -28,8 +28,10 @@ #include #include #include "helper.h" +#include "data-editor.h" +#include "about.h" - +#include "window-manager.h" #include #include @@ -40,8 +42,6 @@ extern struct source_stream *the_source_stream ; extern struct lexer *the_lexer; extern struct dataset *the_dataset; -extern GladeXML *xml; - static gboolean save_editor_to_file (struct syntax_editor *se, const gchar *filename, GError **err); @@ -52,16 +52,17 @@ static gboolean save_editor_to_file (struct syntax_editor *se, static void save_if_modified (struct syntax_editor *se) { + struct editor_window *e = (struct editor_window *) se; if ( TRUE == gtk_text_buffer_get_modified (se->buffer)) { gint response; GtkWidget *dialog = - gtk_message_dialog_new (GTK_WINDOW(se->window), + gtk_message_dialog_new (GTK_WINDOW(e->window), GTK_DIALOG_MODAL, GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, _("Save contents of syntax editor to %s?"), - se->name ? se->name : _("Untitled") + e->name ? e->name : _("Untitled") ); gtk_dialog_add_button (GTK_DIALOG(dialog), @@ -83,7 +84,7 @@ save_if_modified (struct syntax_editor *se) { GError *err = NULL; - if ( ! save_editor_to_file (se, se->name ? se->name : _("Untitled"), + if ( ! save_editor_to_file (se, e->name ? e->name : _("Untitled"), &err) ) { msg (ME, err->message); @@ -95,7 +96,7 @@ save_if_modified (struct syntax_editor *se) return ; } - gtk_widget_destroy (se->window); + gtk_widget_destroy (e->window); } /* Callback for the File->SaveAs menuitem */ @@ -106,10 +107,11 @@ on_syntax_save_as (GtkMenuItem *menuitem, GtkFileFilter *filter; gint response; struct syntax_editor *se = user_data; + struct editor_window *e = user_data; GtkWidget *dialog = gtk_file_chooser_dialog_new (_("Save Syntax"), - GTK_WINDOW(se->window), + GTK_WINDOW(e->window), GTK_FILE_CHOOSER_ACTION_SAVE, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, @@ -138,8 +140,8 @@ on_syntax_save_as (GtkMenuItem *menuitem, if ( save_editor_to_file (se, filename, &err) ) { - g_free (se->name); - se->name = g_strdup (filename); + g_free (e->name); + e->name = g_strdup (filename); } else { @@ -159,13 +161,14 @@ on_syntax_save (GtkMenuItem *menuitem, gpointer user_data) { struct syntax_editor *se = user_data; + struct editor_window *e = user_data; - if ( se->name == NULL ) + if ( e->name == NULL ) on_syntax_save_as (menuitem, user_data); else { GError *err; - save_editor_to_file (se, se->name, &err); + save_editor_to_file (se, e->name, &err); msg (ME, err->message); g_error_free (err); } @@ -215,73 +218,86 @@ on_run_all (GtkMenuItem *menuitem, gpointer user_data) } -void -new_syntax_window (GtkMenuItem *menuitem, - gpointer user_data); - - - -static void open_syntax_window (GtkMenuItem *menuitem, - gpointer user_data); /* Create a new syntax editor with NAME. If NAME is NULL, a name will be automatically assigned */ -static struct syntax_editor * -new_syntax_editor (const gchar *name) +struct syntax_editor * +new_syntax_editor (void) { - GladeXML *new_xml ; + GladeXML *xml = + glade_xml_new (PKGDATADIR "/syntax-editor.glade", NULL, NULL); + GtkWidget *text_view; struct syntax_editor *se ; - - new_xml = glade_xml_new (xml->filename, "syntax_editor", NULL); + struct editor_window *e; se = g_malloc (sizeof (*se)); - se->window = get_widget_assert (new_xml, "syntax_editor"); - text_view = get_widget_assert (new_xml, "syntax_text_view"); + e = (struct editor_window *)se; + + e->window = get_widget_assert (xml, "syntax_editor"); + text_view = get_widget_assert (xml, "syntax_text_view"); se->buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW(text_view)); - if ( name ) - se->name = g_strdup (name); - else - se->name = NULL; - g_signal_connect (get_widget_assert (new_xml,"file_new_syntax"), + g_signal_connect (get_widget_assert (xml,"file_new_syntax"), "activate", G_CALLBACK(new_syntax_window), - se->window); + e->window); - g_signal_connect (get_widget_assert (new_xml,"file_open_syntax"), + g_signal_connect (get_widget_assert (xml,"file_open_syntax"), "activate", G_CALLBACK(open_syntax_window), - se->window); + e->window); - g_signal_connect (get_widget_assert (new_xml,"file_quit"), + g_signal_connect (get_widget_assert (xml,"file_new_data"), + "activate", + G_CALLBACK(new_data_window), + e->window); + + g_signal_connect (get_widget_assert (xml,"file_open_data"), + "activate", + G_CALLBACK(open_data_window), + e->window); + + + g_signal_connect (get_widget_assert (xml,"help_about"), + "activate", + G_CALLBACK(about_new), + e->window); + + +#if 0 + + g_signal_connect (get_widget_assert (xml,"file_quit"), "activate", G_CALLBACK(on_quit), se); - g_signal_connect (get_widget_assert (new_xml,"file_save"), + g_signal_connect (get_widget_assert (xml,"file_save"), "activate", G_CALLBACK(on_syntax_save), se); - g_signal_connect (get_widget_assert (new_xml,"file_save_as"), + g_signal_connect (get_widget_assert (xml,"file_save_as"), "activate", G_CALLBACK(on_syntax_save_as), se); +#endif - g_signal_connect (get_widget_assert (new_xml,"run_all"), + g_signal_connect (get_widget_assert (xml,"run_all"), "activate", G_CALLBACK(on_run_all), se); - g_object_unref (new_xml); - g_signal_connect (se->window, "delete-event", + + g_object_unref (xml); + + g_signal_connect (e->window, "delete-event", G_CALLBACK(on_delete), se); return se; @@ -294,25 +310,7 @@ void new_syntax_window (GtkMenuItem *menuitem, gpointer user_data) { - struct syntax_editor *se = new_syntax_editor (NULL); - gtk_widget_show (se->window); -} - - -static void -set_window_title_from_filename (struct syntax_editor *se, - const gchar *filename) -{ - gchar *title; - gchar *basename ; - g_free (se->name); - se->name = strdup (filename); - basename = g_path_get_basename (filename); - title = - g_strdup_printf (_("%s --- PSPP Syntax Editor"), basename); - g_free (basename); - gtk_window_set_title (GTK_WINDOW(se->window), title); - g_free (title); + window_create (WINDOW_SYNTAX, NULL); } @@ -347,7 +345,7 @@ save_editor_to_file (struct syntax_editor *se, if ( result ) { - set_window_title_from_filename (se, filename); + window_set_name_from_filename ((struct editor_window *) se, filename); gtk_text_buffer_set_modified (buffer, FALSE); } @@ -384,7 +382,7 @@ load_editor_from_file (struct syntax_editor *se, gtk_text_buffer_insert (buffer, &iter, text, -1); - set_window_title_from_filename (se, filename); + window_set_name_from_filename ((struct editor_window *)se, filename); gtk_text_buffer_set_modified (buffer, FALSE); return TRUE; @@ -392,7 +390,7 @@ load_editor_from_file (struct syntax_editor *se, /* Callback for the File->Open->Syntax menuitem */ -static void +void open_syntax_window (GtkMenuItem *menuitem, gpointer parent) { GtkFileFilter *filter; @@ -424,44 +422,16 @@ open_syntax_window (GtkMenuItem *menuitem, gpointer parent) const char *file_name = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)); - struct syntax_editor *se = new_syntax_editor (file_name); + struct syntax_editor *se = (struct syntax_editor *) + window_create (WINDOW_SYNTAX, file_name); load_editor_from_file (se, file_name, NULL); - - gtk_widget_show (se->window); } gtk_widget_destroy (dialog); } -#if 1 -/* FIXME: get rid of these functions */ -void -on_syntax4_activate (GtkMenuItem *menuitem, - gpointer user_data) -{ - g_print ("%s\n", __FUNCTION__); -} - - - -void -on_syntax2_activate (GtkMenuItem *menuitem, - gpointer user_data) -{ - g_print ("%s\n", __FUNCTION__); -} - -void -on_syntax1_activate (GtkMenuItem *menuitem, - gpointer user_data) -{ - g_print ("%s\n", __FUNCTION__); - new_syntax_window (menuitem, user_data); -} -#endif - diff --git a/src/ui/gui/syntax-editor.glade b/src/ui/gui/syntax-editor.glade new file mode 100644 index 00000000..62e409bd --- /dev/null +++ b/src/ui/gui/syntax-editor.glade @@ -0,0 +1,311 @@ + + + + + + + 640 + 480 + True + Psppire Syntax Editor + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + True + False + True + False + False + GDK_WINDOW_TYPE_HINT_NORMAL + GDK_GRAVITY_NORTH_WEST + True + False + + + + True + False + 0 + + + + True + GTK_PACK_DIRECTION_LTR + GTK_PACK_DIRECTION_LTR + + + + True + _File + True + + + + + + + True + gtk-new + True + + + + + + + True + _Syntax + True + + + + + + True + _Data + True + + + + + + + + + + True + gtk-open + True + + + + + + + True + _Syntax + True + + + + + + + True + _Data + True + + + + + + + + + + True + gtk-save + True + + + + + + True + gtk-save-as + True + + + + + + True + + + + + + True + gtk-quit + True + + + + + + + + + + True + False + _Edit + True + + + + + + + True + gtk-cut + True + + + + + + True + gtk-copy + True + + + + + + True + gtk-paste + True + + + + + + True + gtk-delete + True + + + + + + + + + + True + _Run + True + + + + + + + True + All + True + + + + + + True + False + Selection + True + + + + + + True + False + Current Line + True + + + + + + True + False + To End + True + + + + + + + + + + True + _Help + True + + + + + + + True + _About + True + + + + + + + + + 0 + False + False + + + + + + True + True + GTK_POLICY_ALWAYS + GTK_POLICY_ALWAYS + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + True + False + True + GTK_JUSTIFY_LEFT + GTK_WRAP_NONE + True + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + 0 + True + True + + + + + + True + True + + + 0 + False + False + + + + + + + diff --git a/src/ui/gui/syntax-editor.h b/src/ui/gui/syntax-editor.h index 038e1062..cfb49803 100644 --- a/src/ui/gui/syntax-editor.h +++ b/src/ui/gui/syntax-editor.h @@ -23,14 +23,20 @@ #include - +#include "window-manager.h" struct syntax_editor { - GtkWidget *window; /* The top level window of the editor */ + struct editor_window parent; GtkTextBuffer *buffer; /* The buffer which contains the text */ - gchar *name; /* The name of this syntax buffer/editor */ }; +struct syntax_editor * new_syntax_editor (void); + +void new_syntax_window (GtkMenuItem *, gpointer); + +void open_syntax_window (GtkMenuItem *, gpointer); + + #endif diff --git a/src/ui/gui/var-sheet.c b/src/ui/gui/var-sheet.c index b65c6e89..09e23b47 100644 --- a/src/ui/gui/var-sheet.c +++ b/src/ui/gui/var-sheet.c @@ -43,7 +43,6 @@ #include "psppire-var-store.h" #include "helper.h" -#include "menu-actions.h" #include "psppire-dict.h" #include "var-type-dialog.h" #include "var-sheet.h" @@ -57,7 +56,6 @@ static const gint n_initial_rows = 40; -extern GladeXML *xml; struct column_parameters { @@ -79,32 +77,15 @@ static const struct column_parameters column_def[] = { }; -static gboolean -click2row(GtkWidget *w, gint row, gpointer data) -{ - gint current_row, current_column; - GtkWidget *data_sheet = get_widget_assert(xml, "data_sheet"); - - select_sheet(PAGE_DATA_SHEET); - - gtk_sheet_get_active_cell(GTK_SHEET(data_sheet), - ¤t_row, ¤t_column); - - gtk_sheet_set_active_cell(GTK_SHEET(data_sheet), current_row, row); - - return FALSE; -} - - -const gchar *alignments[n_ALIGNMENTS + 1]={ +const gchar *const alignments[n_ALIGNMENTS + 1]={ N_("Left"), N_("Right"), N_("Centre"), 0 }; -const gchar *measures[n_MEASURES + 1]={ +const gchar *const measures[n_MEASURES + 1]={ N_("Nominal"), N_("Ordinal"), N_("Scale"), @@ -204,30 +185,44 @@ traverse_cell_callback (GtkSheet * sheet, } -/* Callback whenever the cell on the var sheet is entered or left. - It sets the entry box type appropriately. + + +/* + Callback whenever the cell on the var sheet is left */ -static gboolean -var_sheet_cell_change_entry (GtkSheet * sheet, gint row, gint column, - gpointer leaving) +static gboolean +var_sheet_cell_entry_leave (GtkSheet * sheet, gint row, gint column, + gpointer data) +{ + gtk_sheet_change_entry(sheet, GTK_TYPE_ENTRY); + return TRUE; +} + + + +/* + Callback whenever the cell on the var sheet is entered. +*/ +static gboolean +var_sheet_cell_entry_enter (GtkSheet * sheet, gint row, gint column, + gpointer data) { GtkSheetCellAttr attributes; PsppireVarStore *var_store ; struct variable *pv ; + GladeXML *xml; + g_return_val_if_fail(sheet != NULL, FALSE); - var_store = PSPPIRE_VAR_STORE(gtk_sheet_get_model(sheet)); + var_store = PSPPIRE_VAR_STORE (gtk_sheet_get_model(sheet)); + + g_assert (var_store); if ( row >= psppire_var_store_get_var_cnt(var_store)) return TRUE; - if ( leaving ) - { - gtk_sheet_change_entry(sheet, GTK_TYPE_ENTRY); - return TRUE; - } - + xml = glade_xml_new (PKGDATADIR "/data-editor.glade", NULL, NULL); gtk_sheet_get_attributes(sheet, row, column, &attributes); @@ -357,46 +352,44 @@ var_sheet_cell_change_entry (GtkSheet * sheet, gint row, gint column, const gchar *s = gtk_sheet_cell_get_text(sheet, row, column); - if (!s) - return FALSE; - - { - GtkSpinButton *spinButton ; - const gint current_value = atoi(s); - GtkObject *adj ; - - const struct fmt_spec *fmt = var_get_write_format (pv); - switch (column) - { - case COL_WIDTH: - r_min = MAX (fmt->d + 1, fmt_min_output_width (fmt->type)); - r_max = fmt_max_output_width (fmt->type); - break; - case COL_DECIMALS: - r_min = 0 ; - r_max = fmt_max_output_decimals (fmt->type, fmt->w); - break; - case COL_COLUMNS: - r_min = 1; - r_max = 255 ; /* Is this a sensible value ? */ - break; - default: - g_assert_not_reached(); - } - - adj = gtk_adjustment_new(current_value, - r_min, r_max, - 1.0, 1.0, 1.0 /* steps */ - ); - - gtk_sheet_change_entry(sheet, GTK_TYPE_SPIN_BUTTON); - - spinButton = - GTK_SPIN_BUTTON(gtk_sheet_get_entry(sheet)); - - gtk_spin_button_set_adjustment(spinButton, GTK_ADJUSTMENT(adj)); - gtk_spin_button_set_digits(spinButton, 0); - } + if (s) + { + GtkSpinButton *spinButton ; + const gint current_value = atoi(s); + GtkObject *adj ; + + const struct fmt_spec *fmt = var_get_write_format (pv); + switch (column) + { + case COL_WIDTH: + r_min = MAX (fmt->d + 1, fmt_min_output_width (fmt->type)); + r_max = fmt_max_output_width (fmt->type); + break; + case COL_DECIMALS: + r_min = 0 ; + r_max = fmt_max_output_decimals (fmt->type, fmt->w); + break; + case COL_COLUMNS: + r_min = 1; + r_max = 255 ; /* Is this a sensible value ? */ + break; + default: + g_assert_not_reached(); + } + + adj = gtk_adjustment_new(current_value, + r_min, r_max, + 1.0, 1.0, 1.0 /* steps */ + ); + + gtk_sheet_change_entry(sheet, GTK_TYPE_SPIN_BUTTON); + + spinButton = + GTK_SPIN_BUTTON(gtk_sheet_get_entry(sheet)); + + gtk_spin_button_set_adjustment(spinButton, GTK_ADJUSTMENT(adj)); + gtk_spin_button_set_digits(spinButton, 0); + } } } break; @@ -406,11 +399,14 @@ var_sheet_cell_change_entry (GtkSheet * sheet, gint row, gint column, break; } + + g_object_unref (xml); + return TRUE; } -extern PsppireVarStore *var_store; +extern PsppireVarStore *the_var_store; /* Create the var sheet */ @@ -426,25 +422,27 @@ psppire_variable_sheet_create (gchar *widget_name, GObject *geo = g_sheet_hetero_column_new(75, n_COLS); - sheet = gtk_sheet_new(G_SHEET_ROW(var_store), + g_assert (the_var_store); + + sheet = gtk_sheet_new(G_SHEET_ROW(the_var_store), G_SHEET_COLUMN(geo), "variable sheet", 0); + g_signal_connect (GTK_OBJECT (sheet), "activate", - GTK_SIGNAL_FUNC (var_sheet_cell_change_entry), + GTK_SIGNAL_FUNC (var_sheet_cell_entry_enter), 0); g_signal_connect (GTK_OBJECT (sheet), "deactivate", - GTK_SIGNAL_FUNC (var_sheet_cell_change_entry), - (void *) 1); + GTK_SIGNAL_FUNC (var_sheet_cell_entry_leave), + 0); g_signal_connect (GTK_OBJECT (sheet), "traverse", GTK_SIGNAL_FUNC (traverse_cell_callback), 0); - g_signal_connect (GTK_OBJECT (sheet), "double-click-row", - GTK_SIGNAL_FUNC (click2row), - sheet); + gtk_sheet_set_model(sheet, G_SHEET_MODEL(the_var_store)); + /* Since this happens inside glade_xml_new, we must prevent strings from * being re-encoded twice */ diff --git a/src/ui/gui/var-sheet.h b/src/ui/gui/var-sheet.h index 6a3d0a22..4cfe6847 100644 --- a/src/ui/gui/var-sheet.h +++ b/src/ui/gui/var-sheet.h @@ -51,11 +51,11 @@ GtkWidget* psppire_variable_sheet_create (gchar *widget_name, #define n_ALIGNMENTS 3 -extern const gchar *alignments[n_ALIGNMENTS + 1]; +extern const gchar *const alignments[n_ALIGNMENTS + 1]; #define n_MEASURES 3 -extern const gchar *measures[n_MEASURES + 1]; +extern const gchar *const measures[n_MEASURES + 1]; #endif diff --git a/src/ui/gui/var-type-dialog.c b/src/ui/gui/var-type-dialog.c index 56439568..7433b93e 100644 --- a/src/ui/gui/var-type-dialog.c +++ b/src/ui/gui/var-type-dialog.c @@ -325,7 +325,7 @@ set_format_type_from_treeview(GtkTreeView *treeview, gpointer data) /* Create the structure from the XML definitions */ struct var_type_dialog * -var_type_dialog_create(GladeXML *xml) +var_type_dialog_create (GladeXML *xml) { gint i; struct var_type_dialog *dialog = g_malloc(sizeof(struct var_type_dialog)); diff --git a/src/ui/gui/window-manager.c b/src/ui/gui/window-manager.c new file mode 100644 index 00000000..5fcf39df --- /dev/null +++ b/src/ui/gui/window-manager.c @@ -0,0 +1,133 @@ +#include "syntax-editor.h" +#include "data-editor.h" + +#include +#define _(msgid) gettext (msgid) +#define N_(msgid) msgid + + +#include "window-manager.h" + + +static int window_count = 0; + +static void +deregister (GtkObject *o, gpointer data) +{ + window_count --; + + if ( 0 == window_count ) + gtk_main_quit (); +}; + +static void set_window_name (struct editor_window *e, const gchar *name ); + + +struct editor_window * +window_create (enum window_type type, const gchar *name) +{ + struct editor_window *e; + switch (type) + { + case WINDOW_SYNTAX: + e = (struct editor_window *) new_syntax_editor (); + break; + case WINDOW_DATA: + e = (struct editor_window *) new_data_editor (); + break; + default: + g_assert_not_reached (); + }; + + e->type = type; + e->name = NULL; + + set_window_name (e, name); + + + gtk_window_set_icon_from_file (GTK_WINDOW(e->window), + PKGDATADIR "/psppicon.png", 0); + + g_signal_connect (e->window, "destroy", G_CALLBACK (deregister), NULL); + + gtk_widget_show (e->window); + + window_count ++; + + return e; +} + + +static void +set_window_name (struct editor_window *e, + const gchar *name ) +{ + gchar *title ; + g_free (e->name); + + + if ( name ) + { + e->name = g_strdup (name); + return ; + } + + switch (e->type ) + { + case WINDOW_SYNTAX: + e->name = g_strdup_printf (_("Syntax%d"), window_count); + title = g_strdup_printf (_("%s --- PSPP Syntax Editor"), e->name); + break; + case WINDOW_DATA: + e->name = g_strdup_printf (_("Untitled%d"), window_count); + title = g_strdup_printf (_("%s --- PSPP Data Editor"), e->name); + break; + default: + g_assert_not_reached (); + } + + gtk_window_set_title (GTK_WINDOW(e->window), title); + + g_free (title); +} + + +void +window_set_name_from_filename (struct editor_window *e, + const gchar *filename) +{ + gchar *title; + gchar *basename = g_path_get_basename (filename); + + set_window_name (e, filename); + + switch (e->type ) + { + case WINDOW_SYNTAX: + title = g_strdup_printf (_("%s --- PSPP Syntax Editor"), basename); + break; + case WINDOW_DATA: + title = g_strdup_printf (_("%s --- PSPP Data Editor"), basename); + break; + default: + g_assert_not_reached (); + } + g_free (basename); + + gtk_window_set_title (GTK_WINDOW(e->window), title); + + g_free (title); +} + + +GtkWindow * +window_toplevel (const struct editor_window *e) +{ + return GTK_WINDOW(e->window); +} + +const gchar * +window_name (const struct editor_window *e) +{ + return e->name; +} diff --git a/src/ui/gui/window-manager.h b/src/ui/gui/window-manager.h new file mode 100644 index 00000000..ee137dbc --- /dev/null +++ b/src/ui/gui/window-manager.h @@ -0,0 +1,31 @@ +#ifndef WINDOW_MANAGER_H +#define WINDOW_MANAGER_H + +#include + +enum window_type + { + WINDOW_DATA, + WINDOW_SYNTAX + }; + + +struct editor_window + { + GtkWidget *window; /* The top level window of the editor */ + gchar *name; /* The name of this editor */ + enum window_type type; + } ; + +struct editor_window * window_create (enum window_type type, + const gchar *name); + + +GtkWindow * window_toplevel (const struct editor_window *); + +const gchar * window_name (const struct editor_window *); + +void window_set_name_from_filename (struct editor_window *e, + const gchar *filename); + +#endif