-/* psppire-data-store.c
-
- PSPPIRE --- A Graphical User Interface for PSPP
+/* 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
+ 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
+ the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
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. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include <string.h>
#define _(msgid) gettext (msgid)
#define N_(msgid) msgid
-#include <data/casewriter.h>
#include <data/datasheet.h>
#include <data/data-out.h>
#include <data/variable.h>
#include <data/value-labels.h>
#include <data/data-in.h>
-#include <data/file-handle-def.h>
-#include <data/sys-file-writer.h>
-
-
static void psppire_data_store_init (PsppireDataStore *data_store);
static void psppire_data_store_class_init (PsppireDataStoreClass *class);
return psppire_dict_get_var_cnt (store->dict);
}
+casenumber
+psppire_data_store_get_case_count (PsppireDataStore *store)
+{
+ return psppire_case_file_get_case_count (store->case_file);
+}
+
static gint
-psppire_data_store_get_case_count (const GSheetModel *model)
+psppire_data_store_get_case_count_from_model (const GSheetModel *model)
{
const PsppireDataStore *store = PSPPIRE_DATA_STORE (model);
}
+
+
static void
psppire_data_store_init (PsppireDataStore *data_store)
{
iface->get_font_desc = psppire_data_store_get_font_desc;
iface->get_cell_border = NULL;
iface->get_column_count = psppire_data_store_get_var_count;
- iface->get_row_count = psppire_data_store_get_case_count;
+ iface->get_row_count = psppire_data_store_get_case_count_from_model;
}
static
}
-
-/* FIXME: There's no reason to actually have this function.
- It should be done by a procedure */
-void
-psppire_data_store_create_system_file (PsppireDataStore *store,
- struct file_handle *handle)
-{
- gint i, var_cnt;
- const struct sfm_write_options wo = {
- true, /* writeable */
- false, /* dont compress */
- 3 /* version */
- };
-
- struct casewriter *writer;
-
- g_assert (handle);
-
- writer = sfm_open_writer (handle, store->dict->dict, wo);
-
- if ( ! writer)
- return;
-
-
- var_cnt = psppire_data_store_get_var_count (G_SHEET_MODEL (store));
-
- for (i = 0 ; i < psppire_case_file_get_case_count (store->case_file); ++i )
- {
- struct ccase c;
- psppire_case_file_get_case (store->case_file, i, &c);
- casewriter_write (writer, &c);
- }
- casewriter_destroy (writer);
-}
-
-
-
void
psppire_data_store_clear (PsppireDataStore *data_store)
{
}
+static gchar *
+geometry_get_column_subtitle (const GSheetColumn *geom, gint unit)
+{
+ gchar *text;
+ const struct variable *v ;
+ PsppireDataStore *ds = PSPPIRE_DATA_STORE (geom);
+
+ if ( unit >= psppire_dict_get_var_cnt (ds->dict) )
+ return NULL;
+
+ v = psppire_dict_get_variable (ds->dict, unit);
+
+ if ( ! var_has_label (v))
+ return NULL;
+
+ text = pspp_locale_to_utf8 (var_get_label (v), -1, 0);
+
+ return text;
+}
+
+
static gboolean
geometry_get_sensitivity (const GSheetColumn *geom, gint unit)
{
iface->get_sensitivity = geometry_get_sensitivity;
iface->get_justification = geometry_get_justification;
iface->get_button_label = geometry_get_column_button_label;
+ iface->get_subtitle = geometry_get_column_subtitle;
}
TRAILING_ROWS + psppire_case_file_get_case_count (ds->case_file))
return 0;
- s = g_strdup_printf (_("%d"), unit);
+ s = g_strdup_printf (_("%d"), unit + FIRST_CASE_NUMBER);
text = pspp_locale_to_utf8 (s, -1, 0);