X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fpsppire-data-store.c;h=afbe3d2fe31f82fb83b4149a2a9656b902d9bc7a;hb=5ee84736663824fe12474b78dace867e42893a14;hp=4f548605f3dd008e6d56b903993df2a2cb502c58;hpb=6882ff1359de0c4812a62e1bfcdfbf8e68474de5;p=pspp-builds.git diff --git a/src/ui/gui/psppire-data-store.c b/src/ui/gui/psppire-data-store.c index 4f548605..afbe3d2f 100644 --- a/src/ui/gui/psppire-data-store.c +++ b/src/ui/gui/psppire-data-store.c @@ -25,9 +25,9 @@ #include #include -#include #include #include +#include #include @@ -39,6 +39,7 @@ #include #include #include +#include static void psppire_data_store_init (PsppireDataStore *data_store); @@ -67,7 +68,7 @@ enum {FONT_CHANGED, static guint signals [n_SIGNALS]; -inline GType +GType psppire_data_store_get_type (void) { static GType data_store_type = 0; @@ -161,7 +162,7 @@ psppire_data_store_get_var_count (const GSheetModel *model) return psppire_dict_get_var_cnt (store->dict); } -inline casenumber +casenumber psppire_data_store_get_case_count (const PsppireDataStore *store) { return psppire_case_file_get_case_count (store->case_file); @@ -173,7 +174,7 @@ psppire_data_store_get_value_count (const PsppireDataStore *store) return psppire_dict_get_value_cnt (store->dict); } -inline casenumber +casenumber psppire_data_store_get_case_count_wrapper (const GSheetModel *model) { const PsppireDataStore *store = PSPPIRE_DATA_STORE (model); @@ -676,23 +677,17 @@ gboolean psppire_data_store_set_string (PsppireDataStore *store, const gchar *text, glong row, glong col) { + glong n_cases; const struct variable *pv = psppire_dict_get_variable (store->dict, col); g_return_val_if_fail (pv, FALSE); -#if 0 - /* Allow the user to insert a lot of blank cases, simply by skipping rows */ - for (r = psppire_case_file_get_case_count (store->case_file); r <= row ; ++r) - { - - gint c; + n_cases = psppire_data_store_get_case_count (store); - psppire_case_array_insert_case (store->cases, r, 0, 0); + if ( row > n_cases) + return FALSE; - - for (c = 0 ; c < psppire_dict_get_var_cnt (store->dict); ++c ) - psppire_data_store_clear_datum (model, r, c); - } -#endif + if (row == n_cases) + psppire_data_store_insert_new_case (store, row); psppire_case_file_data_in (store->case_file, row, var_get_case_index (pv), ss_cstr (text), @@ -897,7 +892,7 @@ psppire_data_store_sheet_column_init (GSheetColumnIface *iface) /* Row related funcs */ static glong -geometry_get_row_count (const GSheetRow *geom, gpointer data) +geometry_get_row_count (const GSheetRow *geom) { PsppireDataStore *ds = PSPPIRE_DATA_STORE (geom); @@ -907,31 +902,31 @@ geometry_get_row_count (const GSheetRow *geom, gpointer data) #define ROW_HEIGHT 25 static gint -geometry_get_height (const GSheetRow *geom, glong unit, gpointer data) +geometry_get_height (const GSheetRow *geom, glong unit) { return ROW_HEIGHT; } static guint -geometry_get_top_ypixel (const GSheetRow *geo, glong row, gpointer data) +geometry_get_top_ypixel (const GSheetRow *geo, glong row) { return row * ROW_HEIGHT; } static glong -geometry_pixel_to_row (const GSheetRow *geo, guint pixel, gpointer data) +geometry_pixel_to_row (const GSheetRow *geo, guint pixel) { glong row = pixel / ROW_HEIGHT; - if (row >= geometry_get_row_count (geo, data)) - row = geometry_get_row_count (geo, data) - 1; + if (row >= geometry_get_row_count (geo)) + row = geometry_get_row_count (geo) - 1; return row; } static gboolean -geometry_get_row_sensitivity (const GSheetRow *geom, glong unit, gpointer data) +geometry_get_row_sensitivity (const GSheetRow *geom, glong unit) { PsppireDataStore *ds = PSPPIRE_DATA_STORE (geom); @@ -941,7 +936,7 @@ geometry_get_row_sensitivity (const GSheetRow *geom, glong unit, gpointer data) static gchar * -geometry_get_row_button_label (const GSheetRow *geom, glong unit, gpointer data) +geometry_get_row_button_label (const GSheetRow *geom, glong unit) { gchar *text; gchar *s;