mirror of https://github.com/GNOME/gimp.git
app/actions/context-actions.c applied a heavily modified patch from David
2004-09-07 Michael Natterer <mitch@gimp.org> * app/actions/context-actions.c * app/actions/context-commands.[ch]: applied a heavily modified patch from David Gowers which adds actions to modify the context's paint_mode. Fixes bug #151471. * menus/image-menu.xml.in: added them to the (commentd out) "Context" submenu.
This commit is contained in:
parent
a2a6572519
commit
5f67c6f216
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2004-09-07 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/actions/context-actions.c
|
||||
* app/actions/context-commands.[ch]: applied a heavily modified
|
||||
patch from David Gowers which adds actions to modify the context's
|
||||
paint_mode. Fixes bug #151471.
|
||||
|
||||
* menus/image-menu.xml.in: added them to the (commentd out)
|
||||
"Context" submenu.
|
||||
|
||||
2004-09-07 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* plug-ins/common/edge.c: indentation and whitespace cleanup.
|
||||
|
|
|
@ -43,21 +43,22 @@
|
|||
|
||||
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-menu", NULL, N_("_Context") },
|
||||
{ "context-colors-menu", GIMP_STOCK_DEFAULT_COLORS, N_("_Colors") },
|
||||
{ "context-opacity-menu", GIMP_STOCK_TRANSPARENCY, N_("_Opacity") },
|
||||
{ "context-paint-mode-menu", GIMP_STOCK_TOOL_PENCIL, N_("Paint _Mode") },
|
||||
{ "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-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-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,
|
||||
|
@ -294,6 +295,26 @@ static GimpEnumActionEntry context_opacity_actions[] =
|
|||
NULL }
|
||||
};
|
||||
|
||||
static GimpEnumActionEntry context_paint_mode_actions[] =
|
||||
{
|
||||
{ "context-paint-mode-first", GIMP_STOCK_TOOL_PENCIL,
|
||||
"First Paint Mode", NULL, NULL,
|
||||
GIMP_ACTION_SELECT_FIRST,
|
||||
NULL },
|
||||
{ "context-paint-mode-last", GIMP_STOCK_TOOL_PENCIL,
|
||||
"Last Paint Mode", NULL, NULL,
|
||||
GIMP_ACTION_SELECT_LAST,
|
||||
NULL },
|
||||
{ "context-paint-mode-previous", GIMP_STOCK_TOOL_PENCIL,
|
||||
"Previous Paint Mode", NULL, NULL,
|
||||
GIMP_ACTION_SELECT_PREVIOUS,
|
||||
NULL },
|
||||
{ "context-paint-mode-next", GIMP_STOCK_TOOL_PENCIL,
|
||||
"Next Paint Mode", NULL, NULL,
|
||||
GIMP_ACTION_SELECT_NEXT,
|
||||
NULL }
|
||||
};
|
||||
|
||||
static GimpEnumActionEntry context_tool_select_actions[] =
|
||||
{
|
||||
{ "context-tool-select-first", GIMP_STOCK_TOOLS,
|
||||
|
@ -628,6 +649,10 @@ context_actions_setup (GimpActionGroup *group)
|
|||
context_opacity_actions,
|
||||
G_N_ELEMENTS (context_opacity_actions),
|
||||
G_CALLBACK (context_opacity_cmd_callback));
|
||||
gimp_action_group_add_enum_actions (group,
|
||||
context_paint_mode_actions,
|
||||
G_N_ELEMENTS (context_paint_mode_actions),
|
||||
G_CALLBACK (context_paint_mode_cmd_callback));
|
||||
|
||||
gimp_action_group_add_enum_actions (group,
|
||||
context_tool_select_actions,
|
||||
|
|
|
@ -36,11 +36,39 @@
|
|||
#include "context-commands.h"
|
||||
|
||||
|
||||
static const GimpLayerModeEffects paint_modes[] =
|
||||
{
|
||||
GIMP_NORMAL_MODE,
|
||||
GIMP_DISSOLVE_MODE,
|
||||
GIMP_BEHIND_MODE,
|
||||
GIMP_COLOR_ERASE_MODE,
|
||||
GIMP_MULTIPLY_MODE,
|
||||
GIMP_DIVIDE_MODE,
|
||||
GIMP_SCREEN_MODE,
|
||||
GIMP_OVERLAY_MODE,
|
||||
GIMP_DODGE_MODE,
|
||||
GIMP_BURN_MODE,
|
||||
GIMP_HARDLIGHT_MODE,
|
||||
GIMP_SOFTLIGHT_MODE,
|
||||
GIMP_GRAIN_EXTRACT_MODE,
|
||||
GIMP_GRAIN_MERGE_MODE,
|
||||
GIMP_DIFFERENCE_MODE,
|
||||
GIMP_ADDITION_MODE,
|
||||
GIMP_SUBTRACT_MODE,
|
||||
GIMP_DARKEN_ONLY_MODE,
|
||||
GIMP_LIGHTEN_ONLY_MODE,
|
||||
GIMP_HUE_MODE,
|
||||
GIMP_SATURATION_MODE,
|
||||
GIMP_COLOR_MODE,
|
||||
GIMP_VALUE_MODE
|
||||
};
|
||||
|
||||
/* local function prototypes */
|
||||
|
||||
static void context_select_object (GimpActionSelectType select_type,
|
||||
GimpContext *context,
|
||||
GimpContainer *container);
|
||||
static void context_select_object (GimpActionSelectType select_type,
|
||||
GimpContext *context,
|
||||
GimpContainer *container);
|
||||
static gint context_paint_mode_index (GimpLayerModeEffects paint_mode);
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
@ -184,6 +212,25 @@ context_opacity_cmd_callback (GtkAction *action,
|
|||
gimp_context_set_opacity (context, opacity);
|
||||
}
|
||||
|
||||
void
|
||||
context_paint_mode_cmd_callback (GtkAction *action,
|
||||
gint value,
|
||||
gpointer data)
|
||||
{
|
||||
GimpContext *context;
|
||||
GimpLayerModeEffects paint_mode;
|
||||
gint index;
|
||||
return_if_no_context (context, data);
|
||||
|
||||
paint_mode = gimp_context_get_paint_mode (context);
|
||||
|
||||
index = action_select_value ((GimpActionSelectType) value,
|
||||
context_paint_mode_index (paint_mode),
|
||||
0, G_N_ELEMENTS (paint_modes) - 1,
|
||||
1.0, 1.0, FALSE);
|
||||
gimp_context_set_paint_mode (context, paint_modes[index]);
|
||||
}
|
||||
|
||||
void
|
||||
context_tool_select_cmd_callback (GtkAction *action,
|
||||
gint value,
|
||||
|
@ -429,3 +476,14 @@ context_select_object (GimpActionSelectType select_type,
|
|||
if (current)
|
||||
gimp_context_set_by_type (context, container->children_type, current);
|
||||
}
|
||||
|
||||
static gint
|
||||
context_paint_mode_index (GimpLayerModeEffects paint_mode)
|
||||
{
|
||||
gint i = 0;
|
||||
|
||||
while (i < (G_N_ELEMENTS (paint_modes) - 1) && paint_modes[i] != paint_mode)
|
||||
i++;
|
||||
|
||||
return i;
|
||||
}
|
||||
|
|
|
@ -48,6 +48,9 @@ void context_background_blue_cmd_callback (GtkAction *action,
|
|||
void context_opacity_cmd_callback (GtkAction *action,
|
||||
gint value,
|
||||
gpointer data);
|
||||
void context_paint_mode_cmd_callback (GtkAction *action,
|
||||
gint value,
|
||||
gpointer data);
|
||||
|
||||
void context_tool_select_cmd_callback (GtkAction *action,
|
||||
gint value,
|
||||
|
|
|
@ -46,6 +46,12 @@
|
|||
<menuitem action="context-opacity-decrease" />
|
||||
<menuitem action="context-opacity-increase" />
|
||||
</menu>
|
||||
<menu action="context-paint-mode-menu" name="Paint Mode">
|
||||
<menuitem action="context-paint-mode-first" />
|
||||
<menuitem action="context-paint-mode-last" />
|
||||
<menuitem action="context-paint-mode-previous" />
|
||||
<menuitem action="context-paint-mode-next" />
|
||||
</menu>
|
||||
<separator />
|
||||
<menu action="context-brush-menu" name="Brush">
|
||||
<menuitem action="context-brush-select-first" />
|
||||
|
|
Loading…
Reference in New Issue