~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to app/pdb/brush_select_cmds.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-05-02 16:33:03 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070502163303-bvzhjzbpw8qglc4y
Tags: 2.3.16-1ubuntu1
* Resynchronized with Debian, remaining Ubuntu changes:
  - debian/rules: i18n magic.
* debian/control.in:
  - Maintainer: Ubuntu Core Developers <ubuntu-devel@lists.ubuntu.com>
* debian/patches/02_help-message.patch,
  debian/patches/03_gimp.desktop.in.in.patch,
  debian/patches/10_dont_show_wizard.patch: updated.
* debian/patches/04_composite-signedness.patch,
  debian/patches/05_add-letter-spacing.patch: dropped, used upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* The GIMP -- an image manipulation program
 
1
/* GIMP - The GNU Image Manipulation Program
2
2
 * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
3
3
 *
4
4
 * This program is free software; you can redistribute it and/or modify
16
16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
17
 */
18
18
 
19
 
/* NOTE: This file is autogenerated by pdbgen.pl. */
 
19
/* NOTE: This file is auto-generated by pdbgen.pl. */
20
20
 
21
21
#include "config.h"
22
22
 
24
24
#include <glib-object.h>
25
25
 
26
26
#include "pdb-types.h"
27
 
#include "procedural_db.h"
 
27
#include "gimppdb.h"
 
28
#include "gimpprocedure.h"
 
29
#include "core/gimpparamspecs.h"
28
30
 
29
31
#include "core/gimp.h"
30
32
#include "core/gimpdatafactory.h"
31
33
 
32
 
static ProcRecord brushes_popup_proc;
33
 
static ProcRecord brushes_close_popup_proc;
34
 
static ProcRecord brushes_set_popup_proc;
35
 
 
36
 
void
37
 
register_brush_select_procs (Gimp *gimp)
38
 
{
39
 
  procedural_db_register (gimp, &brushes_popup_proc);
40
 
  procedural_db_register (gimp, &brushes_close_popup_proc);
41
 
  procedural_db_register (gimp, &brushes_set_popup_proc);
42
 
}
43
 
 
44
 
static Argument *
45
 
brushes_popup_invoker (Gimp         *gimp,
46
 
                       GimpContext  *context,
47
 
                       GimpProgress *progress,
48
 
                       Argument     *args)
 
34
#include "internal_procs.h"
 
35
 
 
36
 
 
37
static GValueArray *
 
38
brushes_popup_invoker (GimpProcedure     *procedure,
 
39
                       Gimp              *gimp,
 
40
                       GimpContext       *context,
 
41
                       GimpProgress      *progress,
 
42
                       const GValueArray *args)
49
43
{
50
44
  gboolean success = TRUE;
51
 
  gchar *brush_callback;
52
 
  gchar *popup_title;
53
 
  gchar *initial_brush;
 
45
  const gchar *brush_callback;
 
46
  const gchar *popup_title;
 
47
  const gchar *initial_brush;
54
48
  gdouble opacity;
55
49
  gint32 spacing;
56
50
  gint32 paint_mode;
57
51
 
58
 
  brush_callback = (gchar *) args[0].value.pdb_pointer;
59
 
  if (brush_callback == NULL || !g_utf8_validate (brush_callback, -1, NULL))
60
 
    success = FALSE;
61
 
 
62
 
  popup_title = (gchar *) args[1].value.pdb_pointer;
63
 
  if (popup_title == NULL || !g_utf8_validate (popup_title, -1, NULL))
64
 
    success = FALSE;
65
 
 
66
 
  initial_brush = (gchar *) args[2].value.pdb_pointer;
67
 
  if (initial_brush && !g_utf8_validate (initial_brush, -1, NULL))
68
 
    success = FALSE;
69
 
 
70
 
  opacity = args[3].value.pdb_float;
71
 
  if (opacity < 0.0 || opacity > 100.0)
72
 
    success = FALSE;
73
 
 
74
 
  spacing = args[4].value.pdb_int;
75
 
  if (spacing > 1000)
76
 
    success = FALSE;
77
 
 
78
 
  paint_mode = args[5].value.pdb_int;
79
 
  if (paint_mode < GIMP_NORMAL_MODE || paint_mode > GIMP_COLOR_ERASE_MODE)
80
 
    success = FALSE;
 
52
  brush_callback = g_value_get_string (&args->values[0]);
 
53
  popup_title = g_value_get_string (&args->values[1]);
 
54
  initial_brush = g_value_get_string (&args->values[2]);
 
55
  opacity = g_value_get_double (&args->values[3]);
 
56
  spacing = g_value_get_int (&args->values[4]);
 
57
  paint_mode = g_value_get_enum (&args->values[5]);
81
58
 
82
59
  if (success)
83
60
    {
84
61
      if (gimp->no_interface ||
85
 
          ! procedural_db_lookup (gimp, brush_callback) ||
86
 
          ! gimp_pdb_dialog_new (gimp, context, gimp->brush_factory->container,
 
62
          ! gimp_pdb_lookup_procedure (gimp->pdb, brush_callback) ||
 
63
          ! gimp_pdb_dialog_new (gimp, context, progress,
 
64
                                 gimp->brush_factory->container,
87
65
                                 popup_title, brush_callback, initial_brush,
88
66
                                 "opacity",    opacity / 100.0,
89
67
                                 "paint-mode", paint_mode,
92
70
        success = FALSE;
93
71
    }
94
72
 
95
 
  return procedural_db_return_args (&brushes_popup_proc, success);
 
73
  return gimp_procedure_get_return_values (procedure, success);
96
74
}
97
75
 
98
 
static ProcArg brushes_popup_inargs[] =
99
 
{
100
 
  {
101
 
    GIMP_PDB_STRING,
102
 
    "brush_callback",
103
 
    "The callback PDB proc to call when brush selection is made"
104
 
  },
105
 
  {
106
 
    GIMP_PDB_STRING,
107
 
    "popup_title",
108
 
    "Title to give the brush popup window"
109
 
  },
110
 
  {
111
 
    GIMP_PDB_STRING,
112
 
    "initial_brush",
113
 
    "The name of the brush to set as the first selected"
114
 
  },
115
 
  {
116
 
    GIMP_PDB_FLOAT,
117
 
    "opacity",
118
 
    "The initial opacity of the brush"
119
 
  },
120
 
  {
121
 
    GIMP_PDB_INT32,
122
 
    "spacing",
123
 
    "The initial spacing of the brush (if < 0 then use brush default spacing)"
124
 
  },
125
 
  {
126
 
    GIMP_PDB_INT32,
127
 
    "paint_mode",
128
 
    "The initial paint mode: { GIMP_NORMAL_MODE (0), GIMP_DISSOLVE_MODE (1), GIMP_BEHIND_MODE (2), GIMP_MULTIPLY_MODE (3), GIMP_SCREEN_MODE (4), GIMP_OVERLAY_MODE (5), GIMP_DIFFERENCE_MODE (6), GIMP_ADDITION_MODE (7), GIMP_SUBTRACT_MODE (8), GIMP_DARKEN_ONLY_MODE (9), GIMP_LIGHTEN_ONLY_MODE (10), GIMP_HUE_MODE (11), GIMP_SATURATION_MODE (12), GIMP_COLOR_MODE (13), GIMP_VALUE_MODE (14), GIMP_DIVIDE_MODE (15), GIMP_DODGE_MODE (16), GIMP_BURN_MODE (17), GIMP_HARDLIGHT_MODE (18), GIMP_SOFTLIGHT_MODE (19), GIMP_GRAIN_EXTRACT_MODE (20), GIMP_GRAIN_MERGE_MODE (21), GIMP_COLOR_ERASE_MODE (22) }"
129
 
  }
130
 
};
131
 
 
132
 
static ProcRecord brushes_popup_proc =
133
 
{
134
 
  "gimp_brushes_popup",
135
 
  "Invokes the Gimp brush selection.",
136
 
  "This procedure popups the brush selection dialog.",
137
 
  "Andy Thomas",
138
 
  "Andy Thomas",
139
 
  "1998",
140
 
  NULL,
141
 
  GIMP_INTERNAL,
142
 
  6,
143
 
  brushes_popup_inargs,
144
 
  0,
145
 
  NULL,
146
 
  { { brushes_popup_invoker } }
147
 
};
148
 
 
149
 
static Argument *
150
 
brushes_close_popup_invoker (Gimp         *gimp,
151
 
                             GimpContext  *context,
152
 
                             GimpProgress *progress,
153
 
                             Argument     *args)
 
76
static GValueArray *
 
77
brushes_close_popup_invoker (GimpProcedure     *procedure,
 
78
                             Gimp              *gimp,
 
79
                             GimpContext       *context,
 
80
                             GimpProgress      *progress,
 
81
                             const GValueArray *args)
154
82
{
155
83
  gboolean success = TRUE;
156
 
  gchar *brush_callback;
 
84
  const gchar *brush_callback;
157
85
 
158
 
  brush_callback = (gchar *) args[0].value.pdb_pointer;
159
 
  if (brush_callback == NULL || !g_utf8_validate (brush_callback, -1, NULL))
160
 
    success = FALSE;
 
86
  brush_callback = g_value_get_string (&args->values[0]);
161
87
 
162
88
  if (success)
163
89
    {
164
90
      if (gimp->no_interface ||
165
 
          ! procedural_db_lookup (gimp, brush_callback) ||
 
91
          ! gimp_pdb_lookup_procedure (gimp->pdb, brush_callback) ||
166
92
          ! gimp_pdb_dialog_close (gimp, gimp->brush_factory->container,
167
93
                                   brush_callback))
168
94
        success = FALSE;
169
95
    }
170
96
 
171
 
  return procedural_db_return_args (&brushes_close_popup_proc, success);
 
97
  return gimp_procedure_get_return_values (procedure, success);
172
98
}
173
99
 
174
 
static ProcArg brushes_close_popup_inargs[] =
175
 
{
176
 
  {
177
 
    GIMP_PDB_STRING,
178
 
    "brush_callback",
179
 
    "The name of the callback registered for this popup"
180
 
  }
181
 
};
182
 
 
183
 
static ProcRecord brushes_close_popup_proc =
184
 
{
185
 
  "gimp_brushes_close_popup",
186
 
  "Popdown the Gimp brush selection.",
187
 
  "This procedure closes an opened brush selection dialog.",
188
 
  "Andy Thomas",
189
 
  "Andy Thomas",
190
 
  "1998",
191
 
  NULL,
192
 
  GIMP_INTERNAL,
193
 
  1,
194
 
  brushes_close_popup_inargs,
195
 
  0,
196
 
  NULL,
197
 
  { { brushes_close_popup_invoker } }
198
 
};
199
 
 
200
 
static Argument *
201
 
brushes_set_popup_invoker (Gimp         *gimp,
202
 
                           GimpContext  *context,
203
 
                           GimpProgress *progress,
204
 
                           Argument     *args)
 
100
static GValueArray *
 
101
brushes_set_popup_invoker (GimpProcedure     *procedure,
 
102
                           Gimp              *gimp,
 
103
                           GimpContext       *context,
 
104
                           GimpProgress      *progress,
 
105
                           const GValueArray *args)
205
106
{
206
107
  gboolean success = TRUE;
207
 
  gchar *brush_callback;
208
 
  gchar *brush_name;
 
108
  const gchar *brush_callback;
 
109
  const gchar *brush_name;
209
110
  gdouble opacity;
210
111
  gint32 spacing;
211
112
  gint32 paint_mode;
212
113
 
213
 
  brush_callback = (gchar *) args[0].value.pdb_pointer;
214
 
  if (brush_callback == NULL || !g_utf8_validate (brush_callback, -1, NULL))
215
 
    success = FALSE;
216
 
 
217
 
  brush_name = (gchar *) args[1].value.pdb_pointer;
218
 
  if (brush_name == NULL || !g_utf8_validate (brush_name, -1, NULL))
219
 
    success = FALSE;
220
 
 
221
 
  opacity = args[2].value.pdb_float;
222
 
  if (opacity < 0.0 || opacity > 100.0)
223
 
    success = FALSE;
224
 
 
225
 
  spacing = args[3].value.pdb_int;
226
 
  if (spacing > 1000)
227
 
    success = FALSE;
228
 
 
229
 
  paint_mode = args[4].value.pdb_int;
230
 
  if (paint_mode < GIMP_NORMAL_MODE || paint_mode > GIMP_COLOR_ERASE_MODE)
231
 
    success = FALSE;
 
114
  brush_callback = g_value_get_string (&args->values[0]);
 
115
  brush_name = g_value_get_string (&args->values[1]);
 
116
  opacity = g_value_get_double (&args->values[2]);
 
117
  spacing = g_value_get_int (&args->values[3]);
 
118
  paint_mode = g_value_get_enum (&args->values[4]);
232
119
 
233
120
  if (success)
234
121
    {
235
122
      if (gimp->no_interface ||
236
 
          ! procedural_db_lookup (gimp, brush_callback) ||
 
123
          ! gimp_pdb_lookup_procedure (gimp->pdb, brush_callback) ||
237
124
          ! gimp_pdb_dialog_set (gimp, gimp->brush_factory->container,
238
125
                                 brush_callback, brush_name,
239
126
                                 "opacity",    opacity / 100.0,
243
130
        success = FALSE;
244
131
    }
245
132
 
246
 
  return procedural_db_return_args (&brushes_set_popup_proc, success);
247
 
}
248
 
 
249
 
static ProcArg brushes_set_popup_inargs[] =
250
 
{
251
 
  {
252
 
    GIMP_PDB_STRING,
253
 
    "brush_callback",
254
 
    "The name of the callback registered for this popup"
255
 
  },
256
 
  {
257
 
    GIMP_PDB_STRING,
258
 
    "brush_name",
259
 
    "The name of the brush to set as selected"
260
 
  },
261
 
  {
262
 
    GIMP_PDB_FLOAT,
263
 
    "opacity",
264
 
    "The initial opacity of the brush"
265
 
  },
266
 
  {
267
 
    GIMP_PDB_INT32,
268
 
    "spacing",
269
 
    "The initial spacing of the brush (if < 0 then use brush default spacing)"
270
 
  },
271
 
  {
272
 
    GIMP_PDB_INT32,
273
 
    "paint_mode",
274
 
    "The initial paint mode: { GIMP_NORMAL_MODE (0), GIMP_DISSOLVE_MODE (1), GIMP_BEHIND_MODE (2), GIMP_MULTIPLY_MODE (3), GIMP_SCREEN_MODE (4), GIMP_OVERLAY_MODE (5), GIMP_DIFFERENCE_MODE (6), GIMP_ADDITION_MODE (7), GIMP_SUBTRACT_MODE (8), GIMP_DARKEN_ONLY_MODE (9), GIMP_LIGHTEN_ONLY_MODE (10), GIMP_HUE_MODE (11), GIMP_SATURATION_MODE (12), GIMP_COLOR_MODE (13), GIMP_VALUE_MODE (14), GIMP_DIVIDE_MODE (15), GIMP_DODGE_MODE (16), GIMP_BURN_MODE (17), GIMP_HARDLIGHT_MODE (18), GIMP_SOFTLIGHT_MODE (19), GIMP_GRAIN_EXTRACT_MODE (20), GIMP_GRAIN_MERGE_MODE (21), GIMP_COLOR_ERASE_MODE (22) }"
275
 
  }
276
 
};
277
 
 
278
 
static ProcRecord brushes_set_popup_proc =
279
 
{
280
 
  "gimp_brushes_set_popup",
281
 
  "Sets the current brush selection in a popup.",
282
 
  "Sets the current brush selection in a popup.",
283
 
  "Andy Thomas",
284
 
  "Andy Thomas",
285
 
  "1998",
286
 
  NULL,
287
 
  GIMP_INTERNAL,
288
 
  5,
289
 
  brushes_set_popup_inargs,
290
 
  0,
291
 
  NULL,
292
 
  { { brushes_set_popup_invoker } }
293
 
};
 
133
  return gimp_procedure_get_return_values (procedure, success);
 
134
}
 
135
 
 
136
void
 
137
register_brush_select_procs (GimpPDB *pdb)
 
138
{
 
139
  GimpProcedure *procedure;
 
140
 
 
141
  /*
 
142
   * gimp-brushes-popup
 
143
   */
 
144
  procedure = gimp_procedure_new (brushes_popup_invoker);
 
145
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-brushes-popup");
 
146
  gimp_procedure_set_static_strings (procedure,
 
147
                                     "gimp-brushes-popup",
 
148
                                     "Invokes the Gimp brush selection.",
 
149
                                     "This procedure opens the brush selection dialog.",
 
150
                                     "Andy Thomas",
 
151
                                     "Andy Thomas",
 
152
                                     "1998",
 
153
                                     NULL);
 
154
  gimp_procedure_add_argument (procedure,
 
155
                               gimp_param_spec_string ("brush-callback",
 
156
                                                       "brush callback",
 
157
                                                       "The callback PDB proc to call when brush selection is made",
 
158
                                                       FALSE, FALSE,
 
159
                                                       NULL,
 
160
                                                       GIMP_PARAM_READWRITE));
 
161
  gimp_procedure_add_argument (procedure,
 
162
                               gimp_param_spec_string ("popup-title",
 
163
                                                       "popup title",
 
164
                                                       "Title of the brush selection dialog",
 
165
                                                       FALSE, FALSE,
 
166
                                                       NULL,
 
167
                                                       GIMP_PARAM_READWRITE));
 
168
  gimp_procedure_add_argument (procedure,
 
169
                               gimp_param_spec_string ("initial-brush",
 
170
                                                       "initial brush",
 
171
                                                       "The name of the brush to set as the first selected",
 
172
                                                       FALSE, TRUE,
 
173
                                                       NULL,
 
174
                                                       GIMP_PARAM_READWRITE));
 
175
  gimp_procedure_add_argument (procedure,
 
176
                               g_param_spec_double ("opacity",
 
177
                                                    "opacity",
 
178
                                                    "The initial opacity of the brush",
 
179
                                                    0, 100, 0,
 
180
                                                    GIMP_PARAM_READWRITE));
 
181
  gimp_procedure_add_argument (procedure,
 
182
                               gimp_param_spec_int32 ("spacing",
 
183
                                                      "spacing",
 
184
                                                      "The initial spacing of the brush (if < 0 then use brush default spacing)",
 
185
                                                      G_MININT32, 1000, 0,
 
186
                                                      GIMP_PARAM_READWRITE));
 
187
  gimp_procedure_add_argument (procedure,
 
188
                               g_param_spec_enum ("paint-mode",
 
189
                                                  "paint mode",
 
190
                                                  "The initial paint mode",
 
191
                                                  GIMP_TYPE_LAYER_MODE_EFFECTS,
 
192
                                                  GIMP_NORMAL_MODE,
 
193
                                                  GIMP_PARAM_READWRITE));
 
194
  gimp_pdb_register_procedure (pdb, procedure);
 
195
  g_object_unref (procedure);
 
196
 
 
197
  /*
 
198
   * gimp-brushes-close-popup
 
199
   */
 
200
  procedure = gimp_procedure_new (brushes_close_popup_invoker);
 
201
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-brushes-close-popup");
 
202
  gimp_procedure_set_static_strings (procedure,
 
203
                                     "gimp-brushes-close-popup",
 
204
                                     "Close the brush selection dialog.",
 
205
                                     "This procedure closes an opened brush selection dialog.",
 
206
                                     "Andy Thomas",
 
207
                                     "Andy Thomas",
 
208
                                     "1998",
 
209
                                     NULL);
 
210
  gimp_procedure_add_argument (procedure,
 
211
                               gimp_param_spec_string ("brush-callback",
 
212
                                                       "brush callback",
 
213
                                                       "The name of the callback registered for this pop-up",
 
214
                                                       FALSE, FALSE,
 
215
                                                       NULL,
 
216
                                                       GIMP_PARAM_READWRITE));
 
217
  gimp_pdb_register_procedure (pdb, procedure);
 
218
  g_object_unref (procedure);
 
219
 
 
220
  /*
 
221
   * gimp-brushes-set-popup
 
222
   */
 
223
  procedure = gimp_procedure_new (brushes_set_popup_invoker);
 
224
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-brushes-set-popup");
 
225
  gimp_procedure_set_static_strings (procedure,
 
226
                                     "gimp-brushes-set-popup",
 
227
                                     "Sets the current brush in a brush selection dialog.",
 
228
                                     "Sets the current brush in a brush selection dialog.",
 
229
                                     "Andy Thomas",
 
230
                                     "Andy Thomas",
 
231
                                     "1998",
 
232
                                     NULL);
 
233
  gimp_procedure_add_argument (procedure,
 
234
                               gimp_param_spec_string ("brush-callback",
 
235
                                                       "brush callback",
 
236
                                                       "The name of the callback registered for this pop-up",
 
237
                                                       FALSE, FALSE,
 
238
                                                       NULL,
 
239
                                                       GIMP_PARAM_READWRITE));
 
240
  gimp_procedure_add_argument (procedure,
 
241
                               gimp_param_spec_string ("brush-name",
 
242
                                                       "brush name",
 
243
                                                       "The name of the brush to set as selected",
 
244
                                                       FALSE, FALSE,
 
245
                                                       NULL,
 
246
                                                       GIMP_PARAM_READWRITE));
 
247
  gimp_procedure_add_argument (procedure,
 
248
                               g_param_spec_double ("opacity",
 
249
                                                    "opacity",
 
250
                                                    "The initial opacity of the brush",
 
251
                                                    0, 100, 0,
 
252
                                                    GIMP_PARAM_READWRITE));
 
253
  gimp_procedure_add_argument (procedure,
 
254
                               gimp_param_spec_int32 ("spacing",
 
255
                                                      "spacing",
 
256
                                                      "The initial spacing of the brush (if < 0 then use brush default spacing)",
 
257
                                                      G_MININT32, 1000, 0,
 
258
                                                      GIMP_PARAM_READWRITE));
 
259
  gimp_procedure_add_argument (procedure,
 
260
                               g_param_spec_enum ("paint-mode",
 
261
                                                  "paint mode",
 
262
                                                  "The initial paint mode",
 
263
                                                  GIMP_TYPE_LAYER_MODE_EFFECTS,
 
264
                                                  GIMP_NORMAL_MODE,
 
265
                                                  GIMP_PARAM_READWRITE));
 
266
  gimp_pdb_register_procedure (pdb, procedure);
 
267
  g_object_unref (procedure);
 
268
}