~ubuntu-branches/ubuntu/breezy/gimp/breezy

« back to all changes in this revision

Viewing changes to app/pdb/pattern_select_cmds.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2005-10-04 19:04:46 UTC
  • Revision ID: james.westby@ubuntu.com-20051004190446-ukh32kwk56s4sjhu
Tags: upstream-2.2.8
ImportĀ upstreamĀ versionĀ 2.2.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* The GIMP -- an image manipulation program
 
2
 * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
 
3
 *
 
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.
 
8
 *
 
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.
 
13
 *
 
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.
 
17
 */
 
18
 
 
19
/* NOTE: This file is autogenerated by pdbgen.pl. */
 
20
 
 
21
#include "config.h"
 
22
 
 
23
 
 
24
#include <glib-object.h>
 
25
 
 
26
#include "pdb-types.h"
 
27
#include "procedural_db.h"
 
28
 
 
29
#include "core/gimp.h"
 
30
#include "core/gimpdatafactory.h"
 
31
 
 
32
static ProcRecord patterns_popup_proc;
 
33
static ProcRecord patterns_close_popup_proc;
 
34
static ProcRecord patterns_set_popup_proc;
 
35
 
 
36
void
 
37
register_pattern_select_procs (Gimp *gimp)
 
38
{
 
39
  procedural_db_register (gimp, &patterns_popup_proc);
 
40
  procedural_db_register (gimp, &patterns_close_popup_proc);
 
41
  procedural_db_register (gimp, &patterns_set_popup_proc);
 
42
}
 
43
 
 
44
static Argument *
 
45
patterns_popup_invoker (Gimp         *gimp,
 
46
                        GimpContext  *context,
 
47
                        GimpProgress *progress,
 
48
                        Argument     *args)
 
49
{
 
50
  gboolean success = TRUE;
 
51
  gchar *pattern_callback;
 
52
  gchar *popup_title;
 
53
  gchar *initial_pattern;
 
54
 
 
55
  pattern_callback = (gchar *) args[0].value.pdb_pointer;
 
56
  if (pattern_callback == NULL || !g_utf8_validate (pattern_callback, -1, NULL))
 
57
    success = FALSE;
 
58
 
 
59
  popup_title = (gchar *) args[1].value.pdb_pointer;
 
60
  if (popup_title == NULL || !g_utf8_validate (popup_title, -1, NULL))
 
61
    success = FALSE;
 
62
 
 
63
  initial_pattern = (gchar *) args[2].value.pdb_pointer;
 
64
  if (initial_pattern && !g_utf8_validate (initial_pattern, -1, NULL))
 
65
    success = FALSE;
 
66
 
 
67
  if (success)
 
68
    {
 
69
      if (gimp->no_interface ||
 
70
          ! procedural_db_lookup (gimp, pattern_callback) ||
 
71
          ! gimp_pdb_dialog_new (gimp, context, gimp->pattern_factory->container,
 
72
                                 popup_title, pattern_callback, initial_pattern,
 
73
                                 NULL))
 
74
        success = FALSE;
 
75
    }
 
76
 
 
77
  return procedural_db_return_args (&patterns_popup_proc, success);
 
78
}
 
79
 
 
80
static ProcArg patterns_popup_inargs[] =
 
81
{
 
82
  {
 
83
    GIMP_PDB_STRING,
 
84
    "pattern_callback",
 
85
    "The callback PDB proc to call when pattern selection is made"
 
86
  },
 
87
  {
 
88
    GIMP_PDB_STRING,
 
89
    "popup_title",
 
90
    "Title to give the pattern popup window"
 
91
  },
 
92
  {
 
93
    GIMP_PDB_STRING,
 
94
    "initial_pattern",
 
95
    "The name of the pattern to set as the first selected"
 
96
  }
 
97
};
 
98
 
 
99
static ProcRecord patterns_popup_proc =
 
100
{
 
101
  "gimp_patterns_popup",
 
102
  "Invokes the Gimp pattern selection.",
 
103
  "This procedure popups the pattern selection dialog.",
 
104
  "Andy Thomas",
 
105
  "Andy Thomas",
 
106
  "1998",
 
107
  NULL,
 
108
  GIMP_INTERNAL,
 
109
  3,
 
110
  patterns_popup_inargs,
 
111
  0,
 
112
  NULL,
 
113
  { { patterns_popup_invoker } }
 
114
};
 
115
 
 
116
static Argument *
 
117
patterns_close_popup_invoker (Gimp         *gimp,
 
118
                              GimpContext  *context,
 
119
                              GimpProgress *progress,
 
120
                              Argument     *args)
 
121
{
 
122
  gboolean success = TRUE;
 
123
  gchar *pattern_callback;
 
124
 
 
125
  pattern_callback = (gchar *) args[0].value.pdb_pointer;
 
126
  if (pattern_callback == NULL || !g_utf8_validate (pattern_callback, -1, NULL))
 
127
    success = FALSE;
 
128
 
 
129
  if (success)
 
130
    {
 
131
      if (gimp->no_interface ||
 
132
          ! procedural_db_lookup (gimp, pattern_callback) ||
 
133
          ! gimp_pdb_dialog_close (gimp, gimp->pattern_factory->container,
 
134
                                   pattern_callback))
 
135
        success = FALSE;
 
136
    }
 
137
 
 
138
  return procedural_db_return_args (&patterns_close_popup_proc, success);
 
139
}
 
140
 
 
141
static ProcArg patterns_close_popup_inargs[] =
 
142
{
 
143
  {
 
144
    GIMP_PDB_STRING,
 
145
    "pattern_callback",
 
146
    "The name of the callback registered for this popup"
 
147
  }
 
148
};
 
149
 
 
150
static ProcRecord patterns_close_popup_proc =
 
151
{
 
152
  "gimp_patterns_close_popup",
 
153
  "Popdown the Gimp pattern selection.",
 
154
  "This procedure closes an opened pattern selection dialog.",
 
155
  "Andy Thomas",
 
156
  "Andy Thomas",
 
157
  "1998",
 
158
  NULL,
 
159
  GIMP_INTERNAL,
 
160
  1,
 
161
  patterns_close_popup_inargs,
 
162
  0,
 
163
  NULL,
 
164
  { { patterns_close_popup_invoker } }
 
165
};
 
166
 
 
167
static Argument *
 
168
patterns_set_popup_invoker (Gimp         *gimp,
 
169
                            GimpContext  *context,
 
170
                            GimpProgress *progress,
 
171
                            Argument     *args)
 
172
{
 
173
  gboolean success = TRUE;
 
174
  gchar *pattern_callback;
 
175
  gchar *pattern_name;
 
176
 
 
177
  pattern_callback = (gchar *) args[0].value.pdb_pointer;
 
178
  if (pattern_callback == NULL || !g_utf8_validate (pattern_callback, -1, NULL))
 
179
    success = FALSE;
 
180
 
 
181
  pattern_name = (gchar *) args[1].value.pdb_pointer;
 
182
  if (pattern_name == NULL || !g_utf8_validate (pattern_name, -1, NULL))
 
183
    success = FALSE;
 
184
 
 
185
  if (success)
 
186
    {
 
187
      if (gimp->no_interface ||
 
188
          ! procedural_db_lookup (gimp, pattern_callback) ||
 
189
          ! gimp_pdb_dialog_set (gimp, gimp->pattern_factory->container,
 
190
                                 pattern_callback, pattern_name,
 
191
                                 NULL))
 
192
        success = FALSE;
 
193
    }
 
194
 
 
195
  return procedural_db_return_args (&patterns_set_popup_proc, success);
 
196
}
 
197
 
 
198
static ProcArg patterns_set_popup_inargs[] =
 
199
{
 
200
  {
 
201
    GIMP_PDB_STRING,
 
202
    "pattern_callback",
 
203
    "The name of the callback registered for this popup"
 
204
  },
 
205
  {
 
206
    GIMP_PDB_STRING,
 
207
    "pattern_name",
 
208
    "The name of the pattern to set as selected"
 
209
  }
 
210
};
 
211
 
 
212
static ProcRecord patterns_set_popup_proc =
 
213
{
 
214
  "gimp_patterns_set_popup",
 
215
  "Sets the current pattern selection in a popup.",
 
216
  "Sets the current pattern selection in a popup.",
 
217
  "Andy Thomas",
 
218
  "Andy Thomas",
 
219
  "1998",
 
220
  NULL,
 
221
  GIMP_INTERNAL,
 
222
  2,
 
223
  patterns_set_popup_inargs,
 
224
  0,
 
225
  NULL,
 
226
  { { patterns_set_popup_invoker } }
 
227
};