Commit 8ab1ae98 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

app/actions/Makefile.am app/actions/context-actions.[ch] added new action

2004-06-15  Michael Natterer  <mitch@gimp.org>

	* app/actions/Makefile.am
	* app/actions/context-actions.[ch]
	* app/actions/context-commands.[ch]: added new action group to
	modify all GimpContext properties. So far there are actions to
	cycle through the lists of brushes, patterns etc., to change the
	opacity, to swap and default colors and to edit generated brushes.

	* app/actions/actions.c: register the new "context" action group.

	* app/actions/tools-actions.c
	* app/actions/tools-commands.[ch]: removed "tools-default-colors"
	and "tools-swap-colors" actions and callbacks because they are
	in the "context" action group now.

	* app/menus/menus.c: add the "context" group to the <Image> and
	<Dock> UI managers.

	* menus/image-menu.xml.in: changed accordingly. Added a temporary
	"Context" menu to test and debug the new actions.
parent d1e70648
2004-06-15 Michael Natterer <mitch@gimp.org>
* app/actions/Makefile.am
* app/actions/context-actions.[ch]
* app/actions/context-commands.[ch]: added new action group to
modify all GimpContext properties. So far there are actions to
cycle through the lists of brushes, patterns etc., to change the
opacity, to swap and default colors and to edit generated brushes.
* app/actions/actions.c: register the new "context" action group.
* app/actions/tools-actions.c
* app/actions/tools-commands.[ch]: removed "tools-default-colors"
and "tools-swap-colors" actions and callbacks because they are
in the "context" action group now.
* app/menus/menus.c: add the "context" group to the <Image> and
<Dock> UI managers.
* menus/image-menu.xml.in: changed accordingly. Added a temporary
"Context" menu to test and debug the new actions.
2004-06-15 Philip Lafleur <plafleur@cvs.gnome.org> 2004-06-15 Philip Lafleur <plafleur@cvs.gnome.org>
* app/tools/gimpcroptool.c (crop_selection_callback): Force * app/tools/gimpcroptool.c (crop_selection_callback): Force
......
...@@ -21,6 +21,10 @@ libappactions_a_SOURCES = \ ...@@ -21,6 +21,10 @@ libappactions_a_SOURCES = \
colormap-editor-actions.h \ colormap-editor-actions.h \
colormap-editor-commands.c \ colormap-editor-commands.c \
colormap-editor-commands.h \ colormap-editor-commands.h \
context-actions.c \
context-actions.h \
context-commands.c \
context-commands.h \
data-commands.c \ data-commands.c \
data-commands.h \ data-commands.h \
debug-actions.c \ debug-actions.c \
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include "buffers-actions.h" #include "buffers-actions.h"
#include "channels-actions.h" #include "channels-actions.h"
#include "colormap-editor-actions.h" #include "colormap-editor-actions.h"
#include "context-actions.h"
#include "debug-actions.h" #include "debug-actions.h"
#include "dialogs-actions.h" #include "dialogs-actions.h"
#include "dockable-actions.h" #include "dockable-actions.h"
...@@ -96,6 +97,9 @@ static GimpActionFactoryEntry action_groups[] = ...@@ -96,6 +97,9 @@ static GimpActionFactoryEntry action_groups[] =
{ "colormap-editor", { "colormap-editor",
colormap_editor_actions_setup, colormap_editor_actions_setup,
colormap_editor_actions_update }, colormap_editor_actions_update },
{ "context",
context_actions_setup,
context_actions_update },
{ "debug", { "debug",
debug_actions_setup, debug_actions_setup,
debug_actions_update }, debug_actions_update },
......
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "actions-types.h"
#include "core/gimp.h"
#include "core/gimpbrushgenerated.h"
#include "core/gimpcontext.h"
#include "core/gimplist.h"
#include "widgets/gimpactiongroup.h"
#include "widgets/gimphelp-ids.h"
#include "actions.h"
#include "context-actions.h"
#include "context-commands.h"
#include "gimp-intl.h"
/* local function prototypes */
static GimpActionEntry context_actions[] =
{
{ "context-menu", NULL, N_("_Context") },
{ "context-colors-menu", GIMP_STOCK_DEFAULT_COLORS, N_("_Colors") },
{ "context-opacity-menu", GIMP_STOCK_TRANSPARENCY, N_("_Opacity") },
{ "context-brush-menu", GIMP_STOCK_BRUSH, N_("_Brush") },
{ "context-pattern-menu", GIMP_STOCK_PATTERN, N_("_Pattern") },
{ "context-palette-menu", GIMP_STOCK_PALETTE, N_("_Palette") },
{ "context-gradient-menu", GIMP_STOCK_GRADIENT, N_("_Gradient") },
{ "context-font-menu", GIMP_STOCK_FONT, N_("_Font") },
{ "context-colors-default", GIMP_STOCK_DEFAULT_COLORS,
N_("_Default Colors"), "D", NULL,
G_CALLBACK (context_colors_default_cmd_callback),
GIMP_HELP_TOOLBOX_DEFAULT_COLORS },
{ "context-colors-swap", GIMP_STOCK_SWAP_COLORS,
N_("S_wap Colors"), "X", NULL,
G_CALLBACK (context_colors_swap_cmd_callback),
GIMP_HELP_TOOLBOX_SWAP_COLORS }
};
static GimpEnumActionEntry context_opacity_actions[] =
{
{ "context-opacity-transparent", GTK_STOCK_GOTO_FIRST,
"Completely Transparent", NULL, NULL,
GIMP_CONTEXT_SELECT_FIRST,
NULL },
{ "context-opacity-opaque", GTK_STOCK_GOTO_LAST,
"Completely Opaque", NULL, NULL,
GIMP_CONTEXT_SELECT_LAST,
NULL },
{ "context-opacity-decrease", GTK_STOCK_REMOVE,
"More Transparent", NULL, NULL,
GIMP_CONTEXT_SELECT_PREVIOUS,
NULL },
{ "context-opacity-increase", GTK_STOCK_ADD,
"More Opaque", NULL, NULL,
GIMP_CONTEXT_SELECT_NEXT,
NULL }
};
static GimpEnumActionEntry context_brush_select_actions[] =
{
{ "context-brush-first", GTK_STOCK_GOTO_FIRST,
"First Brush", NULL, NULL,
GIMP_CONTEXT_SELECT_FIRST,
NULL },
{ "context-brush-last", GTK_STOCK_GOTO_LAST,
"Last Brush", NULL, NULL,
GIMP_CONTEXT_SELECT_LAST,
NULL },
{ "context-brush-previous", GTK_STOCK_GO_BACK,
"Previous Brush", NULL, NULL,
GIMP_CONTEXT_SELECT_PREVIOUS,
NULL },
{ "context-brush-next", GTK_STOCK_GO_FORWARD,
"Next Brush", NULL, NULL,
GIMP_CONTEXT_SELECT_NEXT,
NULL }
};
static GimpEnumActionEntry context_pattern_select_actions[] =
{
{ "context-pattern-first", GTK_STOCK_GOTO_FIRST,
"First Pattern", NULL, NULL,
GIMP_CONTEXT_SELECT_FIRST,
NULL },
{ "context-pattern-last", GTK_STOCK_GOTO_LAST,
"Last Pattern", NULL, NULL,
GIMP_CONTEXT_SELECT_LAST,
NULL },
{ "context-pattern-previous", GTK_STOCK_GO_BACK,
"Previous Pattern", NULL, NULL,
GIMP_CONTEXT_SELECT_PREVIOUS,
NULL },
{ "context-pattern-next", GTK_STOCK_GO_FORWARD,
"Next Pattern", NULL, NULL,
GIMP_CONTEXT_SELECT_NEXT,
NULL }
};
static GimpEnumActionEntry context_palette_select_actions[] =
{
{ "context-palette-first", GTK_STOCK_GOTO_FIRST,
"First Palette", NULL, NULL,
GIMP_CONTEXT_SELECT_FIRST,
NULL },
{ "context-palette-last", GTK_STOCK_GOTO_LAST,
"Last Palette", NULL, NULL,
GIMP_CONTEXT_SELECT_LAST,
NULL },
{ "context-palette-previous", GTK_STOCK_GO_BACK,
"Previous Palette", NULL, NULL,
GIMP_CONTEXT_SELECT_PREVIOUS,
NULL },
{ "context-palette-next", GTK_STOCK_GO_FORWARD,
"Next Palette", NULL, NULL,
GIMP_CONTEXT_SELECT_NEXT,
NULL }
};
static GimpEnumActionEntry context_gradient_select_actions[] =
{
{ "context-gradient-first", GTK_STOCK_GOTO_FIRST,
"First Gradient", NULL, NULL,
GIMP_CONTEXT_SELECT_FIRST,
NULL },
{ "context-gradient-last", GTK_STOCK_GOTO_LAST,
"Last Gradient", NULL, NULL,
GIMP_CONTEXT_SELECT_LAST,
NULL },
{ "context-gradient-previous", GTK_STOCK_GO_BACK,
"Previous Gradient", NULL, NULL,
GIMP_CONTEXT_SELECT_PREVIOUS,
NULL },
{ "context-gradient-next", GTK_STOCK_GO_FORWARD,
"Next Gradient", NULL, NULL,
GIMP_CONTEXT_SELECT_NEXT,
NULL }
};
static GimpEnumActionEntry context_font_select_actions[] =
{
{ "context-font-first", GTK_STOCK_GOTO_FIRST,
"First Font", NULL, NULL,
GIMP_CONTEXT_SELECT_FIRST,
NULL },
{ "context-font-last", GTK_STOCK_GOTO_LAST,
"Last Font", NULL, NULL,
GIMP_CONTEXT_SELECT_LAST,
NULL },
{ "context-font-previous", GTK_STOCK_GO_BACK,
"Previous Font", NULL, NULL,
GIMP_CONTEXT_SELECT_PREVIOUS,
NULL },
{ "context-font-next", GTK_STOCK_GO_FORWARD,
"Next Font", NULL, NULL,
GIMP_CONTEXT_SELECT_NEXT,
NULL }
};
static GimpEnumActionEntry context_brush_radius_actions[] =
{
{ "context-brush-radius-minimum", GTK_STOCK_GOTO_FIRST,
"Minumum Radius", NULL, NULL,
GIMP_CONTEXT_SELECT_FIRST,
NULL },
{ "context-brush-radius-maximum", GTK_STOCK_GOTO_LAST,
"Maximum Radius", NULL, NULL,
GIMP_CONTEXT_SELECT_LAST,
NULL },
{ "context-brush-radius-decrease", GTK_STOCK_GO_BACK,
"Decrease Radius", NULL, NULL,
GIMP_CONTEXT_SELECT_PREVIOUS,
NULL },
{ "context-brush-radius-increase", GTK_STOCK_GO_FORWARD,
"Increase Radius", NULL, NULL,
GIMP_CONTEXT_SELECT_NEXT,
NULL },
{ "context-brush-radius-decrease-skip", GTK_STOCK_GO_BACK,
"Decrease Radius More", NULL, NULL,
GIMP_CONTEXT_SELECT_SKIP_PREVIOUS,
NULL },
{ "context-brush-radius-increase-skip", GTK_STOCK_GO_FORWARD,
"Increase Radius More", NULL, NULL,
GIMP_CONTEXT_SELECT_SKIP_NEXT,
NULL },
};
static GimpEnumActionEntry context_brush_hardness_actions[] =
{
{ "context-brush-hardness-minimum", GTK_STOCK_GOTO_FIRST,
"Minumum Hardness", NULL, NULL,
GIMP_CONTEXT_SELECT_FIRST,
NULL },
{ "context-brush-hardness-maximum", GTK_STOCK_GOTO_LAST,
"Maximum Hardness", NULL, NULL,
GIMP_CONTEXT_SELECT_LAST,
NULL },
{ "context-brush-hardness-decrease", GTK_STOCK_GO_BACK,
"Decrease Hardness", NULL, NULL,
GIMP_CONTEXT_SELECT_PREVIOUS,
NULL },
{ "context-brush-hardness-increase", GTK_STOCK_GO_FORWARD,
"Increase Hardness", NULL, NULL,
GIMP_CONTEXT_SELECT_NEXT,
NULL },
{ "context-brush-hardness-decrease-skip", GTK_STOCK_GO_BACK,
"Decrease Hardness More", NULL, NULL,
GIMP_CONTEXT_SELECT_SKIP_PREVIOUS,
NULL },
{ "context-brush-hardness-increase-skip", GTK_STOCK_GO_FORWARD,
"Increase Hardness More", NULL, NULL,
GIMP_CONTEXT_SELECT_SKIP_NEXT,
NULL },
};
static GimpEnumActionEntry context_brush_aspect_actions[] =
{
{ "context-brush-aspect-minimum", GTK_STOCK_GOTO_FIRST,
"Minumum Aspect", NULL, NULL,
GIMP_CONTEXT_SELECT_FIRST,
NULL },
{ "context-brush-aspect-maximum", GTK_STOCK_GOTO_LAST,
"Maximum Aspect", NULL, NULL,
GIMP_CONTEXT_SELECT_LAST,
NULL },
{ "context-brush-aspect-decrease", GTK_STOCK_GO_BACK,
"Decrease Aspect", NULL, NULL,
GIMP_CONTEXT_SELECT_PREVIOUS,
NULL },
{ "context-brush-aspect-increase", GTK_STOCK_GO_FORWARD,
"Increase Aspect", NULL, NULL,
GIMP_CONTEXT_SELECT_NEXT,
NULL },
{ "context-brush-aspect-decrease-skip", GTK_STOCK_GO_BACK,
"Decrease Aspect More", NULL, NULL,
GIMP_CONTEXT_SELECT_SKIP_PREVIOUS,
NULL },
{ "context-brush-aspect-increase-skip", GTK_STOCK_GO_FORWARD,
"Increase Aspect More", NULL, NULL,
GIMP_CONTEXT_SELECT_SKIP_NEXT,
NULL },
};
static GimpEnumActionEntry context_brush_angle_actions[] =
{
{ "context-brush-angle-minimum", GIMP_STOCK_FLIP_HORIZONTAL,
"Horizontal", NULL, NULL,
GIMP_CONTEXT_SELECT_FIRST,
NULL },
{ "context-brush-angle-maximum", GIMP_STOCK_FLIP_VERTICAL,
"Vertical", NULL, NULL,
GIMP_CONTEXT_SELECT_LAST,
NULL },
{ "context-brush-angle-decrease", GIMP_STOCK_ROTATE_90,
"Rotate Right", NULL, NULL,
GIMP_CONTEXT_SELECT_PREVIOUS,
NULL },
{ "context-brush-angle-increase", GIMP_STOCK_ROTATE_270,
"Rotate Left", NULL, NULL,
GIMP_CONTEXT_SELECT_NEXT,
NULL },
{ "context-brush-angle-decrease-skip", GIMP_STOCK_ROTATE_90,
"Rotate Right 15 degrees", NULL, NULL,
GIMP_CONTEXT_SELECT_SKIP_PREVIOUS,
NULL },
{ "context-brush-angle-increase-skip", GIMP_STOCK_ROTATE_270,
"Rotate Left 15 degrees", NULL, NULL,
GIMP_CONTEXT_SELECT_SKIP_NEXT,
NULL },
};
void
context_actions_setup (GimpActionGroup *group)
{
gimp_action_group_add_actions (group,
context_actions,
G_N_ELEMENTS (context_actions));
gimp_action_group_add_enum_actions (group,
context_opacity_actions,
G_N_ELEMENTS (context_opacity_actions),
G_CALLBACK (context_opacity_cmd_callback));
gimp_action_group_add_enum_actions (group,
context_brush_select_actions,
G_N_ELEMENTS (context_brush_select_actions),
G_CALLBACK (context_brush_select_cmd_callback));
gimp_action_group_add_enum_actions (group,
context_pattern_select_actions,
G_N_ELEMENTS (context_pattern_select_actions),
G_CALLBACK (context_pattern_select_cmd_callback));
gimp_action_group_add_enum_actions (group,
context_palette_select_actions,
G_N_ELEMENTS (context_palette_select_actions),
G_CALLBACK (context_palette_select_cmd_callback));
gimp_action_group_add_enum_actions (group,
context_gradient_select_actions,
G_N_ELEMENTS (context_gradient_select_actions),
G_CALLBACK (context_gradient_select_cmd_callback));
gimp_action_group_add_enum_actions (group,
context_font_select_actions,
G_N_ELEMENTS (context_font_select_actions),
G_CALLBACK (context_font_select_cmd_callback));
gimp_action_group_add_enum_actions (group,
context_brush_radius_actions,
G_N_ELEMENTS (context_brush_radius_actions),
G_CALLBACK (context_brush_radius_cmd_callback));
gimp_action_group_add_enum_actions (group,
context_brush_hardness_actions,
G_N_ELEMENTS (context_brush_hardness_actions),
G_CALLBACK (context_brush_hardness_cmd_callback));
gimp_action_group_add_enum_actions (group,
context_brush_aspect_actions,
G_N_ELEMENTS (context_brush_aspect_actions),
G_CALLBACK (context_brush_aspect_cmd_callback));
gimp_action_group_add_enum_actions (group,
context_brush_angle_actions,
G_N_ELEMENTS (context_brush_angle_actions),
G_CALLBACK (context_brush_angle_cmd_callback));
}
void
context_actions_update (GimpActionGroup *group,
gpointer data)
{
GimpContext *context;
gboolean generated = FALSE;
gboolean radius = 0.0;
gboolean hardness = 0.0;
gboolean aspect = 0.0;
gboolean angle = 0.0;
context = action_data_get_context (data);
if (context)
{
GimpBrush *brush = gimp_context_get_brush (context);
if (GIMP_IS_BRUSH_GENERATED (brush))
{
GimpBrushGenerated *gen = GIMP_BRUSH_GENERATED (brush);
generated = TRUE;
radius = gimp_brush_generated_get_radius (gen);
hardness = gimp_brush_generated_get_hardness (gen);
aspect = gimp_brush_generated_get_aspect_ratio (gen);
angle = gimp_brush_generated_get_angle (gen);
}
}
#define SET_SENSITIVE(action,condition) \
gimp_action_group_set_action_sensitive (group, "context-" action, (condition) != 0)
#if 0
SET_SENSITIVE ("brush-radius-minimum", generated && radius > 1.0);
SET_SENSITIVE ("brush-radius-decrease", generated && radius > 1.0);
SET_SENSITIVE ("brush-radius-decrease-skip", generated && radius > 1.0);
SET_SENSITIVE ("brush-radius-maximum", generated && radius < 4096.0);
SET_SENSITIVE ("brush-radius-increase", generated && radius < 4096.0);
SET_SENSITIVE ("brush-radius-increase-skip", generated && radius < 4096.0);
SET_SENSITIVE ("brush-angle-minimum", generated);
SET_SENSITIVE ("brush-angle-decrease", generated);
SET_SENSITIVE ("brush-angle-decrease-skip", generated);
SET_SENSITIVE ("brush-angle-maximum", generated);
SET_SENSITIVE ("brush-angle-increase", generated);
SET_SENSITIVE ("brush-angle-increase-skip", generated);
#endif
#undef SET_SENSITIVE
}
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __CONTEXT_ACTIONS_H__
#define __CONTEXT_ACTIONS_H__
void context_actions_setup (GimpActionGroup *group);
void context_actions_update (GimpActionGroup *group,
gpointer data);
#endif /* __CONTEXT_ACTIONS_H__ */
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <string.h>
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "actions-types.h"
#include "core/gimp.h"
#include "core/gimpbrushgenerated.h"
#include "core/gimpcontext.h"
#include "core/gimpdatafactory.h"
#include "core/gimplist.h"
#include "actions.h"
#include "context-commands.h"
/* local function prototypes */
static void context_select_object (GimpContext *context,
GimpContainer *container,
GimpContextSelectType select_type);
static gdouble context_select_value (GimpContextSelectType select_type,
gdouble value,
gdouble min,
gdouble max,
gdouble inc,
gdouble skip_inc,
gboolean wrap);
/* public functions */
void
context_colors_default_cmd_callback (GtkAction *action,
gpointer data)
{
GimpContext *context;
return_if_no_context (context, data);
gimp_context_set_default_colors (context);
}
void
context_colors_swap_cmd_callback (GtkAction *action,
gpointer data)
{
GimpContext *context;
return_if_no_context (context, data);
gimp_context_swap_colors (context);
}
void
context_opacity_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpContext *context;
gdouble opacity;
return_if_no_context (context, data);
opacity = context_select_value ((GimpContextSelectType) value,
gimp_context_get_opacity (context),
GIMP_OPACITY_TRANSPARENT,
GIMP_OPACITY_OPAQUE,
0.01, 0.1, FALSE);
gimp_context_set_opacity (context, opacity);
}
void
context_brush_select_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpContext *context;
return_if_no_context (context, data);
context_select_object (context, context->gimp->brush_factory->container,
(GimpContextSelectType) value);
}
void
context_pattern_select_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpContext *context;
return_if_no_context (context, data);
context_select_object (context, context->gimp->pattern_factory->container,
(GimpContextSelectType) value);
}
void
context_palette_select_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpContext *context;
return_if_no_context (context, data);
context_select_object (context, context->gimp->palette_factory->container,
(GimpContextSelectType) value);
}
void
context_gradient_select_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpContext *context;
return_if_no_context (context, data);
context_select_object (context, context->gimp->gradient_factory->container,
(GimpContextSelectType) value);
}
void
context_font_select_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpContext *context;
return_if_no_context (context, data);
context_select_object (context, context->gimp->fonts,
(GimpContextSelectType) value);
}
void
context_brush_radius_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpContext *context;
GimpBrush *brush;
return_if_no_context (context, data);
brush = gimp_context_get_brush (context);
if (GIMP_IS_BRUSH_GENERATED (brush))
{
GimpBrushGenerated *generated = GIMP_BRUSH_GENERATED (brush);
gdouble radius;
radius = gimp_brush_generated_get_radius (generated);
radius = context_select_value ((GimpContextSelectType) value,
radius,
1.0, 4096.0,
1.0, 10.0, FALSE);
gimp_brush_generated_set_radius (generated, radius);
}
}
void
context_brush_hardness_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpContext *context;
GimpBrush *brush;
return_if_no_context (context, data);
brush = gimp_context_get_brush (context);
if (GIMP_IS_BRUSH_GENERATED (brush))
{
GimpBrushGenerated *generated = GIMP_BRUSH_GENERATED (brush);
gdouble hardness;
hardness = gimp_brush_generated_get_hardness (generated);
hardness = context_select_value ((GimpContextSelectType) value,
hardness,
0.0, 1.0,
0.01, 0.1, FALSE);
gimp_brush_generated_set_hardness (generated, hardness);
}
}
void
context_brush_aspect_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpContext *context;
GimpBrush *brush;
return_if_no_context (context, data);
brush = gimp_context_get_brush (context);
if (GIMP_IS_BRUSH_GENERATED (brush))
{
GimpBrushGenerated *generated = GIMP_BRUSH_GENERATED (brush);
gdouble aspect;
aspect = gimp_brush_generated_get_aspect_ratio (generated);
aspect = context_select_value ((GimpContextSelectType) value,
aspect,
1.0, 1000.0,
1.0, 4.0, FALSE);
gimp_brush_generated_set_aspect_ratio (generated, aspect);
}
}
void
context_brush_angle_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpContext *context;
GimpBrush *brush;
return_if_no_context (context, data);
brush = gimp_context_get_brush (context);
if (GIMP_IS_BRUSH_GENERATED (brush))
{
GimpBrushGenerated *generated = GIMP_BRUSH_GENERATED (brush);
gdouble angle;
angle = gimp_brush_generated_get_angle (generated);
if (value == GIMP_CONTEXT_SELECT_FIRST)
angle = 0.0;
else if (value == GIMP_CONTEXT_SELECT_LAST)