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;
62 replace_dictionary (struct dictionary *d)
64 psppire_dict_replace_dictionary (the_data_store->dict, d);
69 replace_casereader (struct casereader *s)
71 struct datasheet *datasheet = datasheet_create (s);
73 psppire_case_file_replace_datasheet (the_data_store->case_file,
80 PsppireDict *dictionary = 0;
82 /* gtk_init messes with the locale.
83 So unset the bits we want to control ourselves */
84 setlocale (LC_NUMERIC, "C");
86 bindtextdomain (PACKAGE, locale_dir);
96 create_source_stream (
97 fn_getenv_default ("STAT_INCLUDE_PATH", include_path)
100 the_dataset = create_dataset (replace_casereader,
103 message_dialog_init (the_source_stream);
105 dictionary = psppire_dict_new_from_dict (
106 dataset_dict (the_dataset)
109 bind_textdomain_codeset (PACKAGE, "UTF-8");
112 /* Create the model for the var_sheet */
113 the_var_store = psppire_var_store_new (dictionary);
115 the_data_store = psppire_data_store_new (dictionary);
118 proc_set_active_file_data (the_dataset,
119 datasheet_make_reader (the_data_store->case_file->datasheet));
122 create_icon_factory ();
124 new_data_window (NULL, NULL);
131 destroy_source_stream (the_source_stream);
132 message_dialog_done ();
137 #define PIXBUF_NEW_FROM_FILE(FILE) \
138 gdk_pixbuf_new_from_file (relocate (PKGDATADIR "/" FILE), 0)
142 create_icon_factory (void)
144 GtkIconFactory *factory = gtk_icon_factory_new ();
146 GtkIconSet *icon_set;
150 pixbuf = PIXBUF_NEW_FROM_FILE ("value-labels.png");
151 icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
152 g_object_unref (pixbuf);
153 gtk_icon_factory_add ( factory, "pspp-value-labels", icon_set);
155 pixbuf = PIXBUF_NEW_FROM_FILE ("weight-cases.png");
156 icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
157 g_object_unref (pixbuf);
158 gtk_icon_factory_add ( factory, "pspp-weight-cases", icon_set);
160 pixbuf = PIXBUF_NEW_FROM_FILE ("goto-variable.png");
161 icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
162 g_object_unref (pixbuf);
163 gtk_icon_factory_add ( factory, "pspp-goto-variable", icon_set);
165 pixbuf = PIXBUF_NEW_FROM_FILE ("insert-variable.png");
166 icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
167 g_object_unref (pixbuf);
168 gtk_icon_factory_add ( factory, "pspp-insert-variable", icon_set);
170 pixbuf = PIXBUF_NEW_FROM_FILE ("insert-case.png");
171 icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
172 g_object_unref (pixbuf);
173 gtk_icon_factory_add ( factory, "pspp-insert-case", icon_set);
175 pixbuf = PIXBUF_NEW_FROM_FILE ("split-file.png");
176 icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
177 g_object_unref (pixbuf);
178 gtk_icon_factory_add ( factory, "pspp-split-file", icon_set);
180 pixbuf = PIXBUF_NEW_FROM_FILE ("select-cases.png");
181 icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
182 g_object_unref (pixbuf);
183 gtk_icon_factory_add ( factory, "pspp-select-cases", icon_set);
185 pixbuf = PIXBUF_NEW_FROM_FILE ("recent-dialogs.png");
186 icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
187 g_object_unref (pixbuf);
188 gtk_icon_factory_add ( factory, "pspp-recent-dialogs", icon_set);
190 pixbuf = PIXBUF_NEW_FROM_FILE ("nominal.png");
191 icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
192 g_object_unref (pixbuf);
193 gtk_icon_factory_add ( factory, "var-nominal", icon_set);
195 pixbuf = PIXBUF_NEW_FROM_FILE ("ordinal.png");
196 icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
197 g_object_unref (pixbuf);
198 gtk_icon_factory_add ( factory, "var-ordinal", icon_set);
200 pixbuf = PIXBUF_NEW_FROM_FILE ("scale.png");
201 icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
202 g_object_unref (pixbuf);
203 gtk_icon_factory_add ( factory, "var-scale", icon_set);
205 pixbuf = PIXBUF_NEW_FROM_FILE ("string.png");
206 icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
207 g_object_unref (pixbuf);
208 gtk_icon_factory_add ( factory, "var-string", icon_set);
210 pixbuf = PIXBUF_NEW_FROM_FILE ("date-scale.png");
211 icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
212 g_object_unref (pixbuf);
213 gtk_icon_factory_add ( factory, "var-date-scale", icon_set);
216 gtk_icon_factory_add_default (factory);