mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-04 01:43:24 +00:00
added GimpContext parameters to GimpActivateItemFunc, GimpNewItemFunc and
2004-05-25 Michael Natterer <mitch@gimp.org> * app/widgets/gimpitemtreeview.h: added GimpContext parameters to GimpActivateItemFunc, GimpNewItemFunc and GimpEditItemFunc. * app/widgets/gimpdrawabletreeview.c * app/widgets/gimpitemtreeview.c: pass the view's context to the functions. * app/actions/actions.c (action_data_get_context): return gimp_get_user_context() if "data" is a Gimp. * app/actions/channels-commands.[ch] * app/actions/layers-commands.[ch] * app/actions/vectors-commands.[ch]: added GimpContext parameters to the resp. activate, new and edit functions and use the passed context instead of gimp_get_user_context(). * app/actions/layers-commands.[ch]: removed the merge and flatten callbacks. * app/actions/image-commands.[ch]: made public layer merge utility function private and cleaned the whole file up a lot. * app/actions/layers-actions.c: use the callbacks from image-commands.c for merge and flatten. * app/actions/edit-commands.c * app/actions/file-commands.c * app/actions/select-commands.c: use action_data_get_context() instead of gimp_get_user_context(). * app/actions/edit-actions.c: some cleanup.
This commit is contained in:
parent
f39cbb8483
commit
18d2d499b5
18 changed files with 718 additions and 756 deletions
34
ChangeLog
34
ChangeLog
|
@ -1,3 +1,37 @@
|
|||
2004-05-25 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/widgets/gimpitemtreeview.h: added GimpContext parameters
|
||||
to GimpActivateItemFunc, GimpNewItemFunc and GimpEditItemFunc.
|
||||
|
||||
* app/widgets/gimpdrawabletreeview.c
|
||||
* app/widgets/gimpitemtreeview.c: pass the view's context to
|
||||
the functions.
|
||||
|
||||
* app/actions/actions.c (action_data_get_context): return
|
||||
gimp_get_user_context() if "data" is a Gimp.
|
||||
|
||||
* app/actions/channels-commands.[ch]
|
||||
* app/actions/layers-commands.[ch]
|
||||
* app/actions/vectors-commands.[ch]: added GimpContext parameters
|
||||
to the resp. activate, new and edit functions and use the passed
|
||||
context instead of gimp_get_user_context().
|
||||
|
||||
* app/actions/layers-commands.[ch]: removed the merge and flatten
|
||||
callbacks.
|
||||
|
||||
* app/actions/image-commands.[ch]: made public layer merge utility
|
||||
function private and cleaned the whole file up a lot.
|
||||
|
||||
* app/actions/layers-actions.c: use the callbacks from
|
||||
image-commands.c for merge and flatten.
|
||||
|
||||
* app/actions/edit-commands.c
|
||||
* app/actions/file-commands.c
|
||||
* app/actions/select-commands.c: use action_data_get_context()
|
||||
instead of gimp_get_user_context().
|
||||
|
||||
* app/actions/edit-actions.c: some cleanup.
|
||||
|
||||
2004-05-25 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* plug-ins/common/plugindetails.c
|
||||
|
|
|
@ -255,6 +255,8 @@ action_data_get_context (gpointer data)
|
|||
return gimp_container_view_get_context (((GimpContainerEditor *) data)->view);
|
||||
else if (GIMP_IS_IMAGE_EDITOR (data))
|
||||
return ((GimpImageEditor *) data)->context;
|
||||
else if (GIMP_IS_GIMP (data))
|
||||
return gimp_get_user_context (data);
|
||||
else if (GIMP_IS_DOCK (data))
|
||||
return ((GimpDock *) data)->context;
|
||||
|
||||
|
|
|
@ -27,9 +27,9 @@
|
|||
|
||||
#include "actions-types.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpchannel.h"
|
||||
#include "core/gimpchannel-select.h"
|
||||
#include "core/gimpcontext.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimage-undo.h"
|
||||
|
||||
|
@ -55,6 +55,20 @@ static void channels_color_changed (GimpColorButton *button,
|
|||
|
||||
/* public functions */
|
||||
|
||||
void
|
||||
channels_edit_attributes_cmd_callback (GtkAction *action,
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GimpChannel *channel;
|
||||
GtkWidget *widget;
|
||||
return_if_no_channel (gimage, channel, data);
|
||||
return_if_no_widget (widget, data);
|
||||
|
||||
channels_edit_channel_query (channel, action_data_get_context (data),
|
||||
widget);
|
||||
}
|
||||
|
||||
void
|
||||
channels_new_cmd_callback (GtkAction *action,
|
||||
gpointer data)
|
||||
|
@ -64,7 +78,8 @@ channels_new_cmd_callback (GtkAction *action,
|
|||
return_if_no_image (gimage, data);
|
||||
return_if_no_widget (widget, data);
|
||||
|
||||
channels_new_channel_query (gimage, NULL, TRUE, widget);
|
||||
channels_new_channel_query (gimage, action_data_get_context (data),
|
||||
NULL, TRUE, widget);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -72,10 +87,10 @@ channels_raise_cmd_callback (GtkAction *action,
|
|||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GimpChannel *active_channel;
|
||||
return_if_no_channel (gimage, active_channel, data);
|
||||
GimpChannel *channel;
|
||||
return_if_no_channel (gimage, channel, data);
|
||||
|
||||
gimp_image_raise_channel (gimage, active_channel);
|
||||
gimp_image_raise_channel (gimage, channel);
|
||||
gimp_image_flush (gimage);
|
||||
}
|
||||
|
||||
|
@ -84,10 +99,10 @@ channels_raise_to_top_cmd_callback (GtkAction *action,
|
|||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GimpChannel *active_channel;
|
||||
return_if_no_channel (gimage, active_channel, data);
|
||||
GimpChannel *channel;
|
||||
return_if_no_channel (gimage, channel, data);
|
||||
|
||||
gimp_image_raise_channel_to_top (gimage, active_channel);
|
||||
gimp_image_raise_channel_to_top (gimage, channel);
|
||||
gimp_image_flush (gimage);
|
||||
}
|
||||
|
||||
|
@ -96,10 +111,10 @@ channels_lower_cmd_callback (GtkAction *action,
|
|||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GimpChannel *active_channel;
|
||||
return_if_no_channel (gimage, active_channel, data);
|
||||
GimpChannel *channel;
|
||||
return_if_no_channel (gimage, channel, data);
|
||||
|
||||
gimp_image_lower_channel (gimage, active_channel);
|
||||
gimp_image_lower_channel (gimage, channel);
|
||||
gimp_image_flush (gimage);
|
||||
}
|
||||
|
||||
|
@ -108,10 +123,10 @@ channels_lower_to_bottom_cmd_callback (GtkAction *action,
|
|||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GimpChannel *active_channel;
|
||||
return_if_no_channel (gimage, active_channel, data);
|
||||
GimpChannel *channel;
|
||||
return_if_no_channel (gimage, channel, data);
|
||||
|
||||
gimp_image_lower_channel_to_bottom (gimage, active_channel);
|
||||
gimp_image_lower_channel_to_bottom (gimage, channel);
|
||||
gimp_image_flush (gimage);
|
||||
}
|
||||
|
||||
|
@ -154,12 +169,12 @@ channels_duplicate_cmd_callback (GtkAction *action,
|
|||
}
|
||||
else
|
||||
{
|
||||
GimpChannel *active_channel;
|
||||
return_if_no_channel (gimage, active_channel, data);
|
||||
GimpChannel *channel;
|
||||
return_if_no_channel (gimage, channel, data);
|
||||
|
||||
new_channel =
|
||||
GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (active_channel),
|
||||
G_TYPE_FROM_INSTANCE (active_channel),
|
||||
GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (channel),
|
||||
G_TYPE_FROM_INSTANCE (channel),
|
||||
TRUE));
|
||||
}
|
||||
|
||||
|
@ -172,10 +187,10 @@ channels_delete_cmd_callback (GtkAction *action,
|
|||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GimpChannel *active_channel;
|
||||
return_if_no_channel (gimage, active_channel, data);
|
||||
GimpChannel *channel;
|
||||
return_if_no_channel (gimage, channel, data);
|
||||
|
||||
gimp_image_remove_channel (gimage, active_channel);
|
||||
gimp_image_remove_channel (gimage, channel);
|
||||
gimp_image_flush (gimage);
|
||||
}
|
||||
|
||||
|
@ -213,19 +228,6 @@ channels_to_selection_cmd_callback (GtkAction *action,
|
|||
gimp_image_flush (gimage);
|
||||
}
|
||||
|
||||
void
|
||||
channels_edit_attributes_cmd_callback (GtkAction *action,
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GimpChannel *active_channel;
|
||||
GtkWidget *widget;
|
||||
return_if_no_channel (gimage, active_channel, data);
|
||||
return_if_no_widget (widget, data);
|
||||
|
||||
channels_edit_channel_query (active_channel, widget);
|
||||
}
|
||||
|
||||
|
||||
/**********************************/
|
||||
/* The new channel query dialog */
|
||||
|
@ -235,11 +237,12 @@ typedef struct _NewChannelOptions NewChannelOptions;
|
|||
|
||||
struct _NewChannelOptions
|
||||
{
|
||||
GtkWidget *query_box;
|
||||
GtkWidget *name_entry;
|
||||
GtkWidget *color_panel;
|
||||
GtkWidget *query_box;
|
||||
GtkWidget *name_entry;
|
||||
GtkWidget *color_panel;
|
||||
|
||||
GimpImage *gimage;
|
||||
GimpContext *context;
|
||||
GimpImage *gimage;
|
||||
};
|
||||
|
||||
static gchar *channel_name = NULL;
|
||||
|
@ -254,28 +257,27 @@ new_channel_query_response (GtkWidget *widget,
|
|||
if (response_id == GTK_RESPONSE_OK)
|
||||
{
|
||||
GimpChannel *new_channel;
|
||||
GimpImage *gimage;
|
||||
|
||||
if (channel_name)
|
||||
g_free (channel_name);
|
||||
channel_name =
|
||||
g_strdup (gtk_entry_get_text (GTK_ENTRY (options->name_entry)));
|
||||
|
||||
if ((gimage = options->gimage))
|
||||
{
|
||||
gimp_color_button_get_color (GIMP_COLOR_BUTTON (options->color_panel),
|
||||
&channel_color);
|
||||
new_channel = gimp_channel_new (gimage, gimage->width, gimage->height,
|
||||
channel_name,
|
||||
&channel_color);
|
||||
gimp_color_button_get_color (GIMP_COLOR_BUTTON (options->color_panel),
|
||||
&channel_color);
|
||||
|
||||
gimp_drawable_fill_by_type (GIMP_DRAWABLE (new_channel),
|
||||
gimp_get_user_context (gimage->gimp),
|
||||
GIMP_TRANSPARENT_FILL);
|
||||
new_channel = gimp_channel_new (options->gimage,
|
||||
options->gimage->width,
|
||||
options->gimage->height,
|
||||
channel_name,
|
||||
&channel_color);
|
||||
|
||||
gimp_image_add_channel (gimage, new_channel, -1);
|
||||
gimp_image_flush (gimage);
|
||||
}
|
||||
gimp_drawable_fill_by_type (GIMP_DRAWABLE (new_channel),
|
||||
options->context,
|
||||
GIMP_TRANSPARENT_FILL);
|
||||
|
||||
gimp_image_add_channel (options->gimage, new_channel, -1);
|
||||
gimp_image_flush (options->gimage);
|
||||
}
|
||||
|
||||
gtk_widget_destroy (options->query_box);
|
||||
|
@ -283,6 +285,7 @@ new_channel_query_response (GtkWidget *widget,
|
|||
|
||||
void
|
||||
channels_new_channel_query (GimpImage *gimage,
|
||||
GimpContext *context,
|
||||
GimpChannel *template,
|
||||
gboolean interactive,
|
||||
GtkWidget *parent)
|
||||
|
@ -294,6 +297,7 @@ channels_new_channel_query (GimpImage *gimage,
|
|||
GtkObject *opacity_scale_data;
|
||||
|
||||
g_return_if_fail (GIMP_IS_IMAGE (gimage));
|
||||
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
||||
g_return_if_fail (! template || GIMP_IS_CHANNEL (template));
|
||||
|
||||
if (template || ! interactive)
|
||||
|
@ -318,13 +322,10 @@ channels_new_channel_query (GimpImage *gimage,
|
|||
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_EDIT_PASTE,
|
||||
_("New Channel"));
|
||||
|
||||
new_channel = gimp_channel_new (gimage,
|
||||
width, height,
|
||||
_("Empty Channel"),
|
||||
&color);
|
||||
new_channel = gimp_channel_new (gimage, width, height,
|
||||
_("Empty Channel"), &color);
|
||||
|
||||
gimp_drawable_fill_by_type (GIMP_DRAWABLE (new_channel),
|
||||
gimp_get_user_context (gimage->gimp),
|
||||
gimp_drawable_fill_by_type (GIMP_DRAWABLE (new_channel), context,
|
||||
GIMP_TRANSPARENT_FILL);
|
||||
|
||||
gimp_image_add_channel (gimage, new_channel, -1);
|
||||
|
@ -336,14 +337,14 @@ channels_new_channel_query (GimpImage *gimage,
|
|||
/* the new options structure */
|
||||
options = g_new (NewChannelOptions, 1);
|
||||
options->gimage = gimage;
|
||||
options->context = context;
|
||||
options->color_panel = gimp_color_panel_new (_("New Channel Color"),
|
||||
&channel_color,
|
||||
GIMP_COLOR_AREA_LARGE_CHECKS,
|
||||
48, 64);
|
||||
gimp_color_panel_set_context (GIMP_COLOR_PANEL (options->color_panel),
|
||||
gimp_get_user_context (gimage->gimp));
|
||||
context);
|
||||
|
||||
/* The dialog */
|
||||
options->query_box =
|
||||
gimp_viewable_dialog_new (GIMP_VIEWABLE (gimage),
|
||||
_("New Channel"), "gimp-channel-new",
|
||||
|
@ -366,23 +367,22 @@ channels_new_channel_query (GimpImage *gimage,
|
|||
G_CALLBACK (new_channel_query_response),
|
||||
options);
|
||||
|
||||
/* The main hbox */
|
||||
hbox = gtk_hbox_new (FALSE, 6);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 12);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options->query_box)->vbox),
|
||||
hbox);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
/* The vbox */
|
||||
vbox = gtk_vbox_new (FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
/* The table */
|
||||
table = gtk_table_new (2, 3, FALSE);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
||||
gtk_widget_show (table);
|
||||
|
||||
/* The name entry */
|
||||
options->name_entry = gtk_entry_new ();
|
||||
gtk_entry_set_text (GTK_ENTRY (options->name_entry),
|
||||
(channel_name ? channel_name : _("New Channel")));
|
||||
|
@ -390,7 +390,6 @@ channels_new_channel_query (GimpImage *gimage,
|
|||
_("Channel Name:"), 0.0, 0.5,
|
||||
options->name_entry, 2, FALSE);
|
||||
|
||||
/* The opacity scale */
|
||||
opacity_scale_data = gimp_scale_entry_new (GTK_TABLE (table), 0, 1,
|
||||
_("Fill Opacity:"), 100, -1,
|
||||
channel_color.a * 100.0,
|
||||
|
@ -402,7 +401,6 @@ channels_new_channel_query (GimpImage *gimage,
|
|||
G_CALLBACK (channels_opacity_update),
|
||||
options->color_panel);
|
||||
|
||||
/* The color panel */
|
||||
gtk_box_pack_start (GTK_BOX (hbox), options->color_panel,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_widget_show (options->color_panel);
|
||||
|
@ -411,9 +409,6 @@ channels_new_channel_query (GimpImage *gimage,
|
|||
G_CALLBACK (channels_color_changed),
|
||||
opacity_scale_data);
|
||||
|
||||
gtk_widget_show (table);
|
||||
gtk_widget_show (vbox);
|
||||
gtk_widget_show (hbox);
|
||||
gtk_widget_show (options->query_box);
|
||||
}
|
||||
|
||||
|
@ -425,12 +420,12 @@ typedef struct _EditChannelOptions EditChannelOptions;
|
|||
|
||||
struct _EditChannelOptions
|
||||
{
|
||||
GtkWidget *query_box;
|
||||
GtkWidget *name_entry;
|
||||
GtkWidget *color_panel;
|
||||
GtkWidget *query_box;
|
||||
GtkWidget *name_entry;
|
||||
GtkWidget *color_panel;
|
||||
|
||||
GimpChannel *channel;
|
||||
GimpImage *gimage;
|
||||
GimpChannel *channel;
|
||||
GimpImage *gimage;
|
||||
};
|
||||
|
||||
static void
|
||||
|
@ -441,42 +436,38 @@ edit_channel_query_response (GtkWidget *widget,
|
|||
if (response_id == GTK_RESPONSE_OK)
|
||||
{
|
||||
GimpChannel *channel = options->channel;
|
||||
const gchar *new_name;
|
||||
GimpRGB color;
|
||||
gboolean name_changed = FALSE;
|
||||
gboolean color_changed = FALSE;
|
||||
|
||||
if (options->gimage)
|
||||
{
|
||||
const gchar *new_name;
|
||||
GimpRGB color;
|
||||
gboolean name_changed = FALSE;
|
||||
gboolean color_changed = FALSE;
|
||||
new_name = gtk_entry_get_text (GTK_ENTRY (options->name_entry));
|
||||
|
||||
new_name = gtk_entry_get_text (GTK_ENTRY (options->name_entry));
|
||||
gimp_color_button_get_color (GIMP_COLOR_BUTTON (options->color_panel),
|
||||
&color);
|
||||
|
||||
gimp_color_button_get_color (GIMP_COLOR_BUTTON (options->color_panel),
|
||||
&color);
|
||||
if (strcmp (new_name, gimp_object_get_name (GIMP_OBJECT (channel))))
|
||||
name_changed = TRUE;
|
||||
|
||||
if (strcmp (new_name, gimp_object_get_name (GIMP_OBJECT (channel))))
|
||||
name_changed = TRUE;
|
||||
if (gimp_rgba_distance (&color, &channel->color) > 0.0001)
|
||||
color_changed = TRUE;
|
||||
|
||||
if (gimp_rgba_distance (&color, &channel->color) > 0.0001)
|
||||
color_changed = TRUE;
|
||||
if (name_changed && color_changed)
|
||||
gimp_image_undo_group_start (options->gimage,
|
||||
GIMP_UNDO_GROUP_ITEM_PROPERTIES,
|
||||
_("Channel Attributes"));
|
||||
|
||||
if (name_changed && color_changed)
|
||||
gimp_image_undo_group_start (options->gimage,
|
||||
GIMP_UNDO_GROUP_ITEM_PROPERTIES,
|
||||
_("Channel Attributes"));
|
||||
if (name_changed)
|
||||
gimp_item_rename (GIMP_ITEM (channel), new_name);
|
||||
|
||||
if (name_changed)
|
||||
gimp_item_rename (GIMP_ITEM (channel), new_name);
|
||||
if (color_changed)
|
||||
gimp_channel_set_color (channel, &color, TRUE);
|
||||
|
||||
if (color_changed)
|
||||
gimp_channel_set_color (channel, &color, TRUE);
|
||||
if (name_changed && color_changed)
|
||||
gimp_image_undo_group_end (options->gimage);
|
||||
|
||||
if (name_changed && color_changed)
|
||||
gimp_image_undo_group_end (options->gimage);
|
||||
|
||||
if (name_changed || color_changed)
|
||||
gimp_image_flush (options->gimage);
|
||||
}
|
||||
if (name_changed || color_changed)
|
||||
gimp_image_flush (options->gimage);
|
||||
}
|
||||
|
||||
gtk_widget_destroy (options->query_box);
|
||||
|
@ -484,6 +475,7 @@ edit_channel_query_response (GtkWidget *widget,
|
|||
|
||||
void
|
||||
channels_edit_channel_query (GimpChannel *channel,
|
||||
GimpContext *context,
|
||||
GtkWidget *parent)
|
||||
{
|
||||
EditChannelOptions *options;
|
||||
|
@ -492,6 +484,9 @@ channels_edit_channel_query (GimpChannel *channel,
|
|||
GtkWidget *table;
|
||||
GtkObject *opacity_scale_data;
|
||||
|
||||
g_return_if_fail (GIMP_IS_CHANNEL (channel));
|
||||
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
||||
|
||||
options = g_new0 (EditChannelOptions, 1);
|
||||
|
||||
options->channel = channel;
|
||||
|
@ -504,7 +499,7 @@ channels_edit_channel_query (GimpChannel *channel,
|
|||
GIMP_COLOR_AREA_LARGE_CHECKS,
|
||||
48, 64);
|
||||
gimp_color_panel_set_context (GIMP_COLOR_PANEL (options->color_panel),
|
||||
gimp_get_user_context (options->gimage->gimp));
|
||||
context);
|
||||
|
||||
/* The dialog */
|
||||
options->query_box =
|
||||
|
@ -529,23 +524,22 @@ channels_edit_channel_query (GimpChannel *channel,
|
|||
G_CALLBACK (edit_channel_query_response),
|
||||
options);
|
||||
|
||||
/* The main hbox */
|
||||
hbox = gtk_hbox_new (FALSE, 6);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 12);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options->query_box)->vbox),
|
||||
hbox);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
/* The vbox */
|
||||
vbox = gtk_vbox_new (FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
/* The table */
|
||||
table = gtk_table_new (2, 3, FALSE);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
||||
gtk_widget_show (table);
|
||||
|
||||
/* The name entry */
|
||||
options->name_entry = gtk_entry_new ();
|
||||
gtk_entry_set_text (GTK_ENTRY (options->name_entry),
|
||||
gimp_object_get_name (GIMP_OBJECT (channel)));
|
||||
|
@ -553,7 +547,6 @@ channels_edit_channel_query (GimpChannel *channel,
|
|||
_("Channel Name:"), 0.0, 0.5,
|
||||
options->name_entry, 2, FALSE);
|
||||
|
||||
/* The opacity scale */
|
||||
opacity_scale_data = gimp_scale_entry_new (GTK_TABLE (table), 0, 1,
|
||||
_("Fill Opacity:"), 100, -1,
|
||||
channel_color.a * 100.0,
|
||||
|
@ -565,7 +558,6 @@ channels_edit_channel_query (GimpChannel *channel,
|
|||
G_CALLBACK (channels_opacity_update),
|
||||
options->color_panel);
|
||||
|
||||
/* The color panel */
|
||||
gtk_box_pack_start (GTK_BOX (hbox), options->color_panel,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_widget_show (options->color_panel);
|
||||
|
@ -574,9 +566,6 @@ channels_edit_channel_query (GimpChannel *channel,
|
|||
G_CALLBACK (channels_color_changed),
|
||||
opacity_scale_data);
|
||||
|
||||
gtk_widget_show (table);
|
||||
gtk_widget_show (vbox);
|
||||
gtk_widget_show (hbox);
|
||||
gtk_widget_show (options->query_box);
|
||||
}
|
||||
|
||||
|
@ -604,4 +593,3 @@ channels_color_changed (GimpColorButton *button,
|
|||
gimp_color_button_get_color (button, &color);
|
||||
gtk_adjustment_set_value (adj, color.a * 100.0);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,8 +20,11 @@
|
|||
#define __CHANNELS_COMMANDS_H__
|
||||
|
||||
|
||||
void channels_edit_attributes_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void channels_new_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
|
||||
void channels_raise_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void channels_raise_to_top_cmd_callback (GtkAction *action,
|
||||
|
@ -30,6 +33,7 @@ void channels_lower_cmd_callback (GtkAction *action,
|
|||
gpointer data);
|
||||
void channels_lower_to_bottom_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
|
||||
void channels_duplicate_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void channels_delete_cmd_callback (GtkAction *action,
|
||||
|
@ -37,14 +41,14 @@ void channels_delete_cmd_callback (GtkAction *action,
|
|||
void channels_to_selection_cmd_callback (GtkAction *action,
|
||||
gint value,
|
||||
gpointer data);
|
||||
void channels_edit_attributes_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
|
||||
void channels_new_channel_query (GimpImage *gimage,
|
||||
GimpContext *context,
|
||||
GimpChannel *template,
|
||||
gboolean interactive,
|
||||
GtkWidget *parent);
|
||||
void channels_edit_channel_query (GimpChannel *channel,
|
||||
GimpContext *context,
|
||||
GtkWidget *parent);
|
||||
|
||||
|
||||
|
|
|
@ -149,7 +149,7 @@ static GimpEnumActionEntry edit_fill_actions[] =
|
|||
void
|
||||
edit_actions_setup (GimpActionGroup *group)
|
||||
{
|
||||
GimpContext *user_context;
|
||||
GimpContext *context = gimp_get_user_context (group->gimp);
|
||||
GimpRGB color;
|
||||
GimpPattern *pattern;
|
||||
|
||||
|
@ -167,26 +167,24 @@ edit_actions_setup (GimpActionGroup *group)
|
|||
group, 0);
|
||||
edit_actions_buffer_changed (group->gimp, group);
|
||||
|
||||
user_context = gimp_get_user_context (group->gimp);
|
||||
|
||||
g_signal_connect_object (user_context, "foreground_changed",
|
||||
g_signal_connect_object (context, "foreground_changed",
|
||||
G_CALLBACK (edit_actions_foreground_changed),
|
||||
group, 0);
|
||||
g_signal_connect_object (user_context, "background_changed",
|
||||
g_signal_connect_object (context, "background_changed",
|
||||
G_CALLBACK (edit_actions_background_changed),
|
||||
group, 0);
|
||||
g_signal_connect_object (user_context, "pattern_changed",
|
||||
g_signal_connect_object (context, "pattern_changed",
|
||||
G_CALLBACK (edit_actions_pattern_changed),
|
||||
group, 0);
|
||||
|
||||
gimp_context_get_foreground (user_context, &color);
|
||||
edit_actions_foreground_changed (user_context, &color, group);
|
||||
gimp_context_get_foreground (context, &color);
|
||||
edit_actions_foreground_changed (context, &color, group);
|
||||
|
||||
gimp_context_get_background (user_context, &color);
|
||||
edit_actions_background_changed (user_context, &color, group);
|
||||
gimp_context_get_background (context, &color);
|
||||
edit_actions_background_changed (context, &color, group);
|
||||
|
||||
pattern = gimp_context_get_pattern (user_context);
|
||||
edit_actions_pattern_changed (user_context, pattern, group);
|
||||
pattern = gimp_context_get_pattern (context);
|
||||
edit_actions_pattern_changed (context, pattern, group);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -129,7 +129,7 @@ edit_cut_cmd_callback (GtkAction *action,
|
|||
GimpDrawable *drawable;
|
||||
return_if_no_drawable (gimage, drawable, data);
|
||||
|
||||
if (gimp_edit_cut (gimage, drawable, gimp_get_user_context (gimage->gimp)))
|
||||
if (gimp_edit_cut (gimage, drawable, action_data_get_context (data)))
|
||||
gimp_image_flush (gimage);
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ edit_copy_cmd_callback (GtkAction *action,
|
|||
GimpDrawable *drawable;
|
||||
return_if_no_drawable (gimage, drawable, data);
|
||||
|
||||
if (gimp_edit_copy (gimage, drawable, gimp_get_user_context (gimage->gimp)))
|
||||
if (gimp_edit_copy (gimage, drawable, action_data_get_context (data)))
|
||||
gimp_image_flush (gimage);
|
||||
}
|
||||
|
||||
|
@ -260,7 +260,7 @@ edit_clear_cmd_callback (GtkAction *action,
|
|||
GimpDrawable *drawable;
|
||||
return_if_no_drawable (gimage, drawable, data);
|
||||
|
||||
gimp_edit_clear (gimage, drawable, gimp_get_user_context (gimage->gimp));
|
||||
gimp_edit_clear (gimage, drawable, action_data_get_context (data));
|
||||
gimp_image_flush (gimage);
|
||||
}
|
||||
|
||||
|
@ -276,7 +276,7 @@ edit_fill_cmd_callback (GtkAction *action,
|
|||
|
||||
fill_type = (GimpFillType) value;
|
||||
|
||||
gimp_edit_fill (gimage, drawable, gimp_get_user_context (gimage->gimp),
|
||||
gimp_edit_fill (gimage, drawable, action_data_get_context (data),
|
||||
fill_type);
|
||||
gimp_image_flush (gimage);
|
||||
}
|
||||
|
@ -291,17 +291,17 @@ cut_named_buffer_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage = GIMP_IMAGE (data);
|
||||
const GimpBuffer *cut_buffer;
|
||||
GimpDrawable *active_drawable;
|
||||
GimpDrawable *drawable;
|
||||
|
||||
active_drawable = gimp_image_active_drawable (gimage);
|
||||
drawable = gimp_image_active_drawable (gimage);
|
||||
|
||||
if (! active_drawable)
|
||||
if (! drawable)
|
||||
{
|
||||
g_message (_("There is no active layer or channel to cut from."));
|
||||
return;
|
||||
}
|
||||
|
||||
cut_buffer = gimp_edit_cut (gimage, active_drawable,
|
||||
cut_buffer = gimp_edit_cut (gimage, drawable,
|
||||
gimp_get_user_context (gimage->gimp));
|
||||
|
||||
if (cut_buffer)
|
||||
|
@ -328,17 +328,17 @@ copy_named_buffer_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage = GIMP_IMAGE (data);
|
||||
const GimpBuffer *copy_buffer;
|
||||
GimpDrawable *active_drawable;
|
||||
GimpDrawable *drawable;
|
||||
|
||||
active_drawable = gimp_image_active_drawable (gimage);
|
||||
drawable = gimp_image_active_drawable (gimage);
|
||||
|
||||
if (! active_drawable)
|
||||
if (! drawable)
|
||||
{
|
||||
g_message (_("There is no active layer or channel to copy from."));
|
||||
return;
|
||||
}
|
||||
|
||||
copy_buffer = gimp_edit_copy (gimage, active_drawable,
|
||||
copy_buffer = gimp_edit_copy (gimage, drawable,
|
||||
gimp_get_user_context (gimage->gimp));
|
||||
|
||||
if (copy_buffer)
|
||||
|
|
|
@ -118,7 +118,7 @@ file_last_opened_cmd_callback (GtkAction *action,
|
|||
GimpPDBStatusType status;
|
||||
GError *error = NULL;
|
||||
|
||||
gimage = file_open_with_display (gimp, gimp_get_user_context (gimp),
|
||||
gimage = file_open_with_display (gimp, action_data_get_context (data),
|
||||
GIMP_OBJECT (imagefile)->name,
|
||||
&status, &error);
|
||||
|
||||
|
@ -164,8 +164,7 @@ file_save_cmd_callback (GtkAction *action,
|
|||
GimpPDBStatusType status;
|
||||
GError *error = NULL;
|
||||
|
||||
status = file_save (gdisp->gimage,
|
||||
gimp_get_user_context (gdisp->gimage->gimp),
|
||||
status = file_save (gdisp->gimage, action_data_get_context (data),
|
||||
GIMP_RUN_WITH_LAST_VALS, &error);
|
||||
|
||||
if (status != GIMP_PDB_SUCCESS &&
|
||||
|
|
|
@ -63,27 +63,46 @@
|
|||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
typedef struct
|
||||
typedef struct _ImageResizeOptions ImageResizeOptions;
|
||||
|
||||
struct _ImageResizeOptions
|
||||
{
|
||||
ResizeDialog *dialog;
|
||||
|
||||
GimpContext *context;
|
||||
GimpDisplay *gdisp;
|
||||
GimpImage *gimage;
|
||||
} ImageResize;
|
||||
};
|
||||
|
||||
|
||||
typedef struct _LayerMergeOptions LayerMergeOptions;
|
||||
|
||||
struct _LayerMergeOptions
|
||||
{
|
||||
GtkWidget *query_box;
|
||||
|
||||
GimpContext *context;
|
||||
GimpImage *gimage;
|
||||
GimpMergeType merge_type;
|
||||
};
|
||||
|
||||
|
||||
/* local function prototypes */
|
||||
|
||||
static void image_resize_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void image_scale_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void image_scale_warn (ImageResize *image_scale,
|
||||
const gchar *warning_title,
|
||||
const gchar *warning_message);
|
||||
static void image_scale_warn_callback (GtkWidget *widget,
|
||||
gboolean do_scale,
|
||||
gpointer data);
|
||||
static void image_scale_implement (ImageResize *image_scale);
|
||||
static void image_resize_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void image_scale_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void image_scale_warn (ImageResizeOptions *options,
|
||||
const gchar *warning_title,
|
||||
const gchar *warning_message);
|
||||
static void image_scale_warn_callback (GtkWidget *widget,
|
||||
gboolean do_scale,
|
||||
gpointer data);
|
||||
static void image_scale_implement (ImageResizeOptions *options);
|
||||
static void image_merge_layers_response (GtkWidget *widget,
|
||||
gint response_id,
|
||||
LayerMergeOptions *options);
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
@ -162,19 +181,20 @@ void
|
|||
image_resize_cmd_callback (GtkAction *action,
|
||||
gpointer data)
|
||||
{
|
||||
GimpDisplay *gdisp;
|
||||
GimpImage *gimage;
|
||||
ImageResize *image_resize;
|
||||
ImageResizeOptions *options;
|
||||
GimpDisplay *gdisp;
|
||||
GimpImage *gimage;
|
||||
return_if_no_display (gdisp, data);
|
||||
|
||||
gimage = gdisp->gimage;
|
||||
|
||||
image_resize = g_new0 (ImageResize, 1);
|
||||
options = g_new0 (ImageResizeOptions, 1);
|
||||
|
||||
image_resize->gdisp = gdisp;
|
||||
image_resize->gimage = gimage;
|
||||
options->context = action_data_get_context (data);
|
||||
options->gdisp = gdisp;
|
||||
options->gimage = gimage;
|
||||
|
||||
image_resize->dialog =
|
||||
options->dialog =
|
||||
resize_dialog_new (GIMP_VIEWABLE (gimage), gdisp->shell,
|
||||
RESIZE_DIALOG,
|
||||
gimage->width,
|
||||
|
@ -184,37 +204,38 @@ image_resize_cmd_callback (GtkAction *action,
|
|||
gimage->unit,
|
||||
GIMP_DISPLAY_SHELL (gdisp->shell)->dot_for_dot,
|
||||
G_CALLBACK (image_resize_callback),
|
||||
image_resize);
|
||||
options);
|
||||
|
||||
g_signal_connect_object (gdisp, "disconnect",
|
||||
G_CALLBACK (gtk_widget_destroy),
|
||||
image_resize->dialog->shell,
|
||||
options->dialog->shell,
|
||||
G_CONNECT_SWAPPED);
|
||||
|
||||
g_object_weak_ref (G_OBJECT (image_resize->dialog->shell),
|
||||
g_object_weak_ref (G_OBJECT (options->dialog->shell),
|
||||
(GWeakNotify) g_free,
|
||||
image_resize);
|
||||
options);
|
||||
|
||||
gtk_widget_show (image_resize->dialog->shell);
|
||||
gtk_widget_show (options->dialog->shell);
|
||||
}
|
||||
|
||||
void
|
||||
image_scale_cmd_callback (GtkAction *action,
|
||||
gpointer data)
|
||||
{
|
||||
GimpDisplay *gdisp;
|
||||
GimpImage *gimage;
|
||||
ImageResize *image_scale;
|
||||
ImageResizeOptions *options;
|
||||
GimpDisplay *gdisp;
|
||||
GimpImage *gimage;
|
||||
return_if_no_display (gdisp, data);
|
||||
|
||||
gimage = gdisp->gimage;
|
||||
|
||||
image_scale = g_new0 (ImageResize, 1);
|
||||
options = g_new0 (ImageResizeOptions, 1);
|
||||
|
||||
image_scale->gdisp = gdisp;
|
||||
image_scale->gimage = gimage;
|
||||
options->context = action_data_get_context (data);
|
||||
options->gdisp = gdisp;
|
||||
options->gimage = gimage;
|
||||
|
||||
image_scale->dialog =
|
||||
options->dialog =
|
||||
resize_dialog_new (GIMP_VIEWABLE (gimage), gdisp->shell,
|
||||
SCALE_DIALOG,
|
||||
gimage->width,
|
||||
|
@ -224,18 +245,18 @@ image_scale_cmd_callback (GtkAction *action,
|
|||
gimage->unit,
|
||||
GIMP_DISPLAY_SHELL (gdisp->shell)->dot_for_dot,
|
||||
G_CALLBACK (image_scale_callback),
|
||||
image_scale);
|
||||
options);
|
||||
|
||||
g_signal_connect_object (gdisp, "disconnect",
|
||||
G_CALLBACK (gtk_widget_destroy),
|
||||
image_scale->dialog->shell,
|
||||
options->dialog->shell,
|
||||
G_CONNECT_SWAPPED);
|
||||
|
||||
g_object_weak_ref (G_OBJECT (image_scale->dialog->shell),
|
||||
g_object_weak_ref (G_OBJECT (options->dialog->shell),
|
||||
(GWeakNotify) g_free,
|
||||
image_scale);
|
||||
options);
|
||||
|
||||
gtk_widget_show (image_scale->dialog->shell);
|
||||
gtk_widget_show (options->dialog->shell);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -249,7 +270,7 @@ image_flip_cmd_callback (GtkAction *action,
|
|||
|
||||
progress = gimp_progress_start (gdisp, _("Flipping..."), TRUE, NULL, NULL);
|
||||
|
||||
gimp_image_flip (gdisp->gimage, gimp_get_user_context (gdisp->gimage->gimp),
|
||||
gimp_image_flip (gdisp->gimage, action_data_get_context (data),
|
||||
(GimpOrientationType) value,
|
||||
gimp_progress_update_and_flush, progress);
|
||||
|
||||
|
@ -269,7 +290,7 @@ image_rotate_cmd_callback (GtkAction *action,
|
|||
|
||||
progress = gimp_progress_start (gdisp, _("Rotating..."), TRUE, NULL, NULL);
|
||||
|
||||
gimp_image_rotate (gdisp->gimage, gimp_get_user_context (gdisp->gimage->gimp),
|
||||
gimp_image_rotate (gdisp->gimage, action_data_get_context (data),
|
||||
(GimpRotationType) value,
|
||||
gimp_progress_update_and_flush, progress);
|
||||
|
||||
|
@ -293,7 +314,7 @@ image_crop_cmd_callback (GtkAction *action,
|
|||
return;
|
||||
}
|
||||
|
||||
gimp_image_crop (gimage, gimp_get_user_context (gimage->gimp),
|
||||
gimp_image_crop (gimage, action_data_get_context (data),
|
||||
x1, y1, x2, y2, FALSE, TRUE);
|
||||
gimp_image_flush (gimage);
|
||||
}
|
||||
|
@ -307,9 +328,7 @@ image_duplicate_cmd_callback (GtkAction *action,
|
|||
return_if_no_image (gimage, data);
|
||||
|
||||
new_gimage = gimp_image_duplicate (gimage);
|
||||
|
||||
gimp_create_display (new_gimage->gimp, new_gimage, 1.0);
|
||||
|
||||
g_object_unref (new_gimage);
|
||||
}
|
||||
|
||||
|
@ -317,12 +336,62 @@ void
|
|||
image_merge_layers_cmd_callback (GtkAction *action,
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GtkWidget *widget;
|
||||
LayerMergeOptions *options;
|
||||
GimpImage *gimage;
|
||||
GtkWidget *widget;
|
||||
GtkWidget *frame;
|
||||
return_if_no_image (gimage, data);
|
||||
return_if_no_widget (widget, data);
|
||||
|
||||
image_layers_merge_query (gimage, TRUE, widget);
|
||||
options = g_new0 (LayerMergeOptions, 1);
|
||||
|
||||
options->context = action_data_get_context (data);
|
||||
options->gimage = gimage;
|
||||
options->merge_type = GIMP_EXPAND_AS_NECESSARY;
|
||||
|
||||
options->query_box =
|
||||
gimp_viewable_dialog_new (GIMP_VIEWABLE (gimage),
|
||||
_("Merge Layers"), "gimp-image-merge-layers",
|
||||
GIMP_STOCK_MERGE_DOWN,
|
||||
_("Layers Merge Options"),
|
||||
widget,
|
||||
gimp_standard_help_func,
|
||||
GIMP_HELP_IMAGE_MERGE_LAYERS,
|
||||
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
GTK_STOCK_OK, GTK_RESPONSE_OK,
|
||||
|
||||
NULL);
|
||||
|
||||
g_signal_connect (options->query_box, "response",
|
||||
G_CALLBACK (image_merge_layers_response),
|
||||
options);
|
||||
|
||||
g_object_weak_ref (G_OBJECT (options->query_box),
|
||||
(GWeakNotify) g_free,
|
||||
options);
|
||||
|
||||
frame = gimp_int_radio_group_new (TRUE, _("Final, Merged Layer should be:"),
|
||||
G_CALLBACK (gimp_radio_button_update),
|
||||
&options->merge_type, options->merge_type,
|
||||
|
||||
_("Expanded as necessary"),
|
||||
GIMP_EXPAND_AS_NECESSARY, NULL,
|
||||
|
||||
_("Clipped to image"),
|
||||
GIMP_CLIP_TO_IMAGE, NULL,
|
||||
|
||||
_("Clipped to bottom layer"),
|
||||
GIMP_CLIP_TO_BOTTOM_LAYER, NULL,
|
||||
|
||||
NULL);
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (frame), 12);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options->query_box)->vbox),
|
||||
frame);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
gtk_widget_show (options->query_box);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -332,7 +401,7 @@ image_flatten_image_cmd_callback (GtkAction *action,
|
|||
GimpImage *gimage;
|
||||
return_if_no_image (gimage, data);
|
||||
|
||||
gimp_image_flatten (gimage, gimp_get_user_context (gimage->gimp));
|
||||
gimp_image_flatten (gimage, action_data_get_context (data));
|
||||
gimp_image_flush (gimage);
|
||||
}
|
||||
|
||||
|
@ -365,142 +434,36 @@ image_configure_grid_cmd_callback (GtkAction *action,
|
|||
}
|
||||
|
||||
|
||||
/****************************/
|
||||
/* The layer merge dialog */
|
||||
/****************************/
|
||||
|
||||
typedef struct _LayerMergeOptions LayerMergeOptions;
|
||||
|
||||
struct _LayerMergeOptions
|
||||
{
|
||||
GtkWidget *query_box;
|
||||
GimpImage *gimage;
|
||||
gboolean merge_visible;
|
||||
GimpMergeType merge_type;
|
||||
};
|
||||
|
||||
static void
|
||||
image_layers_merge_query_response (GtkWidget *widget,
|
||||
gint response_id,
|
||||
LayerMergeOptions *options)
|
||||
{
|
||||
GimpImage *gimage = options->gimage;
|
||||
|
||||
if (! gimage)
|
||||
return;
|
||||
|
||||
if (response_id == GTK_RESPONSE_OK)
|
||||
{
|
||||
if (options->merge_visible)
|
||||
gimp_image_merge_visible_layers (gimage,
|
||||
gimp_get_user_context (gimage->gimp),
|
||||
options->merge_type);
|
||||
|
||||
gimp_image_flush (gimage);
|
||||
}
|
||||
|
||||
gtk_widget_destroy (options->query_box);
|
||||
}
|
||||
|
||||
void
|
||||
image_layers_merge_query (GimpImage *gimage,
|
||||
/* if FALSE, anchor active layer */
|
||||
gboolean merge_visible,
|
||||
GtkWidget *parent)
|
||||
{
|
||||
LayerMergeOptions *options;
|
||||
GtkWidget *frame;
|
||||
|
||||
/* The new options structure */
|
||||
options = g_new (LayerMergeOptions, 1);
|
||||
options->gimage = gimage;
|
||||
options->merge_visible = merge_visible;
|
||||
options->merge_type = GIMP_EXPAND_AS_NECESSARY;
|
||||
|
||||
/* The dialog */
|
||||
options->query_box =
|
||||
gimp_viewable_dialog_new (GIMP_VIEWABLE (gimage),
|
||||
_("Merge Layers"), "gimp-image-merge-layers",
|
||||
GIMP_STOCK_MERGE_DOWN,
|
||||
_("Layers Merge Options"),
|
||||
parent,
|
||||
gimp_standard_help_func,
|
||||
GIMP_HELP_IMAGE_MERGE_LAYERS,
|
||||
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
GTK_STOCK_OK, GTK_RESPONSE_OK,
|
||||
|
||||
NULL);
|
||||
|
||||
g_signal_connect (options->query_box, "response",
|
||||
G_CALLBACK (image_layers_merge_query_response),
|
||||
options);
|
||||
|
||||
g_object_weak_ref (G_OBJECT (options->query_box),
|
||||
(GWeakNotify) g_free,
|
||||
options);
|
||||
|
||||
frame =
|
||||
gimp_int_radio_group_new (TRUE,
|
||||
merge_visible ?
|
||||
_("Final, Merged Layer should be:") :
|
||||
_("Final, Anchored Layer should be:"),
|
||||
G_CALLBACK (gimp_radio_button_update),
|
||||
&options->merge_type, options->merge_type,
|
||||
|
||||
_("Expanded as necessary"),
|
||||
GIMP_EXPAND_AS_NECESSARY, NULL,
|
||||
|
||||
_("Clipped to image"),
|
||||
GIMP_CLIP_TO_IMAGE, NULL,
|
||||
|
||||
_("Clipped to bottom layer"),
|
||||
GIMP_CLIP_TO_BOTTOM_LAYER, NULL,
|
||||
|
||||
NULL);
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (frame), 12);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options->query_box)->vbox),
|
||||
frame);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
gtk_widget_show (options->query_box);
|
||||
}
|
||||
|
||||
|
||||
/* private functions */
|
||||
|
||||
static void
|
||||
image_resize_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
ImageResize *image_resize = data;
|
||||
ImageResizeOptions *options = data;
|
||||
|
||||
g_assert (image_resize != NULL);
|
||||
g_assert (image_resize->gimage != NULL);
|
||||
gtk_widget_set_sensitive (options->dialog->shell, FALSE);
|
||||
|
||||
gtk_widget_set_sensitive (image_resize->dialog->shell, FALSE);
|
||||
|
||||
if (image_resize->dialog->width > 0 &&
|
||||
image_resize->dialog->height > 0)
|
||||
if (options->dialog->width > 0 &&
|
||||
options->dialog->height > 0)
|
||||
{
|
||||
GimpProgress *progress;
|
||||
|
||||
progress = gimp_progress_start (image_resize->gdisp,
|
||||
progress = gimp_progress_start (options->gdisp,
|
||||
_("Resizing..."),
|
||||
TRUE, NULL, NULL);
|
||||
|
||||
gimp_image_resize (image_resize->gimage,
|
||||
gimp_get_user_context (image_resize->gimage->gimp),
|
||||
image_resize->dialog->width,
|
||||
image_resize->dialog->height,
|
||||
image_resize->dialog->offset_x,
|
||||
image_resize->dialog->offset_y,
|
||||
gimp_image_resize (options->gimage,
|
||||
options->context,
|
||||
options->dialog->width,
|
||||
options->dialog->height,
|
||||
options->dialog->offset_x,
|
||||
options->dialog->offset_y,
|
||||
gimp_progress_update_and_flush, progress);
|
||||
|
||||
gimp_progress_end (progress);
|
||||
|
||||
gimp_image_flush (image_resize->gimage);
|
||||
gimp_image_flush (options->gimage);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -508,26 +471,22 @@ image_resize_callback (GtkWidget *widget,
|
|||
"greater than zero."));
|
||||
}
|
||||
|
||||
gtk_widget_destroy (image_resize->dialog->shell);
|
||||
gtk_widget_destroy (options->dialog->shell);
|
||||
}
|
||||
|
||||
static void
|
||||
image_scale_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
ImageResize *image_scale = data;
|
||||
ImageResizeOptions *options = data;
|
||||
GimpImageScaleCheckType scale_check;
|
||||
gint64 new_memsize;
|
||||
gchar *warning_message;
|
||||
|
||||
g_assert (image_scale != NULL);
|
||||
g_assert (image_scale->gimage != NULL);
|
||||
gtk_widget_set_sensitive (options->dialog->shell, FALSE);
|
||||
|
||||
gtk_widget_set_sensitive (image_scale->dialog->shell, FALSE);
|
||||
|
||||
scale_check = gimp_image_scale_check (image_scale->gimage,
|
||||
image_scale->dialog->width,
|
||||
image_scale->dialog->height,
|
||||
scale_check = gimp_image_scale_check (options->gimage,
|
||||
options->dialog->width,
|
||||
options->dialog->height,
|
||||
&new_memsize);
|
||||
switch (scale_check)
|
||||
{
|
||||
|
@ -535,10 +494,11 @@ image_scale_callback (GtkWidget *widget,
|
|||
{
|
||||
gchar *size_str;
|
||||
gchar *max_size_str;
|
||||
gchar *warning_message;
|
||||
|
||||
size_str = gimp_memsize_to_string (new_memsize);
|
||||
max_size_str = gimp_memsize_to_string
|
||||
(GIMP_GUI_CONFIG (image_scale->gimage->gimp->config)->max_new_image_size);
|
||||
(GIMP_GUI_CONFIG (options->gimage->gimp->config)->max_new_image_size);
|
||||
|
||||
warning_message = g_strdup_printf
|
||||
(_("You are trying to create an image with a size of %s.\n\n"
|
||||
|
@ -553,7 +513,7 @@ image_scale_callback (GtkWidget *widget,
|
|||
g_free (size_str);
|
||||
g_free (max_size_str);
|
||||
|
||||
image_scale_warn (image_scale, _("Image exceeds maximum image size"),
|
||||
image_scale_warn (options, _("Image exceeds maximum image size"),
|
||||
warning_message);
|
||||
|
||||
g_free (warning_message);
|
||||
|
@ -561,40 +521,37 @@ image_scale_callback (GtkWidget *widget,
|
|||
break;
|
||||
|
||||
case GIMP_IMAGE_SCALE_TOO_SMALL:
|
||||
warning_message = _("The chosen image size will shrink "
|
||||
"some layers completely away. "
|
||||
"Is this what you want?");
|
||||
|
||||
image_scale_warn (image_scale, _("Layer Too Small"),
|
||||
warning_message);
|
||||
image_scale_warn (options, _("Layer Too Small"),
|
||||
_("The chosen image size will shrink some layers "
|
||||
"completely away. Is this what you want?"));
|
||||
break;
|
||||
|
||||
case GIMP_IMAGE_SCALE_OK:
|
||||
/* If all is well, return directly after scaling image. */
|
||||
image_scale_implement (image_scale);
|
||||
gtk_widget_destroy (image_scale->dialog->shell);
|
||||
image_scale_implement (options);
|
||||
gtk_widget_destroy (options->dialog->shell);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
image_scale_warn (ImageResize *image_scale,
|
||||
const gchar *warning_title,
|
||||
const gchar *warning_message)
|
||||
image_scale_warn (ImageResizeOptions *options,
|
||||
const gchar *warning_title,
|
||||
const gchar *warning_message)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
|
||||
dialog = gimp_query_boolean_box (warning_title,
|
||||
image_scale->dialog->shell,
|
||||
options->dialog->shell,
|
||||
gimp_standard_help_func,
|
||||
GIMP_HELP_IMAGE_SCALE_WARNING,
|
||||
GTK_STOCK_DIALOG_QUESTION,
|
||||
warning_message,
|
||||
GTK_STOCK_OK, GTK_STOCK_CANCEL,
|
||||
G_OBJECT (image_scale->dialog->shell),
|
||||
G_OBJECT (options->dialog->shell),
|
||||
"destroy",
|
||||
image_scale_warn_callback,
|
||||
image_scale);
|
||||
options);
|
||||
gtk_widget_show (dialog);
|
||||
}
|
||||
|
||||
|
@ -603,61 +560,55 @@ image_scale_warn_callback (GtkWidget *widget,
|
|||
gboolean do_scale,
|
||||
gpointer data)
|
||||
{
|
||||
ImageResize *image_scale = data;
|
||||
ImageResizeOptions *options = data;
|
||||
|
||||
if (do_scale) /* User doesn't mind losing layers or
|
||||
* creating huge image... */
|
||||
if (do_scale)
|
||||
{
|
||||
image_scale_implement (image_scale);
|
||||
gtk_widget_destroy (image_scale->dialog->shell);
|
||||
image_scale_implement (options);
|
||||
gtk_widget_destroy (options->dialog->shell);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_set_sensitive (image_scale->dialog->shell, TRUE);
|
||||
gtk_widget_set_sensitive (options->dialog->shell, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
image_scale_implement (ImageResize *image_scale)
|
||||
image_scale_implement (ImageResizeOptions *options)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GimpImage *gimage = options->gimage;
|
||||
|
||||
g_assert (image_scale != NULL);
|
||||
g_assert (image_scale->gimage != NULL);
|
||||
|
||||
gimage = image_scale->gimage;
|
||||
|
||||
if (image_scale->dialog->resolution_x == gimage->xresolution &&
|
||||
image_scale->dialog->resolution_y == gimage->yresolution &&
|
||||
image_scale->dialog->unit == gimage->unit &&
|
||||
image_scale->dialog->width == gimage->width &&
|
||||
image_scale->dialog->height == gimage->height)
|
||||
if (options->dialog->resolution_x == gimage->xresolution &&
|
||||
options->dialog->resolution_y == gimage->yresolution &&
|
||||
options->dialog->unit == gimage->unit &&
|
||||
options->dialog->width == gimage->width &&
|
||||
options->dialog->height == gimage->height)
|
||||
return;
|
||||
|
||||
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_IMAGE_SCALE,
|
||||
_("Scale Image"));
|
||||
|
||||
gimp_image_set_resolution (gimage,
|
||||
image_scale->dialog->resolution_x,
|
||||
image_scale->dialog->resolution_y);
|
||||
gimp_image_set_unit (gimage, image_scale->dialog->unit);
|
||||
options->dialog->resolution_x,
|
||||
options->dialog->resolution_y);
|
||||
gimp_image_set_unit (gimage, options->dialog->unit);
|
||||
|
||||
if (image_scale->dialog->width != gimage->width ||
|
||||
image_scale->dialog->height != gimage->height)
|
||||
if (options->dialog->width != gimage->width ||
|
||||
options->dialog->height != gimage->height)
|
||||
{
|
||||
if (image_scale->dialog->width > 0 &&
|
||||
image_scale->dialog->height > 0)
|
||||
if (options->dialog->width > 0 &&
|
||||
options->dialog->height > 0)
|
||||
{
|
||||
GimpProgress *progress;
|
||||
|
||||
progress = gimp_progress_start (image_scale->gdisp,
|
||||
progress = gimp_progress_start (options->gdisp,
|
||||
_("Scaling..."),
|
||||
TRUE, NULL, NULL);
|
||||
|
||||
gimp_image_scale (gimage,
|
||||
image_scale->dialog->width,
|
||||
image_scale->dialog->height,
|
||||
image_scale->dialog->interpolation,
|
||||
options->dialog->width,
|
||||
options->dialog->height,
|
||||
options->dialog->interpolation,
|
||||
gimp_progress_update_and_flush, progress);
|
||||
|
||||
gimp_progress_end (progress);
|
||||
|
@ -674,3 +625,19 @@ image_scale_implement (ImageResize *image_scale)
|
|||
|
||||
gimp_image_flush (gimage);
|
||||
}
|
||||
|
||||
static void
|
||||
image_merge_layers_response (GtkWidget *widget,
|
||||
gint response_id,
|
||||
LayerMergeOptions *options)
|
||||
{
|
||||
if (response_id == GTK_RESPONSE_OK)
|
||||
{
|
||||
gimp_image_merge_visible_layers (options->gimage,
|
||||
options->context,
|
||||
options->merge_type);
|
||||
gimp_image_flush (options->gimage);
|
||||
}
|
||||
|
||||
gtk_widget_destroy (options->query_box);
|
||||
}
|
||||
|
|
|
@ -20,44 +20,41 @@
|
|||
#define __IMAGE_COMMANDS_H__
|
||||
|
||||
|
||||
void image_new_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void image_new_from_image_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void image_new_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void image_new_from_image_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
|
||||
void image_convert_rgb_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void image_convert_grayscale_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void image_convert_indexed_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void image_convert_rgb_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void image_convert_grayscale_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void image_convert_indexed_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
|
||||
void image_resize_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void image_scale_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void image_flip_cmd_callback (GtkAction *action,
|
||||
gint value,
|
||||
gpointer data);
|
||||
void image_rotate_cmd_callback (GtkAction *action,
|
||||
gint value,
|
||||
gpointer data);
|
||||
void image_crop_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void image_resize_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void image_scale_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void image_flip_cmd_callback (GtkAction *action,
|
||||
gint value,
|
||||
gpointer data);
|
||||
void image_rotate_cmd_callback (GtkAction *action,
|
||||
gint value,
|
||||
gpointer data);
|
||||
void image_crop_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
|
||||
void image_duplicate_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void image_duplicate_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
|
||||
void image_merge_layers_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void image_flatten_image_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void image_merge_layers_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void image_flatten_image_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
|
||||
void image_layers_merge_query (GimpImage *gimage,
|
||||
gboolean merge_visible,
|
||||
GtkWidget *parent);
|
||||
void image_configure_grid_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
|
||||
void image_configure_grid_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
|
||||
#endif /* __IMAGE_COMMANDS_H__ */
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "widgets/gimpactiongroup.h"
|
||||
|
||||
#include "actions.h"
|
||||
#include "image-commands.h"
|
||||
#include "layers-actions.h"
|
||||
#include "layers-commands.h"
|
||||
|
||||
|
@ -131,12 +132,12 @@ static GimpActionEntry layers_actions[] =
|
|||
|
||||
{ "layers-merge-layers", NULL,
|
||||
N_("Merge _Visible Layers..."), NULL, NULL,
|
||||
G_CALLBACK (layers_merge_layers_cmd_callback),
|
||||
G_CALLBACK (image_merge_layers_cmd_callback),
|
||||
GIMP_HELP_IMAGE_MERGE_LAYERS },
|
||||
|
||||
{ "layers-flatten-image", NULL,
|
||||
N_("_Flatten Image"), NULL, NULL,
|
||||
G_CALLBACK (layers_flatten_image_cmd_callback),
|
||||
G_CALLBACK (image_flatten_image_cmd_callback),
|
||||
GIMP_HELP_IMAGE_FLATTEN },
|
||||
|
||||
{ "layers-text-discard", GIMP_STOCK_TOOL_TEXT,
|
||||
|
|
|
@ -62,26 +62,65 @@
|
|||
|
||||
#include "actions.h"
|
||||
#include "layers-commands.h"
|
||||
#include "image-commands.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
/* local function prototypes */
|
||||
|
||||
static void layers_add_mask_query (GimpLayer *layer,
|
||||
GtkWidget *parent);
|
||||
static void layers_scale_layer_query (GimpDisplay *gdisp,
|
||||
GimpImage *gimage,
|
||||
GimpLayer *layer,
|
||||
GtkWidget *parent);
|
||||
static void layers_resize_layer_query (GimpImage *gimage,
|
||||
GimpLayer *layer,
|
||||
GtkWidget *parent);
|
||||
static void layers_add_mask_query (GimpLayer *layer,
|
||||
GtkWidget *parent);
|
||||
static void layers_scale_layer_query (GimpDisplay *gdisp,
|
||||
GimpImage *gimage,
|
||||
GimpLayer *layer,
|
||||
GtkWidget *parent);
|
||||
static void layers_resize_layer_query (GimpImage *gimage,
|
||||
GimpLayer *layer,
|
||||
GimpContext *context,
|
||||
GtkWidget *parent);
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
void
|
||||
layers_text_tool_cmd_callback (GtkAction *action,
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GimpLayer *layer;
|
||||
GtkWidget *widget;
|
||||
return_if_no_layer (gimage, layer, data);
|
||||
return_if_no_widget (widget, data);
|
||||
|
||||
layers_text_tool (layer, action_data_get_context (data), widget);
|
||||
}
|
||||
|
||||
void
|
||||
layers_edit_attributes_cmd_callback (GtkAction *action,
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GimpLayer *layer;
|
||||
GtkWidget *widget;
|
||||
return_if_no_layer (gimage, layer, data);
|
||||
return_if_no_widget (widget, data);
|
||||
|
||||
layers_edit_layer_query (layer, action_data_get_context (data), widget);
|
||||
}
|
||||
|
||||
void
|
||||
layers_new_cmd_callback (GtkAction *action,
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GtkWidget *widget;
|
||||
return_if_no_image (gimage, data);
|
||||
return_if_no_widget (widget, data);
|
||||
|
||||
layers_new_layer_query (gimage, action_data_get_context (data),
|
||||
NULL, TRUE, widget);
|
||||
}
|
||||
|
||||
void
|
||||
layers_select_previous_cmd_callback (GtkAction *action,
|
||||
gpointer data)
|
||||
|
@ -220,18 +259,6 @@ layers_lower_to_bottom_cmd_callback (GtkAction *action,
|
|||
gimp_image_flush (gimage);
|
||||
}
|
||||
|
||||
void
|
||||
layers_new_cmd_callback (GtkAction *action,
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GtkWidget *widget;
|
||||
return_if_no_image (gimage, data);
|
||||
return_if_no_widget (widget, data);
|
||||
|
||||
layers_new_layer_query (gimage, NULL, TRUE, widget);
|
||||
}
|
||||
|
||||
void
|
||||
layers_duplicate_cmd_callback (GtkAction *action,
|
||||
gpointer data)
|
||||
|
@ -316,7 +343,8 @@ layers_resize_cmd_callback (GtkAction *action,
|
|||
return_if_no_layer (gimage, layer, data);
|
||||
return_if_no_widget (widget, data);
|
||||
|
||||
layers_resize_layer_query (gimage, layer, widget);
|
||||
layers_resize_layer_query (gimage, layer, action_data_get_context (data),
|
||||
widget);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -485,66 +513,19 @@ layers_alpha_to_selection_cmd_callback (GtkAction *action,
|
|||
}
|
||||
|
||||
void
|
||||
layers_merge_layers_cmd_callback (GtkAction *action,
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GtkWidget *widget;
|
||||
return_if_no_image (gimage, data);
|
||||
return_if_no_widget (widget, data);
|
||||
|
||||
image_layers_merge_query (gimage, TRUE, widget);
|
||||
}
|
||||
|
||||
void
|
||||
layers_flatten_image_cmd_callback (GtkAction *action,
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
return_if_no_image (gimage, data);
|
||||
|
||||
gimp_image_flatten (gimage, action_data_get_context (data));
|
||||
gimp_image_flush (gimage);
|
||||
}
|
||||
|
||||
void
|
||||
layers_text_tool_cmd_callback (GtkAction *action,
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GimpLayer *layer;
|
||||
GtkWidget *widget;
|
||||
return_if_no_layer (gimage, layer, data);
|
||||
return_if_no_widget (widget, data);
|
||||
|
||||
layers_text_tool (layer, widget);
|
||||
}
|
||||
|
||||
void
|
||||
layers_edit_attributes_cmd_callback (GtkAction *action,
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GimpLayer *layer;
|
||||
GtkWidget *widget;
|
||||
return_if_no_layer (gimage, layer, data);
|
||||
return_if_no_widget (widget, data);
|
||||
|
||||
layers_edit_layer_query (layer, widget);
|
||||
}
|
||||
|
||||
void
|
||||
layers_text_tool (GimpLayer *layer,
|
||||
GtkWidget *parent)
|
||||
layers_text_tool (GimpLayer *layer,
|
||||
GimpContext *context,
|
||||
GtkWidget *parent)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GimpTool *active_tool;
|
||||
|
||||
g_return_if_fail (GIMP_IS_LAYER (layer));
|
||||
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
||||
|
||||
if (! gimp_drawable_is_text_layer (GIMP_DRAWABLE (layer)))
|
||||
{
|
||||
layers_edit_layer_query (layer, parent);
|
||||
layers_edit_layer_query (layer, context, parent);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -563,9 +544,7 @@ layers_text_tool (GimpLayer *layer,
|
|||
|
||||
if (GIMP_IS_TOOL_INFO (tool_info))
|
||||
{
|
||||
gimp_context_set_tool (gimp_get_user_context (gimage->gimp),
|
||||
tool_info);
|
||||
|
||||
gimp_context_set_tool (context, tool_info);
|
||||
active_tool = tool_manager_get_active (gimage->gimp);
|
||||
}
|
||||
}
|
||||
|
@ -591,6 +570,7 @@ struct _NewLayerOptions
|
|||
gint xsize;
|
||||
gint ysize;
|
||||
|
||||
GimpContext *context;
|
||||
GimpImage *gimage;
|
||||
};
|
||||
|
||||
|
@ -605,7 +585,6 @@ new_layer_query_response (GtkWidget *widget,
|
|||
if (response_id == GTK_RESPONSE_OK)
|
||||
{
|
||||
GimpLayer *layer;
|
||||
GimpImage *gimage;
|
||||
|
||||
if (layer_name)
|
||||
g_free (layer_name);
|
||||
|
@ -621,28 +600,26 @@ new_layer_query_response (GtkWidget *widget,
|
|||
|
||||
fill_type = options->fill_type;
|
||||
|
||||
if ((gimage = options->gimage))
|
||||
{
|
||||
layer = gimp_layer_new (gimage,
|
||||
options->xsize,
|
||||
options->ysize,
|
||||
gimp_image_base_type_with_alpha (gimage),
|
||||
layer_name,
|
||||
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE);
|
||||
if (layer)
|
||||
{
|
||||
gimp_drawable_fill_by_type (GIMP_DRAWABLE (layer),
|
||||
gimp_get_user_context (gimage->gimp),
|
||||
fill_type);
|
||||
gimp_image_add_layer (gimage, layer, -1);
|
||||
layer = gimp_layer_new (options->gimage,
|
||||
options->xsize,
|
||||
options->ysize,
|
||||
gimp_image_base_type_with_alpha (options->gimage),
|
||||
layer_name,
|
||||
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE);
|
||||
|
||||
gimp_image_flush (gimage);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_message ("new_layer_query_response: "
|
||||
"could not allocate new layer");
|
||||
}
|
||||
if (layer)
|
||||
{
|
||||
gimp_drawable_fill_by_type (GIMP_DRAWABLE (layer),
|
||||
options->context,
|
||||
fill_type);
|
||||
gimp_image_add_layer (options->gimage, layer, -1);
|
||||
|
||||
gimp_image_flush (options->gimage);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_message ("new_layer_query_response: "
|
||||
"could not allocate new layer");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -650,10 +627,11 @@ new_layer_query_response (GtkWidget *widget,
|
|||
}
|
||||
|
||||
void
|
||||
layers_new_layer_query (GimpImage *gimage,
|
||||
GimpLayer *template,
|
||||
gboolean interactive,
|
||||
GtkWidget *parent)
|
||||
layers_new_layer_query (GimpImage *gimage,
|
||||
GimpContext *context,
|
||||
GimpLayer *template,
|
||||
gboolean interactive,
|
||||
GtkWidget *parent)
|
||||
{
|
||||
NewLayerOptions *options;
|
||||
GimpLayer *floating_sel;
|
||||
|
@ -666,6 +644,7 @@ layers_new_layer_query (GimpImage *gimage,
|
|||
GtkWidget *button;
|
||||
|
||||
g_return_if_fail (GIMP_IS_IMAGE (gimage));
|
||||
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
||||
g_return_if_fail (template == NULL || GIMP_IS_LAYER (template));
|
||||
|
||||
/* If there is a floating selection, the new command transforms
|
||||
|
@ -707,16 +686,11 @@ layers_new_layer_query (GimpImage *gimage,
|
|||
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_EDIT_PASTE,
|
||||
_("New Layer"));
|
||||
|
||||
new_layer = gimp_layer_new (gimage,
|
||||
width,
|
||||
height,
|
||||
new_layer = gimp_layer_new (gimage, width, height,
|
||||
gimp_image_base_type_with_alpha (gimage),
|
||||
_("Empty Layer"),
|
||||
opacity,
|
||||
mode);
|
||||
_("Empty Layer"), opacity, mode);
|
||||
|
||||
gimp_drawable_fill_by_type (GIMP_DRAWABLE (new_layer),
|
||||
gimp_get_user_context (gimage->gimp),
|
||||
gimp_drawable_fill_by_type (GIMP_DRAWABLE (new_layer), context,
|
||||
GIMP_TRANSPARENT_FILL);
|
||||
gimp_item_translate (GIMP_ITEM (new_layer), off_x, off_y, FALSE);
|
||||
|
||||
|
@ -730,6 +704,7 @@ layers_new_layer_query (GimpImage *gimage,
|
|||
|
||||
options->fill_type = fill_type;
|
||||
options->gimage = gimage;
|
||||
options->context = context;
|
||||
|
||||
options->query_box =
|
||||
gimp_viewable_dialog_new (GIMP_VIEWABLE (gimage),
|
||||
|
@ -753,16 +728,17 @@ layers_new_layer_query (GimpImage *gimage,
|
|||
(GWeakNotify) g_free,
|
||||
options);
|
||||
|
||||
/* The main vbox */
|
||||
vbox = gtk_vbox_new (FALSE, 12);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options->query_box)->vbox),
|
||||
vbox);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
table = gtk_table_new (3, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
||||
gtk_widget_show (table);
|
||||
|
||||
/* The name label and entry */
|
||||
options->name_entry = gtk_entry_new ();
|
||||
|
@ -832,8 +808,6 @@ layers_new_layer_query (GimpImage *gimage,
|
|||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (options->size_se), 1,
|
||||
gimage->height);
|
||||
|
||||
gtk_widget_show (table);
|
||||
|
||||
/* The radio frame */
|
||||
frame = gimp_enum_radio_frame_new_with_range (GIMP_TYPE_FILL_TYPE,
|
||||
GIMP_FOREGROUND_FILL,
|
||||
|
@ -845,14 +819,13 @@ layers_new_layer_query (GimpImage *gimage,
|
|||
&button);
|
||||
gimp_int_radio_group_set_active (GTK_RADIO_BUTTON (button),
|
||||
options->fill_type);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
gtk_widget_show (vbox);
|
||||
gtk_widget_show (options->query_box);
|
||||
}
|
||||
|
||||
|
||||
/**************************************/
|
||||
/* The edit layer attributes dialog */
|
||||
/**************************************/
|
||||
|
@ -864,6 +837,7 @@ struct _EditLayerOptions
|
|||
GtkWidget *query_box;
|
||||
GtkWidget *name_entry;
|
||||
GtkWidget *toggle;
|
||||
|
||||
GimpLayer *layer;
|
||||
GimpImage *gimage;
|
||||
};
|
||||
|
@ -875,28 +849,24 @@ edit_layer_query_response (GtkWidget *widget,
|
|||
{
|
||||
if (response_id == GTK_RESPONSE_OK)
|
||||
{
|
||||
GimpLayer *layer = options->layer;
|
||||
GimpLayer *layer = options->layer;
|
||||
const gchar *new_name;
|
||||
|
||||
if (options->gimage)
|
||||
new_name = gtk_entry_get_text (GTK_ENTRY (options->name_entry));
|
||||
|
||||
if (strcmp (new_name, gimp_object_get_name (GIMP_OBJECT (layer))))
|
||||
{
|
||||
const gchar *new_name;
|
||||
gimp_item_rename (GIMP_ITEM (layer), new_name);
|
||||
gimp_image_flush (options->gimage);
|
||||
}
|
||||
|
||||
new_name = gtk_entry_get_text (GTK_ENTRY (options->name_entry));
|
||||
|
||||
if (strcmp (new_name, gimp_object_get_name (GIMP_OBJECT (layer))))
|
||||
{
|
||||
gimp_item_rename (GIMP_ITEM (layer), new_name);
|
||||
gimp_image_flush (options->gimage);
|
||||
}
|
||||
|
||||
if (options->toggle &&
|
||||
gimp_drawable_is_text_layer (GIMP_DRAWABLE (layer)))
|
||||
{
|
||||
g_object_set (layer,
|
||||
"auto-rename",
|
||||
GTK_TOGGLE_BUTTON (options->toggle)->active,
|
||||
NULL);
|
||||
}
|
||||
if (options->toggle &&
|
||||
gimp_drawable_is_text_layer (GIMP_DRAWABLE (layer)))
|
||||
{
|
||||
g_object_set (layer,
|
||||
"auto-rename",
|
||||
GTK_TOGGLE_BUTTON (options->toggle)->active,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -910,7 +880,6 @@ edit_layer_query_activate (GtkWidget *widget,
|
|||
gtk_dialog_response (GTK_DIALOG (options->query_box), GTK_RESPONSE_OK);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
edit_layer_toggle_rename (GtkWidget *widget,
|
||||
EditLayerOptions *options)
|
||||
|
@ -933,13 +902,17 @@ edit_layer_toggle_rename (GtkWidget *widget,
|
|||
}
|
||||
|
||||
void
|
||||
layers_edit_layer_query (GimpLayer *layer,
|
||||
GtkWidget *parent)
|
||||
layers_edit_layer_query (GimpLayer *layer,
|
||||
GimpContext *context,
|
||||
GtkWidget *parent)
|
||||
{
|
||||
EditLayerOptions *options;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *table;
|
||||
|
||||
g_return_if_fail (GIMP_IS_LAYER (layer));
|
||||
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
||||
|
||||
options = g_new0 (EditLayerOptions, 1);
|
||||
|
||||
options->layer = layer;
|
||||
|
@ -967,13 +940,12 @@ layers_edit_layer_query (GimpLayer *layer,
|
|||
(GWeakNotify) g_free,
|
||||
options);
|
||||
|
||||
/* The main vbox */
|
||||
vbox = gtk_vbox_new (FALSE, 12);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options->query_box)->vbox),
|
||||
vbox);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
/* The name label and entry */
|
||||
table = gtk_table_new (1, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
||||
|
@ -1011,10 +983,10 @@ layers_edit_layer_query (GimpLayer *layer,
|
|||
options);
|
||||
}
|
||||
|
||||
gtk_widget_show (vbox);
|
||||
gtk_widget_show (options->query_box);
|
||||
}
|
||||
|
||||
|
||||
/*******************************/
|
||||
/* The add mask query dialog */
|
||||
/*******************************/
|
||||
|
@ -1216,6 +1188,7 @@ layers_scale_layer_query (GimpDisplay *gdisp,
|
|||
gtk_widget_show (options->dialog->shell);
|
||||
}
|
||||
|
||||
|
||||
/*****************************/
|
||||
/* The resize layer dialog */
|
||||
/*****************************/
|
||||
|
@ -1225,6 +1198,7 @@ typedef struct _ResizeLayerOptions ResizeLayerOptions;
|
|||
struct _ResizeLayerOptions
|
||||
{
|
||||
GimpLayer *layer;
|
||||
GimpContext *context;
|
||||
ResizeDialog *dialog;
|
||||
};
|
||||
|
||||
|
@ -1243,7 +1217,7 @@ resize_layer_query_ok_callback (GtkWidget *widget,
|
|||
gtk_widget_set_sensitive (options->dialog->shell, FALSE);
|
||||
|
||||
gimp_item_resize (GIMP_ITEM (layer),
|
||||
gimp_get_user_context (gimage->gimp),
|
||||
options->context,
|
||||
options->dialog->width,
|
||||
options->dialog->height,
|
||||
options->dialog->offset_x,
|
||||
|
@ -1260,15 +1234,17 @@ resize_layer_query_ok_callback (GtkWidget *widget,
|
|||
}
|
||||
|
||||
static void
|
||||
layers_resize_layer_query (GimpImage *gimage,
|
||||
GimpLayer *layer,
|
||||
GtkWidget *parent)
|
||||
layers_resize_layer_query (GimpImage *gimage,
|
||||
GimpLayer *layer,
|
||||
GimpContext *context,
|
||||
GtkWidget *parent)
|
||||
{
|
||||
ResizeLayerOptions *options;
|
||||
|
||||
options = g_new0 (ResizeLayerOptions, 1);
|
||||
|
||||
options->layer = layer;
|
||||
options->context = context;
|
||||
options->layer = layer;
|
||||
|
||||
options->dialog =
|
||||
resize_dialog_new (GIMP_VIEWABLE (layer), parent,
|
||||
|
|
|
@ -20,6 +20,13 @@
|
|||
#define __LAYERS_COMMANDS_H__
|
||||
|
||||
|
||||
void layers_text_tool_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void layers_edit_attributes_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void layers_new_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
|
||||
void layers_select_previous_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void layers_select_next_cmd_callback (GtkAction *action,
|
||||
|
@ -29,71 +36,62 @@ void layers_select_top_cmd_callback (GtkAction *action,
|
|||
void layers_select_bottom_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
|
||||
void layers_raise_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void layers_lower_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void layers_raise_to_top_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void layers_lower_to_bottom_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void layers_raise_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void layers_lower_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void layers_raise_to_top_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void layers_lower_to_bottom_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
|
||||
void layers_new_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void layers_duplicate_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void layers_anchor_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void layers_merge_down_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void layers_delete_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void layers_text_discard_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void layers_duplicate_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void layers_anchor_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void layers_merge_down_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void layers_delete_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void layers_text_discard_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
|
||||
void layers_resize_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void layers_resize_to_image_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void layers_scale_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void layers_crop_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void layers_resize_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void layers_resize_to_image_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void layers_scale_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void layers_crop_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
|
||||
void layers_mask_add_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void layers_mask_apply_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void layers_mask_delete_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void layers_mask_to_selection_cmd_callback (GtkAction *action,
|
||||
gint value,
|
||||
gpointer data);
|
||||
void layers_mask_add_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void layers_mask_apply_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void layers_mask_delete_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void layers_mask_to_selection_cmd_callback (GtkAction *action,
|
||||
gint value,
|
||||
gpointer data);
|
||||
|
||||
void layers_alpha_add_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void layers_alpha_to_selection_cmd_callback (GtkAction *action,
|
||||
gint value,
|
||||
gpointer data);
|
||||
void layers_alpha_add_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void layers_alpha_to_selection_cmd_callback (GtkAction *action,
|
||||
gint value,
|
||||
gpointer data);
|
||||
|
||||
void layers_merge_layers_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void layers_flatten_image_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
|
||||
void layers_text_tool_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void layers_edit_attributes_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
|
||||
void layers_text_tool (GimpLayer *layer,
|
||||
GtkWidget *parent);
|
||||
void layers_new_layer_query (GimpImage *gimage,
|
||||
GimpLayer *template,
|
||||
gboolean interactive,
|
||||
GtkWidget *parent);
|
||||
void layers_edit_layer_query (GimpLayer *layer,
|
||||
GtkWidget *parent);
|
||||
void layers_text_tool (GimpLayer *layer,
|
||||
GimpContext *context,
|
||||
GtkWidget *parent);
|
||||
void layers_new_layer_query (GimpImage *gimage,
|
||||
GimpContext *context,
|
||||
GimpLayer *template,
|
||||
gboolean interactive,
|
||||
GtkWidget *parent);
|
||||
void layers_edit_layer_query (GimpLayer *layer,
|
||||
GimpContext *context,
|
||||
GtkWidget *parent);
|
||||
|
||||
|
||||
#endif /* __LAYERS_COMMANDS_H__ */
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
#include "actions-types.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpchannel.h"
|
||||
#include "core/gimpchannel-select.h"
|
||||
#include "core/gimpimage.h"
|
||||
|
@ -77,7 +76,7 @@ static gboolean selection_shrink_edge_lock = FALSE;
|
|||
|
||||
void
|
||||
select_invert_cmd_callback (GtkAction *action,
|
||||
gpointer data)
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
return_if_no_image (gimage, data);
|
||||
|
@ -88,7 +87,7 @@ select_invert_cmd_callback (GtkAction *action,
|
|||
|
||||
void
|
||||
select_all_cmd_callback (GtkAction *action,
|
||||
gpointer data)
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
return_if_no_image (gimage, data);
|
||||
|
@ -99,7 +98,7 @@ select_all_cmd_callback (GtkAction *action,
|
|||
|
||||
void
|
||||
select_none_cmd_callback (GtkAction *action,
|
||||
gpointer data)
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
return_if_no_image (gimage, data);
|
||||
|
@ -130,21 +129,21 @@ select_from_vectors_cmd_callback (GtkAction *action,
|
|||
|
||||
void
|
||||
select_float_cmd_callback (GtkAction *action,
|
||||
gpointer data)
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
return_if_no_image (gimage, data);
|
||||
|
||||
gimp_selection_float (gimp_image_get_mask (gimage),
|
||||
gimp_image_active_drawable (gimage),
|
||||
gimp_get_user_context (gimage->gimp),
|
||||
action_data_get_context (data),
|
||||
TRUE, 0, 0);
|
||||
gimp_image_flush (gimage);
|
||||
}
|
||||
|
||||
void
|
||||
select_feather_cmd_callback (GtkAction *action,
|
||||
gpointer data)
|
||||
gpointer data)
|
||||
{
|
||||
GimpDisplay *gdisp;
|
||||
GtkWidget *qbox;
|
||||
|
@ -152,22 +151,22 @@ select_feather_cmd_callback (GtkAction *action,
|
|||
|
||||
qbox = gimp_query_size_box (_("Feather Selection"),
|
||||
gdisp->shell,
|
||||
gimp_standard_help_func,
|
||||
GIMP_HELP_SELECTION_FEATHER,
|
||||
_("Feather selection by"),
|
||||
selection_feather_radius, 0, 32767, 3,
|
||||
gdisp->gimage->unit,
|
||||
MIN (gdisp->gimage->xresolution,
|
||||
gdisp->gimage->yresolution),
|
||||
GIMP_DISPLAY_SHELL (gdisp->shell)->dot_for_dot,
|
||||
G_OBJECT (gdisp->gimage), "disconnect",
|
||||
gimp_image_mask_feather_callback, gdisp->gimage);
|
||||
gimp_standard_help_func,
|
||||
GIMP_HELP_SELECTION_FEATHER,
|
||||
_("Feather selection by"),
|
||||
selection_feather_radius, 0, 32767, 3,
|
||||
gdisp->gimage->unit,
|
||||
MIN (gdisp->gimage->xresolution,
|
||||
gdisp->gimage->yresolution),
|
||||
GIMP_DISPLAY_SHELL (gdisp->shell)->dot_for_dot,
|
||||
G_OBJECT (gdisp->gimage), "disconnect",
|
||||
gimp_image_mask_feather_callback, gdisp->gimage);
|
||||
gtk_widget_show (qbox);
|
||||
}
|
||||
|
||||
void
|
||||
select_sharpen_cmd_callback (GtkAction *action,
|
||||
gpointer data)
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
return_if_no_image (gimage, data);
|
||||
|
@ -178,7 +177,7 @@ select_sharpen_cmd_callback (GtkAction *action,
|
|||
|
||||
void
|
||||
select_shrink_cmd_callback (GtkAction *action,
|
||||
gpointer data)
|
||||
gpointer data)
|
||||
{
|
||||
GimpDisplay *gdisp;
|
||||
GtkWidget *shrink_dialog;
|
||||
|
@ -206,7 +205,7 @@ select_shrink_cmd_callback (GtkAction *action,
|
|||
|
||||
g_object_set_data (G_OBJECT (shrink_dialog), "edge_lock_toggle", edge_lock);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (edge_lock),
|
||||
! selection_shrink_edge_lock);
|
||||
! selection_shrink_edge_lock);
|
||||
gtk_widget_show (edge_lock);
|
||||
|
||||
gtk_widget_show (shrink_dialog);
|
||||
|
@ -214,7 +213,7 @@ select_shrink_cmd_callback (GtkAction *action,
|
|||
|
||||
void
|
||||
select_grow_cmd_callback (GtkAction *action,
|
||||
gpointer data)
|
||||
gpointer data)
|
||||
{
|
||||
GimpDisplay *gdisp;
|
||||
GtkWidget *qbox;
|
||||
|
@ -237,7 +236,7 @@ select_grow_cmd_callback (GtkAction *action,
|
|||
|
||||
void
|
||||
select_border_cmd_callback (GtkAction *action,
|
||||
gpointer data)
|
||||
gpointer data)
|
||||
{
|
||||
GimpDisplay *gdisp;
|
||||
GtkWidget *qbox;
|
||||
|
@ -260,7 +259,7 @@ select_border_cmd_callback (GtkAction *action,
|
|||
|
||||
void
|
||||
select_save_cmd_callback (GtkAction *action,
|
||||
gpointer data)
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GtkWidget *widget;
|
||||
|
@ -310,12 +309,10 @@ gimp_image_mask_feather_callback (GtkWidget *widget,
|
|||
GimpUnit unit,
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GimpImage *gimage = GIMP_IMAGE (data);
|
||||
gdouble radius_x;
|
||||
gdouble radius_y;
|
||||
|
||||
gimage = GIMP_IMAGE (data);
|
||||
|
||||
selection_feather_radius = size;
|
||||
|
||||
radius_x = radius_y = selection_feather_radius;
|
||||
|
@ -325,12 +322,12 @@ gimp_image_mask_feather_callback (GtkWidget *widget,
|
|||
gdouble factor;
|
||||
|
||||
factor = (MAX (gimage->xresolution, gimage->yresolution) /
|
||||
MIN (gimage->xresolution, gimage->yresolution));
|
||||
MIN (gimage->xresolution, gimage->yresolution));
|
||||
|
||||
if (gimage->xresolution == MIN (gimage->xresolution, gimage->yresolution))
|
||||
radius_y *= factor;
|
||||
radius_y *= factor;
|
||||
else
|
||||
radius_x *= factor;
|
||||
radius_x *= factor;
|
||||
}
|
||||
|
||||
gimp_channel_feather (gimp_image_get_mask (gimage), radius_x, radius_y, TRUE);
|
||||
|
@ -343,12 +340,10 @@ gimp_image_mask_border_callback (GtkWidget *widget,
|
|||
GimpUnit unit,
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GimpImage *gimage = GIMP_IMAGE (data);
|
||||
gdouble radius_x;
|
||||
gdouble radius_y;
|
||||
|
||||
gimage = GIMP_IMAGE (data);
|
||||
|
||||
selection_border_radius = ROUND (size);
|
||||
|
||||
radius_x = radius_y = selection_border_radius;
|
||||
|
@ -358,12 +353,12 @@ gimp_image_mask_border_callback (GtkWidget *widget,
|
|||
gdouble factor;
|
||||
|
||||
factor = (MAX (gimage->xresolution, gimage->yresolution) /
|
||||
MIN (gimage->xresolution, gimage->yresolution));
|
||||
MIN (gimage->xresolution, gimage->yresolution));
|
||||
|
||||
if (gimage->xresolution == MIN (gimage->xresolution, gimage->yresolution))
|
||||
radius_y *= factor;
|
||||
radius_y *= factor;
|
||||
else
|
||||
radius_x *= factor;
|
||||
radius_x *= factor;
|
||||
}
|
||||
|
||||
gimp_channel_border (gimp_image_get_mask (gimage), radius_x, radius_y, TRUE);
|
||||
|
@ -376,12 +371,10 @@ gimp_image_mask_grow_callback (GtkWidget *widget,
|
|||
GimpUnit unit,
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GimpImage *gimage = GIMP_IMAGE (data);
|
||||
gdouble radius_x;
|
||||
gdouble radius_y;
|
||||
|
||||
gimage = GIMP_IMAGE (data);
|
||||
|
||||
selection_grow_pixels = ROUND (size);
|
||||
|
||||
radius_x = radius_y = selection_grow_pixels;
|
||||
|
@ -391,12 +384,12 @@ gimp_image_mask_grow_callback (GtkWidget *widget,
|
|||
gdouble factor;
|
||||
|
||||
factor = (MAX (gimage->xresolution, gimage->yresolution) /
|
||||
MIN (gimage->xresolution, gimage->yresolution));
|
||||
MIN (gimage->xresolution, gimage->yresolution));
|
||||
|
||||
if (gimage->xresolution == MIN (gimage->xresolution, gimage->yresolution))
|
||||
radius_y *= factor;
|
||||
radius_y *= factor;
|
||||
else
|
||||
radius_x *= factor;
|
||||
radius_x *= factor;
|
||||
}
|
||||
|
||||
gimp_channel_grow (gimp_image_get_mask (gimage), radius_x, radius_y, TRUE);
|
||||
|
@ -409,31 +402,29 @@ gimp_image_mask_shrink_callback (GtkWidget *widget,
|
|||
GimpUnit unit,
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GimpImage *gimage = GIMP_IMAGE (data);
|
||||
gint radius_x;
|
||||
gint radius_y;
|
||||
|
||||
gimage = GIMP_IMAGE (data);
|
||||
|
||||
selection_shrink_pixels = ROUND (size);
|
||||
|
||||
radius_x = radius_y = selection_shrink_pixels;
|
||||
|
||||
selection_shrink_edge_lock =
|
||||
! GTK_TOGGLE_BUTTON (g_object_get_data (G_OBJECT (widget),
|
||||
"edge_lock_toggle"))->active;
|
||||
"edge_lock_toggle"))->active;
|
||||
|
||||
if (unit != GIMP_UNIT_PIXEL)
|
||||
{
|
||||
gdouble factor;
|
||||
|
||||
factor = (MAX (gimage->xresolution, gimage->yresolution) /
|
||||
MIN (gimage->xresolution, gimage->yresolution));
|
||||
MIN (gimage->xresolution, gimage->yresolution));
|
||||
|
||||
if (gimage->xresolution == MIN (gimage->xresolution, gimage->yresolution))
|
||||
radius_y *= factor;
|
||||
radius_y *= factor;
|
||||
else
|
||||
radius_x *= factor;
|
||||
radius_x *= factor;
|
||||
}
|
||||
|
||||
gimp_channel_shrink (gimp_image_get_mask (gimage), radius_x, radius_y,
|
||||
|
|
|
@ -72,6 +72,32 @@ static void vectors_export_query (GimpImage *gimage,
|
|||
|
||||
/* public functions */
|
||||
|
||||
void
|
||||
vectors_vectors_tool_cmd_callback (GtkAction *action,
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GimpVectors *vectors;
|
||||
GtkWidget *widget;
|
||||
return_if_no_vectors (gimage, vectors, data);
|
||||
return_if_no_widget (widget, data);
|
||||
|
||||
vectors_vectors_tool (vectors, action_data_get_context (data), widget);
|
||||
}
|
||||
|
||||
void
|
||||
vectors_edit_attributes_cmd_callback (GtkAction *action,
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GimpVectors *vectors;
|
||||
GtkWidget *widget;
|
||||
return_if_no_vectors (gimage, vectors, data);
|
||||
return_if_no_widget (widget, data);
|
||||
|
||||
vectors_edit_vectors_query (vectors, action_data_get_context (data), widget);
|
||||
}
|
||||
|
||||
void
|
||||
vectors_new_cmd_callback (GtkAction *action,
|
||||
gpointer data)
|
||||
|
@ -81,7 +107,8 @@ vectors_new_cmd_callback (GtkAction *action,
|
|||
return_if_no_image (gimage, data);
|
||||
return_if_no_widget (widget, data);
|
||||
|
||||
vectors_new_vectors_query (gimage, NULL, TRUE, widget);
|
||||
vectors_new_vectors_query (gimage, action_data_get_context (data),
|
||||
NULL, TRUE, widget);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -89,10 +116,10 @@ vectors_raise_to_top_cmd_callback (GtkAction *action,
|
|||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GimpVectors *active_vectors;
|
||||
return_if_no_vectors (gimage, active_vectors, data);
|
||||
GimpVectors *vectors;
|
||||
return_if_no_vectors (gimage, vectors, data);
|
||||
|
||||
gimp_image_raise_vectors_to_top (gimage, active_vectors);
|
||||
gimp_image_raise_vectors_to_top (gimage, vectors);
|
||||
gimp_image_flush (gimage);
|
||||
}
|
||||
|
||||
|
@ -101,10 +128,10 @@ vectors_raise_cmd_callback (GtkAction *action,
|
|||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GimpVectors *active_vectors;
|
||||
return_if_no_vectors (gimage, active_vectors, data);
|
||||
GimpVectors *vectors;
|
||||
return_if_no_vectors (gimage, vectors, data);
|
||||
|
||||
gimp_image_raise_vectors (gimage, active_vectors);
|
||||
gimp_image_raise_vectors (gimage, vectors);
|
||||
gimp_image_flush (gimage);
|
||||
}
|
||||
|
||||
|
@ -113,10 +140,10 @@ vectors_lower_cmd_callback (GtkAction *action,
|
|||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GimpVectors *active_vectors;
|
||||
return_if_no_vectors (gimage, active_vectors, data);
|
||||
GimpVectors *vectors;
|
||||
return_if_no_vectors (gimage, vectors, data);
|
||||
|
||||
gimp_image_lower_vectors (gimage, active_vectors);
|
||||
gimp_image_lower_vectors (gimage, vectors);
|
||||
gimp_image_flush (gimage);
|
||||
}
|
||||
|
||||
|
@ -125,10 +152,10 @@ vectors_lower_to_bottom_cmd_callback (GtkAction *action,
|
|||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GimpVectors *active_vectors;
|
||||
return_if_no_vectors (gimage, active_vectors, data);
|
||||
GimpVectors *vectors;
|
||||
return_if_no_vectors (gimage, vectors, data);
|
||||
|
||||
gimp_image_lower_vectors_to_bottom (gimage, active_vectors);
|
||||
gimp_image_lower_vectors_to_bottom (gimage, vectors);
|
||||
gimp_image_flush (gimage);
|
||||
}
|
||||
|
||||
|
@ -137,14 +164,13 @@ vectors_duplicate_cmd_callback (GtkAction *action,
|
|||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GimpVectors *active_vectors;
|
||||
GimpVectors *vectors;
|
||||
GimpVectors *new_vectors;
|
||||
return_if_no_vectors (gimage, active_vectors, data);
|
||||
return_if_no_vectors (gimage, vectors, data);
|
||||
|
||||
new_vectors =
|
||||
GIMP_VECTORS (gimp_item_duplicate (GIMP_ITEM (active_vectors),
|
||||
G_TYPE_FROM_INSTANCE (active_vectors),
|
||||
TRUE));
|
||||
new_vectors =GIMP_VECTORS (gimp_item_duplicate (GIMP_ITEM (vectors),
|
||||
G_TYPE_FROM_INSTANCE (vectors),
|
||||
TRUE));
|
||||
gimp_image_add_vectors (gimage, new_vectors, -1);
|
||||
gimp_image_flush (gimage);
|
||||
}
|
||||
|
@ -154,10 +180,10 @@ vectors_delete_cmd_callback (GtkAction *action,
|
|||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GimpVectors *active_vectors;
|
||||
return_if_no_vectors (gimage, active_vectors, data);
|
||||
GimpVectors *vectors;
|
||||
return_if_no_vectors (gimage, vectors, data);
|
||||
|
||||
gimp_image_remove_vectors (gimage, active_vectors);
|
||||
gimp_image_remove_vectors (gimage, vectors);
|
||||
gimp_image_flush (gimage);
|
||||
}
|
||||
|
||||
|
@ -166,8 +192,8 @@ vectors_merge_visible_cmd_callback (GtkAction *action,
|
|||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GimpVectors *active_vectors;
|
||||
return_if_no_vectors (gimage, active_vectors, data);
|
||||
GimpVectors *vectors;
|
||||
return_if_no_vectors (gimage, vectors, data);
|
||||
|
||||
gimp_image_merge_visible_vectors (gimage);
|
||||
gimp_image_flush (gimage);
|
||||
|
@ -180,14 +206,14 @@ vectors_to_selection_cmd_callback (GtkAction *action,
|
|||
{
|
||||
GimpChannelOps op;
|
||||
GimpImage *gimage;
|
||||
GimpVectors *active_vectors;
|
||||
return_if_no_vectors (gimage, active_vectors, data);
|
||||
GimpVectors *vectors;
|
||||
return_if_no_vectors (gimage, vectors, data);
|
||||
|
||||
op = (GimpChannelOps) value;
|
||||
|
||||
gimp_channel_select_vectors (gimp_image_get_mask (gimage),
|
||||
_("Path to Selection"),
|
||||
active_vectors,
|
||||
vectors,
|
||||
op, TRUE, FALSE, 0, 0);
|
||||
gimp_image_flush (gimage);
|
||||
}
|
||||
|
@ -216,7 +242,7 @@ vectors_selection_to_vectors_cmd_callback (GtkAction *action,
|
|||
return;
|
||||
}
|
||||
|
||||
gdisp = gimp_context_get_display (gimp_get_user_context (gimage->gimp));
|
||||
gdisp = gimp_context_get_display (action_data_get_context (data));
|
||||
|
||||
/* plug-in arguments as if called by <Image>/Filters/... */
|
||||
args = g_new (Argument, 3);
|
||||
|
@ -228,7 +254,7 @@ vectors_selection_to_vectors_cmd_callback (GtkAction *action,
|
|||
args[2].arg_type = GIMP_PDB_DRAWABLE;
|
||||
args[2].value.pdb_int = -1; /* unused */
|
||||
|
||||
plug_in_run (gimage->gimp, gimp_get_user_context (gimage->gimp),
|
||||
plug_in_run (gimage->gimp, action_data_get_context (data),
|
||||
proc_rec, args, 3, FALSE, TRUE,
|
||||
gdisp ? gdisp->ID : 0);
|
||||
|
||||
|
@ -267,8 +293,8 @@ vectors_copy_cmd_callback (GtkAction *action,
|
|||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GimpVectors *active_vectors;
|
||||
return_if_no_vectors (gimage, active_vectors, data);
|
||||
GimpVectors *vectors;
|
||||
return_if_no_vectors (gimage, vectors, data);
|
||||
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME: need vectors clipboard
|
||||
|
@ -304,45 +330,24 @@ vectors_export_cmd_callback (GtkAction *action,
|
|||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GimpVectors *active_vectors;
|
||||
GimpVectors *vectors;
|
||||
GtkWidget *widget;
|
||||
return_if_no_vectors (gimage, active_vectors, data);
|
||||
return_if_no_vectors (gimage, vectors, data);
|
||||
return_if_no_widget (widget, data);
|
||||
|
||||
vectors_export_query (gimage, active_vectors, widget);
|
||||
vectors_export_query (gimage, vectors, widget);
|
||||
}
|
||||
|
||||
void
|
||||
vectors_vectors_tool_cmd_callback (GtkAction *action,
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GimpVectors *active_vectors;
|
||||
return_if_no_vectors (gimage, active_vectors, data);
|
||||
|
||||
vectors_vectors_tool (active_vectors);
|
||||
}
|
||||
|
||||
void
|
||||
vectors_edit_attributes_cmd_callback (GtkAction *action,
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GimpVectors *active_vectors;
|
||||
GtkWidget *widget;
|
||||
return_if_no_vectors (gimage, active_vectors, data);
|
||||
return_if_no_widget (widget, data);
|
||||
|
||||
vectors_edit_vectors_query (active_vectors, widget);
|
||||
}
|
||||
|
||||
void
|
||||
vectors_vectors_tool (GimpVectors *vectors)
|
||||
vectors_vectors_tool (GimpVectors *vectors,
|
||||
GimpContext *context,
|
||||
GtkWidget *parent)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GimpTool *active_tool;
|
||||
|
||||
g_return_if_fail (GIMP_IS_VECTORS (vectors));
|
||||
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
||||
|
||||
gimage = gimp_item_get_image (GIMP_ITEM (vectors));
|
||||
|
||||
|
@ -361,9 +366,7 @@ vectors_vectors_tool (GimpVectors *vectors)
|
|||
|
||||
if (GIMP_IS_TOOL_INFO (tool_info))
|
||||
{
|
||||
gimp_context_set_tool (gimp_get_user_context (gimage->gimp),
|
||||
tool_info);
|
||||
|
||||
gimp_context_set_tool (context, tool_info);
|
||||
active_tool = tool_manager_get_active (gimage->gimp);
|
||||
}
|
||||
}
|
||||
|
@ -380,10 +383,10 @@ typedef struct _NewVectorsOptions NewVectorsOptions;
|
|||
|
||||
struct _NewVectorsOptions
|
||||
{
|
||||
GtkWidget *query_box;
|
||||
GtkWidget *name_entry;
|
||||
GtkWidget *query_box;
|
||||
GtkWidget *name_entry;
|
||||
|
||||
GimpImage *gimage;
|
||||
GimpImage *gimage;
|
||||
};
|
||||
|
||||
static gchar *vectors_name = NULL;
|
||||
|
@ -397,21 +400,17 @@ new_vectors_query_response (GtkWidget *widget,
|
|||
if (response_id == GTK_RESPONSE_OK)
|
||||
{
|
||||
GimpVectors *new_vectors;
|
||||
GimpImage *gimage;
|
||||
|
||||
if (vectors_name)
|
||||
g_free (vectors_name);
|
||||
vectors_name =
|
||||
g_strdup (gtk_entry_get_text (GTK_ENTRY (options->name_entry)));
|
||||
|
||||
if ((gimage = options->gimage))
|
||||
{
|
||||
new_vectors = gimp_vectors_new (gimage, vectors_name);
|
||||
new_vectors = gimp_vectors_new (options->gimage, vectors_name);
|
||||
|
||||
gimp_image_add_vectors (gimage, new_vectors, -1);
|
||||
gimp_image_add_vectors (options->gimage, new_vectors, -1);
|
||||
|
||||
gimp_image_flush (gimage);
|
||||
}
|
||||
gimp_image_flush (options->gimage);
|
||||
}
|
||||
|
||||
gtk_widget_destroy (options->query_box);
|
||||
|
@ -419,6 +418,7 @@ new_vectors_query_response (GtkWidget *widget,
|
|||
|
||||
void
|
||||
vectors_new_vectors_query (GimpImage *gimage,
|
||||
GimpContext *context,
|
||||
GimpVectors *template,
|
||||
gboolean interactive,
|
||||
GtkWidget *parent)
|
||||
|
@ -430,6 +430,7 @@ vectors_new_vectors_query (GimpImage *gimage,
|
|||
GtkWidget *label;
|
||||
|
||||
g_return_if_fail (GIMP_IS_IMAGE (gimage));
|
||||
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
||||
g_return_if_fail (! template || GIMP_IS_VECTORS (template));
|
||||
|
||||
if (template || ! interactive)
|
||||
|
@ -470,21 +471,21 @@ vectors_new_vectors_query (GimpImage *gimage,
|
|||
(GWeakNotify) g_free,
|
||||
options);
|
||||
|
||||
/* The main hbox */
|
||||
hbox = gtk_hbox_new (FALSE, 6);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 12);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options->query_box)->vbox),
|
||||
hbox);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
/* The vbox */
|
||||
vbox = gtk_vbox_new (FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
/* The table */
|
||||
table = gtk_table_new (2, 3, FALSE);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
||||
gtk_widget_show (table);
|
||||
|
||||
/* The name entry hbox, label and entry */
|
||||
label = gtk_label_new (_("Path name:"));
|
||||
|
@ -501,9 +502,6 @@ vectors_new_vectors_query (GimpImage *gimage,
|
|||
(vectors_name ? vectors_name : _("New Path")));
|
||||
gtk_widget_show (options->name_entry);
|
||||
|
||||
gtk_widget_show (table);
|
||||
gtk_widget_show (vbox);
|
||||
gtk_widget_show (hbox);
|
||||
gtk_widget_show (options->query_box);
|
||||
}
|
||||
|
||||
|
@ -530,18 +528,14 @@ edit_vectors_query_response (GtkWidget *widget,
|
|||
if (response_id == GTK_RESPONSE_OK)
|
||||
{
|
||||
GimpVectors *vectors = options->vectors;
|
||||
const gchar *new_name;
|
||||
|
||||
if (options->gimage)
|
||||
new_name = gtk_entry_get_text (GTK_ENTRY (options->name_entry));
|
||||
|
||||
if (strcmp (new_name, gimp_object_get_name (GIMP_OBJECT (vectors))))
|
||||
{
|
||||
const gchar *new_name;
|
||||
|
||||
new_name = gtk_entry_get_text (GTK_ENTRY (options->name_entry));
|
||||
|
||||
if (strcmp (new_name, gimp_object_get_name (GIMP_OBJECT (vectors))))
|
||||
{
|
||||
gimp_item_rename (GIMP_ITEM (vectors), new_name);
|
||||
gimp_image_flush (options->gimage);
|
||||
}
|
||||
gimp_item_rename (GIMP_ITEM (vectors), new_name);
|
||||
gimp_image_flush (options->gimage);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -550,6 +544,7 @@ edit_vectors_query_response (GtkWidget *widget,
|
|||
|
||||
void
|
||||
vectors_edit_vectors_query (GimpVectors *vectors,
|
||||
GimpContext *context,
|
||||
GtkWidget *parent)
|
||||
{
|
||||
EditVectorsOptions *options;
|
||||
|
@ -559,6 +554,7 @@ vectors_edit_vectors_query (GimpVectors *vectors,
|
|||
GtkWidget *label;
|
||||
|
||||
g_return_if_fail (GIMP_IS_VECTORS (vectors));
|
||||
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
||||
|
||||
options = g_new0 (EditVectorsOptions, 1);
|
||||
|
||||
|
@ -588,21 +584,21 @@ vectors_edit_vectors_query (GimpVectors *vectors,
|
|||
(GWeakNotify) g_free,
|
||||
options);
|
||||
|
||||
/* The main hbox */
|
||||
hbox = gtk_hbox_new (FALSE, 6);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 12);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options->query_box)->vbox),
|
||||
hbox);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
/* The vbox */
|
||||
vbox = gtk_vbox_new (FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
/* The table */
|
||||
table = gtk_table_new (2, 3, FALSE);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
||||
gtk_widget_show (table);
|
||||
|
||||
/* The name entry */
|
||||
label = gtk_label_new (_("Path name:"));
|
||||
|
@ -619,9 +615,6 @@ vectors_edit_vectors_query (GimpVectors *vectors,
|
|||
gimp_object_get_name (GIMP_OBJECT (vectors)));
|
||||
gtk_widget_show (options->name_entry);
|
||||
|
||||
gtk_widget_show (table);
|
||||
gtk_widget_show (vbox);
|
||||
gtk_widget_show (hbox);
|
||||
gtk_widget_show (options->query_box);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,8 +20,13 @@
|
|||
#define __VECTORS_COMMANDS_H__
|
||||
|
||||
|
||||
void vectors_vectors_tool_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void vectors_edit_attributes_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void vectors_new_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
|
||||
void vectors_raise_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void vectors_raise_to_top_cmd_callback (GtkAction *action,
|
||||
|
@ -30,6 +35,7 @@ void vectors_lower_cmd_callback (GtkAction *action,
|
|||
gpointer data);
|
||||
void vectors_lower_to_bottom_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
|
||||
void vectors_duplicate_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void vectors_delete_cmd_callback (GtkAction *action,
|
||||
|
@ -44,6 +50,7 @@ void vectors_selection_to_vectors_cmd_callback (GtkAction *action,
|
|||
gpointer data);
|
||||
void vectors_stroke_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
|
||||
void vectors_copy_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void vectors_paste_cmd_callback (GtkAction *action,
|
||||
|
@ -52,17 +59,17 @@ void vectors_import_cmd_callback (GtkAction *action,
|
|||
gpointer data);
|
||||
void vectors_export_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void vectors_vectors_tool_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void vectors_edit_attributes_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
|
||||
void vectors_vectors_tool (GimpVectors *vectors);
|
||||
void vectors_vectors_tool (GimpVectors *vectors,
|
||||
GimpContext *context,
|
||||
GtkWidget *parent);
|
||||
void vectors_new_vectors_query (GimpImage *gimage,
|
||||
GimpContext *context,
|
||||
GimpVectors *template,
|
||||
gboolean interactive,
|
||||
GtkWidget *parent);
|
||||
void vectors_edit_vectors_query (GimpVectors *vectors,
|
||||
GimpContext *context,
|
||||
GtkWidget *parent);
|
||||
|
||||
|
||||
|
|
|
@ -217,7 +217,8 @@ gimp_drawable_tree_view_new_dropped (GimpItemTreeView *view,
|
|||
gimp_image_undo_group_start (view->gimage, GIMP_UNDO_GROUP_EDIT_PASTE,
|
||||
_("New Layer"));
|
||||
|
||||
view->new_item_func (view->gimage, NULL, FALSE, GTK_WIDGET (view));
|
||||
view->new_item_func (view->gimage, view->context,
|
||||
NULL, FALSE, GTK_WIDGET (view));
|
||||
|
||||
drawable = gimp_image_active_drawable (view->gimage);
|
||||
|
||||
|
|
|
@ -876,7 +876,8 @@ gimp_item_tree_view_activate_item (GimpContainerView *view,
|
|||
if (parent_view_iface->activate_item)
|
||||
parent_view_iface->activate_item (view, item, insert_data);
|
||||
|
||||
item_view->activate_item_func (GIMP_ITEM (item), GTK_WIDGET (view));
|
||||
item_view->activate_item_func (GIMP_ITEM (item), item_view->context,
|
||||
GTK_WIDGET (view));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -985,7 +986,7 @@ gimp_item_tree_view_edit_clicked (GtkWidget *widget,
|
|||
item = GIMP_ITEM_TREE_VIEW_GET_CLASS (view)->get_active_item (view->gimage);
|
||||
|
||||
if (item)
|
||||
view->edit_item_func (item, GTK_WIDGET (view));
|
||||
view->edit_item_func (item, view->context, GTK_WIDGET (view));
|
||||
}
|
||||
|
||||
|
||||
|
@ -995,7 +996,8 @@ static void
|
|||
gimp_item_tree_view_new_clicked (GtkWidget *widget,
|
||||
GimpItemTreeView *view)
|
||||
{
|
||||
view->new_item_func (view->gimage, NULL, FALSE, GTK_WIDGET (view));
|
||||
view->new_item_func (view->gimage, view->context,
|
||||
NULL, FALSE, GTK_WIDGET (view));
|
||||
gimp_image_flush (view->gimage);
|
||||
}
|
||||
|
||||
|
@ -1004,7 +1006,8 @@ gimp_item_tree_view_new_extended_clicked (GtkWidget *widget,
|
|||
guint state,
|
||||
GimpItemTreeView *view)
|
||||
{
|
||||
view->new_item_func (view->gimage, NULL, TRUE, GTK_WIDGET (view));
|
||||
view->new_item_func (view->gimage, view->context,
|
||||
NULL, TRUE, GTK_WIDGET (view));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1019,8 +1022,8 @@ gimp_item_tree_view_new_dropped (GtkWidget *widget,
|
|||
|
||||
if (viewable && gimp_container_have (container, GIMP_OBJECT (viewable)))
|
||||
{
|
||||
view->new_item_func (view->gimage, GIMP_ITEM (viewable), FALSE,
|
||||
GTK_WIDGET (view));
|
||||
view->new_item_func (view->gimage, view->context,
|
||||
GIMP_ITEM (viewable), FALSE, GTK_WIDGET (view));
|
||||
|
||||
gimp_image_flush (view->gimage);
|
||||
}
|
||||
|
|
|
@ -42,12 +42,15 @@ typedef void (* GimpRemoveItemFunc) (GimpImage *gimage,
|
|||
GimpItem *item);
|
||||
|
||||
typedef void (* GimpEditItemFunc) (GimpItem *item,
|
||||
GimpContext *context,
|
||||
GtkWidget *parent);
|
||||
typedef void (* GimpNewItemFunc) (GimpImage *gimage,
|
||||
GimpContext *context,
|
||||
GimpItem *template,
|
||||
gboolean interactive,
|
||||
GtkWidget *parent);
|
||||
typedef void (* GimpActivateItemFunc) (GimpItem *item,
|
||||
GimpContext *context,
|
||||
GtkWidget *parent);
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue