Commit 63e7eac7 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

app/actions/context-actions.c applied a patch from Aron Stansvik that adds

2005-04-27  Sven Neumann  <sven@gimp.org>

	* app/actions/context-actions.c
	* app/actions/context-commands.[ch]: applied a patch from Aron
	Stansvik that adds actions to control hue, saturation and value
	of the foreground and background colors.
parent 9979c3b5
2005-04-27 Sven Neumann <sven@gimp.org>
* app/actions/context-actions.c
* app/actions/context-commands.[ch]: applied a patch from Aron
Stansvik that adds actions to control hue, saturation and value
of the foreground and background colors.
2005-04-27 Sven Neumann <sven@gimp.org>
* app/dialogs/preferences-dialog.c: use the same terms for the
......
......@@ -264,6 +264,198 @@ static GimpEnumActionEntry context_background_blue_actions[] =
NULL }
};
static GimpEnumActionEntry context_foreground_hue_actions[] =
{
{ "context-foreground-hue-set", GIMP_STOCK_TOOL_HUE_SATURATION,
"Foreground Hue Set", NULL, NULL,
GIMP_ACTION_SELECT_SET, TRUE,
NULL },
{ "context-foreground-hue-minimum", GIMP_STOCK_TOOL_HUE_SATURATION,
"Foreground Hue Minimum", NULL, NULL,
GIMP_ACTION_SELECT_FIRST, FALSE,
NULL },
{ "context-foreground-hue-maximum", GIMP_STOCK_TOOL_HUE_SATURATION,
"Foreground Hue Maximum", NULL, NULL,
GIMP_ACTION_SELECT_LAST, FALSE,
NULL },
{ "context-foreground-hue-decrease", GIMP_STOCK_TOOL_HUE_SATURATION,
"Foreground Hue Decrease", NULL, NULL,
GIMP_ACTION_SELECT_PREVIOUS, FALSE,
NULL },
{ "context-foreground-hue-increase", GIMP_STOCK_TOOL_HUE_SATURATION,
"Foreground Hue Increase", NULL, NULL,
GIMP_ACTION_SELECT_NEXT, FALSE,
NULL },
{ "context-foreground-hue-decrease-skip", GIMP_STOCK_TOOL_HUE_SATURATION,
"Foreground Hue Decrease 10%", NULL, NULL,
GIMP_ACTION_SELECT_SKIP_PREVIOUS, FALSE,
NULL },
{ "context-foreground-hue-increase-skip", GIMP_STOCK_TOOL_HUE_SATURATION,
"Foreground Hue Increase 10%", NULL, NULL,
GIMP_ACTION_SELECT_SKIP_NEXT, FALSE,
NULL }
};
static GimpEnumActionEntry context_foreground_saturation_actions[] =
{
{ "context-foreground-saturation-set", GIMP_STOCK_TOOL_HUE_SATURATION,
"Foreground Saturation Set", NULL, NULL,
GIMP_ACTION_SELECT_SET, TRUE,
NULL },
{ "context-foreground-saturation-minimum", GIMP_STOCK_TOOL_HUE_SATURATION,
"Foreground Saturation Minimum", NULL, NULL,
GIMP_ACTION_SELECT_FIRST, FALSE,
NULL },
{ "context-foreground-saturation-maximum", GIMP_STOCK_TOOL_HUE_SATURATION,
"Foreground Saturation Maximum", NULL, NULL,
GIMP_ACTION_SELECT_LAST, FALSE,
NULL },
{ "context-foreground-saturation-decrease", GIMP_STOCK_TOOL_HUE_SATURATION,
"Foreground Saturation Decrease", NULL, NULL,
GIMP_ACTION_SELECT_PREVIOUS, FALSE,
NULL },
{ "context-foreground-saturation-increase", GIMP_STOCK_TOOL_HUE_SATURATION,
"Foreground Saturation Increase", NULL, NULL,
GIMP_ACTION_SELECT_NEXT, FALSE,
NULL },
{ "context-foreground-saturation-decrease-skip", GIMP_STOCK_TOOL_HUE_SATURATION,
"Foreground Saturation Decrease 10%", NULL, NULL,
GIMP_ACTION_SELECT_SKIP_PREVIOUS, FALSE,
NULL },
{ "context-foreground-saturation-increase-skip", GIMP_STOCK_TOOL_HUE_SATURATION,
"Foreground Saturation Increase 10%", NULL, NULL,
GIMP_ACTION_SELECT_SKIP_NEXT, FALSE,
NULL }
};
static GimpEnumActionEntry context_foreground_value_actions[] =
{
{ "context-foreground-value-set", GIMP_STOCK_TOOL_HUE_SATURATION,
"Foreground Value Set", NULL, NULL,
GIMP_ACTION_SELECT_SET, TRUE,
NULL },
{ "context-foreground-value-minimum", GIMP_STOCK_TOOL_HUE_SATURATION,
"Foreground Value Minimum", NULL, NULL,
GIMP_ACTION_SELECT_FIRST, FALSE,
NULL },
{ "context-foreground-value-maximum", GIMP_STOCK_TOOL_HUE_SATURATION,
"Foreground Value Maximum", NULL, NULL,
GIMP_ACTION_SELECT_LAST, FALSE,
NULL },
{ "context-foreground-value-decrease", GIMP_STOCK_TOOL_HUE_SATURATION,
"Foreground Value Decrease", NULL, NULL,
GIMP_ACTION_SELECT_PREVIOUS, FALSE,
NULL },
{ "context-foreground-value-increase", GIMP_STOCK_TOOL_HUE_SATURATION,
"Foreground Value Increase", NULL, NULL,
GIMP_ACTION_SELECT_NEXT, FALSE,
NULL },
{ "context-foreground-value-decrease-skip", GIMP_STOCK_TOOL_HUE_SATURATION,
"Foreground Value Decrease 10%", NULL, NULL,
GIMP_ACTION_SELECT_SKIP_PREVIOUS, FALSE,
NULL },
{ "context-foreground-value-increase-skip", GIMP_STOCK_TOOL_HUE_SATURATION,
"Foreground Value Increase 10%", NULL, NULL,
GIMP_ACTION_SELECT_SKIP_NEXT, FALSE,
NULL }
};
static GimpEnumActionEntry context_background_hue_actions[] =
{
{ "context-background-hue-set", GIMP_STOCK_TOOL_HUE_SATURATION,
"Background Hue Set", NULL, NULL,
GIMP_ACTION_SELECT_SET, TRUE,
NULL },
{ "context-background-hue-minimum", GIMP_STOCK_TOOL_HUE_SATURATION,
"Background Hue Minimum", NULL, NULL,
GIMP_ACTION_SELECT_FIRST, FALSE,
NULL },
{ "context-background-hue-maximum", GIMP_STOCK_TOOL_HUE_SATURATION,
"Background Hue Maximum", NULL, NULL,
GIMP_ACTION_SELECT_LAST, FALSE,
NULL },
{ "context-background-hue-decrease", GIMP_STOCK_TOOL_HUE_SATURATION,
"Background Hue Decrease", NULL, NULL,
GIMP_ACTION_SELECT_PREVIOUS, FALSE,
NULL },
{ "context-background-hue-increase", GIMP_STOCK_TOOL_HUE_SATURATION,
"Background Hue Increase", NULL, NULL,
GIMP_ACTION_SELECT_NEXT, FALSE,
NULL },
{ "context-background-hue-decrease-skip", GIMP_STOCK_TOOL_HUE_SATURATION,
"Background Hue Decrease 10%", NULL, NULL,
GIMP_ACTION_SELECT_SKIP_PREVIOUS, FALSE,
NULL },
{ "context-background-hue-increase-skip", GIMP_STOCK_TOOL_HUE_SATURATION,
"Background Hue Increase 10%", NULL, NULL,
GIMP_ACTION_SELECT_SKIP_NEXT, FALSE,
NULL }
};
static GimpEnumActionEntry context_background_saturation_actions[] =
{
{ "context-background-saturation-set", GIMP_STOCK_TOOL_HUE_SATURATION,
"Background Saturation Set", NULL, NULL,
GIMP_ACTION_SELECT_SET, TRUE,
NULL },
{ "context-background-saturation-minimum", GIMP_STOCK_TOOL_HUE_SATURATION,
"Background Saturation Minimum", NULL, NULL,
GIMP_ACTION_SELECT_FIRST, FALSE,
NULL },
{ "context-background-saturation-maximum", GIMP_STOCK_TOOL_HUE_SATURATION,
"Background Saturation Maximum", NULL, NULL,
GIMP_ACTION_SELECT_LAST, FALSE,
NULL },
{ "context-background-saturation-decrease", GIMP_STOCK_TOOL_HUE_SATURATION,
"Background Saturation Decrease", NULL, NULL,
GIMP_ACTION_SELECT_PREVIOUS, FALSE,
NULL },
{ "context-background-saturation-increase", GIMP_STOCK_TOOL_HUE_SATURATION,
"Background Saturation Increase", NULL, NULL,
GIMP_ACTION_SELECT_NEXT, FALSE,
NULL },
{ "context-background-saturation-decrease-skip", GIMP_STOCK_TOOL_HUE_SATURATION,
"Background Saturation Decrease 10%", NULL, NULL,
GIMP_ACTION_SELECT_SKIP_PREVIOUS, FALSE,
NULL },
{ "context-background-saturation-increase-skip", GIMP_STOCK_TOOL_HUE_SATURATION,
"Background Saturation Increase 10%", NULL, NULL,
GIMP_ACTION_SELECT_SKIP_NEXT, FALSE,
NULL }
};
static GimpEnumActionEntry context_background_value_actions[] =
{
{ "context-background-value-set", GIMP_STOCK_TOOL_HUE_SATURATION,
"Background Value Set", NULL, NULL,
GIMP_ACTION_SELECT_SET, TRUE,
NULL },
{ "context-background-value-minimum", GIMP_STOCK_TOOL_HUE_SATURATION,
"Background Value Minimum", NULL, NULL,
GIMP_ACTION_SELECT_FIRST, FALSE,
NULL },
{ "context-background-value-maximum", GIMP_STOCK_TOOL_HUE_SATURATION,
"Background Value Maximum", NULL, NULL,
GIMP_ACTION_SELECT_LAST, FALSE,
NULL },
{ "context-background-value-decrease", GIMP_STOCK_TOOL_HUE_SATURATION,
"Background Value Decrease", NULL, NULL,
GIMP_ACTION_SELECT_PREVIOUS, FALSE,
NULL },
{ "context-background-value-increase", GIMP_STOCK_TOOL_HUE_SATURATION,
"Background Value Increase", NULL, NULL,
GIMP_ACTION_SELECT_NEXT, FALSE,
NULL },
{ "context-background-value-decrease-skip", GIMP_STOCK_TOOL_HUE_SATURATION,
"Background Value Decrease 10%", NULL, NULL,
GIMP_ACTION_SELECT_SKIP_PREVIOUS, FALSE,
NULL },
{ "context-background-value-increase-skip", GIMP_STOCK_TOOL_HUE_SATURATION,
"Background Value Increase 10%", NULL, NULL,
GIMP_ACTION_SELECT_SKIP_NEXT, FALSE,
NULL }
};
static GimpEnumActionEntry context_opacity_actions[] =
{
{ "context-opacity-set", GIMP_STOCK_TRANSPARENCY,
......@@ -657,6 +849,19 @@ context_actions_setup (GimpActionGroup *group)
G_N_ELEMENTS (context_foreground_blue_actions),
G_CALLBACK (context_foreground_blue_cmd_callback));
gimp_action_group_add_enum_actions (group,
context_foreground_hue_actions,
G_N_ELEMENTS (context_foreground_hue_actions),
G_CALLBACK (context_foreground_hue_cmd_callback));
gimp_action_group_add_enum_actions (group,
context_foreground_saturation_actions,
G_N_ELEMENTS (context_foreground_saturation_actions),
G_CALLBACK (context_foreground_saturation_cmd_callback));
gimp_action_group_add_enum_actions (group,
context_foreground_value_actions,
G_N_ELEMENTS (context_foreground_value_actions),
G_CALLBACK (context_foreground_value_cmd_callback));
gimp_action_group_add_enum_actions (group,
context_background_red_actions,
G_N_ELEMENTS (context_background_red_actions),
......@@ -670,6 +875,19 @@ context_actions_setup (GimpActionGroup *group)
G_N_ELEMENTS (context_background_blue_actions),
G_CALLBACK (context_background_blue_cmd_callback));
gimp_action_group_add_enum_actions (group,
context_background_hue_actions,
G_N_ELEMENTS (context_background_hue_actions),
G_CALLBACK (context_background_hue_cmd_callback));
gimp_action_group_add_enum_actions (group,
context_background_saturation_actions,
G_N_ELEMENTS (context_background_saturation_actions),
G_CALLBACK (context_background_saturation_cmd_callback));
gimp_action_group_add_enum_actions (group,
context_background_value_actions,
G_N_ELEMENTS (context_background_value_actions),
G_CALLBACK (context_background_value_cmd_callback));
gimp_action_group_add_enum_actions (group,
context_opacity_actions,
G_N_ELEMENTS (context_opacity_actions),
......
......@@ -22,6 +22,7 @@
#include <gtk/gtk.h>
#include "libgimpcolor/gimpcolor.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "actions-types.h"
......@@ -195,6 +196,126 @@ context_background_blue_cmd_callback (GtkAction *action,
gimp_context_set_background (context, &color);
}
void
context_foreground_hue_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpContext *context;
GimpRGB color;
GimpHSV hsv;
return_if_no_context (context, data);
gimp_context_get_foreground (context, &color);
gimp_rgb_to_hsv (&color, &hsv);
hsv.h = action_select_value ((GimpActionSelectType) value,
hsv.h,
0.0, 1.0,
0.01, 0.1, FALSE);
gimp_hsv_to_rgb (&hsv, &color);
gimp_context_set_foreground (context, &color);
}
void
context_foreground_saturation_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpContext *context;
GimpRGB color;
GimpHSV hsv;
return_if_no_context (context, data);
gimp_context_get_foreground (context, &color);
gimp_rgb_to_hsv (&color, &hsv);
hsv.s = action_select_value ((GimpActionSelectType) value,
hsv.s,
0.0, 1.0,
0.01, 0.1, FALSE);
gimp_hsv_to_rgb (&hsv, &color);
gimp_context_set_foreground (context, &color);
}
void
context_foreground_value_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpContext *context;
GimpRGB color;
GimpHSV hsv;
return_if_no_context (context, data);
gimp_context_get_foreground (context, &color);
gimp_rgb_to_hsv (&color, &hsv);
hsv.v = action_select_value ((GimpActionSelectType) value,
hsv.v,
0.0, 1.0,
0.01, 0.1, FALSE);
gimp_hsv_to_rgb (&hsv, &color);
gimp_context_set_foreground (context, &color);
}
void
context_background_hue_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpContext *context;
GimpRGB color;
GimpHSV hsv;
return_if_no_context (context, data);
gimp_context_get_background (context, &color);
gimp_rgb_to_hsv (&color, &hsv);
hsv.h = action_select_value ((GimpActionSelectType) value,
hsv.h,
0.0, 1.0,
0.01, 0.1, FALSE);
gimp_hsv_to_rgb (&hsv, &color);
gimp_context_set_background (context, &color);
}
void
context_background_saturation_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpContext *context;
GimpRGB color;
GimpHSV hsv;
return_if_no_context (context, data);
gimp_context_get_background (context, &color);
gimp_rgb_to_hsv (&color, &hsv);
hsv.s = action_select_value ((GimpActionSelectType) value,
hsv.s,
0.0, 1.0,
0.01, 0.1, FALSE);
gimp_hsv_to_rgb (&hsv, &color);
gimp_context_set_background (context, &color);
}
void
context_background_value_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpContext *context;
GimpRGB color;
GimpHSV hsv;
return_if_no_context (context, data);
gimp_context_get_background (context, &color);
gimp_rgb_to_hsv (&color, &hsv);
hsv.v = action_select_value ((GimpActionSelectType) value,
hsv.v,
0.0, 1.0,
0.01, 0.1, FALSE);
gimp_hsv_to_rgb (&hsv, &color);
gimp_context_set_background (context, &color);
}
void
context_opacity_cmd_callback (GtkAction *action,
gint value,
......
......@@ -45,6 +45,26 @@ void context_background_blue_cmd_callback (GtkAction *action,
gint value,
gpointer data);
void context_foreground_hue_cmd_callback (GtkAction *action,
gint value,
gpointer data);
void context_foreground_saturation_cmd_callback (GtkAction *action,
gint value,
gpointer data);
void context_foreground_value_cmd_callback (GtkAction *action,
gint value,
gpointer data);
void context_background_hue_cmd_callback (GtkAction *action,
gint value,
gpointer data);
void context_background_saturation_cmd_callback (GtkAction *action,
gint value,
gpointer data);
void context_background_value_cmd_callback (GtkAction *action,
gint value,
gpointer data);
void context_opacity_cmd_callback (GtkAction *action,
gint value,
gpointer data);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment