1
/* GIMP - The GNU Image Manipulation Program
2
* Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
/* NOTE: This file is auto-generated by pdbgen.pl. */
24
#include <glib-object.h>
26
#include "pdb-types.h"
28
#include "gimpprocedure.h"
29
#include "core/gimpparamspecs.h"
31
#include "core/gimp.h"
32
#include "core/gimpcontainer.h"
33
#include "core/gimpimage.h"
35
#include "internal_procs.h"
39
display_is_valid_invoker (GimpProcedure *procedure,
42
GimpProgress *progress,
43
const GValueArray *args)
45
GValueArray *return_vals;
47
gboolean valid = FALSE;
49
display = gimp_value_get_display (&args->values[0], gimp);
51
valid = (display != NULL);
53
return_vals = gimp_procedure_get_return_values (procedure, TRUE);
54
g_value_set_boolean (&return_vals->values[1], valid);
60
display_new_invoker (GimpProcedure *procedure,
63
GimpProgress *progress,
64
const GValueArray *args)
66
gboolean success = TRUE;
67
GValueArray *return_vals;
69
GimpObject *display = NULL;
71
image = gimp_value_get_image (&args->values[0], gimp);
75
gimp_image_flush (image);
77
display = gimp_create_display (gimp, image, GIMP_UNIT_PIXEL, 1.0);
81
/* the first display takes ownership of the image */
82
if (image->disp_count == 1)
83
g_object_unref (image);
89
return_vals = gimp_procedure_get_return_values (procedure, success);
92
gimp_value_set_display (&return_vals->values[1], display);
98
display_delete_invoker (GimpProcedure *procedure,
100
GimpContext *context,
101
GimpProgress *progress,
102
const GValueArray *args)
104
gboolean success = TRUE;
107
display = gimp_value_get_display (&args->values[0], gimp);
111
gimp_delete_display (gimp, display);
114
return gimp_procedure_get_return_values (procedure, success);
118
display_get_window_handle_invoker (GimpProcedure *procedure,
120
GimpContext *context,
121
GimpProgress *progress,
122
const GValueArray *args)
124
gboolean success = TRUE;
125
GValueArray *return_vals;
129
display = gimp_value_get_display (&args->values[0], gimp);
133
window = (gint32) gimp_get_display_window (gimp, display);
136
return_vals = gimp_procedure_get_return_values (procedure, success);
139
g_value_set_int (&return_vals->values[1], window);
145
displays_flush_invoker (GimpProcedure *procedure,
147
GimpContext *context,
148
GimpProgress *progress,
149
const GValueArray *args)
151
gimp_container_foreach (gimp->images, (GFunc) gimp_image_flush, NULL);
152
return gimp_procedure_get_return_values (procedure, TRUE);
156
displays_reconnect_invoker (GimpProcedure *procedure,
158
GimpContext *context,
159
GimpProgress *progress,
160
const GValueArray *args)
162
gboolean success = TRUE;
163
GimpImage *old_image;
164
GimpImage *new_image;
166
old_image = gimp_value_get_image (&args->values[0], gimp);
167
new_image = gimp_value_get_image (&args->values[1], gimp);
171
success = (old_image != new_image &&
172
old_image->disp_count > 0 &&
173
new_image->disp_count == 0);
177
gimp_reconnect_displays (gimp, old_image, new_image);
179
/* take ownership of the image */
180
if (new_image->disp_count > 0)
181
g_object_unref (new_image);
185
return gimp_procedure_get_return_values (procedure, success);
189
register_display_procs (GimpPDB *pdb)
191
GimpProcedure *procedure;
194
* gimp-display-is-valid
196
procedure = gimp_procedure_new (display_is_valid_invoker);
197
gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-display-is-valid");
198
gimp_procedure_set_static_strings (procedure,
199
"gimp-display-is-valid",
200
"Returns TRUE if the display is valid.",
201
"This procedure checks if the given display ID is valid and refers to an existing display.",
202
"Sven Neumann <sven@gimp.org>",
206
gimp_procedure_add_argument (procedure,
207
gimp_param_spec_display_id ("display",
209
"The display to check",
211
GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
212
gimp_procedure_add_return_value (procedure,
213
g_param_spec_boolean ("valid",
215
"Whether the display ID is valid",
217
GIMP_PARAM_READWRITE));
218
gimp_pdb_register_procedure (pdb, procedure);
219
g_object_unref (procedure);
224
procedure = gimp_procedure_new (display_new_invoker);
225
gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-display-new");
226
gimp_procedure_set_static_strings (procedure,
228
"Create a new display for the specified image.",
229
"Creates a new display for the specified image. If the image already has a display, another is added. Multiple displays are handled transparently by GIMP. The newly created display is returned and can be subsequently destroyed with a call to 'gimp-display-delete'. This procedure only makes sense for use with the GIMP UI.",
230
"Spencer Kimball & Peter Mattis",
231
"Spencer Kimball & Peter Mattis",
234
gimp_procedure_add_argument (procedure,
235
gimp_param_spec_image_id ("image",
239
GIMP_PARAM_READWRITE));
240
gimp_procedure_add_return_value (procedure,
241
gimp_param_spec_display_id ("display",
245
GIMP_PARAM_READWRITE));
246
gimp_pdb_register_procedure (pdb, procedure);
247
g_object_unref (procedure);
250
* gimp-display-delete
252
procedure = gimp_procedure_new (display_delete_invoker);
253
gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-display-delete");
254
gimp_procedure_set_static_strings (procedure,
255
"gimp-display-delete",
256
"Delete the specified display.",
257
"This procedure removes the specified display. If this is the last remaining display for the underlying image, then the image is deleted also. Note that the display is closed no matter if the image is dirty or not. Better save the image before calling this procedure.",
258
"Spencer Kimball & Peter Mattis",
259
"Spencer Kimball & Peter Mattis",
262
gimp_procedure_add_argument (procedure,
263
gimp_param_spec_display_id ("display",
265
"The display to delete",
267
GIMP_PARAM_READWRITE));
268
gimp_pdb_register_procedure (pdb, procedure);
269
g_object_unref (procedure);
272
* gimp-display-get-window-handle
274
procedure = gimp_procedure_new (display_get_window_handle_invoker);
275
gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-display-get-window-handle");
276
gimp_procedure_set_static_strings (procedure,
277
"gimp-display-get-window-handle",
278
"Get a handle to the native window for an image display.",
279
"This procedure returns a handle to the native window for a given image display. For example in the X backend of GDK, a native window handle is an Xlib XID. A value of 0 is returned for an invalid display or if this function is unimplemented for the windowing system that is being used.",
280
"Sven Neumann <sven@gimp.org>",
284
gimp_procedure_add_argument (procedure,
285
gimp_param_spec_display_id ("display",
287
"The display to get the window handle from",
289
GIMP_PARAM_READWRITE));
290
gimp_procedure_add_return_value (procedure,
291
gimp_param_spec_int32 ("window",
293
"The native window handle or 0",
294
G_MININT32, G_MAXINT32, 0,
295
GIMP_PARAM_READWRITE));
296
gimp_pdb_register_procedure (pdb, procedure);
297
g_object_unref (procedure);
300
* gimp-displays-flush
302
procedure = gimp_procedure_new (displays_flush_invoker);
303
gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-displays-flush");
304
gimp_procedure_set_static_strings (procedure,
305
"gimp-displays-flush",
306
"Flush all internal changes to the user interface",
307
"This procedure takes no arguments and returns nothing except a success status. Its purpose is to flush all pending updates of image manipulations to the user interface. It should be called whenever appropriate.",
308
"Spencer Kimball & Peter Mattis",
309
"Spencer Kimball & Peter Mattis",
312
gimp_pdb_register_procedure (pdb, procedure);
313
g_object_unref (procedure);
316
* gimp-displays-reconnect
318
procedure = gimp_procedure_new (displays_reconnect_invoker);
319
gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-displays-reconnect");
320
gimp_procedure_set_static_strings (procedure,
321
"gimp-displays-reconnect",
322
"Reconnect displays from one image to another image.",
323
"This procedure connects all displays of the old_image to the new_image. If the old_image has no display or new_image already has a display the reconnect is not performed and the procedure returns without success. You should rarely need to use this function.",
324
"Spencer Kimball & Peter Mattis",
325
"Spencer Kimball & Peter Mattis",
328
gimp_procedure_add_argument (procedure,
329
gimp_param_spec_image_id ("old-image",
331
"The old image (must have at least one display)",
333
GIMP_PARAM_READWRITE));
334
gimp_procedure_add_argument (procedure,
335
gimp_param_spec_image_id ("new-image",
337
"The new image (must not have a display)",
339
GIMP_PARAM_READWRITE));
340
gimp_pdb_register_procedure (pdb, procedure);
341
g_object_unref (procedure);