24
24
#include <glib-object.h>
26
26
#include "pdb-types.h"
27
#include "procedural_db.h"
28
#include "gimpprocedure.h"
29
#include "core/gimpparamspecs.h"
29
31
#include "core/gimp.h"
31
static ProcRecord fonts_popup_proc;
32
static ProcRecord fonts_close_popup_proc;
33
static ProcRecord fonts_set_popup_proc;
36
register_font_select_procs (Gimp *gimp)
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);
44
fonts_popup_invoker (Gimp *gimp,
46
GimpProgress *progress,
33
#include "internal_procs.h"
37
fonts_popup_invoker (GimpProcedure *procedure,
40
GimpProgress *progress,
41
const GValueArray *args)
49
43
gboolean success = TRUE;
54
font_callback = (gchar *) args[0].value.pdb_pointer;
55
if (font_callback == NULL || !g_utf8_validate (font_callback, -1, NULL))
58
popup_title = (gchar *) args[1].value.pdb_pointer;
59
if (popup_title == NULL || !g_utf8_validate (popup_title, -1, NULL))
62
initial_font = (gchar *) args[2].value.pdb_pointer;
63
if (initial_font && !g_utf8_validate (initial_font, -1, NULL))
44
const gchar *font_callback;
45
const gchar *popup_title;
46
const gchar *initial_font;
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]);
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,
76
return procedural_db_return_args (&fonts_popup_proc, success);
62
return gimp_procedure_get_return_values (procedure, success);
79
static ProcArg fonts_popup_inargs[] =
84
"The callback PDB proc to call when font selection is made"
89
"Title to give the font popup window"
94
"The name of the font to set as the first selected"
98
static ProcRecord fonts_popup_proc =
101
"Invokes the Gimp font selection.",
102
"This procedure popups the font selection dialog.",
103
"Sven Neumann <sven@gimp.org>",
112
{ { fonts_popup_invoker } }
116
fonts_close_popup_invoker (Gimp *gimp,
117
GimpContext *context,
118
GimpProgress *progress,
66
fonts_close_popup_invoker (GimpProcedure *procedure,
69
GimpProgress *progress,
70
const GValueArray *args)
121
72
gboolean success = TRUE;
122
gchar *font_callback;
73
const gchar *font_callback;
124
font_callback = (gchar *) args[0].value.pdb_pointer;
125
if (font_callback == NULL || !g_utf8_validate (font_callback, -1, NULL))
75
font_callback = g_value_get_string (&args->values[0]);
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))
136
return procedural_db_return_args (&fonts_close_popup_proc, success);
85
return gimp_procedure_get_return_values (procedure, success);
139
static ProcArg fonts_close_popup_inargs[] =
144
"The name of the callback registered for this popup"
148
static ProcRecord fonts_close_popup_proc =
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>",
159
fonts_close_popup_inargs,
162
{ { fonts_close_popup_invoker } }
166
fonts_set_popup_invoker (Gimp *gimp,
167
GimpContext *context,
168
GimpProgress *progress,
89
fonts_set_popup_invoker (GimpProcedure *procedure,
92
GimpProgress *progress,
93
const GValueArray *args)
171
95
gboolean success = TRUE;
172
gchar *font_callback;
175
font_callback = (gchar *) args[0].value.pdb_pointer;
176
if (font_callback == NULL || !g_utf8_validate (font_callback, -1, NULL))
179
font_name = (gchar *) args[1].value.pdb_pointer;
180
if (font_name == NULL || !g_utf8_validate (font_name, -1, NULL))
96
const gchar *font_callback;
97
const gchar *font_name;
99
font_callback = g_value_get_string (&args->values[0]);
100
font_name = g_value_get_string (&args->values[1]);
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,
192
return procedural_db_return_args (&fonts_set_popup_proc, success);
195
static ProcArg fonts_set_popup_inargs[] =
200
"The name of the callback registered for this popup"
205
"The name of the font to set as selected"
209
static ProcRecord fonts_set_popup_proc =
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>",
220
fonts_set_popup_inargs,
223
{ { fonts_set_popup_invoker } }
111
return gimp_procedure_get_return_values (procedure, success);
115
register_font_select_procs (GimpPDB *pdb)
117
GimpProcedure *procedure;
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,
126
"Invokes the Gimp font selection.",
127
"This procedure opens the font selection dialog.",
128
"Sven Neumann <sven@gimp.org>",
132
gimp_procedure_add_argument (procedure,
133
gimp_param_spec_string ("font-callback",
135
"The callback PDB proc to call when font selection is made",
138
GIMP_PARAM_READWRITE));
139
gimp_procedure_add_argument (procedure,
140
gimp_param_spec_string ("popup-title",
142
"Title of the font selection dialog",
145
GIMP_PARAM_READWRITE));
146
gimp_procedure_add_argument (procedure,
147
gimp_param_spec_string ("initial-font",
149
"The name of the font to set as the first selected",
152
GIMP_PARAM_READWRITE));
153
gimp_pdb_register_procedure (pdb, procedure);
154
g_object_unref (procedure);
157
* gimp-fonts-close-popup
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>",
169
gimp_procedure_add_argument (procedure,
170
gimp_param_spec_string ("font-callback",
172
"The name of the callback registered for this pop-up",
175
GIMP_PARAM_READWRITE));
176
gimp_pdb_register_procedure (pdb, procedure);
177
g_object_unref (procedure);
180
* gimp-fonts-set-popup
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>",
192
gimp_procedure_add_argument (procedure,
193
gimp_param_spec_string ("font-callback",
195
"The name of the callback registered for this pop-up",
198
GIMP_PARAM_READWRITE));
199
gimp_procedure_add_argument (procedure,
200
gimp_param_spec_string ("font-name",
202
"The name of the font to set as selected",
205
GIMP_PARAM_READWRITE));
206
gimp_pdb_register_procedure (pdb, procedure);
207
g_object_unref (procedure);