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

@ -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,