From: John Darrington Date: Thu, 26 Apr 2007 09:57:51 +0000 (+0000) Subject: More eye candy. X-Git-Tag: v0.6.0~477 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ee08e284e9722ddc0fb785c5f9af09bcb6fa8a47;p=pspp-builds.git More eye candy. --- diff --git a/src/data/ChangeLog b/src/data/ChangeLog index 1a3e1f22..99793d35 100644 --- a/src/data/ChangeLog +++ b/src/data/ChangeLog @@ -1,3 +1,9 @@ +2007-04-19 John Darrington + + * sys-file-reader.c: When reading a system file which has no + long name table, automatically create one where the long names + are the lower case versions of the short names. + 2007-04-22 Ben Pfaff * dictionary.c (dict_set_split_vars): dict_destroy expects that diff --git a/src/ui/gui/ChangeLog b/src/ui/gui/ChangeLog index 6a2b717c..812fdce8 100644 --- a/src/ui/gui/ChangeLog +++ b/src/ui/gui/ChangeLog @@ -1,3 +1,12 @@ +2007-04-25 John Darrington + + * icons/scalable/splash.c icons/splash.png : More eye candy. + + * main.c psppire.h : new files. + + * psppire.c : Seperated the command line parsing and other + environment startup from the core psppire code. + 2007-04-25 John Darrington * icons/scalable icons/16x16: new directories. diff --git a/src/ui/gui/about.c b/src/ui/gui/about.c index 91572586..b6c02203 100644 --- a/src/ui/gui/about.c +++ b/src/ui/gui/about.c @@ -27,6 +27,8 @@ #include "about.h" #include "helper.h" +const static gchar *artists[] = { "Patrick Brunier", "Dondi Bogusky", NULL}; + void about_new (GtkMenuItem *m, GtkWindow *parent) { @@ -53,6 +55,9 @@ about_new (GtkMenuItem *m, GtkWindow *parent) gtk_about_dialog_set_authors (GTK_ABOUT_DIALOG (about), (const gchar **) authors); + gtk_about_dialog_set_artists (GTK_ABOUT_DIALOG (about), + artists); + gtk_window_set_transient_for (GTK_WINDOW (about), parent); gtk_window_set_modal (GTK_WINDOW (about), TRUE); diff --git a/src/ui/gui/automake.mk b/src/ui/gui/automake.mk index 122cd3b9..2f4d884d 100644 --- a/src/ui/gui/automake.mk +++ b/src/ui/gui/automake.mk @@ -64,7 +64,8 @@ dist_src_ui_gui_psppire_DATA = \ $(top_srcdir)/src/ui/gui/icons/16x16/ordinal.png \ $(top_srcdir)/src/ui/gui/icons/16x16/scale.png \ $(top_srcdir)/src/ui/gui/icons/16x16/string.png \ - $(top_srcdir)/src/ui/gui/icons/16x16/date-scale.png + $(top_srcdir)/src/ui/gui/icons/16x16/date-scale.png \ + $(top_srcdir)/src/ui/gui/icons/splash.png src_ui_gui_psppire_SOURCES = \ @@ -84,9 +85,11 @@ src_ui_gui_psppire_SOURCES = \ src/ui/gui/dict-display.h \ src/ui/gui/flexifile-factory.h \ src/ui/gui/flexifile-factory.c \ + src/ui/gui/main.c \ src/ui/gui/message-dialog.c \ src/ui/gui/message-dialog.h \ src/ui/gui/psppire.c \ + src/ui/gui/psppire.h \ src/ui/gui/helper.c \ src/ui/gui/helper.h \ src/ui/gui/missing-val-dialog.c \ diff --git a/src/ui/gui/icons/scalable/splash.svg b/src/ui/gui/icons/scalable/splash.svg new file mode 100644 index 00000000..ca95aa14 --- /dev/null +++ b/src/ui/gui/icons/scalable/splash.svg @@ -0,0 +1,513 @@ + + +image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +GNU + + \ No newline at end of file diff --git a/src/ui/gui/icons/splash.png b/src/ui/gui/icons/splash.png new file mode 100644 index 00000000..168980b3 Binary files /dev/null and b/src/ui/gui/icons/splash.png differ diff --git a/src/ui/gui/main.c b/src/ui/gui/main.c new file mode 100644 index 00000000..002d576a --- /dev/null +++ b/src/ui/gui/main.c @@ -0,0 +1,185 @@ +/* + 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 "psppire.h" +#include "progname.h" +#include +#include + +#include +#include + +static gboolean parse_command_line (int *argc, char ***argv, gchar **filename, + gboolean *show_splash, GError **err); + + + +static GtkWidget * +create_splash_window (void) +{ + GtkWidget *splash ; + GtkWidget *image; + + gtk_window_set_auto_startup_notification (FALSE); + + splash = gtk_window_new (GTK_WINDOW_POPUP); + + gtk_window_set_position (GTK_WINDOW (splash), + GTK_WIN_POS_CENTER_ALWAYS); + + image = gtk_image_new_from_file (PKGDATADIR "/splash.png"); + + gtk_container_add (GTK_CONTAINER (splash), image); + + gtk_widget_show (image); + + return splash; +} + +static gboolean +hide_splash_window (gpointer data) +{ + GtkWidget *splash = data; + gtk_widget_hide (splash); + gtk_window_set_auto_startup_notification (TRUE); + return FALSE; +} + + +static gboolean +quit_one_loop (gpointer data) +{ + gtk_main_quit (); + return FALSE; +} + + +static gboolean +run_inner_loop (gpointer data) +{ + initialize (); + + g_timeout_add (500, hide_splash_window, data); + + gtk_main (); + + de_initialize (); + + return FALSE; +} + + + +int +main (int argc, char *argv[]) +{ + GtkWidget *splash_window; + gchar *filename = 0; + gboolean show_splash = TRUE; + GError *err = 0; + gchar *vers; + + set_program_name (argv[0]); + + if ( ! gtk_parse_args (&argc, &argv) ) + { + perror ("Error parsing arguments"); + exit (1); + } + + if ( (vers = gtk_check_version (GTK_MAJOR_VERSION, + GTK_MINOR_VERSION, + GTK_MICRO_VERSION)) ) + { + g_critical (vers); + } + + /* Deal with options like --version, --help etc */ + if ( ! parse_command_line (&argc, &argv, &filename, &show_splash, &err) ) + { + g_clear_error (&err); + return 0; + } + + gdk_init (&argc, &argv); + + splash_window = create_splash_window (); + if ( show_splash ) + gtk_widget_show (splash_window); + + gtk_idle_add (quit_one_loop, 0); + + gtk_quit_add (0, run_inner_loop, splash_window); + gtk_main (); + + + return 0; +} + + +/* Parses the command line specified by ARGC and ARGV as received by + main (). Returns true if normal execution should proceed, + false if the command-line indicates that PSPP should exit. */ +static gboolean +parse_command_line (int *argc, char ***argv, gchar **filename, + gboolean *show_splash, GError **err) +{ + + static struct option long_options[] = + { + {"help", no_argument, NULL, 'h'}, + {"version", no_argument, NULL, 'V'}, + {"no-splash", no_argument, NULL, 'q'}, + {0, 0, 0, 0}, + }; + + int c; + + for (;;) + { + c = getopt_long (*argc, *argv, "hVq", long_options, NULL); + if (c == -1) + break; + + switch (c) + { + case 'h': + g_print ("Usage: psppire {|--help|--version|--no-splash}\n"); + return FALSE; + case 'V': + g_print (version); + g_print ("\n"); + g_print (legal); + return FALSE; + case 'q': + *show_splash = FALSE; + break; + default: + return FALSE; + } + } + + if ( optind < *argc) + { + *filename = (*argv)[optind]; + } + + return TRUE; +} diff --git a/src/ui/gui/psppire.c b/src/ui/gui/psppire.c index dc912a2f..84489c07 100644 --- a/src/ui/gui/psppire.c +++ b/src/ui/gui/psppire.c @@ -22,13 +22,13 @@ #include #include -#include "progname.h" #include "relocatable.h" #include "data-editor.h" -#include -#include +#include "psppire.h" + + #include #include #include @@ -39,9 +39,8 @@ #include #include #include +#include -#include -#include #include #include #include "psppire-dict.h" @@ -57,12 +56,14 @@ PsppireDataStore *the_data_store = 0; static bool parse_command_line (int *argc, char ***argv, - gchar **filename, GError **err); + gchar **filename, + gboolean *show_splash, + GError **err); PsppireVarStore *the_var_store = 0; -void create_icon_factory (void); +static void create_icon_factory (void); struct source_stream *the_source_stream ; struct dataset * the_dataset = NULL; @@ -70,8 +71,7 @@ struct dataset * the_dataset = NULL; static void replace_dictionary (struct dictionary *d) { - psppire_dict_replace_dictionary (the_data_store->dict, - d); + psppire_dict_replace_dictionary (the_data_store->dict, d); } @@ -93,32 +93,13 @@ replace_flexifile (struct case_source *s) } -int -main (int argc, char *argv[]) + +void +initialize (void) { struct casefile_factory *factory; PsppireDict *dictionary = 0; - gchar *filename=0; - GError *err = 0; - gchar *vers; - - set_program_name (argv[0]); - - if ( ! gtk_parse_args (&argc, &argv) ) - { - perror ("Error parsing arguments"); - exit (1); - } - - if ( (vers = gtk_check_version (GTK_MAJOR_VERSION, - GTK_MINOR_VERSION, - GTK_MICRO_VERSION)) ) - { - g_critical (vers); - } - - /* gtk_init messes with the locale. So unset the bits we want to control ourselves */ setlocale (LC_NUMERIC, "C"); @@ -127,19 +108,14 @@ main (int argc, char *argv[]) textdomain (PACKAGE); - if ( ! parse_command_line (&argc, &argv, &filename, &err) ) - { - g_clear_error (&err); - return 0; - } - glade_init (); fmt_init (); settings_init (); fh_init (); factory = flexifile_factory_create (); - the_source_stream = create_source_stream ( + the_source_stream = + create_source_stream ( fn_getenv_default ("STAT_INCLUDE_PATH", include_path) ); @@ -155,7 +131,6 @@ main (int argc, char *argv[]) bind_textdomain_codeset (PACKAGE, "UTF-8"); - gdk_init (&argc, &argv); /* Create the model for the var_sheet */ the_var_store = psppire_var_store_new (dictionary); @@ -170,68 +145,23 @@ main (int argc, char *argv[]) create_icon_factory (); new_data_window (NULL, NULL); +} - /* start the event loop */ - gtk_main (); +void +de_initialize (void) +{ destroy_source_stream (the_source_stream); message_dialog_done (); - settings_done (); - - return 0; } -/* Parses the command line specified by ARGC and ARGV as received by - main (). Returns true if normal execution should proceed, - false if the command-line indicates that PSPP should exit. */ -static bool -parse_command_line (int *argc, char ***argv, gchar **filename, GError **err) -{ - static struct option long_options[] = - { - {"help", no_argument, NULL, 'h'}, - {"version", no_argument, NULL, 'V'}, - {0, 0, 0, 0}, - }; - - int c; - - for (;;) - { - c = getopt_long (*argc, *argv, "hV", long_options, NULL); - if (c == -1) - break; - - switch (c) - { - case 'h': - g_print ("Usage: psppire {|--help|--version}\n"); - return false; - case 'V': - g_print (version); - g_print ("\n"); - g_print (legal); - return false; - default: - return false; - } - } - - if ( optind < *argc) - { - *filename = (*argv)[optind]; - } - - return true; -} - #define PIXBUF_NEW_FROM_FILE(FILE) \ gdk_pixbuf_new_from_file (relocate (PKGDATADIR "/" FILE), 0) -void +static void create_icon_factory (void) { GtkIconFactory *factory = gtk_icon_factory_new (); @@ -306,7 +236,6 @@ create_icon_factory (void) gtk_icon_factory_add ( factory, "var-date-scale", icon_set); - gtk_icon_factory_add_default (factory); } diff --git a/src/ui/gui/psppire.glade b/src/ui/gui/psppire.glade index b35f6c1a..a436b6c7 100644 --- a/src/ui/gui/psppire.glade +++ b/src/ui/gui/psppire.glade @@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - Patrick Brunier + pspplogo.png @@ -250,25 +250,36 @@ 5 5 - - True - 5 - - - - - - - - + True - 5 + + + True + 0 + Name Variable: + + + False + False + + + + + True + + + False + False + 1 + + + 1 + 2 1 2 - - GTK_FILL + @@ -321,35 +332,24 @@ - + True - - - True - 0 - Name Variable: - - - False - False - - - - - True - - - False - False - 1 - - + 5 - 1 - 2 1 2 + + GTK_FILL + + + + + True + 5 + + + diff --git a/src/ui/gui/psppire.h b/src/ui/gui/psppire.h new file mode 100644 index 00000000..90e64189 --- /dev/null +++ b/src/ui/gui/psppire.h @@ -0,0 +1,27 @@ +/* + 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. */ + +#ifndef PSPPIRE_H +#define PSPPIRE_H + + +void initialize (void); +void de_initialize (void); + +#endif /* PSPPIRE_H */