removed enum GimpContextSelectType.

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

	* app/actions/context-commands.h: removed enum GimpContextSelectType.

	* app/actions/actions-types.h: added enum GimpActionSelectType.

	* app/actions/actions.[ch]: added utility functions
	action_select_value() and action_select_object().

	* app/actions/context-actions.c
	* app/actions/context-commands.c: changed accordingly.

	* app/actions/layers-actions.c
	* app/actions/layers-commands.[ch]: merged the layer select
	callbacks into one using the GimpActionSelectType functions. Added
	actions and callbacks for modifying the active layer's opacity.

	* app/menus/menus-types.h: #incude "actions/action-types.h".

	* app/gui/gui-types.h: #incude "menus/menus-types.h".

	* app/gui/preferences-dialog.c: allow to enable/disable input
	controllers.
This commit is contained in:
Michael Natterer 2004-06-23 00:23:25 +00:00 committed by Michael Natterer
parent 546359f914
commit d88f23ddba
14 changed files with 460 additions and 399 deletions

View File

@ -1,3 +1,27 @@
2004-06-23 Michael Natterer <mitch@gimp.org>
* app/actions/context-commands.h: removed enum GimpContextSelectType.
* app/actions/actions-types.h: added enum GimpActionSelectType.
* app/actions/actions.[ch]: added utility functions
action_select_value() and action_select_object().
* app/actions/context-actions.c
* app/actions/context-commands.c: changed accordingly.
* app/actions/layers-actions.c
* app/actions/layers-commands.[ch]: merged the layer select
callbacks into one using the GimpActionSelectType functions. Added
actions and callbacks for modifying the active layer's opacity.
* app/menus/menus-types.h: #incude "actions/action-types.h".
* app/gui/gui-types.h: #incude "menus/menus-types.h".
* app/gui/preferences-dialog.c: allow to enable/disable input
controllers.
2004-06-22 Bill Skaggs <weskaggs@primate.ucdavis.edu>
* app/tools/gimpcurvestool.c: try again to revert.

View File

@ -23,4 +23,16 @@
#include "gui/gui-types.h"
typedef enum
{
GIMP_ACTION_SELECT_SET = 0,
GIMP_ACTION_SELECT_FIRST = -1,
GIMP_ACTION_SELECT_LAST = -2,
GIMP_ACTION_SELECT_PREVIOUS = -3,
GIMP_ACTION_SELECT_NEXT = -4,
GIMP_ACTION_SELECT_SKIP_PREVIOUS = -5,
GIMP_ACTION_SELECT_SKIP_NEXT = -6
} GimpActionSelectType;
#endif /* __ACTIONS_TYPES_H__ */

View File

@ -25,6 +25,7 @@
#include "actions-types.h"
#include "core/gimp.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
@ -322,3 +323,117 @@ action_data_get_widget (gpointer data)
return NULL;
}
gdouble
action_select_value (GimpActionSelectType select_type,
gdouble value,
gdouble min,
gdouble max,
gdouble inc,
gdouble skip_inc,
gboolean wrap)
{
switch (select_type)
{
case GIMP_ACTION_SELECT_FIRST:
value = min;
break;
case GIMP_ACTION_SELECT_LAST:
value = max;
break;
case GIMP_ACTION_SELECT_PREVIOUS:
value -= inc;
break;
case GIMP_ACTION_SELECT_NEXT:
value += inc;
break;
case GIMP_ACTION_SELECT_SKIP_PREVIOUS:
value -= skip_inc;
break;
case GIMP_ACTION_SELECT_SKIP_NEXT:
value += skip_inc;
break;
default:
if (value >= 0)
value = (gdouble) select_type * (max - min) / 1000.0 + min;
else
g_return_val_if_reached (value);
break;
}
if (wrap)
{
while (value < min)
value = max - (min - value);
while (value > max)
value = min + (max - value);
}
else
{
value = CLAMP (value, min, max);
}
return value;
}
GimpObject *
action_select_object (GimpActionSelectType select_type,
GimpContainer *container,
GimpObject *current)
{
gint select_index;
gint n_children;
g_return_val_if_fail (GIMP_IS_CONTAINER (container), NULL);
g_return_val_if_fail (current == NULL || GIMP_IS_OBJECT (current), NULL);
if (! current)
return NULL;
n_children = gimp_container_num_children (container);
if (n_children == 0)
return;
switch (select_type)
{
case GIMP_ACTION_SELECT_FIRST:
select_index = 0;
break;
case GIMP_ACTION_SELECT_LAST:
select_index = n_children - 1;
break;
case GIMP_ACTION_SELECT_PREVIOUS:
select_index = gimp_container_get_child_index (container, current) - 1;
break;
case GIMP_ACTION_SELECT_NEXT:
select_index = gimp_container_get_child_index (container, current) + 1;
break;
case GIMP_ACTION_SELECT_SKIP_PREVIOUS:
select_index = gimp_container_get_child_index (container, current) - 10;
break;
case GIMP_ACTION_SELECT_SKIP_NEXT:
select_index = gimp_container_get_child_index (container, current) + 10;
break;
default:
g_return_val_if_reached (current);
break;
}
select_index = CLAMP (select_index, 0, n_children - 1);
return gimp_container_get_child_by_index (container, select_index);
}

View File

@ -23,14 +23,25 @@
extern GimpActionFactory *global_action_factory;
void actions_init (Gimp *gimp);
void actions_exit (Gimp *gimp);
void actions_init (Gimp *gimp);
void actions_exit (Gimp *gimp);
Gimp * action_data_get_gimp (gpointer data);
GimpContext * action_data_get_context (gpointer data);
GimpImage * action_data_get_image (gpointer data);
GimpDisplay * action_data_get_display (gpointer data);
GtkWidget * action_data_get_widget (gpointer data);
Gimp * action_data_get_gimp (gpointer data);
GimpContext * action_data_get_context (gpointer data);
GimpImage * action_data_get_image (gpointer data);
GimpDisplay * action_data_get_display (gpointer data);
GtkWidget * action_data_get_widget (gpointer data);
gdouble action_select_value (GimpActionSelectType select_type,
gdouble value,
gdouble min,
gdouble max,
gdouble inc,
gdouble skip_inc,
gboolean wrap);
GimpObject * action_select_object (GimpActionSelectType select_type,
GimpContainer *container,
GimpObject *current);
#define return_if_no_gimp(gimp,data) \

View File

@ -67,31 +67,31 @@ static GimpEnumActionEntry context_foreground_red_actions[] =
{
{ "context-foreground-red-set", NULL,
"Set Foreground Red", NULL, NULL,
GIMP_CONTEXT_SELECT_SET,
GIMP_ACTION_SELECT_SET,
NULL },
{ "context-foreground-red-minimum", GTK_STOCK_GOTO_FIRST,
"Foreground Red Minimum", NULL, NULL,
GIMP_CONTEXT_SELECT_FIRST,
GIMP_ACTION_SELECT_FIRST,
NULL },
{ "context-foreground-red-maximum", GTK_STOCK_GOTO_LAST,
"Foreground Red Maximum", NULL, NULL,
GIMP_CONTEXT_SELECT_LAST,
GIMP_ACTION_SELECT_LAST,
NULL },
{ "context-foreground-red-decrease", GTK_STOCK_REMOVE,
"Foreground Red Decrease", NULL, NULL,
GIMP_CONTEXT_SELECT_PREVIOUS,
GIMP_ACTION_SELECT_PREVIOUS,
NULL },
{ "context-foreground-red-increase", GTK_STOCK_ADD,
"Foreground Red Increase", NULL, NULL,
GIMP_CONTEXT_SELECT_NEXT,
GIMP_ACTION_SELECT_NEXT,
NULL },
{ "context-foreground-red-decrease-skip", GTK_STOCK_REMOVE,
"Foreground Red Decrease 10%", NULL, NULL,
GIMP_CONTEXT_SELECT_SKIP_PREVIOUS,
GIMP_ACTION_SELECT_SKIP_PREVIOUS,
NULL },
{ "context-foreground-red-increase-skip", GTK_STOCK_ADD,
"Foreground Red Increase 10%", NULL, NULL,
GIMP_CONTEXT_SELECT_SKIP_NEXT,
GIMP_ACTION_SELECT_SKIP_NEXT,
NULL }
};
@ -99,31 +99,31 @@ static GimpEnumActionEntry context_foreground_green_actions[] =
{
{ "context-foreground-green-set", NULL,
"Set Foreground Green", NULL, NULL,
GIMP_CONTEXT_SELECT_SET,
GIMP_ACTION_SELECT_SET,
NULL },
{ "context-foreground-green-minimum", GTK_STOCK_GOTO_FIRST,
"Foreground Green Minimum", NULL, NULL,
GIMP_CONTEXT_SELECT_FIRST,
GIMP_ACTION_SELECT_FIRST,
NULL },
{ "context-foreground-green-maximum", GTK_STOCK_GOTO_LAST,
"Foreground Green Maximum", NULL, NULL,
GIMP_CONTEXT_SELECT_LAST,
GIMP_ACTION_SELECT_LAST,
NULL },
{ "context-foreground-green-decrease", GTK_STOCK_REMOVE,
"Foreground Green Decrease", NULL, NULL,
GIMP_CONTEXT_SELECT_PREVIOUS,
GIMP_ACTION_SELECT_PREVIOUS,
NULL },
{ "context-foreground-green-increase", GTK_STOCK_ADD,
"Foreground Green Increase", NULL, NULL,
GIMP_CONTEXT_SELECT_NEXT,
GIMP_ACTION_SELECT_NEXT,
NULL },
{ "context-foreground-green-decrease-skip", GTK_STOCK_REMOVE,
"Foreground Green Decrease 10%", NULL, NULL,
GIMP_CONTEXT_SELECT_SKIP_PREVIOUS,
GIMP_ACTION_SELECT_SKIP_PREVIOUS,
NULL },
{ "context-foreground-green-increase-skip", GTK_STOCK_ADD,
"Foreground Green Increase 10%", NULL, NULL,
GIMP_CONTEXT_SELECT_SKIP_NEXT,
GIMP_ACTION_SELECT_SKIP_NEXT,
NULL }
};
@ -131,31 +131,31 @@ static GimpEnumActionEntry context_foreground_blue_actions[] =
{
{ "context-foreground-blue-set", NULL,
"Set Foreground Blue", NULL, NULL,
GIMP_CONTEXT_SELECT_SET,
GIMP_ACTION_SELECT_SET,
NULL },
{ "context-foreground-blue-minimum", GTK_STOCK_GOTO_FIRST,
"Foreground Blue Minimum", NULL, NULL,
GIMP_CONTEXT_SELECT_FIRST,
GIMP_ACTION_SELECT_FIRST,
NULL },
{ "context-foreground-blue-maximum", GTK_STOCK_GOTO_LAST,
"Foreground Blue Maximum", NULL, NULL,
GIMP_CONTEXT_SELECT_LAST,
GIMP_ACTION_SELECT_LAST,
NULL },
{ "context-foreground-blue-decrease", GTK_STOCK_REMOVE,
"Foreground Blue Decrease", NULL, NULL,
GIMP_CONTEXT_SELECT_PREVIOUS,
GIMP_ACTION_SELECT_PREVIOUS,
NULL },
{ "context-foreground-blue-increase", GTK_STOCK_ADD,
"Foreground Blue Increase", NULL, NULL,
GIMP_CONTEXT_SELECT_NEXT,
GIMP_ACTION_SELECT_NEXT,
NULL },
{ "context-foreground-blue-decrease-skip", GTK_STOCK_REMOVE,
"Foreground Blue Decrease 10%", NULL, NULL,
GIMP_CONTEXT_SELECT_SKIP_PREVIOUS,
GIMP_ACTION_SELECT_SKIP_PREVIOUS,
NULL },
{ "context-foreground-blue-increase-skip", GTK_STOCK_ADD,
"Foreground Blue Increase 10%", NULL, NULL,
GIMP_CONTEXT_SELECT_SKIP_NEXT,
GIMP_ACTION_SELECT_SKIP_NEXT,
NULL }
};
@ -163,31 +163,31 @@ static GimpEnumActionEntry context_background_red_actions[] =
{
{ "context-background-red-set", NULL,
"Set Background Red", NULL, NULL,
GIMP_CONTEXT_SELECT_SET,
GIMP_ACTION_SELECT_SET,
NULL },
{ "context-background-red-minimum", GTK_STOCK_GOTO_FIRST,
"Background Red Minimum", NULL, NULL,
GIMP_CONTEXT_SELECT_FIRST,
GIMP_ACTION_SELECT_FIRST,
NULL },
{ "context-background-red-maximum", GTK_STOCK_GOTO_LAST,
"Background Red Maximum", NULL, NULL,
GIMP_CONTEXT_SELECT_LAST,
GIMP_ACTION_SELECT_LAST,
NULL },
{ "context-background-red-decrease", GTK_STOCK_REMOVE,
"Background Red Decrease", NULL, NULL,
GIMP_CONTEXT_SELECT_PREVIOUS,
GIMP_ACTION_SELECT_PREVIOUS,
NULL },
{ "context-background-red-increase", GTK_STOCK_ADD,
"Background Red Increase", NULL, NULL,
GIMP_CONTEXT_SELECT_NEXT,
GIMP_ACTION_SELECT_NEXT,
NULL },
{ "context-background-red-decrease-skip", GTK_STOCK_REMOVE,
"Background Red Decrease 10%", NULL, NULL,
GIMP_CONTEXT_SELECT_SKIP_PREVIOUS,
GIMP_ACTION_SELECT_SKIP_PREVIOUS,
NULL },
{ "context-background-red-increase-skip", GTK_STOCK_ADD,
"Background Red Increase 10%", NULL, NULL,
GIMP_CONTEXT_SELECT_SKIP_NEXT,
GIMP_ACTION_SELECT_SKIP_NEXT,
NULL }
};
@ -195,31 +195,31 @@ static GimpEnumActionEntry context_background_green_actions[] =
{
{ "context-background-green-set", NULL,
"Set Background Green", NULL, NULL,
GIMP_CONTEXT_SELECT_SET,
GIMP_ACTION_SELECT_SET,
NULL },
{ "context-background-green-minimum", GTK_STOCK_GOTO_FIRST,
"Background Green Minimum", NULL, NULL,
GIMP_CONTEXT_SELECT_FIRST,
GIMP_ACTION_SELECT_FIRST,
NULL },
{ "context-background-green-maximum", GTK_STOCK_GOTO_LAST,
"Background Green Maximum", NULL, NULL,
GIMP_CONTEXT_SELECT_LAST,
GIMP_ACTION_SELECT_LAST,
NULL },
{ "context-background-green-decrease", GTK_STOCK_REMOVE,
"Background Green Decrease", NULL, NULL,
GIMP_CONTEXT_SELECT_PREVIOUS,
GIMP_ACTION_SELECT_PREVIOUS,
NULL },
{ "context-background-green-increase", GTK_STOCK_ADD,
"Background Green Increase", NULL, NULL,
GIMP_CONTEXT_SELECT_NEXT,
GIMP_ACTION_SELECT_NEXT,
NULL },
{ "context-background-green-decrease-skip", GTK_STOCK_REMOVE,
"Background Green Decrease 10%", NULL, NULL,
GIMP_CONTEXT_SELECT_SKIP_PREVIOUS,
GIMP_ACTION_SELECT_SKIP_PREVIOUS,
NULL },
{ "context-background-green-increase-skip", GTK_STOCK_ADD,
"Background Green Increase 10%", NULL, NULL,
GIMP_CONTEXT_SELECT_SKIP_NEXT,
GIMP_ACTION_SELECT_SKIP_NEXT,
NULL }
};
@ -227,31 +227,31 @@ static GimpEnumActionEntry context_background_blue_actions[] =
{
{ "context-background-blue-set", NULL,
"Set Background Blue", NULL, NULL,
GIMP_CONTEXT_SELECT_SET,
GIMP_ACTION_SELECT_SET,
NULL },
{ "context-background-blue-minimum", GTK_STOCK_GOTO_FIRST,
"Background Blue Minimum", NULL, NULL,
GIMP_CONTEXT_SELECT_FIRST,
GIMP_ACTION_SELECT_FIRST,
NULL },
{ "context-background-blue-maximum", GTK_STOCK_GOTO_LAST,
"Background Blue Maximum", NULL, NULL,
GIMP_CONTEXT_SELECT_LAST,
GIMP_ACTION_SELECT_LAST,
NULL },
{ "context-background-blue-decrease", GTK_STOCK_REMOVE,
"Background Blue Decrease", NULL, NULL,
GIMP_CONTEXT_SELECT_PREVIOUS,
GIMP_ACTION_SELECT_PREVIOUS,
NULL },
{ "context-background-blue-increase", GTK_STOCK_ADD,
"Background Blue Increase", NULL, NULL,
GIMP_CONTEXT_SELECT_NEXT,
GIMP_ACTION_SELECT_NEXT,
NULL },
{ "context-background-blue-decrease-skip", GTK_STOCK_REMOVE,
"Background Blue Decrease 10%", NULL, NULL,
GIMP_CONTEXT_SELECT_SKIP_PREVIOUS,
GIMP_ACTION_SELECT_SKIP_PREVIOUS,
NULL },
{ "context-background-blue-increase-skip", GTK_STOCK_ADD,
"Background Blue Increase 10%", NULL, NULL,
GIMP_CONTEXT_SELECT_SKIP_NEXT,
GIMP_ACTION_SELECT_SKIP_NEXT,
NULL }
};
@ -259,31 +259,31 @@ static GimpEnumActionEntry context_opacity_actions[] =
{
{ "context-opacity-set", NULL,
"Set Transparency", NULL, NULL,
GIMP_CONTEXT_SELECT_SET,
GIMP_ACTION_SELECT_SET,
NULL },
{ "context-opacity-transparent", GTK_STOCK_GOTO_FIRST,
"Completely Transparent", NULL, NULL,
GIMP_CONTEXT_SELECT_FIRST,
GIMP_ACTION_SELECT_FIRST,
NULL },
{ "context-opacity-opaque", GTK_STOCK_GOTO_LAST,
"Completely Opaque", NULL, NULL,
GIMP_CONTEXT_SELECT_LAST,
GIMP_ACTION_SELECT_LAST,
NULL },
{ "context-opacity-decrease", GTK_STOCK_REMOVE,
"More Transparent", NULL, NULL,
GIMP_CONTEXT_SELECT_PREVIOUS,
GIMP_ACTION_SELECT_PREVIOUS,
NULL },
{ "context-opacity-increase", GTK_STOCK_ADD,
"More Opaque", NULL, NULL,
GIMP_CONTEXT_SELECT_NEXT,
GIMP_ACTION_SELECT_NEXT,
NULL },
{ "context-opacity-decrease-skip", GTK_STOCK_REMOVE,
"10% More Transparent", NULL, NULL,
GIMP_CONTEXT_SELECT_SKIP_PREVIOUS,
GIMP_ACTION_SELECT_SKIP_PREVIOUS,
NULL },
{ "context-opacity-increase-skip", GTK_STOCK_ADD,
"10% More Opaque", NULL, NULL,
GIMP_CONTEXT_SELECT_SKIP_NEXT,
GIMP_ACTION_SELECT_SKIP_NEXT,
NULL }
};
@ -291,19 +291,19 @@ static GimpEnumActionEntry context_tool_select_actions[] =
{
{ "context-tool-first", GTK_STOCK_GOTO_FIRST,
"First Tool", NULL, NULL,
GIMP_CONTEXT_SELECT_FIRST,
GIMP_ACTION_SELECT_FIRST,
NULL },
{ "context-tool-last", GTK_STOCK_GOTO_LAST,
"Last Tool", NULL, NULL,
GIMP_CONTEXT_SELECT_LAST,
GIMP_ACTION_SELECT_LAST,
NULL },
{ "context-tool-previous", GTK_STOCK_GO_BACK,
"Previous Tool", NULL, NULL,
GIMP_CONTEXT_SELECT_PREVIOUS,
GIMP_ACTION_SELECT_PREVIOUS,
NULL },
{ "context-tool-next", GTK_STOCK_GO_FORWARD,
"Next Tool", NULL, NULL,
GIMP_CONTEXT_SELECT_NEXT,
GIMP_ACTION_SELECT_NEXT,
NULL }
};
@ -311,19 +311,19 @@ static GimpEnumActionEntry context_brush_select_actions[] =
{
{ "context-brush-first", GTK_STOCK_GOTO_FIRST,
"First Brush", NULL, NULL,
GIMP_CONTEXT_SELECT_FIRST,
GIMP_ACTION_SELECT_FIRST,
NULL },
{ "context-brush-last", GTK_STOCK_GOTO_LAST,
"Last Brush", NULL, NULL,
GIMP_CONTEXT_SELECT_LAST,
GIMP_ACTION_SELECT_LAST,
NULL },
{ "context-brush-previous", GTK_STOCK_GO_BACK,
"Previous Brush", NULL, NULL,
GIMP_CONTEXT_SELECT_PREVIOUS,
GIMP_ACTION_SELECT_PREVIOUS,
NULL },
{ "context-brush-next", GTK_STOCK_GO_FORWARD,
"Next Brush", NULL, NULL,
GIMP_CONTEXT_SELECT_NEXT,
GIMP_ACTION_SELECT_NEXT,
NULL }
};
@ -331,19 +331,19 @@ static GimpEnumActionEntry context_pattern_select_actions[] =
{
{ "context-pattern-first", GTK_STOCK_GOTO_FIRST,
"First Pattern", NULL, NULL,
GIMP_CONTEXT_SELECT_FIRST,
GIMP_ACTION_SELECT_FIRST,
NULL },
{ "context-pattern-last", GTK_STOCK_GOTO_LAST,
"Last Pattern", NULL, NULL,
GIMP_CONTEXT_SELECT_LAST,
GIMP_ACTION_SELECT_LAST,
NULL },
{ "context-pattern-previous", GTK_STOCK_GO_BACK,
"Previous Pattern", NULL, NULL,
GIMP_CONTEXT_SELECT_PREVIOUS,
GIMP_ACTION_SELECT_PREVIOUS,
NULL },
{ "context-pattern-next", GTK_STOCK_GO_FORWARD,
"Next Pattern", NULL, NULL,
GIMP_CONTEXT_SELECT_NEXT,
GIMP_ACTION_SELECT_NEXT,
NULL }
};
@ -351,19 +351,19 @@ static GimpEnumActionEntry context_palette_select_actions[] =
{
{ "context-palette-first", GTK_STOCK_GOTO_FIRST,
"First Palette", NULL, NULL,
GIMP_CONTEXT_SELECT_FIRST,
GIMP_ACTION_SELECT_FIRST,
NULL },
{ "context-palette-last", GTK_STOCK_GOTO_LAST,
"Last Palette", NULL, NULL,
GIMP_CONTEXT_SELECT_LAST,
GIMP_ACTION_SELECT_LAST,
NULL },
{ "context-palette-previous", GTK_STOCK_GO_BACK,
"Previous Palette", NULL, NULL,
GIMP_CONTEXT_SELECT_PREVIOUS,
GIMP_ACTION_SELECT_PREVIOUS,
NULL },
{ "context-palette-next", GTK_STOCK_GO_FORWARD,
"Next Palette", NULL, NULL,
GIMP_CONTEXT_SELECT_NEXT,
GIMP_ACTION_SELECT_NEXT,
NULL }
};
@ -371,19 +371,19 @@ static GimpEnumActionEntry context_gradient_select_actions[] =
{
{ "context-gradient-first", GTK_STOCK_GOTO_FIRST,
"First Gradient", NULL, NULL,
GIMP_CONTEXT_SELECT_FIRST,
GIMP_ACTION_SELECT_FIRST,
NULL },
{ "context-gradient-last", GTK_STOCK_GOTO_LAST,
"Last Gradient", NULL, NULL,
GIMP_CONTEXT_SELECT_LAST,
GIMP_ACTION_SELECT_LAST,
NULL },
{ "context-gradient-previous", GTK_STOCK_GO_BACK,
"Previous Gradient", NULL, NULL,
GIMP_CONTEXT_SELECT_PREVIOUS,
GIMP_ACTION_SELECT_PREVIOUS,
NULL },
{ "context-gradient-next", GTK_STOCK_GO_FORWARD,
"Next Gradient", NULL, NULL,
GIMP_CONTEXT_SELECT_NEXT,
GIMP_ACTION_SELECT_NEXT,
NULL }
};
@ -391,19 +391,19 @@ static GimpEnumActionEntry context_font_select_actions[] =
{
{ "context-font-first", GTK_STOCK_GOTO_FIRST,
"First Font", NULL, NULL,
GIMP_CONTEXT_SELECT_FIRST,
GIMP_ACTION_SELECT_FIRST,
NULL },
{ "context-font-last", GTK_STOCK_GOTO_LAST,
"Last Font", NULL, NULL,
GIMP_CONTEXT_SELECT_LAST,
GIMP_ACTION_SELECT_LAST,
NULL },
{ "context-font-previous", GTK_STOCK_GO_BACK,
"Previous Font", NULL, NULL,
GIMP_CONTEXT_SELECT_PREVIOUS,
GIMP_ACTION_SELECT_PREVIOUS,
NULL },
{ "context-font-next", GTK_STOCK_GO_FORWARD,
"Next Font", NULL, NULL,
GIMP_CONTEXT_SELECT_NEXT,
GIMP_ACTION_SELECT_NEXT,
NULL }
};
@ -411,27 +411,27 @@ static GimpEnumActionEntry context_brush_radius_actions[] =
{
{ "context-brush-radius-minimum", GTK_STOCK_GOTO_FIRST,
"Minumum Radius", NULL, NULL,
GIMP_CONTEXT_SELECT_FIRST,
GIMP_ACTION_SELECT_FIRST,
NULL },
{ "context-brush-radius-maximum", GTK_STOCK_GOTO_LAST,
"Maximum Radius", NULL, NULL,
GIMP_CONTEXT_SELECT_LAST,
GIMP_ACTION_SELECT_LAST,
NULL },
{ "context-brush-radius-decrease", GTK_STOCK_GO_BACK,
"Decrease Radius", NULL, NULL,
GIMP_CONTEXT_SELECT_PREVIOUS,
GIMP_ACTION_SELECT_PREVIOUS,
NULL },
{ "context-brush-radius-increase", GTK_STOCK_GO_FORWARD,
"Increase Radius", NULL, NULL,
GIMP_CONTEXT_SELECT_NEXT,
GIMP_ACTION_SELECT_NEXT,
NULL },
{ "context-brush-radius-decrease-skip", GTK_STOCK_GO_BACK,
"Decrease Radius More", NULL, NULL,
GIMP_CONTEXT_SELECT_SKIP_PREVIOUS,
GIMP_ACTION_SELECT_SKIP_PREVIOUS,
NULL },
{ "context-brush-radius-increase-skip", GTK_STOCK_GO_FORWARD,
"Increase Radius More", NULL, NULL,
GIMP_CONTEXT_SELECT_SKIP_NEXT,
GIMP_ACTION_SELECT_SKIP_NEXT,
NULL },
};
@ -439,27 +439,27 @@ static GimpEnumActionEntry context_brush_hardness_actions[] =
{
{ "context-brush-hardness-minimum", GTK_STOCK_GOTO_FIRST,
"Minumum Hardness", NULL, NULL,
GIMP_CONTEXT_SELECT_FIRST,
GIMP_ACTION_SELECT_FIRST,
NULL },
{ "context-brush-hardness-maximum", GTK_STOCK_GOTO_LAST,
"Maximum Hardness", NULL, NULL,
GIMP_CONTEXT_SELECT_LAST,
GIMP_ACTION_SELECT_LAST,
NULL },
{ "context-brush-hardness-decrease", GTK_STOCK_GO_BACK,
"Decrease Hardness", NULL, NULL,
GIMP_CONTEXT_SELECT_PREVIOUS,
GIMP_ACTION_SELECT_PREVIOUS,
NULL },
{ "context-brush-hardness-increase", GTK_STOCK_GO_FORWARD,
"Increase Hardness", NULL, NULL,
GIMP_CONTEXT_SELECT_NEXT,
GIMP_ACTION_SELECT_NEXT,
NULL },
{ "context-brush-hardness-decrease-skip", GTK_STOCK_GO_BACK,
"Decrease Hardness More", NULL, NULL,
GIMP_CONTEXT_SELECT_SKIP_PREVIOUS,
GIMP_ACTION_SELECT_SKIP_PREVIOUS,
NULL },
{ "context-brush-hardness-increase-skip", GTK_STOCK_GO_FORWARD,
"Increase Hardness More", NULL, NULL,
GIMP_CONTEXT_SELECT_SKIP_NEXT,
GIMP_ACTION_SELECT_SKIP_NEXT,
NULL },
};
@ -467,27 +467,27 @@ static GimpEnumActionEntry context_brush_aspect_actions[] =
{
{ "context-brush-aspect-minimum", GTK_STOCK_GOTO_FIRST,
"Minumum Aspect", NULL, NULL,
GIMP_CONTEXT_SELECT_FIRST,
GIMP_ACTION_SELECT_FIRST,
NULL },
{ "context-brush-aspect-maximum", GTK_STOCK_GOTO_LAST,
"Maximum Aspect", NULL, NULL,
GIMP_CONTEXT_SELECT_LAST,
GIMP_ACTION_SELECT_LAST,
NULL },
{ "context-brush-aspect-decrease", GTK_STOCK_GO_BACK,
"Decrease Aspect", NULL, NULL,
GIMP_CONTEXT_SELECT_PREVIOUS,
GIMP_ACTION_SELECT_PREVIOUS,
NULL },
{ "context-brush-aspect-increase", GTK_STOCK_GO_FORWARD,
"Increase Aspect", NULL, NULL,
GIMP_CONTEXT_SELECT_NEXT,
GIMP_ACTION_SELECT_NEXT,
NULL },
{ "context-brush-aspect-decrease-skip", GTK_STOCK_GO_BACK,
"Decrease Aspect More", NULL, NULL,
GIMP_CONTEXT_SELECT_SKIP_PREVIOUS,
GIMP_ACTION_SELECT_SKIP_PREVIOUS,
NULL },
{ "context-brush-aspect-increase-skip", GTK_STOCK_GO_FORWARD,
"Increase Aspect More", NULL, NULL,
GIMP_CONTEXT_SELECT_SKIP_NEXT,
GIMP_ACTION_SELECT_SKIP_NEXT,
NULL },
};
@ -495,27 +495,27 @@ static GimpEnumActionEntry context_brush_angle_actions[] =
{
{ "context-brush-angle-minimum", GIMP_STOCK_FLIP_HORIZONTAL,
"Horizontal", NULL, NULL,
GIMP_CONTEXT_SELECT_FIRST,
GIMP_ACTION_SELECT_FIRST,
NULL },
{ "context-brush-angle-maximum", GIMP_STOCK_FLIP_VERTICAL,
"Vertical", NULL, NULL,
GIMP_CONTEXT_SELECT_LAST,
GIMP_ACTION_SELECT_LAST,
NULL },
{ "context-brush-angle-decrease", GIMP_STOCK_ROTATE_90,
"Rotate Right", NULL, NULL,
GIMP_CONTEXT_SELECT_PREVIOUS,
GIMP_ACTION_SELECT_PREVIOUS,
NULL },
{ "context-brush-angle-increase", GIMP_STOCK_ROTATE_270,
"Rotate Left", NULL, NULL,
GIMP_CONTEXT_SELECT_NEXT,
GIMP_ACTION_SELECT_NEXT,
NULL },
{ "context-brush-angle-decrease-skip", GIMP_STOCK_ROTATE_90,
"Rotate Right 15 degrees", NULL, NULL,
GIMP_CONTEXT_SELECT_SKIP_PREVIOUS,
GIMP_ACTION_SELECT_SKIP_PREVIOUS,
NULL },
{ "context-brush-angle-increase-skip", GIMP_STOCK_ROTATE_270,
"Rotate Left 15 degrees", NULL, NULL,
GIMP_CONTEXT_SELECT_SKIP_NEXT,
GIMP_ACTION_SELECT_SKIP_NEXT,
NULL },
};

View File

@ -38,16 +38,9 @@
/* 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);
static void context_select_object (GimpActionSelectType select_type,
GimpContext *context,
GimpContainer *container);
/* public functions */
@ -82,10 +75,10 @@ context_foreground_red_cmd_callback (GtkAction *action,
return_if_no_context (context, data);
gimp_context_get_foreground (context, &color);
color.r = context_select_value ((GimpContextSelectType) value,
color.r,
0.0, 1.0,
0.01, 0.1, FALSE);
color.r = action_select_value ((GimpActionSelectType) value,
color.r,
0.0, 1.0,
0.01, 0.1, FALSE);
gimp_context_set_foreground (context, &color);
}
@ -99,10 +92,10 @@ context_foreground_green_cmd_callback (GtkAction *action,
return_if_no_context (context, data);
gimp_context_get_foreground (context, &color);
color.g = context_select_value ((GimpContextSelectType) value,
color.g,
0.0, 1.0,
0.01, 0.1, FALSE);
color.g = action_select_value ((GimpActionSelectType) value,
color.g,
0.0, 1.0,
0.01, 0.1, FALSE);
gimp_context_set_foreground (context, &color);
}
@ -116,10 +109,10 @@ context_foreground_blue_cmd_callback (GtkAction *action,
return_if_no_context (context, data);
gimp_context_get_foreground (context, &color);
color.b = context_select_value ((GimpContextSelectType) value,
color.b,
0.0, 1.0,
0.01, 0.1, FALSE);
color.b = action_select_value ((GimpActionSelectType) value,
color.b,
0.0, 1.0,
0.01, 0.1, FALSE);
gimp_context_set_foreground (context, &color);
}
@ -133,10 +126,10 @@ context_background_red_cmd_callback (GtkAction *action,
return_if_no_context (context, data);
gimp_context_get_background (context, &color);
color.r = context_select_value ((GimpContextSelectType) value,
color.r,
0.0, 1.0,
0.01, 0.1, FALSE);
color.r = action_select_value ((GimpActionSelectType) value,
color.r,
0.0, 1.0,
0.01, 0.1, FALSE);
gimp_context_set_background (context, &color);
}
@ -150,10 +143,10 @@ context_background_green_cmd_callback (GtkAction *action,
return_if_no_context (context, data);
gimp_context_get_background (context, &color);
color.g = context_select_value ((GimpContextSelectType) value,
color.g,
0.0, 1.0,
0.01, 0.1, FALSE);
color.g = action_select_value ((GimpActionSelectType) value,
color.g,
0.0, 1.0,
0.01, 0.1, FALSE);
gimp_context_set_background (context, &color);
}
@ -167,10 +160,10 @@ context_background_blue_cmd_callback (GtkAction *action,
return_if_no_context (context, data);
gimp_context_get_background (context, &color);
color.b = context_select_value ((GimpContextSelectType) value,
color.b,
0.0, 1.0,
0.01, 0.1, FALSE);
color.b = action_select_value ((GimpActionSelectType) value,
color.b,
0.0, 1.0,
0.01, 0.1, FALSE);
gimp_context_set_background (context, &color);
}
@ -183,11 +176,11 @@ context_opacity_cmd_callback (GtkAction *action,
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);
opacity = action_select_value ((GimpActionSelectType) value,
gimp_context_get_opacity (context),
GIMP_OPACITY_TRANSPARENT,
GIMP_OPACITY_OPAQUE,
0.01, 0.1, FALSE);
gimp_context_set_opacity (context, opacity);
}
@ -199,8 +192,8 @@ context_tool_select_cmd_callback (GtkAction *action,
GimpContext *context;
return_if_no_context (context, data);
context_select_object (context, context->gimp->tool_info_list,
(GimpContextSelectType) value);
context_select_object ((GimpActionSelectType) value,
context, context->gimp->tool_info_list);
}
void
@ -211,8 +204,8 @@ context_brush_select_cmd_callback (GtkAction *action,
GimpContext *context;
return_if_no_context (context, data);
context_select_object (context, context->gimp->brush_factory->container,
(GimpContextSelectType) value);
context_select_object ((GimpActionSelectType) value,
context, context->gimp->brush_factory->container);
}
void
@ -223,8 +216,8 @@ context_pattern_select_cmd_callback (GtkAction *action,
GimpContext *context;
return_if_no_context (context, data);
context_select_object (context, context->gimp->pattern_factory->container,
(GimpContextSelectType) value);
context_select_object ((GimpActionSelectType) value,
context, context->gimp->pattern_factory->container);
}
void
@ -235,8 +228,8 @@ context_palette_select_cmd_callback (GtkAction *action,
GimpContext *context;
return_if_no_context (context, data);
context_select_object (context, context->gimp->palette_factory->container,
(GimpContextSelectType) value);
context_select_object ((GimpActionSelectType) value,
context, context->gimp->palette_factory->container);
}
void
@ -247,8 +240,8 @@ context_gradient_select_cmd_callback (GtkAction *action,
GimpContext *context;
return_if_no_context (context, data);
context_select_object (context, context->gimp->gradient_factory->container,
(GimpContextSelectType) value);
context_select_object ((GimpActionSelectType) value,
context, context->gimp->gradient_factory->container);
}
void
@ -259,8 +252,8 @@ context_font_select_cmd_callback (GtkAction *action,
GimpContext *context;
return_if_no_context (context, data);
context_select_object (context, context->gimp->fonts,
(GimpContextSelectType) value);
context_select_object ((GimpActionSelectType) value,
context, context->gimp->fonts);
}
void
@ -281,10 +274,10 @@ context_brush_radius_cmd_callback (GtkAction *action,
radius = gimp_brush_generated_get_radius (generated);
radius = context_select_value ((GimpContextSelectType) value,
radius,
1.0, 4096.0,
1.0, 10.0, FALSE);
radius = action_select_value ((GimpActionSelectType) value,
radius,
1.0, 4096.0,
1.0, 10.0, FALSE);
gimp_brush_generated_set_radius (generated, radius);
}
}
@ -307,10 +300,10 @@ context_brush_hardness_cmd_callback (GtkAction *action,
hardness = gimp_brush_generated_get_hardness (generated);
hardness = context_select_value ((GimpContextSelectType) value,
hardness,
0.0, 1.0,
0.01, 0.1, FALSE);
hardness = action_select_value ((GimpActionSelectType) value,
hardness,
0.0, 1.0,
0.01, 0.1, FALSE);
gimp_brush_generated_set_hardness (generated, hardness);
}
}
@ -333,10 +326,10 @@ context_brush_aspect_cmd_callback (GtkAction *action,
aspect = gimp_brush_generated_get_aspect_ratio (generated);
aspect = context_select_value ((GimpContextSelectType) value,
aspect,
1.0, 1000.0,
1.0, 4.0, FALSE);
aspect = action_select_value ((GimpActionSelectType) value,
aspect,
1.0, 1000.0,
1.0, 4.0, FALSE);
gimp_brush_generated_set_aspect_ratio (generated, aspect);
}
}
@ -359,15 +352,15 @@ context_brush_angle_cmd_callback (GtkAction *action,
angle = gimp_brush_generated_get_angle (generated);
if (value == GIMP_CONTEXT_SELECT_FIRST)
if (value == GIMP_ACTION_SELECT_FIRST)
angle = 0.0;
else if (value == GIMP_CONTEXT_SELECT_LAST)
else if (value == GIMP_ACTION_SELECT_LAST)
angle = 90.0;
else
angle = context_select_value ((GimpContextSelectType) value,
angle,
0.0, 180.0,
1.0, 15.0, TRUE);
angle = action_select_value ((GimpActionSelectType) value,
angle,
0.0, 180.0,
1.0, 15.0, TRUE);
gimp_brush_generated_set_angle (generated, angle);
}
@ -377,118 +370,16 @@ context_brush_angle_cmd_callback (GtkAction *action,
/* private functions */
static void
context_select_object (GimpContext *context,
GimpContainer *container,
GimpContextSelectType select_type)
context_select_object (GimpActionSelectType select_type,
GimpContext *context,
GimpContainer *container)
{
GimpObject *current;
gint select_index;
gint n_children;
current = gimp_context_get_by_type (context, container->children_type);
if (! current)
return;
n_children = gimp_container_num_children (container);
if (n_children == 0)
return;
switch (select_type)
{
case GIMP_CONTEXT_SELECT_FIRST:
select_index = 0;
break;
case GIMP_CONTEXT_SELECT_LAST:
select_index = n_children - 1;
break;
case GIMP_CONTEXT_SELECT_PREVIOUS:
select_index = gimp_container_get_child_index (container, current) - 1;
break;
case GIMP_CONTEXT_SELECT_NEXT:
select_index = gimp_container_get_child_index (container, current) + 1;
break;
case GIMP_CONTEXT_SELECT_SKIP_PREVIOUS:
select_index = gimp_container_get_child_index (container, current) - 10;
break;
case GIMP_CONTEXT_SELECT_SKIP_NEXT:
select_index = gimp_container_get_child_index (container, current) + 10;
break;
default:
g_return_if_reached ();
break;
}
select_index = CLAMP (select_index, 0, n_children - 1);
current = gimp_container_get_child_by_index (container, select_index);
current = action_select_object (select_type, container, current);
if (current)
gimp_context_set_by_type (context, container->children_type, current);
}
static gdouble
context_select_value (GimpContextSelectType select_type,
gdouble value,
gdouble min,
gdouble max,
gdouble inc,
gdouble skip_inc,
gboolean wrap)
{
switch (select_type)
{
case GIMP_CONTEXT_SELECT_FIRST:
value = min;
break;
case GIMP_CONTEXT_SELECT_LAST:
value = max;
break;
case GIMP_CONTEXT_SELECT_PREVIOUS:
value -= inc;
break;
case GIMP_CONTEXT_SELECT_NEXT:
value += inc;
break;
case GIMP_CONTEXT_SELECT_SKIP_PREVIOUS:
value -= skip_inc;
break;
case GIMP_CONTEXT_SELECT_SKIP_NEXT:
value += skip_inc;
break;
default:
if (value >= 0)
value = (gdouble) select_type * (max - min) / 1000.0 + min;
else
g_return_val_if_reached (FALSE);
break;
}
if (wrap)
{
while (value < min)
value = max - (min - value);
while (value > max)
value = min + (max - value);
}
else
{
value = CLAMP (value, min, max);
}
return value;
}

View File

@ -20,18 +20,6 @@
#define __CONTEXT_COMMANDS_H__
typedef enum
{
GIMP_CONTEXT_SELECT_SET = 0,
GIMP_CONTEXT_SELECT_FIRST = -1,
GIMP_CONTEXT_SELECT_LAST = -2,
GIMP_CONTEXT_SELECT_PREVIOUS = -3,
GIMP_CONTEXT_SELECT_NEXT = -4,
GIMP_CONTEXT_SELECT_SKIP_PREVIOUS = -5,
GIMP_CONTEXT_SELECT_SKIP_NEXT = -6
} GimpContextSelectType;
void context_colors_default_cmd_callback (GtkAction *action,
gpointer data);
void context_colors_swap_cmd_callback (GtkAction *action,

View File

@ -79,26 +79,6 @@ static GimpActionEntry layers_actions[] =
G_CALLBACK (layers_delete_cmd_callback),
GIMP_HELP_LAYER_DELETE },
{ "layers-select-previous", NULL,
N_("Select _Previous Layer"), "Prior", NULL,
G_CALLBACK (layers_select_previous_cmd_callback),
GIMP_HELP_LAYER_PREVIOUS },
{ "layers-select-top", NULL,
N_("Select _Top Layer"), "Home", NULL,
G_CALLBACK (layers_select_top_cmd_callback),
GIMP_HELP_LAYER_TOP },
{ "layers-select-next", NULL,
N_("Select _Next Layer"), "Next", NULL,
G_CALLBACK (layers_select_next_cmd_callback),
GIMP_HELP_LAYER_NEXT },
{ "layers-select-bottom", NULL,
N_("Select _Bottom Layer"), "End", NULL,
G_CALLBACK (layers_select_bottom_cmd_callback),
GIMP_HELP_LAYER_BOTTOM },
{ "layers-raise", GTK_STOCK_GO_UP,
N_("_Raise Layer"), "", NULL,
G_CALLBACK (layers_raise_cmd_callback),
@ -235,6 +215,62 @@ static GimpEnumActionEntry layers_alpha_to_selection_actions[] =
GIMP_HELP_LAYER_ALPHA_SELECTION_INTERSECT }
};
static GimpEnumActionEntry layers_select_actions[] =
{
{ "layers-select-top", NULL,
N_("Select _Top Layer"), "Home", NULL,
GIMP_ACTION_SELECT_FIRST,
GIMP_HELP_LAYER_TOP },
{ "layers-select-bottom", NULL,
N_("Select _Bottom Layer"), "End", NULL,
GIMP_ACTION_SELECT_LAST,
GIMP_HELP_LAYER_BOTTOM },
{ "layers-select-previous", NULL,
N_("Select _Previous Layer"), "Prior", NULL,
GIMP_ACTION_SELECT_PREVIOUS,
GIMP_HELP_LAYER_PREVIOUS },
{ "layers-select-next", NULL,
N_("Select _Next Layer"), "Next", NULL,
GIMP_ACTION_SELECT_NEXT,
GIMP_HELP_LAYER_NEXT }
};
static GimpEnumActionEntry layers_opacity_actions[] =
{
{ "layers-opacity-set", GIMP_STOCK_TRANSPARENCY,
N_("Set Opacity"), NULL, NULL,
GIMP_ACTION_SELECT_SET,
NULL },
{ "layers-opacity-transparent", GTK_STOCK_GOTO_FIRST,
"Completely Transparent", NULL, NULL,
GIMP_ACTION_SELECT_FIRST,
NULL },
{ "layers-opacity-opaque", GTK_STOCK_GOTO_LAST,
"Completely Opaque", NULL, NULL,
GIMP_ACTION_SELECT_LAST,
NULL },
{ "layers-opacity-decrease", GTK_STOCK_REMOVE,
"More Transparent", NULL, NULL,
GIMP_ACTION_SELECT_PREVIOUS,
NULL },
{ "layers-opacity-increase", GTK_STOCK_ADD,
"More Opaque", NULL, NULL,
GIMP_ACTION_SELECT_NEXT,
NULL },
{ "layers-opacity-decrease-skip", GTK_STOCK_REMOVE,
"10% More Transparent", NULL, NULL,
GIMP_ACTION_SELECT_SKIP_PREVIOUS,
NULL },
{ "layers-opacity-increase-skip", GTK_STOCK_ADD,
"10% More Opaque", NULL, NULL,
GIMP_ACTION_SELECT_SKIP_NEXT,
NULL }
};
void
layers_actions_setup (GimpActionGroup *group)
{
@ -256,6 +292,15 @@ layers_actions_setup (GimpActionGroup *group)
layers_alpha_to_selection_actions,
G_N_ELEMENTS (layers_alpha_to_selection_actions),
G_CALLBACK (layers_alpha_to_selection_cmd_callback));
gimp_action_group_add_enum_actions (group,
layers_select_actions,
G_N_ELEMENTS (layers_select_actions),
G_CALLBACK (layers_select_cmd_callback));
gimp_action_group_add_enum_actions (group,
layers_opacity_actions,
G_N_ELEMENTS (layers_opacity_actions),
G_CALLBACK (layers_opacity_cmd_callback));
}
void
@ -321,14 +366,14 @@ layers_actions_update (GimpActionGroup *group,
SET_VISIBLE ("layers-text-tool", text_layer && !ac);
SET_SENSITIVE ("layers-edit-attributes", layer && !fs && !ac);
SET_SENSITIVE ("layers-new", gimage);
SET_SENSITIVE ("layers-new", gimage);
SET_SENSITIVE ("layers-duplicate", layer && !fs && !ac);
SET_SENSITIVE ("layers-delete", layer && !ac);
SET_SENSITIVE ("layers-select-previous", layer && !fs && !ac && prev);
SET_SENSITIVE ("layers-select-top", layer && !fs && !ac && prev);
SET_SENSITIVE ("layers-select-next", layer && !fs && !ac && next);
SET_SENSITIVE ("layers-select-bottom", layer && !fs && !ac && next);
SET_SENSITIVE ("layers-select-previous", layer && !fs && !ac && prev);
SET_SENSITIVE ("layers-select-next", layer && !fs && !ac && next);
SET_SENSITIVE ("layers-raise", layer && !fs && !ac && alpha && prev);
SET_SENSITIVE ("layers-raise-to-top", layer && !fs && !ac && alpha && prev);

View File

@ -34,11 +34,13 @@
#include "core/gimpimage.h"
#include "core/gimpimage-merge.h"
#include "core/gimpimage-undo.h"
#include "core/gimpitemundo.h"
#include "core/gimplayer.h"
#include "core/gimplayer-floating-sel.h"
#include "core/gimplayermask.h"
#include "core/gimplist.h"
#include "core/gimptoolinfo.h"
#include "core/gimpundostack.h"
#include "text/gimptext.h"
#include "text/gimptextlayer.h"
@ -124,95 +126,28 @@ layers_new_cmd_callback (GtkAction *action,
}
void
layers_select_previous_cmd_callback (GtkAction *action,
gpointer data)
layers_select_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpImage *gimage;
GimpLayer *layer;
GimpLayer *new_layer;
gint current_layer;
return_if_no_image (gimage, data);
current_layer =
gimp_image_get_layer_index (gimage, gimp_image_get_active_layer (gimage));
layer = gimp_image_get_active_layer (gimage);
if (current_layer > 0)
{
new_layer = (GimpLayer *)
gimp_container_get_child_by_index (gimage->layers, current_layer - 1);
new_layer = (GimpLayer *) action_select_object ((GimpActionSelectType) value,
gimage->layers,
(GimpObject *) layer);
if (new_layer)
{
gimp_image_set_active_layer (gimage, new_layer);
gimp_image_flush (gimage);
}
}
}
void
layers_select_next_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *gimage;
GimpLayer *new_layer;
gint current_layer;
return_if_no_image (gimage, data);
current_layer =
gimp_image_get_layer_index (gimage, gimp_image_get_active_layer (gimage));
new_layer =
GIMP_LAYER (gimp_container_get_child_by_index (gimage->layers,
current_layer + 1));
if (new_layer)
if (new_layer && new_layer != layer)
{
gimp_image_set_active_layer (gimage, new_layer);
gimp_image_flush (gimage);
}
}
void
layers_select_top_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *gimage;
GimpLayer *new_layer;
return_if_no_image (gimage, data);
new_layer = (GimpLayer *)
gimp_container_get_child_by_index (gimage->layers, 0);
if (new_layer)
{
gimp_image_set_active_layer (gimage, new_layer);
gimp_image_flush (gimage);
}
}
void
layers_select_bottom_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *gimage;
GimpLayer *new_layer;
gint num_layers;
return_if_no_image (gimage, data);
num_layers = gimp_container_num_children (gimage->layers);
if (num_layers > 0)
{
new_layer = (GimpLayer *)
gimp_container_get_child_by_index (gimage->layers, num_layers - 1);
if (new_layer)
{
gimp_image_set_active_layer (gimage, new_layer);
gimp_image_flush (gimage);
}
}
}
void
layers_raise_cmd_callback (GtkAction *action,
gpointer data)
@ -504,6 +439,38 @@ layers_alpha_to_selection_cmd_callback (GtkAction *action,
gimp_image_flush (gimage);
}
void
layers_opacity_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpImage *gimage;
GimpLayer *layer;
gdouble opacity;
gboolean push_undo = TRUE;
return_if_no_layer (gimage, layer, data);
if (! gimp_undo_stack_peek (gimage->redo_stack))
{
GimpUndo *undo = gimp_undo_stack_peek (gimage->undo_stack);
if (GIMP_IS_ITEM_UNDO (undo) &&
undo->undo_type == GIMP_UNDO_LAYER_OPACITY &&
GIMP_ITEM_UNDO (undo)->item == GIMP_ITEM (layer))
{
push_undo = FALSE;
}
}
opacity = gimp_layer_get_opacity (layer);
opacity = action_select_value ((GimpActionSelectType) value,
opacity,
0.0, 1.0,
0.01, 0.1, FALSE);
gimp_layer_set_opacity (layer, opacity, push_undo);
gimp_image_flush (gimage);
}
void
layers_text_tool (GimpLayer *layer,
GimpContext *context,

View File

@ -27,14 +27,9 @@ void layers_edit_attributes_cmd_callback (GtkAction *action,
void layers_new_cmd_callback (GtkAction *action,
gpointer data);
void layers_select_previous_cmd_callback (GtkAction *action,
gpointer data);
void layers_select_next_cmd_callback (GtkAction *action,
gpointer data);
void layers_select_top_cmd_callback (GtkAction *action,
gpointer data);
void layers_select_bottom_cmd_callback (GtkAction *action,
gpointer data);
void layers_select_cmd_callback (GtkAction *action,
gint value,
gpointer data);
void layers_raise_cmd_callback (GtkAction *action,
gpointer data);
@ -80,6 +75,10 @@ void layers_alpha_to_selection_cmd_callback (GtkAction *action,
gint value,
gpointer data);
void layers_opacity_cmd_callback (GtkAction *action,
gint value,
gpointer data);
void layers_text_tool (GimpLayer *layer,
GimpContext *context,
GtkWidget *parent);

View File

@ -1878,6 +1878,10 @@ prefs_dialog_new (Gimp *gimp,
gtk_label_new (info->controller->name),
1, TRUE);
prefs_check_button_add (G_OBJECT (info), "enabled",
_("Enable this Controller"),
GTK_BOX (vbox3));
store = gtk_list_store_new (NUM_COLUMNS,
G_TYPE_STRING, G_TYPE_STRING);
tv = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));

View File

@ -21,6 +21,7 @@
#include "tools/tools-types.h"
#include "menus/menus-types.h"
typedef struct _ColorNotebook ColorNotebook;

View File

@ -1878,6 +1878,10 @@ prefs_dialog_new (Gimp *gimp,
gtk_label_new (info->controller->name),
1, TRUE);
prefs_check_button_add (G_OBJECT (info), "enabled",
_("Enable this Controller"),
GTK_BOX (vbox3));
store = gtk_list_store_new (NUM_COLUMNS,
G_TYPE_STRING, G_TYPE_STRING);
tv = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));

View File

@ -20,7 +20,7 @@
#define __MENUS_TYPES_H__
#include "gui/gui-types.h"
#include "actions/actions-types.h"
#endif /* __MENUS_TYPES_H__ */