From f8ebb730851f15da1f44e0b2fb5fca3777361fdc Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 1 Jun 2011 09:27:12 -0400 Subject: Embed e_hsv_tweak() directly in e-table-item.c. ETableItem is the last user of e_hsv_tweak(). This allows us to remove widgets/misc/e-hsv-utils.[ch]. --- widgets/table/e-cell-toggle.c | 1 - widgets/table/e-table-item.c | 44 ++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 43 insertions(+), 2 deletions(-) (limited to 'widgets/table') diff --git a/widgets/table/e-cell-toggle.c b/widgets/table/e-cell-toggle.c index 8583446734..06b26c53d4 100644 --- a/widgets/table/e-cell-toggle.c +++ b/widgets/table/e-cell-toggle.c @@ -35,7 +35,6 @@ #include "gal-a11y-e-cell-toggle.h" #include "gal-a11y-e-cell-registry.h" #include "e-util/e-util.h" -#include "misc/e-hsv-utils.h" #include "e-cell-toggle.h" #include "e-table-item.h" diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c index 4b4299fc58..ac46df2cd3 100644 --- a/widgets/table/e-table-item.c +++ b/widgets/table/e-table-item.c @@ -44,7 +44,6 @@ #include "e-util/e-util.h" #include "misc/e-canvas.h" #include "misc/e-canvas-utils.h" -#include "misc/e-hsv-utils.h" #include "e-cell.h" #include "e-table-item.h" @@ -122,6 +121,49 @@ static void e_table_item_redraw_row (ETableItem *eti, gint row); #define ETI_MULTIPLE_ROW_HEIGHT(eti,row) ((eti)->height_cache && (eti)->height_cache[(row)] != -1 ? (eti)->height_cache[(row)] : eti_row_height((eti),(row))) #define ETI_ROW_HEIGHT(eti,row) ((eti)->uniform_row_height ? ETI_SINGLE_ROW_HEIGHT ((eti)) : ETI_MULTIPLE_ROW_HEIGHT((eti),(row))) +/* tweak_hsv is a really tweaky function. it modifies its first argument, which + should be the color you want tweaked. delta_h, delta_s and delta_v specify + how much you want their respective channels modified (and in what direction). + if it can't do the specified modification, it does it in the oppositon direction */ +static void +e_hsv_tweak (GdkColor *color, + gdouble delta_h, + gdouble delta_s, + gdouble delta_v) +{ + gdouble h, s, v, r, g, b; + + r = color->red / 65535.0f; + g = color->green / 65535.0f; + b = color->blue / 65535.0f; + + gtk_rgb_to_hsv (r, g, b, &h, &s, &v); + + if (h + delta_h < 0) { + h -= delta_h; + } else { + h += delta_h; + } + + if (s + delta_s < 0) { + s -= delta_s; + } else { + s += delta_s; + } + + if (v + delta_v < 0) { + v -= delta_v; + } else { + v += delta_v; + } + + gtk_hsv_to_rgb (h, s, v, &r, &g, &b); + + color->red = r * 65535.0f; + color->green = g * 65535.0f; + color->blue = b * 65535.0f; +} + inline static gint model_to_view_row (ETableItem *eti, gint row) { -- cgit v1.2.3