mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Fix missing hatchings when transaction unbalanced
The gtkrc foreground and background functions did not process hatching properly so changed the normal functions to use CSS classes instead and remove the gtkrc functions.
This commit is contained in:
parent
6ebecea263
commit
ed17cd6065
@ -920,7 +920,6 @@ static CellIOFlags get_qty_io_flags (VirtualLocation virt_loc, gpointer user_dat
|
|||||||
static guint32
|
static guint32
|
||||||
gnc_entry_ledger_get_color_internal (VirtualLocation virt_loc,
|
gnc_entry_ledger_get_color_internal (VirtualLocation virt_loc,
|
||||||
GncEntryLedger *ledger,
|
GncEntryLedger *ledger,
|
||||||
const guint32 *color_table,
|
|
||||||
gboolean foreground)
|
gboolean foreground)
|
||||||
{
|
{
|
||||||
VirtualCell *vcell;
|
VirtualCell *vcell;
|
||||||
@ -931,29 +930,29 @@ gnc_entry_ledger_get_color_internal (VirtualLocation virt_loc,
|
|||||||
colorbase = COLOR_UNKNOWN_FG; /* a bit of enum arithmetic */
|
colorbase = COLOR_UNKNOWN_FG; /* a bit of enum arithmetic */
|
||||||
|
|
||||||
if (!ledger)
|
if (!ledger)
|
||||||
return color_table[colorbase + COLOR_UNKNOWN_BG];
|
return (colorbase + COLOR_UNKNOWN_BG);
|
||||||
|
|
||||||
if (gnc_table_virtual_location_in_header (ledger->table, virt_loc))
|
if (gnc_table_virtual_location_in_header (ledger->table, virt_loc))
|
||||||
return color_table[colorbase + COLOR_HEADER_BG];
|
return (colorbase + COLOR_HEADER_BG);
|
||||||
|
|
||||||
vcell = gnc_table_get_virtual_cell (ledger->table, virt_loc.vcell_loc);
|
vcell = gnc_table_get_virtual_cell (ledger->table, virt_loc.vcell_loc);
|
||||||
if (!vcell || !vcell->cellblock)
|
if (!vcell || !vcell->cellblock)
|
||||||
return color_table[colorbase + COLOR_UNKNOWN_BG];
|
return (colorbase + COLOR_UNKNOWN_BG);
|
||||||
|
|
||||||
if ((virt_loc.phys_col_offset < vcell->cellblock->start_col) ||
|
if ((virt_loc.phys_col_offset < vcell->cellblock->start_col) ||
|
||||||
(virt_loc.phys_col_offset > vcell->cellblock->stop_col))
|
(virt_loc.phys_col_offset > vcell->cellblock->stop_col))
|
||||||
return color_table[colorbase + COLOR_UNKNOWN_BG];
|
return (colorbase + COLOR_UNKNOWN_BG);
|
||||||
|
|
||||||
is_current = virt_cell_loc_equal (ledger->table->current_cursor_loc.vcell_loc,
|
is_current = virt_cell_loc_equal (ledger->table->current_cursor_loc.vcell_loc,
|
||||||
virt_loc.vcell_loc);
|
virt_loc.vcell_loc);
|
||||||
|
|
||||||
if (is_current)
|
if (is_current)
|
||||||
return vcell->start_primary_color ?
|
return vcell->start_primary_color ?
|
||||||
color_table[colorbase + COLOR_PRIMARY_BG_ACTIVE] :
|
(colorbase + COLOR_PRIMARY_BG_ACTIVE) :
|
||||||
color_table[colorbase + COLOR_SECONDARY_BG_ACTIVE];
|
(colorbase + COLOR_SECONDARY_BG_ACTIVE);
|
||||||
|
|
||||||
return vcell->start_primary_color ?
|
return vcell->start_primary_color ?
|
||||||
color_table[colorbase + COLOR_PRIMARY_BG] : color_table[colorbase + COLOR_SECONDARY_BG];
|
(colorbase + COLOR_PRIMARY_BG) : (colorbase + COLOR_SECONDARY_BG);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -962,15 +961,7 @@ gnc_entry_ledger_get_fg_color (VirtualLocation virt_loc,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GncEntryLedger *ledger = user_data;
|
GncEntryLedger *ledger = user_data;
|
||||||
return gnc_entry_ledger_get_color_internal (virt_loc, ledger, reg_colors_default, TRUE);
|
return gnc_entry_ledger_get_color_internal (virt_loc, ledger, TRUE);
|
||||||
}
|
|
||||||
|
|
||||||
static guint32
|
|
||||||
gnc_entry_ledger_get_gtkrc_fg_color (VirtualLocation virt_loc,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
GncEntryLedger *ledger = user_data;
|
|
||||||
return gnc_entry_ledger_get_color_internal (virt_loc, ledger, reg_colors_gtkrc, TRUE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static guint32
|
static guint32
|
||||||
@ -982,19 +973,7 @@ gnc_entry_ledger_get_bg_color (VirtualLocation virt_loc,
|
|||||||
if (hatching)
|
if (hatching)
|
||||||
*hatching = FALSE;
|
*hatching = FALSE;
|
||||||
|
|
||||||
return gnc_entry_ledger_get_color_internal (virt_loc, ledger, reg_colors_default, FALSE);
|
return gnc_entry_ledger_get_color_internal (virt_loc, ledger, FALSE);
|
||||||
}
|
|
||||||
|
|
||||||
static guint32
|
|
||||||
gnc_entry_ledger_get_gtkrc_bg_color (VirtualLocation virt_loc,
|
|
||||||
gboolean *hatching, gpointer user_data)
|
|
||||||
{
|
|
||||||
GncEntryLedger *ledger = user_data;
|
|
||||||
|
|
||||||
if (hatching)
|
|
||||||
*hatching = FALSE;
|
|
||||||
|
|
||||||
return gnc_entry_ledger_get_color_internal (virt_loc, ledger, reg_colors_gtkrc, FALSE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* SAVE CELLS */
|
/* SAVE CELLS */
|
||||||
@ -1249,16 +1228,9 @@ static void gnc_entry_ledger_model_new_handlers (TableModel *model,
|
|||||||
gnc_table_model_set_default_fg_color_handler
|
gnc_table_model_set_default_fg_color_handler
|
||||||
(model, gnc_entry_ledger_get_fg_color);
|
(model, gnc_entry_ledger_get_fg_color);
|
||||||
|
|
||||||
gnc_table_model_set_fg_color_handler
|
|
||||||
(model, gnc_entry_ledger_get_gtkrc_fg_color, "gtkrc");
|
|
||||||
|
|
||||||
gnc_table_model_set_default_bg_color_handler
|
gnc_table_model_set_default_bg_color_handler
|
||||||
(model, gnc_entry_ledger_get_bg_color);
|
(model, gnc_entry_ledger_get_bg_color);
|
||||||
|
|
||||||
gnc_table_model_set_bg_color_handler
|
|
||||||
(model, gnc_entry_ledger_get_gtkrc_bg_color, "gtkrc");
|
|
||||||
|
|
||||||
|
|
||||||
for (i = 0; i < (sizeof(models) / sizeof(*models)); i++)
|
for (i = 0; i < (sizeof(models) / sizeof(*models)); i++)
|
||||||
{
|
{
|
||||||
if (models[i].entry_handler)
|
if (models[i].entry_handler)
|
||||||
|
@ -517,7 +517,6 @@ get_trans_total_balance (SplitRegister *reg, Transaction *trans)
|
|||||||
static guint32
|
static guint32
|
||||||
gnc_split_register_get_color_internal (VirtualLocation virt_loc,
|
gnc_split_register_get_color_internal (VirtualLocation virt_loc,
|
||||||
SplitRegister *reg,
|
SplitRegister *reg,
|
||||||
const guint32 *color_table,
|
|
||||||
gboolean foreground)
|
gboolean foreground)
|
||||||
{
|
{
|
||||||
const char *cursor_name;
|
const char *cursor_name;
|
||||||
@ -530,18 +529,18 @@ gnc_split_register_get_color_internal (VirtualLocation virt_loc,
|
|||||||
colorbase = COLOR_UNKNOWN_FG; /* a bit of enum arithmetic */
|
colorbase = COLOR_UNKNOWN_FG; /* a bit of enum arithmetic */
|
||||||
|
|
||||||
if (!reg)
|
if (!reg)
|
||||||
return color_table[colorbase + COLOR_UNKNOWN_BG];
|
return (colorbase + COLOR_UNKNOWN_BG);
|
||||||
|
|
||||||
if (gnc_table_virtual_location_in_header (reg->table, virt_loc))
|
if (gnc_table_virtual_location_in_header (reg->table, virt_loc))
|
||||||
return color_table[colorbase + COLOR_HEADER_BG];
|
return (colorbase + COLOR_HEADER_BG);
|
||||||
|
|
||||||
vcell = gnc_table_get_virtual_cell (reg->table, virt_loc.vcell_loc);
|
vcell = gnc_table_get_virtual_cell (reg->table, virt_loc.vcell_loc);
|
||||||
if (!vcell || !vcell->cellblock)
|
if (!vcell || !vcell->cellblock)
|
||||||
return color_table[colorbase + COLOR_UNKNOWN_BG];
|
return (colorbase + COLOR_UNKNOWN_BG);
|
||||||
|
|
||||||
if ((virt_loc.phys_col_offset < vcell->cellblock->start_col) ||
|
if ((virt_loc.phys_col_offset < vcell->cellblock->start_col) ||
|
||||||
(virt_loc.phys_col_offset > vcell->cellblock->stop_col))
|
(virt_loc.phys_col_offset > vcell->cellblock->stop_col))
|
||||||
return color_table[colorbase + COLOR_UNKNOWN_BG];
|
return (colorbase + COLOR_UNKNOWN_BG);
|
||||||
|
|
||||||
is_current = virt_cell_loc_equal (reg->table->current_cursor_loc.vcell_loc,
|
is_current = virt_cell_loc_equal (reg->table->current_cursor_loc.vcell_loc,
|
||||||
virt_loc.vcell_loc);
|
virt_loc.vcell_loc);
|
||||||
@ -553,11 +552,11 @@ gnc_split_register_get_color_internal (VirtualLocation virt_loc,
|
|||||||
{
|
{
|
||||||
if (is_current)
|
if (is_current)
|
||||||
return vcell->start_primary_color ?
|
return vcell->start_primary_color ?
|
||||||
color_table[colorbase + COLOR_PRIMARY_BG_ACTIVE] :
|
(colorbase + COLOR_PRIMARY_BG_ACTIVE) :
|
||||||
color_table[colorbase + COLOR_SECONDARY_BG_ACTIVE];
|
(colorbase + COLOR_SECONDARY_BG_ACTIVE);
|
||||||
|
|
||||||
return vcell->start_primary_color ?
|
return vcell->start_primary_color ?
|
||||||
color_table[colorbase + COLOR_PRIMARY_BG] : color_table[colorbase + COLOR_SECONDARY_BG];
|
(colorbase + COLOR_PRIMARY_BG) : (colorbase + COLOR_SECONDARY_BG);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_strcmp0 (cursor_name, CURSOR_DOUBLE_JOURNAL) == 0 ||
|
if (g_strcmp0 (cursor_name, CURSOR_DOUBLE_JOURNAL) == 0 ||
|
||||||
@ -571,49 +570,47 @@ gnc_split_register_get_color_internal (VirtualLocation virt_loc,
|
|||||||
{
|
{
|
||||||
if (double_alternate_virt)
|
if (double_alternate_virt)
|
||||||
return vcell->start_primary_color ?
|
return vcell->start_primary_color ?
|
||||||
color_table[colorbase + COLOR_PRIMARY_BG_ACTIVE] :
|
(colorbase + COLOR_PRIMARY_BG_ACTIVE) :
|
||||||
color_table[colorbase + COLOR_SECONDARY_BG_ACTIVE];
|
(colorbase + COLOR_SECONDARY_BG_ACTIVE);
|
||||||
|
|
||||||
return (virt_loc.phys_row_offset % 2 == 0) ?
|
return (virt_loc.phys_row_offset % 2 == 0) ?
|
||||||
color_table[colorbase + COLOR_PRIMARY_BG_ACTIVE] :
|
(colorbase + COLOR_PRIMARY_BG_ACTIVE) :
|
||||||
color_table[colorbase + COLOR_SECONDARY_BG_ACTIVE];
|
(colorbase + COLOR_SECONDARY_BG_ACTIVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (double_alternate_virt)
|
if (double_alternate_virt)
|
||||||
return vcell->start_primary_color ?
|
return vcell->start_primary_color ?
|
||||||
color_table[colorbase + COLOR_PRIMARY_BG] :
|
(colorbase + COLOR_PRIMARY_BG) :
|
||||||
color_table[colorbase + COLOR_SECONDARY_BG];
|
(colorbase + COLOR_SECONDARY_BG);
|
||||||
|
|
||||||
return (virt_loc.phys_row_offset % 2 == 0) ?
|
return (virt_loc.phys_row_offset % 2 == 0) ?
|
||||||
color_table[colorbase + COLOR_PRIMARY_BG] :
|
(colorbase + COLOR_PRIMARY_BG) :
|
||||||
color_table[colorbase + COLOR_SECONDARY_BG];
|
(colorbase + COLOR_SECONDARY_BG);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_strcmp0 (cursor_name, CURSOR_SPLIT) == 0)
|
if (g_strcmp0 (cursor_name, CURSOR_SPLIT) == 0)
|
||||||
{
|
{
|
||||||
if (is_current)
|
if (is_current)
|
||||||
return color_table[colorbase + COLOR_SPLIT_BG_ACTIVE];
|
return (colorbase + COLOR_SPLIT_BG_ACTIVE);
|
||||||
|
|
||||||
return color_table[colorbase + COLOR_SPLIT_BG];
|
return (colorbase + COLOR_SPLIT_BG);
|
||||||
}
|
}
|
||||||
|
|
||||||
PWARN ("Unexpected cursor: %s\n", cursor_name);
|
PWARN ("Unexpected cursor: %s\n", cursor_name);
|
||||||
|
|
||||||
return color_table[colorbase + COLOR_UNKNOWN_BG];
|
return (colorbase + COLOR_UNKNOWN_BG);
|
||||||
}
|
}
|
||||||
|
|
||||||
static guint32
|
static guint32
|
||||||
gnc_split_register_get_fg_color_internal (VirtualLocation virt_loc,
|
gnc_split_register_get_fg_color_internal (VirtualLocation virt_loc,
|
||||||
SplitRegister *reg,
|
SplitRegister *reg)
|
||||||
const guint32 *color_table)
|
|
||||||
{
|
{
|
||||||
const guint32 red_color = color_table[COLOR_NEGATIVE];
|
|
||||||
guint32 fg_color;
|
guint32 fg_color;
|
||||||
const char * cell_name;
|
const char * cell_name;
|
||||||
gnc_numeric value;
|
gnc_numeric value;
|
||||||
Split *split;
|
Split *split;
|
||||||
|
|
||||||
fg_color = gnc_split_register_get_color_internal (virt_loc, reg, color_table, TRUE);
|
fg_color = gnc_split_register_get_color_internal (virt_loc, reg, TRUE);
|
||||||
|
|
||||||
if (!use_red_for_negative)
|
if (!use_red_for_negative)
|
||||||
return fg_color;
|
return fg_color;
|
||||||
@ -653,7 +650,7 @@ gnc_split_register_get_fg_color_internal (VirtualLocation virt_loc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (gnc_numeric_negative_p (value))
|
if (gnc_numeric_negative_p (value))
|
||||||
return red_color;
|
return COLOR_NEGATIVE;
|
||||||
|
|
||||||
return fg_color;
|
return fg_color;
|
||||||
}
|
}
|
||||||
@ -663,15 +660,7 @@ gnc_split_register_get_fg_color (VirtualLocation virt_loc,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
SplitRegister *reg = user_data;
|
SplitRegister *reg = user_data;
|
||||||
return gnc_split_register_get_fg_color_internal (virt_loc, reg, reg_colors_default);
|
return gnc_split_register_get_fg_color_internal (virt_loc, reg);
|
||||||
}
|
|
||||||
|
|
||||||
static guint32
|
|
||||||
gnc_split_register_get_gtkrc_fg_color (VirtualLocation virt_loc,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
SplitRegister *reg = user_data;
|
|
||||||
return gnc_split_register_get_fg_color_internal (virt_loc, reg, reg_colors_gtkrc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static guint32
|
static guint32
|
||||||
@ -684,21 +673,7 @@ gnc_split_register_get_bg_color (VirtualLocation virt_loc,
|
|||||||
if (hatching)
|
if (hatching)
|
||||||
*hatching = FALSE;
|
*hatching = FALSE;
|
||||||
|
|
||||||
return gnc_split_register_get_color_internal (virt_loc, reg, reg_colors_default, FALSE);
|
return gnc_split_register_get_color_internal (virt_loc, reg, FALSE);
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static RegisterColor
|
|
||||||
gnc_split_register_get_gtkrc_bg_color (VirtualLocation virt_loc,
|
|
||||||
gboolean *hatching,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
SplitRegister *reg = user_data;
|
|
||||||
|
|
||||||
if (hatching)
|
|
||||||
*hatching = FALSE;
|
|
||||||
|
|
||||||
return gnc_split_register_get_color_internal (virt_loc, reg, reg_colors_gtkrc, FALSE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static guint32
|
static guint32
|
||||||
@ -2656,16 +2631,10 @@ gnc_split_register_model_new (void)
|
|||||||
gnc_table_model_set_fg_color_handler(
|
gnc_table_model_set_fg_color_handler(
|
||||||
model, gnc_split_register_get_fg_color, RBALN_CELL);
|
model, gnc_split_register_get_fg_color, RBALN_CELL);
|
||||||
|
|
||||||
gnc_table_model_set_fg_color_handler(
|
|
||||||
model, gnc_split_register_get_gtkrc_fg_color, "gtkrc");
|
|
||||||
|
|
||||||
|
|
||||||
gnc_table_model_set_default_bg_color_handler(
|
gnc_table_model_set_default_bg_color_handler(
|
||||||
model, gnc_split_register_get_bg_color);
|
model, gnc_split_register_get_bg_color);
|
||||||
|
|
||||||
gnc_table_model_set_bg_color_handler(
|
|
||||||
model, gnc_split_register_get_gtkrc_bg_color, "gtkrc");
|
|
||||||
|
|
||||||
gnc_table_model_set_bg_color_handler(
|
gnc_table_model_set_bg_color_handler(
|
||||||
model, gnc_split_register_get_debcred_bg_color, DEBT_CELL);
|
model, gnc_split_register_get_debcred_bg_color, DEBT_CELL);
|
||||||
|
|
||||||
|
@ -346,22 +346,27 @@ gnc_table_get_label (Table *table, VirtualLocation virt_loc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static guint32
|
static guint32
|
||||||
gnc_table_get_fg_color_internal (Table *table, VirtualLocation virt_loc,
|
gnc_table_get_fg_color_internal (Table *table, VirtualLocation virt_loc)
|
||||||
gboolean want_gtkrc)
|
|
||||||
{
|
{
|
||||||
TableGetFGColorHandler fg_color_handler;
|
TableGetFGColorHandler fg_color_handler;
|
||||||
const char *handler_name = "gtkrc";
|
const char *handler_name;
|
||||||
|
|
||||||
if (!table || !table->model)
|
if (!table || !table->model)
|
||||||
return 0x0; /* black */
|
return COLOR_UNKNOWN_FG;
|
||||||
|
|
||||||
if (!want_gtkrc)
|
handler_name = gnc_table_get_cell_name (table, virt_loc);
|
||||||
handler_name = gnc_table_get_cell_name (table, virt_loc);
|
|
||||||
|
|
||||||
fg_color_handler = gnc_table_model_get_fg_color_handler (table->model,
|
fg_color_handler = gnc_table_model_get_fg_color_handler (table->model,
|
||||||
handler_name);
|
handler_name);
|
||||||
if (!fg_color_handler)
|
if (!fg_color_handler)
|
||||||
return 0x0;
|
{
|
||||||
|
TableGetBGColorHandler bg_color_handler =
|
||||||
|
gnc_table_model_get_bg_color_handler (table->model, handler_name);
|
||||||
|
|
||||||
|
guint32 bg_color =
|
||||||
|
bg_color_handler (virt_loc, NULL, table->model->handler_user_data);
|
||||||
|
return bg_color + COLOR_UNKNOWN_FG;
|
||||||
|
}
|
||||||
|
|
||||||
return fg_color_handler (virt_loc, table->model->handler_user_data);
|
return fg_color_handler (virt_loc, table->model->handler_user_data);
|
||||||
}
|
}
|
||||||
@ -369,36 +374,29 @@ gnc_table_get_fg_color_internal (Table *table, VirtualLocation virt_loc,
|
|||||||
guint32
|
guint32
|
||||||
gnc_table_get_fg_color (Table *table, VirtualLocation virt_loc)
|
gnc_table_get_fg_color (Table *table, VirtualLocation virt_loc)
|
||||||
{
|
{
|
||||||
return gnc_table_get_fg_color_internal (table, virt_loc, FALSE);
|
return gnc_table_get_fg_color_internal (table, virt_loc);
|
||||||
}
|
|
||||||
|
|
||||||
guint32
|
|
||||||
gnc_table_get_gtkrc_fg_color (Table *table, VirtualLocation virt_loc)
|
|
||||||
{
|
|
||||||
return gnc_table_get_fg_color_internal (table, virt_loc, TRUE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static guint32
|
static guint32
|
||||||
gnc_table_get_bg_color_internal (Table *table, VirtualLocation virt_loc,
|
gnc_table_get_bg_color_internal (Table *table, VirtualLocation virt_loc,
|
||||||
gboolean *hatching,
|
gboolean *hatching)
|
||||||
gboolean want_gtkrc)
|
|
||||||
{
|
{
|
||||||
TableGetBGColorHandler bg_color_handler;
|
TableGetBGColorHandler bg_color_handler;
|
||||||
const char *handler_name = "gtkrc";
|
const char *handler_name;
|
||||||
|
|
||||||
if (hatching)
|
if (hatching)
|
||||||
*hatching = FALSE;
|
*hatching = FALSE;
|
||||||
|
|
||||||
if (!table || !table->model)
|
if (!table || !table->model)
|
||||||
return 0xffffff; /* white */
|
return COLOR_UNKNOWN_BG;
|
||||||
|
|
||||||
if (!want_gtkrc)
|
handler_name = gnc_table_get_cell_name (table, virt_loc);
|
||||||
handler_name = gnc_table_get_cell_name (table, virt_loc);
|
|
||||||
|
|
||||||
bg_color_handler = gnc_table_model_get_bg_color_handler (table->model,
|
bg_color_handler = gnc_table_model_get_bg_color_handler (table->model,
|
||||||
handler_name);
|
handler_name);
|
||||||
|
|
||||||
if (!bg_color_handler)
|
if (!bg_color_handler)
|
||||||
return 0xffffff;
|
return COLOR_UNKNOWN_BG;
|
||||||
|
|
||||||
return bg_color_handler (virt_loc, hatching,
|
return bg_color_handler (virt_loc, hatching,
|
||||||
table->model->handler_user_data);
|
table->model->handler_user_data);
|
||||||
@ -408,14 +406,7 @@ guint32
|
|||||||
gnc_table_get_bg_color (Table *table, VirtualLocation virt_loc,
|
gnc_table_get_bg_color (Table *table, VirtualLocation virt_loc,
|
||||||
gboolean *hatching)
|
gboolean *hatching)
|
||||||
{
|
{
|
||||||
return gnc_table_get_bg_color_internal (table, virt_loc, hatching, FALSE);
|
return gnc_table_get_bg_color_internal (table, virt_loc, hatching);
|
||||||
}
|
|
||||||
|
|
||||||
guint32
|
|
||||||
gnc_table_get_gtkrc_bg_color (Table *table, VirtualLocation virt_loc,
|
|
||||||
gboolean *hatching)
|
|
||||||
{
|
|
||||||
return gnc_table_get_bg_color_internal (table, virt_loc, hatching, TRUE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -182,89 +182,32 @@ struct table
|
|||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
/* Colors used for background drawing */
|
/* Colors used for background drawing */
|
||||||
COLOR_UNKNOWN_BG,
|
COLOR_UNKNOWN_BG, // 0
|
||||||
COLOR_HEADER_BG,
|
COLOR_HEADER_BG, // 1
|
||||||
COLOR_PRIMARY_BG,
|
COLOR_PRIMARY_BG, // 2
|
||||||
COLOR_PRIMARY_BG_ACTIVE,
|
COLOR_PRIMARY_BG_ACTIVE, // 3
|
||||||
COLOR_SECONDARY_BG,
|
COLOR_SECONDARY_BG, // 4
|
||||||
COLOR_SECONDARY_BG_ACTIVE,
|
COLOR_SECONDARY_BG_ACTIVE, // 5
|
||||||
COLOR_SPLIT_BG,
|
COLOR_SPLIT_BG, // 6
|
||||||
COLOR_SPLIT_BG_ACTIVE,
|
COLOR_SPLIT_BG_ACTIVE, // 7
|
||||||
|
|
||||||
/* Colors used for foreground drawing (text etc)
|
/* Colors used for foreground drawing (text etc)
|
||||||
* ATTENTION: the background and foreground lists should have
|
* ATTENTION: the background and foreground lists should have
|
||||||
* the same types (the same amount of entries) !
|
* the same types (the same amount of entries) !
|
||||||
* The code relies on this ! */
|
* The code relies on this ! */
|
||||||
COLOR_UNKNOWN_FG,
|
COLOR_UNKNOWN_FG, // 8
|
||||||
COLOR_HEADER_FG,
|
COLOR_HEADER_FG, // 9
|
||||||
COLOR_PRIMARY_FG,
|
COLOR_PRIMARY_FG, // 10
|
||||||
COLOR_PRIMARY_FG_ACTIVE,
|
COLOR_PRIMARY_FG_ACTIVE, // 11
|
||||||
COLOR_SECONDARY_FG,
|
COLOR_SECONDARY_FG, // 12
|
||||||
COLOR_SECONDARY_FG_ACTIVE,
|
COLOR_SECONDARY_FG_ACTIVE, // 13
|
||||||
COLOR_SPLIT_FG,
|
COLOR_SPLIT_FG, // 14
|
||||||
COLOR_SPLIT_FG_ACTIVE,
|
COLOR_SPLIT_FG_ACTIVE, // 15
|
||||||
|
|
||||||
/* Other colors */
|
/* Other colors */
|
||||||
COLOR_NEGATIVE, /* Color to use for negative numbers */
|
COLOR_NEGATIVE, // 16 Color to use for negative numbers
|
||||||
} RegisterColor;
|
} RegisterColor;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Alternative color tables to use for the register.
|
|
||||||
* The colors in this array are ordered according to the RegisterColor Enum
|
|
||||||
* Be careful to respect this order !
|
|
||||||
*/
|
|
||||||
static const guint32 reg_colors_default [] =
|
|
||||||
{
|
|
||||||
0xFFFFFF, // COLOR_UNKNOWN_BG
|
|
||||||
0x96B183, // COLOR_HEADER_BG
|
|
||||||
0xBFDEB9, // COLOR_PRIMARY_BG
|
|
||||||
0xFFEF98, // COLOR_PRIMARY_BG_ACTIVE
|
|
||||||
0xF6FFDA, // COLOR_SECONDARY_BG
|
|
||||||
0xFFEF98, // COLOR_SECONDARY_BG_ACTIVE
|
|
||||||
0xEDE7D3, // COLOR_SPLIT_BG
|
|
||||||
0xFFEF98, // COLOR_SPLIT_BG_ACTIVE
|
|
||||||
|
|
||||||
0x000000, // COLOR_UNKNOWN_FG
|
|
||||||
0x000000, // COLOR_HEADER_FG
|
|
||||||
0x000000, // COLOR_PRIMARY_FG
|
|
||||||
0x000000, // COLOR_PRIMARY_FG_ACTIVE
|
|
||||||
0x000000, // COLOR_SECONDARY_FG
|
|
||||||
0x000000, // COLOR_SECONDARY_FG_ACTIVE
|
|
||||||
0x000000, // COLOR_SPLIT_FG
|
|
||||||
0x000000, // COLOR_SPLIT_FG_ACTIVE
|
|
||||||
|
|
||||||
0xFF0000, // COLOR_NEGATIVE
|
|
||||||
};
|
|
||||||
|
|
||||||
/* The colors in this array are ordered according to the RegisterColor Enum
|
|
||||||
* Be careful to respect this order !
|
|
||||||
*/
|
|
||||||
static const guint32 reg_colors_gtkrc [] =
|
|
||||||
{
|
|
||||||
COLOR_UNKNOWN_BG, // COLOR_UNKNOWN_BG
|
|
||||||
COLOR_HEADER_BG, // COLOR_HEADER_BG
|
|
||||||
COLOR_PRIMARY_BG, // COLOR_PRIMARY_BG
|
|
||||||
COLOR_PRIMARY_BG_ACTIVE, // COLOR_PRIMARY_BG_ACTIVE
|
|
||||||
COLOR_SECONDARY_BG, // COLOR_SECONDARY_BG
|
|
||||||
COLOR_SECONDARY_BG_ACTIVE, // COLOR_SECONDARY_BG_ACTIVE
|
|
||||||
COLOR_SPLIT_BG, // COLOR_SPLIT_BG
|
|
||||||
COLOR_SPLIT_BG_ACTIVE, // COLOR_SPLIT_BG_ACTIVE
|
|
||||||
|
|
||||||
COLOR_UNKNOWN_FG, // COLOR_UNKNOWN_FG
|
|
||||||
COLOR_HEADER_FG, // COLOR_HEADER_FG
|
|
||||||
COLOR_PRIMARY_FG, // COLOR_PRIMARY_FG
|
|
||||||
COLOR_PRIMARY_FG_ACTIVE, // COLOR_PRIMARY_FG_ACTIVE
|
|
||||||
COLOR_SECONDARY_FG, // COLOR_SECONDARY_FG
|
|
||||||
COLOR_SECONDARY_FG_ACTIVE, // COLOR_SECONDARY_FG_ACTIVE
|
|
||||||
COLOR_SPLIT_FG, // COLOR_SPLIT_FG
|
|
||||||
COLOR_SPLIT_FG_ACTIVE, // COLOR_SPLIT_FG_ACTIVE
|
|
||||||
|
|
||||||
COLOR_NEGATIVE, // COLOR_NEGATIVE
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/** Set the default gui handlers used by new tables. */
|
/** Set the default gui handlers used by new tables. */
|
||||||
void gnc_table_set_default_gui_handlers (TableGUIHandlers *gui_handlers);
|
void gnc_table_set_default_gui_handlers (TableGUIHandlers *gui_handlers);
|
||||||
|
|
||||||
@ -317,12 +260,8 @@ CellIOFlags gnc_table_get_io_flags (Table *table, VirtualLocation virt_loc);
|
|||||||
|
|
||||||
guint32 gnc_table_get_fg_color (Table *table, VirtualLocation virt_loc);
|
guint32 gnc_table_get_fg_color (Table *table, VirtualLocation virt_loc);
|
||||||
|
|
||||||
guint32 gnc_table_get_gtkrc_fg_color (Table *table, VirtualLocation virt_loc);
|
|
||||||
|
|
||||||
guint32 gnc_table_get_bg_color (Table *table, VirtualLocation virt_loc,
|
guint32 gnc_table_get_bg_color (Table *table, VirtualLocation virt_loc,
|
||||||
gboolean *hatching);
|
gboolean *hatching);
|
||||||
guint32 gnc_table_get_gtkrc_bg_color (Table *table, VirtualLocation virt_loc,
|
|
||||||
gboolean *hatching);
|
|
||||||
|
|
||||||
void gnc_table_get_borders (Table *table, VirtualLocation virt_loc,
|
void gnc_table_get_borders (Table *table, VirtualLocation virt_loc,
|
||||||
PhysicalCellBorders *borders);
|
PhysicalCellBorders *borders);
|
||||||
|
@ -88,7 +88,7 @@ gnc_header_draw_offscreen (GncHeader *header)
|
|||||||
gtk_style_context_save (stylectxt);
|
gtk_style_context_save (stylectxt);
|
||||||
|
|
||||||
// Get the background color type and apply the css class
|
// Get the background color type and apply the css class
|
||||||
color_type = gnc_table_get_gtkrc_bg_color (table, virt_loc, NULL);
|
color_type = gnc_table_get_bg_color (table, virt_loc, NULL);
|
||||||
gnucash_get_style_classes (header->sheet, stylectxt, color_type);
|
gnucash_get_style_classes (header->sheet, stylectxt, color_type);
|
||||||
|
|
||||||
if (header->surface)
|
if (header->surface)
|
||||||
|
@ -345,10 +345,10 @@ draw_background_cb (GtkWidget *widget, cairo_t *cr, gpointer user_data)
|
|||||||
gtk_style_context_save (stylectxt);
|
gtk_style_context_save (stylectxt);
|
||||||
|
|
||||||
// Get the background and foreground color types and apply the css class
|
// Get the background and foreground color types and apply the css class
|
||||||
color_type = gnc_table_get_gtkrc_bg_color (item_edit->sheet->table, item_edit->virt_loc, NULL);
|
color_type = gnc_table_get_bg_color (item_edit->sheet->table, item_edit->virt_loc, NULL);
|
||||||
gnucash_get_style_classes (item_edit->sheet, stylectxt, color_type);
|
gnucash_get_style_classes (item_edit->sheet, stylectxt, color_type);
|
||||||
|
|
||||||
color_type = gnc_table_get_gtkrc_fg_color (item_edit->sheet->table, item_edit->virt_loc);
|
color_type = gnc_table_get_fg_color (item_edit->sheet->table, item_edit->virt_loc);
|
||||||
gnucash_get_style_classes (item_edit->sheet, stylectxt, color_type);
|
gnucash_get_style_classes (item_edit->sheet, stylectxt, color_type);
|
||||||
|
|
||||||
gtk_render_background (stylectxt, cr, 0, 0, width, height);
|
gtk_render_background (stylectxt, cr, 0, 0, width, height);
|
||||||
|
@ -399,10 +399,10 @@ draw_cell (GnucashSheet *sheet,
|
|||||||
gtk_style_context_save (stylectxt);
|
gtk_style_context_save (stylectxt);
|
||||||
|
|
||||||
// Get the background and foreground color types and apply the css class
|
// Get the background and foreground color types and apply the css class
|
||||||
color_type = gnc_table_get_gtkrc_bg_color (table, virt_loc, &hatching);
|
color_type = gnc_table_get_bg_color (table, virt_loc, &hatching);
|
||||||
gnucash_get_style_classes (sheet, stylectxt, color_type);
|
gnucash_get_style_classes (sheet, stylectxt, color_type);
|
||||||
|
|
||||||
color_type = gnc_table_get_gtkrc_fg_color (table, virt_loc);
|
color_type = gnc_table_get_fg_color (table, virt_loc);
|
||||||
gnucash_get_style_classes (sheet, stylectxt, color_type);
|
gnucash_get_style_classes (sheet, stylectxt, color_type);
|
||||||
|
|
||||||
// Are we in a read-only row? Then make the background color somewhat more grey.
|
// Are we in a read-only row? Then make the background color somewhat more grey.
|
||||||
|
Loading…
Reference in New Issue
Block a user