Bug 769738 - Add color tags/labels for layers/channels/paths

Add property "color-tag" of type enum GimpColorTag to GimpItem so all
layers, channels and paths can be tagged with a color.

For interoperability, use the color list from Krita which is a
superset of Photoshop's colors.

Features a "Color Tag" submenu in the layers, channels and paths
menus, a row of color radio buttons in the properties dialogs,
undo and PDB API.

As a side effect, some common code is now factores out into
items-actions.[ch] and items-commands.[ch] which adds visible, linked
and lock actions for layers and channels.
This commit is contained in:
Michael Natterer 2016-10-29 16:50:13 +02:00
parent 956d45bf61
commit 31fcd79dd9
49 changed files with 1590 additions and 209 deletions

View File

@ -116,6 +116,10 @@ libappactions_a_SOURCES = \
images-actions.h \
images-commands.c \
images-commands.h \
items-commands.c \
items-commands.h \
items-actions.c \
items-actions.h \
layers-actions.c \
layers-actions.h \
layers-commands.c \

View File

@ -34,6 +34,7 @@
#include "actions.h"
#include "channels-actions.h"
#include "channels-commands.h"
#include "items-actions.h"
#include "gimp-intl.h"
@ -44,6 +45,10 @@ static const GimpActionEntry channels_actions[] =
NC_("channels-action", "Channels Menu"), NULL, NULL, NULL,
GIMP_HELP_CHANNEL_DIALOG },
{ "channels-color-tag-menu", GIMP_STOCK_CLOSE /* abused */,
NC_("channels-action", "Color Tag"), NULL, NULL, NULL,
GIMP_HELP_CHANNEL_COLOR_TAG },
{ "channels-edit-attributes", "gtk-edit",
NC_("channels-action", "_Edit Channel Attributes..."), NULL,
NC_("channels-action", "Edit the channel's name, color and opacity"),
@ -102,6 +107,90 @@ static const GimpActionEntry channels_actions[] =
GIMP_HELP_CHANNEL_LOWER_TO_BOTTOM }
};
static const GimpToggleActionEntry channels_toggle_actions[] =
{
{ "channels-visible", GIMP_STOCK_VISIBLE,
NC_("channels-action", "_Visible"), NULL, NULL,
G_CALLBACK (channels_visible_cmd_callback),
FALSE,
GIMP_HELP_CHANNEL_VISIBLE },
{ "channels-linked", GIMP_STOCK_LINKED,
NC_("channels-action", "_Linked"), NULL, NULL,
G_CALLBACK (channels_linked_cmd_callback),
FALSE,
GIMP_HELP_CHANNEL_LINKED },
{ "channels-lock-content", NULL /* GIMP_STOCK_LOCK */,
NC_("channels-action", "L_ock pixels"), NULL, NULL,
G_CALLBACK (channels_lock_content_cmd_callback),
FALSE,
GIMP_HELP_CHANNEL_LOCK_PIXELS },
{ "channels-lock-position", GIMP_STOCK_TOOL_MOVE,
NC_("channels-action", "L_ock position"), NULL, NULL,
G_CALLBACK (channels_lock_position_cmd_callback),
FALSE,
GIMP_HELP_CHANNEL_LOCK_POSITION }
};
static const GimpEnumActionEntry channels_color_tag_actions[] =
{
{ "channels-color-tag-none", GIMP_STOCK_CLOSE /* abused */,
NC_("channels-action", "None"), NULL,
NC_("channels-action", "Clear color tag"),
GIMP_COLOR_TAG_NONE, FALSE,
GIMP_HELP_CHANNEL_COLOR_TAG },
{ "channels-color-tag-blue", NULL,
NC_("channels-action", "Blue"), NULL,
NC_("channels-action", "Set color tag to blue"),
GIMP_COLOR_TAG_BLUE, FALSE,
GIMP_HELP_CHANNEL_COLOR_TAG },
{ "channels-color-tag-green", NULL,
NC_("channels-action", "Green"), NULL,
NC_("channels-action", "Set color tag to green"),
GIMP_COLOR_TAG_GREEN, FALSE,
GIMP_HELP_CHANNEL_COLOR_TAG },
{ "channels-color-tag-yellow", NULL,
NC_("channels-action", "Yellow"), NULL,
NC_("channels-action", "Set color tag to yellow"),
GIMP_COLOR_TAG_YELLOW, FALSE,
GIMP_HELP_CHANNEL_COLOR_TAG },
{ "channels-color-tag-orange", NULL,
NC_("channels-action", "Orange"), NULL,
NC_("channels-action", "Set color tag to orange"),
GIMP_COLOR_TAG_ORANGE, FALSE,
GIMP_HELP_CHANNEL_COLOR_TAG },
{ "channels-color-tag-brown", NULL,
NC_("channels-action", "Brown"), NULL,
NC_("channels-action", "Set color tag to brown"),
GIMP_COLOR_TAG_BROWN, FALSE,
GIMP_HELP_CHANNEL_COLOR_TAG },
{ "channels-color-tag-red", NULL,
NC_("channels-action", "Red"), NULL,
NC_("channels-action", "Set color tag to red"),
GIMP_COLOR_TAG_RED, FALSE,
GIMP_HELP_CHANNEL_COLOR_TAG },
{ "channels-color-tag-violet", NULL,
NC_("channels-action", "Violet"), NULL,
NC_("channels-action", "Set color tag to violet"),
GIMP_COLOR_TAG_VIOLET, FALSE,
GIMP_HELP_CHANNEL_COLOR_TAG },
{ "channels-color-tag-gray", NULL,
NC_("channels-action", "Gray"), NULL,
NC_("channels-action", "Set color tag to gray"),
GIMP_COLOR_TAG_GRAY, FALSE,
GIMP_HELP_CHANNEL_COLOR_TAG }
};
static const GimpEnumActionEntry channels_to_selection_actions[] =
{
{ "channels-selection-replace", GIMP_STOCK_SELECTION_REPLACE,
@ -137,10 +226,21 @@ channels_actions_setup (GimpActionGroup *group)
channels_actions,
G_N_ELEMENTS (channels_actions));
gimp_action_group_add_toggle_actions (group, "channels-action",
channels_toggle_actions,
G_N_ELEMENTS (channels_toggle_actions));
gimp_action_group_add_enum_actions (group, "channels-action",
channels_color_tag_actions,
G_N_ELEMENTS (channels_color_tag_actions),
G_CALLBACK (channels_color_tag_cmd_callback));
gimp_action_group_add_enum_actions (group, "channels-action",
channels_to_selection_actions,
G_N_ELEMENTS (channels_to_selection_actions),
G_CALLBACK (channels_to_selection_cmd_callback));
items_actions_setup (group, "channels");
}
void
@ -206,4 +306,6 @@ channels_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("channels-selection-intersect", !fs && (channel || component));
#undef SET_SENSITIVE
items_actions_update (group, "channels", GIMP_ITEM (channel));
}

View File

@ -49,6 +49,7 @@
#include "actions.h"
#include "channels-commands.h"
#include "items-commands.h"
#include "gimp-intl.h"
@ -64,6 +65,7 @@ static void channels_new_callback (GtkWidget *dialog,
gboolean save_selection,
gboolean channel_visible,
gboolean channel_linked,
GimpColorTag channel_color_tag,
gboolean channel_lock_content,
gboolean channel_lock_position,
gpointer user_data);
@ -76,6 +78,7 @@ static void channels_edit_attributes_callback (GtkWidget *dialog,
gboolean save_selection,
gboolean channel_visible,
gboolean channel_linked,
GimpColorTag channel_color_tag,
gboolean channel_lock_content,
gboolean channel_lock_position,
gpointer user_data);
@ -117,6 +120,7 @@ channels_edit_attributes_cmd_callback (GtkAction *action,
&channel->color,
gimp_item_get_visible (item),
gimp_item_get_linked (item),
gimp_item_get_color_tag (item),
gimp_item_get_lock_content (item),
gimp_item_get_lock_position (item),
channels_edit_attributes_callback,
@ -161,6 +165,7 @@ channels_new_cmd_callback (GtkAction *action,
&config->channel_new_color,
TRUE,
FALSE,
GIMP_COLOR_TAG_NONE,
FALSE,
FALSE,
channels_new_callback,
@ -362,6 +367,63 @@ channels_to_selection_cmd_callback (GtkAction *action,
gimp_image_flush (image);
}
void
channels_visible_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *image;
GimpChannel *channel;
return_if_no_channel (image, channel, data);
items_visible_cmd_callback (action, image, GIMP_ITEM (channel));
}
void
channels_linked_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *image;
GimpChannel *channel;
return_if_no_channel (image, channel, data);
items_linked_cmd_callback (action, image, GIMP_ITEM (channel));
}
void
channels_lock_content_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *image;
GimpChannel *channel;
return_if_no_channel (image, channel, data);
items_lock_content_cmd_callback (action, image, GIMP_ITEM (channel));
}
void
channels_lock_position_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *image;
GimpChannel *channel;
return_if_no_channel (image, channel, data);
items_lock_position_cmd_callback (action, image, GIMP_ITEM (channel));
}
void
channels_color_tag_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpImage *image;
GimpChannel *channel;
return_if_no_channel (image, channel, data);
items_color_tag_cmd_callback (action, image, GIMP_ITEM (channel),
(GimpColorTag) value);
}
/* private functions */
@ -375,6 +437,7 @@ channels_new_callback (GtkWidget *dialog,
gboolean save_selection,
gboolean channel_visible,
gboolean channel_linked,
GimpColorTag channel_color_tag,
gboolean channel_lock_content,
gboolean channel_lock_position,
gpointer user_data)
@ -411,6 +474,7 @@ channels_new_callback (GtkWidget *dialog,
gimp_item_set_visible (GIMP_ITEM (channel), channel_visible, FALSE);
gimp_item_set_linked (GIMP_ITEM (channel), channel_linked, FALSE);
gimp_item_set_color_tag (GIMP_ITEM (channel), channel_color_tag, FALSE);
gimp_item_set_lock_content (GIMP_ITEM (channel), channel_lock_content, FALSE);
gimp_item_set_lock_position (GIMP_ITEM (channel), channel_lock_position, FALSE);
@ -431,6 +495,7 @@ channels_edit_attributes_callback (GtkWidget *dialog,
gboolean save_selection,
gboolean channel_visible,
gboolean channel_linked,
GimpColorTag channel_color_tag,
gboolean channel_lock_content,
gboolean channel_lock_position,
gpointer user_data)
@ -441,6 +506,7 @@ channels_edit_attributes_callback (GtkWidget *dialog,
gimp_rgba_distance (channel_color, &channel->color) > 0.0001 ||
channel_visible != gimp_item_get_visible (item) ||
channel_linked != gimp_item_get_linked (item) ||
channel_color_tag != gimp_item_get_color_tag (item) ||
channel_lock_content != gimp_item_get_lock_content (item) ||
channel_lock_position != gimp_item_get_lock_position (item))
{
@ -460,6 +526,9 @@ channels_edit_attributes_callback (GtkWidget *dialog,
if (channel_linked != gimp_item_get_linked (item))
gimp_item_set_linked (item, channel_linked, TRUE);
if (channel_color_tag != gimp_item_get_color_tag (item))
gimp_item_set_color_tag (item, channel_color_tag, TRUE);
if (channel_lock_content != gimp_item_get_lock_content (item))
gimp_item_set_lock_content (item, channel_lock_content, TRUE);

View File

@ -43,5 +43,18 @@ void channels_to_selection_cmd_callback (GtkAction *action,
gint value,
gpointer data);
void channels_visible_cmd_callback (GtkAction *action,
gpointer data);
void channels_linked_cmd_callback (GtkAction *action,
gpointer data);
void channels_lock_content_cmd_callback (GtkAction *action,
gpointer data);
void channels_lock_position_cmd_callback (GtkAction *action,
gpointer data);
void channels_color_tag_cmd_callback (GtkAction *action,
gint value,
gpointer data);
#endif /* __CHANNELS_COMMANDS_H__ */

138
app/actions/items-actions.c Normal file
View File

@ -0,0 +1,138 @@
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* 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 <gegl.h>
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "actions-types.h"
#include "core/gimpitem.h"
#include "widgets/gimpactiongroup.h"
#include "widgets/gimpwidgets-utils.h"
#include "items-actions.h"
void
items_actions_setup (GimpActionGroup *group,
const gchar *prefix)
{
GEnumClass *enum_class;
GEnumValue *value;
enum_class = g_type_class_ref (GIMP_TYPE_COLOR_TAG);
for (value = enum_class->values; value->value_name; value++)
{
gchar action[32];
g_snprintf (action, sizeof (action),
"%s-color-tag-%s", prefix, value->value_nick);
if (value->value == GIMP_COLOR_TAG_NONE)
{
gimp_action_group_set_action_always_show_image (group, action, TRUE);
}
else
{
GimpRGB color;
gimp_get_color_tag_color (value->value, &color);
gimp_action_group_set_action_color (group, action, &color, FALSE);
}
}
g_type_class_unref (enum_class);
}
void
items_actions_update (GimpActionGroup *group,
const gchar *prefix,
GimpItem *item)
{
GEnumClass *enum_class;
GEnumValue *value;
gchar action[32];
gboolean visible = FALSE;
gboolean linked = FALSE;
gboolean has_color_tag = FALSE;
gboolean locked = FALSE;
gboolean can_lock = FALSE;
gboolean locked_pos = FALSE;
gboolean can_lock_pos = FALSE;
GimpRGB tag_color;
if (item)
{
visible = gimp_item_get_visible (item);
linked = gimp_item_get_linked (item);
locked = gimp_item_get_lock_content (item);
can_lock = gimp_item_can_lock_content (item);
locked_pos = gimp_item_get_lock_position (item);
can_lock_pos = gimp_item_can_lock_position (item);
has_color_tag = gimp_get_color_tag_color (gimp_item_get_color_tag (item),
&tag_color);
}
#define SET_SENSITIVE(action,condition) \
gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
#define SET_ACTIVE(action,condition) \
gimp_action_group_set_action_active (group, action, (condition) != 0)
#define SET_COLOR(action,color) \
gimp_action_group_set_action_color (group, action, color, FALSE)
g_snprintf (action, sizeof (action), "%s-visible", prefix);
SET_SENSITIVE (action, item);
SET_ACTIVE (action, visible);
g_snprintf (action, sizeof (action), "%s-linked", prefix);
SET_SENSITIVE (action, item);
SET_ACTIVE (action, linked);
g_snprintf (action, sizeof (action), "%s-lock-content", prefix);
SET_SENSITIVE (action, can_lock);
SET_ACTIVE (action, locked);
g_snprintf (action, sizeof (action), "%s-lock-position", prefix);
SET_SENSITIVE (action, can_lock_pos);
SET_ACTIVE (action, locked_pos);
g_snprintf (action, sizeof (action), "%s-color-tag-menu", prefix);
SET_COLOR (action, has_color_tag ? &tag_color : NULL);
enum_class = g_type_class_ref (GIMP_TYPE_COLOR_TAG);
for (value = enum_class->values; value->value_name; value++)
{
g_snprintf (action, sizeof (action),
"%s-color-tag-%s", prefix, value->value_nick);
SET_SENSITIVE (action, item);
}
g_type_class_unref (enum_class);
#undef SET_SENSITIVE
#undef SET_ACTIVE
#undef SET_COLOR
}

View File

@ -0,0 +1,29 @@
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* 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 __ITEMS_ACTIONS_H__
#define __ITEMS_ACTIONS_H__
void items_actions_setup (GimpActionGroup *group,
const gchar *prefix);
void items_actions_update (GimpActionGroup *group,
const gchar *prefix,
GimpItem *item);
#endif /* __ITEMS_ACTIONS_H__ */

View File

@ -0,0 +1,158 @@
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* 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 <gegl.h>
#include <gtk/gtk.h>
#include "actions-types.h"
#include "core/gimpimage.h"
#include "core/gimpimage-undo.h"
#include "core/gimpitem.h"
#include "core/gimpitemundo.h"
#include "items-commands.h"
#include "gimp-intl.h"
/* public functions */
void
items_visible_cmd_callback (GtkAction *action,
GimpImage *image,
GimpItem *item)
{
gboolean visible;
visible = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
if (visible != gimp_item_get_visible (item))
{
GimpUndo *undo;
gboolean push_undo = TRUE;
undo = gimp_image_undo_can_compress (image, GIMP_TYPE_ITEM_UNDO,
GIMP_UNDO_ITEM_VISIBILITY);
if (undo && GIMP_ITEM_UNDO (undo)->item == item)
push_undo = FALSE;
gimp_item_set_visible (item, visible, push_undo);
gimp_image_flush (image);
}
}
void
items_linked_cmd_callback (GtkAction *action,
GimpImage *image,
GimpItem *item)
{
gboolean linked;
linked = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
if (linked != gimp_item_get_linked (item))
{
GimpUndo *undo;
gboolean push_undo = TRUE;
undo = gimp_image_undo_can_compress (image, GIMP_TYPE_ITEM_UNDO,
GIMP_UNDO_ITEM_LINKED);
if (undo && GIMP_ITEM_UNDO (undo)->item == item)
push_undo = FALSE;
gimp_item_set_linked (item, linked, push_undo);
gimp_image_flush (image);
}
}
void
items_lock_content_cmd_callback (GtkAction *action,
GimpImage *image,
GimpItem *item)
{
gboolean locked;
locked = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
if (locked != gimp_item_get_lock_content (item))
{
GimpUndo *undo;
gboolean push_undo = TRUE;
undo = gimp_image_undo_can_compress (image, GIMP_TYPE_ITEM_UNDO,
GIMP_UNDO_ITEM_LINKED);
if (undo && GIMP_ITEM_UNDO (undo)->item == item)
push_undo = FALSE;
gimp_item_set_lock_content (item, locked, push_undo);
gimp_image_flush (image);
}
}
void
items_lock_position_cmd_callback (GtkAction *action,
GimpImage *image,
GimpItem *item)
{
gboolean locked;
locked = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
if (locked != gimp_item_get_lock_position (item))
{
GimpUndo *undo;
gboolean push_undo = TRUE;
undo = gimp_image_undo_can_compress (image, GIMP_TYPE_ITEM_UNDO,
GIMP_UNDO_ITEM_LOCK_POSITION);
if (undo && GIMP_ITEM_UNDO (undo)->item == item)
push_undo = FALSE;
gimp_item_set_lock_position (item, locked, push_undo);
gimp_image_flush (image);
}
}
void
items_color_tag_cmd_callback (GtkAction *action,
GimpImage *image,
GimpItem *item,
GimpColorTag color_tag)
{
if (color_tag != gimp_item_get_color_tag (item))
{
GimpUndo *undo;
gboolean push_undo = TRUE;
undo = gimp_image_undo_can_compress (image, GIMP_TYPE_ITEM_UNDO,
GIMP_UNDO_ITEM_COLOR_TAG);
if (undo && GIMP_ITEM_UNDO (undo)->item == item)
push_undo = FALSE;
gimp_item_set_color_tag (item, color_tag, push_undo);
gimp_image_flush (image);
}
}

View File

@ -0,0 +1,41 @@
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* 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 __ITEMS_COMMANDS_H__
#define __ITEMS_COMMANDS_H__
void items_visible_cmd_callback (GtkAction *action,
GimpImage *image,
GimpItem *item);
void items_linked_cmd_callback (GtkAction *action,
GimpImage *image,
GimpItem *item);
void items_lock_content_cmd_callback (GtkAction *action,
GimpImage *image,
GimpItem *item);
void items_lock_position_cmd_callback (GtkAction *action,
GimpImage *image,
GimpItem *item);
void items_color_tag_cmd_callback (GtkAction *action,
GimpImage *image,
GimpItem *item,
GimpColorTag color_tag);
#endif /* __ITEMS_COMMANDS_H__ */

View File

@ -37,6 +37,7 @@
#include "actions.h"
#include "image-commands.h"
#include "items-actions.h"
#include "layers-actions.h"
#include "layers-commands.h"
@ -49,6 +50,10 @@ static const GimpActionEntry layers_actions[] =
NC_("layers-action", "Layers Menu"), NULL, NULL, NULL,
GIMP_HELP_LAYER_DIALOG },
{ "layers-color-tag-menu", GIMP_STOCK_CLOSE /* abused */,
NC_("layers-action", "Color Tag"), NULL, NULL, NULL,
GIMP_HELP_LAYER_COLOR_TAG },
{ "layers-menu", NULL,
NC_("layers-action", "_Layer") },
{ "layers-stack-menu", NULL,
@ -257,14 +262,6 @@ static const GimpActionEntry layers_actions[] =
static const GimpToggleActionEntry layers_toggle_actions[] =
{
{ "layers-lock-alpha", GIMP_STOCK_TRANSPARENCY,
NC_("layers-action", "Lock Alph_a Channel"), NULL,
NC_("layers-action",
"Keep transparency information on this layer from being modified"),
G_CALLBACK (layers_lock_alpha_cmd_callback),
FALSE,
GIMP_HELP_LAYER_LOCK_ALPHA },
{ "layers-mask-edit", "gtk-edit",
NC_("layers-action", "_Edit Layer Mask"), NULL,
NC_("layers-action", "Work on the layer mask"),
@ -283,7 +280,96 @@ static const GimpToggleActionEntry layers_toggle_actions[] =
NC_("layers-action", "Dismiss the effect of the layer mask"),
G_CALLBACK (layers_mask_disable_cmd_callback),
FALSE,
GIMP_HELP_LAYER_MASK_DISABLE }
GIMP_HELP_LAYER_MASK_DISABLE },
{ "layers-visible", GIMP_STOCK_VISIBLE,
NC_("layers-action", "_Visible"), NULL, NULL,
G_CALLBACK (layers_visible_cmd_callback),
FALSE,
GIMP_HELP_LAYER_VISIBLE },
{ "layers-linked", GIMP_STOCK_LINKED,
NC_("layers-action", "_Linked"), NULL, NULL,
G_CALLBACK (layers_linked_cmd_callback),
FALSE,
GIMP_HELP_LAYER_LINKED },
{ "layers-lock-content", NULL /* GIMP_STOCK_LOCK */,
NC_("layers-action", "L_ock pixels"), NULL, NULL,
G_CALLBACK (layers_lock_content_cmd_callback),
FALSE,
GIMP_HELP_LAYER_LOCK_PIXELS },
{ "layers-lock-position", GIMP_STOCK_TOOL_MOVE,
NC_("layers-action", "L_ock position"), NULL, NULL,
G_CALLBACK (layers_lock_position_cmd_callback),
FALSE,
GIMP_HELP_LAYER_LOCK_POSITION },
{ "layers-lock-alpha", GIMP_STOCK_TRANSPARENCY,
NC_("layers-action", "Lock Alph_a Channel"), NULL,
NC_("layers-action",
"Keep transparency information on this layer from being modified"),
G_CALLBACK (layers_lock_alpha_cmd_callback),
FALSE,
GIMP_HELP_LAYER_LOCK_ALPHA },
};
static const GimpEnumActionEntry layers_color_tag_actions[] =
{
{ "layers-color-tag-none", GIMP_STOCK_CLOSE /* abused */,
NC_("layers-action", "None"), NULL,
NC_("layers-action", "Clear color tag"),
GIMP_COLOR_TAG_NONE, FALSE,
GIMP_HELP_LAYER_COLOR_TAG },
{ "layers-color-tag-blue", NULL,
NC_("layers-action", "Blue"), NULL,
NC_("layers-action", "Set color tag to blue"),
GIMP_COLOR_TAG_BLUE, FALSE,
GIMP_HELP_LAYER_COLOR_TAG },
{ "layers-color-tag-green", NULL,
NC_("layers-action", "Green"), NULL,
NC_("layers-action", "Set color tag to green"),
GIMP_COLOR_TAG_GREEN, FALSE,
GIMP_HELP_LAYER_COLOR_TAG },
{ "layers-color-tag-yellow", NULL,
NC_("layers-action", "Yellow"), NULL,
NC_("layers-action", "Set color tag to yellow"),
GIMP_COLOR_TAG_YELLOW, FALSE,
GIMP_HELP_LAYER_COLOR_TAG },
{ "layers-color-tag-orange", NULL,
NC_("layers-action", "Orange"), NULL,
NC_("layers-action", "Set color tag to orange"),
GIMP_COLOR_TAG_ORANGE, FALSE,
GIMP_HELP_LAYER_COLOR_TAG },
{ "layers-color-tag-brown", NULL,
NC_("layers-action", "Brown"), NULL,
NC_("layers-action", "Set color tag to brown"),
GIMP_COLOR_TAG_BROWN, FALSE,
GIMP_HELP_LAYER_COLOR_TAG },
{ "layers-color-tag-red", NULL,
NC_("layers-action", "Red"), NULL,
NC_("layers-action", "Set color tag to red"),
GIMP_COLOR_TAG_RED, FALSE,
GIMP_HELP_LAYER_COLOR_TAG },
{ "layers-color-tag-violet", NULL,
NC_("layers-action", "Violet"), NULL,
NC_("layers-action", "Set color tag to violet"),
GIMP_COLOR_TAG_VIOLET, FALSE,
GIMP_HELP_LAYER_COLOR_TAG },
{ "layers-color-tag-gray", NULL,
NC_("layers-action", "Gray"), NULL,
NC_("layers-action", "Set color tag to gray"),
GIMP_COLOR_TAG_GRAY, FALSE,
GIMP_HELP_LAYER_COLOR_TAG }
};
static const GimpEnumActionEntry layers_mask_apply_actions[] =
@ -496,6 +582,11 @@ layers_actions_setup (GimpActionGroup *group)
layers_toggle_actions,
G_N_ELEMENTS (layers_toggle_actions));
gimp_action_group_add_enum_actions (group, "layers-action",
layers_color_tag_actions,
G_N_ELEMENTS (layers_color_tag_actions),
G_CALLBACK (layers_color_tag_cmd_callback));
gimp_action_group_add_enum_actions (group, "layers-action",
layers_mask_apply_actions,
G_N_ELEMENTS (layers_mask_apply_actions),
@ -534,6 +625,8 @@ layers_actions_setup (GimpActionGroup *group)
layers_mode_actions,
G_N_ELEMENTS (layers_mode_actions),
G_CALLBACK (layers_mode_cmd_callback));
items_actions_setup (group, "layers");
}
void
@ -706,4 +799,6 @@ layers_actions_update (GimpActionGroup *group,
#undef SET_SENSITIVE
#undef SET_ACTIVE
#undef SET_LABEL
items_actions_update (group, "layers", GIMP_ITEM (layer));
}

View File

@ -75,6 +75,7 @@
#include "dialogs/scale-dialog.h"
#include "actions.h"
#include "items-commands.h"
#include "layers-commands.h"
#include "gimp-intl.h"
@ -126,6 +127,7 @@ static void layers_new_callback (GtkWidget *dialog,
gint layer_offset_y,
gboolean layer_visible,
gboolean layer_linked,
GimpColorTag layer_color_tag,
gboolean layer_lock_pixels,
gboolean layer_lock_position,
gboolean layer_lock_alpha,
@ -145,6 +147,7 @@ static void layers_edit_attributes_callback (GtkWidget *dialog,
gint layer_offset_y,
gboolean layer_visible,
gboolean layer_linked,
GimpColorTag layer_color_tag,
gboolean layer_lock_pixels,
gboolean layer_lock_position,
gboolean layer_lock_alpha,
@ -260,6 +263,7 @@ layers_edit_attributes_cmd_callback (GtkAction *action,
0 /* unused */,
gimp_item_get_visible (item),
gimp_item_get_linked (item),
gimp_item_get_color_tag (item),
gimp_item_get_lock_content (item),
gimp_item_get_lock_position (item),
gimp_layer_get_lock_alpha (layer),
@ -325,6 +329,7 @@ layers_new_cmd_callback (GtkAction *action,
config->layer_new_fill_type,
TRUE,
FALSE,
GIMP_COLOR_TAG_NONE,
FALSE,
FALSE,
FALSE,
@ -1128,6 +1133,50 @@ layers_mode_cmd_callback (GtkAction *action,
gimp_image_flush (image);
}
void
layers_visible_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *image;
GimpLayer *layer;
return_if_no_layer (image, layer, data);
items_visible_cmd_callback (action, image, GIMP_ITEM (layer));
}
void
layers_linked_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *image;
GimpLayer *layer;
return_if_no_layer (image, layer, data);
items_linked_cmd_callback (action, image, GIMP_ITEM (layer));
}
void
layers_lock_content_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *image;
GimpLayer *layer;
return_if_no_layer (image, layer, data);
items_lock_content_cmd_callback (action, image, GIMP_ITEM (layer));
}
void
layers_lock_position_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *image;
GimpLayer *layer;
return_if_no_layer (image, layer, data);
items_lock_position_cmd_callback (action, image, GIMP_ITEM (layer));
}
void
layers_lock_alpha_cmd_callback (GtkAction *action,
gpointer data)
@ -1155,6 +1204,19 @@ layers_lock_alpha_cmd_callback (GtkAction *action,
}
}
void
layers_color_tag_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpImage *image;
GimpLayer *layer;
return_if_no_layer (image, layer, data);
items_color_tag_cmd_callback (action, image, GIMP_ITEM (layer),
(GimpColorTag) value);
}
/* private functions */
@ -1173,6 +1235,7 @@ layers_new_callback (GtkWidget *dialog,
gint layer_offset_y,
gboolean layer_visible,
gboolean layer_linked,
GimpColorTag layer_color_tag,
gboolean layer_lock_pixels,
gboolean layer_lock_position,
gboolean layer_lock_alpha,
@ -1201,6 +1264,7 @@ layers_new_callback (GtkWidget *dialog,
config->layer_new_fill_type);
gimp_item_set_visible (GIMP_ITEM (layer), layer_visible, FALSE);
gimp_item_set_linked (GIMP_ITEM (layer), layer_linked, FALSE);
gimp_item_set_color_tag (GIMP_ITEM (layer), layer_color_tag, FALSE);
gimp_item_set_lock_content (GIMP_ITEM (layer), layer_lock_pixels,
FALSE);
gimp_item_set_lock_position (GIMP_ITEM (layer), layer_lock_position,
@ -1234,6 +1298,7 @@ layers_edit_attributes_callback (GtkWidget *dialog,
gint layer_offset_y,
gboolean layer_visible,
gboolean layer_linked,
GimpColorTag layer_color_tag,
gboolean layer_lock_pixels,
gboolean layer_lock_position,
gboolean layer_lock_alpha,
@ -1249,6 +1314,7 @@ layers_edit_attributes_callback (GtkWidget *dialog,
layer_offset_y != gimp_item_get_offset_y (item) ||
layer_visible != gimp_item_get_visible (item) ||
layer_linked != gimp_item_get_linked (item) ||
layer_color_tag != gimp_item_get_color_tag (item) ||
layer_lock_pixels != gimp_item_get_lock_content (item) ||
layer_lock_position != gimp_item_get_lock_position (item) ||
layer_lock_alpha != gimp_layer_get_lock_alpha (layer))
@ -1291,6 +1357,9 @@ layers_edit_attributes_callback (GtkWidget *dialog,
if (layer_linked != gimp_item_get_linked (item))
gimp_item_set_linked (item, layer_linked, TRUE);
if (layer_color_tag != gimp_item_get_color_tag (item))
gimp_item_set_color_tag (item, layer_color_tag, TRUE);
if (layer_lock_pixels != gimp_item_get_lock_content (item))
gimp_item_set_lock_content (item, layer_lock_pixels, TRUE);
@ -1429,7 +1498,6 @@ layers_resize_callback (GtkWidget *dialog,
gboolean unused2,
gpointer user_data)
{
layer_resize_unit = unit;
if (width > 0 && height > 0)

View File

@ -107,8 +107,20 @@ void layers_mode_cmd_callback (GtkAction *action,
gint value,
gpointer data);
void layers_visible_cmd_callback (GtkAction *action,
gpointer data);
void layers_linked_cmd_callback (GtkAction *action,
gpointer data);
void layers_lock_content_cmd_callback (GtkAction *action,
gpointer data);
void layers_lock_position_cmd_callback (GtkAction *action,
gpointer data);
void layers_lock_alpha_cmd_callback (GtkAction *action,
gpointer data);
void layers_color_tag_cmd_callback (GtkAction *action,
gint value,
gpointer data);
#endif /* __LAYERS_COMMANDS_H__ */

View File

@ -53,6 +53,7 @@ static void quick_mask_configure_callback (GtkWidget *dialog,
gboolean save_selection,
gboolean channel_visible,
gboolean channel_linked,
GimpColorTag channel_color_tag,
gboolean channel_lock_content,
gboolean channel_lock_position,
gpointer user_data);
@ -130,6 +131,7 @@ quick_mask_configure_cmd_callback (GtkAction *action,
&color,
FALSE,
FALSE,
GIMP_COLOR_TAG_NONE,
FALSE,
FALSE,
quick_mask_configure_callback,
@ -156,6 +158,7 @@ quick_mask_configure_callback (GtkWidget *dialog,
gboolean save_selection,
gboolean channel_visible,
gboolean channel_linked,
GimpColorTag channel_color_tag,
gboolean channel_lock_content,
gboolean channel_lock_position,
gpointer user_data)

View File

@ -30,8 +30,10 @@
#include "widgets/gimpactiongroup.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpwidgets-utils.h"
#include "actions.h"
#include "items-actions.h"
#include "vectors-actions.h"
#include "vectors-commands.h"
@ -44,6 +46,10 @@ static const GimpActionEntry vectors_actions[] =
NC_("vectors-action", "Paths Menu"), NULL, NULL, NULL,
GIMP_HELP_PATH_DIALOG },
{ "vectors-color-tag-menu", GIMP_STOCK_CLOSE /* abused */,
NC_("vectors-action", "Color Tag"), NULL, NULL, NULL,
GIMP_HELP_PATH_COLOR_TAG },
{ "vectors-path-tool", GIMP_STOCK_TOOL_PATH,
NC_("vectors-action", "Path _Tool"), NULL, NULL,
G_CALLBACK (vectors_vectors_tool_cmd_callback),
@ -180,6 +186,63 @@ static const GimpToggleActionEntry vectors_toggle_actions[] =
GIMP_HELP_PATH_LOCK_POSITION }
};
static const GimpEnumActionEntry vectors_color_tag_actions[] =
{
{ "vectors-color-tag-none", GIMP_STOCK_CLOSE /* abused */,
NC_("vectors-action", "None"), NULL,
NC_("vectors-action", "Clear color tag"),
GIMP_COLOR_TAG_NONE, FALSE,
GIMP_HELP_PATH_COLOR_TAG },
{ "vectors-color-tag-blue", NULL,
NC_("vectors-action", "Blue"), NULL,
NC_("vectors-action", "Set color tag to blue"),
GIMP_COLOR_TAG_BLUE, FALSE,
GIMP_HELP_PATH_COLOR_TAG },
{ "vectors-color-tag-green", NULL,
NC_("vectors-action", "Green"), NULL,
NC_("vectors-action", "Set color tag to green"),
GIMP_COLOR_TAG_GREEN, FALSE,
GIMP_HELP_PATH_COLOR_TAG },
{ "vectors-color-tag-yellow", NULL,
NC_("vectors-action", "Yellow"), NULL,
NC_("vectors-action", "Set color tag to yellow"),
GIMP_COLOR_TAG_YELLOW, FALSE,
GIMP_HELP_PATH_COLOR_TAG },
{ "vectors-color-tag-orange", NULL,
NC_("vectors-action", "Orange"), NULL,
NC_("vectors-action", "Set color tag to orange"),
GIMP_COLOR_TAG_ORANGE, FALSE,
GIMP_HELP_PATH_COLOR_TAG },
{ "vectors-color-tag-brown", NULL,
NC_("vectors-action", "Brown"), NULL,
NC_("vectors-action", "Set color tag to brown"),
GIMP_COLOR_TAG_BROWN, FALSE,
GIMP_HELP_PATH_COLOR_TAG },
{ "vectors-color-tag-red", NULL,
NC_("vectors-action", "Red"), NULL,
NC_("vectors-action", "Set color tag to red"),
GIMP_COLOR_TAG_RED, FALSE,
GIMP_HELP_PATH_COLOR_TAG },
{ "vectors-color-tag-violet", NULL,
NC_("vectors-action", "Violet"), NULL,
NC_("vectors-action", "Set color tag to violet"),
GIMP_COLOR_TAG_VIOLET, FALSE,
GIMP_HELP_PATH_COLOR_TAG },
{ "vectors-color-tag-gray", NULL,
NC_("vectors-action", "Gray"), NULL,
NC_("vectors-action", "Set color tag to gray"),
GIMP_COLOR_TAG_GRAY, FALSE,
GIMP_HELP_PATH_COLOR_TAG }
};
static const GimpEnumActionEntry vectors_to_selection_actions[] =
{
{ "vectors-selection-replace", GIMP_STOCK_SELECTION_REPLACE,
@ -246,6 +309,11 @@ vectors_actions_setup (GimpActionGroup *group)
vectors_toggle_actions,
G_N_ELEMENTS (vectors_toggle_actions));
gimp_action_group_add_enum_actions (group, "vectors-action",
vectors_color_tag_actions,
G_N_ELEMENTS (vectors_color_tag_actions),
G_CALLBACK (vectors_color_tag_cmd_callback));
gimp_action_group_add_enum_actions (group, "vectors-action",
vectors_to_selection_actions,
G_N_ELEMENTS (vectors_to_selection_actions),
@ -255,27 +323,23 @@ vectors_actions_setup (GimpActionGroup *group)
vectors_selection_to_vectors_actions,
G_N_ELEMENTS (vectors_selection_to_vectors_actions),
G_CALLBACK (vectors_selection_to_vectors_cmd_callback));
items_actions_setup (group, "vectors");
}
void
vectors_actions_update (GimpActionGroup *group,
gpointer data)
{
GimpImage *image = action_data_get_image (data);
GimpVectors *vectors = NULL;
GimpDrawable *drawable = NULL;
gint n_vectors = 0;
gboolean mask_empty = TRUE;
gboolean visible = FALSE;
gboolean linked = FALSE;
gboolean locked = FALSE;
gboolean can_lock = FALSE;
gboolean locked_pos = FALSE;
gboolean can_lock_pos = FALSE;
gboolean dr_writable = FALSE;
gboolean dr_children = FALSE;
GList *next = NULL;
GList *prev = NULL;
GimpImage *image = action_data_get_image (data);
GimpVectors *vectors = NULL;
GimpDrawable *drawable = NULL;
gint n_vectors = 0;
gboolean mask_empty = TRUE;
gboolean dr_writable = FALSE;
gboolean dr_children = FALSE;
GList *next = NULL;
GList *prev = NULL;
if (image)
{
@ -286,17 +350,10 @@ vectors_actions_update (GimpActionGroup *group,
if (vectors)
{
GimpItem *item = GIMP_ITEM (vectors);
GList *vectors_list;
GList *list;
GList *vectors_list;
GList *list;
visible = gimp_item_get_visible (item);
linked = gimp_item_get_linked (item);
locked = gimp_item_get_lock_content (item);
can_lock = gimp_item_can_lock_content (item);
locked_pos = gimp_item_get_lock_position (item);
can_lock_pos = gimp_item_can_lock_position (item);
vectors_list = gimp_item_get_container_iter (item);
vectors_list = gimp_item_get_container_iter (GIMP_ITEM (vectors));
list = g_list_find (vectors_list, vectors);
@ -311,11 +368,9 @@ vectors_actions_update (GimpActionGroup *group,
if (drawable)
{
GimpItem *item = GIMP_ITEM (drawable);
dr_writable = ! gimp_item_is_content_locked (GIMP_ITEM (drawable));
dr_writable = ! gimp_item_is_content_locked (item);
if (gimp_viewable_get_children (GIMP_VIEWABLE (item)))
if (gimp_viewable_get_children (GIMP_VIEWABLE (drawable)))
dr_children = TRUE;
}
}
@ -344,16 +399,6 @@ vectors_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("vectors-export", vectors);
SET_SENSITIVE ("vectors-import", image);
SET_SENSITIVE ("vectors-visible", vectors);
SET_SENSITIVE ("vectors-linked", vectors);
SET_SENSITIVE ("vectors-lock-content", can_lock);
SET_SENSITIVE ("vectors-lock-position", can_lock_pos);
SET_ACTIVE ("vectors-visible", visible);
SET_ACTIVE ("vectors-linked", linked);
SET_ACTIVE ("vectors-lock-content", locked);
SET_ACTIVE ("vectors-lock-position", locked_pos);
SET_SENSITIVE ("vectors-selection-to-vectors", image && !mask_empty);
SET_SENSITIVE ("vectors-selection-to-vectors-short", image && !mask_empty);
SET_SENSITIVE ("vectors-selection-to-vectors-advanced", image && !mask_empty);
@ -378,4 +423,6 @@ vectors_actions_update (GimpActionGroup *group,
#undef SET_SENSITIVE
#undef SET_ACTIVE
items_actions_update (group, "vectors", GIMP_ITEM (vectors));
}

View File

@ -67,6 +67,7 @@
#include "dialogs/vectors-options-dialog.h"
#include "actions.h"
#include "items-commands.h"
#include "vectors-commands.h"
#include "gimp-intl.h"
@ -81,6 +82,7 @@ static void vectors_new_callback (GtkWidget *dialog,
const gchar *vectors_name,
gboolean vectors_visible,
gboolean vectors_linked,
GimpColorTag vectors_color_tag,
gboolean vectors_lock_content,
gboolean vectors_lock_position,
gpointer user_data);
@ -91,6 +93,7 @@ static void vectors_edit_attributes_callback (GtkWidget *dialog,
const gchar *vectors_name,
gboolean vectors_visible,
gboolean vectors_linked,
GimpColorTag vectors_color_tag,
gboolean vectors_lock_content,
gboolean vectors_lock_position,
gpointer user_data);
@ -180,6 +183,7 @@ vectors_edit_attributes_cmd_callback (GtkAction *action,
gimp_object_get_name (vectors),
gimp_item_get_visible (item),
gimp_item_get_linked (item),
gimp_item_get_color_tag (item),
gimp_item_get_lock_content (item),
gimp_item_get_lock_position (item),
vectors_edit_attributes_callback,
@ -220,6 +224,7 @@ vectors_new_cmd_callback (GtkAction *action,
config->vectors_new_name,
FALSE,
FALSE,
GIMP_COLOR_TAG_NONE,
FALSE,
FALSE,
vectors_new_callback,
@ -729,25 +734,9 @@ vectors_visible_cmd_callback (GtkAction *action,
{
GimpImage *image;
GimpVectors *vectors;
gboolean visible;
return_if_no_vectors (image, vectors, data);
visible = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
if (visible != gimp_item_get_visible (GIMP_ITEM (vectors)))
{
GimpUndo *undo;
gboolean push_undo = TRUE;
undo = gimp_image_undo_can_compress (image, GIMP_TYPE_ITEM_UNDO,
GIMP_UNDO_ITEM_VISIBILITY);
if (undo && GIMP_ITEM_UNDO (undo)->item == GIMP_ITEM (vectors))
push_undo = FALSE;
gimp_item_set_visible (GIMP_ITEM (vectors), visible, push_undo);
gimp_image_flush (image);
}
items_visible_cmd_callback (action, image, GIMP_ITEM (vectors));
}
void
@ -756,25 +745,9 @@ vectors_linked_cmd_callback (GtkAction *action,
{
GimpImage *image;
GimpVectors *vectors;
gboolean linked;
return_if_no_vectors (image, vectors, data);
linked = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
if (linked != gimp_item_get_linked (GIMP_ITEM (vectors)))
{
GimpUndo *undo;
gboolean push_undo = TRUE;
undo = gimp_image_undo_can_compress (image, GIMP_TYPE_ITEM_UNDO,
GIMP_UNDO_ITEM_LINKED);
if (undo && GIMP_ITEM_UNDO (undo)->item == GIMP_ITEM (vectors))
push_undo = FALSE;
gimp_item_set_linked (GIMP_ITEM (vectors), linked, push_undo);
gimp_image_flush (image);
}
items_linked_cmd_callback (action, image, GIMP_ITEM (vectors));
}
void
@ -783,29 +756,9 @@ vectors_lock_content_cmd_callback (GtkAction *action,
{
GimpImage *image;
GimpVectors *vectors;
gboolean locked;
return_if_no_vectors (image, vectors, data);
locked = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
if (locked != gimp_item_get_lock_content (GIMP_ITEM (vectors)))
{
#if 0
GimpUndo *undo;
#endif
gboolean push_undo = TRUE;
#if 0
undo = gimp_image_undo_can_compress (image, GIMP_TYPE_ITEM_UNDO,
GIMP_UNDO_ITEM_LINKED);
if (undo && GIMP_ITEM_UNDO (undo)->item == GIMP_ITEM (vectors))
push_undo = FALSE;
#endif
gimp_item_set_lock_content (GIMP_ITEM (vectors), locked, push_undo);
gimp_image_flush (image);
}
items_lock_content_cmd_callback (action, image, GIMP_ITEM (vectors));
}
void
@ -814,42 +767,39 @@ vectors_lock_position_cmd_callback (GtkAction *action,
{
GimpImage *image;
GimpVectors *vectors;
gboolean locked;
return_if_no_vectors (image, vectors, data);
locked = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
items_lock_position_cmd_callback (action, image, GIMP_ITEM (vectors));
}
if (locked != gimp_item_get_lock_position (GIMP_ITEM (vectors)))
{
GimpUndo *undo;
gboolean push_undo = TRUE;
void
vectors_color_tag_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpImage *image;
GimpVectors *vectors;
return_if_no_vectors (image, vectors, data);
undo = gimp_image_undo_can_compress (image, GIMP_TYPE_ITEM_UNDO,
GIMP_UNDO_ITEM_LOCK_POSITION);
if (undo && GIMP_ITEM_UNDO (undo)->item == GIMP_ITEM (vectors))
push_undo = FALSE;
gimp_item_set_lock_position (GIMP_ITEM (vectors), locked, push_undo);
gimp_image_flush (image);
}
items_color_tag_cmd_callback (action, image, GIMP_ITEM (vectors),
(GimpColorTag) value);
}
/* private functions */
static void
vectors_new_callback (GtkWidget *dialog,
GimpImage *image,
GimpVectors *vectors,
GimpContext *context,
const gchar *vectors_name,
gboolean vectors_visible,
gboolean vectors_linked,
gboolean vectors_lock_content,
gboolean vectors_lock_position,
gpointer user_data)
vectors_new_callback (GtkWidget *dialog,
GimpImage *image,
GimpVectors *vectors,
GimpContext *context,
const gchar *vectors_name,
gboolean vectors_visible,
gboolean vectors_linked,
GimpColorTag vectors_color_tag,
gboolean vectors_lock_content,
gboolean vectors_lock_position,
gpointer user_data)
{
GimpDialogConfig *config = GIMP_DIALOG_CONFIG (image->gimp->config);
@ -860,6 +810,7 @@ vectors_new_callback (GtkWidget *dialog,
vectors = gimp_vectors_new (image, config->vectors_new_name);
gimp_item_set_visible (GIMP_ITEM (vectors), vectors_visible, FALSE);
gimp_item_set_linked (GIMP_ITEM (vectors), vectors_linked, FALSE);
gimp_item_set_color_tag (GIMP_ITEM (vectors), vectors_color_tag, FALSE);
gimp_item_set_lock_content (GIMP_ITEM (vectors), vectors_lock_content, FALSE);
gimp_item_set_lock_position (GIMP_ITEM (vectors), vectors_lock_position, FALSE);
@ -871,22 +822,24 @@ vectors_new_callback (GtkWidget *dialog,
}
static void
vectors_edit_attributes_callback (GtkWidget *dialog,
GimpImage *image,
GimpVectors *vectors,
GimpContext *context,
const gchar *vectors_name,
gboolean vectors_visible,
gboolean vectors_linked,
gboolean vectors_lock_content,
gboolean vectors_lock_position,
gpointer user_data)
vectors_edit_attributes_callback (GtkWidget *dialog,
GimpImage *image,
GimpVectors *vectors,
GimpContext *context,
const gchar *vectors_name,
gboolean vectors_visible,
gboolean vectors_linked,
GimpColorTag vectors_color_tag,
gboolean vectors_lock_content,
gboolean vectors_lock_position,
gpointer user_data)
{
GimpItem *item = GIMP_ITEM (vectors);
if (strcmp (vectors_name, gimp_object_get_name (vectors)) ||
vectors_visible != gimp_item_get_visible (item) ||
vectors_linked != gimp_item_get_linked (item) ||
vectors_color_tag != gimp_item_get_color_tag (item) ||
vectors_lock_content != gimp_item_get_lock_content (item) ||
vectors_lock_position != gimp_item_get_lock_position (item))
{
@ -903,6 +856,9 @@ vectors_edit_attributes_callback (GtkWidget *dialog,
if (vectors_linked != gimp_item_get_linked (item))
gimp_item_set_linked (item, vectors_linked, TRUE);
if (vectors_color_tag != gimp_item_get_color_tag (item))
gimp_item_set_color_tag (item, vectors_color_tag, TRUE);
if (vectors_lock_content != gimp_item_get_lock_content (item))
gimp_item_set_lock_content (item, vectors_lock_content, TRUE);

View File

@ -77,5 +77,9 @@ void vectors_lock_content_cmd_callback (GtkAction *action,
void vectors_lock_position_cmd_callback (GtkAction *action,
gpointer data);
void vectors_color_tag_cmd_callback (GtkAction *action,
gint value,
gpointer data);
#endif /* __VECTORS_COMMANDS_H__ */

View File

@ -866,6 +866,7 @@ gimp_undo_type_get_type (void)
{ GIMP_UNDO_ITEM_DISPLACE, "GIMP_UNDO_ITEM_DISPLACE", "item-displace" },
{ GIMP_UNDO_ITEM_VISIBILITY, "GIMP_UNDO_ITEM_VISIBILITY", "item-visibility" },
{ GIMP_UNDO_ITEM_LINKED, "GIMP_UNDO_ITEM_LINKED", "item-linked" },
{ GIMP_UNDO_ITEM_COLOR_TAG, "GIMP_UNDO_ITEM_COLOR_TAG", "item-color-tag" },
{ GIMP_UNDO_ITEM_LOCK_CONTENT, "GIMP_UNDO_ITEM_LOCK_CONTENT", "item-lock-content" },
{ GIMP_UNDO_ITEM_LOCK_POSITION, "GIMP_UNDO_ITEM_LOCK_POSITION", "item-lock-position" },
{ GIMP_UNDO_LAYER_ADD, "GIMP_UNDO_LAYER_ADD", "layer-add" },
@ -958,6 +959,7 @@ gimp_undo_type_get_type (void)
{ GIMP_UNDO_ITEM_DISPLACE, NC_("undo-type", "Move item"), NULL },
{ GIMP_UNDO_ITEM_VISIBILITY, NC_("undo-type", "Item visibility"), NULL },
{ GIMP_UNDO_ITEM_LINKED, NC_("undo-type", "Link/Unlink item"), NULL },
{ GIMP_UNDO_ITEM_COLOR_TAG, NC_("undo-type", "Item color tag"), NULL },
{ GIMP_UNDO_ITEM_LOCK_CONTENT, NC_("undo-type", "Lock/Unlock content"), NULL },
{ GIMP_UNDO_ITEM_LOCK_POSITION, NC_("undo-type", "Lock/Unlock position"), NULL },
{ GIMP_UNDO_LAYER_ADD, NC_("undo-type", "New layer"), NULL },

View File

@ -438,6 +438,7 @@ typedef enum /*< pdb-skip >*/
GIMP_UNDO_ITEM_DISPLACE, /*< desc="Move item" >*/
GIMP_UNDO_ITEM_VISIBILITY, /*< desc="Item visibility" >*/
GIMP_UNDO_ITEM_LINKED, /*< desc="Link/Unlink item" >*/
GIMP_UNDO_ITEM_COLOR_TAG, /*< desc="Item color tag" >*/
GIMP_UNDO_ITEM_LOCK_CONTENT, /*< desc="Lock/Unlock content" >*/
GIMP_UNDO_ITEM_LOCK_POSITION, /*< desc="Lock/Unlock position" >*/
GIMP_UNDO_LAYER_ADD, /*< desc="New layer" >*/

View File

@ -417,6 +417,22 @@ gimp_image_undo_push_item_linked (GimpImage *image,
NULL);
}
GimpUndo *
gimp_image_undo_push_item_color_tag (GimpImage *image,
const gchar *undo_desc,
GimpItem *item)
{
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
g_return_val_if_fail (GIMP_IS_ITEM (item), NULL);
g_return_val_if_fail (gimp_item_is_attached (item), NULL);
return gimp_image_undo_push (image, GIMP_TYPE_ITEM_PROP_UNDO,
GIMP_UNDO_ITEM_COLOR_TAG, undo_desc,
GIMP_DIRTY_ITEM_META,
"item", item,
NULL);
}
GimpUndo *
gimp_image_undo_push_item_lock_content (GimpImage *image,
const gchar *undo_desc,

View File

@ -101,6 +101,9 @@ GimpUndo * gimp_image_undo_push_item_visibility (GimpImage *image,
GimpUndo * gimp_image_undo_push_item_linked (GimpImage *image,
const gchar *undo_desc,
GimpItem *item);
GimpUndo * gimp_image_undo_push_item_color_tag (GimpImage *image,
const gchar *undo_desc,
GimpItem *item);
GimpUndo * gimp_image_undo_push_item_lock_content (GimpImage *image,
const gchar *undo_desc,
GimpItem *item);

View File

@ -54,6 +54,7 @@ enum
{
REMOVED,
LINKED_CHANGED,
COLOR_TAG_CHANGED,
LOCK_CONTENT_CHANGED,
LOCK_POSITION_CHANGED,
LAST_SIGNAL
@ -69,6 +70,7 @@ enum
PROP_OFFSET_X,
PROP_OFFSET_Y,
PROP_LINKED,
PROP_COLOR_TAG,
PROP_LOCK_CONTENT,
PROP_LOCK_POSITION
};
@ -92,7 +94,9 @@ struct _GimpItemPrivate
guint lock_content : 1; /* content editability */
guint lock_position : 1; /* content movability */
guint removed : 1; /* removed from the image? */
guint removed : 1; /* removed from the image? */
GimpColorTag color_tag; /* color tag */
GList *offset_nodes; /* offset nodes to manage */
};
@ -186,6 +190,15 @@ gimp_item_class_init (GimpItemClass *klass)
gimp_marshal_VOID__VOID,
G_TYPE_NONE, 0);
gimp_item_signals[COLOR_TAG_CHANGED] =
g_signal_new ("color-tag-changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpItemClass, color_tag_changed),
NULL, NULL,
gimp_marshal_VOID__VOID,
G_TYPE_NONE, 0);
gimp_item_signals[LOCK_CONTENT_CHANGED] =
g_signal_new ("lock-content-changed",
G_TYPE_FROM_CLASS (klass),
@ -216,6 +229,7 @@ gimp_item_class_init (GimpItemClass *klass)
klass->removed = NULL;
klass->linked_changed = NULL;
klass->color_tag_changed = NULL;
klass->lock_content_changed = NULL;
klass->lock_position_changed = NULL;
@ -286,6 +300,12 @@ gimp_item_class_init (GimpItemClass *klass)
FALSE,
GIMP_PARAM_READABLE));
g_object_class_install_property (object_class, PROP_COLOR_TAG,
g_param_spec_enum ("color-tag", NULL, NULL,
GIMP_TYPE_COLOR_TAG,
GIMP_COLOR_TAG_NONE,
GIMP_PARAM_READABLE));
g_object_class_install_property (object_class, PROP_LOCK_CONTENT,
g_param_spec_boolean ("lock-content",
NULL, NULL,
@ -308,18 +328,7 @@ gimp_item_init (GimpItem *item)
g_object_force_floating (G_OBJECT (item));
private->ID = 0;
private->tattoo = 0;
private->image = NULL;
private->parasites = gimp_parasite_list_new ();
private->width = 0;
private->height = 0;
private->offset_x = 0;
private->offset_y = 0;
private->linked = FALSE;
private->lock_content = FALSE;
private->lock_position = FALSE;
private->removed = FALSE;
private->parasites = gimp_parasite_list_new ();
}
static void
@ -411,6 +420,9 @@ gimp_item_get_property (GObject *object,
case PROP_LINKED:
g_value_set_boolean (value, private->linked);
break;
case PROP_COLOR_TAG:
g_value_set_enum (value, private->color_tag);
break;
case PROP_LOCK_CONTENT:
g_value_set_boolean (value, private->lock_content);
break;
@ -526,8 +538,9 @@ gimp_item_real_duplicate (GimpItem *item,
g_object_unref (GET_PRIVATE (new_item)->parasites);
GET_PRIVATE (new_item)->parasites = gimp_parasite_list_copy (private->parasites);
gimp_item_set_visible (new_item, gimp_item_get_visible (item), FALSE);
gimp_item_set_linked (new_item, gimp_item_get_linked (item), FALSE);
gimp_item_set_visible (new_item, gimp_item_get_visible (item), FALSE);
gimp_item_set_linked (new_item, gimp_item_get_linked (item), FALSE);
gimp_item_set_color_tag (new_item, gimp_item_get_color_tag (item), FALSE);
if (gimp_item_can_lock_content (new_item))
gimp_item_set_lock_content (new_item, gimp_item_get_lock_content (item),
@ -1819,6 +1832,7 @@ gimp_item_replace_item (GimpItem *item,
gimp_item_set_visible (item, gimp_item_get_visible (replace), FALSE);
gimp_item_set_linked (item, gimp_item_get_linked (replace), FALSE);
gimp_item_set_color_tag (item, gimp_item_get_color_tag (replace), FALSE);
gimp_item_set_lock_content (item, gimp_item_get_lock_content (replace), FALSE);
gimp_item_set_lock_position (item, gimp_item_get_lock_position (replace), FALSE);
}
@ -2102,6 +2116,39 @@ gimp_item_get_linked (GimpItem *item)
return GET_PRIVATE (item)->linked;
}
void
gimp_item_set_color_tag (GimpItem *item,
GimpColorTag color_tag,
gboolean push_undo)
{
g_return_if_fail (GIMP_IS_ITEM (item));
if (gimp_item_get_color_tag (item) != color_tag)
{
if (push_undo && gimp_item_is_attached (item))
{
GimpImage *image = gimp_item_get_image (item);
if (image)
gimp_image_undo_push_item_color_tag (image, NULL, item);
}
GET_PRIVATE (item)->color_tag = color_tag;
g_signal_emit (item, gimp_item_signals[COLOR_TAG_CHANGED], 0);
g_object_notify (G_OBJECT (item), "color-tag");
}
}
GimpColorTag
gimp_item_get_color_tag (GimpItem *item)
{
g_return_val_if_fail (GIMP_IS_ITEM (item), GIMP_COLOR_TAG_NONE);
return GET_PRIVATE (item)->color_tag;
}
void
gimp_item_set_lock_content (GimpItem *item,
gboolean lock_content,

View File

@ -44,6 +44,7 @@ struct _GimpItemClass
/* signals */
void (* removed) (GimpItem *item);
void (* linked_changed) (GimpItem *item);
void (* color_tag_changed) (GimpItem *item);
void (* lock_content_changed) (GimpItem *item);
void (* lock_position_changed) (GimpItem *item);
@ -330,6 +331,11 @@ void gimp_item_set_linked (GimpItem *item,
gboolean push_undo);
gboolean gimp_item_get_linked (GimpItem *item);
void gimp_item_set_color_tag (GimpItem *item,
GimpColorTag color_tag,
gboolean push_undo);
GimpColorTag gimp_item_get_color_tag (GimpItem *item);
void gimp_item_set_lock_content (GimpItem *item,
gboolean lock_content,
gboolean push_undo);

View File

@ -124,7 +124,11 @@ gimp_item_prop_undo_constructed (GObject *object)
break;
case GIMP_UNDO_ITEM_LINKED:
item_prop_undo->linked = gimp_item_get_linked (item);
item_prop_undo->linked = gimp_item_get_linked (item);
break;
case GIMP_UNDO_ITEM_COLOR_TAG:
item_prop_undo->color_tag = gimp_item_get_color_tag (item);
break;
case GIMP_UNDO_ITEM_LOCK_CONTENT:
@ -285,6 +289,16 @@ gimp_item_prop_undo_pop (GimpUndo *undo,
}
break;
case GIMP_UNDO_ITEM_COLOR_TAG:
{
GimpColorTag color_tag;
color_tag = gimp_item_get_color_tag (item);
gimp_item_set_color_tag (item, item_prop_undo->color_tag, FALSE);
item_prop_undo->color_tag = color_tag;
}
break;
case GIMP_UNDO_ITEM_LOCK_CONTENT:
{
gboolean lock_content;

View File

@ -46,6 +46,7 @@ struct _GimpItemPropUndo
guint linked : 1;
guint lock_content : 1;
guint lock_position : 1;
GimpColorTag color_tag;
gchar *parasite_name;
GimpParasite *parasite;
};

View File

@ -61,6 +61,7 @@ static void channel_options_dialog_callback (GtkWidget *dialog,
const gchar *item_name,
gboolean item_visible,
gboolean item_linked,
GimpColorTag item_color_tag,
gboolean item_lock_content,
gboolean item_lock_position,
gpointer user_data);
@ -89,6 +90,7 @@ channel_options_dialog_new (GimpImage *image,
const GimpRGB *channel_color,
gboolean channel_visible,
gboolean channel_linked,
GimpColorTag channel_color_tag,
gboolean channel_lock_content,
gboolean channel_lock_position,
GimpChannelOptionsCallback callback,
@ -128,6 +130,7 @@ channel_options_dialog_new (GimpImage *image,
channel_name,
channel_visible,
channel_linked,
channel_color_tag,
channel_lock_content,
channel_lock_position,
channel_options_dialog_callback,
@ -184,16 +187,17 @@ channel_options_dialog_free (ChannelOptionsDialog *private)
}
static void
channel_options_dialog_callback (GtkWidget *dialog,
GimpImage *image,
GimpItem *item,
GimpContext *context,
const gchar *item_name,
gboolean item_visible,
gboolean item_linked,
gboolean item_lock_content,
gboolean item_lock_position,
gpointer user_data)
channel_options_dialog_callback (GtkWidget *dialog,
GimpImage *image,
GimpItem *item,
GimpContext *context,
const gchar *item_name,
gboolean item_visible,
gboolean item_linked,
GimpColorTag item_color_tag,
gboolean item_lock_content,
gboolean item_lock_position,
gpointer user_data)
{
ChannelOptionsDialog *private = user_data;
GimpRGB color;
@ -215,6 +219,7 @@ channel_options_dialog_callback (GtkWidget *dialog,
save_selection,
item_visible,
item_linked,
item_color_tag,
item_lock_content,
item_lock_position,
private->user_data);

View File

@ -28,6 +28,7 @@ typedef void (* GimpChannelOptionsCallback) (GtkWidget *dialog,
gboolean save_selection,
gboolean channel_visible,
gboolean channel_linked,
GimpColorTag channel_color_tag,
gboolean channel_lock_content,
gboolean channel_lock_position,
gpointer user_data);
@ -49,6 +50,7 @@ GtkWidget * channel_options_dialog_new (GimpImage *image,
const GimpRGB *channel_color,
gboolean channel_visible,
gboolean channel_linked,
GimpColorTag channel_color_tag,
gboolean channel_lock_content,
gboolean channel_lock_position,
GimpChannelOptionsCallback callback,

View File

@ -30,6 +30,7 @@
#include "core/gimpitem.h"
#include "widgets/gimpviewabledialog.h"
#include "widgets/gimpwidgets-utils.h"
#include "item-options-dialog.h"
@ -45,6 +46,7 @@ struct _ItemOptionsDialog
GimpContext *context;
gboolean visible;
gboolean linked;
GimpColorTag color_tag;
gboolean lock_content;
gboolean lock_position;
GimpItemOptionsCallback callback;
@ -90,6 +92,7 @@ item_options_dialog_new (GimpImage *image,
const gchar *item_name,
gboolean item_visible,
gboolean item_linked,
GimpColorTag item_color_tag,
gboolean item_lock_content,
gboolean item_lock_position,
GimpItemOptionsCallback callback,
@ -120,6 +123,7 @@ item_options_dialog_new (GimpImage *image,
private->context = context;
private->visible = item_visible;
private->linked = item_linked;
private->color_tag = item_color_tag;
private->lock_content = item_lock_content;
private->lock_position = item_lock_position;
private->callback = callback;
@ -173,12 +177,76 @@ item_options_dialog_new (GimpImage *image,
/* The name label and entry */
if (name_label)
{
GtkWidget *hbox;
GtkWidget *radio;
GtkWidget *radio_box;
GList *children;
GList *list;
private->name_entry = gtk_entry_new ();
gtk_entry_set_activates_default (GTK_ENTRY (private->name_entry), TRUE);
gtk_entry_set_text (GTK_ENTRY (private->name_entry), item_name);
gimp_table_attach_aligned (GTK_TABLE (table), 0, private->table_row++,
name_label, 0.0, 0.5,
private->name_entry, 1, FALSE);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gimp_table_attach_aligned (GTK_TABLE (table), 0, private->table_row++,
_("Color tag:"), 0.0, 0.5,
hbox, 1, TRUE);
radio_box = gimp_enum_radio_box_new (GIMP_TYPE_COLOR_TAG,
G_CALLBACK (gimp_radio_button_update),
&private->color_tag,
&radio);
gimp_int_radio_group_set_active (GTK_RADIO_BUTTON (radio),
private->color_tag);
children = gtk_container_get_children (GTK_CONTAINER (radio_box));
for (list = children;
list;
list = g_list_next (list))
{
GimpColorTag color_tag;
GimpRGB color;
GtkWidget *image;
radio = list->data;
g_object_ref (radio);
gtk_container_remove (GTK_CONTAINER (radio_box), radio);
g_object_set (radio, "draw-indicator", FALSE, NULL);
gtk_box_pack_start (GTK_BOX (hbox), radio, FALSE, FALSE, 0);
g_object_unref (radio);
gtk_widget_destroy (gtk_bin_get_child (GTK_BIN (radio)));
color_tag = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (radio),
"gimp-item-data"));
if (gimp_get_color_tag_color (color_tag, &color))
{
GtkSettings *settings = gtk_widget_get_settings (dialog);
gint w, h;
image = gimp_color_area_new (&color, GIMP_COLOR_AREA_FLAT, 0);
gtk_icon_size_lookup_for_settings (settings,
GTK_ICON_SIZE_MENU, &w, &h);
gtk_widget_set_size_request (image, w, h);
}
else
{
image = gtk_image_new_from_icon_name (GIMP_STOCK_CLOSE,
GTK_ICON_SIZE_MENU);
}
gtk_container_add (GTK_CONTAINER (radio), image);
gtk_widget_show (image);
}
g_list_free (children);
gtk_widget_destroy (radio_box);
}
/* The switches frame & vbox */
@ -382,6 +450,7 @@ item_options_dialog_response (GtkWidget *dialog,
name,
private->visible,
private->linked,
private->color_tag,
private->lock_content,
private->lock_position,
private->user_data);

View File

@ -19,16 +19,17 @@
#define __ITEM_OPTIONS_DIALOG_H__
typedef void (* GimpItemOptionsCallback) (GtkWidget *dialog,
GimpImage *image,
GimpItem *item,
GimpContext *context,
const gchar *item_name,
gboolean item_visible,
gboolean item_linked,
gboolean item_lock_content,
gboolean item_lock_position,
gpointer user_data);
typedef void (* GimpItemOptionsCallback) (GtkWidget *dialog,
GimpImage *image,
GimpItem *item,
GimpContext *context,
const gchar *item_name,
gboolean item_visible,
gboolean item_linked,
GimpColorTag item_color_tag,
gboolean item_lock_content,
gboolean item_lock_position,
gpointer user_data);
GtkWidget * item_options_dialog_new (GimpImage *image,
@ -47,6 +48,7 @@ GtkWidget * item_options_dialog_new (GimpImage *image,
const gchar *item_name,
gboolean item_visible,
gboolean item_linked,
GimpColorTag item_color_tag,
gboolean item_lock_content,
gboolean item_lock_position,
GimpItemOptionsCallback callback,

View File

@ -73,6 +73,7 @@ static void layer_options_dialog_callback (GtkWidget *dialog,
const gchar *item_name,
gboolean item_visible,
gboolean item_linked,
GimpColorTag item_color_tag,
gboolean item_lock_content,
gboolean item_lock_position,
gpointer user_data);
@ -98,6 +99,7 @@ layer_options_dialog_new (GimpImage *image,
GimpFillType layer_fill_type,
gboolean layer_visible,
gboolean layer_linked,
GimpColorTag layer_color_tag,
gboolean layer_lock_content,
gboolean layer_lock_position,
gboolean layer_lock_alpha,
@ -146,6 +148,7 @@ layer_options_dialog_new (GimpImage *image,
layer_name,
layer_visible,
layer_linked,
layer_color_tag,
layer_lock_content,
layer_lock_position,
layer_options_dialog_callback,
@ -400,16 +403,17 @@ layer_options_dialog_free (LayerOptionsDialog *private)
}
static void
layer_options_dialog_callback (GtkWidget *dialog,
GimpImage *image,
GimpItem *item,
GimpContext *context,
const gchar *item_name,
gboolean item_visible,
gboolean item_linked,
gboolean item_lock_content,
gboolean item_lock_position,
gpointer user_data)
layer_options_dialog_callback (GtkWidget *dialog,
GimpImage *image,
GimpItem *item,
GimpContext *context,
const gchar *item_name,
gboolean item_visible,
gboolean item_linked,
GimpColorTag item_color_tag,
gboolean item_lock_content,
gboolean item_lock_position,
gpointer user_data)
{
LayerOptionsDialog *private = user_data;
gint width = 0;
@ -448,6 +452,7 @@ layer_options_dialog_callback (GtkWidget *dialog,
offset_y,
item_visible,
item_linked,
item_color_tag,
item_lock_content,
item_lock_position,
private->lock_alpha,

View File

@ -33,6 +33,7 @@ typedef void (* GimpLayerOptionsCallback) (GtkWidget *dialog,
gint layer_offset_y,
gboolean layer_visible,
gboolean layer_linked,
GimpColorTag layer_color_tag,
gboolean layer_lock_content,
gboolean layer_lock_position,
gboolean layer_lock_alpha,
@ -55,6 +56,7 @@ GtkWidget * layer_options_dialog_new (GimpImage *image,
GimpFillType layer_fill_type,
gboolean layer_visible,
gboolean layer_linked,
GimpColorTag layer_color_tag,
gboolean layer_lock_content,
gboolean layer_lock_position,
gboolean layer_lock_alpha,

View File

@ -54,6 +54,7 @@ static void vectors_options_dialog_callback (GtkWidget *dialog,
const gchar *item_name,
gboolean item_visible,
gboolean item_linked,
GimpColorTag item_color_tag,
gboolean item_lock_content,
gboolean item_lock_position,
gpointer user_data);
@ -74,6 +75,7 @@ vectors_options_dialog_new (GimpImage *image,
const gchar *vectors_name,
gboolean vectors_visible,
gboolean vectors_linked,
GimpColorTag vectors_color_tag,
gboolean vectors_lock_content,
gboolean vectors_lock_position,
GimpVectorsOptionsCallback callback,
@ -108,6 +110,7 @@ vectors_options_dialog_new (GimpImage *image,
vectors_name,
vectors_visible,
vectors_linked,
vectors_color_tag,
vectors_lock_content,
vectors_lock_position,
vectors_options_dialog_callback,
@ -129,16 +132,17 @@ vectors_options_dialog_free (VectorsOptionsDialog *private)
}
static void
vectors_options_dialog_callback (GtkWidget *dialog,
GimpImage *image,
GimpItem *item,
GimpContext *context,
const gchar *item_name,
gboolean item_visible,
gboolean item_linked,
gboolean item_lock_content,
gboolean item_lock_position,
gpointer user_data)
vectors_options_dialog_callback (GtkWidget *dialog,
GimpImage *image,
GimpItem *item,
GimpContext *context,
const gchar *item_name,
gboolean item_visible,
gboolean item_linked,
GimpColorTag item_color_tag,
gboolean item_lock_content,
gboolean item_lock_position,
gpointer user_data)
{
VectorsOptionsDialog *private = user_data;
@ -149,6 +153,7 @@ vectors_options_dialog_callback (GtkWidget *dialog,
item_name,
item_visible,
item_linked,
item_color_tag,
item_lock_content,
item_lock_position,
private->user_data);

View File

@ -19,16 +19,17 @@
#define __VECTORS_OPTIONS_DIALOG_H__
typedef void (* GimpVectorsOptionsCallback) (GtkWidget *dialog,
GimpImage *image,
GimpVectors *vectors,
GimpContext *context,
const gchar *vectors_name,
gboolean vectors_visible,
gboolean vectors_linked,
gboolean vectors_lock_content,
gboolean vectors_lock_position,
gpointer user_data);
typedef void (* GimpVectorsOptionsCallback) (GtkWidget *dialog,
GimpImage *image,
GimpVectors *vectors,
GimpContext *context,
const gchar *vectors_name,
gboolean vectors_visible,
gboolean vectors_linked,
GimpColorTag vectors_color_tag,
gboolean vectors_lock_content,
gboolean vectors_lock_position,
gpointer user_data);
GtkWidget * vectors_options_dialog_new (GimpImage *image,
@ -43,6 +44,7 @@ GtkWidget * vectors_options_dialog_new (GimpImage *image,
const gchar *vectors_name,
gboolean vectors_visible,
gboolean vectors_linked,
GimpColorTag vectors_color_tag,
gboolean vectors_lock_content,
gboolean vectors_lock_position,
GimpVectorsOptionsCallback callback,

View File

@ -28,7 +28,7 @@
#include "internal-procs.h"
/* 800 procedures registered total */
/* 802 procedures registered total */
void
internal_procs_init (GimpPDB *pdb)

View File

@ -715,6 +715,59 @@ item_set_lock_position_invoker (GimpProcedure *procedure,
error ? *error : NULL);
}
static GimpValueArray *
item_get_color_tag_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GimpValueArray *args,
GError **error)
{
gboolean success = TRUE;
GimpValueArray *return_vals;
GimpItem *item;
gint32 color_tag = 0;
item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
if (success)
{
color_tag = gimp_item_get_color_tag (GIMP_ITEM (item));
}
return_vals = gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_set_enum (gimp_value_array_index (return_vals, 1), color_tag);
return return_vals;
}
static GimpValueArray *
item_set_color_tag_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GimpValueArray *args,
GError **error)
{
gboolean success = TRUE;
GimpItem *item;
gint32 color_tag;
item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
color_tag = g_value_get_enum (gimp_value_array_index (args, 1));
if (success)
{
gimp_item_set_color_tag (GIMP_ITEM (item), color_tag, TRUE);
}
return gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static GimpValueArray *
item_get_tattoo_invoker (GimpProcedure *procedure,
Gimp *gimp,
@ -1559,6 +1612,66 @@ register_item_procs (GimpPDB *pdb)
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-item-get-color-tag
*/
procedure = gimp_procedure_new (item_get_color_tag_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-item-get-color-tag");
gimp_procedure_set_static_strings (procedure,
"gimp-item-get-color-tag",
"Get the color tag of the specified item.",
"This procedure returns the specified item's color tag.",
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2016",
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,
g_param_spec_enum ("color-tag",
"color tag",
"The item's color tag",
GIMP_TYPE_COLOR_TAG,
GIMP_COLOR_TAG_NONE,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-item-set-color-tag
*/
procedure = gimp_procedure_new (item_set_color_tag_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-item-set-color-tag");
gimp_procedure_set_static_strings (procedure,
"gimp-item-set-color-tag",
"Set the color tag of the specified item.",
"This procedure sets the specified item's color tag.",
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2016",
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,
g_param_spec_enum ("color-tag",
"color tag",
"The new item color tag",
GIMP_TYPE_COLOR_TAG,
GIMP_COLOR_TAG_NONE,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-item-get-tattoo
*/

View File

@ -191,6 +191,7 @@
#define GIMP_HELP_LAYER_ERODE "gimp-layer-erode"
#define GIMP_HELP_LAYER_VISIBLE "gimp-layer-visible"
#define GIMP_HELP_LAYER_LINKED "gimp-layer-linked"
#define GIMP_HELP_LAYER_COLOR_TAG "gimp-layer-color-tag"
#define GIMP_HELP_LAYER_OPACITY "gimp-layer-opacity"
#define GIMP_HELP_LAYER_MODE "gimp-layer-mode"
#define GIMP_HELP_LAYER_LOCK_ALPHA "gimp-layer-lock-alpha"
@ -232,6 +233,9 @@
#define GIMP_HELP_CHANNEL_LOWER_TO_BOTTOM "gimp-channel-lower-to-bottom"
#define GIMP_HELP_CHANNEL_DUPLICATE "gimp-channel-duplicate"
#define GIMP_HELP_CHANNEL_DELETE "gimp-channel-delete"
#define GIMP_HELP_CHANNEL_VISIBLE "gimp-channel-visible"
#define GIMP_HELP_CHANNEL_LINKED "gimp-channel-linked"
#define GIMP_HELP_CHANNEL_COLOR_TAG "gimp-channel-color-tag"
#define GIMP_HELP_CHANNEL_LOCK_PIXELS "gimp-channel-lock-pixels"
#define GIMP_HELP_CHANNEL_LOCK_POSITION "gimp-channel-lock-position"
#define GIMP_HELP_CHANNEL_SELECTION_REPLACE "gimp-channel-selection-replace"
@ -256,6 +260,7 @@
#define GIMP_HELP_PATH_MERGE_VISIBLE "gimp-path-merge-visible"
#define GIMP_HELP_PATH_VISIBLE "gimp-path-visible"
#define GIMP_HELP_PATH_LINKED "gimp-path-linked"
#define GIMP_HELP_PATH_COLOR_TAG "gimp-path-color-tag"
#define GIMP_HELP_PATH_LOCK_STROKES "gimp-path-lock-strokes"
#define GIMP_HELP_PATH_LOCK_POSITION "gimp-path-lock-position"
#define GIMP_HELP_PATH_SELECTION_REPLACE "gimp-path-selection-replace"

View File

@ -86,11 +86,13 @@ struct _GimpItemTreeViewPriv
gint model_column_visible;
gint model_column_viewable;
gint model_column_linked;
gint model_column_color_tag;
GtkCellRenderer *eye_cell;
GtkCellRenderer *chain_cell;
GimpTreeHandler *visible_changed_handler;
GimpTreeHandler *linked_changed_handler;
GimpTreeHandler *color_tag_changed_handler;
GimpTreeHandler *lock_content_changed_handler;
GimpTreeHandler *lock_position_changed_handler;
@ -169,6 +171,8 @@ static void gimp_item_tree_view_visible_changed (GimpItem *item,
GimpItemTreeView *view);
static void gimp_item_tree_view_linked_changed (GimpItem *item,
GimpItemTreeView *view);
static void gimp_item_tree_view_color_tag_changed (GimpItem *item,
GimpItemTreeView *view);
static void gimp_item_tree_view_lock_content_changed (GimpItem *item,
GimpItemTreeView *view);
static void gimp_item_tree_view_lock_position_changed(GimpItem *item,
@ -328,6 +332,11 @@ gimp_item_tree_view_init (GimpItemTreeView *view)
&tree_view->n_model_columns,
G_TYPE_BOOLEAN);
view->priv->model_column_color_tag =
gimp_container_tree_store_columns_add (tree_view->model_columns,
&tree_view->n_model_columns,
GDK_TYPE_COLOR);
gimp_container_tree_view_set_dnd_drop_to_empty (tree_view, TRUE);
view->priv->image = NULL;
@ -364,8 +373,9 @@ gimp_item_tree_view_constructed (GObject *object)
item_view->priv->eye_cell = gimp_cell_renderer_toggle_new (GIMP_STOCK_VISIBLE);
g_object_set (item_view->priv->eye_cell,
"xpad", 0,
"ypad", 0,
"xpad", 0,
"ypad", 0,
"override-background", TRUE,
NULL);
gtk_tree_view_column_pack_start (column, item_view->priv->eye_cell, FALSE);
gtk_tree_view_column_set_attributes (column, item_view->priv->eye_cell,
@ -373,6 +383,8 @@ gimp_item_tree_view_constructed (GObject *object)
item_view->priv->model_column_visible,
"inconsistent",
item_view->priv->model_column_viewable,
"cell-background-gdk",
item_view->priv->model_column_color_tag,
NULL);
gimp_container_tree_view_add_toggle_cell (tree_view,
@ -898,6 +910,9 @@ gimp_item_tree_view_set_container (GimpContainerView *view,
gimp_tree_handler_disconnect (item_view->priv->linked_changed_handler);
item_view->priv->linked_changed_handler = NULL;
gimp_tree_handler_disconnect (item_view->priv->color_tag_changed_handler);
item_view->priv->color_tag_changed_handler = NULL;
gimp_tree_handler_disconnect (item_view->priv->lock_content_changed_handler);
item_view->priv->lock_content_changed_handler = NULL;
@ -919,6 +934,11 @@ gimp_item_tree_view_set_container (GimpContainerView *view,
G_CALLBACK (gimp_item_tree_view_linked_changed),
view);
item_view->priv->color_tag_changed_handler =
gimp_tree_handler_connect (container, "color-tag-changed",
G_CALLBACK (gimp_item_tree_view_color_tag_changed),
view);
item_view->priv->lock_content_changed_handler =
gimp_tree_handler_connect (container, "lock-content-changed",
G_CALLBACK (gimp_item_tree_view_lock_content_changed),
@ -976,6 +996,9 @@ gimp_item_tree_view_insert_item (GimpContainerView *view,
GimpItemTreeView *item_view = GIMP_ITEM_TREE_VIEW (view);
GimpItem *item = GIMP_ITEM (viewable);
GtkTreeIter *iter;
GimpRGB color;
GdkColor gdk_color;
gboolean has_color;
item_view->priv->inserting_item = TRUE;
@ -984,6 +1007,11 @@ gimp_item_tree_view_insert_item (GimpContainerView *view,
item_view->priv->inserting_item = FALSE;
has_color = gimp_get_color_tag_color (gimp_item_get_color_tag (item),
&color);
if (has_color)
gimp_rgb_get_gdk_color (&color, &gdk_color);
gtk_tree_store_set (GTK_TREE_STORE (tree_view->model), iter,
item_view->priv->model_column_visible,
gimp_item_get_visible (item),
@ -992,6 +1020,8 @@ gimp_item_tree_view_insert_item (GimpContainerView *view,
! gimp_item_is_visible (item),
item_view->priv->model_column_linked,
gimp_item_get_linked (item),
item_view->priv->model_column_color_tag,
has_color ? &gdk_color : NULL,
-1);
return iter;
@ -1378,6 +1408,38 @@ gimp_item_tree_view_chain_clicked (GtkCellRendererToggle *toggle,
}
/* "Color Tag" callbacks */
static void
gimp_item_tree_view_color_tag_changed (GimpItem *item,
GimpItemTreeView *view)
{
GimpContainerView *container_view = GIMP_CONTAINER_VIEW (view);
GimpContainerTreeView *tree_view = GIMP_CONTAINER_TREE_VIEW (view);
GtkTreeIter *iter;
iter = gimp_container_view_lookup (container_view,
(GimpViewable *) item);
if (iter)
{
GimpRGB color;
GdkColor gdk_color;
gboolean has_color;
has_color = gimp_get_color_tag_color (gimp_item_get_color_tag (item),
&color);
if (has_color)
gimp_rgb_get_gdk_color (&color, &gdk_color);
gtk_tree_store_set (GTK_TREE_STORE (tree_view->model), iter,
view->priv->model_column_color_tag,
has_color ? &gdk_color : NULL,
-1);
}
}
/* "Lock Content" callbacks */
static void

View File

@ -1159,6 +1159,45 @@ gimp_get_message_icon_name (GimpMessageSeverity severity)
g_return_val_if_reached (GIMP_STOCK_WARNING);
}
gboolean
gimp_get_color_tag_color (GimpColorTag color_tag,
GimpRGB *color)
{
static const struct
{
guchar r;
guchar g;
guchar b;
}
colors[] =
{
{ 0, 0, 0 }, /* none */
{ 84, 182, 231 }, /* blue */
{ 154, 202, 66 }, /* green */
{ 250, 228, 57 }, /* yellow */
{ 255, 168, 63 }, /* orange */
{ 179, 101, 65 }, /* brown */
{ 245, 44, 52 }, /* red */
{ 196, 107, 217 }, /* violet */
{ 121, 122, 116 } /* gray */
};
g_return_val_if_fail (color != NULL, FALSE);
if (color_tag > GIMP_COLOR_TAG_NONE)
{
gimp_rgba_set_uchar (color,
colors[color_tag].r,
colors[color_tag].g,
colors[color_tag].b,
255);
return TRUE;
}
return FALSE;
}
void
gimp_pango_layout_set_scale (PangoLayout *layout,
gdouble scale)

View File

@ -84,7 +84,11 @@ void gimp_window_set_transient_for (GtkWindow *window
guint32 parent_ID);
void gimp_widget_set_accel_help (GtkWidget *widget,
GtkAction *action);
const gchar * gimp_get_message_icon_name (GimpMessageSeverity severity);
gboolean gimp_get_color_tag_color (GimpColorTag color_tag,
GimpRGB *color);
void gimp_pango_layout_set_scale (PangoLayout *layout,
double scale);
void gimp_pango_layout_set_weight (PangoLayout *layout,

View File

@ -552,6 +552,7 @@ EXPORTS
gimp_item_delete
gimp_item_detach_parasite
gimp_item_get_children
gimp_item_get_color_tag
gimp_item_get_image
gimp_item_get_linked
gimp_item_get_lock_content
@ -571,6 +572,7 @@ EXPORTS
gimp_item_is_text_layer
gimp_item_is_valid
gimp_item_is_vectors
gimp_item_set_color_tag
gimp_item_set_linked
gimp_item_set_lock_content
gimp_item_set_lock_position

View File

@ -14,6 +14,7 @@ static const GimpGetTypeFunc get_type_funcs[] =
gimp_clone_type_get_type,
gimp_color_management_mode_get_type,
gimp_color_rendering_intent_get_type,
gimp_color_tag_get_type,
gimp_component_type_get_type,
gimp_convert_dither_type_get_type,
gimp_convert_palette_type_get_type,
@ -77,6 +78,7 @@ static const gchar * const type_names[] =
"GimpCloneType",
"GimpColorManagementMode",
"GimpColorRenderingIntent",
"GimpColorTag",
"GimpComponentType",
"GimpConvertDitherType",
"GimpConvertPaletteType",

View File

@ -798,6 +798,72 @@ gimp_item_set_lock_position (gint32 item_ID,
return success;
}
/**
* gimp_item_get_color_tag:
* @item_ID: The item.
*
* Get the color tag of the specified item.
*
* This procedure returns the specified item's color tag.
*
* Returns: The item's color tag.
*
* Since: 2.10
**/
GimpColorTag
gimp_item_get_color_tag (gint32 item_ID)
{
GimpParam *return_vals;
gint nreturn_vals;
GimpColorTag color_tag = 0;
return_vals = gimp_run_procedure ("gimp-item-get-color-tag",
&nreturn_vals,
GIMP_PDB_ITEM, item_ID,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
color_tag = return_vals[1].data.d_int32;
gimp_destroy_params (return_vals, nreturn_vals);
return color_tag;
}
/**
* gimp_item_set_color_tag:
* @item_ID: The item.
* @color_tag: The new item color tag.
*
* Set the color tag of the specified item.
*
* This procedure sets the specified item's color tag.
*
* Returns: TRUE on success.
*
* Since: 2.10
**/
gboolean
gimp_item_set_color_tag (gint32 item_ID,
GimpColorTag color_tag)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-item-set-color-tag",
&nreturn_vals,
GIMP_PDB_ITEM, item_ID,
GIMP_PDB_INT32, color_tag,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_item_get_tattoo:
* @item_ID: The item.

View File

@ -61,6 +61,9 @@ gboolean gimp_item_set_lock_content (gint32 item_ID,
gboolean gimp_item_get_lock_position (gint32 item_ID);
gboolean gimp_item_set_lock_position (gint32 item_ID,
gboolean lock_position);
GimpColorTag gimp_item_get_color_tag (gint32 item_ID);
gboolean gimp_item_set_color_tag (gint32 item_ID,
GimpColorTag color_tag);
gint gimp_item_get_tattoo (gint32 item_ID);
gboolean gimp_item_set_tattoo (gint32 item_ID,
gint tattoo);

View File

@ -13,6 +13,7 @@ EXPORTS
gimp_check_type_get_type
gimp_checks_get_shades
gimp_clone_type_get_type
gimp_color_tag_get_type
gimp_component_type_get_type
gimp_convert_palette_type_get_type
gimp_convolve_type_get_type

View File

@ -350,6 +350,50 @@ gimp_clone_type_get_type (void)
return type;
}
GType
gimp_color_tag_get_type (void)
{
static const GEnumValue values[] =
{
{ GIMP_COLOR_TAG_NONE, "GIMP_COLOR_TAG_NONE", "none" },
{ GIMP_COLOR_TAG_BLUE, "GIMP_COLOR_TAG_BLUE", "blue" },
{ GIMP_COLOR_TAG_GREEN, "GIMP_COLOR_TAG_GREEN", "green" },
{ GIMP_COLOR_TAG_YELLOW, "GIMP_COLOR_TAG_YELLOW", "yellow" },
{ GIMP_COLOR_TAG_ORANGE, "GIMP_COLOR_TAG_ORANGE", "orange" },
{ GIMP_COLOR_TAG_BROWN, "GIMP_COLOR_TAG_BROWN", "brown" },
{ GIMP_COLOR_TAG_RED, "GIMP_COLOR_TAG_RED", "red" },
{ GIMP_COLOR_TAG_VIOLET, "GIMP_COLOR_TAG_VIOLET", "violet" },
{ GIMP_COLOR_TAG_GRAY, "GIMP_COLOR_TAG_GRAY", "gray" },
{ 0, NULL, NULL }
};
static const GimpEnumDesc descs[] =
{
{ GIMP_COLOR_TAG_NONE, NC_("color-tag", "None"), NULL },
{ GIMP_COLOR_TAG_BLUE, NC_("color-tag", "Blue"), NULL },
{ GIMP_COLOR_TAG_GREEN, NC_("color-tag", "Green"), NULL },
{ GIMP_COLOR_TAG_YELLOW, NC_("color-tag", "Yellow"), NULL },
{ GIMP_COLOR_TAG_ORANGE, NC_("color-tag", "Orange"), NULL },
{ GIMP_COLOR_TAG_BROWN, NC_("color-tag", "Brown"), NULL },
{ GIMP_COLOR_TAG_RED, NC_("color-tag", "Red"), NULL },
{ GIMP_COLOR_TAG_VIOLET, NC_("color-tag", "Violet"), NULL },
{ GIMP_COLOR_TAG_GRAY, NC_("color-tag", "Gray"), NULL },
{ 0, NULL, NULL }
};
static GType type = 0;
if (G_UNLIKELY (! type))
{
type = g_enum_register_static ("GimpColorTag", values);
gimp_type_set_translation_domain (type, GETTEXT_PACKAGE "-libgimp");
gimp_type_set_translation_context (type, "color-tag");
gimp_enum_set_value_descriptions (type, descs);
}
return type;
}
GType
gimp_component_type_get_type (void)
{

View File

@ -193,6 +193,24 @@ typedef enum
} GimpCloneType;
#define GIMP_TYPE_COLOR_TAG (gimp_color_tag_get_type ())
GType gimp_color_tag_get_type (void) G_GNUC_CONST;
typedef enum
{
GIMP_COLOR_TAG_NONE, /*< desc="None" >*/
GIMP_COLOR_TAG_BLUE, /*< desc="Blue" >*/
GIMP_COLOR_TAG_GREEN, /*< desc="Green" >*/
GIMP_COLOR_TAG_YELLOW, /*< desc="Yellow" >*/
GIMP_COLOR_TAG_ORANGE, /*< desc="Orange" >*/
GIMP_COLOR_TAG_BROWN, /*< desc="Brown" >*/
GIMP_COLOR_TAG_RED, /*< desc="Red" >*/
GIMP_COLOR_TAG_VIOLET, /*< desc="Violet" >*/
GIMP_COLOR_TAG_GRAY /*< desc="Gray" >*/
} GimpColorTag;
#define GIMP_TYPE_COMPONENT_TYPE (gimp_component_type_get_type ())
GType gimp_component_type_get_type (void) G_GNUC_CONST;

View File

@ -4,6 +4,17 @@
<ui>
<popup action="channels-popup">
<menuitem action="channels-edit-attributes" />
<menu action="channels-color-tag-menu" name="Color Tags">
<menuitem action="channels-color-tag-none" />
<menuitem action="channels-color-tag-blue" />
<menuitem action="channels-color-tag-green" />
<menuitem action="channels-color-tag-yellow" />
<menuitem action="channels-color-tag-orange" />
<menuitem action="channels-color-tag-brown" />
<menuitem action="channels-color-tag-red" />
<menuitem action="channels-color-tag-violet" />
<menuitem action="channels-color-tag-gray" />
</menu>
<separator />
<menuitem action="channels-new" />
<menuitem action="channels-raise" />

View File

@ -5,6 +5,17 @@
<popup action="layers-popup">
<menuitem action="layers-text-tool" />
<menuitem action="layers-edit-attributes" />
<menu action="layers-color-tag-menu" name="Color Tags">
<menuitem action="layers-color-tag-none" />
<menuitem action="layers-color-tag-blue" />
<menuitem action="layers-color-tag-green" />
<menuitem action="layers-color-tag-yellow" />
<menuitem action="layers-color-tag-orange" />
<menuitem action="layers-color-tag-brown" />
<menuitem action="layers-color-tag-red" />
<menuitem action="layers-color-tag-violet" />
<menuitem action="layers-color-tag-gray" />
</menu>
<separator />
<menuitem action="layers-new" />
<menuitem action="layers-new-from-visible" />

View File

@ -5,6 +5,17 @@
<popup action="vectors-popup">
<menuitem action="vectors-path-tool" />
<menuitem action="vectors-edit-attributes" />
<menu action="vectors-color-tag-menu" name="Color Tags">
<menuitem action="vectors-color-tag-none" />
<menuitem action="vectors-color-tag-blue" />
<menuitem action="vectors-color-tag-green" />
<menuitem action="vectors-color-tag-yellow" />
<menuitem action="vectors-color-tag-orange" />
<menuitem action="vectors-color-tag-brown" />
<menuitem action="vectors-color-tag-red" />
<menuitem action="vectors-color-tag-violet" />
<menuitem action="vectors-color-tag-gray" />
</menu>
<separator />
<menuitem action="vectors-new" />
<menuitem action="vectors-raise" />

View File

@ -101,6 +101,24 @@ package Gimp::CodeGen::enums;
mapping => { GIMP_CLONE_IMAGE => '0',
GIMP_CLONE_PATTERN => '1' }
},
GimpColorTag =>
{ contig => 1,
header => 'libgimpbase/gimpbaseenums.h',
symbols => [ qw(GIMP_COLOR_TAG_NONE GIMP_COLOR_TAG_BLUE
GIMP_COLOR_TAG_GREEN GIMP_COLOR_TAG_YELLOW
GIMP_COLOR_TAG_ORANGE GIMP_COLOR_TAG_BROWN
GIMP_COLOR_TAG_RED GIMP_COLOR_TAG_VIOLET
GIMP_COLOR_TAG_GRAY) ],
mapping => { GIMP_COLOR_TAG_NONE => '0',
GIMP_COLOR_TAG_BLUE => '1',
GIMP_COLOR_TAG_GREEN => '2',
GIMP_COLOR_TAG_YELLOW => '3',
GIMP_COLOR_TAG_ORANGE => '4',
GIMP_COLOR_TAG_BROWN => '5',
GIMP_COLOR_TAG_RED => '6',
GIMP_COLOR_TAG_VIOLET => '7',
GIMP_COLOR_TAG_GRAY => '8' }
},
GimpComponentType =>
{ contig => 0,
header => 'libgimpbase/gimpbaseenums.h',

View File

@ -675,6 +675,55 @@ CODE
);
}
sub item_get_color_tag {
$blurb = "Get the color tag of the specified item.";
$help = "This procedure returns the specified item's color tag.";
&mitch_pdb_misc('2016', '2.10');
@inargs = (
{ name => 'item', type => 'item',
desc => 'The item' }
);
@outargs = (
{ name => 'color_tag', type => 'enum GimpColorTag',
desc => "The item's color tag" }
);
%invoke = (
code => <<'CODE'
{
color_tag = gimp_item_get_color_tag (GIMP_ITEM (item));
}
CODE
);
}
sub item_set_color_tag {
$blurb = "Set the color tag of the specified item.";
$help = "This procedure sets the specified item's color tag.";
&mitch_pdb_misc('2016', '2.10');
@inargs = (
{ name => 'item', type => 'item',
desc => 'The item' },
{ name => 'color_tag', type => 'enum GimpColorTag',
desc => "The new item color tag" }
);
%invoke = (
code => <<'CODE'
{
gimp_item_set_color_tag (GIMP_ITEM (item), color_tag, TRUE);
}
CODE
);
}
sub item_get_tattoo {
$blurb = "Get the tattoo of the specified item.";
@ -873,6 +922,7 @@ CODE
item_get_linked item_set_linked
item_get_lock_content item_set_lock_content
item_get_lock_position item_set_lock_position
item_get_color_tag item_set_color_tag
item_get_tattoo item_set_tattoo
item_attach_parasite item_detach_parasite
item_get_parasite