diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-06-01 21:27:12 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-06-30 00:42:22 +0800 |
commit | f8ebb730851f15da1f44e0b2fb5fca3777361fdc (patch) | |
tree | 3fdd8c83faf9574430ec049cb30f1dd9c16b37f2 /widgets/table | |
parent | d6a1733667e7aa0b9d7c5e03d606f13fddf42f84 (diff) | |
download | gsoc2013-evolution-f8ebb730851f15da1f44e0b2fb5fca3777361fdc.tar.gz gsoc2013-evolution-f8ebb730851f15da1f44e0b2fb5fca3777361fdc.tar.zst gsoc2013-evolution-f8ebb730851f15da1f44e0b2fb5fca3777361fdc.zip |
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].
Diffstat (limited to 'widgets/table')
-rw-r--r-- | widgets/table/e-cell-toggle.c | 1 | ||||
-rw-r--r-- | widgets/table/e-table-item.c | 44 |
2 files changed, 43 insertions, 2 deletions
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) { |