diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-06-01 21:27:12 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2011-06-01 21:27:12 +0800 |
commit | 8494cbd4f1b3ad4a3d738df03170f945afce237b (patch) | |
tree | e11a7cb1ea1f34f37c1d12a60e522da806800059 /widgets | |
parent | 03320071af0ec6c676df56508bfca2ec03794070 (diff) | |
download | gsoc2013-evolution-8494cbd4f1b3ad4a3d738df03170f945afce237b.tar gsoc2013-evolution-8494cbd4f1b3ad4a3d738df03170f945afce237b.tar.gz gsoc2013-evolution-8494cbd4f1b3ad4a3d738df03170f945afce237b.tar.bz2 gsoc2013-evolution-8494cbd4f1b3ad4a3d738df03170f945afce237b.tar.lz gsoc2013-evolution-8494cbd4f1b3ad4a3d738df03170f945afce237b.tar.xz 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')
-rw-r--r-- | widgets/misc/Makefile.am | 2 | ||||
-rw-r--r-- | widgets/misc/e-canvas-background.c | 1 | ||||
-rw-r--r-- | widgets/misc/e-hsv-utils.c | 72 | ||||
-rw-r--r-- | widgets/misc/e-hsv-utils.h | 38 | ||||
-rw-r--r-- | widgets/table/e-cell-toggle.c | 1 | ||||
-rw-r--r-- | widgets/table/e-table-item.c | 44 |
6 files changed, 43 insertions, 115 deletions
diff --git a/widgets/misc/Makefile.am b/widgets/misc/Makefile.am index 05a5967b7f..fdcd5417dd 100644 --- a/widgets/misc/Makefile.am +++ b/widgets/misc/Makefile.am @@ -36,7 +36,6 @@ widgetsinclude_HEADERS = \ e-dateedit.h \ e-focus-tracker.h \ e-hinted-entry.h \ - e-hsv-utils.h \ e-image-chooser.h \ e-import-assistant.h \ e-map.h \ @@ -115,7 +114,6 @@ libemiscwidgets_la_SOURCES = \ e-dateedit.c \ e-focus-tracker.c \ e-hinted-entry.c \ - e-hsv-utils.c \ e-image-chooser.c \ e-import-assistant.c \ e-map.c \ diff --git a/widgets/misc/e-canvas-background.c b/widgets/misc/e-canvas-background.c index 10cddb4219..dc415777d9 100644 --- a/widgets/misc/e-canvas-background.c +++ b/widgets/misc/e-canvas-background.c @@ -37,7 +37,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-canvas-background.h" diff --git a/widgets/misc/e-hsv-utils.c b/widgets/misc/e-hsv-utils.c deleted file mode 100644 index 81919a2258..0000000000 --- a/widgets/misc/e-hsv-utils.c +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-hsv-utils.c - utilites for manipulating colors in HSV space - * Copyright (C) 1995-2001 Seth Nickell, Peter Mattis, Spencer Kimball and Josh MacDonald - * - * Authors: - * Seth Nickell <seth@eazel.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "e-hsv-utils.h" - -/* 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 */ -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; -} - diff --git a/widgets/misc/e-hsv-utils.h b/widgets/misc/e-hsv-utils.h deleted file mode 100644 index e2f707e56a..0000000000 --- a/widgets/misc/e-hsv-utils.h +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-hsv-utils.h - utilites for manipulating colors in HSV space - * Copyright (C) 1995-2001 Seth Nickell, Peter Mattis, Spencer Kimball and Josh MacDonald - * - * Authors: - * Seth Nickell <seth@eazel.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. - */ - -#ifndef _E_HSV_UTILS_H_ -#define _E_HSV_UTILS_H_ - -#include <gtk/gtk.h> - -G_BEGIN_DECLS - -void e_hsv_tweak (GdkColor *color, - gdouble delta_h, - gdouble delta_s, - gdouble delta_v); - -G_END_DECLS - -#endif /* _E_HSV_UTILS_H_ */ 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) { |