gboolean label_visible;
GtkJustification justification;
+ gboolean overstruck;
};
struct _PsppireSheetCell
allocation.x, allocation.y,
allocation.width, allocation.height);
+ if ( button->overstruck)
+ {
+ GdkPoint points[2] = {
+ {allocation.x, allocation.y},
+ {allocation.x + allocation.width,
+ allocation.y + allocation.height}
+ };
+
+ gtk_paint_polygon (sheet->button->style,
+ window,
+ button->state,
+ shadow_type,
+ NULL,
+ GTK_WIDGET (sheet),
+ "button",
+ points,
+ 2,
+ TRUE);
+ }
+
if (button->label_visible)
{
text_height = DEFAULT_ROW_HEIGHT -
button->label = NULL;
button->label_visible = TRUE;
button->justification = GTK_JUSTIFY_FILL;
+ button->overstruck = FALSE;
return button;
}
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);
static gchar * get_row_button_label (const PsppireSheetModel *model, gint row);
static gboolean get_row_sensitivity (const PsppireSheetModel *model, gint row);
+static gboolean get_row_overstrike (const PsppireSheetModel *model, gint row);
static void
iface->get_row_title = get_row_button_label;
iface->get_row_sensitivity = get_row_sensitivity;
+ iface->get_row_overstrike = get_row_overstrike;
}
return TRUE;
}
+
+static gboolean
+get_row_overstrike (const PsppireSheetModel *model, gint row)
+{
+ union value val;
+ PsppireDataStore *ds = PSPPIRE_DATA_STORE (model);
+
+ const struct dictionary *dict = ds->dict->dict;
+
+ const struct variable *filter = dict_get_filter (dict);
+
+ if ( row < 0 || row >= datasheet_get_row_cnt (ds->datasheet))
+ return FALSE;
+
+ if ( ! filter)
+ return FALSE;
+
+ g_assert (var_is_numeric (filter));
+
+ if ( ! datasheet_get_value (ds->datasheet, row,
+ var_get_case_index (filter),
+ &val, 0) )
+ return FALSE;
+
+
+ return (val.f == 0.0);
+}
const gchar *text,
glong row, glong column);
+
+gboolean psppire_data_store_filtered (PsppireDataStore *ds,
+ glong row);
+
+
casenumber psppire_data_store_get_case_count (const PsppireDataStore *ds);
size_t psppire_data_store_get_value_count (const PsppireDataStore *ds);
iface->get_row_title = get_row_title;
iface->get_row_sensitivity = get_row_sensitivity;
+
+ iface->get_row_overstrike = NULL;
}
/**
/* PsppireSheetModel --- an abstract model for the PsppireSheet widget.
- * Copyright (C) 2006, 2008 Free Software Foundation
+ Copyright (C) 2006, 2008 Free Software Foundation
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
if ( PSPPIRE_SHEET_MODEL_GET_IFACE (model)->get_column_title)
button->label = PSPPIRE_SHEET_MODEL_GET_IFACE (model)->get_column_title (model, col);
+ button->overstruck = FALSE;
+
return button;
}
g_return_val_if_fail (PSPPIRE_IS_SHEET_MODEL (model), NULL);
if ( PSPPIRE_SHEET_MODEL_GET_IFACE (model)->get_row_title)
- button->label = PSPPIRE_SHEET_MODEL_GET_IFACE (model)->get_row_title (model, row);
+ button->label =
+ PSPPIRE_SHEET_MODEL_GET_IFACE (model)->get_row_title (model, row);
+
+ if ( PSPPIRE_SHEET_MODEL_GET_IFACE (model)->get_row_overstrike)
+ button->overstruck =
+ PSPPIRE_SHEET_MODEL_GET_IFACE (model)->get_row_overstrike (model, row);
return button;
}
gchar * (*get_row_subtitle) (const PsppireSheetModel *, gint row);
glong (*get_row_count) (const PsppireSheetModel *model);
gboolean (*get_row_sensitivity) (const PsppireSheetModel *, gint row);
+
+ gboolean (*get_row_overstrike) (const PsppireSheetModel *, gint row);
};