Commit 1b2fb3a6 authored by Morten Welinder's avatar Morten Welinder

GUI: simplify code for colouring deps.

parent da324e2b
2013-03-25 Morten Welinder <terra@gnome.org>
* src/item-cursor.c (gnm_item_cursor_class_init): Change type of
color to GOColor.
* src/gnm-pane.c (gnm_pane_expr_cursor_bound_set): Take GOColor,
not colour name.
* src/item-bar.c: Rename: ItemBar to GnmItemBar.
* src/gnumeric.css: use deprecated px-free syntax for padding, so
......
......@@ -2254,7 +2254,7 @@ gnm_pane_mouse_cursor_set (GnmPane *pane, GdkCursor *c)
void
gnm_pane_expr_cursor_bound_set (GnmPane *pane, GnmRange const *r,
gchar const *color)
GOColor color)
{
GnmItemCursor *cursor;
......
......@@ -42,7 +42,7 @@ void gnm_pane_special_cursor_start (GnmPane *pane, int style, int button);
void gnm_pane_special_cursor_stop (GnmPane *pane);
void gnm_pane_mouse_cursor_set (GnmPane *pane, GdkCursor *c);
void gnm_pane_expr_cursor_bound_set (GnmPane *pane, GnmRange const *r,
gchar const *color);
GOColor color);
void gnm_pane_expr_cursor_stop (GnmPane *pane);
/************************************************************************/
......
......@@ -1394,7 +1394,6 @@ item_cursor_set_property (GObject *obj, guint param_id,
GValue const *value, GParamSpec *pspec)
{
GnmItemCursor *ic = GNM_ITEM_CURSOR (obj);
char const *color_name;
switch (param_id) {
case ITEM_CURSOR_PROP_SHEET_CONTROL_GUI:
......@@ -1406,14 +1405,9 @@ item_cursor_set_property (GObject *obj, guint param_id,
case ITEM_CURSOR_PROP_BUTTON :
ic->drag_button = g_value_get_int (value);
break;
case ITEM_CURSOR_PROP_COLOR: {
GOColor color;
color_name = g_value_get_string (value);
if (go_color_from_str (color_name, &color)) {
go_color_to_gdk_rgba (color, &ic->color);
ic->use_color = 1;
}
}
case ITEM_CURSOR_PROP_COLOR:
go_color_to_gdk_rgba (g_value_get_uint (value), &ic->color);
ic->use_color = 1;
}
}
......@@ -1446,10 +1440,11 @@ gnm_item_cursor_class_init (GObjectClass *gobject_klass)
0, G_MAXINT, 0,
GSF_PARAM_STATIC | G_PARAM_WRITABLE));
g_object_class_install_property (gobject_klass, ITEM_CURSOR_PROP_COLOR,
g_param_spec_string ("color", "Color",
"name of the cursor's color",
"black",
GSF_PARAM_STATIC | G_PARAM_WRITABLE));
g_param_spec_uint ("color", "Color",
"Name of the cursor's color",
0, 0xffffffff,
GO_COLOR_BLACK,
GSF_PARAM_STATIC | G_PARAM_WRITABLE));
item_klass->realize = item_cursor_realize;
item_klass->unrealize = item_cursor_unrealize;
......
2013-03-25 Morten Welinder <terra@gnome.org>
* gnumeric-expr-entry.c (gnm_expr_entry_colour_ranges): Make sure
we only have the colours once here.
2013-03-09 Morten Welinder <terra@gnome.org>
* Release 1.12.1
......
......@@ -599,17 +599,14 @@ static void
gnm_expr_entry_colour_ranges (GnmExprEntry *gee, int start, int end, GnmRangeRef *rr, int colour,
PangoAttrList **attrs, gboolean insert_cursor)
{
static struct {
guint16 red;
guint16 green;
guint16 blue;
gchar const *name;
} colours[] = {{0x0, 0xFFFF, 0x0, "00:ff:00:ff"},
{0x0, 0x0, 0xFFFF, "00:00:ff:ff"},
{0xFFFF, 0x0, 0x0, "ff:00:00:ff"},
{0x0, 0x80FF, 0x80FF, "00:80:80:ff"},
{0xA0FF, 0xA0FF, 0x0, "a0:a0:00:ff"},
{0xA0FF, 0x0, 0xA0FF, "a0:00:a0:ff"}};
static const GOColor colours[] = {
GO_COLOR_FROM_RGB (0x00, 0xff, 0x00),
GO_COLOR_FROM_RGB (0x00, 0x00, 0xff),
GO_COLOR_FROM_RGB (0xff, 0x00, 0x00),
GO_COLOR_FROM_RGB (0x00, 0x80, 0x80),
GO_COLOR_FROM_RGB (0xa0, 0xa0, 0x00),
GO_COLOR_FROM_RGB (0xa0, 0x00, 0xa0)
};
PangoAttribute *at;
GnmRange r;
GnmRange const *merge; /*[#127415]*/
......@@ -646,11 +643,10 @@ gnm_expr_entry_colour_ranges (GnmExprEntry *gee, int start, int end, GnmRangeRef
}
SCG_FOREACH_PANE (scg, pane, gnm_pane_expr_cursor_bound_set
(pane, &r, colours[colour].name););
(pane, &r, colours[colour]););
}
at = pango_attr_foreground_new (colours[colour].red, colours[colour].green,
colours[colour].blue);
at = go_color_to_pango (colours[colour], TRUE);
at->start_index = start;
at->end_index = end;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment