aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-06-01 21:27:12 +0800
committerMatthew Barnes <mbarnes@redhat.com>2011-06-01 21:27:12 +0800
commit8494cbd4f1b3ad4a3d738df03170f945afce237b (patch)
treee11a7cb1ea1f34f37c1d12a60e522da806800059 /widgets/table
parent03320071af0ec6c676df56508bfca2ec03794070 (diff)
downloadgsoc2013-evolution-8494cbd4f1b3ad4a3d738df03170f945afce237b.tar.gz
gsoc2013-evolution-8494cbd4f1b3ad4a3d738df03170f945afce237b.tar.zst
gsoc2013-evolution-8494cbd4f1b3ad4a3d738df03170f945afce237b.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.c1
-rw-r--r--widgets/table/e-table-item.c44
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)
{