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

« back to all changes in this revision

Viewing changes to app/pdb/font_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
 
31
 
static ProcRecord fonts_popup_proc;
32
 
static ProcRecord fonts_close_popup_proc;
33
 
static ProcRecord fonts_set_popup_proc;
34
 
 
35
 
void
36
 
register_font_select_procs (Gimp *gimp)
37
 
{
38
 
  procedural_db_register (gimp, &fonts_popup_proc);
39
 
  procedural_db_register (gimp, &fonts_close_popup_proc);
40
 
  procedural_db_register (gimp, &fonts_set_popup_proc);
41
 
}
42
 
 
43
 
static Argument *
44
 
fonts_popup_invoker (Gimp         *gimp,
45
 
                     GimpContext  *context,
46
 
                     GimpProgress *progress,
47
 
                     Argument     *args)
 
33
#include "internal_procs.h"
 
34
 
 
35
 
 
36
static GValueArray *
 
37
fonts_popup_invoker (GimpProcedure     *procedure,
 
38
                     Gimp              *gimp,
 
39
                     GimpContext       *context,
 
40
                     GimpProgress      *progress,
 
41
                     const GValueArray *args)
48
42
{
49
43
  gboolean success = TRUE;
50
 
  gchar *font_callback;
51
 
  gchar *popup_title;
52
 
  gchar *initial_font;
53
 
 
54
 
  font_callback = (gchar *) args[0].value.pdb_pointer;
55
 
  if (font_callback == NULL || !g_utf8_validate (font_callback, -1, NULL))
56
 
    success = FALSE;
57
 
 
58
 
  popup_title = (gchar *) args[1].value.pdb_pointer;
59
 
  if (popup_title == NULL || !g_utf8_validate (popup_title, -1, NULL))
60
 
    success = FALSE;
61
 
 
62
 
  initial_font = (gchar *) args[2].value.pdb_pointer;
63
 
  if (initial_font && !g_utf8_validate (initial_font, -1, NULL))
64
 
    success = FALSE;
 
44
  const gchar *font_callback;
 
45
  const gchar *popup_title;
 
46
  const gchar *initial_font;
 
47
 
 
48
  font_callback = g_value_get_string (&args->values[0]);
 
49
  popup_title = g_value_get_string (&args->values[1]);
 
50
  initial_font = g_value_get_string (&args->values[2]);
65
51
 
66
52
  if (success)
67
53
    {
68
54
      if (gimp->no_interface ||
69
 
          ! procedural_db_lookup (gimp, font_callback) ||
70
 
          ! gimp_pdb_dialog_new (gimp, context, gimp->fonts,
 
55
          ! gimp_pdb_lookup_procedure (gimp->pdb, font_callback) ||
 
56
          ! gimp_pdb_dialog_new (gimp, context, progress, gimp->fonts,
71
57
                                 popup_title, font_callback, initial_font,
72
58
                                 NULL))
73
59
        success = FALSE;
74
60
    }
75
61
 
76
 
  return procedural_db_return_args (&fonts_popup_proc, success);
 
62
  return gimp_procedure_get_return_values (procedure, success);
77
63
}
78
64
 
79
 
static ProcArg fonts_popup_inargs[] =
80
 
{
81
 
  {
82
 
    GIMP_PDB_STRING,
83
 
    "font_callback",
84
 
    "The callback PDB proc to call when font selection is made"
85
 
  },
86
 
  {
87
 
    GIMP_PDB_STRING,
88
 
    "popup_title",
89
 
    "Title to give the font popup window"
90
 
  },
91
 
  {
92
 
    GIMP_PDB_STRING,
93
 
    "initial_font",
94
 
    "The name of the font to set as the first selected"
95
 
  }
96
 
};
97
 
 
98
 
static ProcRecord fonts_popup_proc =
99
 
{
100
 
  "gimp_fonts_popup",
101
 
  "Invokes the Gimp font selection.",
102
 
  "This procedure popups the font selection dialog.",
103
 
  "Sven Neumann <sven@gimp.org>",
104
 
  "Sven Neumann",
105
 
  "2003",
106
 
  NULL,
107
 
  GIMP_INTERNAL,
108
 
  3,
109
 
  fonts_popup_inargs,
110
 
  0,
111
 
  NULL,
112
 
  { { fonts_popup_invoker } }
113
 
};
114
 
 
115
 
static Argument *
116
 
fonts_close_popup_invoker (Gimp         *gimp,
117
 
                           GimpContext  *context,
118
 
                           GimpProgress *progress,
119
 
                           Argument     *args)
 
65
static GValueArray *
 
66
fonts_close_popup_invoker (GimpProcedure     *procedure,
 
67
                           Gimp              *gimp,
 
68
                           GimpContext       *context,
 
69
                           GimpProgress      *progress,
 
70
                           const GValueArray *args)
120
71
{
121
72
  gboolean success = TRUE;
122
 
  gchar *font_callback;
 
73
  const gchar *font_callback;
123
74
 
124
 
  font_callback = (gchar *) args[0].value.pdb_pointer;
125
 
  if (font_callback == NULL || !g_utf8_validate (font_callback, -1, NULL))
126
 
    success = FALSE;
 
75
  font_callback = g_value_get_string (&args->values[0]);
127
76
 
128
77
  if (success)
129
78
    {
130
79
      if (gimp->no_interface ||
131
 
          ! procedural_db_lookup (gimp, font_callback) ||
 
80
          ! gimp_pdb_lookup_procedure (gimp->pdb, font_callback) ||
132
81
          ! gimp_pdb_dialog_close (gimp, gimp->fonts, font_callback))
133
82
        success = FALSE;
134
83
    }
135
84
 
136
 
  return procedural_db_return_args (&fonts_close_popup_proc, success);
 
85
  return gimp_procedure_get_return_values (procedure, success);
137
86
}
138
87
 
139
 
static ProcArg fonts_close_popup_inargs[] =
140
 
{
141
 
  {
142
 
    GIMP_PDB_STRING,
143
 
    "font_callback",
144
 
    "The name of the callback registered for this popup"
145
 
  }
146
 
};
147
 
 
148
 
static ProcRecord fonts_close_popup_proc =
149
 
{
150
 
  "gimp_fonts_close_popup",
151
 
  "Popdown the Gimp font selection.",
152
 
  "This procedure closes an opened font selection dialog.",
153
 
  "Sven Neumann <sven@gimp.org>",
154
 
  "Sven Neumann",
155
 
  "2003",
156
 
  NULL,
157
 
  GIMP_INTERNAL,
158
 
  1,
159
 
  fonts_close_popup_inargs,
160
 
  0,
161
 
  NULL,
162
 
  { { fonts_close_popup_invoker } }
163
 
};
164
 
 
165
 
static Argument *
166
 
fonts_set_popup_invoker (Gimp         *gimp,
167
 
                         GimpContext  *context,
168
 
                         GimpProgress *progress,
169
 
                         Argument     *args)
 
88
static GValueArray *
 
89
fonts_set_popup_invoker (GimpProcedure     *procedure,
 
90
                         Gimp              *gimp,
 
91
                         GimpContext       *context,
 
92
                         GimpProgress      *progress,
 
93
                         const GValueArray *args)
170
94
{
171
95
  gboolean success = TRUE;
172
 
  gchar *font_callback;
173
 
  gchar *font_name;
174
 
 
175
 
  font_callback = (gchar *) args[0].value.pdb_pointer;
176
 
  if (font_callback == NULL || !g_utf8_validate (font_callback, -1, NULL))
177
 
    success = FALSE;
178
 
 
179
 
  font_name = (gchar *) args[1].value.pdb_pointer;
180
 
  if (font_name == NULL || !g_utf8_validate (font_name, -1, NULL))
181
 
    success = FALSE;
 
96
  const gchar *font_callback;
 
97
  const gchar *font_name;
 
98
 
 
99
  font_callback = g_value_get_string (&args->values[0]);
 
100
  font_name = g_value_get_string (&args->values[1]);
182
101
 
183
102
  if (success)
184
103
    {
185
104
      if (gimp->no_interface ||
186
 
          ! procedural_db_lookup (gimp, font_callback) ||
 
105
          ! gimp_pdb_lookup_procedure (gimp->pdb, font_callback) ||
187
106
          ! gimp_pdb_dialog_set (gimp, gimp->fonts, font_callback, font_name,
188
107
                                 NULL))
189
108
        success = FALSE;
190
109
    }
191
110
 
192
 
  return procedural_db_return_args (&fonts_set_popup_proc, success);
193
 
}
194
 
 
195
 
static ProcArg fonts_set_popup_inargs[] =
196
 
{
197
 
  {
198
 
    GIMP_PDB_STRING,
199
 
    "font_callback",
200
 
    "The name of the callback registered for this popup"
201
 
  },
202
 
  {
203
 
    GIMP_PDB_STRING,
204
 
    "font_name",
205
 
    "The name of the font to set as selected"
206
 
  }
207
 
};
208
 
 
209
 
static ProcRecord fonts_set_popup_proc =
210
 
{
211
 
  "gimp_fonts_set_popup",
212
 
  "Sets the current font selection in a popup.",
213
 
  "Sets the current font selection in a popup.",
214
 
  "Sven Neumann <sven@gimp.org>",
215
 
  "Sven Neumann",
216
 
  "2003",
217
 
  NULL,
218
 
  GIMP_INTERNAL,
219
 
  2,
220
 
  fonts_set_popup_inargs,
221
 
  0,
222
 
  NULL,
223
 
  { { fonts_set_popup_invoker } }
224
 
};
 
111
  return gimp_procedure_get_return_values (procedure, success);
 
112
}
 
113
 
 
114
void
 
115
register_font_select_procs (GimpPDB *pdb)
 
116
{
 
117
  GimpProcedure *procedure;
 
118
 
 
119
  /*
 
120
   * gimp-fonts-popup
 
121
   */
 
122
  procedure = gimp_procedure_new (fonts_popup_invoker);
 
123
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-fonts-popup");
 
124
  gimp_procedure_set_static_strings (procedure,
 
125
                                     "gimp-fonts-popup",
 
126
                                     "Invokes the Gimp font selection.",
 
127
                                     "This procedure opens the font selection dialog.",
 
128
                                     "Sven Neumann <sven@gimp.org>",
 
129
                                     "Sven Neumann",
 
130
                                     "2003",
 
131
                                     NULL);
 
132
  gimp_procedure_add_argument (procedure,
 
133
                               gimp_param_spec_string ("font-callback",
 
134
                                                       "font callback",
 
135
                                                       "The callback PDB proc to call when font selection is made",
 
136
                                                       FALSE, FALSE,
 
137
                                                       NULL,
 
138
                                                       GIMP_PARAM_READWRITE));
 
139
  gimp_procedure_add_argument (procedure,
 
140
                               gimp_param_spec_string ("popup-title",
 
141
                                                       "popup title",
 
142
                                                       "Title of the font selection dialog",
 
143
                                                       FALSE, FALSE,
 
144
                                                       NULL,
 
145
                                                       GIMP_PARAM_READWRITE));
 
146
  gimp_procedure_add_argument (procedure,
 
147
                               gimp_param_spec_string ("initial-font",
 
148
                                                       "initial font",
 
149
                                                       "The name of the font to set as the first selected",
 
150
                                                       FALSE, TRUE,
 
151
                                                       NULL,
 
152
                                                       GIMP_PARAM_READWRITE));
 
153
  gimp_pdb_register_procedure (pdb, procedure);
 
154
  g_object_unref (procedure);
 
155
 
 
156
  /*
 
157
   * gimp-fonts-close-popup
 
158
   */
 
159
  procedure = gimp_procedure_new (fonts_close_popup_invoker);
 
160
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-fonts-close-popup");
 
161
  gimp_procedure_set_static_strings (procedure,
 
162
                                     "gimp-fonts-close-popup",
 
163
                                     "Close the font selection dialog.",
 
164
                                     "This procedure closes an opened font selection dialog.",
 
165
                                     "Sven Neumann <sven@gimp.org>",
 
166
                                     "Sven Neumann",
 
167
                                     "2003",
 
168
                                     NULL);
 
169
  gimp_procedure_add_argument (procedure,
 
170
                               gimp_param_spec_string ("font-callback",
 
171
                                                       "font callback",
 
172
                                                       "The name of the callback registered for this pop-up",
 
173
                                                       FALSE, FALSE,
 
174
                                                       NULL,
 
175
                                                       GIMP_PARAM_READWRITE));
 
176
  gimp_pdb_register_procedure (pdb, procedure);
 
177
  g_object_unref (procedure);
 
178
 
 
179
  /*
 
180
   * gimp-fonts-set-popup
 
181
   */
 
182
  procedure = gimp_procedure_new (fonts_set_popup_invoker);
 
183
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-fonts-set-popup");
 
184
  gimp_procedure_set_static_strings (procedure,
 
185
                                     "gimp-fonts-set-popup",
 
186
                                     "Sets the current font in a font selection dialog.",
 
187
                                     "Sets the current font in a font selection dialog.",
 
188
                                     "Sven Neumann <sven@gimp.org>",
 
189
                                     "Sven Neumann",
 
190
                                     "2003",
 
191
                                     NULL);
 
192
  gimp_procedure_add_argument (procedure,
 
193
                               gimp_param_spec_string ("font-callback",
 
194
                                                       "font callback",
 
195
                                                       "The name of the callback registered for this pop-up",
 
196
                                                       FALSE, FALSE,
 
197
                                                       NULL,
 
198
                                                       GIMP_PARAM_READWRITE));
 
199
  gimp_procedure_add_argument (procedure,
 
200
                               gimp_param_spec_string ("font-name",
 
201
                                                       "font name",
 
202
                                                       "The name of the font to set as selected",
 
203
                                                       FALSE, FALSE,
 
204
                                                       NULL,
 
205
                                                       GIMP_PARAM_READWRITE));
 
206
  gimp_pdb_register_procedure (pdb, procedure);
 
207
  g_object_unref (procedure);
 
208
}