Merge branch 'master' into soc-2010-cage-2

This commit is contained in:
Alexia Death 2010-08-26 21:50:55 +03:00
commit aee148a486
689 changed files with 40621 additions and 72286 deletions

View File

@ -283,12 +283,12 @@ gimp-console.rc.o: gimp.rc
gimp.rc gimp-console.rc.o
# If git is available, always check if git-version.h should be
# updated. If git is not avaialbe, don't do anything if git-version.h
# updated. If git is not available, don't do anything if git-version.h
# already exists because then we are probably working with a tarball
# in which case the git-version.h we ship is correct.
git-version.h: update-git-version-header
@if test -d "$(top_srcdir)/.git"; then \
echo "#define GIMP_GIT_VERSION \"`git log HEAD^..HEAD --pretty=format:%H`\"" > "$@.tmp"; \
echo "#define GIMP_GIT_VERSION \"`git log -n1 --reverse --pretty=%H`\"" > "$@.tmp"; \
elif test ! -f "$@"; then \
echo "#define GIMP_GIT_VERSION \"Unknown, shouldn't happen\"" > "$@.tmp"; \
fi
@ -296,7 +296,7 @@ git-version.h: update-git-version-header
rm -f "$@.tmp"; \
elif test -f "$@.tmp"; then \
mv "$@.tmp" "$@"; \
echo " git HEAD changed: git-version.h regenerated"; \
echo " git HEAD changed: $@ regenerated"; \
fi
.PHONY: update-git-version-header

View File

@ -26,7 +26,7 @@
_("GNU Image Manipulation Program")
#define GIMP_COPYRIGHT \
_("Copyright © 1995-2009\n" \
_("Copyright © 1995-2010\n" \
"Spencer Kimball, Peter Mattis and the GIMP Development Team")
#define GIMP_LICENSE \

View File

@ -547,6 +547,7 @@ action_select_property (GimpActionSelectType select_type,
gdouble small_inc,
gdouble inc,
gdouble skip_inc,
gdouble delta_factor,
gboolean wrap)
{
GParamSpec *pspec;
@ -569,7 +570,7 @@ action_select_property (GimpActionSelectType select_type,
G_PARAM_SPEC_DOUBLE (pspec)->minimum,
G_PARAM_SPEC_DOUBLE (pspec)->maximum,
G_PARAM_SPEC_DOUBLE (pspec)->default_value,
small_inc, inc, skip_inc, 0, wrap);
small_inc, inc, skip_inc, delta_factor, wrap);
g_object_set (object, property_name, value, NULL);
@ -595,7 +596,7 @@ action_select_property (GimpActionSelectType select_type,
G_PARAM_SPEC_INT (pspec)->minimum,
G_PARAM_SPEC_INT (pspec)->maximum,
G_PARAM_SPEC_INT (pspec)->default_value,
small_inc, inc, skip_inc, 0, wrap);
small_inc, inc, skip_inc, delta_factor, wrap);
g_object_set (object, property_name, value, NULL);

View File

@ -50,6 +50,7 @@ void action_select_property (GimpActionSelectType select_type,
gdouble small_inc,
gdouble inc,
gdouble skip_inc,
gdouble delta_factor,
gboolean wrap);
GimpObject * action_select_object (GimpActionSelectType select_type,
GimpContainer *container,

View File

@ -181,7 +181,7 @@ channels_raise_cmd_callback (GtkAction *action,
GimpChannel *channel;
return_if_no_channel (image, channel, data);
gimp_image_raise_channel (image, channel, NULL);
gimp_image_raise_item (image, GIMP_ITEM (channel), NULL);
gimp_image_flush (image);
}
@ -193,7 +193,7 @@ channels_raise_to_top_cmd_callback (GtkAction *action,
GimpChannel *channel;
return_if_no_channel (image, channel, data);
gimp_image_raise_channel_to_top (image, channel);
gimp_image_raise_item_to_top (image, GIMP_ITEM (channel));
gimp_image_flush (image);
}
@ -205,7 +205,7 @@ channels_lower_cmd_callback (GtkAction *action,
GimpChannel *channel;
return_if_no_channel (image, channel, data);
gimp_image_lower_channel (image, channel, NULL);
gimp_image_lower_item (image, GIMP_ITEM (channel), NULL);
gimp_image_flush (image);
}
@ -217,7 +217,7 @@ channels_lower_to_bottom_cmd_callback (GtkAction *action,
GimpChannel *channel;
return_if_no_channel (image, channel, data);
gimp_image_lower_channel_to_bottom (image, channel);
gimp_image_lower_item_to_bottom (image, GIMP_ITEM (channel));
gimp_image_flush (image);
}
@ -311,10 +311,8 @@ channels_to_selection_cmd_callback (GtkAction *action,
GimpChannel *channel;
return_if_no_channel (image, channel, data);
gimp_channel_select_channel (gimp_image_get_mask (image),
_("Channel to Selection"),
channel, 0, 0,
op, FALSE, 0.0, 0.0);
gimp_item_to_selection (GIMP_ITEM (channel),
op, TRUE, FALSE, 0.0, 0.0);
}
gimp_image_flush (image);

View File

@ -385,7 +385,7 @@ context_opacity_cmd_callback (GtkAction *action,
action_data_get_display (data),
G_OBJECT (tool_info->tool_options),
"opacity",
1.0 / 255.0, 0.01, 0.1, FALSE);
1.0 / 255.0, 0.01, 0.1, 0.1, FALSE);
}
}
@ -517,7 +517,7 @@ context_brush_spacing_cmd_callback (GtkAction *action,
action_data_get_display (data),
G_OBJECT (brush),
"spacing",
1.0, 5.0, 20.0, FALSE);
1.0, 5.0, 20.0, 0.1, FALSE);
}
}
@ -632,7 +632,7 @@ context_brush_spikes_cmd_callback (GtkAction *action,
action_data_get_display (data),
G_OBJECT (brush),
"spikes",
0.0, 1.0, 4.0, FALSE);
0.0, 1.0, 4.0, 0.1, FALSE);
}
}
@ -654,7 +654,7 @@ context_brush_hardness_cmd_callback (GtkAction *action,
action_data_get_display (data),
G_OBJECT (brush),
"hardness",
0.001, 0.01, 0.1, FALSE);
0.001, 0.01, 0.1, 0.1, FALSE);
}
}
@ -676,7 +676,7 @@ context_brush_aspect_cmd_callback (GtkAction *action,
action_data_get_display (data),
G_OBJECT (brush),
"aspect-ratio",
0.1, 1.0, 4.0, FALSE);
0.1, 1.0, 4.0, 0.1, FALSE);
}
}
@ -708,7 +708,7 @@ context_brush_angle_cmd_callback (GtkAction *action,
angle = action_select_value ((GimpActionSelectType) value,
angle,
0.0, 180.0, 0.0,
0.1, 1.0, 15.0, 0.0, TRUE);
0.1, 1.0, 15.0, 0.1, TRUE);
gimp_brush_generated_set_angle (generated, angle);

View File

@ -132,7 +132,7 @@ static const GimpEnumActionEntry file_save_actions[] =
{ "file-save-a-copy", NULL,
NC_("file-action", "Save a Cop_y..."), NULL,
NC_("file-action",
"Save this image with a different name, but keep its current name"),
"Save a copy of this image, without affecting the source file (if any) or the current state of the image"),
GIMP_SAVE_MODE_SAVE_A_COPY, FALSE,
GIMP_HELP_FILE_SAVE_A_COPY },

View File

@ -33,6 +33,7 @@
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpactiongroup.h"
#include "widgets/gimpwidgets-utils.h"
#include "actions.h"
#include "image-commands.h"
@ -52,8 +53,6 @@ static const GimpActionEntry layers_actions[] =
NC_("layers-action", "_Layer") },
{ "layers-stack-menu", NULL,
NC_("layers-action", "Stac_k") },
{ "layers-text-to-selection-menu", GIMP_STOCK_TOOL_TEXT,
NC_("layers-action", "Te_xt to Selection") },
{ "layers-mask-menu", NULL,
NC_("layers-action", "_Mask") },
{ "layers-transparency-menu", NULL,
@ -337,36 +336,6 @@ static const GimpEnumActionEntry layers_alpha_to_selection_actions[] =
GIMP_HELP_LAYER_ALPHA_SELECTION_INTERSECT }
};
static const GimpEnumActionEntry layers_text_to_selection_actions[] =
{
{ "layers-text-selection-replace", GIMP_STOCK_SELECTION_REPLACE,
NC_("layers-action", "_Text to Selection"), NULL,
NC_("layers-action", "Replace the selection with the text layer's outline"),
GIMP_CHANNEL_OP_REPLACE, FALSE,
GIMP_HELP_LAYER_TEXT_SELECTION_REPLACE },
{ "layers-text-selection-add", GIMP_STOCK_SELECTION_ADD,
NC_("layers-action", "A_dd to Selection"), NULL,
NC_("layers-action",
"Add the text layer's outline to the current selection"),
GIMP_CHANNEL_OP_ADD, FALSE,
GIMP_HELP_LAYER_TEXT_SELECTION_ADD },
{ "layers-text-selection-subtract", GIMP_STOCK_SELECTION_SUBTRACT,
NC_("layers-action", "_Subtract from Selection"), NULL,
NC_("layers-action",
"Subtract the text layer's outline from the current selection"),
GIMP_CHANNEL_OP_SUBTRACT, FALSE,
GIMP_HELP_LAYER_TEXT_SELECTION_SUBTRACT },
{ "layers-text-selection-intersect", GIMP_STOCK_SELECTION_INTERSECT,
NC_("layers-action", "_Intersect with Selection"), NULL,
NC_("layers-action",
"Intersect the text layer's outline with the current selection"),
GIMP_CHANNEL_OP_INTERSECT, FALSE,
GIMP_HELP_LAYER_TEXT_SELECTION_INTERSECT }
};
static const GimpEnumActionEntry layers_select_actions[] =
{
{ "layers-select-top", NULL,
@ -446,6 +415,41 @@ static const GimpEnumActionEntry layers_mode_actions[] =
GIMP_HELP_LAYER_MODE }
};
/**
* layers_actions_fix_tooltip:
* @group:
* @action:
* @modifiers:
*
* Make layer alpha to selection click-shortcuts discoverable, at
* least in theory.
**/
static void
layers_actions_fix_tooltip (GimpActionGroup *group,
const gchar *action,
GdkModifierType modifiers)
{
const gchar *old_hint;
gchar *new_hint;
old_hint = gimp_action_group_get_action_tooltip (group,
action);
new_hint = g_strconcat (old_hint,
"\n",
/* Will be followed with e.g. "Shift-Click
on thumbnail"
*/
_("Shortcut: "),
gimp_get_mod_string (modifiers),
/* Will be prepended with a modifier key
string, e.g. "Shift"
*/
_("-Click on thumbnail in Layers dockable"),
NULL);
gimp_action_group_set_action_tooltip (group, action, new_hint);
g_free (new_hint);
}
void
layers_actions_setup (GimpActionGroup *group)
@ -472,11 +476,14 @@ 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-action",
layers_text_to_selection_actions,
G_N_ELEMENTS (layers_alpha_to_selection_actions),
G_CALLBACK (layers_alpha_to_selection_cmd_callback));
layers_actions_fix_tooltip (group, "layers-alpha-selection-replace",
GDK_MOD1_MASK);
layers_actions_fix_tooltip (group, "layers-alpha-selection-add",
GDK_SHIFT_MASK | GDK_MOD1_MASK);
layers_actions_fix_tooltip (group, "layers-alpha-selection-subtract",
GDK_CONTROL_MASK | GDK_MOD1_MASK);
layers_actions_fix_tooltip (group, "layers-alpha-selection-intersect",
GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK);
gimp_action_group_add_enum_actions (group, "layers-action",
layers_select_actions,
@ -619,10 +626,6 @@ layers_actions_update (GimpActionGroup *group,
SET_VISIBLE ("layers-text-discard", text_layer && !ac);
SET_VISIBLE ("layers-text-to-vectors", text_layer && !ac);
SET_VISIBLE ("layers-text-along-vectors", text_layer && !ac);
SET_VISIBLE ("layers-text-selection-replace", text_layer && !ac);
SET_VISIBLE ("layers-text-selection-add", text_layer && !ac);
SET_VISIBLE ("layers-text-selection-subtract", text_layer && !ac);
SET_VISIBLE ("layers-text-selection-intersect", text_layer && !ac);
SET_SENSITIVE ("layers-resize", writable && !ac);
SET_SENSITIVE ("layers-resize-to-image", writable && !ac);

View File

@ -31,7 +31,6 @@
#include "config/gimpcoreconfig.h"
#include "core/gimp.h"
#include "core/gimpchannel-select.h"
#include "core/gimpcontext.h"
#include "core/gimpgrouplayer.h"
#include "core/gimpimage.h"
@ -416,7 +415,7 @@ layers_raise_cmd_callback (GtkAction *action,
GimpLayer *layer;
return_if_no_layer (image, layer, data);
gimp_image_raise_layer (image, layer, NULL);
gimp_image_raise_item (image, GIMP_ITEM (layer), NULL);
gimp_image_flush (image);
}
@ -428,7 +427,7 @@ layers_raise_to_top_cmd_callback (GtkAction *action,
GimpLayer *layer;
return_if_no_layer (image, layer, data);
gimp_image_raise_layer_to_top (image, layer);
gimp_image_raise_item_to_top (image, GIMP_ITEM (layer));
gimp_image_flush (image);
}
@ -440,7 +439,7 @@ layers_lower_cmd_callback (GtkAction *action,
GimpLayer *layer;
return_if_no_layer (image, layer, data);
gimp_image_lower_layer (image, layer, NULL);
gimp_image_lower_item (image, GIMP_ITEM (layer), NULL);
gimp_image_flush (image);
}
@ -452,7 +451,7 @@ layers_lower_to_bottom_cmd_callback (GtkAction *action,
GimpLayer *layer;
return_if_no_layer (image, layer, data);
gimp_image_lower_layer_to_bottom (image, layer);
gimp_image_lower_item_to_bottom (image, GIMP_ITEM (layer));
gimp_image_flush (image);
}
@ -821,27 +820,18 @@ layers_mask_to_selection_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpChannelOps op;
GimpImage *image;
GimpLayer *layer;
GimpLayerMask *mask;
GimpImage *image;
GimpLayer *layer;
GimpLayerMask *mask;
return_if_no_layer (image, layer, data);
op = (GimpChannelOps) value;
mask = gimp_layer_get_mask (layer);
if (mask)
{
gint off_x, off_y;
gimp_item_get_offset (GIMP_ITEM (mask), &off_x, &off_y);
gimp_channel_select_channel (gimp_image_get_mask (image),
_("Layer Mask to Selection"),
GIMP_CHANNEL (mask),
off_x, off_y,
op, FALSE, 0.0, 0.0);
gimp_item_to_selection (GIMP_ITEM (mask),
(GimpChannelOps) value,
TRUE, FALSE, 0.0, 0.0);
gimp_image_flush (image);
}
}
@ -881,16 +871,13 @@ layers_alpha_to_selection_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpChannelOps op;
GimpImage *image;
GimpLayer *layer;
GimpImage *image;
GimpLayer *layer;
return_if_no_layer (image, layer, data);
op = (GimpChannelOps) value;
gimp_channel_select_alpha (gimp_image_get_mask (image),
GIMP_DRAWABLE (layer),
op, FALSE, 0.0, 0.0);
gimp_item_to_selection (GIMP_ITEM (layer),
(GimpChannelOps) value,
TRUE, FALSE, 0.0, 0.0);
gimp_image_flush (image);
}

View File

@ -27,7 +27,6 @@
#include "core/gimp.h"
#include "core/gimpchannel.h"
#include "core/gimpchannel-select.h"
#include "core/gimpimage.h"
#include "core/gimpselection.h"
#include "core/gimpstrokeoptions.h"

View File

@ -172,6 +172,15 @@ static const GimpEnumActionEntry tools_paint_brush_angle_actions[] =
"Increase Brush Angle More", NULL, NULL,
GIMP_ACTION_SELECT_SKIP_NEXT, FALSE,
NULL },
{ "tools-paint-brush-scale-decrease-percent", GIMP_STOCK_TOOL_PAINTBRUSH,
"Decrease Brush Scale Relative", NULL, NULL,
GIMP_ACTION_SELECT_PERCENT_PREVIOUS, FALSE,
NULL },
{ "tools-paint-brush-scale-increase-percent", GIMP_STOCK_TOOL_PAINTBRUSH,
"Increase Brush Scale Relative", NULL, NULL,
GIMP_ACTION_SELECT_PERCENT_NEXT, FALSE,
NULL },
};
static const GimpEnumActionEntry tools_paint_brush_aspect_ratio_actions[] =
@ -240,6 +249,14 @@ static const GimpEnumActionEntry tools_ink_blob_size_actions[] =
"Increase Ink Blob Size More", NULL, NULL,
GIMP_ACTION_SELECT_SKIP_NEXT, FALSE,
NULL },
{ "tools-ink-blob-size-decrease-percent", GIMP_STOCK_TOOL_INK,
"Decrease Ink Blob Size Relative", NULL, NULL,
GIMP_ACTION_SELECT_PERCENT_PREVIOUS, FALSE,
NULL },
{ "tools-ink-blob-size-increase-percent", GIMP_STOCK_TOOL_INK,
"Increase Ink Blob Size Relative", NULL, NULL,
GIMP_ACTION_SELECT_PERCENT_NEXT, FALSE,
NULL },
};
static const GimpEnumActionEntry tools_ink_blob_aspect_actions[] =
@ -352,6 +369,16 @@ static const GimpEnumActionEntry tools_foreground_select_brush_size_actions[] =
"Increase Foreground Select Brush Size More", NULL, NULL,
GIMP_ACTION_SELECT_SKIP_NEXT, FALSE,
NULL },
{ "tools-foreground-select-brush-size-decrease-percent",
GIMP_STOCK_TOOL_FOREGROUND_SELECT,
"Decrease Foreground Select Brush Size Relative", NULL, NULL,
GIMP_ACTION_SELECT_PERCENT_PREVIOUS, FALSE,
NULL },
{ "tools-foreground-select-brush-size-increase-percent",
GIMP_STOCK_TOOL_FOREGROUND_SELECT,
"Increase Foreground Select Brush Size", NULL, NULL,
GIMP_ACTION_SELECT_PERCENT_NEXT, FALSE,
NULL },
};
static const GimpEnumActionEntry tools_transform_preview_opacity_actions[] =
@ -423,6 +450,14 @@ static const GimpEnumActionEntry tools_value_1_actions[] =
"Increase Value 1 More", "<control>greater", NULL,
GIMP_ACTION_SELECT_SKIP_NEXT, FALSE,
NULL },
{ "tools-value-1-decrease-percent", GIMP_STOCK_TOOL_OPTIONS,
"Decrease Value 1 Relative", NULL, NULL,
GIMP_ACTION_SELECT_PERCENT_PREVIOUS, FALSE,
NULL },
{ "tools-value-1-increase-percent", GIMP_STOCK_TOOL_OPTIONS,
"Increase Value 1 Relative", NULL, NULL,
GIMP_ACTION_SELECT_PERCENT_NEXT, FALSE,
NULL },
};
/* tools-value-2 is effectively used to control
@ -462,6 +497,14 @@ static const GimpEnumActionEntry tools_value_2_actions[] =
"Increase Value 2 More", "<shift>bracketright", NULL,
GIMP_ACTION_SELECT_SKIP_NEXT, FALSE,
NULL },
{ "tools-value-2-decrease-percent", GIMP_STOCK_TOOL_OPTIONS,
"Decrease Value 2 Relative", NULL, NULL,
GIMP_ACTION_SELECT_PERCENT_PREVIOUS, FALSE,
NULL },
{ "tools-value-2-increase-percent", GIMP_STOCK_TOOL_OPTIONS,
"Increase Value 2 Relative", NULL, NULL,
GIMP_ACTION_SELECT_PERCENT_NEXT, FALSE,
NULL },
};
static const GimpEnumActionEntry tools_value_3_actions[] =
@ -498,6 +541,14 @@ static const GimpEnumActionEntry tools_value_3_actions[] =
"Increase Value 3 More", NULL, NULL,
GIMP_ACTION_SELECT_SKIP_NEXT, FALSE,
NULL },
{ "tools-value-3-decrease-percent", GIMP_STOCK_TOOL_OPTIONS,
"Decrease Value 3 Relative", NULL, NULL,
GIMP_ACTION_SELECT_PERCENT_PREVIOUS, FALSE,
NULL },
{ "tools-value-3-increase-percent", GIMP_STOCK_TOOL_OPTIONS,
"Increase Value 3 Relative", NULL, NULL,
GIMP_ACTION_SELECT_PERCENT_NEXT, FALSE,
NULL },
};
static const GimpEnumActionEntry tools_value_4_actions[] =
@ -534,6 +585,14 @@ static const GimpEnumActionEntry tools_value_4_actions[] =
"Increase Value 4 More", NULL, NULL,
GIMP_ACTION_SELECT_SKIP_NEXT, FALSE,
NULL },
{ "tools-value-4-decrease-percent", GIMP_STOCK_TOOL_OPTIONS,
"Decrease Value 4 Relative", NULL, NULL,
GIMP_ACTION_SELECT_PERCENT_PREVIOUS, FALSE,
NULL },
{ "tools-value-4-increase-percent", GIMP_STOCK_TOOL_OPTIONS,
"Increase Value 4 Relative", NULL, NULL,
GIMP_ACTION_SELECT_PERCENT_NEXT, FALSE,
NULL },
};
static const GimpEnumActionEntry tools_object_1_actions[] =

View File

@ -119,7 +119,7 @@ tools_color_average_radius_cmd_callback (GtkAction *action,
action_data_get_display (data),
G_OBJECT (tool_info->tool_options),
"average-radius",
1.0, 1.0, 10.0, FALSE);
1.0, 1.0, 10.0, 0.1, FALSE);
}
}
@ -140,7 +140,7 @@ tools_paint_brush_scale_cmd_callback (GtkAction *action,
action_data_get_display (data),
G_OBJECT (tool_info->tool_options),
"brush-scale",
0.01, 0.1, 1.0, FALSE);
0.01, 0.1, 1.0, 0.1, FALSE);
}
}
@ -161,7 +161,7 @@ tools_paint_brush_angle_cmd_callback (GtkAction *action,
action_data_get_display (data),
G_OBJECT (tool_info->tool_options),
"brush-angle",
0.1, 1.0, 15.0, TRUE);
0.1, 1.0, 15.0, 0.1, TRUE);
}
}
@ -182,7 +182,7 @@ tools_paint_brush_aspect_ratio_cmd_callback (GtkAction *action,
action_data_get_display (data),
G_OBJECT (tool_info->tool_options),
"brush-aspect-ratio",
0.01, 0.1, 1.0, TRUE);
0.01, 0.1, 1.0, 0.1, TRUE);
}
}
@ -203,7 +203,7 @@ tools_ink_blob_size_cmd_callback (GtkAction *action,
action_data_get_display (data),
G_OBJECT (tool_info->tool_options),
"size",
1.0, 1.0, 10.0, FALSE);
1.0, 1.0, 10.0, 0.1, FALSE);
}
}
@ -224,7 +224,7 @@ tools_ink_blob_aspect_cmd_callback (GtkAction *action,
action_data_get_display (data),
G_OBJECT (tool_info->tool_options),
"blob-aspect",
1.0, 0.1, 1.0, FALSE);
1.0, 0.1, 1.0, 0.1, FALSE);
}
}
@ -245,7 +245,7 @@ tools_ink_blob_angle_cmd_callback (GtkAction *action,
action_data_get_display (data),
G_OBJECT (tool_info->tool_options),
"blob-angle",
1.0, 1.0, 15.0, TRUE);
1.0, 1.0, 15.0, 0.1, TRUE);
}
}
@ -266,7 +266,7 @@ tools_fg_select_brush_size_cmd_callback (GtkAction *action,
action_data_get_display (data),
G_OBJECT (tool_info->tool_options),
"stroke-width",
1.0, 4.0, 16.0, FALSE);
1.0, 4.0, 16.0, 0.1, FALSE);
}
}
@ -287,7 +287,7 @@ tools_transform_preview_opacity_cmd_callback (GtkAction *action,
action_data_get_display (data),
G_OBJECT (tool_info->tool_options),
"preview-opacity",
0.01, 0.1, 0.5, FALSE);
0.01, 0.1, 0.5, 0.1, FALSE);
}
}

View File

@ -29,7 +29,6 @@
#include "core/gimp.h"
#include "core/gimp-utils.h"
#include "core/gimpchannel.h"
#include "core/gimpchannel-select.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "core/gimpimage-merge.h"
@ -200,7 +199,7 @@ vectors_raise_cmd_callback (GtkAction *action,
GimpVectors *vectors;
return_if_no_vectors (image, vectors, data);
gimp_image_raise_vectors (image, vectors, NULL);
gimp_image_raise_item (image, GIMP_ITEM (vectors), NULL);
gimp_image_flush (image);
}
@ -212,7 +211,7 @@ vectors_raise_to_top_cmd_callback (GtkAction *action,
GimpVectors *vectors;
return_if_no_vectors (image, vectors, data);
gimp_image_raise_vectors_to_top (image, vectors);
gimp_image_raise_item_to_top (image, GIMP_ITEM (vectors));
gimp_image_flush (image);
}
@ -224,7 +223,7 @@ vectors_lower_cmd_callback (GtkAction *action,
GimpVectors *vectors;
return_if_no_vectors (image, vectors, data);
gimp_image_lower_vectors (image, vectors, NULL);
gimp_image_lower_item (image, GIMP_ITEM (vectors), NULL);
gimp_image_flush (image);
}
@ -236,7 +235,7 @@ vectors_lower_to_bottom_cmd_callback (GtkAction *action,
GimpVectors *vectors;
return_if_no_vectors (image, vectors, data);
gimp_image_lower_vectors_to_bottom (image, vectors);
gimp_image_lower_item_to_bottom (image, GIMP_ITEM (vectors));
gimp_image_flush (image);
}
@ -303,17 +302,13 @@ vectors_to_selection_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpChannelOps op;
GimpImage *image;
GimpVectors *vectors;
GimpImage *image;
GimpVectors *vectors;
return_if_no_vectors (image, vectors, data);
op = (GimpChannelOps) value;
gimp_channel_select_vectors (gimp_image_get_mask (image),
_("Path to Selection"),
vectors,
op, TRUE, FALSE, 0, 0, TRUE);
gimp_item_to_selection (GIMP_ITEM (vectors),
(GimpChannelOps) value,
TRUE, FALSE, 0, 0);
gimp_image_flush (image);
}

View File

@ -43,6 +43,20 @@ static void pixel_region_configure (PixelRegionHolder *PRH,
/**************************/
/* Function definitions */
/**
* pixel_region_init:
* @PR: Pointer to PixelRegion struct, typically allocated on the
* stack
* @tiles: Tiles
* @x: X of region
* @y: Y of region
* @w: Width of region
* @h: Height of region
* @dirty: %TRUE if there will be changes to the pixel region that
* shall be written back to the tiles, %FALSE otherwise
*
* Initializes a pixel region over a set of tiles.
**/
void
pixel_region_init (PixelRegion *PR,
TileManager *tiles,

View File

@ -182,15 +182,15 @@ static void
stageone (lab *points,
gint left,
gint right,
gint depth,
const gint depth,
gint *clusters,
const gfloat *limits,
const gint dims)
{
gint curdim = depth % dims;
gfloat min, max;
gfloat curval;
gint i;
const gint curdim = depth % dims;
gfloat min, max;
gfloat curval;
gint i;
min = CURRENT_VALUE (points, left, curdim);
max = min;
@ -208,20 +208,21 @@ stageone (lab *points,
/* Split according to Rubner-Rule */
if (max - min > limits[curdim])
{
gfloat pivot = (min + max) / 2.0;
gint l = left;
gint r = right - 1;
lab tmp;
const gfloat pivot = (min + max) / 2.0;
gint l = left;
gint r = right - 1;
lab tmp;
while (TRUE)
{
while ( CURRENT_VALUE (points, l, curdim) <= pivot )
while (CURRENT_VALUE (points, l, curdim) <= pivot)
++l;
while ( CURRENT_VALUE (points, r, curdim) > pivot )
while (CURRENT_VALUE (points, r, curdim) > pivot)
--r;
if (l > r)
break;
break;
tmp = points[l];
points[l] = points[r];
@ -268,16 +269,16 @@ static void
stagetwo (lab *points,
gint left,
gint right,
gint depth,
const gint depth,
gint *clusters,
const gfloat *limits,
const gfloat threshold,
const gint dims)
{
gint curdim = depth % dims;
gfloat min, max;
gfloat curval;
gint i;
const gint curdim = depth % dims;
gfloat min, max;
gfloat curval;
gint i;
min = CURRENT_VALUE (points, left, curdim);
max = min;
@ -295,20 +296,21 @@ stagetwo (lab *points,
/* Split according to Rubner-Rule */
if (max - min > limits[curdim])
{
gfloat pivot = (min + max) / 2.0;
gint l = left;
gint r = right - 1;
lab tmp;
const gfloat pivot = (min + max) / 2.0;
gint l = left;
gint r = right - 1;
lab tmp;
while (TRUE)
{
while ( CURRENT_VALUE (points, l, curdim) <= pivot )
while (CURRENT_VALUE (points, l, curdim) <= pivot)
++l;
while ( CURRENT_VALUE (points, r, curdim) > pivot )
while (CURRENT_VALUE (points, r, curdim) > pivot)
--r;
if (l > r)
break;
break;
tmp = points[l];
points[l] = points[r];
@ -332,9 +334,9 @@ stagetwo (lab *points,
if (sum >= threshold)
{
const gint c = right - left;
gfloat l = 0;
gfloat a = 0;
gfloat b = 0;
gfloat l = 0;
gfloat a = 0;
gfloat b = 0;
for (; left < right; ++left)
{
@ -866,6 +868,10 @@ siox_foreground_extract (SioxState *state,
limits[1] = sensitivity[1];
limits[2] = sensitivity[2];
#ifdef SIOX_DEBUG
g_printerr ("siox.c: limits %f %f %f\n", limits[0], limits[1], limits[2]);
#endif
clustersize = get_clustersize (limits);
siox_progress_update (progress_callback, progress_data, 0.0);
@ -941,7 +947,6 @@ siox_foreground_extract (SioxState *state,
if (refinement & SIOX_REFINEMENT_ADD_BACKGROUND)
surebg = g_new (lab, surebgcount);
/* create inputs for color signatures */
pixel_region_init (&srcPR, state->pixels,
x - state->offset_x, y - state->offset_y,

View File

@ -38,7 +38,7 @@
#define DEFAULT_BRUSH "Round Fuzzy"
#define DEFAULT_DYNAMICS "Basic Dynamics"
#define DEFAULT_DYNAMICS "Dynamics Off"
#define DEFAULT_PATTERN "Pine"
#define DEFAULT_PALETTE "Default"
#define DEFAULT_GRADIENT "FG to BG (RGB)"

View File

@ -660,7 +660,7 @@ gimp_real_initialize (Gimp *gimp,
tool_preset_loader_entries,
G_N_ELEMENTS (tool_preset_loader_entries),
gimp_tool_preset_new,
gimp_tool_preset_get_standard);
NULL);
gimp_object_set_static_name (GIMP_OBJECT (gimp->tool_preset_factory),
"tool preset factory");

View File

@ -48,6 +48,7 @@
#include "gimpimage-undo-push.h"
#include "gimpchannel.h"
#include "gimpchannel-project.h"
#include "gimpchannel-select.h"
#include "gimpcontext.h"
#include "gimpdrawable-stroke.h"
#include "gimpmarshal.h"
@ -123,6 +124,12 @@ static gboolean gimp_channel_stroke (GimpItem *item,
gboolean push_undo,
GimpProgress *progress,
GError **error);
static void gimp_channel_to_selection (GimpItem *item,
GimpChannelOps op,
gboolean antialias,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y);
static void gimp_channel_invalidate_boundary (GimpDrawable *drawable);
static void gimp_channel_get_active_components (const GimpDrawable *drawable,
@ -259,6 +266,7 @@ gimp_channel_class_init (GimpChannelClass *klass)
item_class->rotate = gimp_channel_rotate;
item_class->transform = gimp_channel_transform;
item_class->stroke = gimp_channel_stroke;
item_class->to_selection = gimp_channel_to_selection;
item_class->get_node = gimp_channel_get_node;
item_class->default_name = _("Channel");
item_class->rename_desc = C_("undo-type", "Rename Channel");
@ -269,6 +277,14 @@ gimp_channel_class_init (GimpChannelClass *klass)
item_class->rotate_desc = C_("undo-type", "Rotate Channel");
item_class->transform_desc = C_("undo-type", "Transform Channel");
item_class->stroke_desc = C_("undo-type", "Stroke Channel");
item_class->to_selection_desc = C_("undo-type", "Channel to Selection");
item_class->reorder_desc = C_("undo-type", "Reorder Channel");
item_class->raise_desc = C_("undo-type", "Raise Channel");
item_class->raise_to_top_desc = C_("undo-type", "Raise Channel to Top");
item_class->lower_desc = C_("undo-type", "Lower Channel");
item_class->lower_to_bottom_desc = C_("undo-type", "Lower Channel to Bottom");
item_class->raise_failed = _("Channel cannot be raised higher.");
item_class->lower_failed = _("Channel cannot be lowered more.");
drawable_class->invalidate_boundary = gimp_channel_invalidate_boundary;
drawable_class->get_active_components = gimp_channel_get_active_components;
@ -753,6 +769,27 @@ gimp_channel_stroke (GimpItem *item,
return retval;
}
static void
gimp_channel_to_selection (GimpItem *item,
GimpChannelOps op,
gboolean antialias,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y)
{
GimpChannel *channel = GIMP_CHANNEL (item);
GimpImage *image = gimp_item_get_image (item);
gint off_x, off_y;
gimp_item_get_offset (item, &off_x, &off_y);
gimp_channel_select_channel (gimp_image_get_mask (image),
GIMP_ITEM_GET_CLASS (item)->to_selection_desc,
channel, off_x, off_y,
op,
feather, feather_radius_x, feather_radius_x);
}
static void
gimp_channel_invalidate_boundary (GimpDrawable *drawable)
{

View File

@ -1675,7 +1675,6 @@ gimp_context_copy_property (GimpContext *src,
case GIMP_CONTEXT_PROP_TOOL_PRESET:
gimp_context_real_set_tool_preset (dest, src->tool_preset);
object = src->tool_preset;
standard_object = gimp_tool_preset_get_standard (src);
src_name = src->tool_preset_name;
dest_name_loc = &dest->tool_preset_name;
break;
@ -3105,12 +3104,8 @@ gimp_context_tool_preset_list_thaw (GimpContainer *container,
{
GimpToolPreset *tool_preset;
if (! context->tool_preset_name)
context->tool_preset_name = g_strdup (context->gimp->config->default_tool_preset);
tool_preset = gimp_context_find_object (context, container,
context->tool_preset_name,
gimp_tool_preset_get_standard (context));
context->tool_preset_name, NULL);
gimp_context_real_set_tool_preset (context, tool_preset);
}
@ -3122,8 +3117,7 @@ gimp_context_real_set_tool_preset (GimpContext *context,
if (context->tool_preset == tool_preset)
return;
if (context->tool_preset_name &&
tool_preset != GIMP_TOOL_PRESET (gimp_tool_preset_get_standard (context)))
if (context->tool_preset_name)
{
g_free (context->tool_preset_name);
context->tool_preset_name = NULL;
@ -3149,8 +3143,7 @@ gimp_context_real_set_tool_preset (GimpContext *context,
context,
0);
if (tool_preset != GIMP_TOOL_PRESET (gimp_tool_preset_get_standard (context)))
context->tool_preset_name = g_strdup (gimp_object_get_name (tool_preset));
context->tool_preset_name = g_strdup (gimp_object_get_name (tool_preset));
}
g_object_notify (G_OBJECT (context), "tool-preset");

View File

@ -797,6 +797,34 @@ gimp_curve_move_point (GimpCurve *curve,
gimp_data_dirty (GIMP_DATA (curve));
}
void
gimp_curve_delete_point (GimpCurve *curve,
gint point)
{
g_return_if_fail (GIMP_IS_CURVE (curve));
g_return_if_fail (point >= 0 && point < curve->n_points);
if (point == 0)
{
curve->points[0].x = 0.0;
curve->points[0].y = 0.0;
}
else if (point == curve->n_points - 1)
{
curve->points[curve->n_points - 1].x = 1.0;
curve->points[curve->n_points - 1].y = 1.0;
}
else
{
curve->points[point].x = -1.0;
curve->points[point].y = -1.0;
}
g_object_notify (G_OBJECT (curve), "points");
gimp_data_dirty (GIMP_DATA (curve));
}
void
gimp_curve_get_point (GimpCurve *curve,
gint point,

View File

@ -79,6 +79,8 @@ void gimp_curve_set_point (GimpCurve *curve,
void gimp_curve_move_point (GimpCurve *curve,
gint point,
gdouble y);
void gimp_curve_delete_point (GimpCurve *curve,
gint point);
void gimp_curve_get_point (GimpCurve *curve,
gint point,
gdouble *x,

View File

@ -36,7 +36,9 @@
#include "gimpimage-private.h"
#include "gimpimage-undo.h"
#include "gimpimage-sample-points.h"
#include "gimpitemstack.h"
#include "gimplayer.h"
#include "gimplayermask.h"
#include "gimplayer-floating-sel.h"
#include "gimpparasitelist.h"
#include "gimpsamplepoint.h"
@ -50,17 +52,16 @@ static void gimp_image_duplicate_save_source_uri (GimpImage *image,
GimpImage *new_image);
static void gimp_image_duplicate_colormap (GimpImage *image,
GimpImage *new_image);
static GimpItem * gimp_image_duplicate_item (GimpItem *item,
GimpImage *new_image);
static GimpLayer * gimp_image_duplicate_layers (GimpImage *image,
GimpImage *new_image,
GimpLayer **new_floating_layer,
GimpDrawable **floating_sel_drawable,
GimpDrawable **new_floating_sel_drawable);
GimpImage *new_image);
static GimpChannel * gimp_image_duplicate_channels (GimpImage *image,
GimpImage *new_image,
GimpDrawable *floating_sel_drawable,
GimpDrawable **new_floating_sel_drawable);
GimpImage *new_image);
static GimpVectors * gimp_image_duplicate_vectors (GimpImage *image,
GimpImage *new_image);
static void gimp_image_duplicate_floating_sel (GimpImage *image,
GimpImage *new_image);
static void gimp_image_duplicate_mask (GimpImage *image,
GimpImage *new_image);
static void gimp_image_duplicate_components (GimpImage *image,
@ -84,9 +85,6 @@ gimp_image_duplicate (GimpImage *image)
GimpLayer *active_layer;
GimpChannel *active_channel;
GimpVectors *active_vectors;
GimpLayer *new_floating_layer = NULL;
GimpDrawable *floating_sel_drawable = NULL;
GimpDrawable *new_floating_sel_drawable = NULL;
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
@ -111,25 +109,20 @@ gimp_image_duplicate (GimpImage *image)
gimp_image_duplicate_resolution (image, new_image);
/* Copy the layers */
active_layer = gimp_image_duplicate_layers (image, new_image,
&new_floating_layer,
&floating_sel_drawable,
&new_floating_sel_drawable);
active_layer = gimp_image_duplicate_layers (image, new_image);
/* Copy the channels */
active_channel = gimp_image_duplicate_channels (image, new_image,
floating_sel_drawable,
&new_floating_sel_drawable);
active_channel = gimp_image_duplicate_channels (image, new_image);
/* Copy any vectors */
active_vectors = gimp_image_duplicate_vectors (image, new_image);
/* Copy floating layer */
gimp_image_duplicate_floating_sel (image, new_image);
/* Copy the selection mask */
gimp_image_duplicate_mask (image, new_image);
if (new_floating_layer)
floating_sel_attach (new_floating_layer, new_floating_sel_drawable);
/* Set active layer, active channel, active vectors */
if (active_layer)
gimp_image_set_active_layer (new_image, active_layer);
@ -195,24 +188,30 @@ gimp_image_duplicate_colormap (GimpImage *image,
FALSE);
}
static GimpItem *
gimp_image_duplicate_item (GimpItem *item,
GimpImage *new_image)
{
GimpItem *new_item;
new_item = gimp_item_convert (item, new_image,
G_TYPE_FROM_INSTANCE (item));
/* Make sure the copied item doesn't say: "<old item> copy" */
gimp_object_set_name (GIMP_OBJECT (new_item),
gimp_object_get_name (item));
return new_item;
}
static GimpLayer *
gimp_image_duplicate_layers (GimpImage *image,
GimpImage *new_image,
GimpLayer **floating_layer,
GimpDrawable **floating_sel_drawable,
GimpDrawable **new_floating_sel_drawable)
gimp_image_duplicate_layers (GimpImage *image,
GimpImage *new_image)
{
GimpLayer *active_layer = NULL;
GimpLayer *floating_selection;
GList *list;
gint count;
/* Copy floating layer */
floating_selection = gimp_image_get_floating_selection (image);
if (floating_selection)
*floating_sel_drawable = gimp_layer_get_floating_sel_drawable (floating_selection);
for (list = gimp_image_get_layer_iter (image), count = 0;
list;
list = g_list_next (list))
@ -220,13 +219,11 @@ gimp_image_duplicate_layers (GimpImage *image,
GimpLayer *layer = list->data;
GimpLayer *new_layer;
new_layer = GIMP_LAYER (gimp_item_convert (GIMP_ITEM (layer),
new_image,
G_TYPE_FROM_INSTANCE (layer)));
if (gimp_layer_is_floating_sel (layer))
continue;
/* Make sure the copied layer doesn't say: "<old layer> copy" */
gimp_object_set_name (GIMP_OBJECT (new_layer),
gimp_object_get_name (layer));
new_layer = GIMP_LAYER (gimp_image_duplicate_item (GIMP_ITEM (layer),
new_image));
/* Make sure that if the layer has a layer mask,
* its name isn't screwed up
@ -238,25 +235,16 @@ gimp_image_duplicate_layers (GimpImage *image,
if (gimp_image_get_active_layer (image) == layer)
active_layer = new_layer;
if (gimp_image_get_floating_selection (image) == layer)
*floating_layer = new_layer;
if (*floating_sel_drawable == GIMP_DRAWABLE (layer))
*new_floating_sel_drawable = GIMP_DRAWABLE (new_layer);
if (*floating_layer != new_layer)
gimp_image_add_layer (new_image, new_layer,
NULL, count++, FALSE);
gimp_image_add_layer (new_image, new_layer,
NULL, count++, FALSE);
}
return active_layer;
}
static GimpChannel *
gimp_image_duplicate_channels (GimpImage *image,
GimpImage *new_image,
GimpDrawable *floating_sel_drawable,
GimpDrawable **new_floating_sel_drawable)
gimp_image_duplicate_channels (GimpImage *image,
GimpImage *new_image)
{
GimpChannel *active_channel = NULL;
GList *list;
@ -269,20 +257,12 @@ gimp_image_duplicate_channels (GimpImage *image,
GimpChannel *channel = list->data;
GimpChannel *new_channel;
new_channel = GIMP_CHANNEL (gimp_item_convert (GIMP_ITEM (channel),
new_image,
G_TYPE_FROM_INSTANCE (channel)));
/* Make sure the copied channel doesn't say: "<old channel> copy" */
gimp_object_set_name (GIMP_OBJECT (new_channel),
gimp_object_get_name (channel));
new_channel = GIMP_CHANNEL (gimp_image_duplicate_item (GIMP_ITEM (channel),
new_image));
if (gimp_image_get_active_channel (image) == channel)
active_channel = new_channel;
if (floating_sel_drawable == GIMP_DRAWABLE (channel))
*new_floating_sel_drawable = GIMP_DRAWABLE (new_channel);
gimp_image_add_channel (new_image, new_channel,
NULL, count++, FALSE);
}
@ -305,13 +285,8 @@ gimp_image_duplicate_vectors (GimpImage *image,
GimpVectors *vectors = list->data;
GimpVectors *new_vectors;
new_vectors = GIMP_VECTORS (gimp_item_convert (GIMP_ITEM (vectors),
new_image,
G_TYPE_FROM_INSTANCE (vectors)));
/* Make sure the copied vectors doesn't say: "<old vectors> copy" */
gimp_object_set_name (GIMP_OBJECT (new_vectors),
gimp_object_get_name (vectors));
new_vectors = GIMP_VECTORS (gimp_image_duplicate_item (GIMP_ITEM (vectors),
new_image));
if (gimp_image_get_active_vectors (image) == vectors)
active_vectors = new_vectors;
@ -323,6 +298,85 @@ gimp_image_duplicate_vectors (GimpImage *image,
return active_vectors;
}
static void
gimp_image_duplicate_floating_sel (GimpImage *image,
GimpImage *new_image)
{
GimpLayer *floating_sel;
GimpDrawable *floating_sel_drawable;
GList *floating_sel_path;
GimpItemStack *new_item_stack;
GimpLayer *new_floating_sel;
GimpDrawable *new_floating_sel_drawable;
floating_sel = gimp_image_get_floating_selection (image);
if (! floating_sel)
return;
floating_sel_drawable = gimp_layer_get_floating_sel_drawable (floating_sel);
if (GIMP_IS_LAYER_MASK (floating_sel_drawable))
{
GimpLayer *layer;
layer = gimp_layer_mask_get_layer (GIMP_LAYER_MASK (floating_sel_drawable));
floating_sel_path = gimp_item_get_path (GIMP_ITEM (layer));
new_item_stack = GIMP_ITEM_STACK (gimp_image_get_layers (new_image));
}
else
{
floating_sel_path = gimp_item_get_path (GIMP_ITEM (floating_sel_drawable));
if (GIMP_IS_LAYER (floating_sel_drawable))
new_item_stack = GIMP_ITEM_STACK (gimp_image_get_layers (new_image));
else
new_item_stack = GIMP_ITEM_STACK (gimp_image_get_channels (new_image));
}
/* adjust path[0] for the floating layer missing in new_image */
floating_sel_path->data =
GUINT_TO_POINTER (GPOINTER_TO_UINT (floating_sel_path->data) - 1);
if (GIMP_IS_LAYER (floating_sel_drawable))
{
new_floating_sel =
GIMP_LAYER (gimp_image_duplicate_item (GIMP_ITEM (floating_sel),
new_image));
}
else
{
/* can't use gimp_item_convert() for floating selections of channels
* or layer masks because they maybe don't have a normal layer's type
*/
new_floating_sel =
GIMP_LAYER (gimp_item_duplicate (GIMP_ITEM (floating_sel),
G_TYPE_FROM_INSTANCE (floating_sel)));
gimp_item_set_image (GIMP_ITEM (new_floating_sel), new_image);
gimp_object_set_name (GIMP_OBJECT (new_floating_sel),
gimp_object_get_name (floating_sel));
}
/* Make sure the copied layer doesn't say: "<old layer> copy" */
gimp_object_set_name (GIMP_OBJECT (new_floating_sel),
gimp_object_get_name (floating_sel));
new_floating_sel_drawable =
GIMP_DRAWABLE (gimp_item_stack_get_item_by_path (new_item_stack,
floating_sel_path));
if (GIMP_IS_LAYER_MASK (floating_sel_drawable))
new_floating_sel_drawable =
GIMP_DRAWABLE (gimp_layer_get_mask (GIMP_LAYER (new_floating_sel_drawable)));
floating_sel_attach (new_floating_sel, new_floating_sel_drawable);
g_list_free (floating_sel_path);
}
static void
gimp_image_duplicate_mask (GimpImage *image,
GimpImage *new_image)

View File

@ -3246,6 +3246,127 @@ gimp_image_get_vectors_by_name (const GimpImage *image,
}
/* items */
gboolean
gimp_image_reorder_item (GimpImage *image,
GimpItem *item,
GimpItem *new_parent,
gint new_index,
gboolean push_undo,
const gchar *undo_desc)
{
GimpItemTree *tree;
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
g_return_val_if_fail (GIMP_IS_ITEM (item), FALSE);
g_return_val_if_fail (gimp_item_get_image (item) == image, FALSE);
tree = gimp_item_get_tree (item);
g_return_val_if_fail (tree != NULL, FALSE);
if (push_undo && ! undo_desc)
undo_desc = GIMP_ITEM_GET_CLASS (item)->reorder_desc;
/* item and new_parent are type-checked in GimpItemTree
*/
return gimp_item_tree_reorder_item (tree, item,
new_parent, new_index,
push_undo, undo_desc);
}
gboolean
gimp_image_raise_item (GimpImage *image,
GimpItem *item,
GError **error)
{
gint index;
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
g_return_val_if_fail (GIMP_IS_ITEM (item), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
index = gimp_item_get_index (item);
g_return_val_if_fail (index != -1, FALSE);
if (index == 0)
{
g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
GIMP_ITEM_GET_CLASS (item)->raise_failed);
return FALSE;
}
return gimp_image_reorder_item (image, item,
gimp_item_get_parent (item), index - 1,
TRUE, GIMP_ITEM_GET_CLASS (item)->raise_desc);
}
gboolean
gimp_image_raise_item_to_top (GimpImage *image,
GimpItem *item)
{
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
g_return_val_if_fail (GIMP_IS_ITEM (item), FALSE);
return gimp_image_reorder_item (image, item,
gimp_item_get_parent (item), 0,
TRUE, GIMP_ITEM_GET_CLASS (item)->raise_to_top_desc);
}
gboolean
gimp_image_lower_item (GimpImage *image,
GimpItem *item,
GError **error)
{
GimpContainer *container;
gint index;
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
g_return_val_if_fail (GIMP_IS_ITEM (item), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
container = gimp_item_get_container (item);
g_return_val_if_fail (container != NULL, FALSE);
index = gimp_item_get_index (item);
if (index == gimp_container_get_n_children (container) - 1)
{
g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
GIMP_ITEM_GET_CLASS (item)->lower_failed);
return FALSE;
}
return gimp_image_reorder_item (image, item,
gimp_item_get_parent (item), index + 1,
TRUE, GIMP_ITEM_GET_CLASS (item)->lower_desc);
}
gboolean
gimp_image_lower_item_to_bottom (GimpImage *image,
GimpItem *item)
{
GimpContainer *container;
gint length;
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
g_return_val_if_fail (GIMP_IS_ITEM (item), FALSE);
container = gimp_item_get_container (item);
g_return_val_if_fail (container != NULL, FALSE);
length = gimp_container_get_n_children (container);
return gimp_image_reorder_item (image, item,
gimp_item_get_parent (item), length - 1,
TRUE, GIMP_ITEM_GET_CLASS (item)->lower_to_bottom_desc);
}
/* layers */
gboolean
@ -3484,109 +3605,6 @@ gimp_image_add_layers (GimpImage *image,
gimp_image_undo_group_end (image);
}
gboolean
gimp_image_raise_layer (GimpImage *image,
GimpLayer *layer,
GError **error)
{
gint index;
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
g_return_val_if_fail (GIMP_IS_LAYER (layer), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
index = gimp_item_get_index (GIMP_ITEM (layer));
if (index == 0)
{
g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
_("Layer cannot be raised higher."));
return FALSE;
}
return gimp_image_reorder_layer (image, layer,
gimp_layer_get_parent (layer), index - 1,
TRUE, C_("undo-type", "Raise Layer"));
}
gboolean
gimp_image_raise_layer_to_top (GimpImage *image,
GimpLayer *layer)
{
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
g_return_val_if_fail (GIMP_IS_LAYER (layer), FALSE);
return gimp_image_reorder_layer (image, layer,
gimp_layer_get_parent (layer), 0,
TRUE, C_("undo-type", "Raise Layer to Top"));
}
gboolean
gimp_image_lower_layer (GimpImage *image,
GimpLayer *layer,
GError **error)
{
GimpContainer *container;
gint index;
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
g_return_val_if_fail (GIMP_IS_LAYER (layer), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
container = gimp_item_get_container (GIMP_ITEM (layer));
index = gimp_item_get_index (GIMP_ITEM (layer));
if (index == gimp_container_get_n_children (container) - 1)
{
g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
_("Layer cannot be lowered more."));
return FALSE;
}
return gimp_image_reorder_layer (image, layer,
gimp_layer_get_parent (layer), index + 1,
TRUE, C_("undo-type", "Lower Layer"));
}
gboolean
gimp_image_lower_layer_to_bottom (GimpImage *image,
GimpLayer *layer)
{
GimpContainer *container;
gint length;
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
g_return_val_if_fail (GIMP_IS_LAYER (layer), FALSE);
container = gimp_item_get_container (GIMP_ITEM (layer));
length = gimp_container_get_n_children (container);
return gimp_image_reorder_layer (image, layer,
gimp_layer_get_parent (layer), length - 1,
TRUE, C_("undo-type", "Lower Layer to Bottom"));
}
gboolean
gimp_image_reorder_layer (GimpImage *image,
GimpLayer *layer,
GimpLayer *new_parent,
gint new_index,
gboolean push_undo,
const gchar *undo_desc)
{
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
/* item and new_parent are type-checked in GimpItemTree
*/
return gimp_item_tree_reorder_item (GIMP_IMAGE_GET_PRIVATE (image)->layers,
(GimpItem *) layer,
(GimpItem *) new_parent,
new_index,
push_undo, undo_desc);
}
/* channels */
@ -3684,110 +3702,6 @@ gimp_image_remove_channel (GimpImage *image,
gimp_image_undo_group_end (image);
}
gboolean
gimp_image_raise_channel (GimpImage *image,
GimpChannel *channel,
GError **error)
{
gint index;
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
g_return_val_if_fail (GIMP_IS_CHANNEL (channel), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
index = gimp_item_get_index (GIMP_ITEM (channel));
if (index == 0)
{
g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
_("Channel cannot be raised higher."));
return FALSE;
}
return gimp_image_reorder_channel (image, channel,
gimp_channel_get_parent (channel), index - 1,
TRUE, C_("undo-type", "Raise Channel"));
}
gboolean
gimp_image_raise_channel_to_top (GimpImage *image,
GimpChannel *channel)
{
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
g_return_val_if_fail (GIMP_IS_CHANNEL (channel), FALSE);
return gimp_image_reorder_channel (image, channel,
gimp_channel_get_parent (channel), 0,
TRUE, C_("undo-type", "Raise Channel to Top"));
}
gboolean
gimp_image_lower_channel (GimpImage *image,
GimpChannel *channel,
GError **error)
{
GimpContainer *container;
gint index;
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
g_return_val_if_fail (GIMP_IS_CHANNEL (channel), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
container = gimp_item_get_container (GIMP_ITEM (channel));
index = gimp_item_get_index (GIMP_ITEM (channel));
if (index == gimp_container_get_n_children (container) - 1)
{
g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
_("Channel cannot be lowered more."));
return FALSE;
}
return gimp_image_reorder_channel (image, channel,
gimp_channel_get_parent (channel), index + 1,
TRUE, C_("undo-type", "Lower Channel"));
}
gboolean
gimp_image_lower_channel_to_bottom (GimpImage *image,
GimpChannel *channel)
{
GimpContainer *container;
gint length;
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
g_return_val_if_fail (GIMP_IS_CHANNEL (channel), FALSE);
container = gimp_item_get_container (GIMP_ITEM (channel));
length = gimp_container_get_n_children (container);
return gimp_image_reorder_channel (image, channel,
gimp_channel_get_parent (channel), length - 1,
TRUE, C_("undo-type", "Lower Channel to Bottom"));
}
gboolean
gimp_image_reorder_channel (GimpImage *image,
GimpChannel *channel,
GimpChannel *new_parent,
gint new_index,
gboolean push_undo,
const gchar *undo_desc)
{
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
/* item and new_parent are type-checked in GimpItemTree
*/
return gimp_item_tree_reorder_item (GIMP_IMAGE_GET_PRIVATE (image)->channels,
(GimpItem *) channel,
(GimpItem *) new_parent,
new_index,
push_undo, undo_desc);
}
/* vectors */
@ -3858,109 +3772,6 @@ gimp_image_remove_vectors (GimpImage *image,
gimp_image_set_active_vectors (image, new_active);
}
gboolean
gimp_image_raise_vectors (GimpImage *image,
GimpVectors *vectors,
GError **error)
{
gint index;
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
g_return_val_if_fail (GIMP_IS_VECTORS (vectors), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
index = gimp_item_get_index (GIMP_ITEM (vectors));
if (index == 0)
{
g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
_("Path cannot be raised higher."));
return FALSE;
}
return gimp_image_reorder_vectors (image, vectors,
gimp_vectors_get_parent (vectors), index - 1,
TRUE, C_("undo-type", "Raise Path"));
}
gboolean
gimp_image_raise_vectors_to_top (GimpImage *image,
GimpVectors *vectors)
{
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
g_return_val_if_fail (GIMP_IS_VECTORS (vectors), FALSE);
return gimp_image_reorder_vectors (image, vectors,
gimp_vectors_get_parent (vectors), 0,
TRUE, C_("undo-type", "Raise Path to Top"));
}
gboolean
gimp_image_lower_vectors (GimpImage *image,
GimpVectors *vectors,
GError **error)
{
GimpContainer *container;
gint index;
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
g_return_val_if_fail (GIMP_IS_VECTORS (vectors), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
container = gimp_item_get_container (GIMP_ITEM (vectors));
index = gimp_item_get_index (GIMP_ITEM (vectors));
if (index == gimp_container_get_n_children (container) - 1)
{
g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
_("Path cannot be lowered more."));
return FALSE;
}
return gimp_image_reorder_vectors (image, vectors,
gimp_vectors_get_parent (vectors), index + 1,
TRUE, C_("undo-type", "Lower Path"));
}
gboolean
gimp_image_lower_vectors_to_bottom (GimpImage *image,
GimpVectors *vectors)
{
GimpContainer *container;
gint length;
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
g_return_val_if_fail (GIMP_IS_VECTORS (vectors), FALSE);
container = gimp_item_get_container (GIMP_ITEM (vectors));
length = gimp_container_get_n_children (container);
return gimp_image_reorder_vectors (image, vectors,
gimp_vectors_get_parent (vectors), length - 1,
TRUE, C_("undo-type", "Lower Path to Bottom"));
}
gboolean
gimp_image_reorder_vectors (GimpImage *image,
GimpVectors *vectors,
GimpVectors *new_parent,
gint new_index,
gboolean push_undo,
const gchar *undo_desc)
{
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
/* item and new_parent are type-checked in GimpItemTree
*/
return gimp_item_tree_reorder_item (GIMP_IMAGE_GET_PRIVATE (image)->vectors,
(GimpItem *) vectors,
(GimpItem *) new_parent,
new_index,
push_undo, undo_desc);
}
gboolean
gimp_image_coords_in_active_pickable (GimpImage *image,
const GimpCoords *coords,

View File

@ -401,6 +401,23 @@ GimpChannel * gimp_image_get_channel_by_name (const GimpImage *image,
GimpVectors * gimp_image_get_vectors_by_name (const GimpImage *image,
const gchar *name);
gboolean gimp_image_reorder_item (GimpImage *image,
GimpItem *item,
GimpItem *new_parent,
gint new_index,
gboolean push_undo,
const gchar *undo_desc);
gboolean gimp_image_raise_item (GimpImage *image,
GimpItem *item,
GError **error);
gboolean gimp_image_raise_item_to_top (GimpImage *image,
GimpItem *item);
gboolean gimp_image_lower_item (GimpImage *image,
GimpItem *item,
GError **error);
gboolean gimp_image_lower_item_to_bottom (GimpImage *image,
GimpItem *item);
gboolean gimp_image_add_layer (GimpImage *image,
GimpLayer *layer,
GimpLayer *parent,
@ -421,23 +438,6 @@ void gimp_image_add_layers (GimpImage *image,
gint height,
const gchar *undo_desc);
gboolean gimp_image_raise_layer (GimpImage *image,
GimpLayer *layer,
GError **error);
gboolean gimp_image_raise_layer_to_top (GimpImage *image,
GimpLayer *layer);
gboolean gimp_image_lower_layer (GimpImage *image,
GimpLayer *layer,
GError **error);
gboolean gimp_image_lower_layer_to_bottom (GimpImage *image,
GimpLayer *layer);
gboolean gimp_image_reorder_layer (GimpImage *image,
GimpLayer *layer,
GimpLayer *new_parent,
gint new_index,
gboolean push_undo,
const gchar *undo_desc);
gboolean gimp_image_add_channel (GimpImage *image,
GimpChannel *channel,
GimpChannel *parent,
@ -448,23 +448,6 @@ void gimp_image_remove_channel (GimpImage *image,
gboolean push_undo,
GimpChannel *new_active);
gboolean gimp_image_raise_channel (GimpImage *image,
GimpChannel *channel,
GError **error);
gboolean gimp_image_raise_channel_to_top (GimpImage *image,
GimpChannel *channel);
gboolean gimp_image_lower_channel (GimpImage *image,
GimpChannel *channel,
GError **error);
gboolean gimp_image_lower_channel_to_bottom (GimpImage *image,
GimpChannel *channel);
gboolean gimp_image_reorder_channel (GimpImage *image,
GimpChannel *channel,
GimpChannel *new_parent,
gint new_index,
gboolean push_undo,
const gchar *undo_desc);
gboolean gimp_image_add_vectors (GimpImage *image,
GimpVectors *vectors,
GimpVectors *parent,
@ -475,23 +458,6 @@ void gimp_image_remove_vectors (GimpImage *image,
gboolean push_undo,
GimpVectors *new_active);
gboolean gimp_image_raise_vectors (GimpImage *image,
GimpVectors *vectors,
GError **error);
gboolean gimp_image_raise_vectors_to_top (GimpImage *image,
GimpVectors *vectors);
gboolean gimp_image_lower_vectors (GimpImage *image,
GimpVectors *vectors,
GError **error);
gboolean gimp_image_lower_vectors_to_bottom (GimpImage *image,
GimpVectors *vectors);
gboolean gimp_image_reorder_vectors (GimpImage *image,
GimpVectors *vectors,
GimpVectors *new_parent,
gint new_index,
gboolean push_undo,
const gchar *undo_desc);
gboolean gimp_image_coords_in_active_pickable (GimpImage *image,
const GimpCoords *coords,
gboolean sample_merged,

View File

@ -192,6 +192,7 @@ gimp_item_class_init (GimpItemClass *klass)
klass->rotate = NULL;
klass->transform = NULL;
klass->stroke = NULL;
klass->to_selection = NULL;
klass->get_node = gimp_item_real_get_node;
klass->default_name = NULL;
@ -1411,6 +1412,26 @@ gimp_item_stroke (GimpItem *item,
return retval;
}
void
gimp_item_to_selection (GimpItem *item,
GimpChannelOps op,
gboolean antialias,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y)
{
GimpItemClass *item_class;
g_return_if_fail (GIMP_IS_ITEM (item));
g_return_if_fail (gimp_item_is_attached (item));
item_class = GIMP_ITEM_GET_CLASS (item);
if (item_class->to_selection)
item_class->to_selection (item, op, antialias,
feather, feather_radius_x, feather_radius_y);
}
GeglNode *
gimp_item_get_node (GimpItem *item)
{

View File

@ -121,6 +121,12 @@ struct _GimpItemClass
gboolean push_undo,
GimpProgress *progress,
GError **error);
void (* to_selection) (GimpItem *item,
GimpChannelOps op,
gboolean antialias,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y);
GeglNode * (* get_node) (GimpItem *item);
@ -132,7 +138,17 @@ struct _GimpItemClass
const gchar *flip_desc;
const gchar *rotate_desc;
const gchar *transform_desc;
const gchar *to_selection_desc;
const gchar *stroke_desc;
const gchar *reorder_desc;
const gchar *raise_desc;
const gchar *raise_to_top_desc;
const gchar *lower_desc;
const gchar *lower_to_bottom_desc;
const gchar *raise_failed;
const gchar *lower_failed;
};
@ -246,6 +262,13 @@ gboolean gimp_item_stroke (GimpItem *item,
GimpProgress *progress,
GError **error);
void gimp_item_to_selection (GimpItem *item,
GimpChannelOps op,
gboolean antialias,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y);
GeglNode * gimp_item_get_node (GimpItem *item);
GeglNode * gimp_item_peek_node (GimpItem *item);
GeglNode * gimp_item_get_offset_node (GimpItem *item);

View File

@ -233,6 +233,39 @@ gimp_item_stack_get_item_by_tattoo (GimpItemStack *stack,
return NULL;
}
GimpItem *
gimp_item_stack_get_item_by_path (GimpItemStack *stack,
GList *path)
{
GimpContainer *container;
GimpItem *item = NULL;
g_return_val_if_fail (GIMP_IS_ITEM_STACK (stack), NULL);
g_return_val_if_fail (path != NULL, NULL);
container = GIMP_CONTAINER (stack);
while (path)
{
guint32 i = GPOINTER_TO_UINT (path->data);
item = GIMP_ITEM (gimp_container_get_child_by_index (container, i));
g_return_val_if_fail (GIMP_IS_ITEM (item), item);
if (path->next)
{
container = gimp_viewable_get_children (GIMP_VIEWABLE (item));
g_return_val_if_fail (GIMP_IS_ITEM_STACK (container), item);
}
path = path->next;
}
return item;
}
GimpItem *
gimp_item_stack_get_parent_by_path (GimpItemStack *stack,
GList *path,

View File

@ -53,6 +53,8 @@ GList * gimp_item_stack_get_item_iter (GimpItemStack *stack);
GList * gimp_item_stack_get_item_list (GimpItemStack *stack);
GimpItem * gimp_item_stack_get_item_by_tattoo (GimpItemStack *stack,
GimpTattoo tattoo);
GimpItem * gimp_item_stack_get_item_by_path (GimpItemStack *stack,
GList *path);
GimpItem * gimp_item_stack_get_parent_by_path (GimpItemStack *stack,
GList *path,
gint *index);

View File

@ -302,9 +302,7 @@ gimp_item_tree_set_active_item (GimpItemTree *tree,
g_return_if_fail (item == NULL ||
G_TYPE_CHECK_INSTANCE_TYPE (item, private->item_type));
g_return_if_fail (item == NULL || gimp_item_is_attached (item));
g_return_if_fail (item == NULL ||
gimp_item_get_image (item) == private->image);
g_return_if_fail (item == NULL || gimp_item_get_tree (item) == tree);
if (item != private->active_item)
{
@ -349,11 +347,7 @@ gimp_item_tree_get_insert_pos (GimpItemTree *tree,
FALSE);
g_return_val_if_fail (*parent == NULL ||
*parent == GIMP_IMAGE_ACTIVE_PARENT ||
gimp_item_is_attached (*parent), FALSE);
g_return_val_if_fail (*parent == NULL ||
*parent == GIMP_IMAGE_ACTIVE_PARENT ||
gimp_item_get_image (*parent) == private->image,
FALSE);
gimp_item_get_tree (*parent) == tree, FALSE);
g_return_val_if_fail (*parent == NULL ||
*parent == GIMP_IMAGE_ACTIVE_PARENT ||
gimp_viewable_get_children (GIMP_VIEWABLE (*parent)),
@ -431,9 +425,7 @@ gimp_item_tree_add_item (GimpItemTree *tree,
g_return_if_fail (gimp_item_get_image (item) == private->image);
g_return_if_fail (parent == NULL ||
G_TYPE_CHECK_INSTANCE_TYPE (parent, private->item_type));
g_return_if_fail (parent == NULL || gimp_item_is_attached (parent));
g_return_if_fail (parent == NULL ||
gimp_item_get_image (parent) == private->image);
g_return_if_fail (parent == NULL || gimp_item_get_tree (parent) == tree);
g_return_if_fail (parent == NULL ||
gimp_viewable_get_children (GIMP_VIEWABLE (parent)));
@ -482,8 +474,7 @@ gimp_item_tree_remove_item (GimpItemTree *tree,
g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (item, private->item_type),
NULL);
g_return_val_if_fail (gimp_item_is_attached (item), NULL);
g_return_val_if_fail (gimp_item_get_image (item) == private->image, NULL);
g_return_val_if_fail (gimp_item_get_tree (item) == tree, NULL);
parent = gimp_item_get_parent (item);
container = gimp_item_get_container (item);
@ -557,17 +548,13 @@ gimp_item_tree_reorder_item (GimpItemTree *tree,
g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (item, private->item_type),
FALSE);
g_return_val_if_fail (gimp_item_is_attached (item), FALSE);
g_return_val_if_fail (gimp_item_get_image (item) == private->image, FALSE);
g_return_val_if_fail (gimp_item_get_tree (item) == tree, FALSE);
g_return_val_if_fail (new_parent == NULL ||
G_TYPE_CHECK_INSTANCE_TYPE (new_parent,
private->item_type),
FALSE);
g_return_val_if_fail (new_parent == NULL ||
gimp_item_is_attached (new_parent), FALSE);
g_return_val_if_fail (new_parent == NULL ||
gimp_item_get_image (new_parent) == private->image,
FALSE);
gimp_item_get_tree (new_parent) == tree, FALSE);
g_return_val_if_fail (new_parent == NULL ||
gimp_viewable_get_children (GIMP_VIEWABLE (new_parent)),
FALSE);
@ -633,8 +620,7 @@ gimp_item_tree_rename_item (GimpItemTree *tree,
private = GIMP_ITEM_TREE_GET_PRIVATE (tree);
g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (item, private->item_type));
g_return_if_fail (gimp_item_is_attached (item));
g_return_if_fail (gimp_item_get_image (item) == private->image);
g_return_if_fail (gimp_item_get_tree (item) == tree);
g_return_if_fail (new_name != NULL);
if (strcmp (new_name, gimp_object_get_name (item)))

View File

@ -36,6 +36,7 @@
#include "gegl/gimp-gegl-utils.h"
#include "gimpchannel-select.h"
#include "gimpcontext.h"
#include "gimpcontainer.h"
#include "gimpdrawable-convert.h"
@ -140,8 +141,14 @@ static void gimp_layer_transform (GimpItem *item,
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gint recursion_level,
GimpTransformResize clip_result,
GimpTransformResize clip_result,
GimpProgress *progress);
static void gimp_layer_to_selection (GimpItem *item,
GimpChannelOps op,
gboolean antialias,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y);
static GeglNode * gimp_layer_get_node (GimpItem *item);
static gint64 gimp_layer_estimate_memsize (const GimpDrawable *drawable,
@ -253,6 +260,7 @@ gimp_layer_class_init (GimpLayerClass *klass)
item_class->flip = gimp_layer_flip;
item_class->rotate = gimp_layer_rotate;
item_class->transform = gimp_layer_transform;
item_class->to_selection = gimp_layer_to_selection;
item_class->get_node = gimp_layer_get_node;
item_class->default_name = _("Layer");
item_class->rename_desc = C_("undo-type", "Rename Layer");
@ -262,6 +270,14 @@ gimp_layer_class_init (GimpLayerClass *klass)
item_class->flip_desc = C_("undo-type", "Flip Layer");
item_class->rotate_desc = C_("undo-type", "Rotate Layer");
item_class->transform_desc = C_("undo-type", "Transform Layer");
item_class->to_selection_desc = C_("undo-type", "Alpha to Selection");
item_class->reorder_desc = C_("undo-type", "Reorder Layer");
item_class->raise_desc = C_("undo-type", "Raise Layer");
item_class->raise_to_top_desc = C_("undo-type", "Raise Layer to Top");
item_class->lower_desc = C_("undo-type", "Lower Layer");
item_class->lower_to_bottom_desc = C_("undo-type", "Lower Layer to Bottom");
item_class->raise_failed = _("Layer cannot be raised higher.");
item_class->lower_failed = _("Layer cannot be lowered more.");
drawable_class->estimate_memsize = gimp_layer_estimate_memsize;
drawable_class->invalidate_boundary = gimp_layer_invalidate_boundary;
@ -746,6 +762,23 @@ gimp_layer_transform (GimpItem *item,
clip_result, progress);
}
static void
gimp_layer_to_selection (GimpItem *item,
GimpChannelOps op,
gboolean antialias,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y)
{
GimpLayer *layer = GIMP_LAYER (item);
GimpImage *image = gimp_item_get_image (item);
gimp_channel_select_alpha (gimp_image_get_mask (image),
GIMP_DRAWABLE (layer),
op,
feather, feather_radius_x, feather_radius_y);
}
static GeglNode *
gimp_layer_get_node (GimpItem *item)
{

View File

@ -108,6 +108,7 @@ gimp_layer_mask_class_init (GimpLayerMaskClass *klass)
item_class->duplicate = gimp_layer_mask_duplicate;
item_class->rename = gimp_layer_mask_rename;
item_class->translate_desc = C_("undo-type", "Move Layer Mask");
item_class->to_selection_desc = C_("undo-type", "Layer Mask to Selection");
}
static void

View File

@ -873,39 +873,34 @@ gimp_param_spec_item_id (const gchar *name,
const gchar *nick,
const gchar *blurb,
Gimp *gimp,
GType item_type,
gboolean none_ok,
GParamFlags flags)
{
GimpParamSpecItemID *ispec;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (g_type_is_a (item_type, GIMP_TYPE_ITEM), NULL);
ispec = g_param_spec_internal (GIMP_TYPE_PARAM_ITEM_ID,
name, nick, blurb, flags);
ispec->gimp = gimp;
ispec->item_type = item_type;
ispec->none_ok = none_ok;
ispec->gimp = gimp;
ispec->none_ok = none_ok;
return G_PARAM_SPEC (ispec);
}
GimpItem *
gimp_value_get_item (const GValue *value,
Gimp *gimp,
GType item_type)
Gimp *gimp)
{
GimpItem *item;
g_return_val_if_fail (GIMP_VALUE_HOLDS_ITEM_ID (value), NULL);
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (g_type_is_a (item_type, GIMP_TYPE_ITEM), NULL);
item = gimp_item_get_by_ID (gimp, value->data[0].v_int);
if (item && ! g_type_is_a (G_TYPE_FROM_INSTANCE (item), item_type))
if (item && ! GIMP_IS_ITEM (item))
return NULL;
return item;

View File

@ -278,13 +278,11 @@ GParamSpec * gimp_param_spec_item_id (const gchar *name,
const gchar *nick,
const gchar *blurb,
Gimp *gimp,
GType item_type,
gboolean none_ok,
GParamFlags flags);
GimpItem * gimp_value_get_item (const GValue *value,
Gimp *gimp,
GType item_type);
Gimp *gimp);
void gimp_value_set_item (GValue *value,
GimpItem *item);

View File

@ -421,6 +421,8 @@ gimp_tool_preset_new (GimpContext *context,
tool_info = gimp_context_get_tool (context);
g_return_val_if_fail (tool_info != NULL, NULL);
stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool_info));
return g_object_new (GIMP_TYPE_TOOL_PRESET,
@ -431,28 +433,6 @@ gimp_tool_preset_new (GimpContext *context,
NULL);
}
GimpData *
gimp_tool_preset_get_standard (GimpContext *context)
{
static GimpData *standard_tool_preset = NULL;
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
if (! standard_tool_preset)
{
standard_tool_preset = gimp_tool_preset_new (context,
"Standard tool preset");
gimp_data_clean (standard_tool_preset);
gimp_data_make_internal (standard_tool_preset, "gimp-tool-preset-standard");
g_object_add_weak_pointer (G_OBJECT (standard_tool_preset),
(gpointer *) &standard_tool_preset);
}
return standard_tool_preset;
}
GimpContextPropMask
gimp_tool_preset_get_prop_mask (GimpToolPreset *preset)
{

View File

@ -58,7 +58,6 @@ GType gimp_tool_preset_get_type (void) G_GNUC_CONST;
GimpData * gimp_tool_preset_new (GimpContext *context,
const gchar *name);
GimpData * gimp_tool_preset_get_standard (GimpContext *context);
GimpContextPropMask gimp_tool_preset_get_prop_mask (GimpToolPreset *preset);

View File

@ -263,18 +263,19 @@ about_dialog_anim_expose (GtkWidget *widget,
GimpAboutDialog *dialog)
{
GtkStyle *style = gtk_widget_get_style (widget);
cairo_t *cr;
GtkAllocation allocation;
GdkGC *text_gc;
gint x, y;
gint width, height;
if (! dialog->visible)
return FALSE;
cr = gdk_cairo_create (event->window);
gdk_cairo_set_source_color (cr, &style->text[GTK_STATE_NORMAL]);
gtk_widget_get_allocation (widget, &allocation);
text_gc = style->text_gc[GTK_STATE_NORMAL];
pango_layout_get_pixel_size (dialog->layout, &width, &height);
x = (allocation.width - width) / 2;
@ -282,26 +283,25 @@ about_dialog_anim_expose (GtkWidget *widget,
if (dialog->textrange[1] > 0)
{
GdkRegion *covered_region = NULL;
GdkRegion *rect_region;
GdkRegion *covered_region;
covered_region = gdk_pango_layout_get_clip_region (dialog->layout,
x, y,
dialog->textrange, 1);
rect_region = gdk_region_rectangle (&event->area);
gdk_region_intersect (covered_region, event->region);
gdk_region_intersect (covered_region, rect_region);
gdk_region_destroy (rect_region);
gdk_cairo_region (cr, covered_region);
cairo_clip (cr);
gdk_gc_set_clip_region (text_gc, covered_region);
gdk_region_destroy (covered_region);
}
gdk_draw_layout (gtk_widget_get_window (widget),
text_gc, x, y, dialog->layout);
cairo_move_to (cr, x, y);
gdk_gc_set_clip_region (text_gc, NULL);
pango_cairo_show_layout (cr, dialog->layout);
cairo_destroy (cr);
return FALSE;
}

View File

@ -90,7 +90,7 @@ static void prefs_message (GtkMessageType type,
const gchar *message);
static void prefs_notebook_page_callback (GtkNotebook *notebook,
GtkNotebookPage *page,
gpointer page,
guint page_num,
GtkTreeSelection *sel);
static void prefs_resolution_source_callback (GtkWidget *widget,
@ -801,7 +801,7 @@ prefs_tree_select_callback (GtkTreeSelection *sel,
static void
prefs_notebook_page_callback (GtkNotebook *notebook,
GtkNotebookPage *page,
gpointer page,
guint page_num,
GtkTreeSelection *sel)
{

View File

@ -71,6 +71,8 @@ libappdisplay_a_sources = \
gimpdisplayshell-scroll.h \
gimpdisplayshell-selection.c \
gimpdisplayshell-selection.h \
gimpdisplayshell-style.c \
gimpdisplayshell-style.h \
gimpdisplayshell-title.c \
gimpdisplayshell-title.h \
gimpdisplayshell-transform.c \

View File

@ -371,8 +371,6 @@ gimp_canvas_gc_new (GimpCanvas *canvas,
{
case GIMP_CANVAS_STYLE_BLACK:
case GIMP_CANVAS_STYLE_WHITE:
case GIMP_CANVAS_STYLE_SAMPLE_POINT_NORMAL:
case GIMP_CANVAS_STYLE_SAMPLE_POINT_ACTIVE:
break;
case GIMP_CANVAS_STYLE_RENDER:
@ -400,18 +398,12 @@ gimp_canvas_gc_new (GimpCanvas *canvas,
case GIMP_CANVAS_STYLE_SELECTION_IN:
case GIMP_CANVAS_STYLE_SELECTION_OUT:
case GIMP_CANVAS_STYLE_LAYER_BOUNDARY:
case GIMP_CANVAS_STYLE_LAYER_GROUP_BOUNDARY:
case GIMP_CANVAS_STYLE_GUIDE_NORMAL:
case GIMP_CANVAS_STYLE_GUIDE_ACTIVE:
case GIMP_CANVAS_STYLE_LAYER_MASK_ACTIVE:
mask |= GDK_GC_CAP_STYLE | GDK_GC_FILL | GDK_GC_STIPPLE;
values.cap_style = GDK_CAP_NOT_LAST;
values.fill = GDK_OPAQUE_STIPPLED;
values.stipple = canvas->stipple[0];
break;
case GIMP_CANVAS_STYLE_CUSTOM:
default:
return NULL;
}
@ -461,68 +453,6 @@ gimp_canvas_gc_new (GimpCanvas *canvas,
bg.green = 0x7f7f;
bg.blue = 0x7f7f;
break;
case GIMP_CANVAS_STYLE_LAYER_BOUNDARY:
fg.red = 0x0;
fg.green = 0x0;
fg.blue = 0x0;
bg.red = 0xffff;
bg.green = 0xffff;
bg.blue = 0x0;
break;
case GIMP_CANVAS_STYLE_LAYER_GROUP_BOUNDARY:
fg.red = 0x0;
fg.green = 0x0;
fg.blue = 0x0;
bg.red = 0x0;
bg.green = 0xffff;
bg.blue = 0xffff;
break;
case GIMP_CANVAS_STYLE_GUIDE_NORMAL:
fg.red = 0x0;
fg.green = 0x0;
fg.blue = 0x0;
bg.red = 0x0;
bg.green = 0x7f7f;
bg.blue = 0xffff;
break;
case GIMP_CANVAS_STYLE_GUIDE_ACTIVE:
fg.red = 0x0;
fg.green = 0x0;
fg.blue = 0x0;
bg.red = 0xffff;
bg.green = 0x0;
bg.blue = 0x0;
break;
case GIMP_CANVAS_STYLE_LAYER_MASK_ACTIVE:
fg.red = 0x0;
fg.green = 0x0;
fg.blue = 0x0;
bg.red = 0x0;
bg.green = 0xffff;
bg.blue = 0x0;
break;
case GIMP_CANVAS_STYLE_SAMPLE_POINT_NORMAL:
fg.red = 0x0;
fg.green = 0x7f7f;
fg.blue = 0xffff;
break;
case GIMP_CANVAS_STYLE_SAMPLE_POINT_ACTIVE:
fg.red = 0xffff;
fg.green = 0x0;
fg.blue = 0x0;
break;
}
gdk_gc_set_rgb_fg_color (gc, &fg);
@ -569,41 +499,6 @@ gimp_canvas_new (GimpDisplayConfig *config)
NULL);
}
/**
* gimp_canvas_draw_cursor:
* @canvas: the #GimpCanvas widget to draw on.
* @x: x coordinate
* @y: y coordinate
*
* Draws a plus-shaped black and white cursor, centered at the point
* @x, @y.
**/
void
gimp_canvas_draw_cursor (GimpCanvas *canvas,
gint x,
gint y)
{
GtkWidget *widget = GTK_WIDGET (canvas);
GdkWindow *window = gtk_widget_get_window (widget);
if (! (gimp_canvas_ensure_style (canvas, GIMP_CANVAS_STYLE_BLACK) &&
gimp_canvas_ensure_style (canvas, GIMP_CANVAS_STYLE_WHITE)) )
return;
gdk_draw_line (window, canvas->gc[GIMP_CANVAS_STYLE_WHITE],
x - 7, y - 1, x + 7, y - 1);
gdk_draw_line (window, canvas->gc[GIMP_CANVAS_STYLE_BLACK],
x - 7, y, x + 7, y );
gdk_draw_line (window, canvas->gc[GIMP_CANVAS_STYLE_WHITE],
x - 7, y + 1, x + 7, y + 1);
gdk_draw_line (window, canvas->gc[GIMP_CANVAS_STYLE_WHITE],
x - 1, y - 7, x - 1, y + 7);
gdk_draw_line (window, canvas->gc[GIMP_CANVAS_STYLE_BLACK],
x, y - 7, x, y + 7);
gdk_draw_line (window, canvas->gc[GIMP_CANVAS_STYLE_WHITE],
x + 1, y - 7, x + 1, y + 7);
}
/**
* gimp_canvas_draw_point:
* @canvas: a #GimpCanvas widget
@ -827,28 +722,24 @@ gimp_canvas_draw_segments (GimpCanvas *canvas,
/**
* gimp_canvas_draw_text:
* @canvas: a #GimpCanvas widget
* @style: one of the enumerated #GimpCanvasStyle's.
* @x: X coordinate of the left of the layout.
* @y: Y coordinate of the top of the layout.
* @format: a standard printf() format string.
* @Varargs: the parameters to insert into the format string.
*
* Draws a layout, in the specified style.
* Returns a layout which can be used for
* pango_cairo_show_layout(). The layout belongs to the canvas and
* should not be freed, not should a pointer to it be kept around
* after drawing.
*
* Returns: a #PangoLayout owned by the canvas.
**/
void
gimp_canvas_draw_text (GimpCanvas *canvas,
GimpCanvasStyle style,
gint x,
gint y,
const gchar *format,
...)
PangoLayout *
gimp_canvas_get_layout (GimpCanvas *canvas,
const gchar *format,
...)
{
va_list args;
gchar *text;
if (! gimp_canvas_ensure_style (canvas, style))
return;
if (! canvas->layout)
canvas->layout = gtk_widget_create_pango_layout (GTK_WIDGET (canvas),
NULL);
@ -860,9 +751,7 @@ gimp_canvas_draw_text (GimpCanvas *canvas,
pango_layout_set_text (canvas->layout, text, -1);
g_free (text);
gdk_draw_layout (gtk_widget_get_window (GTK_WIDGET (canvas)),
canvas->gc[style],
x, y, canvas->layout);
return canvas->layout;
}
/**
@ -1030,32 +919,6 @@ gimp_canvas_set_stipple_index (GimpCanvas *canvas,
gdk_gc_set_stipple (canvas->gc[style], canvas->stipple[index]);
}
/**
* gimp_canvas_set_custom_gc:
* @canvas: a #GimpCanvas widget
* @gc: a #GdkGC;
*
* The #GimpCanvas widget has an extra style for a custom #GdkGC. This
* function allows you to set the @gc for the %GIMP_CANVAS_STYLE_CUSTOM.
* Drawing with the custom style only works if you set a #GdkGC
* earlier. Since the custom #GdkGC can under certain circumstances
* be destroyed by #GimpCanvas, you should always set the custom gc
* before calling a #GimpCanvas drawing function with
* %GIMP_CANVAS_STYLE_CUSTOM.
**/
void
gimp_canvas_set_custom_gc (GimpCanvas *canvas,
GdkGC *gc)
{
if (gc)
g_object_ref (gc);
if (canvas->gc[GIMP_CANVAS_STYLE_CUSTOM])
g_object_unref (canvas->gc[GIMP_CANVAS_STYLE_CUSTOM]);
canvas->gc[GIMP_CANVAS_STYLE_CUSTOM] = gc;
}
/**
* gimp_canvas_set_bg_color:
* @canvas: a #GimpCanvas widget

View File

@ -32,14 +32,6 @@ typedef enum
GIMP_CANVAS_STYLE_XOR_DOTTED,
GIMP_CANVAS_STYLE_SELECTION_IN,
GIMP_CANVAS_STYLE_SELECTION_OUT,
GIMP_CANVAS_STYLE_LAYER_BOUNDARY,
GIMP_CANVAS_STYLE_LAYER_GROUP_BOUNDARY,
GIMP_CANVAS_STYLE_GUIDE_NORMAL,
GIMP_CANVAS_STYLE_GUIDE_ACTIVE,
GIMP_CANVAS_STYLE_SAMPLE_POINT_NORMAL,
GIMP_CANVAS_STYLE_SAMPLE_POINT_ACTIVE,
GIMP_CANVAS_STYLE_LAYER_MASK_ACTIVE,
GIMP_CANVAS_STYLE_CUSTOM,
GIMP_CANVAS_NUM_STYLES
} GimpCanvasStyle;
@ -90,9 +82,6 @@ GType gimp_canvas_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_canvas_new (GimpDisplayConfig *config);
void gimp_canvas_draw_cursor (GimpCanvas *canvas,
gint x,
gint y);
void gimp_canvas_draw_point (GimpCanvas *canvas,
GimpCanvasStyle style,
gint x,
@ -136,12 +125,9 @@ void gimp_canvas_draw_segments (GimpCanvas *canvas,
GimpCanvasStyle style,
GdkSegment *segments,
gint num_segments);
void gimp_canvas_draw_text (GimpCanvas *canvas,
GimpCanvasStyle style,
gint x,
gint y,
PangoLayout *gimp_canvas_get_layout (GimpCanvas *canvas,
const gchar *format,
...) G_GNUC_PRINTF (5, 6);
...) G_GNUC_PRINTF (2, 3);
void gimp_canvas_draw_rgb (GimpCanvas *canvas,
GimpCanvasStyle style,
gint x,
@ -164,8 +150,6 @@ void gimp_canvas_set_clip_region (GimpCanvas *canvas,
void gimp_canvas_set_stipple_index (GimpCanvas *canvas,
GimpCanvasStyle style,
guint index);
void gimp_canvas_set_custom_gc (GimpCanvas *canvas,
GdkGC *gc);
void gimp_canvas_set_bg_color (GimpCanvas *canvas,
GimpRGB *color);

View File

@ -2216,6 +2216,7 @@ static void
gimp_display_shell_canvas_expose_image (GimpDisplayShell *shell,
GdkEventExpose *eevent)
{
cairo_t *cr;
GdkRegion *clear_region;
GdkRegion *image_region;
GdkRectangle image_rect;
@ -2223,6 +2224,11 @@ gimp_display_shell_canvas_expose_image (GimpDisplayShell *shell,
gint n_rects;
gint i;
cr = gdk_cairo_create (eevent->window);
gdk_cairo_region (cr, eevent->region);
cairo_clip (cr);
/* first, clear the exposed part of the region that is outside the
* image, which is the exposed region minus the image rectangle
*/
@ -2286,19 +2292,29 @@ gimp_display_shell_canvas_expose_image (GimpDisplayShell *shell,
gimp_display_shell_preview_transform (shell);
/* draw the grid */
gimp_display_shell_draw_grid (shell, eevent->region);
cairo_save (cr);
gimp_display_shell_draw_grid (shell, cr);
cairo_restore (cr);
/* draw the guides */
gimp_display_shell_draw_guides (shell, eevent->region);
cairo_save (cr);
gimp_display_shell_draw_guides (shell, cr);
cairo_restore (cr);
/* draw the sample points */
gimp_display_shell_draw_sample_points (shell, eevent->region);
cairo_save (cr);
gimp_display_shell_draw_sample_points (shell, cr);
cairo_restore (cr);
/* and the cursor (if we have a software cursor) */
gimp_display_shell_draw_cursor (shell);
cairo_save (cr);
gimp_display_shell_draw_cursor (shell, cr);
cairo_restore (cr);
/* restart (and recalculate) the selection boundaries */
gimp_display_shell_selection_control (shell, GIMP_SELECTION_ON);
cairo_destroy (cr);
}
static void

View File

@ -146,17 +146,25 @@ gimp_display_shell_update_cursor (GimpDisplayShell *shell,
display_y != shell->cursor_y))
{
gimp_display_shell_expose_area (shell,
shell->cursor_x - 7,
shell->cursor_y - 7,
15, 15);
if (! new_cursor)
shell->have_cursor = FALSE;
shell->cursor_x - GIMP_CURSOR_SIZE,
shell->cursor_y - GIMP_CURSOR_SIZE,
2 * GIMP_CURSOR_SIZE + 1,
2 * GIMP_CURSOR_SIZE + 1);
}
shell->have_cursor = new_cursor;
shell->cursor_x = display_x;
shell->cursor_y = display_y;
if (shell->have_cursor)
{
gimp_display_shell_expose_area (shell,
shell->cursor_x - GIMP_CURSOR_SIZE,
shell->cursor_y - GIMP_CURSOR_SIZE,
2 * GIMP_CURSOR_SIZE + 1,
2 * GIMP_CURSOR_SIZE + 1);
}
/* use the passed image_coords for the statusbar because they are
* possibly snapped...
*/

View File

@ -19,6 +19,9 @@
#define __GIMP_DISPLAY_SHELL_CURSOR_H__
#define GIMP_CURSOR_SIZE 7
void gimp_display_shell_set_cursor (GimpDisplayShell *shell,
GimpCursorType cursor_type,
GimpToolCursorType tool_cursor,

View File

@ -26,9 +26,11 @@
#include "display-types.h"
#include "base/boundary.h"
#include "base/tile-manager.h"
#include "core/gimpcontext.h"
#include "core/gimpdrawable.h"
#include "core/gimpgrid.h"
#include "core/gimpguide.h"
#include "core/gimpimage.h"
@ -47,22 +49,15 @@
#include "gimpdisplay.h"
#include "gimpdisplayshell.h"
#include "gimpdisplayshell-appearance.h"
#include "gimpdisplayshell-cursor.h"
#include "gimpdisplayshell-draw.h"
#include "gimpdisplayshell-render.h"
#include "gimpdisplayshell-scale.h"
#include "gimpdisplayshell-scroll.h"
#include "gimpdisplayshell-style.h"
#include "gimpdisplayshell-transform.h"
/* local function prototypes */
static GdkGC * gimp_display_shell_get_grid_gc (GimpDisplayShell *shell,
GimpGrid *grid);
static GdkGC * gimp_display_shell_get_pen_gc (GimpDisplayShell *shell,
GimpContext *context,
GimpActiveColor active);
/* public functions */
/**
@ -133,120 +128,104 @@ gimp_display_shell_draw_get_scaled_image_size_for_scale (GimpDisplayShell *shell
void
gimp_display_shell_draw_guide (GimpDisplayShell *shell,
cairo_t *cr,
GimpGuide *guide,
const GdkRectangle *area,
gboolean active)
{
gint position;
gint x1, y1, x2, y2;
gint x, y;
gint position;
gdouble dx1, dy1, dx2, dy2;
gint x1, y1, x2, y2;
gint x, y;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (cr != NULL);
g_return_if_fail (GIMP_IS_GUIDE (guide));
position = gimp_guide_get_position (guide);
if (position < 0)
return;
x1 = 0;
y1 = 0;
cairo_clip_extents (cr, &dx1, &dy1, &dx2, &dy2);
gdk_drawable_get_size (gtk_widget_get_window (shell->canvas), &x2, &y2);
x1 = floor (dx1);
y1 = floor (dy1);
x2 = ceil (dx2);
y2 = ceil (dy2);
gimp_display_shell_set_guide_style (shell, cr, active);
switch (gimp_guide_get_orientation (guide))
{
case GIMP_ORIENTATION_HORIZONTAL:
gimp_display_shell_transform_xy (shell, 0, position, &x, &y, FALSE);
if (area && (y < area->y || y >= area->y + area->height))
return;
if (y < y1 || y >= y2)
return;
y1 = y2 = y;
if (y >= y1 && y < y2)
{
cairo_move_to (cr, x1, y + 0.5);
cairo_line_to (cr, x2, y + 0.5);
}
break;
case GIMP_ORIENTATION_VERTICAL:
gimp_display_shell_transform_xy (shell, position, 0, &x, &y, FALSE);
if (area && (x < area->x || x >= area->x + area->width))
return;
if (x < x1 || x >= x2)
return;
x1 = x2 = x;
if (x >= x1 && x < x2)
{
cairo_move_to (cr, x + 0.5, y1);
cairo_line_to (cr, x + 0.5, y2);
}
break;
case GIMP_ORIENTATION_UNKNOWN:
return;
}
gimp_canvas_draw_line (GIMP_CANVAS (shell->canvas),
(active ?
GIMP_CANVAS_STYLE_GUIDE_ACTIVE :
GIMP_CANVAS_STYLE_GUIDE_NORMAL), x1, y1, x2, y2);
cairo_stroke (cr);
}
void
gimp_display_shell_draw_guides (GimpDisplayShell *shell,
const GdkRegion *region)
cairo_t *cr)
{
GimpImage *image;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (region != NULL);
g_return_if_fail (cr != NULL);
image = gimp_display_get_image (shell->display);
if (image && gimp_display_shell_get_show_guides (shell))
{
GdkRectangle area;
GList *list;
if (region)
{
gimp_canvas_set_clip_region (GIMP_CANVAS (shell->canvas),
GIMP_CANVAS_STYLE_GUIDE_NORMAL,
region);
gdk_region_get_clipbox (region, &area);
}
GList *list;
for (list = gimp_image_get_guides (image);
list;
list = g_list_next (list))
{
gimp_display_shell_draw_guide (shell, list->data,
region ? &area : NULL,
FALSE);
gimp_display_shell_draw_guide (shell, cr, list->data, FALSE);
}
if (region)
gimp_canvas_set_clip_region (GIMP_CANVAS (shell->canvas),
GIMP_CANVAS_STYLE_GUIDE_NORMAL,
NULL);
}
}
void
gimp_display_shell_draw_grid (GimpDisplayShell *shell,
const GdkRegion *region)
cairo_t *cr)
{
GimpImage *image;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (region != NULL);
g_return_if_fail (cr != NULL);
image = gimp_display_get_image (shell->display);
if (image && gimp_display_shell_get_show_grid (shell))
{
GimpCanvas *canvas = GIMP_CANVAS (shell->canvas);
GimpGrid *grid;
GdkRectangle area;
GdkGC *grid_gc;
gdouble x, y;
gint x0, x1, x2, x3;
gint y0, y1, y2, y3;
gint x_real, y_real;
gdouble x_offset, y_offset;
gint width, height;
GimpGrid *grid;
gdouble x, y;
gdouble dx1, dy1, dx2, dy2;
gint x0, x1, x2, x3;
gint y0, y1, y2, y3;
gint x_real, y_real;
gdouble x_offset, y_offset;
gint width, height;
#define CROSSHAIR 2
@ -256,12 +235,12 @@ gimp_display_shell_draw_grid (GimpDisplayShell *shell,
g_return_if_fail (grid->xspacing > 0 && grid->yspacing > 0);
gdk_region_get_clipbox (region, &area);
cairo_clip_extents (cr, &dx1, &dy1, &dx2, &dy2);
x1 = area.x;
y1 = area.y;
x2 = area.x + area.width;
y2 = area.y + area.height;
x1 = floor (dx1);
y1 = floor (dy1);
x2 = ceil (dx2);
y2 = ceil (dy2);
width = gimp_image_get_width (image);
height = gimp_image_get_height (image);
@ -274,10 +253,7 @@ gimp_display_shell_draw_grid (GimpDisplayShell *shell,
while (y_offset > 0)
y_offset -= grid->yspacing;
grid_gc = gimp_display_shell_get_grid_gc (shell, grid);
gdk_gc_set_clip_region (grid_gc, region);
gimp_canvas_set_custom_gc (canvas, grid_gc);
gimp_display_shell_set_grid_style (shell, cr, grid);
switch (grid->style)
{
@ -304,9 +280,10 @@ gimp_display_shell_draw_grid (GimpDisplayShell *shell,
FALSE);
if (y_real >= y1 && y_real < y2)
gimp_canvas_draw_point (GIMP_CANVAS (shell->canvas),
GIMP_CANVAS_STYLE_CUSTOM,
x_real, y_real);
{
cairo_move_to (cr, x_real, y_real + 0.5);
cairo_line_to (cr, x_real + 1, y_real + 0.5);
}
}
}
break;
@ -337,21 +314,28 @@ gimp_display_shell_draw_grid (GimpDisplayShell *shell,
continue;
if (x_real >= x1 && x_real < x2)
gimp_canvas_draw_line (canvas, GIMP_CANVAS_STYLE_CUSTOM,
x_real,
CLAMP (y_real - CROSSHAIR,
y1, y2 - 1),
x_real,
CLAMP (y_real + CROSSHAIR,
y1, y2 - 1));
{
cairo_move_to (cr,
x_real + 0.5,
CLAMP (y_real - CROSSHAIR,
y1, y2 - 1));
cairo_line_to (cr,
x_real + 0.5,
CLAMP (y_real + CROSSHAIR,
y1, y2 - 1) + 1);
}
if (y_real >= y1 && y_real < y2)
gimp_canvas_draw_line (canvas, GIMP_CANVAS_STYLE_CUSTOM,
CLAMP (x_real - CROSSHAIR,
x1, x2 - 1),
y_real,
CLAMP (x_real + CROSSHAIR,
x1, x2 - 1),
y_real);
{
cairo_move_to (cr,
CLAMP (x_real - CROSSHAIR,
x1, x2 - 1),
y_real + 0.5);
cairo_line_to (cr,
CLAMP (x_real + CROSSHAIR,
x1, x2 - 1) + 1,
y_real + 0.5);
}
}
}
break;
@ -376,8 +360,10 @@ gimp_display_shell_draw_grid (GimpDisplayShell *shell,
FALSE);
if (x_real >= x1 && x_real < x2)
gimp_canvas_draw_line (canvas, GIMP_CANVAS_STYLE_CUSTOM,
x_real, y0, x_real, y3 - 1);
{
cairo_move_to (cr, x_real + 0.5, y0);
cairo_line_to (cr, x_real + 0.5, y3 + 1);
}
}
for (y = y_offset; y < height; y += grid->yspacing)
@ -390,75 +376,77 @@ gimp_display_shell_draw_grid (GimpDisplayShell *shell,
FALSE);
if (y_real >= y1 && y_real < y2)
gimp_canvas_draw_line (canvas, GIMP_CANVAS_STYLE_CUSTOM,
x0, y_real, x3 - 1, y_real);
{
cairo_move_to (cr, x0, y_real + 0.5);
cairo_line_to (cr, x3 + 1, y_real + 0.5);
}
}
break;
}
gimp_canvas_set_custom_gc (canvas, NULL);
gdk_gc_set_clip_region (grid_gc, NULL);
cairo_stroke (cr);
}
}
void
gimp_display_shell_draw_pen (GimpDisplayShell *shell,
cairo_t *cr,
const GimpVector2 *points,
gint num_points,
gint n_points,
GimpContext *context,
GimpActiveColor color,
gint width)
{
GimpCanvas *canvas;
GdkGC *gc;
GdkGCValues values;
GdkPoint *coords;
gint i;
gint x, y;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (cr != NULL);
g_return_if_fail (GIMP_IS_CONTEXT (context));
g_return_if_fail (num_points == 0 || points != NULL);
g_return_if_fail (n_points == 0 || points != NULL);
canvas = GIMP_CANVAS (shell->canvas);
if (n_points == 0)
return;
coords = g_new (GdkPoint, MAX (2, num_points));
gimp_display_shell_set_pen_style (shell, cr, context, color, width);
cairo_translate (cr, 0.5, 0.5);
gimp_display_shell_transform_points (shell,
points, coords, num_points, FALSE);
gimp_display_shell_transform_xy (shell,
points[0].x, points[0].y,
&x, &y, FALSE);
if (num_points == 1)
cairo_move_to (cr, x, y);
for (i = 1; i < n_points; i++)
{
coords[1] = coords[0];
num_points = 2;
gimp_display_shell_transform_xy (shell,
points[i].x, points[i].y,
&x, &y, FALSE);
cairo_line_to (cr, x, y);
}
gc = gimp_display_shell_get_pen_gc (shell, context, color);
if (i == 1)
cairo_line_to (cr, x, y);
values.line_width = MAX (1, width);
gdk_gc_set_values (gc, &values, GDK_GC_LINE_WIDTH);
gimp_canvas_set_custom_gc (canvas, gc);
gimp_canvas_draw_lines (canvas, GIMP_CANVAS_STYLE_CUSTOM, coords, num_points);
gimp_canvas_set_custom_gc (canvas, NULL);
g_free (coords);
cairo_stroke (cr);
}
void
gimp_display_shell_draw_sample_point (GimpDisplayShell *shell,
cairo_t *cr,
GimpSamplePoint *sample_point,
const GdkRectangle *area,
gboolean active)
{
GimpImage *image;
GimpCanvasStyle style;
gdouble x, y;
gint x1, x2;
gint y1, y2;
gint w, h;
GimpImage *image;
gdouble dx1, dy1, dx2, dy2;
gint x1, x2, y1, y2;
gint sx1, sx2, sy1, sy2;
gdouble x, y;
PangoLayout *layout;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (cr != NULL);
g_return_if_fail (sample_point != NULL);
if (sample_point->x < 0)
@ -466,101 +454,181 @@ gimp_display_shell_draw_sample_point (GimpDisplayShell *shell,
image = gimp_display_get_image (shell->display);
cairo_clip_extents (cr, &dx1, &dy1, &dx2, &dy2);
x1 = floor (dx1);
y1 = floor (dy1);
x2 = ceil (dx2);
y2 = ceil (dy2);
gimp_display_shell_transform_xy_f (shell,
sample_point->x + 0.5,
sample_point->y + 0.5,
&x, &y, FALSE);
x1 = floor (x - GIMP_SAMPLE_POINT_DRAW_SIZE);
x2 = ceil (x + GIMP_SAMPLE_POINT_DRAW_SIZE);
y1 = floor (y - GIMP_SAMPLE_POINT_DRAW_SIZE);
y2 = ceil (y + GIMP_SAMPLE_POINT_DRAW_SIZE);
sx1 = floor (x - GIMP_SAMPLE_POINT_DRAW_SIZE);
sx2 = ceil (x + GIMP_SAMPLE_POINT_DRAW_SIZE);
sy1 = floor (y - GIMP_SAMPLE_POINT_DRAW_SIZE);
sy2 = ceil (y + GIMP_SAMPLE_POINT_DRAW_SIZE);
gdk_drawable_get_size (gtk_widget_get_window (shell->canvas), &w, &h);
if (x < - GIMP_SAMPLE_POINT_DRAW_SIZE ||
y < - GIMP_SAMPLE_POINT_DRAW_SIZE ||
x > w + GIMP_SAMPLE_POINT_DRAW_SIZE ||
y > h + GIMP_SAMPLE_POINT_DRAW_SIZE)
if (sx1 > x2 ||
sx2 < x1 ||
sy1 > y2 ||
sy2 < y1)
return;
if (area && (x + GIMP_SAMPLE_POINT_DRAW_SIZE < area->x ||
y + GIMP_SAMPLE_POINT_DRAW_SIZE < area->y ||
x - GIMP_SAMPLE_POINT_DRAW_SIZE >= area->x + area->width ||
y - GIMP_SAMPLE_POINT_DRAW_SIZE >= area->y + area->height))
return;
if (active)
style = GIMP_CANVAS_STYLE_SAMPLE_POINT_ACTIVE;
else
style = GIMP_CANVAS_STYLE_SAMPLE_POINT_NORMAL;
gimp_display_shell_set_sample_point_style (shell, cr, active);
#define HALF_SIZE (GIMP_SAMPLE_POINT_DRAW_SIZE / 2)
gimp_canvas_draw_line (GIMP_CANVAS (shell->canvas), style,
x, y1, x, y1 + HALF_SIZE);
gimp_canvas_draw_line (GIMP_CANVAS (shell->canvas), style,
x, y2 - HALF_SIZE, x, y2);
cairo_move_to (cr, x + 0.5, sy1);
cairo_line_to (cr, x + 0.5, sy1 + HALF_SIZE);
gimp_canvas_draw_line (GIMP_CANVAS (shell->canvas), style,
x1, y, x1 + HALF_SIZE, y);
gimp_canvas_draw_line (GIMP_CANVAS (shell->canvas), style,
x2 - HALF_SIZE, y, x2, y);
cairo_move_to (cr, x + 0.5, sy2);
cairo_line_to (cr, x + 0.5, sy2 - HALF_SIZE);
gimp_canvas_draw_arc (GIMP_CANVAS (shell->canvas), style,
FALSE,
x - HALF_SIZE, y - HALF_SIZE,
GIMP_SAMPLE_POINT_DRAW_SIZE,
GIMP_SAMPLE_POINT_DRAW_SIZE,
0, 64 * 270);
cairo_move_to (cr, sx1, y + 0.5);
cairo_line_to (cr, sx1 + HALF_SIZE, y + 0.5);
gimp_canvas_draw_text (GIMP_CANVAS (shell->canvas), style,
x + 2, y + 2,
"%d",
g_list_index (gimp_image_get_sample_points (image),
sample_point) + 1);
cairo_move_to (cr, sx2, y + 0.5);
cairo_line_to (cr, sx2 - HALF_SIZE, y + 0.5);
cairo_arc_negative (cr, x + 0.5, y + 0.5, HALF_SIZE, 0.0, 0.5 * G_PI);
cairo_stroke (cr);
layout =
gimp_canvas_get_layout (GIMP_CANVAS (shell->canvas),
"%d",
g_list_index (gimp_image_get_sample_points (image),
sample_point) + 1);
cairo_move_to (cr, x + 2, y + 2);
pango_cairo_show_layout (cr, layout);
cairo_fill (cr);
}
void
gimp_display_shell_draw_sample_points (GimpDisplayShell *shell,
const GdkRegion *region)
cairo_t *cr)
{
GimpImage *image;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (region != NULL);
g_return_if_fail (cr != NULL);
image = gimp_display_get_image (shell->display);
if (image && gimp_display_shell_get_show_sample_points (shell))
{
GdkRectangle area;
GList *list;
if (region)
{
gimp_canvas_set_clip_region (GIMP_CANVAS (shell->canvas),
GIMP_CANVAS_STYLE_SAMPLE_POINT_NORMAL,
region);
gdk_region_get_clipbox (region, &area);
}
GList *list;
for (list = gimp_image_get_sample_points (image);
list;
list = g_list_next (list))
{
gimp_display_shell_draw_sample_point (shell, list->data,
region ? &area : NULL,
FALSE);
gimp_display_shell_draw_sample_point (shell, cr, list->data, FALSE);
}
if (region)
gimp_canvas_set_clip_region (GIMP_CANVAS (shell->canvas),
GIMP_CANVAS_STYLE_SAMPLE_POINT_NORMAL,
region);
}
}
void
gimp_display_shell_draw_layer_boundary (GimpDisplayShell *shell,
cairo_t *cr,
GimpDrawable *drawable,
GdkSegment *segs,
gint n_segs)
{
gint i;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (cr != NULL);
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (segs != NULL && n_segs == 4);
gimp_display_shell_set_layer_style (shell, cr, drawable);
for (i = 0; i < n_segs; i++)
{
if (segs[i].x1 == segs[i].x2)
{
cairo_move_to (cr, segs[i].x1 + 0.5, segs[i].y1);
cairo_line_to (cr, segs[i].x2 + 0.5, segs[i].y2);
}
else
{
cairo_move_to (cr, segs[i].x1, segs[i].y1 + 0.5);
cairo_line_to (cr, segs[i].x2, segs[i].y2 + 0.5);
}
}
cairo_stroke (cr);
}
void
gimp_display_shell_draw_selection_out (GimpDisplayShell *shell,
cairo_t *cr,
GdkSegment *segs,
gint n_segs)
{
gint i;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (cr != NULL);
g_return_if_fail (segs != NULL && n_segs > 0);
gimp_display_shell_set_selection_out_style (shell, cr);
for (i = 0; i < n_segs; i++)
{
if (segs[i].x1 == segs[i].x2)
{
cairo_move_to (cr, segs[i].x1 + 0.5, segs[i].y1);
cairo_line_to (cr, segs[i].x2 + 0.5, segs[i].y2);
}
else
{
cairo_move_to (cr, segs[i].x1, segs[i].y1 + 0.5);
cairo_line_to (cr, segs[i].x2, segs[i].y2 + 0.5);
}
}
cairo_stroke (cr);
}
void
gimp_display_shell_draw_selection_in (GimpDisplayShell *shell,
cairo_t *cr,
GdkSegment *segs,
gint n_segs,
gint index)
{
gint i;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (cr != NULL);
g_return_if_fail (segs != NULL && n_segs > 0);
gimp_display_shell_set_selection_in_style (shell, cr, index);
for (i = 0; i < n_segs; i++)
{
if (segs[i].x1 == segs[i].x2)
{
cairo_move_to (cr, segs[i].x1 + 0.5, segs[i].y1);
cairo_line_to (cr, segs[i].x2 + 0.5, segs[i].y2);
}
else
{
cairo_move_to (cr, segs[i].x1, segs[i].y1 + 0.5);
cairo_line_to (cr, segs[i].x2, segs[i].y2 + 0.5);
}
}
cairo_stroke (cr);
}
void
gimp_display_shell_draw_vector (GimpDisplayShell *shell,
GimpVectors *vectors)
@ -629,13 +697,43 @@ gimp_display_shell_draw_vectors (GimpDisplayShell *shell)
}
void
gimp_display_shell_draw_cursor (GimpDisplayShell *shell)
gimp_display_shell_draw_cursor (GimpDisplayShell *shell,
cairo_t *cr)
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (cr != NULL);
if (shell->have_cursor)
gimp_canvas_draw_cursor (GIMP_CANVAS (shell->canvas),
shell->cursor_x, shell->cursor_y);
{
gimp_display_shell_set_cursor_style (shell, cr);
cairo_translate (cr, 0.5, 0.5);
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
cairo_move_to (cr, shell->cursor_x - GIMP_CURSOR_SIZE, shell->cursor_y - 1);
cairo_line_to (cr, shell->cursor_x + GIMP_CURSOR_SIZE, shell->cursor_y - 1);
cairo_move_to (cr, shell->cursor_x - GIMP_CURSOR_SIZE, shell->cursor_y + 1);
cairo_line_to (cr, shell->cursor_x + GIMP_CURSOR_SIZE, shell->cursor_y + 1);
cairo_move_to (cr, shell->cursor_x - 1, shell->cursor_y - GIMP_CURSOR_SIZE);
cairo_line_to (cr, shell->cursor_x - 1, shell->cursor_y + GIMP_CURSOR_SIZE);
cairo_move_to (cr, shell->cursor_x + 1, shell->cursor_y - GIMP_CURSOR_SIZE);
cairo_line_to (cr, shell->cursor_x + 1, shell->cursor_y + GIMP_CURSOR_SIZE);
cairo_stroke (cr);
cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
cairo_move_to (cr, shell->cursor_x - GIMP_CURSOR_SIZE, shell->cursor_y);
cairo_line_to (cr, shell->cursor_x + GIMP_CURSOR_SIZE, shell->cursor_y);
cairo_move_to (cr, shell->cursor_x, shell->cursor_y - GIMP_CURSOR_SIZE);
cairo_line_to (cr, shell->cursor_x, shell->cursor_y + GIMP_CURSOR_SIZE);
cairo_stroke (cr);
}
}
void
@ -688,93 +786,3 @@ gimp_display_shell_draw_area (GimpDisplayShell *shell,
}
}
}
/* private functions */
static GdkGC *
gimp_display_shell_get_grid_gc (GimpDisplayShell *shell,
GimpGrid *grid)
{
GdkGCValues values;
GdkColor fg, bg;
if (shell->grid_gc)
return shell->grid_gc;
switch (grid->style)
{
case GIMP_GRID_ON_OFF_DASH:
values.line_style = GDK_LINE_ON_OFF_DASH;
break;
case GIMP_GRID_DOUBLE_DASH:
values.line_style = GDK_LINE_DOUBLE_DASH;
break;
case GIMP_GRID_DOTS:
case GIMP_GRID_INTERSECTIONS:
case GIMP_GRID_SOLID:
values.line_style = GDK_LINE_SOLID;
break;
}
values.join_style = GDK_JOIN_MITER;
shell->grid_gc = gdk_gc_new_with_values (gtk_widget_get_window (shell->canvas),
&values, (GDK_GC_LINE_STYLE |
GDK_GC_JOIN_STYLE));
gimp_rgb_get_gdk_color (&grid->fgcolor, &fg);
gdk_gc_set_rgb_fg_color (shell->grid_gc, &fg);
gimp_rgb_get_gdk_color (&grid->bgcolor, &bg);
gdk_gc_set_rgb_bg_color (shell->grid_gc, &bg);
return shell->grid_gc;
}
static GdkGC *
gimp_display_shell_get_pen_gc (GimpDisplayShell *shell,
GimpContext *context,
GimpActiveColor active)
{
GdkGCValues values;
GimpRGB rgb;
GdkColor color;
if (shell->pen_gc)
return shell->pen_gc;
values.line_style = GDK_LINE_SOLID;
values.cap_style = GDK_CAP_ROUND;
values.join_style = GDK_JOIN_ROUND;
shell->pen_gc = gdk_gc_new_with_values (gtk_widget_get_window (shell->canvas),
&values, (GDK_GC_LINE_STYLE |
GDK_GC_CAP_STYLE |
GDK_GC_JOIN_STYLE));
switch (active)
{
case GIMP_ACTIVE_COLOR_FOREGROUND:
gimp_context_get_foreground (context, &rgb);
break;
case GIMP_ACTIVE_COLOR_BACKGROUND:
gimp_context_get_background (context, &rgb);
break;
}
gimp_rgb_get_gdk_color (&rgb, &color);
gdk_gc_set_rgb_fg_color (shell->pen_gc, &color);
g_object_add_weak_pointer (G_OBJECT (shell->pen_gc),
(gpointer) &shell->pen_gc);
g_signal_connect_object (context, "notify",
G_CALLBACK (g_object_unref),
shell->pen_gc, G_CONNECT_SWAPPED);
return shell->pen_gc;
}

View File

@ -28,29 +28,45 @@ void gimp_display_shell_draw_get_scaled_image_size_for_scale
gint *w,
gint *h);
void gimp_display_shell_draw_guide (GimpDisplayShell *shell,
cairo_t *cr,
GimpGuide *guide,
const GdkRectangle *area,
gboolean active);
void gimp_display_shell_draw_guides (GimpDisplayShell *shell,
const GdkRegion *region);
cairo_t *cr);
void gimp_display_shell_draw_grid (GimpDisplayShell *shell,
const GdkRegion *region);
cairo_t *cr);
void gimp_display_shell_draw_pen (GimpDisplayShell *shell,
cairo_t *cr,
const GimpVector2 *points,
gint num_points,
gint n_points,
GimpContext *context,
GimpActiveColor color,
gint width);
void gimp_display_shell_draw_sample_point (GimpDisplayShell *shell,
cairo_t *cr,
GimpSamplePoint *sample_point,
const GdkRectangle *area,
gboolean active);
void gimp_display_shell_draw_sample_points (GimpDisplayShell *shell,
const GdkRegion *region);
cairo_t *cr);
void gimp_display_shell_draw_layer_boundary (GimpDisplayShell *shell,
cairo_t *cr,
GimpDrawable *drawable,
GdkSegment *segs,
gint n_segs);
void gimp_display_shell_draw_selection_out (GimpDisplayShell *shell,
cairo_t *cr,
GdkSegment *segs,
gint n_segs);
void gimp_display_shell_draw_selection_in (GimpDisplayShell *shell,
cairo_t *cr,
GdkSegment *segs,
gint n_segs,
gint index);
void gimp_display_shell_draw_vector (GimpDisplayShell *shell,
GimpVectors *vectors);
void gimp_display_shell_draw_vectors (GimpDisplayShell *shell);
void gimp_display_shell_draw_cursor (GimpDisplayShell *shell);
void gimp_display_shell_draw_cursor (GimpDisplayShell *shell,
cairo_t *cr);
void gimp_display_shell_draw_area (GimpDisplayShell *shell,
gint x,
gint y,

View File

@ -304,18 +304,6 @@ gimp_display_shell_disconnect (GimpDisplayShell *shell)
gimp_display_shell_icon_update_stop (shell);
if (shell->grid_gc)
{
g_object_unref (shell->grid_gc);
shell->grid_gc = NULL;
}
if (shell->pen_gc)
{
g_object_unref (shell->pen_gc);
shell->pen_gc = NULL;
}
g_signal_handlers_disconnect_by_func (shell->display->config,
gimp_display_shell_quality_notify_handler,
shell);
@ -426,12 +414,6 @@ gimp_display_shell_grid_notify_handler (GimpGrid *grid,
GParamSpec *pspec,
GimpDisplayShell *shell)
{
if (shell->grid_gc)
{
g_object_unref (shell->grid_gc);
shell->grid_gc = NULL;
}
gimp_display_shell_expose_full (shell);
/* update item factory */

View File

@ -318,12 +318,9 @@ gimp_display_shell_render (GimpDisplayShell *shell,
/* put it to the screen */
{
gint disp_xoffset, disp_yoffset;
gint offset_x, offset_y;
gimp_display_shell_scroll_get_disp_offset (shell,
&disp_xoffset, &disp_yoffset);
gimp_display_shell_scroll_get_render_start_offset (shell,
&offset_x, &offset_y);
gimp_canvas_draw_rgb (GIMP_CANVAS (shell->canvas),
GIMP_CANVAS_STYLE_RENDER,

View File

@ -35,6 +35,7 @@
#include "gimpdisplay.h"
#include "gimpdisplayshell.h"
#include "gimpdisplayshell-appearance.h"
#include "gimpdisplayshell-draw.h"
#include "gimpdisplayshell-expose.h"
#include "gimpdisplayshell-selection.h"
#include "gimpdisplayshell-transform.h"
@ -49,12 +50,18 @@
struct _Selection
{
GimpDisplayShell *shell; /* shell that owns the selection */
gboolean use_cairo; /* temp hack */
GdkSegment *segs_in; /* gdk segments of area boundary */
gint n_segs_in; /* number of segments in segs_in */
GdkSegment *segs_out; /* gdk segments of area boundary */
GdkSegment *segs_layer; /* gdk segments of layer boundary */
gint num_segs_in; /* number of segments in segs1 */
gint num_segs_out; /* number of segments in segs2 */
gint num_segs_layer; /* number of segments in segs3 */
gint n_segs_out; /* number of segments in segs_out */
GdkSegment *segs_layer; /* segments of layer boundary */
gint n_segs_layer; /* number of segments in segs_layer */
guint index; /* index of current stipple pattern */
gint paused; /* count of pause requests */
gboolean visible; /* visility of the display shell */
@ -89,7 +96,7 @@ static void selection_render_points (Selection *selection);
static void selection_transform_segs (Selection *selection,
const BoundSeg *src_segs,
GdkSegment *dest_segs,
gint num_segs);
gint n_segs);
static void selection_generate_segs (Selection *selection);
static void selection_free_segs (Selection *selection);
@ -117,6 +124,7 @@ gimp_display_shell_selection_init (GimpDisplayShell *shell)
selection = g_slice_new0 (Selection);
selection->shell = shell;
selection->use_cairo = g_getenv ("CAIRO_SELECTION") != NULL;
selection->visible = TRUE;
selection->hidden = ! gimp_display_shell_get_show_selection (shell);
selection->layer_hidden = ! gimp_display_shell_get_show_layer (shell);
@ -290,70 +298,105 @@ selection_resume (Selection *selection)
selection_start (selection);
}
/* #define BENCHMARK 1 */
static void
selection_draw (Selection *selection)
{
GimpCanvas *canvas = GIMP_CANVAS (selection->shell->canvas);
#ifdef BENCHMARK
GTimer *timer = g_timer_new ();
gint test;
for (test = 0; test < 20; test++)
{
#endif /* BENCHMARK */
if (selection->use_cairo)
{
if (selection->segs_in)
{
cairo_t *cr;
cr = gdk_cairo_create (gtk_widget_get_window (selection->shell->canvas));
gimp_display_shell_draw_selection_in (selection->shell, cr,
selection->segs_in,
selection->n_segs_in,
selection->index % 8);
cairo_destroy (cr);
}
}
else
{
#ifdef USE_DRAWPOINTS
#ifdef VERBOSE
{
gint j, sum;
{
gint j, sum;
sum = 0;
for (j = 0; j < 8; j++)
sum += selection->num_points_in[j];
sum = 0;
for (j = 0; j < 8; j++)
sum += selection->num_points_in[j];
g_print ("%d segments, %d points\n", selection->num_segs_in, sum);
}
g_print ("%d segments, %d points\n", selection->n_segs_in, sum);
}
#endif
if (selection->segs_in)
{
gint i;
if (selection->index == 0)
if (selection->segs_in)
{
for (i = 0; i < 4; i++)
if (selection->num_points_in[i])
gimp_canvas_draw_points (canvas, GIMP_CANVAS_STYLE_WHITE,
selection->points_in[i],
selection->num_points_in[i]);
gint i;
for (i = 4; i < 8; i++)
if (selection->num_points_in[i])
gimp_canvas_draw_points (canvas, GIMP_CANVAS_STYLE_BLACK,
selection->points_in[i],
selection->num_points_in[i]);
}
else
{
i = ((selection->index + 3) & 7);
if (selection->num_points_in[i])
gimp_canvas_draw_points (canvas, GIMP_CANVAS_STYLE_WHITE,
selection->points_in[i],
selection->num_points_in[i]);
if (selection->index == 0)
{
for (i = 0; i < 4; i++)
if (selection->num_points_in[i])
gimp_canvas_draw_points (canvas, GIMP_CANVAS_STYLE_WHITE,
selection->points_in[i],
selection->num_points_in[i]);
i = ((selection->index + 7) & 7);
if (selection->num_points_in[i])
gimp_canvas_draw_points (canvas, GIMP_CANVAS_STYLE_BLACK,
selection->points_in[i],
selection->num_points_in[i]);
for (i = 4; i < 8; i++)
if (selection->num_points_in[i])
gimp_canvas_draw_points (canvas, GIMP_CANVAS_STYLE_BLACK,
selection->points_in[i],
selection->num_points_in[i]);
}
else
{
i = ((selection->index + 3) & 7);
if (selection->num_points_in[i])
gimp_canvas_draw_points (canvas, GIMP_CANVAS_STYLE_WHITE,
selection->points_in[i],
selection->num_points_in[i]);
i = ((selection->index + 7) & 7);
if (selection->num_points_in[i])
gimp_canvas_draw_points (canvas, GIMP_CANVAS_STYLE_BLACK,
selection->points_in[i],
selection->num_points_in[i]);
}
}
}
#else /* ! USE_DRAWPOINTS */
gimp_canvas_set_stipple_index (canvas,
GIMP_CANVAS_STYLE_SELECTION_IN,
selection->index);
if (selection->segs_in)
gimp_canvas_draw_segments (canvas, GIMP_CANVAS_STYLE_SELECTION_IN,
selection->segs_in,
selection->num_segs_in);
gimp_canvas_set_stipple_index (canvas,
GIMP_CANVAS_STYLE_SELECTION_IN,
selection->index);
if (selection->segs_in)
gimp_canvas_draw_segments (canvas, GIMP_CANVAS_STYLE_SELECTION_IN,
selection->segs_in,
selection->n_segs_in);
#endif /* USE_DRAWPOINTS */
}
#ifdef BENCHMARK
}
g_printerr ("drawing 20 selections took %f seconds\n",
g_timer_elapsed (timer, NULL));
g_timer_destroy (timer);
#endif /* BENCHMARK */
}
static void
@ -378,24 +421,22 @@ selection_undraw (Selection *selection)
static void
selection_layer_draw (Selection *selection)
{
GimpCanvas *canvas = GIMP_CANVAS (selection->shell->canvas);
GimpImage *image = gimp_display_get_image (selection->shell->display);
GimpDrawable *drawable = gimp_image_get_active_drawable (image);
if (selection->segs_layer)
{
GimpCanvasStyle style;
GimpImage *image;
GimpDrawable *drawable;
cairo_t *cr;
if (GIMP_IS_LAYER_MASK (drawable))
style = GIMP_CANVAS_STYLE_LAYER_MASK_ACTIVE;
else if (gimp_viewable_get_children (GIMP_VIEWABLE (drawable)))
style = GIMP_CANVAS_STYLE_LAYER_GROUP_BOUNDARY;
else
style = GIMP_CANVAS_STYLE_LAYER_BOUNDARY;
image = gimp_display_get_image (selection->shell->display);
drawable = gimp_image_get_active_drawable (image);
gimp_canvas_draw_segments (canvas, style,
selection->segs_layer,
selection->num_segs_layer);
cr = gdk_cairo_create (gtk_widget_get_window (selection->shell->canvas));
gimp_display_shell_draw_layer_boundary (selection->shell, cr, drawable,
selection->segs_layer,
selection->n_segs_layer);
cairo_destroy (cr);
}
}
@ -404,7 +445,7 @@ selection_layer_undraw (Selection *selection)
{
selection_stop (selection);
if (selection->segs_layer && selection->num_segs_layer == 4)
if (selection->segs_layer && selection->n_segs_layer == 4)
{
gint x1 = selection->segs_layer[0].x1 - 1;
gint y1 = selection->segs_layer[0].y1 - 1;
@ -473,7 +514,7 @@ selection_render_points (Selection *selection)
selection->num_points_in[i] = 0;
}
for (i = 0; i < selection->num_segs_in; i++)
for (i = 0; i < selection->n_segs_in; i++)
{
gint x, y;
gint dx, dy;
@ -570,16 +611,16 @@ static void
selection_transform_segs (Selection *selection,
const BoundSeg *src_segs,
GdkSegment *dest_segs,
gint num_segs)
gint n_segs)
{
gint xclamp = selection->shell->disp_width + 1;
gint yclamp = selection->shell->disp_height + 1;
gint i;
gimp_display_shell_transform_segments (selection->shell,
src_segs, dest_segs, num_segs, FALSE);
src_segs, dest_segs, n_segs, FALSE);
for (i = 0; i < num_segs; i++)
for (i = 0; i < n_segs; i++)
{
dest_segs[i].x1 = CLAMP (dest_segs[i].x1, -1, xclamp);
dest_segs[i].y1 = CLAMP (dest_segs[i].y1, -1, yclamp);
@ -622,14 +663,14 @@ selection_generate_segs (Selection *selection)
*/
gimp_channel_boundary (gimp_image_get_mask (image),
&segs_in, &segs_out,
&selection->num_segs_in, &selection->num_segs_out,
&selection->n_segs_in, &selection->n_segs_out,
0, 0, 0, 0);
if (selection->num_segs_in)
if (selection->n_segs_in)
{
selection->segs_in = g_new (GdkSegment, selection->num_segs_in);
selection->segs_in = g_new (GdkSegment, selection->n_segs_in);
selection_transform_segs (selection, segs_in,
selection->segs_in, selection->num_segs_in);
selection->segs_in, selection->n_segs_in);
#ifdef USE_DRAWPOINTS
selection_render_points (selection);
@ -641,11 +682,11 @@ selection_generate_segs (Selection *selection)
}
/* Possible secondary boundary representation */
if (selection->num_segs_out)
if (selection->n_segs_out)
{
selection->segs_out = g_new (GdkSegment, selection->num_segs_out);
selection->segs_out = g_new (GdkSegment, selection->n_segs_out);
selection_transform_segs (selection, segs_out,
selection->segs_out, selection->num_segs_out);
selection->segs_out, selection->n_segs_out);
}
else
{
@ -658,18 +699,19 @@ selection_generate_segs (Selection *selection)
{
BoundSeg *segs;
segs = gimp_layer_boundary (layer, &selection->num_segs_layer);
segs = gimp_layer_boundary (layer, &selection->n_segs_layer);
if (selection->num_segs_layer)
if (selection->n_segs_layer)
{
selection->segs_layer = g_new (GdkSegment, selection->num_segs_layer);
selection->segs_layer = g_new (GdkSegment, selection->n_segs_layer);
selection_transform_segs (selection, segs,
selection_transform_segs (selection,
segs,
selection->segs_layer,
selection->num_segs_layer);
g_free (segs);
selection->n_segs_layer);
}
g_free (segs);
}
}
@ -681,22 +723,22 @@ selection_free_segs (Selection *selection)
if (selection->segs_in)
{
g_free (selection->segs_in);
selection->segs_in = NULL;
selection->num_segs_in = 0;
selection->segs_in = NULL;
selection->n_segs_in = 0;
}
if (selection->segs_out)
{
g_free (selection->segs_out);
selection->segs_out = NULL;
selection->num_segs_out = 0;
selection->segs_out = NULL;
selection->n_segs_out = 0;
}
if (selection->segs_layer)
{
g_free (selection->segs_layer);
selection->segs_layer = NULL;
selection->num_segs_layer = 0;
selection->segs_layer = NULL;
selection->n_segs_layer = 0;
}
for (j = 0; j < 8; j++)
@ -735,10 +777,26 @@ selection_start_timeout (Selection *selection)
selection_draw (selection);
if (selection->segs_out)
gimp_canvas_draw_segments (canvas, GIMP_CANVAS_STYLE_SELECTION_OUT,
selection->segs_out,
selection->num_segs_out);
{
if (selection->use_cairo)
{
cairo_t *cr;
cr = gdk_cairo_create (gtk_widget_get_window (selection->shell->canvas));
gimp_display_shell_draw_selection_out (selection->shell, cr,
selection->segs_out,
selection->n_segs_out);
cairo_destroy (cr);
}
else
{
gimp_canvas_draw_segments (canvas, GIMP_CANVAS_STYLE_SELECTION_OUT,
selection->segs_out,
selection->n_segs_out);
}
}
if (selection->segs_in && selection->visible)
selection->timeout = g_timeout_add_full (G_PRIORITY_DEFAULT_IDLE,

View File

@ -0,0 +1,317 @@
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimpdisplayshell-style.c
* Copyright (C) 2010 Michael Natterer <mitch@gimp.org>
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <string.h>
#include <gegl.h>
#include <gtk/gtk.h>
#include "libgimpcolor/gimpcolor.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "display-types.h"
#include "core/gimpcontext.h"
#include "core/gimpgrid.h"
#include "core/gimplayermask.h"
#include "gimpdisplayshell.h"
#include "gimpdisplayshell-style.h"
static const GimpRGB guide_normal_fg = { 0.0, 0.0, 0.0, 1.0 };
static const GimpRGB guide_normal_bg = { 0.0, 0.5, 1.0, 1.0 };
static const GimpRGB guide_active_fg = { 0.0, 0.0, 0.0, 1.0 };
static const GimpRGB guide_active_bg = { 1.0, 0.0, 0.0, 1.0 };
static const GimpRGB sample_point_normal = { 0.0, 0.5, 1.0, 1.0 };
static const GimpRGB sample_point_active = { 1.0, 0.0, 0.0, 1.0 };
static const GimpRGB layer_fg = { 0.0, 0.0, 0.0, 1.0 };
static const GimpRGB layer_bg = { 1.0, 1.0, 0.0, 1.0 };
static const GimpRGB layer_group_fg = { 0.0, 0.0, 0.0, 1.0 };
static const GimpRGB layer_group_bg = { 0.0, 1.0, 1.0, 1.0 };
static const GimpRGB layer_mask_fg = { 0.0, 0.0, 0.0, 1.0 };
static const GimpRGB layer_mask_bg = { 0.0, 1.0, 0.0, 1.0 };
static const GimpRGB selection_out_fg = { 1.0, 1.0, 1.0, 1.0 };
static const GimpRGB selection_out_bg = { 0.5, 0.5, 0.5, 1.0 };
static const GimpRGB selection_in_fg = { 0.0, 0.0, 0.0, 1.0 };
static const GimpRGB selection_in_bg = { 1.0, 1.0, 1.0, 1.0 };
/* local function prototypes */
static void gimp_display_shell_set_stipple_style (cairo_t *cr,
const GimpRGB *fg,
const GimpRGB *bg,
gint index);
/* public functions */
void
gimp_display_shell_set_guide_style (GimpDisplayShell *shell,
cairo_t *cr,
gboolean active)
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (cr != NULL);
cairo_set_line_width (cr, 1.0);
if (active)
gimp_display_shell_set_stipple_style (cr,
&guide_active_fg,
&guide_active_bg,
0);
else
gimp_display_shell_set_stipple_style (cr,
&guide_normal_fg,
&guide_normal_bg,
0);
}
void
gimp_display_shell_set_sample_point_style (GimpDisplayShell *shell,
cairo_t *cr,
gboolean active)
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (cr != NULL);
cairo_set_line_width (cr, 1.0);
if (active)
cairo_set_source_rgb (cr,
sample_point_active.r,
sample_point_active.g,
sample_point_active.b);
else
cairo_set_source_rgb (cr,
sample_point_normal.r,
sample_point_normal.g,
sample_point_normal.b);
}
void
gimp_display_shell_set_grid_style (GimpDisplayShell *shell,
cairo_t *cr,
GimpGrid *grid)
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (cr != NULL);
g_return_if_fail (GIMP_IS_GRID (grid));
cairo_set_line_width (cr, 1.0);
switch (grid->style)
{
case GIMP_GRID_ON_OFF_DASH:
case GIMP_GRID_DOUBLE_DASH:
if (grid->style == GIMP_GRID_DOUBLE_DASH)
{
gimp_display_shell_set_stipple_style (cr,
&grid->fgcolor,
&grid->bgcolor,
0);
}
else
{
GimpRGB bg = { 0.0, 0.0, 0.0, 0.0 };
gimp_display_shell_set_stipple_style (cr,
&grid->fgcolor,
&bg,
0);
}
break;
case GIMP_GRID_DOTS:
case GIMP_GRID_INTERSECTIONS:
case GIMP_GRID_SOLID:
cairo_set_source_rgb (cr,
grid->fgcolor.r,
grid->fgcolor.g,
grid->fgcolor.b);
break;
}
}
void
gimp_display_shell_set_cursor_style (GimpDisplayShell *shell,
cairo_t *cr)
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (cr != NULL);
cairo_set_line_width (cr, 1.0);
cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
}
void
gimp_display_shell_set_pen_style (GimpDisplayShell *shell,
cairo_t *cr,
GimpContext *context,
GimpActiveColor active,
gint width)
{
GimpRGB rgb;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (cr != NULL);
g_return_if_fail (GIMP_IS_CONTEXT (context));
cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE);
cairo_set_line_width (cr, width);
cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND);
switch (active)
{
case GIMP_ACTIVE_COLOR_FOREGROUND:
gimp_context_get_foreground (context, &rgb);
break;
case GIMP_ACTIVE_COLOR_BACKGROUND:
gimp_context_get_background (context, &rgb);
break;
}
cairo_set_source_rgb (cr, rgb.r, rgb.g, rgb.b);
}
void
gimp_display_shell_set_layer_style (GimpDisplayShell *shell,
cairo_t *cr,
GimpDrawable *drawable)
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (cr != NULL);
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
cairo_set_line_width (cr, 1.0);
if (GIMP_IS_LAYER_MASK (drawable))
{
gimp_display_shell_set_stipple_style (cr,
&layer_mask_fg,
&layer_mask_bg,
0);
}
else if (gimp_viewable_get_children (GIMP_VIEWABLE (drawable)))
{
gimp_display_shell_set_stipple_style (cr,
&layer_group_fg,
&layer_group_bg,
0);
}
else
{
gimp_display_shell_set_stipple_style (cr,
&layer_fg,
&layer_bg,
0);
}
}
void
gimp_display_shell_set_selection_out_style (GimpDisplayShell *shell,
cairo_t *cr)
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (cr != NULL);
cairo_set_line_width (cr, 1.0);
gimp_display_shell_set_stipple_style (cr,
&selection_out_fg,
&selection_out_bg,
0);
}
void
gimp_display_shell_set_selection_in_style (GimpDisplayShell *shell,
cairo_t *cr,
gint index)
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (cr != NULL);
cairo_set_line_width (cr, 1.0);
gimp_display_shell_set_stipple_style (cr,
&selection_in_fg,
&selection_in_bg,
index);
}
/* private functions */
static cairo_user_data_key_t surface_data_key = { 0, };
static void
gimp_display_shell_set_stipple_style (cairo_t *cr,
const GimpRGB *fg,
const GimpRGB *bg,
gint index)
{
cairo_surface_t *surface;
guchar *data = g_malloc0 (8 * 8 * 4);
guchar fg_r, fg_g, fg_b, fg_a;
guchar bg_r, bg_g, bg_b, bg_a;
gint x, y;
guchar *d;
gimp_rgba_get_uchar (fg, &fg_r, &fg_g, &fg_b, &fg_a);
gimp_rgba_get_uchar (bg, &bg_r, &bg_g, &bg_b, &bg_a);
d = data;
for (y = 0; y < 8; y++)
{
for (x = 0; x < 8; x++)
{
if ((x + y + index) % 8 >= 4)
GIMP_CAIRO_ARGB32_SET_PIXEL (d, fg_r, fg_g, fg_b, fg_a);
else
GIMP_CAIRO_ARGB32_SET_PIXEL (d, bg_r, bg_g, bg_b, bg_a);
d += 4;
}
}
surface = cairo_image_surface_create_for_data (data,
CAIRO_FORMAT_ARGB32,
8, 8, 8 * 4);
cairo_surface_set_user_data (surface, &surface_data_key,
data, (cairo_destroy_func_t) g_free);
cairo_set_source_surface (cr, surface, 0, 0);
cairo_surface_destroy (surface);
cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_REPEAT);
}

View File

@ -0,0 +1,51 @@
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimpdisplayshell-style.h
* Copyright (C) 2010 Michael Natterer <mitch@gimp.org>
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GIMP_DISPLAY_SHELL_STYLE_H__
#define __GIMP_DISPLAY_SHELL_STYLE_H__
void gimp_display_shell_set_guide_style (GimpDisplayShell *shell,
cairo_t *cr,
gboolean active);
void gimp_display_shell_set_sample_point_style (GimpDisplayShell *shell,
cairo_t *cr,
gboolean active);
void gimp_display_shell_set_grid_style (GimpDisplayShell *shell,
cairo_t *cr,
GimpGrid *grid);
void gimp_display_shell_set_cursor_style (GimpDisplayShell *shell,
cairo_t *cr);
void gimp_display_shell_set_pen_style (GimpDisplayShell *shell,
cairo_t *cr,
GimpContext *context,
GimpActiveColor active,
gint width);
void gimp_display_shell_set_layer_style (GimpDisplayShell *shell,
cairo_t *cr,
GimpDrawable *drawable);
void gimp_display_shell_set_selection_out_style (GimpDisplayShell *shell,
cairo_t *cr);
void gimp_display_shell_set_selection_in_style (GimpDisplayShell *shell,
cairo_t *cr,
gint index);
#endif /* __GIMP_DISPLAY_SHELL_STYLE_H__ */

View File

@ -938,18 +938,6 @@ gimp_display_shell_unrealize (GtkWidget *widget)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (widget);
if (shell->grid_gc)
{
g_object_unref (shell->grid_gc);
shell->grid_gc = NULL;
}
if (shell->pen_gc)
{
g_object_unref (shell->pen_gc);
shell->pen_gc = NULL;
}
if (shell->nav_popup)
gtk_widget_unrealize (shell->nav_popup);

View File

@ -115,8 +115,6 @@ struct _GimpDisplayShell
GList *children;
GtkWidget *canvas; /* GimpCanvas widget */
GdkGC *grid_gc; /* GC for grid drawing */
GdkGC *pen_gc; /* GC for felt pen drawing */
GtkAdjustment *hsbdata; /* adjustments */
GtkAdjustment *vsbdata;

View File

@ -163,7 +163,7 @@ static gboolean gimp_image_window_shell_events (GtkWidget *wid
GimpImageWindow *window);
static void gimp_image_window_switch_page (GtkNotebook *notebook,
GtkNotebookPage *page,
gpointer page,
gint page_num,
GimpImageWindow *window);
static void gimp_image_window_page_removed (GtkNotebook *notebook,
@ -1236,7 +1236,7 @@ gimp_image_window_shell_events (GtkWidget *widget,
static void
gimp_image_window_switch_page (GtkNotebook *notebook,
GtkNotebookPage *page,
gpointer page,
gint page_num,
GimpImageWindow *window)
{

View File

@ -518,11 +518,10 @@ gimp_navigation_editor_marker_changed (GimpNavigationView *view,
{
if (editor->shell)
{
GimpDisplayShell *shell = editor->shell;
gimp_display_shell_scroll_center_image_coordinate (shell,
x + width / 2,
y + height / 2);
if (gimp_display_get_image (editor->shell->display))
gimp_display_shell_scroll_center_image_coordinate (editor->shell,
x + width / 2,
y + height / 2);
}
}
@ -535,10 +534,11 @@ gimp_navigation_editor_zoom (GimpNavigationView *view,
if (editor->shell)
{
gimp_display_shell_scale (editor->shell,
direction,
0.0,
GIMP_ZOOM_FOCUS_BEST_GUESS);
if (gimp_display_get_image (editor->shell->display))
gimp_display_shell_scale (editor->shell,
direction,
0.0,
GIMP_ZOOM_FOCUS_BEST_GUESS);
}
}
@ -595,10 +595,11 @@ static void
gimp_navigation_editor_zoom_adj_changed (GtkAdjustment *adj,
GimpNavigationEditor *editor)
{
gimp_display_shell_scale (editor->shell,
GIMP_ZOOM_TO,
pow (2.0, gtk_adjustment_get_value (adj)),
GIMP_ZOOM_FOCUS_BEST_GUESS);
if (gimp_display_get_image (editor->shell->display))
gimp_display_shell_scale (editor->shell,
GIMP_ZOOM_TO,
pow (2.0, gtk_adjustment_get_value (adj)),
GIMP_ZOOM_FOCUS_BEST_GUESS);
}
static void

View File

@ -1330,9 +1330,15 @@ gimp_statusbar_label_expose (GtkWidget *widget,
{
if (statusbar->icon)
{
cairo_t *cr;
PangoRectangle rect;
gint x, y;
cr = gdk_cairo_create (event->window);
gdk_cairo_region (cr, event->region);
cairo_clip (cr);
gtk_label_get_layout_offsets (GTK_LABEL (widget), &x, &y);
pango_layout_index_to_pos (gtk_label_get_layout (GTK_LABEL (widget)), 0,
@ -1343,14 +1349,10 @@ gimp_statusbar_label_expose (GtkWidget *widget,
PANGO_PIXELS (rect.width) : 0);
y += PANGO_PIXELS (rect.y);
gdk_draw_pixbuf (gtk_widget_get_window (widget),
gtk_widget_get_style (widget)->black_gc,
statusbar->icon,
0, 0,
x, y,
gdk_pixbuf_get_width (statusbar->icon),
gdk_pixbuf_get_height (statusbar->icon),
GDK_RGB_DITHER_NORMAL, 0, 0);
gdk_cairo_set_source_pixbuf (cr, statusbar->icon, x, y);
cairo_paint (cr);
cairo_destroy (cr);
}
return FALSE;

View File

@ -44,7 +44,7 @@ typedef struct
gint width;
gint height;
GtkWidget *progress;
GdkGC *gc;
GdkColor color;
PangoLayout *upper;
gint upper_x;
gint upper_y;
@ -97,7 +97,6 @@ splash_create (gboolean be_verbose)
GtkWidget *vbox;
GdkPixbufAnimation *pixbuf;
GdkScreen *screen;
GdkGCValues values;
g_return_if_fail (splash == NULL);
@ -165,19 +164,16 @@ splash_create (gboolean be_verbose)
splash_average_text_area (splash,
gdk_pixbuf_animation_get_static_image (pixbuf),
&values.foreground);
&splash->color);
gtk_widget_realize (splash->area);
splash->gc = gdk_gc_new_with_values (gtk_widget_get_window (splash->area),
&values,
GDK_GC_FOREGROUND);
if (gdk_pixbuf_animation_is_static_image (pixbuf))
{
GdkPixmap *pixmap = gdk_pixmap_new (gtk_widget_get_window (splash->area),
splash->width, splash->height, -1);
gdk_draw_pixbuf (pixmap, splash->gc,
gdk_draw_pixbuf (pixmap, gtk_widget_get_style (splash->area)->black_gc,
gdk_pixbuf_animation_get_static_image (pixbuf),
0, 0, 0, 0, splash->width, splash->height,
GDK_RGB_DITHER_NORMAL, 0, 0);
@ -212,7 +208,6 @@ splash_destroy (void)
gtk_widget_destroy (splash->window);
g_object_unref (splash->gc);
g_object_unref (splash->upper);
g_object_unref (splash->lower);
@ -264,13 +259,20 @@ splash_area_expose (GtkWidget *widget,
GdkEventExpose *event,
GimpSplash *splash)
{
gdk_gc_set_clip_region (splash->gc, event->region);
cairo_t *cr = gdk_cairo_create (event->window);
gdk_draw_layout (gtk_widget_get_window (widget), splash->gc,
splash->upper_x, splash->upper_y, splash->upper);
gdk_cairo_region (cr, event->region);
cairo_clip (cr);
gdk_draw_layout (gtk_widget_get_window (widget), splash->gc,
splash->lower_x, splash->lower_y, splash->lower);
gdk_cairo_set_source_color (cr, &splash->color);
cairo_move_to (cr, splash->upper_x, splash->upper_y);
pango_cairo_show_layout (cr, splash->upper);
cairo_move_to (cr, splash->lower_x, splash->lower_y);
pango_cairo_show_layout (cr, splash->lower);
cairo_destroy (cr);
return FALSE;
}

View File

@ -172,7 +172,7 @@ static const GOptionEntry main_entries[] =
{
"no-splash", 's', 0,
G_OPTION_ARG_NONE, &no_splash,
N_("Do not show a startup window"), NULL
N_("Do not show a splash screen"), NULL
},
{
"no-shm", 0, G_OPTION_FLAG_REVERSE,

View File

@ -325,7 +325,7 @@ gimp_brush_core_finalize (GObject *object)
if (core->transformed_brush_bound_segs)
{
g_free (core->transformed_brush_bound_segs);
core->transformed_brush_bound_segs = NULL;
core->transformed_brush_bound_segs = NULL;
}
G_OBJECT_CLASS (parent_class)->finalize (object);
@ -963,12 +963,15 @@ gimp_brush_core_create_bound_segs (GimpBrushCore *core,
{
scale = gimp_brush_core_clamp_brush_scale (core, scale);
/* Generated brushes are a bit special*/
/* Generated brushes are a bit special */
if (GIMP_IS_BRUSH_GENERATED (core->main_brush))
{
GimpBrushGenerated *generated_brush = GIMP_BRUSH_GENERATED (core->main_brush);
GimpBrushGenerated *generated_brush;
gdouble ratio;
gdouble ratio = gimp_brush_generated_get_aspect_ratio (generated_brush);
generated_brush = GIMP_BRUSH_GENERATED (core->main_brush);
ratio = gimp_brush_generated_get_aspect_ratio (generated_brush);
gimp_brush_generated_set_aspect_ratio (generated_brush, 1.0);
@ -978,8 +981,10 @@ gimp_brush_core_create_bound_segs (GimpBrushCore *core,
gimp_brush_generated_set_aspect_ratio (generated_brush, ratio);
}
else
mask = gimp_brush_transform_mask (core->main_brush,
1.0, 1.0, 0.0, 1.0);
{
mask = gimp_brush_transform_mask (core->main_brush,
1.0, 1.0, 0.0, 1.0);
}
}
if (mask)
@ -1043,9 +1048,13 @@ gimp_brush_core_transform_bound_segs (GimpBrushCore *core,
/* Generated brushes have their angle applied on top of base angle */
if (GIMP_IS_BRUSH_GENERATED (core->main_brush))
{
GimpBrushGenerated *generated_brush = GIMP_BRUSH_GENERATED (core->main_brush);
GimpBrushGenerated *generated_brush;
gdouble base_angle;
generated_brush = GIMP_BRUSH_GENERATED (core->main_brush);
base_angle = gimp_brush_generated_get_angle (generated_brush);
gdouble base_angle = gimp_brush_generated_get_angle (generated_brush);
angle = angle + base_angle / 360;
if (aspect_ratio == 1.0)
@ -1057,8 +1066,8 @@ gimp_brush_core_transform_bound_segs (GimpBrushCore *core,
if (aspect_ratio < 1.0)
{
scale_x = scale * aspect_ratio;
scale_y = scale;
scale_x = scale * aspect_ratio;
scale_y = scale;
}
else
{
@ -1069,29 +1078,25 @@ gimp_brush_core_transform_bound_segs (GimpBrushCore *core,
if (core->transformed_brush_bound_segs)
{
g_free (core->transformed_brush_bound_segs);
core->transformed_brush_bound_segs = NULL;
core->transformed_brush_bound_segs = NULL;
}
if ((scale > 0.0) && (aspect_ratio > 0.0))
{
scale = gimp_brush_core_clamp_brush_scale (core, scale);
gimp_brush_transform_matrix (height, width,
scale, aspect_ratio, angle, &matrix);
core->transformed_brush_bound_segs
= boundary_transform (core->brush_bound_segs,
&core->n_brush_bound_segs,
&matrix);
core->transformed_brush_bound_segs =
boundary_transform (core->brush_bound_segs,
&core->n_brush_bound_segs,
&matrix);
/* FIXME. Do noy use scale_x/scale_y */
core->transformed_brush_bound_width = core->brush_bound_width * scale_x;
core->transformed_brush_bound_width = core->brush_bound_width * scale_x;
core->transformed_brush_bound_height = core->brush_bound_height * scale_y;
}
}
void

View File

@ -376,38 +376,37 @@ gimp_paint_core_stroke_emulate_dynamics (GimpCoords *coords,
}
}
if (length > 0)
if (length > 1)
{
gint i;
gdouble delta_x;
gdouble delta_y;
/* Fill in direction */
for (i = 2; i < length; i++)
for (i = 1; i < length; i++)
{
gdouble delta_x = coords[i - 1].x - coords[i].x;
gdouble delta_y = coords[i - 1].y - coords[i].y;
delta_x = coords[i - 1].x - coords[i].x;
delta_y = coords[i - 1].y - coords[i].y;
if (delta_x == 0)
if ((delta_x == 0) && (delta_y == 0))
{
coords[i].direction = coords[i - 1].direction;
}
else
{
coords[i].direction = 1.0 - atan (delta_y / delta_x) / (2 * G_PI);
if (delta_x > 0.0)
coords[i].direction = coords[i].direction + 0.5;
coords[i].direction = atan (delta_y / delta_x) / (2 * G_PI);
if (coords[i].direction < 0)
coords[i].direction += 1.0;
coords[i].direction = 1.0 - coords[i].direction;
}
/* This should avoid confusing the interpolator on sharp
* turns where the angle warps
*/
if (fabs (coords[i].direction - coords[i - 1].direction) > 0.5)
coords[i].direction = coords[i].direction + 1.0;
}
if (length > 2)
if (length > 1)
{
coords[0].direction = coords[2].direction;
coords[1].direction = coords[2].direction;
coords[0].direction = coords[1].direction;
}
}
}

View File

@ -57,6 +57,7 @@ libappinternal_procs_a_SOURCES = \
guides-cmds.c \
help-cmds.c \
image-cmds.c \
item-cmds.c \
layer-cmds.c \
message-cmds.c \
misc-cmds.c \

View File

@ -306,8 +306,8 @@ register_brushes_procs (GimpPDB *pdb)
"gimp-brushes-get-brush");
gimp_procedure_set_static_strings (procedure,
"gimp-brushes-get-brush",
"This procedure is deprecated! Use 'gimp-context-get-brush' instead.",
"This procedure is deprecated! Use 'gimp-context-get-brush' instead.",
"Deprecated: Use 'gimp-context-get-brush' instead.",
"Deprecated: Use 'gimp-context-get-brush' instead.",
"",
"",
"",
@ -348,8 +348,8 @@ register_brushes_procs (GimpPDB *pdb)
"gimp-brushes-get-spacing");
gimp_procedure_set_static_strings (procedure,
"gimp-brushes-get-spacing",
"This procedure is deprecated! Use 'gimp-brush-get-spacing' instead.",
"This procedure is deprecated! Use 'gimp-brush-get-spacing' instead.",
"Deprecated: Use 'gimp-brush-get-spacing' instead.",
"Deprecated: Use 'gimp-brush-get-spacing' instead.",
"",
"",
"",
@ -371,8 +371,8 @@ register_brushes_procs (GimpPDB *pdb)
"gimp-brushes-set-spacing");
gimp_procedure_set_static_strings (procedure,
"gimp-brushes-set-spacing",
"This procedure is deprecated! Use 'gimp-brush-set-spacing' instead.",
"This procedure is deprecated! Use 'gimp-brush-set-spacing' instead.",
"Deprecated: Use 'gimp-brush-set-spacing' instead.",
"Deprecated: Use 'gimp-brush-set-spacing' instead.",
"",
"",
"",
@ -394,8 +394,8 @@ register_brushes_procs (GimpPDB *pdb)
"gimp-brushes-get-brush-data");
gimp_procedure_set_static_strings (procedure,
"gimp-brushes-get-brush-data",
"This procedure is deprecated! Use 'gimp-brush-get-pixels' instead.",
"This procedure is deprecated! Use 'gimp-brush-get-pixels' instead.",
"Deprecated: Use 'gimp-brush-get-pixels' instead.",
"Deprecated: Use 'gimp-brush-get-pixels' instead.",
"",
"",
"",

View File

@ -66,7 +66,7 @@ brightness_contrast_invoker (GimpProcedure *procedure,
if (success)
{
if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) ||
if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) ||
! gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) ||
gimp_drawable_is_indexed (drawable))
success = FALSE;
@ -107,7 +107,7 @@ levels_invoker (GimpProcedure *procedure,
if (success)
{
if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) ||
if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) ||
! gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) ||
gimp_drawable_is_indexed (drawable) ||
(! gimp_drawable_has_alpha (drawable) &&
@ -143,7 +143,7 @@ levels_auto_invoker (GimpProcedure *procedure,
if (success)
{
if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) ||
if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) ||
! gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) ||
gimp_drawable_is_indexed (drawable))
success = FALSE;
@ -171,7 +171,7 @@ levels_stretch_invoker (GimpProcedure *procedure,
if (success)
{
if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) ||
if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) ||
! gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) ||
gimp_drawable_is_indexed (drawable))
success = FALSE;
@ -201,7 +201,7 @@ posterize_invoker (GimpProcedure *procedure,
if (success)
{
if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) ||
if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) ||
! gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) ||
gimp_drawable_is_indexed (drawable))
success = FALSE;
@ -229,7 +229,7 @@ desaturate_invoker (GimpProcedure *procedure,
if (success)
{
if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) ||
if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) ||
! gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) ||
! gimp_drawable_is_rgb (drawable))
success = FALSE;
@ -259,7 +259,7 @@ desaturate_full_invoker (GimpProcedure *procedure,
if (success)
{
if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) ||
if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) ||
! gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) ||
! gimp_drawable_is_rgb (drawable))
success = FALSE;
@ -289,7 +289,7 @@ equalize_invoker (GimpProcedure *procedure,
if (success)
{
if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) ||
if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) ||
! gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) ||
gimp_drawable_is_indexed (drawable))
success = FALSE;
@ -317,7 +317,7 @@ invert_invoker (GimpProcedure *procedure,
if (success)
{
if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) ||
if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) ||
! gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) ||
gimp_drawable_is_indexed (drawable))
success = FALSE;
@ -351,7 +351,7 @@ curves_spline_invoker (GimpProcedure *procedure,
if (success)
{
if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) ||
if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) ||
! gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) ||
gimp_drawable_is_indexed (drawable) || (num_points & 1) ||
(! gimp_drawable_has_alpha (drawable) &&
@ -390,7 +390,7 @@ curves_explicit_invoker (GimpProcedure *procedure,
if (success)
{
if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) ||
if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) ||
! gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) ||
gimp_drawable_is_indexed (drawable) || (num_bytes != 256) ||
(! gimp_drawable_has_alpha (drawable) &&
@ -433,7 +433,7 @@ color_balance_invoker (GimpProcedure *procedure,
if (success)
{
if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) ||
if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) ||
! gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) ||
gimp_drawable_is_indexed (drawable))
success = FALSE;
@ -470,7 +470,7 @@ colorize_invoker (GimpProcedure *procedure,
if (success)
{
if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) ||
if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) ||
! gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) ||
! gimp_drawable_is_rgb (drawable))
success = FALSE;
@ -512,7 +512,7 @@ histogram_invoker (GimpProcedure *procedure,
if (success)
{
if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), FALSE, error) ||
if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, FALSE, error) ||
gimp_drawable_is_indexed (drawable) ||
(! gimp_drawable_has_alpha (drawable) &&
channel == GIMP_HISTOGRAM_ALPHA) ||
@ -580,7 +580,7 @@ hue_saturation_invoker (GimpProcedure *procedure,
if (success)
{
if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) ||
if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) ||
! gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) ||
gimp_drawable_is_indexed (drawable))
success = FALSE;
@ -613,7 +613,7 @@ threshold_invoker (GimpProcedure *procedure,
if (success)
{
if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) ||
if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) ||
! gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) ||
gimp_drawable_is_indexed (drawable) ||
(low_threshold > high_threshold))
@ -736,8 +736,8 @@ register_color_procs (GimpPDB *pdb)
"gimp-levels-auto");
gimp_procedure_set_static_strings (procedure,
"gimp-levels-auto",
"This procedure is deprecated! Use 'gimp-levels-stretch' instead.",
"This procedure is deprecated! Use 'gimp-levels-stretch' instead.",
"Deprecated: Use 'gimp-levels-stretch' instead.",
"Deprecated: Use 'gimp-levels-stretch' instead.",
"",
"",
"",

View File

@ -724,62 +724,6 @@ drawable_set_linked_invoker (GimpProcedure *procedure,
error ? *error : NULL);
}
static GValueArray *
drawable_get_lock_content_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GValueArray *args,
GError **error)
{
gboolean success = TRUE;
GValueArray *return_vals;
GimpDrawable *drawable;
gboolean lock_content = FALSE;
drawable = gimp_value_get_drawable (&args->values[0], gimp);
if (success)
{
lock_content = gimp_item_get_lock_content (GIMP_ITEM (drawable));
}
return_vals = gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_set_boolean (&return_vals->values[1], lock_content);
return return_vals;
}
static GValueArray *
drawable_set_lock_content_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GValueArray *args,
GError **error)
{
gboolean success = TRUE;
GimpDrawable *drawable;
gboolean lock_content;
drawable = gimp_value_get_drawable (&args->values[0], gimp);
lock_content = g_value_get_boolean (&args->values[1]);
if (success)
{
if (gimp_item_can_lock_content (GIMP_ITEM (drawable)))
gimp_item_set_lock_content (GIMP_ITEM (drawable), lock_content, TRUE);
else
success = FALSE;
}
return gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static GValueArray *
drawable_get_tattoo_invoker (GimpProcedure *procedure,
Gimp *gimp,
@ -854,7 +798,7 @@ drawable_mask_bounds_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), FALSE, error))
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, FALSE, error))
non_empty = gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
else
success = FALSE;
@ -896,7 +840,7 @@ drawable_mask_intersect_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), FALSE, error))
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, FALSE, error))
non_empty = gimp_drawable_mask_intersect (drawable,
&x, &y, &width, &height);
else
@ -935,7 +879,7 @@ drawable_merge_shadow_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) &&
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
const gchar *undo_desc = _("Plug-In");
@ -1175,7 +1119,7 @@ drawable_offset_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) &&
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
gimp_drawable_offset (drawable, context, wrap_around, fill_type,
offset_x, offset_y);
@ -1368,7 +1312,7 @@ drawable_foreground_extract_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), FALSE, error))
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, FALSE, error))
gimp_drawable_foreground_extract (drawable, mode, mask, progress);
else
success = FALSE;
@ -1391,12 +1335,12 @@ register_drawable_procs (GimpPDB *pdb)
"gimp-drawable-is-valid");
gimp_procedure_set_static_strings (procedure,
"gimp-drawable-is-valid",
"Returns TRUE if the drawable is valid.",
"This procedure checks if the given drawable ID is valid and refers to an existing drawable.",
"Deprecated: Use 'gimp-item-is-valid' instead.",
"Deprecated: Use 'gimp-item-is-valid' instead.",
"Sven Neumann <sven@gimp.org>",
"Sven Neumann",
"2007",
NULL);
"gimp-item-is-valid");
gimp_procedure_add_argument (procedure,
gimp_param_spec_drawable_id ("drawable",
"drawable",
@ -1420,12 +1364,12 @@ register_drawable_procs (GimpPDB *pdb)
"gimp-drawable-is-layer");
gimp_procedure_set_static_strings (procedure,
"gimp-drawable-is-layer",
"Returns whether the drawable is a layer.",
"This procedure returns TRUE if the specified drawable is a layer.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL);
"Deprecated: Use 'gimp-item-is-layer' instead.",
"Deprecated: Use 'gimp-item-is-layer' instead.",
"",
"",
"",
"gimp-item-is-layer");
gimp_procedure_add_argument (procedure,
gimp_param_spec_drawable_id ("drawable",
"drawable",
@ -1478,12 +1422,12 @@ register_drawable_procs (GimpPDB *pdb)
"gimp-drawable-is-layer-mask");
gimp_procedure_set_static_strings (procedure,
"gimp-drawable-is-layer-mask",
"Returns whether the drawable is a layer mask.",
"This procedure returns TRUE if the specified drawable is a layer mask.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL);
"Deprecated: Use 'gimp-item-is-layer-mask' instead.",
"Deprecated: Use 'gimp-item-is-layer-mask' instead.",
"",
"",
"",
"gimp-item-is-layer-mask");
gimp_procedure_add_argument (procedure,
gimp_param_spec_drawable_id ("drawable",
"drawable",
@ -1507,12 +1451,12 @@ register_drawable_procs (GimpPDB *pdb)
"gimp-drawable-is-channel");
gimp_procedure_set_static_strings (procedure,
"gimp-drawable-is-channel",
"Returns whether the drawable is a channel.",
"This procedure returns TRUE if the specified drawable is a channel.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL);
"Deprecated: Use 'gimp-item-is-channel' instead.",
"Deprecated: Use 'gimp-item-is-channel' instead.",
"",
"",
"",
"gimp-item-is-channel");
gimp_procedure_add_argument (procedure,
gimp_param_spec_drawable_id ("drawable",
"drawable",
@ -1840,12 +1784,12 @@ register_drawable_procs (GimpPDB *pdb)
"gimp-drawable-delete");
gimp_procedure_set_static_strings (procedure,
"gimp-drawable-delete",
"Delete a drawable.",
"This procedure deletes the specified drawable. This must not be done if the image containing this drawable was already deleted or if the drawable was already removed from the image. The only case in which this procedure is useful is if you want to get rid of a drawable which has not yet been added to an image.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL);
"Deprecated: Use 'gimp-item-delete' instead.",
"Deprecated: Use 'gimp-item-delete' instead.",
"",
"",
"",
"gimp-item-delete");
gimp_procedure_add_argument (procedure,
gimp_param_spec_drawable_id ("drawable",
"drawable",
@ -1863,12 +1807,12 @@ register_drawable_procs (GimpPDB *pdb)
"gimp-drawable-get-image");
gimp_procedure_set_static_strings (procedure,
"gimp-drawable-get-image",
"Returns the drawable's image.",
"This procedure returns the drawable's image.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL);
"Deprecated: Use 'gimp-item-get-image' instead.",
"Deprecated: Use 'gimp-item-get-image' instead.",
"",
"",
"",
"gimp-item-get-image");
gimp_procedure_add_argument (procedure,
gimp_param_spec_drawable_id ("drawable",
"drawable",
@ -1892,8 +1836,8 @@ register_drawable_procs (GimpPDB *pdb)
"gimp-drawable-set-image");
gimp_procedure_set_static_strings (procedure,
"gimp-drawable-set-image",
"This procedure is deprecated!",
"This procedure is deprecated!",
"Deprecated: There is no replacement for this procedure.",
"Deprecated: There is no replacement for this procedure.",
"",
"",
"",
@ -1921,12 +1865,12 @@ register_drawable_procs (GimpPDB *pdb)
"gimp-drawable-get-name");
gimp_procedure_set_static_strings (procedure,
"gimp-drawable-get-name",
"Get the name of the specified drawable.",
"This procedure returns the specified drawable's name.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL);
"Deprecated: Use 'gimp-item-get-name' instead.",
"Deprecated: Use 'gimp-item-get-name' instead.",
"",
"",
"",
"gimp-item-get-name");
gimp_procedure_add_argument (procedure,
gimp_param_spec_drawable_id ("drawable",
"drawable",
@ -1951,12 +1895,12 @@ register_drawable_procs (GimpPDB *pdb)
"gimp-drawable-set-name");
gimp_procedure_set_static_strings (procedure,
"gimp-drawable-set-name",
"Set the name of the specified drawable.",
"This procedure sets the specified drawable's name.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL);
"Deprecated: Use 'gimp-item-set-name' instead.",
"Deprecated: Use 'gimp-item-set-name' instead.",
"",
"",
"",
"gimp-item-set-name");
gimp_procedure_add_argument (procedure,
gimp_param_spec_drawable_id ("drawable",
"drawable",
@ -1981,12 +1925,12 @@ register_drawable_procs (GimpPDB *pdb)
"gimp-drawable-get-visible");
gimp_procedure_set_static_strings (procedure,
"gimp-drawable-get-visible",
"Get the visibility of the specified drawable.",
"This procedure returns the specified drawable's visibility.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL);
"Deprecated: Use 'gimp-item-get-visible' instead.",
"Deprecated: Use 'gimp-item-get-visible' instead.",
"",
"",
"",
"gimp-item-get-visible");
gimp_procedure_add_argument (procedure,
gimp_param_spec_drawable_id ("drawable",
"drawable",
@ -2010,12 +1954,12 @@ register_drawable_procs (GimpPDB *pdb)
"gimp-drawable-set-visible");
gimp_procedure_set_static_strings (procedure,
"gimp-drawable-set-visible",
"Set the visibility of the specified drawable.",
"This procedure sets the specified drawable's visibility.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL);
"Deprecated: Use 'gimp-item-set-visible' instead.",
"Deprecated: Use 'gimp-item-set-visible' instead.",
"",
"",
"",
"gimp-item-set-visible");
gimp_procedure_add_argument (procedure,
gimp_param_spec_drawable_id ("drawable",
"drawable",
@ -2039,12 +1983,12 @@ register_drawable_procs (GimpPDB *pdb)
"gimp-drawable-get-linked");
gimp_procedure_set_static_strings (procedure,
"gimp-drawable-get-linked",
"Get the linked state of the specified drawable.",
"This procedure returns the specified drawable's linked state.",
"Deprecated: Use 'gimp-item-get-linked' instead.",
"Deprecated: Use 'gimp-item-get-linked' instead.",
"Wolfgang Hofer",
"Wolfgang Hofer",
"1998",
NULL);
"gimp-item-get-linked");
gimp_procedure_add_argument (procedure,
gimp_param_spec_drawable_id ("drawable",
"drawable",
@ -2068,12 +2012,12 @@ register_drawable_procs (GimpPDB *pdb)
"gimp-drawable-set-linked");
gimp_procedure_set_static_strings (procedure,
"gimp-drawable-set-linked",
"Set the linked state of the specified drawable.",
"This procedure sets the specified drawable's linked state.",
"Deprecated: Use 'gimp-item-set-linked' instead.",
"Deprecated: Use 'gimp-item-set-linked' instead.",
"Wolfgang Hofer",
"Wolfgang Hofer",
"1998",
NULL);
"gimp-item-set-linked");
gimp_procedure_add_argument (procedure,
gimp_param_spec_drawable_id ("drawable",
"drawable",
@ -2089,64 +2033,6 @@ register_drawable_procs (GimpPDB *pdb)
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-drawable-get-lock-content
*/
procedure = gimp_procedure_new (drawable_get_lock_content_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-drawable-get-lock-content");
gimp_procedure_set_static_strings (procedure,
"gimp-drawable-get-lock-content",
"Get the 'lock content' state of the specified drawable.",
"This procedure returns the specified drawable's lock content state.",
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2009",
NULL);
gimp_procedure_add_argument (procedure,
gimp_param_spec_drawable_id ("drawable",
"drawable",
"The drawable",
pdb->gimp, FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
g_param_spec_boolean ("lock-content",
"lock content",
"Whether the drawable's pixels are locked",
FALSE,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-drawable-set-lock-content
*/
procedure = gimp_procedure_new (drawable_set_lock_content_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-drawable-set-lock-content");
gimp_procedure_set_static_strings (procedure,
"gimp-drawable-set-lock-content",
"Set the 'lock content' state of the specified drawable.",
"This procedure sets the specified drawable's lock content state.",
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2009",
NULL);
gimp_procedure_add_argument (procedure,
gimp_param_spec_drawable_id ("drawable",
"drawable",
"The drawable",
pdb->gimp, FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_boolean ("lock-content",
"lock content",
"The new drawable 'lock content' state",
FALSE,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-drawable-get-tattoo
*/
@ -2155,12 +2041,12 @@ register_drawable_procs (GimpPDB *pdb)
"gimp-drawable-get-tattoo");
gimp_procedure_set_static_strings (procedure,
"gimp-drawable-get-tattoo",
"Get the tattoo of the specified drawable.",
"This procedure returns the specified drawable's tattoo. A tattoo is a unique and permanent identifier attached to a drawable that can be used to uniquely identify a drawable within an image even between sessions.",
"Deprecated: Use 'gimp-item-get-tattoo' instead.",
"Deprecated: Use 'gimp-item-get-tattoo' instead.",
"Jay Cox",
"Jay Cox",
"1998",
NULL);
"gimp-item-get-tattoo");
gimp_procedure_add_argument (procedure,
gimp_param_spec_drawable_id ("drawable",
"drawable",
@ -2184,12 +2070,12 @@ register_drawable_procs (GimpPDB *pdb)
"gimp-drawable-set-tattoo");
gimp_procedure_set_static_strings (procedure,
"gimp-drawable-set-tattoo",
"Set the tattoo of the specified drawable.",
"This procedure sets the specified drawable's tattoo. A tattoo is a unique and permanent identifier attached to a drawable that can be used to uniquely identify a drawable within an image even between sessions.",
"Deprecated: Use 'gimp-item-set-tattoo' instead.",
"Deprecated: Use 'gimp-item-set-tattoo' instead.",
"Jay Cox",
"Jay Cox",
"1998",
NULL);
"gimp-item-set-tattoo");
gimp_procedure_add_argument (procedure,
gimp_param_spec_drawable_id ("drawable",
"drawable",

View File

@ -68,7 +68,7 @@ drawable_transform_flip_simple_invoker (GimpProcedure *procedure,
{
gint x, y, width, height;
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error);
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
if (success &&
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@ -125,7 +125,7 @@ drawable_transform_flip_invoker (GimpProcedure *procedure,
{
gint x, y, width, height;
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error);
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
if (success &&
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@ -196,7 +196,7 @@ drawable_transform_flip_default_invoker (GimpProcedure *procedure,
{
gint x, y, width, height;
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error);
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
if (success &&
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@ -285,7 +285,7 @@ drawable_transform_perspective_invoker (GimpProcedure *procedure,
{
gint x, y, width, height;
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error);
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
if (success &&
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@ -366,7 +366,7 @@ drawable_transform_perspective_default_invoker (GimpProcedure *procedure,
{
gint x, y, width, height;
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error);
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
if (success &&
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@ -441,7 +441,7 @@ drawable_transform_rotate_simple_invoker (GimpProcedure *procedure,
{
gint x, y, width, height;
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), FALSE, error);
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, FALSE, error);
if (success &&
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@ -498,7 +498,7 @@ drawable_transform_rotate_invoker (GimpProcedure *procedure,
{
gint x, y, width, height;
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error);
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
if (success &&
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@ -573,7 +573,7 @@ drawable_transform_rotate_default_invoker (GimpProcedure *procedure,
{
gint x, y, width, height;
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error);
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
if (success &&
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@ -658,7 +658,7 @@ drawable_transform_scale_invoker (GimpProcedure *procedure,
{
gint x, y, width, height;
success = (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) && x0 < x1 && y0 < y1);
success = (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) && x0 < x1 && y0 < y1);
if (success &&
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@ -730,7 +730,7 @@ drawable_transform_scale_default_invoker (GimpProcedure *procedure,
{
gint x, y, width, height;
success = (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) && x0 < x1 && y0 < y1);
success = (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) && x0 < x1 && y0 < y1);
if (success &&
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@ -808,7 +808,7 @@ drawable_transform_shear_invoker (GimpProcedure *procedure,
{
gint x, y, width, height;
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error);
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
if (success &&
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@ -876,7 +876,7 @@ drawable_transform_shear_default_invoker (GimpProcedure *procedure,
{
gint x, y, width, height;
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error);
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
if (success &&
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@ -964,7 +964,7 @@ drawable_transform_2d_invoker (GimpProcedure *procedure,
{
gint x, y, width, height;
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error);
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
if (success &&
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@ -1043,7 +1043,7 @@ drawable_transform_2d_default_invoker (GimpProcedure *procedure,
{
gint x, y, width, height;
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error);
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
if (success &&
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@ -1136,7 +1136,7 @@ drawable_transform_matrix_invoker (GimpProcedure *procedure,
{
gint x, y, width, height;
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error);
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
if (success &&
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@ -1223,7 +1223,7 @@ drawable_transform_matrix_default_invoker (GimpProcedure *procedure,
{
gint x, y, width, height;
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error);
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
if (success &&
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))

View File

@ -64,7 +64,7 @@ edit_cut_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) &&
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
@ -110,7 +110,7 @@ edit_copy_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), FALSE, error))
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, FALSE, error))
{
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GError *my_error = NULL;
@ -197,7 +197,7 @@ edit_paste_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp->global_buffer &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
floating_sel = gimp_edit_paste (gimp_item_get_image (GIMP_ITEM (drawable)),
@ -272,7 +272,7 @@ edit_named_cut_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) &&
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
@ -325,7 +325,7 @@ edit_named_copy_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), FALSE, error))
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, FALSE, error))
{
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GError *my_error = NULL;
@ -428,7 +428,7 @@ edit_named_paste_invoker (GimpProcedure *procedure,
GimpBuffer *buffer = gimp_pdb_get_buffer (gimp, buffer_name, error);
if (buffer &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
floating_sel = gimp_edit_paste (gimp_item_get_image (GIMP_ITEM (drawable)),
@ -504,7 +504,7 @@ edit_clear_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) &&
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
@ -536,7 +536,7 @@ edit_fill_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) &&
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
@ -581,7 +581,7 @@ edit_bucket_fill_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) &&
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
@ -638,7 +638,7 @@ edit_bucket_fill_full_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) &&
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
@ -707,7 +707,7 @@ edit_blend_invoker (GimpProcedure *procedure,
if (success)
{
success = (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) &&
success = (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error));
if (success && supersample)
@ -760,7 +760,7 @@ edit_stroke_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) &&
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
@ -801,9 +801,10 @@ edit_stroke_vectors_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) &&
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) &&
gimp_pdb_item_is_attached (GIMP_ITEM (vectors), FALSE, error))
gimp_pdb_item_is_attached (GIMP_ITEM (vectors),
gimp_item_get_image (GIMP_ITEM (drawable)), FALSE, error))
{
GimpStrokeOptions *options = gimp_stroke_options_new (gimp, context, TRUE);

View File

@ -152,7 +152,7 @@ floating_sel_attach_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) &&
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
floating_sel_attach (layer, drawable);
else
@ -320,8 +320,8 @@ register_floating_sel_procs (GimpPDB *pdb)
"gimp-floating-sel-rigor");
gimp_procedure_set_static_strings (procedure,
"gimp-floating-sel-rigor",
"This procedure is deprecated!",
"This procedure is deprecated!",
"Deprecated: There is no replacement for this procedure.",
"Deprecated: There is no replacement for this procedure.",
"",
"",
"",
@ -349,8 +349,8 @@ register_floating_sel_procs (GimpPDB *pdb)
"gimp-floating-sel-relax");
gimp_procedure_set_static_strings (procedure,
"gimp-floating-sel-relax",
"This procedure is deprecated!",
"This procedure is deprecated!",
"Deprecated: There is no replacement for this procedure.",
"Deprecated: There is no replacement for this procedure.",
"",
"",
"",

View File

@ -108,7 +108,10 @@ gimp_pdb_compat_param_spec (Gimp *gimp,
G_PARAM_READWRITE);
break;
case GIMP_PDB_REGION:
case GIMP_PDB_ITEM:
pspec = gimp_param_spec_item_id (name, name, desc,
gimp, TRUE,
G_PARAM_READWRITE);
break;
case GIMP_PDB_DISPLAY:
@ -220,8 +223,8 @@ gimp_pdb_compat_arg_type_to_gtype (GimpPDBArgType type)
case GIMP_PDB_COLOR:
return GIMP_TYPE_RGB;
case GIMP_PDB_REGION:
break;
case GIMP_PDB_ITEM:
return GIMP_TYPE_ITEM_ID;
case GIMP_PDB_DISPLAY:
return GIMP_TYPE_DISPLAY_ID;

View File

@ -304,10 +304,12 @@ gimp_pdb_get_paint_info (Gimp *gimp,
gboolean
gimp_pdb_item_is_attached (GimpItem *item,
GimpImage *image,
gboolean writable,
GError **error)
{
g_return_val_if_fail (GIMP_IS_ITEM (item), FALSE);
g_return_val_if_fail (image == NULL || GIMP_IS_IMAGE (image), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
if (! gimp_item_is_attached (item))
@ -320,12 +322,48 @@ gimp_pdb_item_is_attached (GimpItem *item,
return FALSE;
}
if (image && image != gimp_item_get_image (item))
{
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_INVALID_ARGUMENT,
_("Item '%s' (%d) can not be used because it is "
"attached to another image"),
gimp_object_get_name (item),
gimp_item_get_ID (item));
return FALSE;
}
if (writable)
return gimp_pdb_item_is_writable (item, error);
return TRUE;
}
gboolean
gimp_pdb_item_is_in_tree (GimpItem *item,
GimpImage *image,
gboolean writable,
GError **error)
{
g_return_val_if_fail (GIMP_IS_ITEM (item), FALSE);
g_return_val_if_fail (image == NULL || GIMP_IS_IMAGE (image), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
if (! gimp_pdb_item_is_attached (item, image, writable, error))
return FALSE;
if (! gimp_item_get_tree (item))
{
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_INVALID_ARGUMENT,
_("Item '%s' (%d) can not be used because it is not "
"a direct child of an item tree"),
gimp_object_get_name (item),
gimp_item_get_ID (item));
return FALSE;
}
return TRUE;
}
gboolean
gimp_pdb_item_is_floating (GimpItem *item,
GimpImage *dest_image,
@ -414,7 +452,7 @@ gimp_pdb_layer_is_text_layer (GimpLayer *layer,
return FALSE;
}
return gimp_pdb_item_is_attached (GIMP_ITEM (layer), writable, error);
return gimp_pdb_item_is_attached (GIMP_ITEM (layer), NULL, writable, error);
}
static const gchar *

View File

@ -49,6 +49,11 @@ GimpPaintInfo * gimp_pdb_get_paint_info (Gimp *gimp,
GError **error);
gboolean gimp_pdb_item_is_attached (GimpItem *item,
GimpImage *image,
gboolean writable,
GError **error);
gboolean gimp_pdb_item_is_in_tree (GimpItem *item,
GimpImage *image,
gboolean writable,
GError **error);
gboolean gimp_pdb_item_is_floating (GimpItem *item,

View File

@ -349,8 +349,8 @@ register_gradients_procs (GimpPDB *pdb)
"gimp-gradients-sample-uniform");
gimp_procedure_set_static_strings (procedure,
"gimp-gradients-sample-uniform",
"This procedure is deprecated! Use 'gimp-gradient-get-uniform-samples' instead.",
"This procedure is deprecated! Use 'gimp-gradient-get-uniform-samples' instead.",
"Deprecated: Use 'gimp-gradient-get-uniform-samples' instead.",
"Deprecated: Use 'gimp-gradient-get-uniform-samples' instead.",
"",
"",
"",
@ -389,8 +389,8 @@ register_gradients_procs (GimpPDB *pdb)
"gimp-gradients-sample-custom");
gimp_procedure_set_static_strings (procedure,
"gimp-gradients-sample-custom",
"This procedure is deprecated! Use 'gimp-gradient-get-custom-samples' instead.",
"This procedure is deprecated! Use 'gimp-gradient-get-custom-samples' instead.",
"Deprecated: Use 'gimp-gradient-get-custom-samples' instead.",
"Deprecated: Use 'gimp-gradient-get-custom-samples' instead.",
"",
"",
"",
@ -434,8 +434,8 @@ register_gradients_procs (GimpPDB *pdb)
"gimp-gradients-get-gradient-data");
gimp_procedure_set_static_strings (procedure,
"gimp-gradients-get-gradient-data",
"This procedure is deprecated! Use 'gimp-gradient-get-uniform-samples' instead.",
"This procedure is deprecated! Use 'gimp-gradient-get-uniform-samples' instead.",
"Deprecated: Use 'gimp-gradient-get-uniform-samples' instead.",
"Deprecated: Use 'gimp-gradient-get-uniform-samples' instead.",
"",
"",
"",

View File

@ -946,7 +946,7 @@ image_remove_layer_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), FALSE, error))
if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), image, FALSE, error))
gimp_image_remove_layer (image, layer, TRUE, NULL);
else
success = FALSE;
@ -1009,7 +1009,10 @@ image_raise_layer_invoker (GimpProcedure *procedure,
if (success)
{
success = gimp_image_raise_layer (image, layer, error);
if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), image, FALSE, error))
success = gimp_image_raise_item (image, GIMP_ITEM (layer), error);
else
success = FALSE;
}
return gimp_procedure_get_return_values (procedure, success,
@ -1033,7 +1036,10 @@ image_lower_layer_invoker (GimpProcedure *procedure,
if (success)
{
success = gimp_image_lower_layer (image, layer, error);
if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), image, FALSE, error))
success = gimp_image_lower_item (image, GIMP_ITEM (layer), error);
else
success = FALSE;
}
return gimp_procedure_get_return_values (procedure, success,
@ -1057,7 +1063,10 @@ image_raise_layer_to_top_invoker (GimpProcedure *procedure,
if (success)
{
success = gimp_image_raise_layer_to_top (image, layer);
if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), image, FALSE, error))
success = gimp_image_raise_item_to_top (image, GIMP_ITEM (layer));
else
success = FALSE;
}
return gimp_procedure_get_return_values (procedure, success,
@ -1081,7 +1090,10 @@ image_lower_layer_to_bottom_invoker (GimpProcedure *procedure,
if (success)
{
success = gimp_image_lower_layer_to_bottom (image, layer);
if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), image, FALSE, error))
success = gimp_image_lower_item_to_bottom (image, GIMP_ITEM (layer));
else
success = FALSE;
}
return gimp_procedure_get_return_values (procedure, success,
@ -1140,7 +1152,7 @@ image_remove_channel_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (channel), FALSE, error))
if (gimp_pdb_item_is_attached (GIMP_ITEM (channel), image, FALSE, error))
gimp_image_remove_channel (image, channel, TRUE, NULL);
else
success = FALSE;
@ -1203,7 +1215,10 @@ image_raise_channel_invoker (GimpProcedure *procedure,
if (success)
{
success = gimp_image_raise_channel (image, channel, error);
if (gimp_pdb_item_is_attached (GIMP_ITEM (channel), image, FALSE, error))
success = gimp_image_raise_item (image, GIMP_ITEM (channel), error);
else
success = FALSE;
}
return gimp_procedure_get_return_values (procedure, success,
@ -1227,7 +1242,10 @@ image_lower_channel_invoker (GimpProcedure *procedure,
if (success)
{
success = gimp_image_lower_channel (image, channel, error);
if (gimp_pdb_item_is_attached (GIMP_ITEM (channel), image, FALSE, error))
success = gimp_image_lower_item (image, GIMP_ITEM (channel), error);
else
success = FALSE;
}
return gimp_procedure_get_return_values (procedure, success,
@ -1286,7 +1304,7 @@ image_remove_vectors_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (vectors), FALSE, error))
if (gimp_pdb_item_is_attached (GIMP_ITEM (vectors), image, FALSE, error))
gimp_image_remove_vectors (image, vectors, TRUE, NULL);
else
success = FALSE;
@ -1349,7 +1367,10 @@ image_raise_vectors_invoker (GimpProcedure *procedure,
if (success)
{
success = gimp_image_raise_vectors (image, vectors, error);
if (gimp_pdb_item_is_attached (GIMP_ITEM (vectors), image, FALSE, error))
success = gimp_image_raise_item (image, GIMP_ITEM (vectors), error);
else
success = FALSE;
}
return gimp_procedure_get_return_values (procedure, success,
@ -1373,7 +1394,10 @@ image_lower_vectors_invoker (GimpProcedure *procedure,
if (success)
{
success = gimp_image_lower_vectors (image, vectors, error);
if (gimp_pdb_item_is_attached (GIMP_ITEM (vectors), image, FALSE, error))
success = gimp_image_lower_item (image, GIMP_ITEM (vectors), error);
else
success = FALSE;
}
return gimp_procedure_get_return_values (procedure, success,
@ -1397,7 +1421,10 @@ image_raise_vectors_to_top_invoker (GimpProcedure *procedure,
if (success)
{
success = gimp_image_raise_vectors_to_top (image, vectors);
if (gimp_pdb_item_is_attached (GIMP_ITEM (vectors), image, FALSE, error))
success = gimp_image_raise_item_to_top (image, GIMP_ITEM (vectors));
else
success = FALSE;
}
return gimp_procedure_get_return_values (procedure, success,
@ -1421,7 +1448,10 @@ image_lower_vectors_to_bottom_invoker (GimpProcedure *procedure,
if (success)
{
success = gimp_image_lower_vectors_to_bottom (image, vectors);
if (gimp_pdb_item_is_attached (GIMP_ITEM (vectors), image, FALSE, error))
success = gimp_image_lower_item_to_bottom (image, GIMP_ITEM (vectors));
else
success = FALSE;
}
return gimp_procedure_get_return_values (procedure, success,
@ -1515,7 +1545,7 @@ image_merge_down_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (merge_layer), FALSE, error))
if (gimp_pdb_item_is_attached (GIMP_ITEM (merge_layer), image, FALSE, error))
{
layer = gimp_image_merge_down (image, merge_layer, context, merge_type,
error);
@ -1585,7 +1615,7 @@ image_remove_layer_mask_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), mode == GIMP_MASK_APPLY, error) &&
if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), image, mode == GIMP_MASK_APPLY, error) &&
gimp_layer_get_mask (layer))
gimp_layer_apply_mask (layer, mode, TRUE);
else
@ -2773,8 +2803,8 @@ register_image_procs (GimpPDB *pdb)
"gimp-image-free-shadow");
gimp_procedure_set_static_strings (procedure,
"gimp-image-free-shadow",
"This procedure is deprecated! Use 'gimp-drawable-free-shadow' instead.",
"This procedure is deprecated! Use 'gimp-drawable-free-shadow' instead.",
"Deprecated: Use 'gimp-drawable-free-shadow' instead.",
"Deprecated: Use 'gimp-drawable-free-shadow' instead.",
"",
"",
"",
@ -4069,8 +4099,8 @@ register_image_procs (GimpPDB *pdb)
"gimp-image-add-layer-mask");
gimp_procedure_set_static_strings (procedure,
"gimp-image-add-layer-mask",
"This procedure is deprecated! Use 'gimp-layer-add-mask' instead.",
"This procedure is deprecated! Use 'gimp-layer-add-mask' instead.",
"Deprecated: Use 'gimp-layer-add-mask' instead.",
"Deprecated: Use 'gimp-layer-add-mask' instead.",
"",
"",
"",
@ -4104,8 +4134,8 @@ register_image_procs (GimpPDB *pdb)
"gimp-image-remove-layer-mask");
gimp_procedure_set_static_strings (procedure,
"gimp-image-remove-layer-mask",
"This procedure is deprecated! Use 'gimp-layer-remove-mask' instead.",
"This procedure is deprecated! Use 'gimp-layer-remove-mask' instead.",
"Deprecated: Use 'gimp-layer-remove-mask' instead.",
"Deprecated: Use 'gimp-layer-remove-mask' instead.",
"",
"",
"",

View File

@ -28,7 +28,7 @@
#include "internal-procs.h"
/* 602 procedures registered total */
/* 621 procedures registered total */
void
internal_procs_init (GimpPDB *pdb)
@ -59,6 +59,7 @@ internal_procs_init (GimpPDB *pdb)
register_guides_procs (pdb);
register_help_procs (pdb);
register_image_procs (pdb);
register_item_procs (pdb);
register_layer_procs (pdb);
register_message_procs (pdb);
register_misc_procs (pdb);

View File

@ -48,6 +48,7 @@ void register_grid_procs (GimpPDB *pdb);
void register_guides_procs (GimpPDB *pdb);
void register_help_procs (GimpPDB *pdb);
void register_image_procs (GimpPDB *pdb);
void register_item_procs (GimpPDB *pdb);
void register_layer_procs (GimpPDB *pdb);
void register_message_procs (GimpPDB *pdb);
void register_misc_procs (GimpPDB *pdb);

1115
app/pdb/item-cmds.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -292,7 +292,7 @@ layer_scale_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), TRUE, error))
if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), NULL, TRUE, error))
{
if (progress)
gimp_progress_start (progress, _("Scaling"), FALSE);
@ -337,7 +337,7 @@ layer_scale_full_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), TRUE, error))
if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), NULL, TRUE, error))
{
if (progress)
gimp_progress_start (progress, _("Scaling"), FALSE);
@ -382,7 +382,7 @@ layer_resize_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), TRUE, error))
if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), NULL, TRUE, error))
gimp_item_resize (GIMP_ITEM (layer), context,
new_width, new_height, offx, offy);
else
@ -408,7 +408,7 @@ layer_resize_to_image_size_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), TRUE, error))
if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), NULL, TRUE, error))
gimp_layer_resize_to_image (layer, context);
else
success = FALSE;
@ -648,7 +648,7 @@ layer_remove_mask_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), mode == GIMP_MASK_APPLY, error) &&
if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), NULL, mode == GIMP_MASK_APPLY, error) &&
gimp_layer_get_mask (layer))
gimp_layer_apply_mask (layer, mode, TRUE);
else

View File

@ -117,7 +117,7 @@ airbrush_invoker (GimpProcedure *procedure,
GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-airbrush", error);
if (info &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpPaintOptions *options = gimp_paint_options_new (info);
@ -161,7 +161,7 @@ airbrush_default_invoker (GimpProcedure *procedure,
GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-airbrush", error);
if (info &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpPaintOptions *options = gimp_paint_options_new (info);
@ -209,7 +209,7 @@ clone_invoker (GimpProcedure *procedure,
GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-clone", error);
if (info &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpPaintOptions *options = gimp_paint_options_new (info);
@ -256,7 +256,7 @@ clone_default_invoker (GimpProcedure *procedure,
GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-clone", error);
if (info &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpPaintOptions *options = gimp_paint_options_new (info);
@ -300,7 +300,7 @@ convolve_invoker (GimpProcedure *procedure,
GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-convolve", error);
if (info &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpPaintOptions *options = gimp_paint_options_new (info);
@ -345,7 +345,7 @@ convolve_default_invoker (GimpProcedure *procedure,
GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-convolve", error);
if (info &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpPaintOptions *options = gimp_paint_options_new (info);
@ -391,7 +391,7 @@ dodgeburn_invoker (GimpProcedure *procedure,
GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-dodge-burn", error);
if (info &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpPaintOptions *options = gimp_paint_options_new (info);
@ -437,7 +437,7 @@ dodgeburn_default_invoker (GimpProcedure *procedure,
GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-dodge-burn", error);
if (info &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpPaintOptions *options = gimp_paint_options_new (info);
@ -481,7 +481,7 @@ eraser_invoker (GimpProcedure *procedure,
GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-eraser", error);
if (info &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpPaintOptions *options = gimp_paint_options_new (info);
@ -526,7 +526,7 @@ eraser_default_invoker (GimpProcedure *procedure,
GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-eraser", error);
if (info &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpPaintOptions *options = gimp_paint_options_new (info);
@ -572,7 +572,7 @@ heal_invoker (GimpProcedure *procedure,
GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-heal", error);
if (info &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpPaintOptions *options = gimp_paint_options_new (info);
@ -615,7 +615,7 @@ heal_default_invoker (GimpProcedure *procedure,
GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-heal", error);
if (info &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpPaintOptions *options = gimp_paint_options_new (info);
@ -661,7 +661,7 @@ paintbrush_invoker (GimpProcedure *procedure,
GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-paintbrush", error);
if (info &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpPaintOptions *options = gimp_paint_options_new (info);
@ -709,7 +709,7 @@ paintbrush_default_invoker (GimpProcedure *procedure,
GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-paintbrush", error);
if (info &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpPaintOptions *options = gimp_paint_options_new (info);
@ -749,7 +749,7 @@ pencil_invoker (GimpProcedure *procedure,
GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-pencil", error);
if (info &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpPaintOptions *options = gimp_paint_options_new (info);
@ -791,7 +791,7 @@ smudge_invoker (GimpProcedure *procedure,
GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-smudge", error);
if (info &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpPaintOptions *options = gimp_paint_options_new (info);
@ -835,7 +835,7 @@ smudge_default_invoker (GimpProcedure *procedure,
GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-smudge", error);
if (info &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpPaintOptions *options = gimp_paint_options_new (info);

View File

@ -245,8 +245,8 @@ register_palettes_procs (GimpPDB *pdb)
"gimp-palettes-get-palette");
gimp_procedure_set_static_strings (procedure,
"gimp-palettes-get-palette",
"This procedure is deprecated! Use 'gimp-context-get-palette' instead.",
"This procedure is deprecated! Use 'gimp-context-get-palette' instead.",
"Deprecated: Use 'gimp-context-get-palette' instead.",
"Deprecated: Use 'gimp-context-get-palette' instead.",
"",
"",
"",
@ -275,8 +275,8 @@ register_palettes_procs (GimpPDB *pdb)
"gimp-palettes-get-palette-entry");
gimp_procedure_set_static_strings (procedure,
"gimp-palettes-get-palette-entry",
"This procedure is deprecated! Use 'gimp-palette-entry-get-color' instead.",
"This procedure is deprecated! Use 'gimp-palette-entry-get-color' instead.",
"Deprecated: Use 'gimp-palette-entry-get-color' instead.",
"Deprecated: Use 'gimp-palette-entry-get-color' instead.",
"",
"",
"",

View File

@ -28,6 +28,7 @@
#include "core/gimp-parasites.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "core/gimpitem.h"
#include "core/gimpparamspecs.h"
#include "vectors/gimpvectors.h"
@ -249,6 +250,121 @@ image_parasite_list_invoker (GimpProcedure *procedure,
return return_vals;
}
static GValueArray *
item_parasite_find_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GValueArray *args,
GError **error)
{
gboolean success = TRUE;
GValueArray *return_vals;
GimpItem *item;
const gchar *name;
GimpParasite *parasite = NULL;
item = gimp_value_get_item (&args->values[0], gimp);
name = g_value_get_string (&args->values[1]);
if (success)
{
parasite = gimp_parasite_copy (gimp_item_parasite_find (item, name));
if (! parasite)
success = FALSE;
}
return_vals = gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_take_boxed (&return_vals->values[1], parasite);
return return_vals;
}
static GValueArray *
item_parasite_attach_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GValueArray *args,
GError **error)
{
gboolean success = TRUE;
GimpItem *item;
const GimpParasite *parasite;
item = gimp_value_get_item (&args->values[0], gimp);
parasite = g_value_get_boxed (&args->values[1]);
if (success)
{
gimp_item_parasite_attach (item, parasite);
}
return gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static GValueArray *
item_parasite_detach_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GValueArray *args,
GError **error)
{
gboolean success = TRUE;
GimpItem *item;
const gchar *name;
item = gimp_value_get_item (&args->values[0], gimp);
name = g_value_get_string (&args->values[1]);
if (success)
{
gimp_item_parasite_detach (item, name);
}
return gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static GValueArray *
item_parasite_list_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GValueArray *args,
GError **error)
{
gboolean success = TRUE;
GValueArray *return_vals;
GimpItem *item;
gint32 num_parasites = 0;
gchar **parasites = NULL;
item = gimp_value_get_item (&args->values[0], gimp);
if (success)
{
parasites = gimp_item_parasite_list (item, &num_parasites);
}
return_vals = gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
{
g_value_set_int (&return_vals->values[1], num_parasites);
gimp_value_take_stringarray (&return_vals->values[2], parasites, num_parasites);
}
return return_vals;
}
static GValueArray *
drawable_parasite_find_invoker (GimpProcedure *procedure,
Gimp *gimp,
@ -716,6 +832,133 @@ register_parasite_procs (GimpPDB *pdb)
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-item-parasite-find
*/
procedure = gimp_procedure_new (item_parasite_find_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-item-parasite-find");
gimp_procedure_set_static_strings (procedure,
"gimp-item-parasite-find",
"Look up a parasite in an item",
"Finds and returns the parasite that is attached to an item.",
"Jay Cox",
"Jay Cox",
"1998",
NULL);
gimp_procedure_add_argument (procedure,
gimp_param_spec_item_id ("item",
"item",
"The item",
pdb->gimp, FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_string ("name",
"name",
"The name of the parasite to find",
FALSE, FALSE, FALSE,
NULL,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
gimp_param_spec_parasite ("parasite",
"parasite",
"The found parasite",
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-item-parasite-attach
*/
procedure = gimp_procedure_new (item_parasite_attach_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-item-parasite-attach");
gimp_procedure_set_static_strings (procedure,
"gimp-item-parasite-attach",
"Add a parasite to an item.",
"This procedure attaches a parasite to an item. It has no return values.",
"Jay Cox",
"Jay Cox",
"1998",
NULL);
gimp_procedure_add_argument (procedure,
gimp_param_spec_item_id ("item",
"item",
"The item",
pdb->gimp, FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_parasite ("parasite",
"parasite",
"The parasite to attach to the item",
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-item-parasite-detach
*/
procedure = gimp_procedure_new (item_parasite_detach_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-item-parasite-detach");
gimp_procedure_set_static_strings (procedure,
"gimp-item-parasite-detach",
"Removes a parasite from an item.",
"This procedure detaches a parasite from an item. It has no return values.",
"Jay Cox",
"Jay Cox",
"1998",
NULL);
gimp_procedure_add_argument (procedure,
gimp_param_spec_item_id ("item",
"item",
"The item",
pdb->gimp, FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_string ("name",
"name",
"The name of the parasite to detach from the item.",
FALSE, FALSE, FALSE,
NULL,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-item-parasite-list
*/
procedure = gimp_procedure_new (item_parasite_list_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-item-parasite-list");
gimp_procedure_set_static_strings (procedure,
"gimp-item-parasite-list",
"List all parasites.",
"Returns a list of all parasites currently attached the an item.",
"Marc Lehmann",
"Marc Lehmann",
"1999",
NULL);
gimp_procedure_add_argument (procedure,
gimp_param_spec_item_id ("item",
"item",
"The item",
pdb->gimp, FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
gimp_param_spec_int32 ("num-parasites",
"num parasites",
"The number of attached parasites",
0, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
gimp_param_spec_string_array ("parasites",
"parasites",
"The names of currently attached parasites",
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-drawable-parasite-find
*/
@ -724,12 +967,12 @@ register_parasite_procs (GimpPDB *pdb)
"gimp-drawable-parasite-find");
gimp_procedure_set_static_strings (procedure,
"gimp-drawable-parasite-find",
"Look up a parasite in a drawable",
"Finds and returns the parasite that was previously attached to a drawable.",
"Deprecated: Use 'gimp-item-parasite-find' instead.",
"Deprecated: Use 'gimp-item-parasite-find' instead.",
"Jay Cox",
"Jay Cox",
"1998",
NULL);
"gimp-item-parasite-find");
gimp_procedure_add_argument (procedure,
gimp_param_spec_drawable_id ("drawable",
"drawable",
@ -759,12 +1002,12 @@ register_parasite_procs (GimpPDB *pdb)
"gimp-drawable-parasite-attach");
gimp_procedure_set_static_strings (procedure,
"gimp-drawable-parasite-attach",
"Add a parasite to a drawable.",
"This procedure attaches a parasite to a drawable. It has no return values.",
"Deprecated: Use 'gimp-item-parasite-attach' instead.",
"Deprecated: Use 'gimp-item-parasite-attach' instead.",
"Jay Cox",
"Jay Cox",
"1998",
NULL);
"gimp-item-parasite-attach");
gimp_procedure_add_argument (procedure,
gimp_param_spec_drawable_id ("drawable",
"drawable",
@ -787,12 +1030,12 @@ register_parasite_procs (GimpPDB *pdb)
"gimp-drawable-parasite-detach");
gimp_procedure_set_static_strings (procedure,
"gimp-drawable-parasite-detach",
"Removes a parasite from a drawable.",
"This procedure detaches a parasite from a drawable. It has no return values.",
"Deprecated: Use 'gimp-item-parasite-detach' instead.",
"Deprecated: Use 'gimp-item-parasite-detach' instead.",
"Jay Cox",
"Jay Cox",
"1998",
NULL);
"gimp-item-parasite-detach");
gimp_procedure_add_argument (procedure,
gimp_param_spec_drawable_id ("drawable",
"drawable",
@ -817,12 +1060,12 @@ register_parasite_procs (GimpPDB *pdb)
"gimp-drawable-parasite-list");
gimp_procedure_set_static_strings (procedure,
"gimp-drawable-parasite-list",
"List all parasites.",
"Returns a list of all currently attached parasites.",
"Deprecated: Use 'gimp-item-parasite-list' instead.",
"Deprecated: Use 'gimp-item-parasite-list' instead.",
"Marc Lehmann",
"Marc Lehmann",
"1999",
NULL);
"gimp-item-parasite-list");
gimp_procedure_add_argument (procedure,
gimp_param_spec_drawable_id ("drawable",
"drawable",
@ -851,12 +1094,12 @@ register_parasite_procs (GimpPDB *pdb)
"gimp-vectors-parasite-find");
gimp_procedure_set_static_strings (procedure,
"gimp-vectors-parasite-find",
"Look up a parasite in a vectors object",
"Finds and returns the parasite that was previously attached to a vectors object.",
"Deprecated: Use 'gimp-item-parasite-find' instead.",
"Deprecated: Use 'gimp-item-parasite-find' instead.",
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2006",
NULL);
"gimp-item-parasite-find");
gimp_procedure_add_argument (procedure,
gimp_param_spec_vectors_id ("vectors",
"vectors",
@ -886,12 +1129,12 @@ register_parasite_procs (GimpPDB *pdb)
"gimp-vectors-parasite-attach");
gimp_procedure_set_static_strings (procedure,
"gimp-vectors-parasite-attach",
"Add a parasite to a vectors object",
"This procedure attaches a parasite to a vectors object. It has no return values.",
"Deprecated: Use 'gimp-item-parasite-attach' instead.",
"Deprecated: Use 'gimp-item-parasite-attach' instead.",
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2006",
NULL);
"gimp-item-parasite-attach");
gimp_procedure_add_argument (procedure,
gimp_param_spec_vectors_id ("vectors",
"vectors",
@ -914,12 +1157,12 @@ register_parasite_procs (GimpPDB *pdb)
"gimp-vectors-parasite-detach");
gimp_procedure_set_static_strings (procedure,
"gimp-vectors-parasite-detach",
"Removes a parasite from a vectors object",
"This procedure detaches a parasite from a vectors object. It has no return values.",
"Deprecated: Use 'gimp-item-parasite-detach' instead.",
"Deprecated: Use 'gimp-item-parasite-detach' instead.",
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2006",
NULL);
"gimp-item-parasite-detach");
gimp_procedure_add_argument (procedure,
gimp_param_spec_vectors_id ("vectors",
"vectors",
@ -944,12 +1187,12 @@ register_parasite_procs (GimpPDB *pdb)
"gimp-vectors-parasite-list");
gimp_procedure_set_static_strings (procedure,
"gimp-vectors-parasite-list",
"List all parasites.",
"Returns a list of all currently attached parasites.",
"Deprecated: Use 'gimp-item-parasite-list' instead.",
"Deprecated: Use 'gimp-item-parasite-list' instead.",
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2006",
NULL);
"gimp-item-parasite-list");
gimp_procedure_add_argument (procedure,
gimp_param_spec_vectors_id ("vectors",
"vectors",

View File

@ -27,7 +27,6 @@
#include "pdb-types.h"
#include "core/gimpchannel-select.h"
#include "core/gimpimage.h"
#include "core/gimplist.h"
#include "core/gimpparamspecs.h"
@ -641,15 +640,12 @@ path_to_selection_invoker (GimpProcedure *procedure,
GimpVectors *vectors = gimp_image_get_vectors_by_name (image, name);
if (vectors)
gimp_channel_select_vectors (gimp_image_get_mask (image),
_("Path to Selection"),
vectors,
op,
antialias,
feather,
feather_radius_x,
feather_radius_y,
TRUE);
gimp_item_to_selection (GIMP_ITEM (vectors),
op,
antialias,
feather,
feather_radius_x,
feather_radius_y);
else
success = FALSE;
}
@ -700,8 +696,8 @@ register_paths_procs (GimpPDB *pdb)
"gimp-path-list");
gimp_procedure_set_static_strings (procedure,
"gimp-path-list",
"This procedure is deprecated! Use 'gimp-image-get-vectors' instead.",
"This procedure is deprecated! Use 'gimp-image-get-vectors' instead.",
"Deprecated: Use 'gimp-image-get-vectors' instead.",
"Deprecated: Use 'gimp-image-get-vectors' instead.",
"",
"",
"",
@ -734,8 +730,8 @@ register_paths_procs (GimpPDB *pdb)
"gimp-path-get-current");
gimp_procedure_set_static_strings (procedure,
"gimp-path-get-current",
"This procedure is deprecated! Use 'gimp-image-get-active-vectors' instead.",
"This procedure is deprecated! Use 'gimp-image-get-active-vectors' instead.",
"Deprecated: Use 'gimp-image-get-active-vectors' instead.",
"Deprecated: Use 'gimp-image-get-active-vectors' instead.",
"",
"",
"",
@ -764,8 +760,8 @@ register_paths_procs (GimpPDB *pdb)
"gimp-path-set-current");
gimp_procedure_set_static_strings (procedure,
"gimp-path-set-current",
"This procedure is deprecated! Use 'gimp-image-set-active-vectors' instead.",
"This procedure is deprecated! Use 'gimp-image-set-active-vectors' instead.",
"Deprecated: Use 'gimp-image-set-active-vectors' instead.",
"Deprecated: Use 'gimp-image-set-active-vectors' instead.",
"",
"",
"",
@ -794,8 +790,8 @@ register_paths_procs (GimpPDB *pdb)
"gimp-path-delete");
gimp_procedure_set_static_strings (procedure,
"gimp-path-delete",
"This procedure is deprecated! Use 'gimp-image-remove-vectors' instead.",
"This procedure is deprecated! Use 'gimp-image-remove-vectors' instead.",
"Deprecated: Use 'gimp-image-remove-vectors' instead.",
"Deprecated: Use 'gimp-image-remove-vectors' instead.",
"",
"",
"",
@ -824,8 +820,8 @@ register_paths_procs (GimpPDB *pdb)
"gimp-path-get-points");
gimp_procedure_set_static_strings (procedure,
"gimp-path-get-points",
"This procedure is deprecated! Use 'gimp-vectors-stroke-get-points' instead.",
"This procedure is deprecated! Use 'gimp-vectors-stroke-get-points' instead.",
"Deprecated: Use 'gimp-vectors-stroke-get-points' instead.",
"Deprecated: Use 'gimp-vectors-stroke-get-points' instead.",
"",
"",
"",
@ -877,12 +873,12 @@ register_paths_procs (GimpPDB *pdb)
"gimp-path-set-points");
gimp_procedure_set_static_strings (procedure,
"gimp-path-set-points",
"This procedure is deprecated! Use 'vectors-stroke-new-from-points' instead.",
"This procedure is deprecated! Use 'vectors-stroke-new-from-points' instead.",
"Deprecated: Use 'gimp-vectors-stroke-new-from-points' instead.",
"Deprecated: Use 'gimp-vectors-stroke-new-from-points' instead.",
"",
"",
"",
"vectors-stroke-new-from-points");
"gimp-vectors-stroke-new-from-points");
gimp_procedure_add_argument (procedure,
gimp_param_spec_image_id ("image",
"image",
@ -924,8 +920,8 @@ register_paths_procs (GimpPDB *pdb)
"gimp-path-stroke-current");
gimp_procedure_set_static_strings (procedure,
"gimp-path-stroke-current",
"This procedure is deprecated! Use 'gimp-edit-stroke-vectors' instead.",
"This procedure is deprecated! Use 'gimp-edit-stroke-vectors' instead.",
"Deprecated: Use 'gimp-edit-stroke-vectors' instead.",
"Deprecated: Use 'gimp-edit-stroke-vectors' instead.",
"",
"",
"",
@ -947,8 +943,8 @@ register_paths_procs (GimpPDB *pdb)
"gimp-path-get-point-at-dist");
gimp_procedure_set_static_strings (procedure,
"gimp-path-get-point-at-dist",
"This procedure is deprecated! Use 'gimp-vectors-stroke-get-point-at-dist' instead.",
"This procedure is deprecated! Use 'gimp-vectors-stroke-get-point-at-dist' instead.",
"Deprecated: Use 'gimp-vectors-stroke-get-point-at-dist' instead.",
"Deprecated: Use 'gimp-vectors-stroke-get-point-at-dist' instead.",
"",
"",
"",
@ -994,8 +990,8 @@ register_paths_procs (GimpPDB *pdb)
"gimp-path-get-tattoo");
gimp_procedure_set_static_strings (procedure,
"gimp-path-get-tattoo",
"This procedure is deprecated! Use 'gimp-vectors-get-tattoo' instead.",
"This procedure is deprecated! Use 'gimp-vectors-get-tattoo' instead.",
"Deprecated: Use 'gimp-vectors-get-tattoo' instead.",
"Deprecated: Use 'gimp-vectors-get-tattoo' instead.",
"",
"",
"",
@ -1030,8 +1026,8 @@ register_paths_procs (GimpPDB *pdb)
"gimp-path-set-tattoo");
gimp_procedure_set_static_strings (procedure,
"gimp-path-set-tattoo",
"This procedure is deprecated! Use 'gimp-vectors-set-tattoo' instead.",
"This procedure is deprecated! Use 'gimp-vectors-set-tattoo' instead.",
"Deprecated: Use 'gimp-vectors-set-tattoo' instead.",
"Deprecated: Use 'gimp-vectors-set-tattoo' instead.",
"",
"",
"",
@ -1066,8 +1062,8 @@ register_paths_procs (GimpPDB *pdb)
"gimp-get-path-by-tattoo");
gimp_procedure_set_static_strings (procedure,
"gimp-get-path-by-tattoo",
"This procedure is deprecated! Use 'gimp-image-get-vectors-by-tattoo' instead.",
"This procedure is deprecated! Use 'gimp-image-get-vectors-by-tattoo' instead.",
"Deprecated: Use 'gimp-image-get-vectors-by-tattoo' instead.",
"Deprecated: Use 'gimp-image-get-vectors-by-tattoo' instead.",
"",
"",
"",
@ -1102,8 +1098,8 @@ register_paths_procs (GimpPDB *pdb)
"gimp-path-get-locked");
gimp_procedure_set_static_strings (procedure,
"gimp-path-get-locked",
"This procedure is deprecated! Use 'gimp-vectors-get-linked' instead.",
"This procedure is deprecated! Use 'gimp-vectors-get-linked' instead.",
"Deprecated: Use 'gimp-vectors-get-linked' instead.",
"Deprecated: Use 'gimp-vectors-get-linked' instead.",
"",
"",
"",
@ -1138,8 +1134,8 @@ register_paths_procs (GimpPDB *pdb)
"gimp-path-set-locked");
gimp_procedure_set_static_strings (procedure,
"gimp-path-set-locked",
"This procedure is deprecated! Use 'gimp-vectors-set-linked' instead.",
"This procedure is deprecated! Use 'gimp-vectors-set-linked' instead.",
"Deprecated: Use 'gimp-vectors-set-linked' instead.",
"Deprecated: Use 'gimp-vectors-set-linked' instead.",
"",
"",
"",
@ -1174,8 +1170,8 @@ register_paths_procs (GimpPDB *pdb)
"gimp-path-to-selection");
gimp_procedure_set_static_strings (procedure,
"gimp-path-to-selection",
"This procedure is deprecated! Use 'gimp-vectors-to-selection' instead.",
"This procedure is deprecated! Use 'gimp-vectors-to-selection' instead.",
"Deprecated: Use 'gimp-vectors-to-selection' instead.",
"Deprecated: Use 'gimp-vectors-to-selection' instead.",
"",
"",
"",
@ -1235,12 +1231,12 @@ register_paths_procs (GimpPDB *pdb)
"gimp-path-import");
gimp_procedure_set_static_strings (procedure,
"gimp-path-import",
"This procedure is deprecated! Use 'vectors-import-from-file' instead.",
"This procedure is deprecated! Use 'vectors-import-from-file' instead.",
"Deprecated: Use 'gimp-vectors-import-from-file' instead.",
"Deprecated: Use 'gimp-vectors-import-from-file' instead.",
"",
"",
"",
"vectors-import-from-file");
"gimp-vectors-import-from-file");
gimp_procedure_add_argument (procedure,
gimp_param_spec_image_id ("image",
"image",

View File

@ -248,8 +248,8 @@ register_patterns_procs (GimpPDB *pdb)
"gimp-patterns-get-pattern");
gimp_procedure_set_static_strings (procedure,
"gimp-patterns-get-pattern",
"This procedure is deprecated! Use 'gimp-context-get-pattern' instead.",
"This procedure is deprecated! Use 'gimp-context-get-pattern' instead.",
"Deprecated: Use 'gimp-context-get-pattern' instead.",
"Deprecated: Use 'gimp-context-get-pattern' instead.",
"",
"",
"",
@ -284,8 +284,8 @@ register_patterns_procs (GimpPDB *pdb)
"gimp-patterns-get-pattern-data");
gimp_procedure_set_static_strings (procedure,
"gimp-patterns-get-pattern-data",
"This procedure is deprecated! Use 'gimp-pattern-get-pixels' instead.",
"This procedure is deprecated! Use 'gimp-pattern-get-pixels' instead.",
"Deprecated: Use 'gimp-pattern-get-pixels' instead.",
"Deprecated: Use 'gimp-pattern-get-pixels' instead.",
"",
"",
"",

View File

@ -23,7 +23,6 @@
#include "pdb-types.h"
#include "core/gimpchannel-select.h"
#include "core/gimpchannel.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
@ -190,7 +189,7 @@ selection_float_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) &&
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
@ -418,11 +417,12 @@ selection_layer_alpha_invoker (GimpProcedure *procedure,
if (success)
{
GimpImage *image = gimp_item_get_image (GIMP_ITEM (layer));
gimp_channel_select_alpha (gimp_image_get_mask (image),
GIMP_DRAWABLE (layer),
GIMP_CHANNEL_OP_REPLACE, FALSE, 0.0, 0.0);
if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), NULL, FALSE, error))
gimp_item_to_selection (GIMP_ITEM (layer),
GIMP_CHANNEL_OP_REPLACE,
TRUE, FALSE, 0.0, 0.0);
else
success = FALSE;
}
return gimp_procedure_get_return_values (procedure, success,
@ -444,18 +444,12 @@ selection_load_invoker (GimpProcedure *procedure,
if (success)
{
GimpImage *image;
gint off_x, off_y;
image = gimp_item_get_image (GIMP_ITEM (channel));
gimp_item_get_offset (GIMP_ITEM (channel), &off_x, &off_y);
gimp_channel_select_channel (gimp_image_get_mask (image),
_("Channel to Selection"),
channel,
off_x, off_y,
GIMP_CHANNEL_OP_REPLACE,
FALSE, 0.0, 0.0);
if (gimp_pdb_item_is_attached (GIMP_ITEM (channel), NULL, FALSE, error))
gimp_item_to_selection (GIMP_ITEM (channel),
GIMP_CHANNEL_OP_REPLACE,
TRUE, FALSE, 0.0, 0.0);
else
success = FALSE;
}
return gimp_procedure_get_return_values (procedure, success,
@ -511,18 +505,12 @@ selection_combine_invoker (GimpProcedure *procedure,
if (success)
{
GimpImage *image;
gint off_x, off_y;
image = gimp_item_get_image (GIMP_ITEM (channel));
gimp_item_get_offset (GIMP_ITEM (channel), &off_x, &off_y);
gimp_channel_select_channel (gimp_image_get_mask (image),
_("Channel to Selection"),
channel,
off_x, off_y,
operation,
FALSE, 0.0, 0.0);
if (gimp_pdb_item_is_attached (GIMP_ITEM (channel), NULL, FALSE, error))
gimp_item_to_selection (GIMP_ITEM (channel),
operation,
TRUE, FALSE, 0.0, 0.0);
else
success = FALSE;
}
return gimp_procedure_get_return_values (procedure, success,

View File

@ -2115,8 +2115,8 @@ register_text_layer_procs (GimpPDB *pdb)
"gimp-text-layer-get-hinting");
gimp_procedure_set_static_strings (procedure,
"gimp-text-layer-get-hinting",
"This procedure is deprecated! Use 'gimp-text-layer-get-hint-style' instead.",
"This procedure is deprecated! Use 'gimp-text-layer-get-hint-style' instead.",
"Deprecated: Use 'gimp-text-layer-get-hint-style' instead.",
"Deprecated: Use 'gimp-text-layer-get-hint-style' instead.",
"",
"",
"",

View File

@ -73,7 +73,7 @@ text_fontname_invoker (GimpProcedure *procedure,
if (success)
{
if (drawable &&
(! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) ||
(! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), image, TRUE, error) ||
! gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error)))
success = FALSE;
@ -197,7 +197,7 @@ text_invoker (GimpProcedure *procedure,
if (success)
{
if (drawable &&
(! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) ||
(! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), image, TRUE, error) ||
! gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error)))
success = FALSE;
@ -452,8 +452,8 @@ register_text_tool_procs (GimpPDB *pdb)
"gimp-text");
gimp_procedure_set_static_strings (procedure,
"gimp-text",
"This procedure is deprecated! Use 'gimp-text-fontname' instead.",
"This procedure is deprecated! Use 'gimp-text-fontname' instead.",
"Deprecated: Use 'gimp-text-fontname' instead.",
"Deprecated: Use 'gimp-text-fontname' instead.",
"",
"",
"",
@ -587,8 +587,8 @@ register_text_tool_procs (GimpPDB *pdb)
"gimp-text-get-extents");
gimp_procedure_set_static_strings (procedure,
"gimp-text-get-extents",
"This procedure is deprecated! Use 'gimp-text-get-extents-fontname' instead.",
"This procedure is deprecated! Use 'gimp-text-get-extents-fontname' instead.",
"Deprecated: Use 'gimp-text-get-extents-fontname' instead.",
"Deprecated: Use 'gimp-text-get-extents-fontname' instead.",
"",
"",
"",

View File

@ -62,7 +62,7 @@ flip_invoker (GimpProcedure *procedure,
{
gint x, y, width, height;
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error);
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
if (success &&
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@ -117,7 +117,7 @@ perspective_invoker (GimpProcedure *procedure,
{
gint x, y, width, height;
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error);
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
if (success &&
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@ -187,7 +187,7 @@ rotate_invoker (GimpProcedure *procedure,
{
gint x, y, width, height;
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error);
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
if (success &&
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@ -262,7 +262,7 @@ scale_invoker (GimpProcedure *procedure,
{
gint x, y, width, height;
success = (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error) &&
success = (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
x0 < x1 && y0 < y1);
if (success &&
@ -334,7 +334,7 @@ shear_invoker (GimpProcedure *procedure,
{
gint x, y, width, height;
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error);
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
if (success &&
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@ -415,7 +415,7 @@ transform_2d_invoker (GimpProcedure *procedure,
{
gint x, y, width, height;
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), TRUE, error);
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
if (success &&
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@ -469,8 +469,8 @@ register_transform_tools_procs (GimpPDB *pdb)
"gimp-flip");
gimp_procedure_set_static_strings (procedure,
"gimp-flip",
"This procedure is deprecated! Use 'gimp-drawable-transform-flip-simple' instead.",
"This procedure is deprecated! Use 'gimp-drawable-transform-flip-simple' instead.",
"Deprecated: Use 'gimp-drawable-transform-flip-simple' instead.",
"Deprecated: Use 'gimp-drawable-transform-flip-simple' instead.",
"",
"",
"",
@ -507,8 +507,8 @@ register_transform_tools_procs (GimpPDB *pdb)
"gimp-perspective");
gimp_procedure_set_static_strings (procedure,
"gimp-perspective",
"This procedure is deprecated! Use 'gimp-drawable-transform-perspective-default' instead.",
"This procedure is deprecated! Use 'gimp-drawable-transform-perspective-default' instead.",
"Deprecated: Use 'gimp-drawable-transform-perspective-default' instead.",
"Deprecated: Use 'gimp-drawable-transform-perspective-default' instead.",
"",
"",
"",
@ -590,8 +590,8 @@ register_transform_tools_procs (GimpPDB *pdb)
"gimp-rotate");
gimp_procedure_set_static_strings (procedure,
"gimp-rotate",
"This procedure is deprecated! Use 'gimp-drawable-transform-rotate-default' instead.",
"This procedure is deprecated! Use 'gimp-drawable-transform-rotate-default' instead.",
"Deprecated: Use 'gimp-drawable-transform-rotate-default' instead.",
"Deprecated: Use 'gimp-drawable-transform-rotate-default' instead.",
"",
"",
"",
@ -631,8 +631,8 @@ register_transform_tools_procs (GimpPDB *pdb)
"gimp-scale");
gimp_procedure_set_static_strings (procedure,
"gimp-scale",
"This procedure is deprecated! Use 'gimp-drawable-transform-scale-default' instead.",
"This procedure is deprecated! Use 'gimp-drawable-transform-scale-default' instead.",
"Deprecated: Use 'gimp-drawable-transform-scale-default' instead.",
"Deprecated: Use 'gimp-drawable-transform-scale-default' instead.",
"",
"",
"",
@ -690,8 +690,8 @@ register_transform_tools_procs (GimpPDB *pdb)
"gimp-shear");
gimp_procedure_set_static_strings (procedure,
"gimp-shear",
"This procedure is deprecated! Use 'gimp-drawable-transform-shear-default' instead.",
"This procedure is deprecated! Use 'gimp-drawable-transform-shear-default' instead.",
"Deprecated: Use 'gimp-drawable-transform-shear-default' instead.",
"Deprecated: Use 'gimp-drawable-transform-shear-default' instead.",
"",
"",
"",
@ -740,8 +740,8 @@ register_transform_tools_procs (GimpPDB *pdb)
"gimp-transform-2d");
gimp_procedure_set_static_strings (procedure,
"gimp-transform-2d",
"This procedure is deprecated! Use 'gimp-drawable-transform-2d-default' instead.",
"This procedure is deprecated! Use 'gimp-drawable-transform-2d-default' instead.",
"Deprecated: Use 'gimp-drawable-transform-2d-default' instead.",
"Deprecated: Use 'gimp-drawable-transform-2d-default' instead.",
"",
"",
"",

View File

@ -25,7 +25,6 @@
#include "pdb-types.h"
#include "core/gimpchannel-select.h"
#include "core/gimpimage-undo-push.h"
#include "core/gimpimage.h"
#include "core/gimplayer.h"
@ -367,62 +366,6 @@ vectors_set_linked_invoker (GimpProcedure *procedure,
error ? *error : NULL);
}
static GValueArray *
vectors_get_lock_content_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GValueArray *args,
GError **error)
{
gboolean success = TRUE;
GValueArray *return_vals;
GimpVectors *vectors;
gboolean lock_content = FALSE;
vectors = gimp_value_get_vectors (&args->values[0], gimp);
if (success)
{
lock_content = gimp_item_get_lock_content (GIMP_ITEM (vectors));
}
return_vals = gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_set_boolean (&return_vals->values[1], lock_content);
return return_vals;
}
static GValueArray *
vectors_set_lock_content_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GValueArray *args,
GError **error)
{
gboolean success = TRUE;
GimpVectors *vectors;
gboolean lock_content;
vectors = gimp_value_get_vectors (&args->values[0], gimp);
lock_content = g_value_get_boolean (&args->values[1]);
if (success)
{
if (gimp_item_can_lock_content (GIMP_ITEM (vectors)))
gimp_item_set_lock_content (GIMP_ITEM (vectors), lock_content, TRUE);
else
success = FALSE;
}
return gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static GValueArray *
vectors_get_tattoo_invoker (GimpProcedure *procedure,
Gimp *gimp,
@ -1398,18 +1341,13 @@ vectors_to_selection_invoker (GimpProcedure *procedure,
if (success)
{
GimpImage *image = gimp_item_get_image (GIMP_ITEM (vectors));
if (image)
gimp_channel_select_vectors (gimp_image_get_mask (image),
_("Path to Selection"),
vectors,
operation,
antialias,
feather,
feather_radius_x,
feather_radius_y,
TRUE);
if (gimp_pdb_item_is_attached (GIMP_ITEM (vectors), NULL, FALSE, error))
gimp_item_to_selection (GIMP_ITEM (vectors),
operation,
antialias,
feather,
feather_radius_x,
feather_radius_y);
else
success = FALSE;
}
@ -1616,12 +1554,12 @@ register_vectors_procs (GimpPDB *pdb)
"gimp-vectors-is-valid");
gimp_procedure_set_static_strings (procedure,
"gimp-vectors-is-valid",
"Returns TRUE if the vectors object is valid.",
"This procedure checks if the given vectors ID is valid and refers to an existing vectors object.",
"Deprecated: Use 'gimp-item-is-valid' instead.",
"Deprecated: Use 'gimp-item-is-valid' instead.",
"Sven Neumann <sven@gimp.org>",
"Sven Neumann",
"2007",
NULL);
"gimp-item-is-valid");
gimp_procedure_add_argument (procedure,
gimp_param_spec_vectors_id ("vectors",
"vectors",
@ -1745,12 +1683,12 @@ register_vectors_procs (GimpPDB *pdb)
"gimp-vectors-get-image");
gimp_procedure_set_static_strings (procedure,
"gimp-vectors-get-image",
"Returns the vectors objects image.",
"Returns the vectors objects image.",
"Deprecated: Use 'gimp-item-get-image' instead.",
"Deprecated: Use 'gimp-item-get-image' instead.",
"Simon Budig",
"Simon Budig",
"2005",
NULL);
"gimp-item-get-image");
gimp_procedure_add_argument (procedure,
gimp_param_spec_vectors_id ("vectors",
"vectors",
@ -1774,12 +1712,12 @@ register_vectors_procs (GimpPDB *pdb)
"gimp-vectors-get-name");
gimp_procedure_set_static_strings (procedure,
"gimp-vectors-get-name",
"Gets the name of the vectors object.",
"Gets the name of the vectors object.",
"Deprecated: Use 'gimp-item-get-name' instead.",
"Deprecated: Use 'gimp-item-get-name' instead.",
"Simon Budig",
"Simon Budig",
"2005",
NULL);
"gimp-item-get-name");
gimp_procedure_add_argument (procedure,
gimp_param_spec_vectors_id ("vectors",
"vectors",
@ -1804,12 +1742,12 @@ register_vectors_procs (GimpPDB *pdb)
"gimp-vectors-set-name");
gimp_procedure_set_static_strings (procedure,
"gimp-vectors-set-name",
"Sets the name of the vectors object.",
"Sets the name of the vectors object.",
"Deprecated: Use 'gimp-item-set-name' instead.",
"Deprecated: Use 'gimp-item-set-name' instead.",
"Simon Budig",
"Simon Budig",
"2005",
NULL);
"gimp-item-set-name");
gimp_procedure_add_argument (procedure,
gimp_param_spec_vectors_id ("vectors",
"vectors",
@ -1834,12 +1772,12 @@ register_vectors_procs (GimpPDB *pdb)
"gimp-vectors-get-visible");
gimp_procedure_set_static_strings (procedure,
"gimp-vectors-get-visible",
"Gets the visibility of the vectors object.",
"Gets the visibility of the vectors object.",
"Deprecated: Use 'gimp-item-get-visible' instead.",
"Deprecated: Use 'gimp-item-get-visible' instead.",
"Simon Budig",
"Simon Budig",
"2005",
NULL);
"gimp-item-get-visible");
gimp_procedure_add_argument (procedure,
gimp_param_spec_vectors_id ("vectors",
"vectors",
@ -1863,12 +1801,12 @@ register_vectors_procs (GimpPDB *pdb)
"gimp-vectors-set-visible");
gimp_procedure_set_static_strings (procedure,
"gimp-vectors-set-visible",
"Sets the visibility of the vectors object.",
"Sets the visibility of the vectors object.",
"Deprecated: Use 'gimp-item-set-visible' instead.",
"Deprecated: Use 'gimp-item-set-visible' instead.",
"Simon Budig",
"Simon Budig",
"2005",
NULL);
"gimp-item-set-visible");
gimp_procedure_add_argument (procedure,
gimp_param_spec_vectors_id ("vectors",
"vectors",
@ -1892,12 +1830,12 @@ register_vectors_procs (GimpPDB *pdb)
"gimp-vectors-get-linked");
gimp_procedure_set_static_strings (procedure,
"gimp-vectors-get-linked",
"Gets the linked state of the vectors object.",
"Gets the linked state of the vectors object.",
"Deprecated: Use 'gimp-item-get-linked' instead.",
"Deprecated: Use 'gimp-item-get-linked' instead.",
"Simon Budig",
"Simon Budig",
"2005",
NULL);
"gimp-item-get-linked");
gimp_procedure_add_argument (procedure,
gimp_param_spec_vectors_id ("vectors",
"vectors",
@ -1921,12 +1859,12 @@ register_vectors_procs (GimpPDB *pdb)
"gimp-vectors-set-linked");
gimp_procedure_set_static_strings (procedure,
"gimp-vectors-set-linked",
"Sets the linked state of the vectors object.",
"Sets the linked state of the vectors object.",
"Deprecated: Use 'gimp-item-set-linked' instead.",
"Deprecated: Use 'gimp-item-set-linked' instead.",
"Simon Budig",
"Simon Budig",
"2005",
NULL);
"gimp-item-set-linked");
gimp_procedure_add_argument (procedure,
gimp_param_spec_vectors_id ("vectors",
"vectors",
@ -1942,64 +1880,6 @@ register_vectors_procs (GimpPDB *pdb)
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-vectors-get-lock-content
*/
procedure = gimp_procedure_new (vectors_get_lock_content_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-vectors-get-lock-content");
gimp_procedure_set_static_strings (procedure,
"gimp-vectors-get-lock-content",
"Gets the 'lock content' state of the vectors object.",
"Gets the 'lock content' state of the vectors object.",
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2009",
NULL);
gimp_procedure_add_argument (procedure,
gimp_param_spec_vectors_id ("vectors",
"vectors",
"The vectors object",
pdb->gimp, FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
g_param_spec_boolean ("lock-content",
"lock content",
"Whether the path's strokes are locked",
FALSE,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-vectors-set-lock-content
*/
procedure = gimp_procedure_new (vectors_set_lock_content_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-vectors-set-lock-content");
gimp_procedure_set_static_strings (procedure,
"gimp-vectors-set-lock-content",
"Sets the 'lock content' state of the vectors object.",
"Sets the 'lock content' state of the vectors object.",
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2009",
NULL);
gimp_procedure_add_argument (procedure,
gimp_param_spec_vectors_id ("vectors",
"vectors",
"The vectors object",
pdb->gimp, FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_boolean ("lock-content",
"lock content",
"Whether the path's strokes are locked",
FALSE,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-vectors-get-tattoo
*/
@ -2008,12 +1888,12 @@ register_vectors_procs (GimpPDB *pdb)
"gimp-vectors-get-tattoo");
gimp_procedure_set_static_strings (procedure,
"gimp-vectors-get-tattoo",
"Get the tattoo of the vectors object.",
"Get the tattoo state of the vectors object.",
"Deprecated: Use 'gimp-item-get-tattoo' instead.",
"Deprecated: Use 'gimp-item-get-tattoo' instead.",
"Simon Budig",
"Simon Budig",
"2005",
NULL);
"gimp-item-get-tattoo");
gimp_procedure_add_argument (procedure,
gimp_param_spec_vectors_id ("vectors",
"vectors",
@ -2037,12 +1917,12 @@ register_vectors_procs (GimpPDB *pdb)
"gimp-vectors-set-tattoo");
gimp_procedure_set_static_strings (procedure,
"gimp-vectors-set-tattoo",
"Set the tattoo of the vectors object.",
"Set the tattoo of the vectors object.",
"Deprecated: Use 'gimp-item-set-tattoo' instead.",
"Deprecated: Use 'gimp-item-set-tattoo' instead.",
"Simon Budig",
"Simon Budig",
"2005",
NULL);
"gimp-item-set-tattoo");
gimp_procedure_add_argument (procedure,
gimp_param_spec_vectors_id ("vectors",
"vectors",
@ -3110,7 +2990,7 @@ register_vectors_procs (GimpPDB *pdb)
gimp_procedure_set_static_strings (procedure,
"gimp-vectors-export-to-string",
"Save a path as an SVG string.",
"This procedure works like 'gimp-vectors-export-to-file' but creates a string rather than a file. The contents are a %NUL-terminated string that holds a complete XML document. If you pass 0 as the 'vectors' argument, then all paths in the image will be exported.",
"This procedure works like 'gimp-vectors-export-to-file' but creates a string rather than a file. The contents are a NUL-terminated string that holds a complete XML document. If you pass 0 as the 'vectors' argument, then all paths in the image will be exported.",
"Bill Skaggs <weskaggs@primate.ucdavis.edu>",
"Bill Skaggs",
"2007",

View File

@ -192,8 +192,8 @@ plug_in_params_to_args (GParamSpec **pspecs,
gimp_value_set_rgb (&value, &params[i].data.d_color);
break;
case GIMP_PDB_REGION:
g_message ("the \"region\" argument type is not supported");
case GIMP_PDB_ITEM:
g_value_set_int (&value, params[i].data.d_item);
break;
case GIMP_PDB_DISPLAY:
@ -353,8 +353,8 @@ plug_in_args_to_params (GValueArray *args,
gimp_value_get_rgb (value, &params[i].data.d_color);
break;
case GIMP_PDB_REGION:
g_message ("the \"region\" argument type is not supported");
case GIMP_PDB_ITEM:
params[i].data.d_item = g_value_get_int (value);
break;
case GIMP_PDB_DISPLAY:

View File

@ -17,6 +17,7 @@
#include "config.h"
#include <cairo/cairo.h>
#include <fontconfig/fontconfig.h>
#include <pango/pango.h>
#include <pango/pangoft2.h>
@ -31,6 +32,7 @@
static gchar * sanity_check_gimp (void);
static gchar * sanity_check_glib (void);
static gchar * sanity_check_cairo (void);
static gchar * sanity_check_pango (void);
static gchar * sanity_check_fontconfig (void);
static gchar * sanity_check_freetype (void);
@ -49,6 +51,9 @@ sanity_check (void)
if (! abort_message)
abort_message = sanity_check_glib ();
if (! abort_message)
abort_message = sanity_check_cairo ();
if (! abort_message)
abort_message = sanity_check_pango ();
@ -149,6 +154,36 @@ sanity_check_glib (void)
return NULL;
}
static gchar *
sanity_check_cairo (void)
{
#define CAIRO_REQUIRED_MAJOR 1
#define CAIRO_REQUIRED_MINOR 8
#define CAIRO_REQUIRED_MICRO 0
if (cairo_version () < CAIRO_VERSION_ENCODE (CAIRO_REQUIRED_MAJOR,
CAIRO_REQUIRED_MINOR,
CAIRO_REQUIRED_MICRO))
{
return g_strdup_printf
("The Cairo version being used is too old!\n\n"
"GIMP requires Cairo version %d.%d.%d or later.\n"
"Installed Cairo version is %s.\n\n"
"Somehow you or your software packager managed\n"
"to install GIMP with an older Cairo version.\n\n"
"Please upgrade to Cairo version %d.%d.%d or later.",
CAIRO_REQUIRED_MAJOR, CAIRO_REQUIRED_MINOR, CAIRO_REQUIRED_MICRO,
cairo_version_string (),
CAIRO_REQUIRED_MAJOR, CAIRO_REQUIRED_MINOR, CAIRO_REQUIRED_MICRO);
}
#undef CAIRO_REQUIRED_MAJOR
#undef CAIRO_REQUIRED_MINOR
#undef CAIRO_REQUIRED_MICRO
return NULL;
}
static gchar *
sanity_check_pango (void)
{

View File

@ -683,6 +683,19 @@ window_roles (GimpTestFixture *fixture,
*/
}
static void
paintbrush_is_standard_tool (GimpTestFixture *fixture,
gconstpointer data)
{
Gimp *gimp = GIMP (data);
GimpContext *user_context = gimp_get_user_context (gimp);
GimpToolInfo *tool_info = gimp_context_get_tool (user_context);
g_assert_cmpstr (tool_info->help_id,
==,
"gimp-tool-paintbrush");
}
static GimpUIManager *
gimp_ui_get_ui_manager (Gimp *gimp)
{
@ -839,7 +852,11 @@ int main(int argc, char **argv)
gimp = gimp_init_for_gui_testing (FALSE, TRUE);
gimp_test_run_mainloop_until_idle ();
/* Add tests */
/* Add tests. Note that the order matters. For example,
* 'paintbrush_is_standard_tool' can't be after
* 'tool_options_editor_updates'
*/
ADD_TEST (paintbrush_is_standard_tool);
ADD_TEST (tool_options_editor_updates);
ADD_TEST (automatic_tab_style);
ADD_TEST (create_new_image_via_dialog);

View File

@ -30,6 +30,7 @@
#include "core/gimpchannel-select.h"
#include "core/gimpdrawable.h"
#include "core/gimpgrid.h"
#include "core/gimpgrouplayer.h"
#include "core/gimpguide.h"
#include "core/gimpimage.h"
#include "core/gimpimage-grid.h"
@ -72,6 +73,16 @@
#define GIMP_MAINIMAGE_LAYER2_OPACITY 0.0
#define GIMP_MAINIMAGE_LAYER2_MODE GIMP_MULTIPLY_MODE
#define GIMP_MAINIMAGE_GROUP1_NAME "group1"
#define GIMP_MAINIMAGE_LAYER3_NAME "layer3"
#define GIMP_MAINIMAGE_LAYER4_NAME "layer4"
#define GIMP_MAINIMAGE_GROUP2_NAME "group2"
#define GIMP_MAINIMAGE_LAYER5_NAME "layer5"
#define GIMP_MAINIMAGE_VGUIDE1_POS 42
#define GIMP_MAINIMAGE_VGUIDE2_POS 82
#define GIMP_MAINIMAGE_HGUIDE1_POS 3
@ -545,7 +556,78 @@ gimp_create_mainimage (gboolean with_unusual_stuff,
/* Adds stuff like layer groups */
if (use_gimp_2_8_features)
{
/* TODO: mitch? ;) */
GimpLayer *parent;
/* Add a layer group and some layers:
*
* group1
* layer3
* layer4
* group2
* layer5
*/
/* group1 */
layer = gimp_group_layer_new (image);
gimp_object_set_name (GIMP_OBJECT (layer), GIMP_MAINIMAGE_GROUP1_NAME);
gimp_image_add_layer (image,
layer,
NULL /*parent*/,
-1 /*position*/,
FALSE /*push_undo*/);
parent = layer;
/* layer3 */
layer = gimp_layer_new (image,
GIMP_MAINIMAGE_LAYER1_WIDTH,
GIMP_MAINIMAGE_LAYER1_HEIGHT,
GIMP_MAINIMAGE_LAYER1_TYPE,
GIMP_MAINIMAGE_LAYER3_NAME,
GIMP_MAINIMAGE_LAYER1_OPACITY,
GIMP_MAINIMAGE_LAYER1_MODE);
gimp_image_add_layer (image,
layer,
parent,
-1 /*position*/,
FALSE /*push_undo*/);
/* layer4 */
layer = gimp_layer_new (image,
GIMP_MAINIMAGE_LAYER1_WIDTH,
GIMP_MAINIMAGE_LAYER1_HEIGHT,
GIMP_MAINIMAGE_LAYER1_TYPE,
GIMP_MAINIMAGE_LAYER4_NAME,
GIMP_MAINIMAGE_LAYER1_OPACITY,
GIMP_MAINIMAGE_LAYER1_MODE);
gimp_image_add_layer (image,
layer,
parent,
-1 /*position*/,
FALSE /*push_undo*/);
/* group2 */
layer = gimp_group_layer_new (image);
gimp_object_set_name (GIMP_OBJECT (layer), GIMP_MAINIMAGE_GROUP2_NAME);
gimp_image_add_layer (image,
layer,
parent,
-1 /*position*/,
FALSE /*push_undo*/);
parent = layer;
/* layer5 */
layer = gimp_layer_new (image,
GIMP_MAINIMAGE_LAYER1_WIDTH,
GIMP_MAINIMAGE_LAYER1_HEIGHT,
GIMP_MAINIMAGE_LAYER1_TYPE,
GIMP_MAINIMAGE_LAYER5_NAME,
GIMP_MAINIMAGE_LAYER1_OPACITY,
GIMP_MAINIMAGE_LAYER1_MODE);
gimp_image_add_layer (image,
layer,
parent,
-1 /*position*/,
FALSE /*push_undo*/);
}
/* Todo, should be tested somehow:
@ -848,7 +930,20 @@ gimp_assert_mainimage (GimpImage *image,
if (use_gimp_2_8_features)
{
/* TODO: mitch? ;) */
/* Only verify the parent relationships, the layer attributes
* are tested above
*/
GimpItem *group1 = GIMP_ITEM (gimp_image_get_layer_by_name (image, GIMP_MAINIMAGE_GROUP1_NAME));
GimpItem *layer3 = GIMP_ITEM (gimp_image_get_layer_by_name (image, GIMP_MAINIMAGE_LAYER3_NAME));
GimpItem *layer4 = GIMP_ITEM (gimp_image_get_layer_by_name (image, GIMP_MAINIMAGE_LAYER4_NAME));
GimpItem *group2 = GIMP_ITEM (gimp_image_get_layer_by_name (image, GIMP_MAINIMAGE_GROUP2_NAME));
GimpItem *layer5 = GIMP_ITEM (gimp_image_get_layer_by_name (image, GIMP_MAINIMAGE_LAYER5_NAME));
g_assert (gimp_item_get_parent (group1) == NULL);
g_assert (gimp_item_get_parent (layer3) == group1);
g_assert (gimp_item_get_parent (layer4) == group1);
g_assert (gimp_item_get_parent (group2) == group1);
g_assert (gimp_item_get_parent (layer5) == group2);
}
}

View File

@ -210,15 +210,23 @@ gimp_color_tool_control (GimpTool *tool,
case GIMP_TOOL_ACTION_RESUME:
if (color_tool->sample_point &&
gimp_display_shell_get_show_sample_points (shell))
gimp_display_shell_draw_sample_point (shell, color_tool->sample_point,
NULL, TRUE);
{
cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (shell->canvas));
gimp_display_shell_draw_sample_point (shell, cr,
color_tool->sample_point, TRUE);
cairo_destroy (cr);
}
break;
case GIMP_TOOL_ACTION_HALT:
if (color_tool->sample_point &&
gimp_display_shell_get_show_sample_points (shell))
gimp_display_shell_draw_sample_point (shell, color_tool->sample_point,
NULL, FALSE);
{
cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (shell->canvas));
gimp_display_shell_draw_sample_point (shell, cr,
color_tool->sample_point, FALSE);
cairo_destroy (cr);
}
break;
}
@ -356,8 +364,12 @@ gimp_color_tool_button_release (GimpTool *tool,
gimp_image_flush (image);
if (color_tool->sample_point)
gimp_display_shell_draw_sample_point (shell, color_tool->sample_point,
NULL, TRUE);
{
cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (shell->canvas));
gimp_display_shell_draw_sample_point (shell, cr,
color_tool->sample_point, TRUE);
cairo_destroy (cr);
}
color_tool->moving_sample_point = FALSE;
color_tool->sample_point_x = -1;
@ -496,8 +508,12 @@ gimp_color_tool_oper_update (GimpTool *tool,
color_tool->sample_point = sample_point;
if (color_tool->sample_point)
gimp_display_shell_draw_sample_point (shell, color_tool->sample_point,
NULL, TRUE);
{
cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (shell->canvas));
gimp_display_shell_draw_sample_point (shell, cr,
color_tool->sample_point, TRUE);
cairo_destroy (cr);
}
}
static void
@ -823,9 +839,13 @@ gimp_color_tool_start_sample_point (GimpTool *tool,
gimp_tool_control_set_scroll_lock (tool->control, TRUE);
if (color_tool->sample_point)
gimp_display_shell_draw_sample_point (gimp_display_get_shell (display),
color_tool->sample_point,
NULL, FALSE);
{
GimpDisplayShell *shell = gimp_display_get_shell (display);
cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (shell->canvas));
gimp_display_shell_draw_sample_point (shell, cr,
color_tool->sample_point, FALSE);
cairo_destroy (cr);
}
color_tool->sample_point = NULL;
color_tool->moving_sample_point = TRUE;

View File

@ -121,7 +121,7 @@ gimp_desaturate_tool_initialize (GimpTool *tool,
if (! gimp_drawable_is_rgb (drawable))
{
g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
_("Desaturate does only operate on RGB layers."));
_("Desaturate only operates on RGB layers."));
return FALSE;
}

View File

@ -571,7 +571,10 @@ gimp_foreground_select_tool_draw (GimpDrawTool *draw_tool)
if (fg_select->stroke)
{
GimpDisplayShell *shell = gimp_display_get_shell (draw_tool->display);
cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (shell->canvas));
gimp_display_shell_draw_pen (gimp_display_get_shell (draw_tool->display),
cr,
(const GimpVector2 *)fg_select->stroke->data,
fg_select->stroke->len,
GIMP_CONTEXT (options),
@ -579,6 +582,7 @@ gimp_foreground_select_tool_draw (GimpDrawTool *draw_tool)
GIMP_ACTIVE_COLOR_BACKGROUND :
GIMP_ACTIVE_COLOR_FOREGROUND),
options->stroke_width);
cairo_destroy (cr);
}
if (fg_select->mask)

View File

@ -190,12 +190,20 @@ gimp_move_tool_control (GimpTool *tool,
case GIMP_TOOL_ACTION_RESUME:
if (move->guide && gimp_display_shell_get_show_guides (shell))
gimp_display_shell_draw_guide (shell, move->guide, NULL, TRUE);
{
cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (shell->canvas));
gimp_display_shell_draw_guide (shell, cr, move->guide, TRUE);
cairo_destroy (cr);
}
break;
case GIMP_TOOL_ACTION_HALT:
if (move->guide && gimp_display_shell_get_show_guides (shell))
gimp_display_shell_draw_guide (shell, move->guide, NULL, FALSE);
{
cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (shell->canvas));
gimp_display_shell_draw_guide (shell, cr, move->guide, FALSE);
cairo_destroy (cr);
}
break;
}
@ -446,7 +454,11 @@ gimp_move_tool_button_release (GimpTool *tool,
gimp_image_flush (image);
if (move->guide)
gimp_display_shell_draw_guide (shell, move->guide, NULL, TRUE);
{
cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (shell->canvas));
gimp_display_shell_draw_guide (shell, cr, move->guide, TRUE);
cairo_destroy (cr);
}
move->moving_guide = FALSE;
move->guide_position = -1;
@ -667,12 +679,20 @@ gimp_move_tool_oper_update (GimpTool *tool,
}
if (move->guide && move->guide != guide)
gimp_display_shell_draw_guide (shell, move->guide, NULL, FALSE);
{
cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (shell->canvas));
gimp_display_shell_draw_guide (shell, cr, move->guide, FALSE);
cairo_destroy (cr);
}
move->guide = guide;
if (move->guide)
gimp_display_shell_draw_guide (shell, move->guide, NULL, TRUE);
{
cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (shell->canvas));
gimp_display_shell_draw_guide (shell, cr, move->guide, TRUE);
cairo_destroy (cr);
}
}
static void
@ -818,8 +838,12 @@ gimp_move_tool_start_guide (GimpMoveTool *move,
gimp_tool_control_set_scroll_lock (tool->control, TRUE);
if (move->guide)
gimp_display_shell_draw_guide (gimp_display_get_shell (display),
move->guide, NULL, FALSE);
{
GimpDisplayShell *shell = gimp_display_get_shell (display);
cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (shell->canvas));
gimp_display_shell_draw_guide (shell, cr, move->guide, FALSE);
cairo_destroy (cr);
}
move->guide = NULL;
move->moving_guide = TRUE;

View File

@ -865,7 +865,7 @@ gimp_rectangle_options_gui (GimpToolOptions *tool_options)
"default-aspect-denominator",
"overridden-fixed-aspect",
FALSE, TRUE,
":/",
":/" "xX*",
TRUE,
0.001, GIMP_MAX_IMAGE_SIZE);
gtk_box_pack_start (GTK_BOX (private->fixed_aspect_hbox), entry,
@ -930,7 +930,7 @@ gimp_rectangle_options_gui (GimpToolOptions *tool_options)
"default-fixed-size-height",
"overridden-fixed-size",
TRUE, FALSE,
"xX*",
"xX*" ":/",
FALSE,
1, GIMP_MAX_IMAGE_SIZE);
gtk_box_pack_start (GTK_BOX (private->fixed_size_hbox), entry,

View File

@ -86,7 +86,7 @@ gimp_region_select_options_class_init (GimpRegionSelectOptionsClass *klass)
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SAMPLE_MERGED,
"sample-merged",
N_("Base region_select on all visible layers"),
N_("Base selection on all visible layers"),
FALSE,
GIMP_PARAM_STATIC_STRINGS);

View File

@ -31,7 +31,6 @@
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimpchannel-select.h"
#include "core/gimpimage.h"
#include "core/gimpimage-undo.h"
#include "core/gimpimage-undo-push.h"
@ -1953,11 +1952,9 @@ gimp_vector_tool_to_selection_extended (GimpVectorTool *vector_tool,
operation = GIMP_CHANNEL_OP_SUBTRACT;
}
gimp_channel_select_vectors (gimp_image_get_mask (image),
_("Path to selection"),
vector_tool->vectors,
operation,
TRUE, FALSE, 0, 0, TRUE);
gimp_item_to_selection (GIMP_ITEM (vector_tool->vectors),
operation,
TRUE, FALSE, 0, 0);
gimp_image_flush (image);
}

View File

@ -29,6 +29,7 @@
#include "vectors-types.h"
#include "core/gimp.h"
#include "core/gimpchannel-select.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimpdrawable-stroke.h"
@ -111,6 +112,12 @@ static gboolean gimp_vectors_stroke (GimpItem *item,
gboolean push_undo,
GimpProgress *progress,
GError **error);
static void gimp_vectors_to_selection (GimpItem *item,
GimpChannelOps op,
gboolean antialias,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y);
static void gimp_vectors_real_thaw (GimpVectors *vectors);
static void gimp_vectors_real_stroke_add (GimpVectors *vectors,
@ -191,15 +198,24 @@ gimp_vectors_class_init (GimpVectorsClass *klass)
item_class->rotate = gimp_vectors_rotate;
item_class->transform = gimp_vectors_transform;
item_class->stroke = gimp_vectors_stroke;
item_class->to_selection = gimp_vectors_to_selection;
item_class->default_name = _("Path");
item_class->rename_desc = _("Rename Path");
item_class->translate_desc = _("Move Path");
item_class->scale_desc = _("Scale Path");
item_class->resize_desc = _("Resize Path");
item_class->flip_desc = _("Flip Path");
item_class->rotate_desc = _("Rotate Path");
item_class->transform_desc = _("Transform Path");
item_class->stroke_desc = _("Stroke Path");
item_class->rename_desc = C_("undo-type", "Rename Path");
item_class->translate_desc = C_("undo-type", "Move Path");
item_class->scale_desc = C_("undo-type", "Scale Path");
item_class->resize_desc = C_("undo-type", "Resize Path");
item_class->flip_desc = C_("undo-type", "Flip Path");
item_class->rotate_desc = C_("undo-type", "Rotate Path");
item_class->transform_desc = C_("undo-type", "Transform Path");
item_class->stroke_desc = C_("undo-type", "Stroke Path");
item_class->to_selection_desc = C_("undo-type", "Path to Selection");
item_class->reorder_desc = C_("undo-type", "Reorder Path");
item_class->raise_desc = C_("undo-type", "Raise Path");
item_class->raise_to_top_desc = C_("undo-type", "Raise Path to Top");
item_class->lower_desc = C_("undo-type", "Lower Path");
item_class->lower_to_bottom_desc = C_("undo-type", "Lower Path to Bottom");
item_class->raise_failed = _("Path cannot be raised higher.");
item_class->lower_failed = _("Path cannot be lowered more.");
klass->freeze = NULL;
klass->thaw = gimp_vectors_real_thaw;
@ -559,6 +575,25 @@ gimp_vectors_stroke (GimpItem *item,
return retval;
}
static void
gimp_vectors_to_selection (GimpItem *item,
GimpChannelOps op,
gboolean antialias,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y)
{
GimpVectors *vectors = GIMP_VECTORS (item);
GimpImage *image = gimp_item_get_image (item);
gimp_channel_select_vectors (gimp_image_get_mask (image),
GIMP_ITEM_GET_CLASS (item)->to_selection_desc,
vectors,
op, antialias,
feather, feather_radius_x, feather_radius_x,
TRUE);
}
static void
gimp_vectors_real_thaw (GimpVectors *vectors)
{

View File

@ -129,7 +129,7 @@ gimp_version_show (gboolean be_verbose)
if (be_verbose)
{
g_print (_("git commit %s"), GIMP_GIT_VERSION);
g_print ("git commit %s", GIMP_GIT_VERSION);
g_print ("\n");
g_print ("\n");

View File

@ -808,6 +808,28 @@ gimp_action_group_set_action_tooltip (GimpActionGroup *group,
gtk_action_set_tooltip (action, tooltip);
}
const gchar *
gimp_action_group_get_action_tooltip (GimpActionGroup *group,
const gchar *action_name)
{
GtkAction *action;
g_return_val_if_fail (GIMP_IS_ACTION_GROUP (group), NULL);
g_return_val_if_fail (action_name != NULL, NULL);
action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), action_name);
if (! action)
{
g_warning ("%s: Unable to get tooltip of action "
"which doesn't exist: %s",
G_STRFUNC, action_name);
return NULL;
}
return gtk_action_get_tooltip (action);
}
void
gimp_action_group_set_action_color (GimpActionGroup *group,
const gchar *action_name,

View File

@ -171,34 +171,36 @@ void gimp_action_group_add_plug_in_actions (GimpActionGroup *grou
guint n_entries,
GCallback callback);
void gimp_action_group_activate_action (GimpActionGroup *group,
const gchar *action_name);
void gimp_action_group_activate_action (GimpActionGroup *group,
const gchar *action_name);
void gimp_action_group_set_action_visible (GimpActionGroup *group,
const gchar *action_name,
gboolean visible);
void gimp_action_group_set_action_sensitive (GimpActionGroup *group,
const gchar *action_name,
gboolean sensitive);
void gimp_action_group_set_action_active (GimpActionGroup *group,
const gchar *action_name,
gboolean active);
void gimp_action_group_set_action_label (GimpActionGroup *group,
const gchar *action_name,
const gchar *label);
void gimp_action_group_set_action_tooltip (GimpActionGroup *group,
const gchar *action_name,
const gchar *tooltip);
const gchar * gimp_action_group_get_action_tooltip (GimpActionGroup *group,
const gchar *action_name);
void gimp_action_group_set_action_color (GimpActionGroup *group,
const gchar *action_name,
const GimpRGB *color,
gboolean set_label);
void gimp_action_group_set_action_viewable (GimpActionGroup *group,
const gchar *action_name,
GimpViewable *viewable);
void gimp_action_group_set_action_hide_empty (GimpActionGroup *group,
const gchar *action_name,
gboolean hide_empty);
void gimp_action_group_set_action_visible (GimpActionGroup *group,
const gchar *action_name,
gboolean visible);
void gimp_action_group_set_action_sensitive (GimpActionGroup *group,
const gchar *action_name,
gboolean sensitive);
void gimp_action_group_set_action_active (GimpActionGroup *group,
const gchar *action_name,
gboolean active);
void gimp_action_group_set_action_label (GimpActionGroup *group,
const gchar *action_name,
const gchar *label);
void gimp_action_group_set_action_tooltip (GimpActionGroup *group,
const gchar *action_name,
const gchar *tooltip);
void gimp_action_group_set_action_color (GimpActionGroup *group,
const gchar *action_name,
const GimpRGB *color,
gboolean set_label);
void gimp_action_group_set_action_viewable (GimpActionGroup *group,
const gchar *action_name,
GimpViewable *viewable);
void gimp_action_group_set_action_hide_empty(GimpActionGroup *group,
const gchar *action_name,
gboolean hide_empty);
#endif /* __GIMP_ACTION_GROUP_H__ */

Some files were not shown because too many files have changed in this diff Show More