When a resister is read only make whole sheet insensitive.

This commit is contained in:
Robert Fewell 2020-12-03 15:59:35 +00:00
parent f3eae750ed
commit dced40cf6a
2 changed files with 14 additions and 0 deletions

View File

@ -408,6 +408,17 @@ draw_cell (GnucashSheet *sheet, SheetBlock *block,
color_type = gnc_table_get_color (table, virt_loc, &hatching);
gnucash_get_style_classes (sheet, stylectxt, color_type, use_neg_class);
if (sheet->read_only)
{
if (!gtk_style_context_has_class (stylectxt, GTK_STYLE_CLASS_BACKGROUND))
gtk_style_context_set_state (stylectxt, GTK_STATE_FLAG_INSENSITIVE);
}
else
{
if (gtk_style_context_has_class (stylectxt, GTK_STYLE_CLASS_BACKGROUND))
gtk_style_context_set_state (stylectxt, GTK_STATE_FLAG_NORMAL);
}
// Are we in a read-only row? Then make the background color somewhat more grey.
if ((virt_loc.phys_row_offset < block->style->nrows)
&& (table->model->dividing_row_upper >= 0)
@ -627,6 +638,8 @@ gnucash_sheet_draw_internal (GnucashSheet* sheet, cairo_t* cr,
if (!sheet_block || !sheet_block->style)
return FALSE;
sheet->read_only = gnc_table_model_read_only (sheet->table->model);
for ( ; virt_loc.vcell_loc.virt_row < sheet->num_virt_rows;
virt_loc.vcell_loc.virt_row++ )
{

View File

@ -44,6 +44,7 @@ struct _GnucashSheet
gpointer popup_data;
Table *table;
gboolean read_only;
GtkWidget *reg;