/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 2008 Free Software Foundation, Inc.
+ Copyright (C) 2008, 2009 Free Software Foundation, Inc.
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
#include <language/syntax-string-source.h>
#include "psppire-data-store.h"
-#include <ui/gui/sheet/psppire-axis-impl.h>
+#include <libpspp/i18n.h>
+#include <ui/gui/sheet/psppire-axis.h>
#include "helper.h"
#include <gtk-contrib/gtkxpaned.h>
for (i = 0; i < 2; ++i)
{
- psppire_axis_impl_clear (de->vaxis[i]);
- psppire_axis_impl_append_n (de->vaxis[i], n_cases, DEFAULT_ROW_HEIGHT);
+ psppire_axis_clear (de->vaxis[i]);
+ psppire_axis_append_n (de->vaxis[i], n_cases, DEFAULT_ROW_HEIGHT);
}
}
PsppireDataEditor *de = PSPPIRE_DATA_EDITOR (data);
for (i = 0; i < 2; ++i)
- psppire_axis_impl_insert (de->vaxis[i], before, DEFAULT_ROW_HEIGHT);
+ psppire_axis_insert (de->vaxis[i], before, DEFAULT_ROW_HEIGHT);
}
PsppireDataEditor *de = PSPPIRE_DATA_EDITOR (data);
for (i = 0; i < 2; ++i)
- psppire_axis_impl_delete (de->vaxis[0], first, n_cases);
+ psppire_axis_delete (de->vaxis[0], first, n_cases);
}
PsppireDataEditor *de = PSPPIRE_DATA_EDITOR (data);
gint m_width = width_of_m (GTK_WIDGET (de));
- PsppireAxisImpl *vaxis;
+ PsppireAxis *vaxis;
g_object_get (de->var_sheet, "vertical-axis", &vaxis, NULL);
- psppire_axis_impl_clear (vaxis);
- psppire_axis_impl_append_n (vaxis, 1 + psppire_dict_get_var_cnt (dict), DEFAULT_ROW_HEIGHT);
+ psppire_axis_clear (vaxis);
+ psppire_axis_append_n (vaxis, 1 + psppire_dict_get_var_cnt (dict), DEFAULT_ROW_HEIGHT);
g_signal_connect_swapped (de->haxis, "resize-unit",
G_CALLBACK (rewidth_variable), de);
- psppire_axis_impl_clear (de->haxis);
+ psppire_axis_clear (de->haxis);
for (v = 0 ; v < psppire_dict_get_var_cnt (dict); ++v)
{
const struct variable *var = psppire_dict_get_variable (dict, v);
- psppire_axis_impl_append (de->haxis, m_width * var_get_display_width (var));
+ psppire_axis_append (de->haxis, m_width * var_get_display_width (var));
}
}
gint m_width = width_of_m (GTK_WIDGET (de));
- PsppireAxisImpl *var_vaxis;
+ PsppireAxis *var_vaxis;
const struct variable *var = psppire_dict_get_variable (dict, x);
g_object_get (de->var_sheet, "vertical-axis", &var_vaxis, NULL);
- psppire_axis_impl_insert (var_vaxis, x, DEFAULT_ROW_HEIGHT);
+ psppire_axis_insert (var_vaxis, x, DEFAULT_ROW_HEIGHT);
- psppire_axis_impl_insert (de->haxis, x, m_width * var_get_display_width (var));
+ psppire_axis_insert (de->haxis, x, m_width * var_get_display_width (var));
}
{
PsppireDataEditor *de = PSPPIRE_DATA_EDITOR (data);
- PsppireAxisImpl *var_vaxis;
+ PsppireAxis *var_vaxis;
g_object_get (de->var_sheet, "vertical-axis", &var_vaxis, NULL);
- psppire_axis_impl_delete (var_vaxis, posn, 1);
+ psppire_axis_delete (var_vaxis, posn, 1);
- psppire_axis_impl_delete (de->haxis, posn, 1);
+ psppire_axis_delete (de->haxis, posn, 1);
}
if ( var_width < 1 )
var_width = 1;
- psppire_axis_impl_resize (de->haxis, posn, m_width * var_width);
+ psppire_axis_resize (de->haxis, posn, m_width * var_width);
}
g_object_ref (de->data_store);
for (i = 0 ; i < 4 ; ++i )
- g_object_set (de->data_sheet[i],
- "model", de->data_store,
- NULL);
+ {
+ g_object_set (de->data_sheet[i],
+ "model", de->data_store,
+ NULL);
+
+ g_signal_connect_swapped (de->data_store->dict, "filter-changed",
+ G_CALLBACK (gtk_widget_queue_draw),
+ de->data_sheet[i]);
+ }
g_signal_connect (de->data_store->dict, "backend-changed",
G_CALLBACK (new_variables_callback), de);
object_class->set_property = psppire_data_editor_set_property;
object_class->get_property = psppire_data_editor_get_property;
+
+
data_store_spec =
g_param_spec_pointer ("data-store",
"Data Store",
gchar *text = g_strdup_printf ("%d: %s", row + FIRST_CASE_NUMBER,
var_get_name (var));
- gchar *s = pspp_locale_to_utf8 (text, -1, 0);
+ gchar *s = recode_string (UTF8,
+ psppire_dict_encoding (data_store->dict),
+ text, -1);
g_free (text);
static void
init_sheet (PsppireDataEditor *de, int i,
GtkAdjustment *hadj, GtkAdjustment *vadj,
- PsppireAxisImpl *vaxis,
- PsppireAxisImpl *haxis
+ PsppireAxis *vaxis,
+ PsppireAxis *haxis
)
{
de->sheet_bin[i] = gtk_scrolled_window_new (hadj, vadj);
GtkAdjustment *vadj1, *hadj1;
GtkWidget *sheet ;
- de->vaxis[0] = psppire_axis_impl_new ();
- de->vaxis[1] = psppire_axis_impl_new ();
+ de->vaxis[0] = psppire_axis_new ();
+ de->vaxis[1] = psppire_axis_new ();
- /* Txoxovhere's only one horizontal axis, since the
+ /* There's only one horizontal axis, since the
column widths are parameters of the variables */
- de->haxis = psppire_axis_impl_new ();
-
+ de->haxis = psppire_axis_new ();
de->split = TRUE;
de->paned = gtk_xpaned_new ();
G_CALLBACK (on_switch_page),
NULL);
+ g_object_set (de, "can-focus", FALSE, NULL);
g_signal_connect (de, "map", G_CALLBACK (on_map), NULL);
-
// psppire_sheet_hide_column_titles (de->var_sheet);
// psppire_sheet_hide_row_titles (de->data_sheet);
on_switch_page (PsppireDataEditor *de, GtkNotebookPage *p,
gint pagenum, gpointer data)
{
- if ( pagenum != PSPPIRE_DATA_EDITOR_DATA_VIEW )
+ switch (pagenum)
{
+ case PSPPIRE_DATA_EDITOR_DATA_VIEW:
+ gtk_widget_grab_focus (de->data_vbox);
+ on_select_range (de);
+ break;
+ case PSPPIRE_DATA_EDITOR_VARIABLE_VIEW:
+ gtk_widget_grab_focus (de->var_sheet);
emit_selected_signal (de);
- return TRUE;
- }
-
- on_select_range (de);
+ break;
+ default:
+ break;
+ };
return TRUE;
}
writer = autopaging_writer_create (dict_get_next_value_idx (clip_dict));
for (i = range.row0; i <= range.rowi ; ++i )
{
- struct ccase old;
-
- if (psppire_data_store_get_case (ds, i, &old))
- {
- struct ccase new;
-
- case_map_execute (map, &old, &new);
- case_destroy (&old);
- casewriter_write (writer, &new);
- }
+ struct ccase *old = psppire_data_store_get_case (ds, i);
+ if (old != NULL)
+ casewriter_write (writer, case_map_execute (map, old));
else
casewriter_force_error (writer);
}
for (r = 0 ; r < case_cnt ; ++r )
{
int c;
- struct ccase cc;
- if ( ! casereader_peek (clip_datasheet, r, &cc))
+ struct ccase *cc;
+
+ cc = casereader_peek (clip_datasheet, r);
+ if (cc == NULL)
{
g_warning ("Clipboard seems to have inexplicably shrunk");
break;
for (c = 0 ; c < var_cnt ; ++c)
{
const struct variable *v = dict_get_var (clip_dict, c);
- data_out_g_string (string, v, &cc);
+ data_out_g_string (string, v, cc);
if ( c < val_cnt - 1 )
g_string_append (string, "\t");
}
if ( r < case_cnt)
g_string_append (string, "\n");
- case_destroy (&cc);
+ case_unref (cc);
}
return string;
for (r = 0 ; r < case_cnt ; ++r )
{
int c;
- struct ccase cc;
- if ( ! casereader_peek (clip_datasheet, r, &cc))
+ struct ccase *cc = casereader_peek (clip_datasheet, r);
+ if (cc == NULL)
{
g_warning ("Clipboard seems to have inexplicably shrunk");
break;
{
const struct variable *v = dict_get_var (clip_dict, c);
g_string_append (string, "<td>");
- data_out_g_string (string, v, &cc);
+ data_out_g_string (string, v, cc);
g_string_append (string, "</td>\n");
}
g_string_append (string, "</tr>\n");
- case_destroy (&cc);
+ case_unref (cc);
}
g_string_append (string, "</table>\n");
g_signal_emit (de, data_editor_signals[DATA_AVAILABLE_CHANGED], 0,
compatible_target);
}
-
-