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

« back to all changes in this revision

Viewing changes to app/pdb/gradient_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
#include "core/gimpgradient.h"
32
34
 
33
 
static ProcRecord gradients_popup_proc;
34
 
static ProcRecord gradients_close_popup_proc;
35
 
static ProcRecord gradients_set_popup_proc;
36
 
 
37
 
void
38
 
register_gradient_select_procs (Gimp *gimp)
39
 
{
40
 
  procedural_db_register (gimp, &gradients_popup_proc);
41
 
  procedural_db_register (gimp, &gradients_close_popup_proc);
42
 
  procedural_db_register (gimp, &gradients_set_popup_proc);
43
 
}
44
 
 
45
 
static Argument *
46
 
gradients_popup_invoker (Gimp         *gimp,
47
 
                         GimpContext  *context,
48
 
                         GimpProgress *progress,
49
 
                         Argument     *args)
 
35
#include "internal_procs.h"
 
36
 
 
37
 
 
38
static GValueArray *
 
39
gradients_popup_invoker (GimpProcedure     *procedure,
 
40
                         Gimp              *gimp,
 
41
                         GimpContext       *context,
 
42
                         GimpProgress      *progress,
 
43
                         const GValueArray *args)
50
44
{
51
45
  gboolean success = TRUE;
52
 
  gchar *gradient_callback;
53
 
  gchar *popup_title;
54
 
  gchar *initial_gradient;
 
46
  const gchar *gradient_callback;
 
47
  const gchar *popup_title;
 
48
  const gchar *initial_gradient;
55
49
  gint32 sample_size;
56
50
 
57
 
  gradient_callback = (gchar *) args[0].value.pdb_pointer;
58
 
  if (gradient_callback == NULL || !g_utf8_validate (gradient_callback, -1, NULL))
59
 
    success = FALSE;
60
 
 
61
 
  popup_title = (gchar *) args[1].value.pdb_pointer;
62
 
  if (popup_title == NULL || !g_utf8_validate (popup_title, -1, NULL))
63
 
    success = FALSE;
64
 
 
65
 
  initial_gradient = (gchar *) args[2].value.pdb_pointer;
66
 
  if (initial_gradient && !g_utf8_validate (initial_gradient, -1, NULL))
67
 
    success = FALSE;
68
 
 
69
 
  sample_size = args[3].value.pdb_int;
70
 
  if (sample_size <= 0 || sample_size > 10000)
71
 
    sample_size = GIMP_GRADIENT_DEFAULT_SAMPLE_SIZE;
 
51
  gradient_callback = g_value_get_string (&args->values[0]);
 
52
  popup_title = g_value_get_string (&args->values[1]);
 
53
  initial_gradient = g_value_get_string (&args->values[2]);
 
54
  sample_size = g_value_get_int (&args->values[3]);
72
55
 
73
56
  if (success)
74
57
    {
 
58
      if (sample_size < 1 || sample_size > 10000)
 
59
        sample_size = GIMP_GRADIENT_DEFAULT_SAMPLE_SIZE;
 
60
 
75
61
      if (gimp->no_interface ||
76
 
          ! procedural_db_lookup (gimp, gradient_callback) ||
77
 
          ! gimp_pdb_dialog_new (gimp, context, gimp->gradient_factory->container,
 
62
          ! gimp_pdb_lookup_procedure (gimp->pdb, gradient_callback) ||
 
63
          ! gimp_pdb_dialog_new (gimp, context, progress,
 
64
                                 gimp->gradient_factory->container,
78
65
                                 popup_title, gradient_callback, initial_gradient,
79
66
                                 "sample-size", sample_size,
80
67
                                 NULL))
81
68
        success = FALSE;
82
69
    }
83
70
 
84
 
  return procedural_db_return_args (&gradients_popup_proc, success);
 
71
  return gimp_procedure_get_return_values (procedure, success);
85
72
}
86
73
 
87
 
static ProcArg gradients_popup_inargs[] =
88
 
{
89
 
  {
90
 
    GIMP_PDB_STRING,
91
 
    "gradient_callback",
92
 
    "The callback PDB proc to call when gradient selection is made"
93
 
  },
94
 
  {
95
 
    GIMP_PDB_STRING,
96
 
    "popup_title",
97
 
    "Title to give the gradient popup window"
98
 
  },
99
 
  {
100
 
    GIMP_PDB_STRING,
101
 
    "initial_gradient",
102
 
    "The name of the pattern to set as the first selected"
103
 
  },
104
 
  {
105
 
    GIMP_PDB_INT32,
106
 
    "sample_size",
107
 
    "Size of the sample to return when the gradient is changed (0 < sample_size <= 10000)"
108
 
  }
109
 
};
110
 
 
111
 
static ProcRecord gradients_popup_proc =
112
 
{
113
 
  "gimp_gradients_popup",
114
 
  "Invokes the Gimp gradients selection.",
115
 
  "This procedure popups the gradients selection dialog.",
116
 
  "Andy Thomas",
117
 
  "Andy Thomas",
118
 
  "1998",
119
 
  NULL,
120
 
  GIMP_INTERNAL,
121
 
  4,
122
 
  gradients_popup_inargs,
123
 
  0,
124
 
  NULL,
125
 
  { { gradients_popup_invoker } }
126
 
};
127
 
 
128
 
static Argument *
129
 
gradients_close_popup_invoker (Gimp         *gimp,
130
 
                               GimpContext  *context,
131
 
                               GimpProgress *progress,
132
 
                               Argument     *args)
 
74
static GValueArray *
 
75
gradients_close_popup_invoker (GimpProcedure     *procedure,
 
76
                               Gimp              *gimp,
 
77
                               GimpContext       *context,
 
78
                               GimpProgress      *progress,
 
79
                               const GValueArray *args)
133
80
{
134
81
  gboolean success = TRUE;
135
 
  gchar *gradient_callback;
 
82
  const gchar *gradient_callback;
136
83
 
137
 
  gradient_callback = (gchar *) args[0].value.pdb_pointer;
138
 
  if (gradient_callback == NULL || !g_utf8_validate (gradient_callback, -1, NULL))
139
 
    success = FALSE;
 
84
  gradient_callback = g_value_get_string (&args->values[0]);
140
85
 
141
86
  if (success)
142
87
    {
143
88
      if (gimp->no_interface ||
144
 
          ! procedural_db_lookup (gimp, gradient_callback) ||
 
89
          ! gimp_pdb_lookup_procedure (gimp->pdb, gradient_callback) ||
145
90
          ! gimp_pdb_dialog_close (gimp, gimp->gradient_factory->container,
146
91
                                   gradient_callback))
147
92
        success = FALSE;
148
93
    }
149
94
 
150
 
  return procedural_db_return_args (&gradients_close_popup_proc, success);
 
95
  return gimp_procedure_get_return_values (procedure, success);
151
96
}
152
97
 
153
 
static ProcArg gradients_close_popup_inargs[] =
154
 
{
155
 
  {
156
 
    GIMP_PDB_STRING,
157
 
    "gradient_callback",
158
 
    "The name of the callback registered for this popup"
159
 
  }
160
 
};
161
 
 
162
 
static ProcRecord gradients_close_popup_proc =
163
 
{
164
 
  "gimp_gradients_close_popup",
165
 
  "Popdown the Gimp gradient selection.",
166
 
  "This procedure closes an opened gradient selection dialog.",
167
 
  "Andy Thomas",
168
 
  "Andy Thomas",
169
 
  "1998",
170
 
  NULL,
171
 
  GIMP_INTERNAL,
172
 
  1,
173
 
  gradients_close_popup_inargs,
174
 
  0,
175
 
  NULL,
176
 
  { { gradients_close_popup_invoker } }
177
 
};
178
 
 
179
 
static Argument *
180
 
gradients_set_popup_invoker (Gimp         *gimp,
181
 
                             GimpContext  *context,
182
 
                             GimpProgress *progress,
183
 
                             Argument     *args)
 
98
static GValueArray *
 
99
gradients_set_popup_invoker (GimpProcedure     *procedure,
 
100
                             Gimp              *gimp,
 
101
                             GimpContext       *context,
 
102
                             GimpProgress      *progress,
 
103
                             const GValueArray *args)
184
104
{
185
105
  gboolean success = TRUE;
186
 
  gchar *gradient_callback;
187
 
  gchar *gradient_name;
188
 
 
189
 
  gradient_callback = (gchar *) args[0].value.pdb_pointer;
190
 
  if (gradient_callback == NULL || !g_utf8_validate (gradient_callback, -1, NULL))
191
 
    success = FALSE;
192
 
 
193
 
  gradient_name = (gchar *) args[1].value.pdb_pointer;
194
 
  if (gradient_name == NULL || !g_utf8_validate (gradient_name, -1, NULL))
195
 
    success = FALSE;
 
106
  const gchar *gradient_callback;
 
107
  const gchar *gradient_name;
 
108
 
 
109
  gradient_callback = g_value_get_string (&args->values[0]);
 
110
  gradient_name = g_value_get_string (&args->values[1]);
196
111
 
197
112
  if (success)
198
113
    {
199
114
      if (gimp->no_interface ||
200
 
          ! procedural_db_lookup (gimp, gradient_callback) ||
 
115
          ! gimp_pdb_lookup_procedure (gimp->pdb, gradient_callback) ||
201
116
          ! gimp_pdb_dialog_set (gimp, gimp->gradient_factory->container,
202
117
                                 gradient_callback, gradient_name,
203
118
                                 NULL))
204
119
        success = FALSE;
205
120
    }
206
121
 
207
 
  return procedural_db_return_args (&gradients_set_popup_proc, success);
208
 
}
209
 
 
210
 
static ProcArg gradients_set_popup_inargs[] =
211
 
{
212
 
  {
213
 
    GIMP_PDB_STRING,
214
 
    "gradient_callback",
215
 
    "The name of the callback registered for this popup"
216
 
  },
217
 
  {
218
 
    GIMP_PDB_STRING,
219
 
    "gradient_name",
220
 
    "The name of the gradient to set as selected"
221
 
  }
222
 
};
223
 
 
224
 
static ProcRecord gradients_set_popup_proc =
225
 
{
226
 
  "gimp_gradients_set_popup",
227
 
  "Sets the current gradient selection in a popup.",
228
 
  "Sets the current gradient selection in a popup.",
229
 
  "Andy Thomas",
230
 
  "Andy Thomas",
231
 
  "1998",
232
 
  NULL,
233
 
  GIMP_INTERNAL,
234
 
  2,
235
 
  gradients_set_popup_inargs,
236
 
  0,
237
 
  NULL,
238
 
  { { gradients_set_popup_invoker } }
239
 
};
 
122
  return gimp_procedure_get_return_values (procedure, success);
 
123
}
 
124
 
 
125
void
 
126
register_gradient_select_procs (GimpPDB *pdb)
 
127
{
 
128
  GimpProcedure *procedure;
 
129
 
 
130
  /*
 
131
   * gimp-gradients-popup
 
132
   */
 
133
  procedure = gimp_procedure_new (gradients_popup_invoker);
 
134
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-gradients-popup");
 
135
  gimp_procedure_set_static_strings (procedure,
 
136
                                     "gimp-gradients-popup",
 
137
                                     "Invokes the Gimp gradients selection.",
 
138
                                     "This procedure opens the gradient selection dialog.",
 
139
                                     "Andy Thomas",
 
140
                                     "Andy Thomas",
 
141
                                     "1998",
 
142
                                     NULL);
 
143
  gimp_procedure_add_argument (procedure,
 
144
                               gimp_param_spec_string ("gradient-callback",
 
145
                                                       "gradient callback",
 
146
                                                       "The callback PDB proc to call when gradient selection is made",
 
147
                                                       FALSE, FALSE,
 
148
                                                       NULL,
 
149
                                                       GIMP_PARAM_READWRITE));
 
150
  gimp_procedure_add_argument (procedure,
 
151
                               gimp_param_spec_string ("popup-title",
 
152
                                                       "popup title",
 
153
                                                       "Title of the gradient selection dialog",
 
154
                                                       FALSE, FALSE,
 
155
                                                       NULL,
 
156
                                                       GIMP_PARAM_READWRITE));
 
157
  gimp_procedure_add_argument (procedure,
 
158
                               gimp_param_spec_string ("initial-gradient",
 
159
                                                       "initial gradient",
 
160
                                                       "The name of the gradient to set as the first selected",
 
161
                                                       FALSE, TRUE,
 
162
                                                       NULL,
 
163
                                                       GIMP_PARAM_READWRITE));
 
164
  gimp_procedure_add_argument (procedure,
 
165
                               gimp_param_spec_int32 ("sample-size",
 
166
                                                      "sample size",
 
167
                                                      "Size of the sample to return when the gradient is changed",
 
168
                                                      1, 10000, 1,
 
169
                                                      GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
 
170
  gimp_pdb_register_procedure (pdb, procedure);
 
171
  g_object_unref (procedure);
 
172
 
 
173
  /*
 
174
   * gimp-gradients-close-popup
 
175
   */
 
176
  procedure = gimp_procedure_new (gradients_close_popup_invoker);
 
177
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-gradients-close-popup");
 
178
  gimp_procedure_set_static_strings (procedure,
 
179
                                     "gimp-gradients-close-popup",
 
180
                                     "Close the gradient selection dialog.",
 
181
                                     "This procedure closes an opened gradient selection dialog.",
 
182
                                     "Andy Thomas",
 
183
                                     "Andy Thomas",
 
184
                                     "1998",
 
185
                                     NULL);
 
186
  gimp_procedure_add_argument (procedure,
 
187
                               gimp_param_spec_string ("gradient-callback",
 
188
                                                       "gradient callback",
 
189
                                                       "The name of the callback registered for this pop-up",
 
190
                                                       FALSE, FALSE,
 
191
                                                       NULL,
 
192
                                                       GIMP_PARAM_READWRITE));
 
193
  gimp_pdb_register_procedure (pdb, procedure);
 
194
  g_object_unref (procedure);
 
195
 
 
196
  /*
 
197
   * gimp-gradients-set-popup
 
198
   */
 
199
  procedure = gimp_procedure_new (gradients_set_popup_invoker);
 
200
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-gradients-set-popup");
 
201
  gimp_procedure_set_static_strings (procedure,
 
202
                                     "gimp-gradients-set-popup",
 
203
                                     "Sets the current gradient in a gradient selection dialog.",
 
204
                                     "Sets the current gradient in a gradient selection dialog.",
 
205
                                     "Andy Thomas",
 
206
                                     "Andy Thomas",
 
207
                                     "1998",
 
208
                                     NULL);
 
209
  gimp_procedure_add_argument (procedure,
 
210
                               gimp_param_spec_string ("gradient-callback",
 
211
                                                       "gradient callback",
 
212
                                                       "The name of the callback registered for this pop-up",
 
213
                                                       FALSE, FALSE,
 
214
                                                       NULL,
 
215
                                                       GIMP_PARAM_READWRITE));
 
216
  gimp_procedure_add_argument (procedure,
 
217
                               gimp_param_spec_string ("gradient-name",
 
218
                                                       "gradient name",
 
219
                                                       "The name of the gradient to set as selected",
 
220
                                                       FALSE, FALSE,
 
221
                                                       NULL,
 
222
                                                       GIMP_PARAM_READWRITE));
 
223
  gimp_pdb_register_procedure (pdb, procedure);
 
224
  g_object_unref (procedure);
 
225
}