app/tools/gimpbrightnesscontrasttool.c app/tools/gimpcolorbalancetool.c

2007-12-29  Michael Natterer  <mitch@gimp.org>

	* app/tools/gimpbrightnesscontrasttool.c
	* app/tools/gimpcolorbalancetool.c
	* app/tools/gimpcolorizetool.c
	* app/tools/gimphuesaturationtool.c
	* app/tools/gimplevelstool.c
	* app/tools/gimpthresholdtool.c: more cleanup in preparation of
	migrating to gegl.


svn path=/trunk/; revision=24468
This commit is contained in:
Michael Natterer 2007-12-29 16:29:31 +00:00 committed by Michael Natterer
parent 3377d0423b
commit e485274069
7 changed files with 190 additions and 205 deletions

View File

@ -1,3 +1,13 @@
2007-12-29 Michael Natterer <mitch@gimp.org>
* app/tools/gimpbrightnesscontrasttool.c
* app/tools/gimpcolorbalancetool.c
* app/tools/gimpcolorizetool.c
* app/tools/gimphuesaturationtool.c
* app/tools/gimplevelstool.c
* app/tools/gimpthresholdtool.c: more cleanup in preparation of
migrating to gegl.
2007-12-29 Michael Natterer <mitch@gimp.org>
* app/gegl/gimp-gegl.c

View File

@ -73,7 +73,7 @@ static void gimp_brightness_contrast_tool_map (GimpImageMapTool
static void gimp_brightness_contrast_tool_dialog (GimpImageMapTool *image_map_tool);
static void gimp_brightness_contrast_tool_reset (GimpImageMapTool *image_map_tool);
static void brightness_contrast_update (GimpBrightnessContrastTool *bc_tool);
static void brightness_contrast_update_sliders (GimpBrightnessContrastTool *bc_tool);
static void brightness_contrast_brightness_changed (GtkAdjustment *adj,
GimpBrightnessContrastTool *bc_tool);
static void brightness_contrast_contrast_changed (GtkAdjustment *adj,
@ -170,7 +170,7 @@ gimp_brightness_contrast_tool_initialize (GimpTool *tool,
GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error);
brightness_contrast_update (bc_tool);
brightness_contrast_update_sliders (bc_tool);
return TRUE;
}
@ -230,7 +230,6 @@ gimp_brightness_contrast_tool_button_release (GimpTool *tool,
gimp_image_map_tool_preview (im_tool);
}
static void
gimp_brightness_contrast_tool_motion (GimpTool *tool,
GimpCoords *coords,
@ -249,7 +248,7 @@ gimp_brightness_contrast_tool_motion (GimpTool *tool,
bc_tool->brightness = CLAMP (bc_tool->dy, -127.0, 127.0);
bc_tool->contrast = CLAMP (bc_tool->dx, -127.0, 127.0);
brightness_contrast_update (bc_tool);
brightness_contrast_update_sliders (bc_tool);
gimp_image_map_tool_preview (im_tool);
gimp_tool_control_resume (tool->control);
@ -315,11 +314,11 @@ gimp_brightness_contrast_tool_reset (GimpImageMapTool *im_tool)
bc_tool->brightness = 0.0;
bc_tool->contrast = 0.0;
brightness_contrast_update (bc_tool);
brightness_contrast_update_sliders (bc_tool);
}
static void
brightness_contrast_update (GimpBrightnessContrastTool *bc_tool)
brightness_contrast_update_sliders (GimpBrightnessContrastTool *bc_tool)
{
gtk_adjustment_set_value (bc_tool->brightness_data, bc_tool->brightness);
gtk_adjustment_set_value (bc_tool->contrast_data, bc_tool->contrast);

View File

@ -57,13 +57,13 @@ static void color_balance_range_callback (GtkWidget *widget
GimpColorBalanceTool *cb_tool);
static void color_balance_range_reset_callback (GtkWidget *widget,
GimpColorBalanceTool *cb_tool);
static void color_balance_preserve_update (GtkWidget *widget,
static void color_balance_preserve_toggled (GtkWidget *widget,
GimpColorBalanceTool *cb_tool);
static void color_balance_cr_adjustment_update (GtkAdjustment *adj,
static void color_balance_cr_changed (GtkAdjustment *adj,
GimpColorBalanceTool *cb_tool);
static void color_balance_mg_adjustment_update (GtkAdjustment *adj,
static void color_balance_mg_changed (GtkAdjustment *adj,
GimpColorBalanceTool *cb_tool);
static void color_balance_yb_adjustment_update (GtkAdjustment *adj,
static void color_balance_yb_changed (GtkAdjustment *adj,
GimpColorBalanceTool *cb_tool);
@ -251,21 +251,21 @@ gimp_color_balance_tool_dialog (GimpImageMapTool *im_tool)
create_levels_scale (_("Cyan"), _("Red"), table, 0);
g_signal_connect (cb_tool->cyan_red_adj, "value-changed",
G_CALLBACK (color_balance_cr_adjustment_update),
G_CALLBACK (color_balance_cr_changed),
cb_tool);
cb_tool->magenta_green_adj =
create_levels_scale (_("Magenta"), _("Green"), table, 1);
g_signal_connect (cb_tool->magenta_green_adj, "value-changed",
G_CALLBACK (color_balance_mg_adjustment_update),
G_CALLBACK (color_balance_mg_changed),
cb_tool);
cb_tool->yellow_blue_adj =
create_levels_scale (_("Yellow"), _("Blue"), table, 2);
g_signal_connect (cb_tool->yellow_blue_adj, "value-changed",
G_CALLBACK (color_balance_yb_adjustment_update),
G_CALLBACK (color_balance_yb_changed),
cb_tool);
hbox = gtk_hbox_new (FALSE, 6);
@ -289,7 +289,7 @@ gimp_color_balance_tool_dialog (GimpImageMapTool *im_tool)
gtk_widget_show (cb_tool->preserve_toggle);
g_signal_connect (cb_tool->preserve_toggle, "toggled",
G_CALLBACK (color_balance_preserve_update),
G_CALLBACK (color_balance_preserve_toggled),
cb_tool);
/* set range after everything is in place */
@ -342,12 +342,10 @@ color_balance_range_reset_callback (GtkWidget *widget,
}
static void
color_balance_preserve_update (GtkWidget *widget,
GimpColorBalanceTool *cb_tool)
color_balance_preserve_toggled (GtkWidget *widget,
GimpColorBalanceTool *cb_tool)
{
gboolean active;
active = GTK_TOGGLE_BUTTON (widget)->active;
gboolean active = GTK_TOGGLE_BUTTON (widget)->active;
if (cb_tool->color_balance->preserve_luminosity != active)
{
@ -358,12 +356,10 @@ color_balance_preserve_update (GtkWidget *widget,
}
static void
color_balance_cr_adjustment_update (GtkAdjustment *adjustment,
GimpColorBalanceTool *cb_tool)
color_balance_cr_changed (GtkAdjustment *adjustment,
GimpColorBalanceTool *cb_tool)
{
GimpTransferMode tm;
tm = cb_tool->transfer_mode;
GimpTransferMode tm = cb_tool->transfer_mode;
if (cb_tool->color_balance->cyan_red[tm] != adjustment->value)
{
@ -374,12 +370,10 @@ color_balance_cr_adjustment_update (GtkAdjustment *adjustment,
}
static void
color_balance_mg_adjustment_update (GtkAdjustment *adjustment,
GimpColorBalanceTool *cb_tool)
color_balance_mg_changed (GtkAdjustment *adjustment,
GimpColorBalanceTool *cb_tool)
{
GimpTransferMode tm;
tm = cb_tool->transfer_mode;
GimpTransferMode tm = cb_tool->transfer_mode;
if (cb_tool->color_balance->magenta_green[tm] != adjustment->value)
{
@ -390,12 +384,10 @@ color_balance_mg_adjustment_update (GtkAdjustment *adjustment,
}
static void
color_balance_yb_adjustment_update (GtkAdjustment *adjustment,
GimpColorBalanceTool *cb_tool)
color_balance_yb_changed (GtkAdjustment *adjustment,
GimpColorBalanceTool *cb_tool)
{
GimpTransferMode tm;
tm = cb_tool->transfer_mode;
GimpTransferMode tm = cb_tool->transfer_mode;
if (cb_tool->color_balance->yellow_blue[tm] != adjustment->value)
{

View File

@ -40,16 +40,9 @@
#include "gimp-intl.h"
#define SLIDER_WIDTH 200
#define DA_WIDTH 40
#define DA_HEIGHT 20
#define HUE_SLIDER (1 << 0)
#define SATURATION_SLIDER (1 << 1)
#define LIGHTNESS_SLIDER (1 << 2)
#define DRAW (1 << 3)
#define SLIDERS (HUE_SLIDER | LIGHTNESS_SLIDER | SATURATION_SLIDER)
#define ALL (SLIDERS | DRAW)
#define SLIDER_WIDTH 200
#define DA_WIDTH 40
#define DA_HEIGHT 20
/* local function prototypes */
@ -64,13 +57,12 @@ static void gimp_colorize_tool_map (GimpImageMapTool *im_tool);
static void gimp_colorize_tool_dialog (GimpImageMapTool *im_tool);
static void gimp_colorize_tool_reset (GimpImageMapTool *im_tool);
static void colorize_update (GimpColorizeTool *col_tool,
gint update);
static void colorize_hue_adj_update (GtkAdjustment *adj,
static void colorize_update_sliders (GimpColorizeTool *col_tool);
static void colorize_hue_changed (GtkAdjustment *adj,
GimpColorizeTool *col_tool);
static void colorize_saturation_adj_update (GtkAdjustment *adj,
static void colorize_saturation_changed (GtkAdjustment *adj,
GimpColorizeTool *col_tool);
static void colorize_lightness_adj_update (GtkAdjustment *adj,
static void colorize_lightness_changed (GtkAdjustment *adj,
GimpColorizeTool *col_tool);
@ -150,10 +142,11 @@ gimp_colorize_tool_initialize (GimpTool *tool,
}
colorize_init (col_tool->colorize);
colorize_calculate (col_tool->colorize);
GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error);
colorize_update (col_tool, ALL);
colorize_update_sliders (col_tool);
gimp_image_map_tool_preview (GIMP_IMAGE_MAP_TOOL (tool));
@ -212,7 +205,7 @@ gimp_colorize_tool_dialog (GimpImageMapTool *image_map_tool)
gtk_range_set_update_policy (GTK_RANGE (slider), GTK_UPDATE_CONTINUOUS);
g_signal_connect (data, "value-changed",
G_CALLBACK (colorize_hue_adj_update),
G_CALLBACK (colorize_hue_changed),
col_tool);
/* Create the saturation scale widget */
@ -226,7 +219,7 @@ gimp_colorize_tool_dialog (GimpImageMapTool *image_map_tool)
gtk_range_set_update_policy (GTK_RANGE (slider), GTK_UPDATE_CONTINUOUS);
g_signal_connect (col_tool->saturation_data, "value-changed",
G_CALLBACK (colorize_saturation_adj_update),
G_CALLBACK (colorize_saturation_changed),
col_tool);
/* Create the lightness scale widget */
@ -240,7 +233,7 @@ gimp_colorize_tool_dialog (GimpImageMapTool *image_map_tool)
gtk_range_set_update_policy (GTK_RANGE (slider), GTK_UPDATE_CONTINUOUS);
g_signal_connect (data, "value-changed",
G_CALLBACK (colorize_lightness_adj_update),
G_CALLBACK (colorize_lightness_changed),
col_tool);
}
@ -250,63 +243,56 @@ gimp_colorize_tool_reset (GimpImageMapTool *image_map_tool)
GimpColorizeTool *col_tool = GIMP_COLORIZE_TOOL (image_map_tool);
colorize_init (col_tool->colorize);
colorize_update (col_tool, ALL);
}
static void
colorize_update (GimpColorizeTool *col_tool,
gint update)
{
colorize_calculate (col_tool->colorize);
if (update & HUE_SLIDER)
gtk_adjustment_set_value (GTK_ADJUSTMENT (col_tool->hue_data),
col_tool->colorize->hue);
if (update & SATURATION_SLIDER)
gtk_adjustment_set_value (GTK_ADJUSTMENT (col_tool->saturation_data),
col_tool->colorize->saturation);
if (update & LIGHTNESS_SLIDER)
gtk_adjustment_set_value (GTK_ADJUSTMENT (col_tool->lightness_data),
col_tool->colorize->lightness);
colorize_update_sliders (col_tool);
}
static void
colorize_hue_adj_update (GtkAdjustment *adjustment,
GimpColorizeTool *col_tool)
colorize_update_sliders (GimpColorizeTool *col_tool)
{
gtk_adjustment_set_value (GTK_ADJUSTMENT (col_tool->hue_data),
col_tool->colorize->hue);
gtk_adjustment_set_value (GTK_ADJUSTMENT (col_tool->saturation_data),
col_tool->colorize->saturation);
gtk_adjustment_set_value (GTK_ADJUSTMENT (col_tool->lightness_data),
col_tool->colorize->lightness);
}
static void
colorize_hue_changed (GtkAdjustment *adjustment,
GimpColorizeTool *col_tool)
{
if (col_tool->colorize->hue != adjustment->value)
{
col_tool->colorize->hue = adjustment->value;
colorize_update (col_tool, DRAW);
colorize_calculate (col_tool->colorize);
gimp_image_map_tool_preview (GIMP_IMAGE_MAP_TOOL (col_tool));
}
}
static void
colorize_saturation_adj_update (GtkAdjustment *adjustment,
GimpColorizeTool *col_tool)
colorize_saturation_changed (GtkAdjustment *adjustment,
GimpColorizeTool *col_tool)
{
if (col_tool->colorize->saturation != adjustment->value)
{
col_tool->colorize->saturation = adjustment->value;
colorize_update (col_tool, DRAW);
colorize_calculate (col_tool->colorize);
gimp_image_map_tool_preview (GIMP_IMAGE_MAP_TOOL (col_tool));
}
}
static void
colorize_lightness_adj_update (GtkAdjustment *adjustment,
GimpColorizeTool *col_tool)
colorize_lightness_changed (GtkAdjustment *adjustment,
GimpColorizeTool *col_tool)
{
if (col_tool->colorize->lightness != adjustment->value)
{
col_tool->colorize->lightness = adjustment->value;
colorize_update (col_tool, DRAW);
colorize_calculate (col_tool->colorize);
gimp_image_map_tool_preview (GIMP_IMAGE_MAP_TOOL (col_tool));
}

View File

@ -45,17 +45,6 @@
#define DA_WIDTH 40
#define DA_HEIGHT 20
#define HUE_SLIDER (1 << 0)
#define LIGHTNESS_SLIDER (1 << 1)
#define SATURATION_SLIDER (1 << 2)
#define DRAW (1 << 3)
#define OVERLAP_SLIDER (1 << 4)
#define SLIDERS (HUE_SLIDER | \
LIGHTNESS_SLIDER | \
SATURATION_SLIDER | \
OVERLAP_SLIDER)
#define ALL (SLIDERS | DRAW)
/* local function prototypes */
@ -69,20 +58,21 @@ static void gimp_hue_saturation_tool_map (GimpImageMapTool *im_tool);
static void gimp_hue_saturation_tool_dialog (GimpImageMapTool *im_tool);
static void gimp_hue_saturation_tool_reset (GimpImageMapTool *im_tool);
static void hue_saturation_update (GimpHueSaturationTool *hs_tool,
gint update);
static void hue_saturation_partition_callback (GtkWidget *widget,
gpointer data);
static void hue_saturation_partition_reset_callback (GtkWidget *widget,
gpointer data);
static void hue_saturation_hue_adjustment_update (GtkAdjustment *adj,
gpointer data);
static void hue_saturation_lightness_adjustment_update (GtkAdjustment *adj,
gpointer data);
static void hue_saturation_saturation_adjustment_update (GtkAdjustment *adj,
gpointer data);
static void hue_saturation_overlap_adjustment_update (GtkAdjustment *adj,
gpointer data);
static void hue_saturation_update_sliders (GimpHueSaturationTool *hs_tool);
static void hue_saturation_update_color_areas (GimpHueSaturationTool *hs_tool);
static void hue_saturation_partition_callback (GtkWidget *widget,
gpointer data);
static void hue_saturation_partition_reset_callback (GtkWidget *widget,
gpointer data);
static void hue_saturation_hue_changed (GtkAdjustment *adj,
gpointer data);
static void hue_saturation_lightness_changed (GtkAdjustment *adj,
gpointer data);
static void hue_saturation_saturation_changed (GtkAdjustment *adj,
gpointer data);
static void hue_saturation_overlap_changed (GtkAdjustment *adj,
gpointer data);
G_DEFINE_TYPE (GimpHueSaturationTool, gimp_hue_saturation_tool,
@ -175,10 +165,12 @@ gimp_hue_saturation_tool_initialize (GimpTool *tool,
}
hue_saturation_init (hs_tool->hue_saturation);
hue_saturation_calculate_transfers (hs_tool->hue_saturation);
GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error);
hue_saturation_update (hs_tool, ALL);
hue_saturation_update_sliders (hs_tool);
hue_saturation_update_color_areas (hs_tool);
return TRUE;
}
@ -338,7 +330,7 @@ gimp_hue_saturation_tool_dialog (GimpImageMapTool *image_map_tool)
gtk_range_set_update_policy (GTK_RANGE (slider), GTK_UPDATE_CONTINUOUS);
g_signal_connect (data, "value-changed",
G_CALLBACK (hue_saturation_overlap_adjustment_update),
G_CALLBACK (hue_saturation_overlap_changed),
hs_tool);
frame = gimp_frame_new (_("Adjust Selected Color"));
@ -372,7 +364,7 @@ gimp_hue_saturation_tool_dialog (GimpImageMapTool *image_map_tool)
gtk_range_set_update_policy (GTK_RANGE (slider), GTK_UPDATE_CONTINUOUS);
g_signal_connect (data, "value-changed",
G_CALLBACK (hue_saturation_hue_adjustment_update),
G_CALLBACK (hue_saturation_hue_changed),
hs_tool);
/* Create the lightness scale widget */
@ -390,7 +382,7 @@ gimp_hue_saturation_tool_dialog (GimpImageMapTool *image_map_tool)
gtk_range_set_update_policy (GTK_RANGE (slider), GTK_UPDATE_CONTINUOUS);
g_signal_connect (data, "value-changed",
G_CALLBACK (hue_saturation_lightness_adjustment_update),
G_CALLBACK (hue_saturation_lightness_changed),
hs_tool);
/* Create the saturation scale widget */
@ -408,7 +400,7 @@ gimp_hue_saturation_tool_dialog (GimpImageMapTool *image_map_tool)
gtk_range_set_update_policy (GTK_RANGE (slider), GTK_UPDATE_CONTINUOUS);
g_signal_connect (hs_tool->saturation_data, "value-changed",
G_CALLBACK (hue_saturation_saturation_adjustment_update),
G_CALLBACK (hue_saturation_saturation_changed),
hs_tool);
hbox = gtk_hbox_new (FALSE, 6);
@ -430,57 +422,51 @@ gimp_hue_saturation_tool_reset (GimpImageMapTool *image_map_tool)
GimpHueSaturationTool *hs_tool = GIMP_HUE_SATURATION_TOOL (image_map_tool);
hue_saturation_init (hs_tool->hue_saturation);
hue_saturation_update (hs_tool, ALL);
hue_saturation_calculate_transfers (hs_tool->hue_saturation);
hue_saturation_update_sliders (hs_tool);
hue_saturation_update_color_areas (hs_tool);
}
static void
hue_saturation_update (GimpHueSaturationTool *hs_tool,
gint update)
hue_saturation_update_sliders (GimpHueSaturationTool *hs_tool)
{
gtk_adjustment_set_value (GTK_ADJUSTMENT (hs_tool->hue_data),
hs_tool->hue_saturation->hue[hs_tool->hue_partition]);
gtk_adjustment_set_value (GTK_ADJUSTMENT (hs_tool->lightness_data),
hs_tool->hue_saturation->lightness[hs_tool->hue_partition]);
gtk_adjustment_set_value (GTK_ADJUSTMENT (hs_tool->saturation_data),
hs_tool->hue_saturation->saturation[hs_tool->hue_partition]);
gtk_adjustment_set_value (GTK_ADJUSTMENT (hs_tool->overlap_data),
hs_tool->hue_saturation->overlap);
}
static void
hue_saturation_update_color_areas (GimpHueSaturationTool *hs_tool)
{
gint rgb[3];
GimpRGB color;
gint i;
hue_saturation_calculate_transfers (hs_tool->hue_saturation);
if (update & HUE_SLIDER)
gtk_adjustment_set_value (GTK_ADJUSTMENT (hs_tool->hue_data),
hs_tool->hue_saturation->hue[hs_tool->hue_partition]);
if (update & LIGHTNESS_SLIDER)
gtk_adjustment_set_value (GTK_ADJUSTMENT (hs_tool->lightness_data),
hs_tool->hue_saturation->lightness[hs_tool->hue_partition]);
if (update & SATURATION_SLIDER)
gtk_adjustment_set_value (GTK_ADJUSTMENT (hs_tool->saturation_data),
hs_tool->hue_saturation->saturation[hs_tool->hue_partition]);
if (update & OVERLAP_SLIDER)
gtk_adjustment_set_value (GTK_ADJUSTMENT (hs_tool->overlap_data),
hs_tool->hue_saturation->overlap);
if (update & DRAW)
for (i = 0; i < 6; i++)
{
for (i = 0; i < 6; i++)
{
rgb[RED_PIX] = default_colors[i][RED_PIX];
rgb[GREEN_PIX] = default_colors[i][GREEN_PIX];
rgb[BLUE_PIX] = default_colors[i][BLUE_PIX];
rgb[RED_PIX] = default_colors[i][RED_PIX];
rgb[GREEN_PIX] = default_colors[i][GREEN_PIX];
rgb[BLUE_PIX] = default_colors[i][BLUE_PIX];
gimp_rgb_to_hsl_int (rgb, rgb + 1, rgb + 2);
gimp_rgb_to_hsl_int (rgb, rgb + 1, rgb + 2);
rgb[RED_PIX] = hs_tool->hue_saturation->hue_transfer[i][rgb[RED_PIX]];
rgb[GREEN_PIX] = hs_tool->hue_saturation->saturation_transfer[i][rgb[GREEN_PIX]];
rgb[BLUE_PIX] = hs_tool->hue_saturation->lightness_transfer[i][rgb[BLUE_PIX]];
rgb[RED_PIX] = hs_tool->hue_saturation->hue_transfer[i][rgb[RED_PIX]];
rgb[GREEN_PIX] = hs_tool->hue_saturation->saturation_transfer[i][rgb[GREEN_PIX]];
rgb[BLUE_PIX] = hs_tool->hue_saturation->lightness_transfer[i][rgb[BLUE_PIX]];
gimp_hsl_to_rgb_int (rgb, rgb + 1, rgb + 2);
gimp_hsl_to_rgb_int (rgb, rgb + 1, rgb + 2);
gimp_rgb_set_uchar (&color,
(guchar) rgb[0], (guchar) rgb[1], (guchar) rgb[2]);
gimp_rgb_set_uchar (&color,
(guchar) rgb[0], (guchar) rgb[1], (guchar) rgb[2]);
gimp_color_area_set_color (GIMP_COLOR_AREA (hs_tool->hue_partition_da[i]),
&color);
}
gimp_color_area_set_color (GIMP_COLOR_AREA (hs_tool->hue_partition_da[i]),
&color);
}
}
@ -497,7 +483,8 @@ hue_saturation_partition_callback (GtkWidget *widget,
if (hs_tool->hue_partition != partition)
{
hs_tool->hue_partition = partition;
hue_saturation_update (hs_tool, SLIDERS);
hue_saturation_update_sliders (hs_tool);
}
}
@ -509,14 +496,17 @@ hue_saturation_partition_reset_callback (GtkWidget *widget,
hue_saturation_partition_reset (hs_tool->hue_saturation,
hs_tool->hue_partition);
hue_saturation_update (hs_tool, ALL);
hue_saturation_calculate_transfers (hs_tool->hue_saturation);
hue_saturation_update_sliders (hs_tool);
hue_saturation_update_color_areas (hs_tool);
gimp_image_map_tool_preview (GIMP_IMAGE_MAP_TOOL (hs_tool));
}
static void
hue_saturation_hue_adjustment_update (GtkAdjustment *adjustment,
gpointer data)
hue_saturation_hue_changed (GtkAdjustment *adjustment,
gpointer data)
{
GimpHueSaturationTool *hs_tool = GIMP_HUE_SATURATION_TOOL (data);
GimpHueRange part = hs_tool->hue_partition;
@ -524,15 +514,17 @@ hue_saturation_hue_adjustment_update (GtkAdjustment *adjustment,
if (hs_tool->hue_saturation->hue[part] != adjustment->value)
{
hs_tool->hue_saturation->hue[part] = adjustment->value;
hue_saturation_update (hs_tool, DRAW);
hue_saturation_calculate_transfers (hs_tool->hue_saturation);
hue_saturation_update_color_areas (hs_tool);
gimp_image_map_tool_preview (GIMP_IMAGE_MAP_TOOL (hs_tool));
}
}
static void
hue_saturation_lightness_adjustment_update (GtkAdjustment *adjustment,
gpointer data)
hue_saturation_lightness_changed (GtkAdjustment *adjustment,
gpointer data)
{
GimpHueSaturationTool *hs_tool = GIMP_HUE_SATURATION_TOOL (data);
GimpHueRange part = hs_tool->hue_partition;
@ -540,15 +532,17 @@ hue_saturation_lightness_adjustment_update (GtkAdjustment *adjustment,
if (hs_tool->hue_saturation->lightness[part] != adjustment->value)
{
hs_tool->hue_saturation->lightness[part] = adjustment->value;
hue_saturation_update (hs_tool, DRAW);
hue_saturation_calculate_transfers (hs_tool->hue_saturation);
hue_saturation_update_color_areas (hs_tool);
gimp_image_map_tool_preview (GIMP_IMAGE_MAP_TOOL (hs_tool));
}
}
static void
hue_saturation_saturation_adjustment_update (GtkAdjustment *adjustment,
gpointer data)
hue_saturation_saturation_changed (GtkAdjustment *adjustment,
gpointer data)
{
GimpHueSaturationTool *hs_tool = GIMP_HUE_SATURATION_TOOL (data);
GimpHueRange part = hs_tool->hue_partition;
@ -556,22 +550,26 @@ hue_saturation_saturation_adjustment_update (GtkAdjustment *adjustment,
if (hs_tool->hue_saturation->saturation[part] != adjustment->value)
{
hs_tool->hue_saturation->saturation[part] = adjustment->value;
hue_saturation_update (hs_tool, DRAW);
hue_saturation_calculate_transfers (hs_tool->hue_saturation);
hue_saturation_update_color_areas (hs_tool);
gimp_image_map_tool_preview (GIMP_IMAGE_MAP_TOOL (hs_tool));
}
}
static void
hue_saturation_overlap_adjustment_update (GtkAdjustment *adjustment,
gpointer data)
hue_saturation_overlap_changed (GtkAdjustment *adjustment,
gpointer data)
{
GimpHueSaturationTool *hs_tool = GIMP_HUE_SATURATION_TOOL (data);
if (hs_tool->hue_saturation->overlap != adjustment->value)
{
hs_tool->hue_saturation->overlap = adjustment->value;
hue_saturation_update (hs_tool, DRAW);
hue_saturation_calculate_transfers (hs_tool->hue_saturation);
hue_saturation_update_color_areas (hs_tool);
gimp_image_map_tool_preview (GIMP_IMAGE_MAP_TOOL (hs_tool));
}

View File

@ -90,33 +90,33 @@ static gboolean gimp_levels_tool_settings_load (GimpImageMapTool *image_mao_to
static gboolean gimp_levels_tool_settings_save (GimpImageMapTool *image_map_tool,
gpointer fp);
static void levels_update_adjustments (GimpLevelsTool *tool);
static void levels_update_input_bar (GimpLevelsTool *tool);
static void levels_update_adjustments (GimpLevelsTool *tool);
static void levels_update_input_bar (GimpLevelsTool *tool);
static void levels_channel_callback (GtkWidget *widget,
GimpLevelsTool *tool);
static void levels_channel_reset_callback (GtkWidget *widget,
GimpLevelsTool *tool);
static void levels_channel_callback (GtkWidget *widget,
GimpLevelsTool *tool);
static void levels_channel_reset_callback (GtkWidget *widget,
GimpLevelsTool *tool);
static gboolean levels_menu_sensitivity (gint value,
gpointer data);
static gboolean levels_menu_sensitivity (gint value,
gpointer data);
static void levels_stretch_callback (GtkWidget *widget,
GimpLevelsTool *tool);
static void levels_low_input_adjustment_update (GtkAdjustment *adjustment,
GimpLevelsTool *tool);
static void levels_gamma_adjustment_update (GtkAdjustment *adjustment,
GimpLevelsTool *tool);
static void levels_linear_gamma_adjustment_update(GtkAdjustment *adjustment,
GimpLevelsTool *tool);
static void levels_high_input_adjustment_update (GtkAdjustment *adjustment,
GimpLevelsTool *tool);
static void levels_low_output_adjustment_update (GtkAdjustment *adjustment,
GimpLevelsTool *tool);
static void levels_high_output_adjustment_update (GtkAdjustment *adjustment,
GimpLevelsTool *tool);
static void levels_input_picker_toggled (GtkWidget *widget,
GimpLevelsTool *tool);
static void levels_stretch_callback (GtkWidget *widget,
GimpLevelsTool *tool);
static void levels_low_input_changed (GtkAdjustment *adjustment,
GimpLevelsTool *tool);
static void levels_gamma_changed (GtkAdjustment *adjustment,
GimpLevelsTool *tool);
static void levels_linear_gamma_changed (GtkAdjustment *adjustment,
GimpLevelsTool *tool);
static void levels_high_input_changed (GtkAdjustment *adjustment,
GimpLevelsTool *tool);
static void levels_low_output_changed (GtkAdjustment *adjustment,
GimpLevelsTool *tool);
static void levels_high_output_changed (GtkAdjustment *adjustment,
GimpLevelsTool *tool);
static void levels_input_picker_toggled (GtkWidget *widget,
GimpLevelsTool *tool);
G_DEFINE_TYPE (GimpLevelsTool, gimp_levels_tool, GIMP_TYPE_IMAGE_MAP_TOOL)
@ -472,7 +472,7 @@ gimp_levels_tool_dialog (GimpImageMapTool *image_map_tool)
tool->low_input = GTK_ADJUSTMENT (data);
g_signal_connect (tool->low_input, "value-changed",
G_CALLBACK (levels_low_input_adjustment_update),
G_CALLBACK (levels_low_input_changed),
tool);
gimp_handle_bar_set_adjustment (GIMP_HANDLE_BAR (tool->input_sliders), 0,
@ -486,13 +486,13 @@ gimp_levels_tool_dialog (GimpImageMapTool *image_map_tool)
tool->gamma = GTK_ADJUSTMENT (data);
g_signal_connect (tool->gamma, "value-changed",
G_CALLBACK (levels_gamma_adjustment_update),
G_CALLBACK (levels_gamma_changed),
tool);
tool->gamma_linear = GTK_ADJUSTMENT (gtk_adjustment_new (127, 0, 255,
0.1, 1.0, 0.0));
g_signal_connect (tool->gamma_linear, "value-changed",
G_CALLBACK (levels_linear_gamma_adjustment_update),
G_CALLBACK (levels_linear_gamma_changed),
tool);
gimp_handle_bar_set_adjustment (GIMP_HANDLE_BAR (tool->input_sliders), 1,
@ -514,7 +514,7 @@ gimp_levels_tool_dialog (GimpImageMapTool *image_map_tool)
tool->high_input = GTK_ADJUSTMENT (data);
g_signal_connect (tool->high_input, "value-changed",
G_CALLBACK (levels_high_input_adjustment_update),
G_CALLBACK (levels_high_input_changed),
tool);
gimp_handle_bar_set_adjustment (GIMP_HANDLE_BAR (tool->input_sliders), 2,
@ -574,7 +574,7 @@ gimp_levels_tool_dialog (GimpImageMapTool *image_map_tool)
tool->low_output = GTK_ADJUSTMENT (data);
g_signal_connect (tool->low_output, "value-changed",
G_CALLBACK (levels_low_output_adjustment_update),
G_CALLBACK (levels_low_output_changed),
tool);
gimp_handle_bar_set_adjustment (GIMP_HANDLE_BAR (tool->output_sliders), 0,
@ -587,7 +587,7 @@ gimp_levels_tool_dialog (GimpImageMapTool *image_map_tool)
tool->high_output = GTK_ADJUSTMENT (data);
g_signal_connect (tool->high_output, "value-changed",
G_CALLBACK (levels_high_output_adjustment_update),
G_CALLBACK (levels_high_output_changed),
tool);
gimp_handle_bar_set_adjustment (GIMP_HANDLE_BAR (tool->output_sliders), 2,
@ -914,8 +914,8 @@ levels_linear_gamma_update (GimpLevelsTool *tool)
}
static void
levels_linear_gamma_adjustment_update (GtkAdjustment *adjustment,
GimpLevelsTool *tool)
levels_linear_gamma_changed (GtkAdjustment *adjustment,
GimpLevelsTool *tool)
{
gdouble delta, mid, tmp, value;
@ -935,8 +935,8 @@ levels_linear_gamma_adjustment_update (GtkAdjustment *adjustment,
}
static void
levels_low_input_adjustment_update (GtkAdjustment *adjustment,
GimpLevelsTool *tool)
levels_low_input_changed (GtkAdjustment *adjustment,
GimpLevelsTool *tool)
{
gint value = ROUND (adjustment->value);
@ -957,8 +957,8 @@ levels_low_input_adjustment_update (GtkAdjustment *adjustment,
}
static void
levels_gamma_adjustment_update (GtkAdjustment *adjustment,
GimpLevelsTool *tool)
levels_gamma_changed (GtkAdjustment *adjustment,
GimpLevelsTool *tool)
{
if (tool->levels->gamma[tool->channel] != adjustment->value)
{
@ -972,8 +972,8 @@ levels_gamma_adjustment_update (GtkAdjustment *adjustment,
}
static void
levels_high_input_adjustment_update (GtkAdjustment *adjustment,
GimpLevelsTool *tool)
levels_high_input_changed (GtkAdjustment *adjustment,
GimpLevelsTool *tool)
{
gint value = ROUND (adjustment->value);
@ -994,8 +994,8 @@ levels_high_input_adjustment_update (GtkAdjustment *adjustment,
}
static void
levels_low_output_adjustment_update (GtkAdjustment *adjustment,
GimpLevelsTool *tool)
levels_low_output_changed (GtkAdjustment *adjustment,
GimpLevelsTool *tool)
{
gint value = ROUND (adjustment->value);
@ -1008,8 +1008,8 @@ levels_low_output_adjustment_update (GtkAdjustment *adjustment,
}
static void
levels_high_output_adjustment_update (GtkAdjustment *adjustment,
GimpLevelsTool *tool)
levels_high_output_changed (GtkAdjustment *adjustment,
GimpLevelsTool *tool)
{
gint value = ROUND (adjustment->value);

View File

@ -149,7 +149,7 @@ gimp_threshold_tool_initialize (GimpTool *tool,
return FALSE;
}
if (!t_tool->hist)
if (! t_tool->hist)
t_tool->hist = gimp_histogram_new ();
t_tool->threshold->color = gimp_drawable_is_rgb (drawable);