2 PSPPIRE --- A Graphical User Interface for PSPP
3 Copyright (C) 2004, 2005, 2006 Free Software Foundation
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 #include "relocatable.h"
27 #include "data-editor.h"
32 #include <data/casereader.h>
33 #include <data/datasheet.h>
34 #include <data/file-handle-def.h>
35 #include <data/format.h>
36 #include <data/settings.h>
37 #include <data/file-name.h>
38 #include <data/procedure.h>
39 #include <libpspp/getl.h>
40 #include <language/lexer/lexer.h>
41 #include <libpspp/version.h>
44 #include <glade/glade.h>
45 #include "psppire-dict.h"
46 #include "psppire-var-store.h"
47 #include "psppire-data-store.h"
49 #include "data-sheet.h"
50 #include "var-sheet.h"
51 #include "message-dialog.h"
53 PsppireDataStore *the_data_store = 0;
54 PsppireVarStore *the_var_store = 0;
56 static void create_icon_factory (void);
58 struct source_stream *the_source_stream ;
59 struct dataset * the_dataset = NULL;
63 replace_casereader (struct casereader *s)
65 PsppireCaseFile *pcf = psppire_case_file_new (s);
67 psppire_data_store_set_case_file (the_data_store, pcf);
73 PsppireDict *dictionary = 0;
75 /* gtk_init messes with the locale.
76 So unset the bits we want to control ourselves */
77 setlocale (LC_NUMERIC, "C");
79 bindtextdomain (PACKAGE, locale_dir);
89 create_source_stream (
90 fn_getenv_default ("STAT_INCLUDE_PATH", include_path)
93 the_dataset = create_dataset (NULL, NULL);
96 message_dialog_init (the_source_stream);
98 dictionary = psppire_dict_new_from_dict (dataset_dict (the_dataset));
101 bind_textdomain_codeset (PACKAGE, "UTF-8");
104 /* Create the model for the var_sheet */
105 the_var_store = psppire_var_store_new (dictionary);
107 the_data_store = psppire_data_store_new (dictionary);
108 replace_casereader (NULL);
111 create_icon_factory ();
113 new_data_window (NULL, NULL);
120 destroy_source_stream (the_source_stream);
121 message_dialog_done ();
126 #define PIXBUF_NEW_FROM_FILE(FILE) \
127 gdk_pixbuf_new_from_file (relocate (PKGDATADIR "/" FILE), 0)
131 create_icon_factory (void)
133 GtkIconFactory *factory = gtk_icon_factory_new ();
135 GtkIconSet *icon_set;
139 pixbuf = PIXBUF_NEW_FROM_FILE ("value-labels.png");
140 icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
141 g_object_unref (pixbuf);
142 gtk_icon_factory_add ( factory, "pspp-value-labels", icon_set);
144 pixbuf = PIXBUF_NEW_FROM_FILE ("weight-cases.png");
145 icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
146 g_object_unref (pixbuf);
147 gtk_icon_factory_add ( factory, "pspp-weight-cases", icon_set);
149 pixbuf = PIXBUF_NEW_FROM_FILE ("goto-variable.png");
150 icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
151 g_object_unref (pixbuf);
152 gtk_icon_factory_add ( factory, "pspp-goto-variable", icon_set);
154 pixbuf = PIXBUF_NEW_FROM_FILE ("insert-variable.png");
155 icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
156 g_object_unref (pixbuf);
157 gtk_icon_factory_add ( factory, "pspp-insert-variable", icon_set);
159 pixbuf = PIXBUF_NEW_FROM_FILE ("insert-case.png");
160 icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
161 g_object_unref (pixbuf);
162 gtk_icon_factory_add ( factory, "pspp-insert-case", icon_set);
164 pixbuf = PIXBUF_NEW_FROM_FILE ("split-file.png");
165 icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
166 g_object_unref (pixbuf);
167 gtk_icon_factory_add ( factory, "pspp-split-file", icon_set);
169 pixbuf = PIXBUF_NEW_FROM_FILE ("select-cases.png");
170 icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
171 g_object_unref (pixbuf);
172 gtk_icon_factory_add ( factory, "pspp-select-cases", icon_set);
174 pixbuf = PIXBUF_NEW_FROM_FILE ("recent-dialogs.png");
175 icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
176 g_object_unref (pixbuf);
177 gtk_icon_factory_add ( factory, "pspp-recent-dialogs", icon_set);
179 pixbuf = PIXBUF_NEW_FROM_FILE ("nominal.png");
180 icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
181 g_object_unref (pixbuf);
182 gtk_icon_factory_add ( factory, "var-nominal", icon_set);
184 pixbuf = PIXBUF_NEW_FROM_FILE ("ordinal.png");
185 icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
186 g_object_unref (pixbuf);
187 gtk_icon_factory_add ( factory, "var-ordinal", icon_set);
189 pixbuf = PIXBUF_NEW_FROM_FILE ("scale.png");
190 icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
191 g_object_unref (pixbuf);
192 gtk_icon_factory_add ( factory, "var-scale", icon_set);
194 pixbuf = PIXBUF_NEW_FROM_FILE ("string.png");
195 icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
196 g_object_unref (pixbuf);
197 gtk_icon_factory_add ( factory, "var-string", icon_set);
199 pixbuf = PIXBUF_NEW_FROM_FILE ("date-scale.png");
200 icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
201 g_object_unref (pixbuf);
202 gtk_icon_factory_add ( factory, "var-date-scale", icon_set);
205 gtk_icon_factory_add_default (factory);