mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Bug 434462 - register color don't work correct with system theme color - Part 1
This commit fixes this for ordinary registers. Entry ledgers (business) aren't handled yet.
This commit is contained in:
parent
61cd3f1106
commit
ac1990fc9d
@ -60,6 +60,17 @@ static const guint32 reg_colors_default [] =
|
||||
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
|
||||
@ -75,6 +86,17 @@ static const guint32 reg_colors_gtkrc [] =
|
||||
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
|
||||
};
|
||||
|
||||
/* This static indicates the debugging module that this .o belongs to. */
|
||||
@ -539,23 +561,113 @@ get_trans_total_balance (SplitRegister *reg, Transaction *trans)
|
||||
}
|
||||
|
||||
static guint32
|
||||
gnc_split_register_get_fg_color (VirtualLocation virt_loc,
|
||||
gpointer user_data)
|
||||
gnc_split_register_get_color_internal (VirtualLocation virt_loc,
|
||||
SplitRegister *reg,
|
||||
const guint32 *color_table,
|
||||
gboolean foreground)
|
||||
{
|
||||
SplitRegister *reg = user_data;
|
||||
const guint32 black = 0x000000;
|
||||
const guint32 red = 0xff0000;
|
||||
const char *cursor_name;
|
||||
VirtualCell *vcell;
|
||||
gboolean is_current;
|
||||
gboolean double_alternate_virt;
|
||||
guint32 colorbase = 0; /* By default return background colors */
|
||||
|
||||
if (foreground)
|
||||
colorbase = COLOR_UNKNOWN_FG; /* a bit of enum arithmetic */
|
||||
|
||||
if (!reg)
|
||||
return color_table[colorbase + COLOR_UNKNOWN_BG];
|
||||
|
||||
if (gnc_table_virtual_location_in_header (reg->table, virt_loc))
|
||||
return color_table[colorbase + COLOR_HEADER_BG];
|
||||
|
||||
vcell = gnc_table_get_virtual_cell (reg->table, virt_loc.vcell_loc);
|
||||
if (!vcell || !vcell->cellblock)
|
||||
return color_table[colorbase + COLOR_UNKNOWN_BG];
|
||||
|
||||
if ((virt_loc.phys_col_offset < vcell->cellblock->start_col) ||
|
||||
(virt_loc.phys_col_offset > vcell->cellblock->stop_col))
|
||||
return color_table[colorbase + COLOR_UNKNOWN_BG];
|
||||
|
||||
is_current = virt_cell_loc_equal (reg->table->current_cursor_loc.vcell_loc,
|
||||
virt_loc.vcell_loc);
|
||||
|
||||
cursor_name = vcell->cellblock->cursor_name;
|
||||
|
||||
if (g_strcmp0 (cursor_name, CURSOR_SINGLE_JOURNAL) == 0 ||
|
||||
g_strcmp0 (cursor_name, CURSOR_SINGLE_LEDGER) == 0)
|
||||
{
|
||||
if (is_current)
|
||||
return vcell->start_primary_color ?
|
||||
color_table[colorbase + COLOR_PRIMARY_BG_ACTIVE] :
|
||||
color_table[colorbase + COLOR_SECONDARY_BG_ACTIVE];
|
||||
|
||||
return vcell->start_primary_color ?
|
||||
color_table[colorbase + COLOR_PRIMARY_BG] : color_table[colorbase + COLOR_SECONDARY_BG];
|
||||
}
|
||||
|
||||
if (g_strcmp0 (cursor_name, CURSOR_DOUBLE_JOURNAL) == 0 ||
|
||||
g_strcmp0 (cursor_name, CURSOR_DOUBLE_JOURNAL_NUM_ACTN) == 0 ||
|
||||
g_strcmp0 (cursor_name, CURSOR_DOUBLE_LEDGER) == 0 ||
|
||||
g_strcmp0 (cursor_name, CURSOR_DOUBLE_LEDGER_NUM_ACTN) == 0)
|
||||
{
|
||||
double_alternate_virt = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL_REGISTER,
|
||||
GNC_PREF_ALT_COLOR_BY_TRANS);
|
||||
if (is_current)
|
||||
{
|
||||
if (double_alternate_virt)
|
||||
return vcell->start_primary_color ?
|
||||
color_table[colorbase + COLOR_PRIMARY_BG_ACTIVE] :
|
||||
color_table[colorbase + COLOR_SECONDARY_BG_ACTIVE];
|
||||
|
||||
return (virt_loc.phys_row_offset % 2 == 0) ?
|
||||
color_table[colorbase + COLOR_PRIMARY_BG_ACTIVE] :
|
||||
color_table[colorbase + COLOR_SECONDARY_BG_ACTIVE];
|
||||
}
|
||||
|
||||
if (double_alternate_virt)
|
||||
return vcell->start_primary_color ?
|
||||
color_table[colorbase + COLOR_PRIMARY_BG] :
|
||||
color_table[colorbase + COLOR_SECONDARY_BG];
|
||||
|
||||
return (virt_loc.phys_row_offset % 2 == 0) ?
|
||||
color_table[colorbase + COLOR_PRIMARY_BG] :
|
||||
color_table[colorbase + COLOR_SECONDARY_BG];
|
||||
}
|
||||
|
||||
if (g_strcmp0 (cursor_name, CURSOR_SPLIT) == 0)
|
||||
{
|
||||
if (is_current)
|
||||
return color_table[colorbase + COLOR_SPLIT_BG_ACTIVE];
|
||||
|
||||
return color_table[colorbase + COLOR_SPLIT_BG];
|
||||
}
|
||||
|
||||
PWARN ("Unexpected cursor: %s\n", cursor_name);
|
||||
|
||||
return color_table[colorbase + COLOR_UNKNOWN_BG];
|
||||
}
|
||||
|
||||
static guint32
|
||||
gnc_split_register_get_fg_color_internal (VirtualLocation virt_loc,
|
||||
SplitRegister *reg,
|
||||
const guint32 *color_table)
|
||||
{
|
||||
const guint32 red_color = color_table[COLOR_NEGATIVE];
|
||||
guint32 fg_color;
|
||||
const char * cell_name;
|
||||
gboolean is_current;
|
||||
gnc_numeric value;
|
||||
Split *split;
|
||||
|
||||
fg_color = gnc_split_register_get_color_internal (virt_loc, reg, color_table, TRUE);
|
||||
|
||||
if (!use_red_for_negative)
|
||||
return black;
|
||||
return fg_color;
|
||||
|
||||
split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
|
||||
if (!split)
|
||||
return black;
|
||||
return fg_color;
|
||||
|
||||
cell_name = gnc_table_get_cell_name (reg->table, virt_loc);
|
||||
|
||||
@ -574,7 +686,7 @@ gnc_split_register_get_fg_color (VirtualLocation virt_loc,
|
||||
else if (gnc_cell_name_equal (cell_name, BALN_CELL))
|
||||
value = xaccSplitGetBalance (split);
|
||||
else if (gnc_cell_name_equal (cell_name, RBALN_CELL))
|
||||
value = gnc_split_register_get_rbaln (virt_loc, user_data, TRUE);
|
||||
value = gnc_split_register_get_rbaln (virt_loc, reg, TRUE);
|
||||
else if (gnc_cell_name_equal (cell_name, TBALN_CELL))
|
||||
value = get_trans_total_balance (reg, xaccSplitGetParent (split));
|
||||
|
||||
@ -588,93 +700,25 @@ gnc_split_register_get_fg_color (VirtualLocation virt_loc,
|
||||
}
|
||||
|
||||
if (gnc_numeric_negative_p (value))
|
||||
return red;
|
||||
return red_color;
|
||||
|
||||
return black;
|
||||
return fg_color;
|
||||
}
|
||||
|
||||
static guint32
|
||||
gnc_split_register_get_bg_color_internal (VirtualLocation virt_loc,
|
||||
SplitRegister *reg,
|
||||
const guint32 *color_table,
|
||||
guint32 default_color)
|
||||
gnc_split_register_get_fg_color (VirtualLocation virt_loc,
|
||||
gpointer user_data)
|
||||
{
|
||||
const char *cursor_name;
|
||||
VirtualCell *vcell;
|
||||
gboolean is_current;
|
||||
gboolean double_alternate_virt;
|
||||
SplitRegister *reg = user_data;
|
||||
return gnc_split_register_get_fg_color_internal (virt_loc, reg, reg_colors_default);
|
||||
}
|
||||
|
||||
if (!reg)
|
||||
return default_color;
|
||||
|
||||
if (gnc_table_virtual_location_in_header (reg->table, virt_loc))
|
||||
return color_table[COLOR_HEADER_BG];
|
||||
|
||||
vcell = gnc_table_get_virtual_cell (reg->table, virt_loc.vcell_loc);
|
||||
if (!vcell || !vcell->cellblock)
|
||||
return default_color;
|
||||
|
||||
if ((virt_loc.phys_col_offset < vcell->cellblock->start_col) ||
|
||||
(virt_loc.phys_col_offset > vcell->cellblock->stop_col))
|
||||
return default_color;
|
||||
|
||||
is_current = virt_cell_loc_equal (reg->table->current_cursor_loc.vcell_loc,
|
||||
virt_loc.vcell_loc);
|
||||
|
||||
cursor_name = vcell->cellblock->cursor_name;
|
||||
|
||||
if (g_strcmp0 (cursor_name, CURSOR_SINGLE_JOURNAL) == 0 ||
|
||||
g_strcmp0 (cursor_name, CURSOR_SINGLE_LEDGER) == 0)
|
||||
{
|
||||
if (is_current)
|
||||
return vcell->start_primary_color ?
|
||||
color_table[COLOR_PRIMARY_BG_ACTIVE] :
|
||||
color_table[COLOR_SECONDARY_BG_ACTIVE];
|
||||
|
||||
return vcell->start_primary_color ?
|
||||
color_table[COLOR_PRIMARY_BG] : color_table[COLOR_SECONDARY_BG];
|
||||
}
|
||||
|
||||
if (g_strcmp0 (cursor_name, CURSOR_DOUBLE_JOURNAL) == 0 ||
|
||||
g_strcmp0 (cursor_name, CURSOR_DOUBLE_JOURNAL_NUM_ACTN) == 0 ||
|
||||
g_strcmp0 (cursor_name, CURSOR_DOUBLE_LEDGER) == 0 ||
|
||||
g_strcmp0 (cursor_name, CURSOR_DOUBLE_LEDGER_NUM_ACTN) == 0)
|
||||
{
|
||||
double_alternate_virt = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL_REGISTER,
|
||||
GNC_PREF_ALT_COLOR_BY_TRANS);
|
||||
if (is_current)
|
||||
{
|
||||
if (double_alternate_virt)
|
||||
return vcell->start_primary_color ?
|
||||
color_table[COLOR_PRIMARY_BG_ACTIVE] :
|
||||
color_table[COLOR_SECONDARY_BG_ACTIVE];
|
||||
|
||||
return (virt_loc.phys_row_offset % 2 == 0) ?
|
||||
color_table[COLOR_PRIMARY_BG_ACTIVE] :
|
||||
color_table[COLOR_SECONDARY_BG_ACTIVE];
|
||||
}
|
||||
|
||||
if (double_alternate_virt)
|
||||
return vcell->start_primary_color ?
|
||||
color_table[COLOR_PRIMARY_BG] :
|
||||
color_table[COLOR_SECONDARY_BG];
|
||||
|
||||
return (virt_loc.phys_row_offset % 2 == 0) ?
|
||||
color_table[COLOR_PRIMARY_BG] :
|
||||
color_table[COLOR_SECONDARY_BG];
|
||||
}
|
||||
|
||||
if (g_strcmp0 (cursor_name, CURSOR_SPLIT) == 0)
|
||||
{
|
||||
if (is_current)
|
||||
return color_table[COLOR_SPLIT_BG_ACTIVE];
|
||||
|
||||
return color_table[COLOR_SPLIT_BG];
|
||||
}
|
||||
|
||||
PWARN ("Unexpected cursor: %s\n", cursor_name);
|
||||
|
||||
return default_color;
|
||||
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
|
||||
@ -687,7 +731,7 @@ gnc_split_register_get_bg_color (VirtualLocation virt_loc,
|
||||
if (hatching)
|
||||
*hatching = FALSE;
|
||||
|
||||
return gnc_split_register_get_bg_color_internal (virt_loc, reg, reg_colors_default, 0xffffff);
|
||||
return gnc_split_register_get_color_internal (virt_loc, reg, reg_colors_default, FALSE);
|
||||
}
|
||||
|
||||
|
||||
@ -701,7 +745,7 @@ gnc_split_register_get_gtkrc_bg_color (VirtualLocation virt_loc,
|
||||
if (hatching)
|
||||
*hatching = FALSE;
|
||||
|
||||
return gnc_split_register_get_bg_color_internal (virt_loc, reg, reg_colors_gtkrc, COLOR_UNKNOWN_BG);
|
||||
return gnc_split_register_get_color_internal (virt_loc, reg, reg_colors_gtkrc, FALSE);
|
||||
}
|
||||
|
||||
static guint32
|
||||
@ -2611,6 +2655,9 @@ gnc_split_register_model_new (void)
|
||||
gnc_table_model_set_fg_color_handler(
|
||||
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(
|
||||
model, gnc_split_register_get_bg_color);
|
||||
|
@ -30,6 +30,7 @@ TableModel * gnc_template_register_model_new (void);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
/* Colors used for background drawing */
|
||||
COLOR_UNKNOWN_BG,
|
||||
COLOR_HEADER_BG,
|
||||
COLOR_PRIMARY_BG,
|
||||
@ -38,6 +39,22 @@ typedef enum
|
||||
COLOR_SECONDARY_BG_ACTIVE,
|
||||
COLOR_SPLIT_BG,
|
||||
COLOR_SPLIT_BG_ACTIVE,
|
||||
|
||||
/* Colors used for foreground drawing (text etc)
|
||||
* ATTENTION: the background and foreground lists should have
|
||||
* the same types (the same amount of entries) !
|
||||
* The code relies on this ! */
|
||||
COLOR_UNKNOWN_FG,
|
||||
COLOR_HEADER_FG,
|
||||
COLOR_PRIMARY_FG,
|
||||
COLOR_PRIMARY_FG_ACTIVE,
|
||||
COLOR_SECONDARY_FG,
|
||||
COLOR_SECONDARY_FG_ACTIVE,
|
||||
COLOR_SPLIT_FG,
|
||||
COLOR_SPLIT_FG_ACTIVE,
|
||||
|
||||
/* Other colors */
|
||||
COLOR_NEGATIVE, /* Color to use for negative numbers */
|
||||
} RegisterColor;
|
||||
|
||||
#endif
|
||||
|
@ -345,25 +345,39 @@ gnc_table_get_label (Table *table, VirtualLocation virt_loc)
|
||||
return label;
|
||||
}
|
||||
|
||||
guint32
|
||||
gnc_table_get_fg_color (Table *table, VirtualLocation virt_loc)
|
||||
static guint32
|
||||
gnc_table_get_fg_color_internal (Table *table, VirtualLocation virt_loc,
|
||||
gboolean want_gtkrc)
|
||||
{
|
||||
TableGetFGColorHandler fg_color_handler;
|
||||
const char *cell_name;
|
||||
const char *handler_name = "gtkrc";
|
||||
|
||||
if (!table || !table->model)
|
||||
return 0x0; /* black */
|
||||
|
||||
cell_name = gnc_table_get_cell_name (table, virt_loc);
|
||||
if (!want_gtkrc)
|
||||
handler_name = gnc_table_get_cell_name (table, virt_loc);
|
||||
|
||||
fg_color_handler = gnc_table_model_get_fg_color_handler (table->model,
|
||||
cell_name);
|
||||
handler_name);
|
||||
if (!fg_color_handler)
|
||||
return 0x0;
|
||||
|
||||
return fg_color_handler (virt_loc, table->model->handler_user_data);
|
||||
}
|
||||
|
||||
guint32
|
||||
gnc_table_get_fg_color (Table *table, VirtualLocation virt_loc)
|
||||
{
|
||||
return gnc_table_get_fg_color_internal (table, virt_loc, FALSE);
|
||||
}
|
||||
|
||||
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
|
||||
gnc_table_get_bg_color_internal (Table *table, VirtualLocation virt_loc,
|
||||
gboolean *hatching,
|
||||
|
@ -210,6 +210,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_gtkrc_fg_color (Table *table, VirtualLocation virt_loc);
|
||||
|
||||
guint32 gnc_table_get_bg_color (Table *table, VirtualLocation virt_loc,
|
||||
gboolean *hatching);
|
||||
guint32 gnc_table_get_gtkrc_bg_color (Table *table, VirtualLocation virt_loc,
|
||||
|
@ -605,17 +605,25 @@ draw_cell (GnucashGrid *grid,
|
||||
context = pango_layout_get_context (layout);
|
||||
font = pango_font_description_copy (pango_context_get_font_description (context));
|
||||
|
||||
argb = gnc_table_get_fg_color (table, virt_loc);
|
||||
#ifdef READONLY_LINES_WITH_CHANGED_FG_COLOR
|
||||
// Are we in a read-only row? Then make the foreground color somewhat less black
|
||||
if ((virt_loc.phys_row_offset == (block->style->nrows - 1))
|
||||
&& (table->model->dividing_row_upper >= 0)
|
||||
&& (virt_loc.vcell_loc.virt_row < table->model->dividing_row_upper))
|
||||
if (grid->sheet->use_theme_colors)
|
||||
{
|
||||
argb = inc_intensity_10percent(argb);
|
||||
color_type = gnc_table_get_gtkrc_fg_color (table, virt_loc);
|
||||
fg_color = get_gtkrc_color(grid->sheet, color_type);
|
||||
}
|
||||
else
|
||||
{
|
||||
argb = gnc_table_get_fg_color (table, virt_loc);
|
||||
#ifdef READONLY_LINES_WITH_CHANGED_FG_COLOR
|
||||
// Are we in a read-only row? Then make the foreground color somewhat less black
|
||||
if ((virt_loc.phys_row_offset == (block->style->nrows - 1))
|
||||
&& (table->model->dividing_row_upper >= 0)
|
||||
&& (virt_loc.vcell_loc.virt_row < table->model->dividing_row_upper))
|
||||
{
|
||||
argb = inc_intensity_10percent(argb);
|
||||
}
|
||||
#endif
|
||||
fg_color = gnucash_color_argb_to_gdk (argb);
|
||||
fg_color = gnucash_color_argb_to_gdk (argb);
|
||||
}
|
||||
|
||||
gdk_gc_set_foreground (grid->gc, fg_color);
|
||||
|
||||
|
@ -75,7 +75,7 @@ gnc_header_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
|
||||
VirtualLocation virt_loc;
|
||||
VirtualCell *vcell;
|
||||
CellDimensions *cd;
|
||||
GdkColor *bg_color;
|
||||
GdkColor *bg_color, *fg_color;
|
||||
int xpaint, ypaint;
|
||||
const char *text;
|
||||
CellBlock *cb;
|
||||
@ -94,11 +94,15 @@ gnc_header_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
|
||||
color_type = gnc_table_get_gtkrc_bg_color (table, virt_loc,
|
||||
NULL);
|
||||
bg_color = get_gtkrc_color(header->sheet, color_type);
|
||||
color_type = gnc_table_get_gtkrc_fg_color (table, virt_loc);
|
||||
fg_color = get_gtkrc_color(header->sheet, color_type);
|
||||
}
|
||||
else
|
||||
{
|
||||
argb = gnc_table_get_bg_color (table, virt_loc, NULL);
|
||||
bg_color = gnucash_color_argb_to_gdk (argb);
|
||||
argb = gnc_table_get_fg_color (table, virt_loc);
|
||||
fg_color = gnucash_color_argb_to_gdk (argb);
|
||||
}
|
||||
|
||||
h = style->dimensions->height;
|
||||
@ -111,7 +115,7 @@ gnc_header_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
|
||||
style->dimensions->width, h);
|
||||
|
||||
gdk_gc_set_line_attributes (header->gc, 1, GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_MITER);
|
||||
gdk_gc_set_foreground (header->gc, &gn_black);
|
||||
gdk_gc_set_foreground (header->gc, fg_color);
|
||||
|
||||
gdk_draw_rectangle (drawable, header->gc, FALSE, -x, -y,
|
||||
style->dimensions->width, h);
|
||||
@ -121,7 +125,7 @@ gnc_header_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
|
||||
|
||||
gdk_gc_set_line_attributes (header->gc, 1, GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_MITER);
|
||||
gdk_gc_set_background (header->gc, &gn_white);
|
||||
gdk_gc_set_foreground (header->gc, &gn_black);
|
||||
gdk_gc_set_foreground (header->gc, fg_color);
|
||||
/*font = gnucash_register_font;*/
|
||||
|
||||
vcell = gnc_table_get_virtual_cell
|
||||
|
@ -196,16 +196,20 @@ gnc_item_edit_draw_info (GncItemEdit *item_edit, int x, int y, TextDrawInfo *inf
|
||||
item_edit->virt_loc,
|
||||
&hatching);
|
||||
info->bg_color = get_gtkrc_color(item_edit->sheet, color_type);
|
||||
color_type = gnc_table_get_gtkrc_fg_color (table,
|
||||
item_edit->virt_loc);
|
||||
info->fg_color = get_gtkrc_color(item_edit->sheet, color_type);
|
||||
}
|
||||
else
|
||||
{
|
||||
argb = gnc_table_get_bg_color (table, item_edit->virt_loc,
|
||||
&hatching);
|
||||
info->bg_color = gnucash_color_argb_to_gdk (argb);
|
||||
argb = gnc_table_get_fg_color (table, item_edit->virt_loc);
|
||||
info->fg_color = gnucash_color_argb_to_gdk (argb);
|
||||
}
|
||||
|
||||
info->hatching = hatching;
|
||||
info->fg_color = &gn_black;
|
||||
|
||||
info->bg_color2 = &gn_dark_gray;
|
||||
info->fg_color2 = &gn_white;
|
||||
|
@ -2609,31 +2609,49 @@ get_gtkrc_color (GnucashSheet *sheet,
|
||||
{
|
||||
GtkWidget *widget = NULL;
|
||||
GtkStyle *style;
|
||||
GdkColor *white;
|
||||
GdkColor *white, *black, *red;
|
||||
GdkColor *color = NULL;
|
||||
|
||||
white = gnucash_color_argb_to_gdk (0xFFFFFF);
|
||||
black = gnucash_color_argb_to_gdk (0x000000);
|
||||
red = gnucash_color_argb_to_gdk (0xFF0000); /* Hardcoded...*/
|
||||
switch (field_type)
|
||||
{
|
||||
default:
|
||||
return white;
|
||||
|
||||
case COLOR_UNKNOWN_BG:
|
||||
return white;
|
||||
|
||||
case COLOR_UNKNOWN_FG:
|
||||
return black;
|
||||
|
||||
case COLOR_NEGATIVE:
|
||||
return red;
|
||||
|
||||
case COLOR_HEADER_BG:
|
||||
case COLOR_HEADER_FG:
|
||||
widget = sheet->header_color;
|
||||
break;
|
||||
|
||||
case COLOR_PRIMARY_BG:
|
||||
case COLOR_PRIMARY_BG_ACTIVE:
|
||||
case COLOR_PRIMARY_FG:
|
||||
case COLOR_PRIMARY_FG_ACTIVE:
|
||||
widget = sheet->primary_color;
|
||||
break;
|
||||
|
||||
case COLOR_SECONDARY_BG:
|
||||
case COLOR_SECONDARY_BG_ACTIVE:
|
||||
case COLOR_SECONDARY_FG:
|
||||
case COLOR_SECONDARY_FG_ACTIVE:
|
||||
widget = sheet->secondary_color;
|
||||
break;
|
||||
|
||||
case COLOR_SPLIT_BG:
|
||||
case COLOR_SPLIT_BG_ACTIVE:
|
||||
case COLOR_SPLIT_FG:
|
||||
case COLOR_SPLIT_FG_ACTIVE:
|
||||
widget = sheet->split_color;
|
||||
break;
|
||||
}
|
||||
@ -2659,6 +2677,19 @@ get_gtkrc_color (GnucashSheet *sheet,
|
||||
case COLOR_SPLIT_BG_ACTIVE:
|
||||
color = &style->base[GTK_STATE_SELECTED];
|
||||
break;
|
||||
|
||||
case COLOR_HEADER_FG:
|
||||
case COLOR_PRIMARY_FG:
|
||||
case COLOR_SECONDARY_FG:
|
||||
case COLOR_SPLIT_FG:
|
||||
color = &style->text[GTK_STATE_NORMAL];
|
||||
break;
|
||||
|
||||
case COLOR_PRIMARY_FG_ACTIVE:
|
||||
case COLOR_SECONDARY_FG_ACTIVE:
|
||||
case COLOR_SPLIT_FG_ACTIVE:
|
||||
color = &style->text[GTK_STATE_SELECTED];
|
||||
break;
|
||||
}
|
||||
|
||||
gnucash_color_alloc_gdk(color);
|
||||
|
Loading…
Reference in New Issue
Block a user