Commit f3d3a3a6 authored by Michael Natterer's avatar Michael Natterer Committed by Michael Natterer

app/actions/context-actions.c app/actions/context-commands.[ch] added

2004-08-05  Michael Natterer  <mitch@gimp.org>

	* app/actions/context-actions.c
	* app/actions/context-commands.[ch]
	* menus/image-menu.xml.in: added actions, callbacks and menu items
	for the brush shape and spikes.
parent 8e7d7f55
2004-08-05 Michael Natterer <mitch@gimp.org>
* app/actions/context-actions.c
* app/actions/context-commands.[ch]
* menus/image-menu.xml.in: added actions, callbacks and menu items
for the brush shape and spikes.
2004-08-04 Simon Budig <simon@gimp.org>
* plug-ins/common/grid.c: changed the default colors for the
......
......@@ -52,6 +52,13 @@ static GimpActionEntry context_actions[] =
{ "context-gradient-menu", GIMP_STOCK_GRADIENT, N_("_Gradient") },
{ "context-font-menu", GIMP_STOCK_FONT, N_("_Font") },
{ "context-brush-shape-menu", NULL, N_("_Shape") },
{ "context-brush-radius-menu", NULL, N_("_Radius") },
{ "context-brush-spikes-menu", NULL, N_("S_pikes") },
{ "context-brush-hardness-menu", NULL, N_("_Hardness") },
{ "context-brush-aspect-menu", NULL, N_("_Aspect") },
{ "context-brush-angle-menu", NULL, N_("A_ngle") },
{ "context-colors-default", GIMP_STOCK_DEFAULT_COLORS,
N_("_Default Colors"), "D", NULL,
G_CALLBACK (context_colors_default_cmd_callback),
......@@ -407,6 +414,22 @@ static GimpEnumActionEntry context_font_select_actions[] =
NULL }
};
static GimpEnumActionEntry context_brush_shape_actions[] =
{
{ "context-brush-shape-circle", GIMP_STOCK_SHAPE_CIRCLE,
"Circle", NULL, NULL,
GIMP_BRUSH_GENERATED_CIRCLE,
NULL },
{ "context-brush-shape-square", GIMP_STOCK_SHAPE_SQUARE,
"Square", NULL, NULL,
GIMP_BRUSH_GENERATED_SQUARE,
NULL },
{ "context-brush-shape-diamond", GIMP_STOCK_SHAPE_DIAMOND,
"Diamond", NULL, NULL,
GIMP_BRUSH_GENERATED_DIAMOND,
NULL }
};
static GimpEnumActionEntry context_brush_radius_actions[] =
{
{ "context-brush-radius-set", NULL,
......@@ -439,6 +462,38 @@ static GimpEnumActionEntry context_brush_radius_actions[] =
NULL },
};
static GimpEnumActionEntry context_brush_spikes_actions[] =
{
{ "context-brush-spikes-set", NULL,
"Set Brush Spikes", NULL, NULL,
GIMP_ACTION_SELECT_SET,
NULL },
{ "context-brush-spikes-minimum", GTK_STOCK_GOTO_FIRST,
"Minumum Spikes", NULL, NULL,
GIMP_ACTION_SELECT_FIRST,
NULL },
{ "context-brush-spikes-maximum", GTK_STOCK_GOTO_LAST,
"Maximum Spikes", NULL, NULL,
GIMP_ACTION_SELECT_LAST,
NULL },
{ "context-brush-spikes-decrease", GTK_STOCK_GO_BACK,
"Decrease Spikes", NULL, NULL,
GIMP_ACTION_SELECT_PREVIOUS,
NULL },
{ "context-brush-spikes-increase", GTK_STOCK_GO_FORWARD,
"Increase Spikes", NULL, NULL,
GIMP_ACTION_SELECT_NEXT,
NULL },
{ "context-brush-spikes-decrease-skip", GTK_STOCK_GO_BACK,
"Decrease Spikes More", NULL, NULL,
GIMP_ACTION_SELECT_SKIP_PREVIOUS,
NULL },
{ "context-brush-spikes-increase-skip", GTK_STOCK_GO_FORWARD,
"Increase Spikes More", NULL, NULL,
GIMP_ACTION_SELECT_SKIP_NEXT,
NULL },
};
static GimpEnumActionEntry context_brush_hardness_actions[] =
{
{ "context-brush-hardness-set", NULL,
......@@ -599,10 +654,18 @@ context_actions_setup (GimpActionGroup *group)
G_N_ELEMENTS (context_font_select_actions),
G_CALLBACK (context_font_select_cmd_callback));
gimp_action_group_add_enum_actions (group,
context_brush_shape_actions,
G_N_ELEMENTS (context_brush_shape_actions),
G_CALLBACK (context_brush_shape_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_spikes_actions,
G_N_ELEMENTS (context_brush_spikes_actions),
G_CALLBACK (context_brush_spikes_cmd_callback));
gimp_action_group_add_enum_actions (group,
context_brush_hardness_actions,
G_N_ELEMENTS (context_brush_hardness_actions),
......@@ -623,10 +686,11 @@ context_actions_update (GimpActionGroup *group,
{
GimpContext *context;
gboolean generated = FALSE;
gboolean radius = 0.0;
gboolean hardness = 0.0;
gboolean aspect = 0.0;
gboolean angle = 0.0;
gdouble radius = 0.0;
gint spikes = 0;
gdouble hardness = 0.0;
gdouble aspect = 0.0;
gdouble angle = 0.0;
context = action_data_get_context (data);
......@@ -641,6 +705,7 @@ context_actions_update (GimpActionGroup *group,
generated = TRUE;
radius = gimp_brush_generated_get_radius (gen);
spikes = gimp_brush_generated_get_spikes (gen);
hardness = gimp_brush_generated_get_hardness (gen);
aspect = gimp_brush_generated_get_aspect_ratio (gen);
angle = gimp_brush_generated_get_angle (gen);
......
......@@ -256,6 +256,26 @@ context_font_select_cmd_callback (GtkAction *action,
context, context->gimp->fonts);
}
void
context_brush_shape_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);
gimp_brush_generated_set_shape (generated,
(GimpBrushGeneratedShape) value);
}
}
void
context_brush_radius_cmd_callback (GtkAction *action,
gint value,
......@@ -282,6 +302,32 @@ context_brush_radius_cmd_callback (GtkAction *action,
}
}
void
context_brush_spikes_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);
gint spikes;
spikes = gimp_brush_generated_get_spikes (generated);
spikes = action_select_value ((GimpActionSelectType) value,
spikes,
2.0, 20.0,
1.0, 4.0, FALSE);
gimp_brush_generated_set_spikes (generated, spikes);
}
}
void
context_brush_hardness_cmd_callback (GtkAction *action,
gint value,
......
......@@ -68,9 +68,15 @@ void context_font_select_cmd_callback (GtkAction *action,
gint value,
gpointer data);
void context_brush_shape_cmd_callback (GtkAction *action,
gint value,
gpointer data);
void context_brush_radius_cmd_callback (GtkAction *action,
gint value,
gpointer data);
void context_brush_spikes_cmd_callback (GtkAction *action,
gint value,
gpointer data);
void context_brush_hardness_cmd_callback (GtkAction *action,
gint value,
gpointer data);
......
......@@ -53,33 +53,51 @@
<menuitem action="context-brush-select-previous" />
<menuitem action="context-brush-select-next" />
<separator />
<menuitem action="context-brush-radius-minimum" />
<menuitem action="context-brush-radius-maximum" />
<menuitem action="context-brush-radius-decrease" />
<menuitem action="context-brush-radius-increase" />
<menuitem action="context-brush-radius-decrease-skip" />
<menuitem action="context-brush-radius-increase-skip" />
<separator />
<menuitem action="context-brush-hardness-minimum" />
<menuitem action="context-brush-hardness-maximum" />
<menuitem action="context-brush-hardness-decrease" />
<menuitem action="context-brush-hardness-increase" />
<menuitem action="context-brush-hardness-decrease-skip" />
<menuitem action="context-brush-hardness-increase-skip" />
<separator />
<menuitem action="context-brush-aspect-minimum" />
<menuitem action="context-brush-aspect-maximum" />
<menuitem action="context-brush-aspect-decrease" />
<menuitem action="context-brush-aspect-increase" />
<menuitem action="context-brush-aspect-decrease-skip" />
<menuitem action="context-brush-aspect-increase-skip" />
<separator />
<menuitem action="context-brush-angle-minimum" />
<menuitem action="context-brush-angle-maximum" />
<menuitem action="context-brush-angle-decrease" />
<menuitem action="context-brush-angle-increase" />
<menuitem action="context-brush-angle-decrease-skip" />
<menuitem action="context-brush-angle-increase-skip" />
<menu action="context-brush-shape-menu" name="Shape">
<menuitem action="context-brush-shape-circle" />
<menuitem action="context-brush-shape-square" />
<menuitem action="context-brush-shape-diamond" />
</menu>
<menu action="context-brush-radius-menu" name="Radius">
<menuitem action="context-brush-radius-minimum" />
<menuitem action="context-brush-radius-maximum" />
<menuitem action="context-brush-radius-decrease" />
<menuitem action="context-brush-radius-increase" />
<menuitem action="context-brush-radius-decrease-skip" />
<menuitem action="context-brush-radius-increase-skip" />
</menu>
<menu action="context-brush-spikes-menu" name="Spikes">
<menuitem action="context-brush-spikes-minimum" />
<menuitem action="context-brush-spikes-maximum" />
<menuitem action="context-brush-spikes-decrease" />
<menuitem action="context-brush-spikes-increase" />
<menuitem action="context-brush-spikes-decrease-skip" />
<menuitem action="context-brush-spikes-increase-skip" />
</menu>
<menu action="context-brush-hardness-menu" name="Hardness">
<menuitem action="context-brush-hardness-minimum" />
<menuitem action="context-brush-hardness-maximum" />
<menuitem action="context-brush-hardness-decrease" />
<menuitem action="context-brush-hardness-increase" />
<menuitem action="context-brush-hardness-decrease-skip" />
<menuitem action="context-brush-hardness-increase-skip" />
</menu>
<menu action="context-brush-aspect-menu" name="Aspect">
<menuitem action="context-brush-aspect-minimum" />
<menuitem action="context-brush-aspect-maximum" />
<menuitem action="context-brush-aspect-decrease" />
<menuitem action="context-brush-aspect-increase" />
<menuitem action="context-brush-aspect-decrease-skip" />
<menuitem action="context-brush-aspect-increase-skip" />
</menu>
<menu action="context-brush-angle-menu" name="Angle">
<menuitem action="context-brush-angle-minimum" />
<menuitem action="context-brush-angle-maximum" />
<menuitem action="context-brush-angle-decrease" />
<menuitem action="context-brush-angle-increase" />
<menuitem action="context-brush-angle-decrease-skip" />
<menuitem action="context-brush-angle-increase-skip" />
</menu>
</menu>
<menu action="context-pattern-menu" name="Pattern">
<menuitem action="context-pattern-select-first" />
......
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