From: John Darrington Date: Sun, 14 Dec 2008 03:20:25 +0000 (+0900) Subject: Rename gsheetmodel to psppiresheetmodel X-Git-Tag: v0.7.1~34 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=55c723d6462035523940e90892debcfdf872ff57;p=pspp-builds.git Rename gsheetmodel to psppiresheetmodel --- diff --git a/lib/gtksheet/automake.mk b/lib/gtksheet/automake.mk index 25775238..9758a3ea 100644 --- a/lib/gtksheet/automake.mk +++ b/lib/gtksheet/automake.mk @@ -11,8 +11,8 @@ nodist_lib_gtksheet_libgtksheet_a_SOURCES = \ lib/gtksheet/psppire-marshal.h lib_gtksheet_libgtksheet_a_SOURCES = \ - lib/gtksheet/gsheetmodel.c \ - lib/gtksheet/gsheetmodel.h \ + lib/gtksheet/psppire-sheetmodel.c \ + lib/gtksheet/psppire-gsheetmodel.h \ lib/gtksheet/gtkextra-sheet.h \ lib/gtksheet/gtksheet.c \ lib/gtksheet/gtksheet.h \ diff --git a/lib/gtksheet/gsheetmodel.c b/lib/gtksheet/gsheetmodel.c deleted file mode 100644 index 26a6be62..00000000 --- a/lib/gtksheet/gsheetmodel.c +++ /dev/null @@ -1,543 +0,0 @@ -/* GSheetModel --- an abstract model for the GSheet widget. - * Copyright (C) 2006 Free Software Foundation - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include - -#include -#include "gsheetmodel.h" -#include - -enum { - RANGE_CHANGED, - ROWS_INSERTED, - ROWS_DELETED, - COLUMNS_INSERTED, - COLUMNS_DELETED, - LAST_SIGNAL -}; - -static guint sheet_model_signals[LAST_SIGNAL] = { 0 }; - - -static void g_sheet_model_base_init (gpointer g_class); - - -GType -g_sheet_model_get_type (void) -{ - static GType sheet_model_type = 0; - - if (! sheet_model_type) - { - static const GTypeInfo sheet_model_info = - { - sizeof (GSheetModelIface), /* class_size */ - g_sheet_model_base_init, /* base_init */ - NULL, /* base_finalize */ - NULL, - NULL, /* class_finalize */ - NULL, /* class_data */ - 0, - 0, /* n_preallocs */ - NULL - }; - - sheet_model_type = - g_type_register_static (G_TYPE_INTERFACE, "GSheetModel", - &sheet_model_info, 0); - - g_type_interface_add_prerequisite (sheet_model_type, G_TYPE_OBJECT); - } - - return sheet_model_type; -} - -static void -g_sheet_model_base_init (gpointer g_class) -{ - static gboolean initialized = FALSE; - - if (! initialized) - { - sheet_model_signals[RANGE_CHANGED] = - g_signal_new ("range_changed", - G_TYPE_SHEET_MODEL, - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GSheetModelIface, range_changed), - NULL, NULL, - psppire_marshal_VOID__INT_INT_INT_INT, - G_TYPE_NONE, 4, - G_TYPE_INT, - G_TYPE_INT, - G_TYPE_INT, - G_TYPE_INT); - - - - sheet_model_signals[ROWS_INSERTED] = - g_signal_new ("rows_inserted", - G_TYPE_SHEET_MODEL, - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GSheetModelIface, rows_inserted), - NULL, NULL, - psppire_marshal_VOID__INT_INT, - G_TYPE_NONE, 2, - G_TYPE_INT, - G_TYPE_INT); - - - sheet_model_signals[ROWS_DELETED] = - g_signal_new ("rows_deleted", - G_TYPE_SHEET_MODEL, - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GSheetModelIface, rows_deleted), - NULL, NULL, - psppire_marshal_VOID__INT_INT, - G_TYPE_NONE, 2, - G_TYPE_INT, - G_TYPE_INT); - - sheet_model_signals[COLUMNS_INSERTED] = - g_signal_new ("columns_inserted", - G_TYPE_SHEET_MODEL, - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GSheetModelIface, columns_inserted), - NULL, NULL, - psppire_marshal_VOID__INT_INT, - G_TYPE_NONE, 2, - G_TYPE_INT, - G_TYPE_INT); - - - sheet_model_signals[COLUMNS_DELETED] = - g_signal_new ("columns_deleted", - G_TYPE_SHEET_MODEL, - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GSheetModelIface, columns_deleted), - NULL, NULL, - psppire_marshal_VOID__INT_INT, - G_TYPE_NONE, 2, - G_TYPE_INT, - G_TYPE_INT); - - - initialized = TRUE; - } -} - - -/** - * g_sheet_model_free_strings - * @sheet_model: A #GSheetModel - * - * Returns: True if strings obtained with get_string should be freed by the - * sheet when no longer required. - **/ -gboolean -g_sheet_model_free_strings (const GSheetModel *sheet_model) -{ - g_return_val_if_fail (G_IS_SHEET_MODEL (sheet_model), FALSE); - - return G_SHEET_MODEL_GET_IFACE (sheet_model)->free_strings; -} - - -/** - * g_sheet_model_get_string: - * @sheet_model: A #GSheetModel - * @row: The row of the cell to be retrieved. - * @column: The column of the cell to be retrieved. - * - * Retrieves the datum at location ROW, COLUMN in the form of a string. - * Returns: The string representation of the datum, or NULL on error. - **/ -gchar * -g_sheet_model_get_string (const GSheetModel *sheet_model, - glong row, glong column) -{ - g_return_val_if_fail (G_IS_SHEET_MODEL (sheet_model), 0); - - g_assert (G_SHEET_MODEL_GET_IFACE (sheet_model)->get_string); - - return (G_SHEET_MODEL_GET_IFACE (sheet_model)->get_string) (sheet_model, row, column); -} - -/** - * g_sheet_model_set_string - * @sheet_model: A #GSheetModel - * @text: The text describing the datum to be set. - * @row: The row of the cell to be cleared. - * @column: The column of the cell to be cleared. - * - * Sets the datum at a location from a string. - * Returns: TRUE if the datum was changed, FALSE otherwise. - **/ -gboolean -g_sheet_model_set_string (GSheetModel *sheet_model, - const gchar *text, - glong row, glong column) -{ - g_return_val_if_fail (G_IS_SHEET_MODEL (sheet_model), FALSE); - - g_assert (G_SHEET_MODEL_GET_IFACE (sheet_model)->set_string); - - return G_SHEET_MODEL_GET_IFACE (sheet_model)->set_string (sheet_model, - text, row, column); -} - - - -/** - * g_sheet_model_datum_clear: - * @sheet_model: A #GSheetModel - * @row: The row of the cell to be cleared. - * @column: The column of the cell to be cleared. - * - * Called when the datum at a location is to be cleared. - * Returns: TRUE if the datum was cleared, FALSE otherwise. - **/ -gboolean -g_sheet_model_datum_clear (GSheetModel *sheet_model, - glong row, glong column) -{ - g_return_val_if_fail (G_IS_SHEET_MODEL (sheet_model), FALSE); - - g_assert (G_SHEET_MODEL_GET_IFACE (sheet_model)->clear_datum); - - return G_SHEET_MODEL_GET_IFACE (sheet_model)->clear_datum (sheet_model, - row, column); -} - - -/** - * g_sheet_model_range_changed: - * @sheet_model: A #GSheetModel - * @range: The #GSheetRange range of cells which have changed. - * - * Emits the "range_changed" signal on @sheet_model. - **/ -void -g_sheet_model_range_changed (GSheetModel *sheet_model, - glong row0, glong col0, - glong rowi, glong coli) -{ - g_return_if_fail (G_IS_SHEET_MODEL (sheet_model)); - - g_signal_emit (sheet_model, sheet_model_signals[RANGE_CHANGED], 0, - row0, col0, rowi, coli); -} - - - - -/** - * g_sheet_model_rows_inserted: - * @sheet_model: A #GSheetModel - * @row: The row before which the new rows should be inserted. - * @n_rows: The number of rows to insert. - * - * Emits the "rows_inserted" signal on @sheet_model. - **/ -void -g_sheet_model_rows_inserted (GSheetModel *sheet_model, - glong row, glong n_rows) -{ - g_return_if_fail (G_IS_SHEET_MODEL (sheet_model)); - - g_signal_emit (sheet_model, sheet_model_signals[ROWS_INSERTED], 0, - row, n_rows); -} - - -/** - * g_sheet_model_columns_inserted: - * @sheet_model: A #GSheetModel - * @column: The column before which the new columns should be inserted. - * @n_columns: The number of columns to insert. - * - * Emits the "columns_inserted" signal on @sheet_model. - **/ -void -g_sheet_model_columns_inserted (GSheetModel *sheet_model, - glong column, glong n_columns) -{ - g_return_if_fail (G_IS_SHEET_MODEL (sheet_model)); - - g_signal_emit (sheet_model, sheet_model_signals[COLUMNS_INSERTED], 0, - column, n_columns); -} - - - - -/** - * g_sheet_model_rows_deleted: - * @sheet_model: A #GSheetModel - * @row: The first row to be deleted. - * @n_rows: The number of rows to delete. - * - * Emits the "rows_deleted" signal on @sheet_model. - **/ -void -g_sheet_model_rows_deleted (GSheetModel *sheet_model, - glong row, glong n_rows) -{ - g_return_if_fail (G_IS_SHEET_MODEL (sheet_model)); - - g_signal_emit (sheet_model, sheet_model_signals[ROWS_DELETED], 0, - row, n_rows); -} - - - -/** - * g_sheet_model_columns_deleted: - * @sheet_model: A #GSheetModel - * @column: The first column to be deleted. - * @n_columns: The number of columns to delete. - * - * Emits the "columns_deleted" signal on @sheet_model. - **/ -void -g_sheet_model_columns_deleted (GSheetModel *sheet_model, - glong column, glong n_columns) -{ - g_return_if_fail (G_IS_SHEET_MODEL (sheet_model)); - - g_signal_emit (sheet_model, sheet_model_signals[COLUMNS_DELETED], 0, - column, n_columns); -} - - - - - -/** - * g_sheet_model_is_editable: - * @sheet_model: A #GSheetModel - * @row: The row - * @column: The column - * - * Returns: TRUE if the cell is editable, FALSE otherwise - **/ -gboolean -g_sheet_model_is_editable (const GSheetModel *model, - glong row, glong column) -{ - g_return_val_if_fail (G_IS_SHEET_MODEL (model), TRUE); - - if ( ! G_SHEET_MODEL_GET_IFACE (model)->is_editable ) - return TRUE; - - return G_SHEET_MODEL_GET_IFACE (model)->is_editable (model, - row, column); -} - - -/** - * g_sheet_model_get_foreground: - * @sheet_model: A #GSheetModel - * @row: The row - * @column: The column - * - * Returns the foreground colour of the cell at @row, @column - * The color is unallocated. It will be allocated by the viewing object. - **/ -GdkColor * -g_sheet_model_get_foreground (const GSheetModel *model, - glong row, glong column) -{ - g_return_val_if_fail (G_IS_SHEET_MODEL (model), NULL); - - if ( ! G_SHEET_MODEL_GET_IFACE (model)->get_foreground ) - return NULL; - - return G_SHEET_MODEL_GET_IFACE (model)->get_foreground (model, - row, column); -} - -/** - * g_sheet_model_get_background: - * @sheet_model: A #GSheetModel - * @row: The row - * @column: The column - * - * Returns the background colour of the cell at @row, @column - * The color is unallocated. It will be allocated by the viewing object. - **/ -GdkColor * -g_sheet_model_get_background (const GSheetModel *model, - glong row, glong column) -{ - g_return_val_if_fail (G_IS_SHEET_MODEL (model), NULL); - - if ( ! G_SHEET_MODEL_GET_IFACE (model)->get_background ) - return NULL; - - return G_SHEET_MODEL_GET_IFACE (model)->get_background (model, - row, column); -} - -/** - * g_sheet_model_get_justification: - * @sheet_model: A #GSheetModel - * @row: The row - * @column: The column - * - * Returns the justification of the cell at @row, @column - * Returns: the justification, or NULL on error. - **/ -const GtkJustification * -g_sheet_model_get_justification (const GSheetModel *model, - glong row, glong column) -{ - g_return_val_if_fail (G_IS_SHEET_MODEL (model), NULL); - - if ( ! G_SHEET_MODEL_GET_IFACE (model)->get_justification) - return NULL; - - return G_SHEET_MODEL_GET_IFACE (model)->get_justification (model, - row, column); -} - - -/** - * g_sheet_model_get_column_count: - * @model: A #GSheetModel - * - * Returns the total number of columns represented by the model - **/ -glong -g_sheet_model_get_column_count (const GSheetModel *model) -{ - g_return_val_if_fail (G_IS_SHEET_MODEL (model), -1); - - return G_SHEET_MODEL_GET_IFACE (model)->get_column_count (model); -} - -/** - * g_sheet_model_get_row_count: - * @model: A #GSheetModel - * - * Returns the total number of rows represented by the model - **/ -gint -g_sheet_model_get_row_count(const GSheetModel *model) -{ - g_return_val_if_fail (G_IS_SHEET_MODEL (model), -1); - - return G_SHEET_MODEL_GET_IFACE (model)->get_row_count (model); -} - - - -/* Column related functions */ -gboolean -g_sheet_model_get_column_sensitivity (const GSheetModel *model, gint col) -{ - g_return_val_if_fail (G_IS_SHEET_MODEL (model), FALSE); - - if ( NULL == G_SHEET_MODEL_GET_IFACE (model)->get_column_sensitivity) - return TRUE; - - return G_SHEET_MODEL_GET_IFACE (model)->get_column_sensitivity (model, col); -} - - -gchar * -g_sheet_model_get_column_subtitle (const GSheetModel *model, - gint col) -{ - g_return_val_if_fail (G_IS_SHEET_MODEL (model), NULL); - g_return_val_if_fail (col >= 0, NULL); - - if ( NULL == G_SHEET_MODEL_GET_IFACE (model)->get_column_subtitle) - return NULL; - - return G_SHEET_MODEL_GET_IFACE (model)->get_column_subtitle (model, col); -} - - -GtkSheetButton * -g_sheet_model_get_column_button (const GSheetModel *model, - gint col) -{ - GtkSheetButton *button = gtk_sheet_button_new (); - - g_return_val_if_fail (G_IS_SHEET_MODEL (model), NULL); - - if ( G_SHEET_MODEL_GET_IFACE (model)->get_column_title) - button->label = G_SHEET_MODEL_GET_IFACE (model)->get_column_title (model, col); - - return button; -} - -GtkJustification -g_sheet_model_get_column_justification (const GSheetModel *model, - gint col) -{ - g_return_val_if_fail (G_IS_SHEET_MODEL (model), GTK_JUSTIFY_LEFT); - - if ( G_SHEET_MODEL_GET_IFACE (model)->get_column_justification) - return G_SHEET_MODEL_GET_IFACE (model)->get_column_justification (model, col); - - return GTK_JUSTIFY_LEFT; -} - - - -gboolean -g_sheet_model_get_row_sensitivity (const GSheetModel *model, gint row) -{ - g_return_val_if_fail (G_IS_SHEET_MODEL (model), FALSE); - - if ( NULL == G_SHEET_MODEL_GET_IFACE (model)->get_row_sensitivity) - return TRUE; - - return G_SHEET_MODEL_GET_IFACE (model)->get_row_sensitivity (model, row); -} - - - -gchar * -g_sheet_model_get_row_subtitle (const GSheetModel *model, - gint row) -{ - g_return_val_if_fail (G_IS_SHEET_MODEL (model), NULL); - - if ( NULL == G_SHEET_MODEL_GET_IFACE (model)->get_row_subtitle) - return NULL; - - return G_SHEET_MODEL_GET_IFACE (model)->get_row_subtitle (model, row); -} - - -GtkSheetButton * -g_sheet_model_get_row_button (const GSheetModel *model, - gint row) -{ - GtkSheetButton *button = gtk_sheet_button_new (); - - g_return_val_if_fail (G_IS_SHEET_MODEL (model), NULL); - - if ( G_SHEET_MODEL_GET_IFACE (model)->get_row_title) - button->label = G_SHEET_MODEL_GET_IFACE (model)->get_row_title (model, row); - - return button; -} - diff --git a/lib/gtksheet/gsheetmodel.h b/lib/gtksheet/gsheetmodel.h deleted file mode 100644 index 6a54d7e8..00000000 --- a/lib/gtksheet/gsheetmodel.h +++ /dev/null @@ -1,226 +0,0 @@ -/* GSheetModel --- an abstract model for the GtkSheet widget. - * Copyright (C) 2006 Free Software Foundation - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef __G_SHEET_MODEL_H__ -#define __G_SHEET_MODEL_H__ - - -/* This file provides an abstract interface or the data displayed by the - GtkSheet widget */ - -#include -#include -#include -#include "gtkextra-sheet.h" - -G_BEGIN_DECLS - -#define G_TYPE_SHEET_MODEL (g_sheet_model_get_type ()) -#define G_SHEET_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_SHEET_MODEL, GSheetModel)) -#define G_IS_SHEET_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_SHEET_MODEL)) -#define G_SHEET_MODEL_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_SHEET_MODEL, GSheetModelIface)) - -typedef enum -{ - GTK_SHEET_LEFT_BORDER = 1 << 0, - GTK_SHEET_RIGHT_BORDER = 1 << 1, - GTK_SHEET_TOP_BORDER = 1 << 2, - GTK_SHEET_BOTTOM_BORDER = 1 << 3 -} GtkSheetBorderType ; - - -typedef struct _GSheetModel GSheetModel; /* Dummy typedef */ -typedef struct _GSheetModelIface GSheetModelIface; -typedef struct _GtkSheetRange GtkSheetRange; -typedef struct _GtkSheetCellBorder GtkSheetCellBorder; - -struct _GtkSheetRange -{ - gint row0, col0; /* upper-left cell */ - gint rowi, coli; /* lower-right cell */ -}; - -struct _GtkSheetCellBorder -{ - GtkSheetBorderType mask; - guint width; - GdkLineStyle line_style; - GdkCapStyle cap_style; - GdkJoinStyle join_style; - GdkColor color; -}; - - - -struct _GSheetModelIface -{ - GTypeInterface g_iface; - - gboolean free_strings; - - /* Signals */ - void (* range_changed) (GSheetModel *sheet_model, - glong row0, glong col0, - glong rowi, glong coli); - - void (* rows_inserted) (GSheetModel *sheet_model, - glong row, glong n_rows); - - void (* rows_deleted) (GSheetModel *sheet_model, - glong row, glong n_rows); - - void (* columns_inserted) (GSheetModel *sheet_model, - glong column, glong n_columns); - - void (* columns_deleted) (GSheetModel *sheet_model, - glong column, glong n_columns); - - - - - - - /* Virtual Table */ - - gchar * (* get_string) (const GSheetModel *sheet_model, - glong row, glong column); - - gboolean (* set_string) (GSheetModel *sheet_model, - const gchar *s, glong row, glong column); - - gboolean (* clear_datum) (GSheetModel *sheet_model, - glong row, glong column); - - gboolean (* is_editable) (const GSheetModel *sheet_model, glong row, glong column); - - GdkColor * (* get_foreground) (const GSheetModel *sheet_model, - glong row, glong column); - - GdkColor * (* get_background) (const GSheetModel *sheet_model, - glong row, glong column); - - const GtkJustification * (* get_justification) (const GSheetModel *sheet_model, - glong row, glong column); - - /* column related metadata */ - - gchar * (*get_column_title) (const GSheetModel *, gint col); - gchar * (*get_column_subtitle) (const GSheetModel *, gint col); - gboolean (*get_column_sensitivity) (const GSheetModel *, gint col); - GtkJustification (*get_column_justification) (const GSheetModel *mode, gint col); - const GtkSheetButton * (* get_button) (const GSheetModel *model, gint col); - - glong (*get_column_count) (const GSheetModel *model); - - - /* row related metadata */ - gchar * (*get_row_title) (const GSheetModel *, gint row); - gchar * (*get_row_subtitle) (const GSheetModel *, gint row); - glong (*get_row_count) (const GSheetModel *model); - gboolean (*get_row_sensitivity) (const GSheetModel *, gint row); -}; - - - -GType g_sheet_model_get_type (void) G_GNUC_CONST; - - -gchar * g_sheet_model_get_string (const GSheetModel *sheet_model, - glong row, glong column); - -gboolean g_sheet_model_set_string (GSheetModel *sheet_model, - const gchar *s, - glong row, glong column); - -gboolean g_sheet_model_datum_clear (GSheetModel *sheet_model, - glong row, glong column); - - -void g_sheet_model_range_changed (GSheetModel *sheet_model, - glong row0, glong col0, - glong rowi, glong coli); - -void g_sheet_model_rows_deleted (GSheetModel *sheet_model, - glong row, glong n_rows); - -void g_sheet_model_rows_inserted (GSheetModel *sheet_model, - glong row, glong n_rows); - -void g_sheet_model_columns_inserted (GSheetModel *sheet_model, - glong column, glong n_columns); - -void g_sheet_model_columns_deleted (GSheetModel *sheet_model, - glong column, glong n_columns); - - -gboolean g_sheet_model_is_editable (const GSheetModel *model, - glong row, glong column); - -gboolean g_sheet_model_is_visible - (const GSheetModel *model, glong row, glong column); - - -GdkColor *g_sheet_model_get_foreground - (const GSheetModel *model, glong row, glong column); - -GdkColor *g_sheet_model_get_background - (const GSheetModel *model, glong row, glong column); - -const GtkJustification *g_sheet_model_get_justification - (const GSheetModel *model, glong row, glong column); - -const GtkSheetCellBorder * g_sheet_model_get_cell_border - (const GSheetModel *model, glong row, glong column); - -gboolean g_sheet_model_free_strings (const GSheetModel *sheet_model); - -glong g_sheet_model_get_column_count (const GSheetModel *sheet_model); - -gint g_sheet_model_get_row_count (const GSheetModel *sheet_model); - - - -gboolean g_sheet_model_get_column_sensitivity (const GSheetModel *model, - gint col); - -gchar * g_sheet_model_get_column_subtitle (const GSheetModel *model, - gint col); - -GtkSheetButton * g_sheet_model_get_column_button (const GSheetModel *, gint); - -GtkJustification g_sheet_model_get_column_justification (const GSheetModel *, - gint); - - - -gboolean g_sheet_model_get_row_sensitivity (const GSheetModel *model, - gint row); - - -gchar * g_sheet_model_get_row_subtitle (const GSheetModel *model, - gint row); - - -GtkSheetButton * g_sheet_model_get_row_button (const GSheetModel *, gint); - - - - -G_END_DECLS - -#endif /* __G_SHEET_MODEL_H__ */ diff --git a/lib/gtksheet/gtksheet.c b/lib/gtksheet/gtksheet.c index ec49e499..977d3bbc 100644 --- a/lib/gtksheet/gtksheet.c +++ b/lib/gtksheet/gtksheet.c @@ -54,7 +54,7 @@ #include #include "gtksheet.h" #include -#include "gsheetmodel.h" +#include "psppire-sheetmodel.h" #include #include @@ -107,12 +107,12 @@ static GtkStateType gtk_sheet_cell_get_state (GtkSheet *sheet, gint row, gint co static inline void dispose_string (const GtkSheet *sheet, gchar *text) { - GSheetModel *model = gtk_sheet_get_model (sheet); + PsppireSheetModel *model = gtk_sheet_get_model (sheet); if ( ! model ) return; - if (g_sheet_model_free_strings (model)) + if (psppire_sheet_model_free_strings (model)) g_free (text); } @@ -1173,14 +1173,14 @@ redraw_range (GtkSheet *sheet, GtkSheetRange *range) /* Callback which occurs whenever columns are inserted / deleted in the model */ static void -columns_inserted_deleted_callback (GSheetModel *model, gint first_column, +columns_inserted_deleted_callback (PsppireSheetModel *model, gint first_column, gint n_columns, gpointer data) { GtkSheet *sheet = GTK_SHEET (data); GtkSheetRange range; - gint model_columns = g_sheet_model_get_column_count (model); + gint model_columns = psppire_sheet_model_get_column_count (model); /* Need to update all the columns starting from the first column and onwards. @@ -1208,14 +1208,14 @@ columns_inserted_deleted_callback (GSheetModel *model, gint first_column, /* Callback which occurs whenever rows are inserted / deleted in the model */ static void -rows_inserted_deleted_callback (GSheetModel *model, gint first_row, +rows_inserted_deleted_callback (PsppireSheetModel *model, gint first_row, gint n_rows, gpointer data) { GtkSheet *sheet = GTK_SHEET (data); GtkSheetRange range; - gint model_rows = g_sheet_model_get_row_count (model); + gint model_rows = psppire_sheet_model_get_row_count (model); /* Need to update all the rows starting from the first row and onwards. * Previous rows are unchanged, so don't need to be updated. @@ -1240,7 +1240,7 @@ rows_inserted_deleted_callback (GSheetModel *model, gint first_row, If col0 or coli are negative, then all columns will be updated. */ static void -range_update_callback (GSheetModel *m, gint row0, gint col0, +range_update_callback (PsppireSheetModel *m, gint row0, gint col0, gint rowi, gint coli, gpointer data) { GtkSheet *sheet = GTK_SHEET (data); @@ -1295,7 +1295,7 @@ range_update_callback (GSheetModel *m, gint row0, gint col0, * Returns: the new sheet widget */ GtkWidget * -gtk_sheet_new (GSheetModel *model) +gtk_sheet_new (PsppireSheetModel *model) { GtkWidget *widget = g_object_new (GTK_TYPE_SHEET, "model", model, @@ -1313,7 +1313,7 @@ gtk_sheet_new (GSheetModel *model) * */ void -gtk_sheet_set_model (GtkSheet *sheet, GSheetModel *model) +gtk_sheet_set_model (GtkSheet *sheet, PsppireSheetModel *model) { g_return_if_fail (GTK_IS_SHEET (sheet)); @@ -2321,7 +2321,7 @@ gtk_sheet_set_cell (GtkSheet *sheet, gint row, gint col, GtkJustification justification, const gchar *text) { - GSheetModel *model ; + PsppireSheetModel *model ; gchar *old_text ; g_return_if_fail (sheet != NULL); @@ -2335,16 +2335,16 @@ gtk_sheet_set_cell (GtkSheet *sheet, gint row, gint col, model = gtk_sheet_get_model (sheet); - old_text = g_sheet_model_get_string (model, row, col); + old_text = psppire_sheet_model_get_string (model, row, col); if (0 != safe_strcmp (old_text, text)) { g_signal_handler_block (sheet->model, sheet->update_handler_id); - g_sheet_model_set_string (model, text, row, col); + psppire_sheet_model_set_string (model, text, row, col); g_signal_handler_unblock (sheet->model, sheet->update_handler_id); } - if ( g_sheet_model_free_strings (model)) + if ( psppire_sheet_model_free_strings (model)) g_free (old_text); } @@ -2374,13 +2374,13 @@ gtk_sheet_cell_clear (GtkSheet *sheet, gint row, gint column) static void gtk_sheet_real_cell_clear (GtkSheet *sheet, gint row, gint column) { - GSheetModel *model = gtk_sheet_get_model (sheet); + PsppireSheetModel *model = gtk_sheet_get_model (sheet); gchar *old_text = gtk_sheet_cell_get_text (sheet, row, column); if (old_text && strlen (old_text) > 0 ) { - g_sheet_model_datum_clear (model, row, column); + psppire_sheet_model_datum_clear (model, row, column); } dispose_string (sheet, old_text); @@ -2389,7 +2389,7 @@ gtk_sheet_real_cell_clear (GtkSheet *sheet, gint row, gint column) gchar * gtk_sheet_cell_get_text (const GtkSheet *sheet, gint row, gint col) { - GSheetModel *model; + PsppireSheetModel *model; g_return_val_if_fail (sheet != NULL, NULL); g_return_val_if_fail (GTK_IS_SHEET (sheet), NULL); @@ -2402,7 +2402,7 @@ gtk_sheet_cell_get_text (const GtkSheet *sheet, gint row, gint col) if ( !model ) return NULL; - return g_sheet_model_get_string (model, row, col); + return psppire_sheet_model_get_string (model, row, col); } @@ -2719,7 +2719,7 @@ gtk_sheet_show_entry_widget (GtkSheet *sheet) gtk_sheet_size_allocate_entry (sheet); gtk_widget_set_sensitive (GTK_WIDGET (sheet_entry), - g_sheet_model_is_editable (sheet->model, + psppire_sheet_model_is_editable (sheet->model, row, col)); gtk_widget_map (sheet->entry_widget); } @@ -3220,7 +3220,7 @@ gtk_sheet_button_press (GtkWidget *widget, sheet_signals[BUTTON_EVENT_COLUMN], 0, column, event); - if (g_sheet_model_get_column_sensitivity (sheet->model, column)) + if (psppire_sheet_model_get_column_sensitivity (sheet->model, column)) { if ( event->type == GDK_2BUTTON_PRESS && event->button == 1) g_signal_emit (sheet, @@ -3233,7 +3233,7 @@ gtk_sheet_button_press (GtkWidget *widget, sheet_signals[BUTTON_EVENT_ROW], 0, row, event); - if (g_sheet_model_get_row_sensitivity (sheet->model, row)) + if (psppire_sheet_model_get_row_sensitivity (sheet->model, row)) { if ( event->type == GDK_2BUTTON_PRESS && event->button == 1) g_signal_emit (sheet, @@ -3369,7 +3369,7 @@ gtk_sheet_button_press (GtkWidget *widget, column = column_from_xpixel (sheet, x); - if (g_sheet_model_get_column_sensitivity (sheet->model, column)) + if (psppire_sheet_model_get_column_sensitivity (sheet->model, column)) { veto = gtk_sheet_click_cell (sheet, -1, column); gtk_grab_add (GTK_WIDGET (sheet)); @@ -3386,7 +3386,7 @@ gtk_sheet_button_press (GtkWidget *widget, y += sheet->vadjustment->value; row = row_from_ypixel (sheet, y); - if (g_sheet_model_get_row_sensitivity (sheet->model, row)) + if (psppire_sheet_model_get_row_sensitivity (sheet->model, row)) { veto = gtk_sheet_click_cell (sheet, row, -1); gtk_grab_add (GTK_WIDGET (sheet)); @@ -3723,7 +3723,7 @@ motion_timeout_callback (gpointer data) { if (sheet->row_title_under && row >= 0) { - gchar *text = g_sheet_model_get_row_subtitle (sheet->model, row); + gchar *text = psppire_sheet_model_get_row_subtitle (sheet->model, row); show_subtitle (sheet, row, -1, text); g_free (text); @@ -3731,7 +3731,7 @@ motion_timeout_callback (gpointer data) if (sheet->column_title_under && column >= 0) { - gchar *text = g_sheet_model_get_column_subtitle (sheet->model, + gchar *text = psppire_sheet_model_get_column_subtitle (sheet->model, column); show_subtitle (sheet, -1, column, text); @@ -4793,7 +4793,7 @@ draw_column_title_buttons_range (GtkSheet *sheet, gint first, gint last) gboolean is_sensitive = FALSE; GtkSheetButton * - button = g_sheet_model_get_column_button (sheet->model, col); + button = psppire_sheet_model_get_column_button (sheet->model, col); allocation.y = 0; allocation.x = psppire_axis_start_pixel (sheet->haxis, col) + CELL_SPACING; @@ -4801,7 +4801,7 @@ draw_column_title_buttons_range (GtkSheet *sheet, gint first, gint last) allocation.height = sheet->column_title_area.height; allocation.width = psppire_axis_unit_size (sheet->haxis, col); - is_sensitive = g_sheet_model_get_column_sensitivity (sheet->model, col); + is_sensitive = psppire_sheet_model_get_column_sensitivity (sheet->model, col); draw_button (sheet, sheet->column_title_window, button, is_sensitive, allocation); @@ -4842,7 +4842,7 @@ draw_row_title_buttons_range (GtkSheet *sheet, gint first, gint last) gboolean is_sensitive = FALSE; GtkSheetButton *button = - g_sheet_model_get_row_button (sheet->model, row); + psppire_sheet_model_get_row_button (sheet->model, row); allocation.x = 0; allocation.y = psppire_axis_start_pixel (sheet->vaxis, row) + CELL_SPACING; @@ -4850,7 +4850,7 @@ draw_row_title_buttons_range (GtkSheet *sheet, gint first, gint last) allocation.width = sheet->row_title_area.width; allocation.height = psppire_axis_unit_size (sheet->vaxis, row); - is_sensitive = g_sheet_model_get_row_sensitivity (sheet->model, row); + is_sensitive = psppire_sheet_model_get_row_sensitivity (sheet->model, row); draw_button (sheet, sheet->row_title_window, button, is_sensitive, allocation); @@ -5201,17 +5201,17 @@ gtk_sheet_get_attributes (const GtkSheet *sheet, gint row, gint col, attr->border.mask = 0; attr->border.color = GTK_WIDGET (sheet)->style->black; - attr->is_editable = g_sheet_model_is_editable (sheet->model, row, col); + attr->is_editable = psppire_sheet_model_is_editable (sheet->model, row, col); colormap = gtk_widget_get_colormap (GTK_WIDGET (sheet)); - fg = g_sheet_model_get_foreground (sheet->model, row, col); + fg = psppire_sheet_model_get_foreground (sheet->model, row, col); if ( fg ) { gdk_colormap_alloc_color (colormap, fg, TRUE, TRUE); attr->foreground = *fg; } - bg = g_sheet_model_get_background (sheet->model, row, col); + bg = psppire_sheet_model_get_background (sheet->model, row, col); if ( bg ) { gdk_colormap_alloc_color (colormap, bg, TRUE, TRUE); @@ -5219,9 +5219,9 @@ gtk_sheet_get_attributes (const GtkSheet *sheet, gint row, gint col, } attr->justification = - g_sheet_model_get_column_justification (sheet->model, col); + psppire_sheet_model_get_column_justification (sheet->model, col); - j = g_sheet_model_get_justification (sheet->model, row, col); + j = psppire_sheet_model_get_justification (sheet->model, row, col); if (j) attr->justification = *j; @@ -5267,7 +5267,7 @@ gtk_sheet_forall (GtkContainer *container, } -GSheetModel * +PsppireSheetModel * gtk_sheet_get_model (const GtkSheet *sheet) { g_return_val_if_fail (GTK_IS_SHEET (sheet), NULL); diff --git a/lib/gtksheet/gtksheet.h b/lib/gtksheet/gtksheet.h index 7341e21c..bdefc41b 100644 --- a/lib/gtksheet/gtksheet.h +++ b/lib/gtksheet/gtksheet.h @@ -29,7 +29,7 @@ #include #include "gtkextra-sheet.h" -#include "gsheetmodel.h" +#include "psppire-sheetmodel.h" #include "psppire-axis.h" G_BEGIN_DECLS @@ -92,7 +92,7 @@ struct _GtkSheet guint16 flags; - GSheetModel *model; + PsppireSheetModel *model; GtkSelectionMode selection_mode; @@ -212,7 +212,7 @@ GtkType gtk_sheet_range_get_type (void); /* create a new sheet */ -GtkWidget * gtk_sheet_new (GSheetModel *model); +GtkWidget * gtk_sheet_new (PsppireSheetModel *model); /* create a new sheet with custom entry */ GtkWidget * @@ -288,9 +288,9 @@ gboolean gtk_sheet_get_attributes (const GtkSheet *sheet, GtkSheetCellAttr *attributes); void gtk_sheet_set_model (GtkSheet *sheet, - GSheetModel *model); + PsppireSheetModel *model); -GSheetModel * gtk_sheet_get_model (const GtkSheet *sheet); +PsppireSheetModel * gtk_sheet_get_model (const GtkSheet *sheet); G_END_DECLS diff --git a/src/ui/gui/psppire-data-store.c b/src/ui/gui/psppire-data-store.c index e0402dea..f9481f08 100644 --- a/src/ui/gui/psppire-data-store.c +++ b/src/ui/gui/psppire-data-store.c @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include @@ -48,12 +48,12 @@ static void psppire_data_store_init (PsppireDataStore *data_store); static void psppire_data_store_class_init (PsppireDataStoreClass *class); -static void psppire_data_store_sheet_model_init (GSheetModelIface *iface); +static void psppire_data_store_sheet_model_init (PsppireSheetModelIface *iface); static void psppire_data_store_finalize (GObject *object); static void psppire_data_store_dispose (GObject *object); -static gboolean psppire_data_store_clear_datum (GSheetModel *model, +static gboolean psppire_data_store_clear_datum (PsppireSheetModel *model, glong row, glong column); @@ -117,7 +117,7 @@ psppire_data_store_get_type (void) &data_store_info, 0); g_type_add_interface_static (data_store_type, - G_TYPE_SHEET_MODEL, + PSPPIRE_TYPE_SHEET_MODEL, &sheet_model_info); } @@ -203,7 +203,7 @@ psppire_data_store_set_value (PsppireDataStore *ds, casenumber casenum, static glong -psppire_data_store_get_var_count (const GSheetModel *model) +psppire_data_store_get_var_count (const PsppireSheetModel *model) { const PsppireDataStore *store = PSPPIRE_DATA_STORE (model); @@ -223,7 +223,7 @@ psppire_data_store_get_value_count (const PsppireDataStore *store) } static casenumber -psppire_data_store_get_case_count_wrapper (const GSheetModel *model) +psppire_data_store_get_case_count_wrapper (const PsppireSheetModel *model) { const PsppireDataStore *store = PSPPIRE_DATA_STORE (model); return psppire_data_store_get_case_count (store); @@ -238,7 +238,7 @@ psppire_data_store_init (PsppireDataStore *data_store) } static inline gchar * -psppire_data_store_get_string_wrapper (const GSheetModel *model, glong row, +psppire_data_store_get_string_wrapper (const PsppireSheetModel *model, glong row, glong column) { return psppire_data_store_get_string (PSPPIRE_DATA_STORE (model), row, column); @@ -246,7 +246,7 @@ psppire_data_store_get_string_wrapper (const GSheetModel *model, glong row, static inline gboolean -psppire_data_store_set_string_wrapper (GSheetModel *model, +psppire_data_store_set_string_wrapper (PsppireSheetModel *model, const gchar *text, glong row, glong column) { @@ -256,17 +256,17 @@ psppire_data_store_set_string_wrapper (GSheetModel *model, -static gchar * get_column_subtitle (const GSheetModel *model, gint col); -static gchar * get_column_button_label (const GSheetModel *model, gint col); -static gboolean get_column_sensitivity (const GSheetModel *model, gint col); -static GtkJustification get_column_justification (const GSheetModel *model, gint col); +static gchar * get_column_subtitle (const PsppireSheetModel *model, gint col); +static gchar * get_column_button_label (const PsppireSheetModel *model, gint col); +static gboolean get_column_sensitivity (const PsppireSheetModel *model, gint col); +static GtkJustification get_column_justification (const PsppireSheetModel *model, gint col); -static gchar * get_row_button_label (const GSheetModel *model, gint row); -static gboolean get_row_sensitivity (const GSheetModel *model, gint row); +static gchar * get_row_button_label (const PsppireSheetModel *model, gint row); +static gboolean get_row_sensitivity (const PsppireSheetModel *model, gint row); static void -psppire_data_store_sheet_model_init (GSheetModelIface *iface) +psppire_data_store_sheet_model_init (PsppireSheetModelIface *iface) { iface->free_strings = TRUE; iface->get_string = psppire_data_store_get_string_wrapper; @@ -299,11 +299,11 @@ delete_variable_callback (GObject *obj, gint dict_index, PsppireDataStore *store = PSPPIRE_DATA_STORE (data); - g_sheet_model_columns_deleted (G_SHEET_MODEL (store), dict_index, 1); + psppire_sheet_model_columns_deleted (PSPPIRE_SHEET_MODEL (store), dict_index, 1); #if AXIS_TRANSITION - g_sheet_column_columns_changed (G_SHEET_COLUMN (store), + psppire_sheet_column_columns_changed (PSPPIRE_SHEET_COLUMN (store), dict_index, -1); #endif } @@ -316,11 +316,11 @@ variable_changed_callback (GObject *obj, gint var_num, gpointer data) PsppireDataStore *store = PSPPIRE_DATA_STORE (data); #if AXIS_TRANSITION - g_sheet_column_columns_changed (G_SHEET_COLUMN (store), + psppire_sheet_column_columns_changed (PSPPIRE_SHEET_COLUMN (store), var_num, 1); - g_sheet_model_range_changed (G_SHEET_MODEL (store), + psppire_sheet_model_range_changed (PSPPIRE_SHEET_MODEL (store), -1, var_num, -1, var_num); #endif @@ -354,11 +354,11 @@ insert_variable_callback (GObject *obj, gint var_num, gpointer data) #if AXIS_TRANSITION - g_sheet_column_columns_changed (G_SHEET_COLUMN (store), + psppire_sheet_column_columns_changed (PSPPIRE_SHEET_COLUMN (store), var_num, 1); #endif - g_sheet_model_columns_inserted (G_SHEET_MODEL (store), var_num, 1); + psppire_sheet_model_columns_inserted (PSPPIRE_SHEET_MODEL (store), var_num, 1); } @@ -410,7 +410,7 @@ psppire_data_store_set_reader (PsppireDataStore *ds, ds->datasheet = datasheet_create (reader); - g_sheet_model_range_changed (G_SHEET_MODEL (ds), + psppire_sheet_model_range_changed (PSPPIRE_SHEET_MODEL (ds), -1, -1, -1, -1); if ( ds->dict ) @@ -477,10 +477,10 @@ psppire_data_store_set_dictionary (PsppireDataStore *data_store, PsppireDict *di /* The entire model has changed */ - g_sheet_model_range_changed (G_SHEET_MODEL (data_store), -1, -1, -1, -1); + psppire_sheet_model_range_changed (PSPPIRE_SHEET_MODEL (data_store), -1, -1, -1, -1); #if AXIS_TRANSITION - g_sheet_column_columns_changed (G_SHEET_COLUMN (data_store), 0, -1); + psppire_sheet_column_columns_changed (PSPPIRE_SHEET_COLUMN (data_store), 0, -1); #endif if ( data_store->dict ) @@ -628,7 +628,7 @@ psppire_data_store_get_string (PsppireDataStore *store, glong row, glong column) static gboolean -psppire_data_store_clear_datum (GSheetModel *model, +psppire_data_store_clear_datum (PsppireSheetModel *model, glong row, glong col) { PsppireDataStore *store = PSPPIRE_DATA_STORE (model); @@ -646,7 +646,7 @@ psppire_data_store_clear_datum (GSheetModel *model, psppire_data_store_set_value (store, row, index, &v, var_get_width (pv)); - g_sheet_model_range_changed (model, row, col, row, col); + psppire_sheet_model_range_changed (model, row, col, row, col); return TRUE; } @@ -677,7 +677,7 @@ psppire_data_store_set_string (PsppireDataStore *store, var_get_case_index (pv), ss_cstr (text), var_get_write_format (pv)); - g_sheet_model_range_changed (G_SHEET_MODEL (store), row, col, row, col); + psppire_sheet_model_range_changed (PSPPIRE_SHEET_MODEL (store), row, col, row, col); return TRUE; } @@ -692,7 +692,7 @@ psppire_data_store_show_labels (PsppireDataStore *store, gboolean show_labels) store->show_labels = show_labels; - g_sheet_model_range_changed (G_SHEET_MODEL (store), + psppire_sheet_model_range_changed (PSPPIRE_SHEET_MODEL (store), -1, -1, -1, -1); } @@ -744,7 +744,7 @@ static const gchar null_var_name[]=N_("var"); /* Row related funcs */ static gchar * -get_row_button_label (const GSheetModel *model, gint unit) +get_row_button_label (const PsppireSheetModel *model, gint unit) { gchar *s = g_strdup_printf (_("%d"), unit + FIRST_CASE_NUMBER); @@ -757,7 +757,7 @@ get_row_button_label (const GSheetModel *model, gint unit) static gboolean -get_row_sensitivity (const GSheetModel *model, gint unit) +get_row_sensitivity (const PsppireSheetModel *model, gint unit) { PsppireDataStore *ds = PSPPIRE_DATA_STORE (model); @@ -770,7 +770,7 @@ get_row_sensitivity (const GSheetModel *model, gint unit) /* Column related stuff */ static gchar * -get_column_subtitle (const GSheetModel *model, gint col) +get_column_subtitle (const PsppireSheetModel *model, gint col) { gchar *text; const struct variable *v ; @@ -790,7 +790,7 @@ get_column_subtitle (const GSheetModel *model, gint col) } static gchar * -get_column_button_label (const GSheetModel *model, gint col) +get_column_button_label (const PsppireSheetModel *model, gint col) { gchar *text; struct variable *pv ; @@ -807,7 +807,7 @@ get_column_button_label (const GSheetModel *model, gint col) } static gboolean -get_column_sensitivity (const GSheetModel *model, gint col) +get_column_sensitivity (const PsppireSheetModel *model, gint col) { PsppireDataStore *ds = PSPPIRE_DATA_STORE (model); @@ -817,7 +817,7 @@ get_column_sensitivity (const GSheetModel *model, gint col) static GtkJustification -get_column_justification (const GSheetModel *model, gint col) +get_column_justification (const PsppireSheetModel *model, gint col) { PsppireDataStore *ds = PSPPIRE_DATA_STORE (model); const struct variable *pv ; @@ -866,7 +866,7 @@ psppire_data_store_delete_cases (PsppireDataStore *ds, casenumber first, datasheet_delete_rows (ds->datasheet, first, n_cases); g_signal_emit (ds, signals [CASES_DELETED], 0, first, n_cases); - g_sheet_model_rows_deleted (G_SHEET_MODEL (ds), first, n_cases); + psppire_sheet_model_rows_deleted (PSPPIRE_SHEET_MODEL (ds), first, n_cases); return TRUE; } @@ -891,7 +891,7 @@ psppire_data_store_insert_case (PsppireDataStore *ds, if ( result ) { g_signal_emit (ds, signals [CASE_INSERTED], 0, posn); - g_sheet_model_rows_inserted (G_SHEET_MODEL (ds), posn, 1); + psppire_sheet_model_rows_inserted (PSPPIRE_SHEET_MODEL (ds), posn, 1); } else g_warning ("Cannot insert case at position %ld\n", posn); diff --git a/src/ui/gui/psppire-var-store.c b/src/ui/gui/psppire-var-store.c index 19b50028..2b6364a7 100644 --- a/src/ui/gui/psppire-var-store.c +++ b/src/ui/gui/psppire-var-store.c @@ -25,7 +25,7 @@ #include -#include +#include #include "psppire-var-store.h" #include "helper.h" @@ -49,23 +49,23 @@ enum static void psppire_var_store_init (PsppireVarStore *var_store); static void psppire_var_store_class_init (PsppireVarStoreClass *class); -static void psppire_var_store_sheet_model_init (GSheetModelIface *iface); +static void psppire_var_store_sheet_model_init (PsppireSheetModelIface *iface); static void psppire_var_store_finalize (GObject *object); gchar * missing_values_to_string (const struct variable *pv, GError **err); -static gchar *psppire_var_store_get_string (const GSheetModel *sheet_model, glong row, glong column); +static gchar *psppire_var_store_get_string (const PsppireSheetModel *sheet_model, glong row, glong column); -static gboolean psppire_var_store_clear (GSheetModel *model, glong row, glong col); +static gboolean psppire_var_store_clear (PsppireSheetModel *model, glong row, glong col); -static gboolean psppire_var_store_set_string (GSheetModel *model, +static gboolean psppire_var_store_set_string (PsppireSheetModel *model, const gchar *text, glong row, glong column); -static glong psppire_var_store_get_row_count (const GSheetModel * model); -static glong psppire_var_store_get_column_count (const GSheetModel * model); +static glong psppire_var_store_get_row_count (const PsppireSheetModel * model); +static glong psppire_var_store_get_column_count (const PsppireSheetModel * model); static gchar *text_for_column (const struct variable *pv, gint c, GError **err); @@ -126,7 +126,7 @@ psppire_var_store_get_type (void) var_store_type = g_type_register_static (G_TYPE_OBJECT, "PsppireVarStore", &var_store_info, 0); g_type_add_interface_static (var_store_type, - G_TYPE_SHEET_MODEL, + PSPPIRE_TYPE_SHEET_MODEL, &sheet_model_info); } @@ -260,7 +260,7 @@ psppire_var_store_get_var (PsppireVarStore *store, glong row) } static gboolean -psppire_var_store_is_editable (const GSheetModel *model, glong row, glong column) +psppire_var_store_is_editable (const PsppireSheetModel *model, glong row, glong column) { PsppireVarStore *store = PSPPIRE_VAR_STORE (model); return psppire_var_store_item_editable (store, row, column); @@ -268,7 +268,7 @@ psppire_var_store_is_editable (const GSheetModel *model, glong row, glong column static GdkColor * -psppire_var_store_get_foreground (const GSheetModel *model, glong row, glong column) +psppire_var_store_get_foreground (const PsppireSheetModel *model, glong row, glong column) { PsppireVarStore *store = PSPPIRE_VAR_STORE (model); @@ -279,12 +279,12 @@ psppire_var_store_get_foreground (const GSheetModel *model, glong row, glong col } -static gchar *get_column_title (const GSheetModel *model, gint col); -static gchar *get_row_title (const GSheetModel *model, gint row); -static gboolean get_row_sensitivity (const GSheetModel *model, gint row); +static gchar *get_column_title (const PsppireSheetModel *model, gint col); +static gchar *get_row_title (const PsppireSheetModel *model, gint row); +static gboolean get_row_sensitivity (const PsppireSheetModel *model, gint row); static void -psppire_var_store_sheet_model_init (GSheetModelIface *iface) +psppire_var_store_sheet_model_init (PsppireSheetModelIface *iface) { iface->get_row_count = psppire_var_store_get_row_count; iface->get_column_count = psppire_var_store_get_column_count; @@ -325,9 +325,9 @@ psppire_var_store_new (PsppireDict *dict) static void var_change_callback (GtkWidget *w, gint n, gpointer data) { - GSheetModel *model = G_SHEET_MODEL (data); + PsppireSheetModel *model = PSPPIRE_SHEET_MODEL (data); - g_sheet_model_range_changed (model, + psppire_sheet_model_range_changed (model, n, 0, n, PSPPIRE_VAR_STORE_n_COLS); } @@ -335,9 +335,9 @@ var_change_callback (GtkWidget *w, gint n, gpointer data) static void var_delete_callback (GtkWidget *w, gint dict_idx, gint case_idx, gint val_cnt, gpointer data) { - GSheetModel *model = G_SHEET_MODEL (data); + PsppireSheetModel *model = PSPPIRE_SHEET_MODEL (data); - g_sheet_model_rows_deleted (model, dict_idx, 1); + psppire_sheet_model_rows_deleted (model, dict_idx, 1); } @@ -345,9 +345,9 @@ var_delete_callback (GtkWidget *w, gint dict_idx, gint case_idx, gint val_cnt, g static void var_insert_callback (GtkWidget *w, glong row, gpointer data) { - GSheetModel *model = G_SHEET_MODEL (data); + PsppireSheetModel *model = PSPPIRE_SHEET_MODEL (data); - g_sheet_model_rows_inserted (model, row, 1); + psppire_sheet_model_rows_inserted (model, row, 1); } static void @@ -355,7 +355,7 @@ refresh (PsppireDict *d, gpointer data) { PsppireVarStore *vs = data; - g_sheet_model_range_changed (G_SHEET_MODEL (vs), -1, -1, -1, -1); + psppire_sheet_model_range_changed (PSPPIRE_SHEET_MODEL (vs), -1, -1, -1, -1); } /** @@ -386,7 +386,7 @@ psppire_var_store_set_dictionary (PsppireVarStore *var_store, PsppireDict *dict) var_store); /* The entire model has changed */ - g_sheet_model_range_changed (G_SHEET_MODEL (var_store), -1, -1, -1, -1); + psppire_sheet_model_range_changed (PSPPIRE_SHEET_MODEL (var_store), -1, -1, -1, -1); } static void @@ -397,7 +397,7 @@ psppire_var_store_finalize (GObject *object) } static gchar * -psppire_var_store_get_string (const GSheetModel *model, glong row, glong column) +psppire_var_store_get_string (const PsppireSheetModel *model, glong row, glong column) { PsppireVarStore *store = PSPPIRE_VAR_STORE (model); @@ -417,7 +417,7 @@ psppire_var_store_get_string (const GSheetModel *model, glong row, glong column) Returns true if anything was updated, false otherwise. */ static gboolean -psppire_var_store_clear (GSheetModel *model, glong row, glong col) +psppire_var_store_clear (PsppireSheetModel *model, glong row, glong col) { struct variable *pv ; @@ -447,7 +447,7 @@ psppire_var_store_clear (GSheetModel *model, glong row, glong col) Returns true if anything was updated, false otherwise. */ static gboolean -psppire_var_store_set_string (GSheetModel *model, +psppire_var_store_set_string (PsppireSheetModel *model, const gchar *text, glong row, glong col) { struct variable *pv ; @@ -716,7 +716,7 @@ psppire_var_store_get_var_cnt (PsppireVarStore *store) static glong -psppire_var_store_get_row_count (const GSheetModel * model) +psppire_var_store_get_row_count (const PsppireSheetModel * model) { gint rows = 0; PsppireVarStore *vs = PSPPIRE_VAR_STORE (model); @@ -728,7 +728,7 @@ psppire_var_store_get_row_count (const GSheetModel * model) } static glong -psppire_var_store_get_column_count (const GSheetModel * model) +psppire_var_store_get_column_count (const PsppireSheetModel * model) { return PSPPIRE_VAR_STORE_n_COLS ; } @@ -739,7 +739,7 @@ psppire_var_store_get_column_count (const GSheetModel * model) static gboolean -get_row_sensitivity (const GSheetModel *model, gint row) +get_row_sensitivity (const PsppireSheetModel *model, gint row) { PsppireVarStore *vs = PSPPIRE_VAR_STORE (model); @@ -751,7 +751,7 @@ get_row_sensitivity (const GSheetModel *model, gint row) static gchar * -get_row_title (const GSheetModel *model, gint unit) +get_row_title (const PsppireSheetModel *model, gint unit) { return g_strdup_printf (_("%d"), unit + 1); } @@ -774,7 +774,7 @@ static const gchar *column_titles[] = { static gchar * -get_column_title (const GSheetModel *model, gint col) +get_column_title (const PsppireSheetModel *model, gint col) { if ( col >= 10) return NULL;