43
44
#include "gimp-intl.h"
47
/* local function prototypes */
49
static void desaturate_response (GtkWidget *widget,
51
DesaturateDialog *dialog);
54
/* private variables */
56
static GimpDesaturateMode desaturate_mode = GIMP_DESATURATE_LIGHTNESS;
46
59
/* public functions */
49
62
drawable_desaturate_cmd_callback (GtkAction *action,
53
GimpDrawable *drawable;
54
return_if_no_drawable (gimage, drawable, data);
65
DesaturateDialog *dialog;
67
GimpDrawable *drawable;
69
return_if_no_drawable (image, drawable, data);
70
return_if_no_widget (widget, data);
56
72
if (! gimp_drawable_is_rgb (drawable))
58
g_message (_("Desaturate operates only on RGB color layers."));
74
gimp_message (image->gimp, G_OBJECT (widget), GIMP_MESSAGE_WARNING,
75
_("Desaturate operates only on RGB color layers."));
62
gimp_drawable_desaturate (drawable);
63
gimp_image_flush (gimage);
79
dialog = desaturate_dialog_new (drawable,
80
action_data_get_context (data),
81
widget, desaturate_mode);
83
g_signal_connect (dialog->dialog, "response",
84
G_CALLBACK (desaturate_response),
87
gtk_widget_show (dialog->dialog);
67
91
drawable_equalize_cmd_callback (GtkAction *action,
71
95
GimpDrawable *drawable;
72
return_if_no_drawable (gimage, drawable, data);
97
return_if_no_drawable (image, drawable, data);
98
return_if_no_widget (widget, data);
74
100
if (gimp_drawable_is_indexed (drawable))
76
g_message (_("Equalize does not operate on indexed layers."));
102
gimp_message (image->gimp, G_OBJECT (widget), GIMP_MESSAGE_WARNING,
103
_("Equalize does not operate on indexed layers."));
80
107
gimp_drawable_equalize (drawable, TRUE);
81
gimp_image_flush (gimage);
108
gimp_image_flush (image);
85
112
drawable_invert_cmd_callback (GtkAction *action,
89
116
GimpDrawable *drawable;
90
return_if_no_drawable (gimage, drawable, data);
118
return_if_no_drawable (image, drawable, data);
119
return_if_no_widget (widget, data);
92
121
if (gimp_drawable_is_indexed (drawable))
94
g_message (_("Invert does not operate on indexed layers."));
123
gimp_message (image->gimp, G_OBJECT (widget), GIMP_MESSAGE_WARNING,
124
_("Invert does not operate on indexed layers."));
98
128
gimp_drawable_invert (drawable);
99
gimp_image_flush (gimage);
129
gimp_image_flush (image);
103
133
drawable_levels_stretch_cmd_callback (GtkAction *action,
107
137
GimpDrawable *drawable;
108
138
GimpContext *context;
109
return_if_no_drawable (gimage, drawable, data);
140
return_if_no_drawable (image, drawable, data);
110
141
return_if_no_context (context, data);
142
return_if_no_widget (widget, data);
112
144
if (! gimp_drawable_is_rgb (drawable))
114
g_message (_("White Balance operates only on RGB color layers."));
146
gimp_message (image->gimp, G_OBJECT (widget), GIMP_MESSAGE_WARNING,
147
_("White Balance operates only on RGB color layers."));
118
151
gimp_drawable_levels_stretch (drawable, context);
119
gimp_image_flush (gimage);
152
gimp_image_flush (image);
123
156
drawable_offset_cmd_callback (GtkAction *action,
127
160
GimpDrawable *drawable;
128
161
GtkWidget *widget;
129
162
GtkWidget *dialog;
130
return_if_no_drawable (gimage, drawable, data);
163
return_if_no_drawable (image, drawable, data);
131
164
return_if_no_widget (widget, data);
133
dialog = offset_dialog_new (drawable, widget);
166
dialog = offset_dialog_new (drawable, action_data_get_context (data),
134
168
gtk_widget_show (dialog);
283
317
gimp_item_linked_rotate (item, context, (GimpRotationType) value,
284
318
center_x, center_y, FALSE);
285
gimp_image_undo_group_end (gimage);
288
gimp_image_flush (gimage);
319
gimp_image_undo_group_end (image);
322
gimp_image_flush (image);
325
/* private functions */
328
desaturate_response (GtkWidget *widget,
330
DesaturateDialog *dialog)
332
if (response_id == GTK_RESPONSE_OK)
334
GimpDrawable *drawable = dialog->drawable;
335
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
337
/* remember for next invocation of the dialog */
338
desaturate_mode = dialog->mode;
340
gimp_drawable_desaturate (drawable, desaturate_mode);
342
gimp_image_flush (image);
345
gtk_widget_destroy (dialog->dialog);