renamed parameters to be consistent with the other foo-select.* files.

2002-03-13  Michael Natterer  <mitch@gimp.org>

	* app/gui/brush-select.[ch]: renamed parameters to be consistent
	with the other foo-select.* files.

	* app/gui/tool-options-dialog.c: removed unused function.

	* app/plug-in/plug-in-types.h: PlugInImageType was accidentially
	exported to the PDB.

	* tools/pdbgen/enums.pl
	* libgimp/gimpenums.h
	* plug-ins/script-fu/script-fu-constants.c: regenerated.

	More brush, pattern, ... PDB wrapper cleanup:

	* tools/pdbgen/pdb/brush_select.pdb
	* tools/pdbgen/pdb/gradient_select.pdb
	* tools/pdbgen/pdb/palette_select.pdb
	* tools/pdbgen/pdb/pattern_select.pdb: even more cleanup, guard
	all functions with if(!gimp->no_interface).

	* tools/pdbgen/pdb/brushes.pdb
	* tools/pdbgen/pdb/gradients.pdb
	* tools/pdbgen/pdb/palettes.pdb
	* tools/pdbgen/pdb/patterns.pdb: reordered functions to be
	consistent across all files. Generate libgimp wrappers for *all*
	functions because of API symmetry.

	* tools/pdbgen/pdb/gradients.pdb: renamed gradients_[get|set]_active
	to gradients_[get|set]_gradient because of API symmetry.

	* libgimp/gimpcompat.h: added the old function names here, guard
	the whole file with GIMP_ENABLE_COMPAT_CRUFT (it's back, yeah).

	* plug-ins/FractalExplorer/Dialogs.c
	* plug-ins/gflare/gflare.c: use the new function names.

	* libgimp/gimpbrushes_pdb.[ch]
	* libgimp/gimpgradients_pdb.[ch]
	* libgimp/gimppalettes_pdb.[ch]
	* libgimp/gimppatterns_pdb.[ch]
	* app/pdb/brush_select_cmds.c
	* app/pdb/brushes_cmds.c
	* app/pdb/gradient_select_cmds.c
	* app/pdb/gradients_cmds.c
	* app/pdb/palette_select_cmds.c
	* app/pdb/palettes_cmds.c
	* app/pdb/pattern_select_cmds.c
	* app/pdb/patterns_cmds.c: regenerated.
This commit is contained in:
Michael Natterer 2002-03-13 15:29:59 +00:00 committed by Michael Natterer
parent fb9b034490
commit 4fc885d4f0
36 changed files with 1153 additions and 650 deletions

View File

@ -1,3 +1,54 @@
2002-03-13 Michael Natterer <mitch@gimp.org>
* app/gui/brush-select.[ch]: renamed parameters to be consistent
with the other foo-select.* files.
* app/gui/tool-options-dialog.c: removed unused function.
* app/plug-in/plug-in-types.h: PlugInImageType was accidentially
exported to the PDB.
* tools/pdbgen/enums.pl
* libgimp/gimpenums.h
* plug-ins/script-fu/script-fu-constants.c: regenerated.
More brush, pattern, ... PDB wrapper cleanup:
* tools/pdbgen/pdb/brush_select.pdb
* tools/pdbgen/pdb/gradient_select.pdb
* tools/pdbgen/pdb/palette_select.pdb
* tools/pdbgen/pdb/pattern_select.pdb: even more cleanup, guard
all functions with if(!gimp->no_interface).
* tools/pdbgen/pdb/brushes.pdb
* tools/pdbgen/pdb/gradients.pdb
* tools/pdbgen/pdb/palettes.pdb
* tools/pdbgen/pdb/patterns.pdb: reordered functions to be
consistent across all files. Generate libgimp wrappers for *all*
functions because of API symmetry.
* tools/pdbgen/pdb/gradients.pdb: renamed gradients_[get|set]_active
to gradients_[get|set]_gradient because of API symmetry.
* libgimp/gimpcompat.h: added the old function names here, guard
the whole file with GIMP_ENABLE_COMPAT_CRUFT (it's back, yeah).
* plug-ins/FractalExplorer/Dialogs.c
* plug-ins/gflare/gflare.c: use the new function names.
* libgimp/gimpbrushes_pdb.[ch]
* libgimp/gimpgradients_pdb.[ch]
* libgimp/gimppalettes_pdb.[ch]
* libgimp/gimppatterns_pdb.[ch]
* app/pdb/brush_select_cmds.c
* app/pdb/brushes_cmds.c
* app/pdb/gradient_select_cmds.c
* app/pdb/gradients_cmds.c
* app/pdb/palette_select_cmds.c
* app/pdb/palettes_cmds.c
* app/pdb/pattern_select_cmds.c
* app/pdb/patterns_cmds.c: regenerated.
2002-03-13 Sven Neumann <sven@gimp.org>
* app/core/core-enums.h: register GimpChannelType and

View File

@ -86,14 +86,14 @@ static GSList *brush_active_dialogs = NULL;
/* public functions */
BrushSelect *
brush_select_new (Gimp *gimp,
GimpContext *context,
const gchar *title,
const gchar *init_name,
gdouble init_opacity,
gint init_spacing,
gint init_mode,
const gchar *callback_name)
brush_select_new (Gimp *gimp,
GimpContext *context,
const gchar *title,
const gchar *initial_brush,
gdouble initial_opacity,
GimpLayerModeEffects initial_mode,
gint initial_spacing,
const gchar *callback_name)
{
BrushSelect *bsp;
GtkWidget *sep;
@ -113,11 +113,11 @@ brush_select_new (Gimp *gimp,
first_call = FALSE;
if (init_name && strlen (init_name))
if (initial_brush && strlen (initial_brush))
{
active = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container,
init_name);
initial_brush);
}
if (! active)
@ -150,9 +150,9 @@ brush_select_new (Gimp *gimp,
}
gimp_context_set_brush (bsp->context, active);
gimp_context_set_paint_mode (bsp->context, init_mode);
gimp_context_set_opacity (bsp->context, init_opacity);
bsp->spacing_value = init_spacing;
gimp_context_set_paint_mode (bsp->context, initial_mode);
gimp_context_set_opacity (bsp->context, initial_opacity);
bsp->spacing_value = initial_spacing;
g_signal_connect (G_OBJECT (bsp->context), "brush_changed",
G_CALLBACK (brush_select_brush_changed),
@ -234,10 +234,10 @@ brush_select_new (Gimp *gimp,
spacing_adj = GIMP_BRUSH_FACTORY_VIEW (bsp->view)->spacing_adjustment;
if (init_spacing >= 0)
if (initial_spacing >= 0)
{
/* Use passed spacing instead of brushes default */
gtk_adjustment_set_value (spacing_adj, init_spacing);
gtk_adjustment_set_value (spacing_adj, initial_spacing);
}
g_signal_connect (G_OBJECT (spacing_adj), "value_changed",

View File

@ -35,17 +35,17 @@ struct _BrushSelect
};
BrushSelect * brush_select_new (Gimp *gimp,
GimpContext *context,
const gchar *title,
const gchar *init_name,
gdouble init_opacity,
gint init_spacing,
gint init_mode,
const gchar *callback_name);
void brush_select_free (BrushSelect *bsp);
BrushSelect * brush_select_new (Gimp *gimp,
GimpContext *context,
const gchar *title,
const gchar *initial_brush,
gdouble initial_opacity,
GimpLayerModeEffects initial_mode,
gint initial_spacing,
const gchar *callback_name);
void brush_select_free (BrushSelect *bsp);
BrushSelect * brush_select_get_by_callback (const gchar *callback_name);
BrushSelect * brush_select_get_by_callback (const gchar *callback_name);
void brush_select_dialogs_check (void);

View File

@ -48,13 +48,9 @@ static void tool_options_dialog_destroy (GtkWidget *widget,
static void tool_options_dialog_tool_changed (GimpContext *context,
GimpToolInfo *tool_info,
gpointer data);
static void tool_options_dialog_drop_tool (GtkWidget *widget,
GimpViewable *viewable,
gpointer data);
static GimpViewable * tool_options_dialog_drag_tool (GtkWidget *widget,
gpointer data);
static void tool_options_dialog_save_callback (GtkWidget *widget,
GimpContext *context);
static void tool_options_dialog_restore_callback (GtkWidget *widget,
@ -249,17 +245,6 @@ tool_options_dialog_drop_tool (GtkWidget *widget,
gimp_context_set_tool (context, GIMP_TOOL_INFO (viewable));
}
GimpViewable *
tool_options_dialog_drag_tool (GtkWidget *widget,
gpointer data)
{
GimpContext *context;
context = GIMP_CONTEXT (data);
return (GimpViewable *) gimp_context_get_tool (context);
}
static void
tool_options_dialog_save_callback (GtkWidget *widget,
GimpContext *context)

View File

@ -62,8 +62,7 @@ brushes_popup_invoker (Gimp *gimp,
gdouble opacity;
gint32 spacing;
gint32 paint_mode;
ProcRecord *prec;
BrushSelect *newdialog;
ProcRecord *proc;
brush_callback = (gchar *) args[0].value.pdb_pointer;
if (brush_callback == NULL)
@ -89,22 +88,23 @@ brushes_popup_invoker (Gimp *gimp,
if (success)
{
if ((prec = procedural_db_lookup (gimp, brush_callback)))
if (! gimp->no_interface &&
(proc = procedural_db_lookup (gimp, brush_callback)))
{
if (initial_brush && strlen (initial_brush))
newdialog = brush_select_new (gimp, NULL, popup_title,
initial_brush,
opacity / 100.0,
spacing,
paint_mode,
brush_callback);
brush_select_new (gimp, NULL, popup_title,
initial_brush,
opacity / 100.0,
paint_mode,
spacing,
brush_callback);
else
newdialog = brush_select_new (gimp, NULL, popup_title,
NULL,
0.0,
0,
0,
brush_callback);
brush_select_new (gimp, NULL, popup_title,
NULL,
0.0,
0,
0,
brush_callback);
}
else
{
@ -171,7 +171,7 @@ brushes_close_popup_invoker (Gimp *gimp,
{
gboolean success = TRUE;
gchar *brush_callback;
ProcRecord *prec;
ProcRecord *proc;
BrushSelect *bsp;
brush_callback = (gchar *) args[0].value.pdb_pointer;
@ -180,7 +180,8 @@ brushes_close_popup_invoker (Gimp *gimp,
if (success)
{
if ((prec = procedural_db_lookup (gimp, brush_callback)) &&
if (! gimp->no_interface &&
(proc = procedural_db_lookup (gimp, brush_callback)) &&
(bsp = brush_select_get_by_callback (brush_callback)))
{
brush_select_free (bsp);
@ -229,7 +230,7 @@ brushes_set_popup_invoker (Gimp *gimp,
gdouble opacity;
gint32 spacing;
gint32 paint_mode;
ProcRecord *prec;
ProcRecord *proc;
BrushSelect *bsp;
brush_callback = (gchar *) args[0].value.pdb_pointer;
@ -254,16 +255,18 @@ brushes_set_popup_invoker (Gimp *gimp,
if (success)
{
if ((prec = procedural_db_lookup (gimp, brush_callback)) &&
if (! gimp->no_interface &&
(proc = procedural_db_lookup (gimp, brush_callback)) &&
(bsp = brush_select_get_by_callback (brush_callback)))
{
GimpObject *object =
GimpBrush *active = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container,
brush_name);
if (object)
success = (active != NULL);
if (success)
{
GimpBrush *active = GIMP_BRUSH (object);
GtkAdjustment *spacing_adj;
spacing_adj = GIMP_BRUSH_FACTORY_VIEW (bsp->view)->spacing_adjustment;
@ -276,8 +279,6 @@ brushes_set_popup_invoker (Gimp *gimp,
gtk_adjustment_set_value (spacing_adj, spacing);
}
else
success = FALSE;
}
else
success = FALSE;

View File

@ -38,6 +38,7 @@
#include "core/gimplist.h"
static ProcRecord brushes_refresh_proc;
static ProcRecord brushes_get_list_proc;
static ProcRecord brushes_get_brush_proc;
static ProcRecord brushes_set_brush_proc;
static ProcRecord brushes_get_opacity_proc;
@ -46,13 +47,13 @@ static ProcRecord brushes_get_spacing_proc;
static ProcRecord brushes_set_spacing_proc;
static ProcRecord brushes_get_paint_mode_proc;
static ProcRecord brushes_set_paint_mode_proc;
static ProcRecord brushes_get_list_proc;
static ProcRecord brushes_get_brush_data_proc;
void
register_brushes_procs (Gimp *gimp)
{
procedural_db_register (gimp, &brushes_refresh_proc);
procedural_db_register (gimp, &brushes_get_list_proc);
procedural_db_register (gimp, &brushes_get_brush_proc);
procedural_db_register (gimp, &brushes_set_brush_proc);
procedural_db_register (gimp, &brushes_get_opacity_proc);
@ -61,7 +62,6 @@ register_brushes_procs (Gimp *gimp)
procedural_db_register (gimp, &brushes_set_spacing_proc);
procedural_db_register (gimp, &brushes_get_paint_mode_proc);
procedural_db_register (gimp, &brushes_set_paint_mode_proc);
procedural_db_register (gimp, &brushes_get_list_proc);
procedural_db_register (gimp, &brushes_get_brush_data_proc);
}
@ -99,6 +99,68 @@ static ProcRecord brushes_refresh_proc =
{ { brushes_refresh_invoker } }
};
static Argument *
brushes_get_list_invoker (Gimp *gimp,
Argument *args)
{
gboolean success = TRUE;
Argument *return_args;
gchar **brushes;
GList *list;
int i = 0;
brushes = g_new (char *, gimp->brush_factory->container->num_children);
for (list = GIMP_LIST (gimp->brush_factory->container)->list;
list;
list = g_list_next (list))
{
brushes[i++] = g_strdup (GIMP_OBJECT (list->data)->name);
}
success = (i > 0);
return_args = procedural_db_return_args (&brushes_get_list_proc, success);
if (success)
{
return_args[1].value.pdb_int = gimp->brush_factory->container->num_children;
return_args[2].value.pdb_pointer = brushes;
}
return return_args;
}
static ProcArg brushes_get_list_outargs[] =
{
{
GIMP_PDB_INT32,
"num_brushes",
"The number of brushes in the brush list"
},
{
GIMP_PDB_STRINGARRAY,
"brush_list",
"The list of brush names"
}
};
static ProcRecord brushes_get_list_proc =
{
"gimp_brushes_get_list",
"Retrieve a complete listing of the available brushes.",
"This procedure returns a complete listing of available GIMP brushes. Each name returned can be used as input to the 'gimp_brushes_set_brush'.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
GIMP_INTERNAL,
0,
NULL,
2,
brushes_get_list_outargs,
{ { brushes_get_list_invoker } }
};
static Argument *
brushes_get_brush_invoker (Gimp *gimp,
Argument *args)
@ -450,68 +512,6 @@ static ProcRecord brushes_set_paint_mode_proc =
{ { brushes_set_paint_mode_invoker } }
};
static Argument *
brushes_get_list_invoker (Gimp *gimp,
Argument *args)
{
gboolean success = TRUE;
Argument *return_args;
gchar **brushes;
GList *list;
int i = 0;
brushes = g_new (char *, gimp->brush_factory->container->num_children);
for (list = GIMP_LIST (gimp->brush_factory->container)->list;
list;
list = g_list_next (list))
{
brushes[i++] = g_strdup (GIMP_OBJECT (list->data)->name);
}
success = (i > 0);
return_args = procedural_db_return_args (&brushes_get_list_proc, success);
if (success)
{
return_args[1].value.pdb_int = gimp->brush_factory->container->num_children;
return_args[2].value.pdb_pointer = brushes;
}
return return_args;
}
static ProcArg brushes_get_list_outargs[] =
{
{
GIMP_PDB_INT32,
"num_brushes",
"The number of brushes in the brush list"
},
{
GIMP_PDB_STRINGARRAY,
"brush_list",
"The list of brush names"
}
};
static ProcRecord brushes_get_list_proc =
{
"gimp_brushes_get_list",
"Retrieve a complete listing of the available brushes.",
"This procedure returns a complete listing of available GIMP brushes. Each name returned can be used as input to the 'gimp_brushes_set_brush'.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
GIMP_INTERNAL,
0,
NULL,
2,
brushes_get_list_outargs,
{ { brushes_get_list_invoker } }
};
static Argument *
brushes_get_brush_data_invoker (Gimp *gimp,
Argument *args)

View File

@ -58,8 +58,7 @@ gradients_popup_invoker (Gimp *gimp,
gchar *popup_title;
gchar *initial_gradient;
gint32 sample_size;
ProcRecord *prec;
GradientSelect *newdialog;
ProcRecord *proc;
gradient_callback = (gchar *) args[0].value.pdb_pointer;
if (gradient_callback == NULL)
@ -77,18 +76,19 @@ gradients_popup_invoker (Gimp *gimp,
if (success)
{
if ((prec = procedural_db_lookup (gimp, gradient_callback)))
if (! gimp->no_interface &&
(proc = procedural_db_lookup (gimp, gradient_callback)))
{
if (initial_gradient && strlen (initial_gradient))
newdialog = gradient_select_new (gimp, NULL, popup_title,
initial_gradient,
gradient_callback,
sample_size);
gradient_select_new (gimp, NULL, popup_title,
initial_gradient,
gradient_callback,
sample_size);
else
newdialog = gradient_select_new (gimp, NULL, popup_title,
NULL,
gradient_callback,
sample_size);
gradient_select_new (gimp, NULL, popup_title,
NULL,
gradient_callback,
sample_size);
}
else
{
@ -154,7 +154,8 @@ gradients_close_popup_invoker (Gimp *gimp,
if (success)
{
if ((prec = procedural_db_lookup (gimp, gradient_callback)) &&
if (! gimp->no_interface &&
(prec = procedural_db_lookup (gimp, gradient_callback)) &&
(gsp = gradient_select_get_by_callback (gradient_callback)))
{
gradient_select_free (gsp);
@ -213,7 +214,8 @@ gradients_set_popup_invoker (Gimp *gimp,
if (success)
{
if ((prec = procedural_db_lookup (gimp, gradient_callback)) &&
if (! gimp->no_interface &&
(prec = procedural_db_lookup (gimp, gradient_callback)) &&
(gsp = gradient_select_get_by_callback (gradient_callback)))
{
GimpGradient *active = NULL;

View File

@ -38,8 +38,8 @@
static ProcRecord gradients_refresh_proc;
static ProcRecord gradients_get_list_proc;
static ProcRecord gradients_get_active_proc;
static ProcRecord gradients_set_active_proc;
static ProcRecord gradients_get_gradient_proc;
static ProcRecord gradients_set_gradient_proc;
static ProcRecord gradients_sample_uniform_proc;
static ProcRecord gradients_sample_custom_proc;
static ProcRecord gradients_get_gradient_data_proc;
@ -49,8 +49,8 @@ register_gradients_procs (Gimp *gimp)
{
procedural_db_register (gimp, &gradients_refresh_proc);
procedural_db_register (gimp, &gradients_get_list_proc);
procedural_db_register (gimp, &gradients_get_active_proc);
procedural_db_register (gimp, &gradients_set_active_proc);
procedural_db_register (gimp, &gradients_get_gradient_proc);
procedural_db_register (gimp, &gradients_set_gradient_proc);
procedural_db_register (gimp, &gradients_sample_uniform_proc);
procedural_db_register (gimp, &gradients_sample_custom_proc);
procedural_db_register (gimp, &gradients_get_gradient_data_proc);
@ -144,15 +144,15 @@ static ProcRecord gradients_get_list_proc =
};
static Argument *
gradients_get_active_invoker (Gimp *gimp,
Argument *args)
gradients_get_gradient_invoker (Gimp *gimp,
Argument *args)
{
gboolean success = TRUE;
Argument *return_args;
success = gimp_context_get_gradient (gimp_get_current_context (gimp)) != NULL;
return_args = procedural_db_return_args (&gradients_get_active_proc, success);
return_args = procedural_db_return_args (&gradients_get_gradient_proc, success);
if (success)
return_args[1].value.pdb_pointer = g_strdup (GIMP_OBJECT (gimp_context_get_gradient (gimp_get_current_context (gimp)))->name);
@ -160,7 +160,7 @@ gradients_get_active_invoker (Gimp *gimp,
return return_args;
}
static ProcArg gradients_get_active_outargs[] =
static ProcArg gradients_get_gradient_outargs[] =
{
{
GIMP_PDB_STRING,
@ -169,9 +169,9 @@ static ProcArg gradients_get_active_outargs[] =
}
};
static ProcRecord gradients_get_active_proc =
static ProcRecord gradients_get_gradient_proc =
{
"gimp_gradients_get_active",
"gimp_gradients_get_gradient",
"Retrieve the name of the active gradient.",
"This procedure returns the name of the active gradient in the gradient editor.",
"Federico Mena Quintero",
@ -181,13 +181,13 @@ static ProcRecord gradients_get_active_proc =
0,
NULL,
1,
gradients_get_active_outargs,
{ { gradients_get_active_invoker } }
gradients_get_gradient_outargs,
{ { gradients_get_gradient_invoker } }
};
static Argument *
gradients_set_active_invoker (Gimp *gimp,
Argument *args)
gradients_set_gradient_invoker (Gimp *gimp,
Argument *args)
{
gboolean success = TRUE;
gchar *name;
@ -212,10 +212,10 @@ gradients_set_active_invoker (Gimp *gimp,
}
}
return procedural_db_return_args (&gradients_set_active_proc, success);
return procedural_db_return_args (&gradients_set_gradient_proc, success);
}
static ProcArg gradients_set_active_inargs[] =
static ProcArg gradients_set_gradient_inargs[] =
{
{
GIMP_PDB_STRING,
@ -224,9 +224,9 @@ static ProcArg gradients_set_active_inargs[] =
}
};
static ProcRecord gradients_set_active_proc =
static ProcRecord gradients_set_gradient_proc =
{
"gimp_gradients_set_active",
"gimp_gradients_set_gradient",
"Sets the specified gradient as the active gradient.",
"This procedure lets you set the specified gradient as the active or \"current\" one. The name is simply a string which corresponds to one of the loaded gradients in the gradient editor. If no matching gradient is found, this procedure will return an error. Otherwise, the specified gradient will become active and will be used for subsequent custom gradient operations.",
"Federico Mena Quintero",
@ -234,10 +234,10 @@ static ProcRecord gradients_set_active_proc =
"1997",
GIMP_INTERNAL,
1,
gradients_set_active_inargs,
gradients_set_gradient_inargs,
0,
NULL,
{ { gradients_set_active_invoker } }
{ { gradients_set_gradient_invoker } }
};
static Argument *

View File

@ -56,8 +56,7 @@ palettes_popup_invoker (Gimp *gimp,
gchar *palette_callback;
gchar *popup_title;
gchar *initial_palette;
ProcRecord *prec;
PaletteSelect *newdialog;
ProcRecord *proc;
palette_callback = (gchar *) args[0].value.pdb_pointer;
if (palette_callback == NULL)
@ -71,16 +70,17 @@ palettes_popup_invoker (Gimp *gimp,
if (success)
{
if ((prec = procedural_db_lookup (gimp, palette_callback)))
if (! gimp->no_interface &&
(proc = procedural_db_lookup (gimp, palette_callback)))
{
if (initial_palette && strlen (initial_palette))
newdialog = palette_select_new (gimp, NULL, popup_title,
initial_palette,
palette_callback);
palette_select_new (gimp, NULL, popup_title,
initial_palette,
palette_callback);
else
newdialog = palette_select_new (gimp, NULL, popup_title,
NULL,
palette_callback);
palette_select_new (gimp, NULL, popup_title,
NULL,
palette_callback);
}
else
{
@ -115,7 +115,7 @@ static ProcRecord palettes_popup_proc =
"gimp_palettes_popup",
"Invokes the Gimp palette selection.",
"This procedure popups the palette selection dialog.",
"Michael Natterer",
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2002",
GIMP_INTERNAL,
@ -132,7 +132,7 @@ palettes_close_popup_invoker (Gimp *gimp,
{
gboolean success = TRUE;
gchar *palette_callback;
ProcRecord *prec;
ProcRecord *proc;
PaletteSelect *psp;
palette_callback = (gchar *) args[0].value.pdb_pointer;
@ -141,7 +141,8 @@ palettes_close_popup_invoker (Gimp *gimp,
if (success)
{
if ((prec = procedural_db_lookup (gimp, palette_callback)) &&
if (! gimp->no_interface &&
(proc = procedural_db_lookup (gimp, palette_callback)) &&
(psp = palette_select_get_by_callback (palette_callback)))
{
palette_select_free (psp);
@ -169,7 +170,7 @@ static ProcRecord palettes_close_popup_proc =
"gimp_palettes_close_popup",
"Popdown the Gimp palette selection.",
"This procedure closes an opened palette selection dialog.",
"Michael Natterer",
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2002",
GIMP_INTERNAL,
@ -187,7 +188,7 @@ palettes_set_popup_invoker (Gimp *gimp,
gboolean success = TRUE;
gchar *palette_callback;
gchar *palette_name;
ProcRecord *prec;
ProcRecord *proc;
PaletteSelect *psp;
palette_callback = (gchar *) args[0].value.pdb_pointer;
@ -200,20 +201,18 @@ palettes_set_popup_invoker (Gimp *gimp,
if (success)
{
if ((prec = procedural_db_lookup (gimp, palette_callback)) &&
if (! gimp->no_interface &&
(proc = procedural_db_lookup (gimp, palette_callback)) &&
(psp = palette_select_get_by_callback (palette_callback)))
{
GimpPalette *active = (GimpPalette *)
gimp_container_get_child_by_name (gimp->palette_factory->container,
palette_name);
if (active)
{
/* Must alter the wigdets on screen as well */
gimp_context_set_palette (psp->context, active);
}
else
success = FALSE;
success = (active != NULL);
if (success)
gimp_context_set_palette (psp->context, active);
}
else
success = FALSE;
@ -241,7 +240,7 @@ static ProcRecord palettes_set_popup_proc =
"gimp_palettes_set_popup",
"Sets the current palette selection in a popup.",
"Sets the current palette selection in a popup.",
"Michael Natterer",
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2002",
GIMP_INTERNAL,

View File

@ -38,18 +38,18 @@
#include "libgimpcolor/gimpcolor.h"
static ProcRecord palettes_refresh_proc;
static ProcRecord palettes_get_list_proc;
static ProcRecord palettes_get_palette_proc;
static ProcRecord palettes_set_palette_proc;
static ProcRecord palettes_get_list_proc;
static ProcRecord palettes_get_palette_entry_proc;
void
register_palettes_procs (Gimp *gimp)
{
procedural_db_register (gimp, &palettes_refresh_proc);
procedural_db_register (gimp, &palettes_get_list_proc);
procedural_db_register (gimp, &palettes_get_palette_proc);
procedural_db_register (gimp, &palettes_set_palette_proc);
procedural_db_register (gimp, &palettes_get_list_proc);
procedural_db_register (gimp, &palettes_get_palette_entry_proc);
}
@ -87,6 +87,68 @@ static ProcRecord palettes_refresh_proc =
{ { palettes_refresh_invoker } }
};
static Argument *
palettes_get_list_invoker (Gimp *gimp,
Argument *args)
{
gboolean success = TRUE;
Argument *return_args;
gchar **palettes;
GList *list;
gint i = 0;
palettes = g_new (gchar *, gimp->palette_factory->container->num_children);
for (list = GIMP_LIST (gimp->palette_factory->container)->list;
list;
list = g_list_next (list))
{
palettes[i++] = g_strdup (GIMP_OBJECT (list->data)->name);
}
success = (i > 0);
return_args = procedural_db_return_args (&palettes_get_list_proc, success);
if (success)
{
return_args[1].value.pdb_int = gimp->palette_factory->container->num_children;
return_args[2].value.pdb_pointer = palettes;
}
return return_args;
}
static ProcArg palettes_get_list_outargs[] =
{
{
GIMP_PDB_INT32,
"num_palettes",
"The number of palettes in the list"
},
{
GIMP_PDB_STRINGARRAY,
"palette_list",
"The list of palette names"
}
};
static ProcRecord palettes_get_list_proc =
{
"gimp_palettes_get_list",
"Retrieves a list of all of the available palettes",
"This procedure returns a complete listing of available palettes. Each name returned can be used as input to the command 'gimp_palette_set_palette'.",
"Nathan Summers <rock@gimp.org>",
"Nathan Summers",
"2001",
GIMP_INTERNAL,
0,
NULL,
2,
palettes_get_list_outargs,
{ { palettes_get_list_invoker } }
};
static Argument *
palettes_get_palette_invoker (Gimp *gimp,
Argument *args)
@ -189,68 +251,6 @@ static ProcRecord palettes_set_palette_proc =
{ { palettes_set_palette_invoker } }
};
static Argument *
palettes_get_list_invoker (Gimp *gimp,
Argument *args)
{
gboolean success = TRUE;
Argument *return_args;
gchar **palettes;
GList *list;
gint i = 0;
palettes = g_new (gchar *, gimp->palette_factory->container->num_children);
for (list = GIMP_LIST (gimp->palette_factory->container)->list;
list;
list = g_list_next (list))
{
palettes[i++] = g_strdup (GIMP_OBJECT (list->data)->name);
}
success = (i > 0);
return_args = procedural_db_return_args (&palettes_get_list_proc, success);
if (success)
{
return_args[1].value.pdb_int = gimp->palette_factory->container->num_children;
return_args[2].value.pdb_pointer = palettes;
}
return return_args;
}
static ProcArg palettes_get_list_outargs[] =
{
{
GIMP_PDB_INT32,
"num_palettes",
"The number of palettes in the list"
},
{
GIMP_PDB_STRINGARRAY,
"palette_list",
"The list of palette names"
}
};
static ProcRecord palettes_get_list_proc =
{
"gimp_palettes_get_list",
"Retrieves a list of all of the available palettes",
"This procedure returns a complete listing of available palettes. Each name returned can be used as input to the command 'gimp_palette_set_palette'.",
"Nathan Summers <rock@gimp.org>",
"Nathan Summers",
"2001",
GIMP_INTERNAL,
0,
NULL,
2,
palettes_get_list_outargs,
{ { palettes_get_list_invoker } }
};
static Argument *
palettes_get_palette_entry_invoker (Gimp *gimp,
Argument *args)

View File

@ -56,8 +56,7 @@ patterns_popup_invoker (Gimp *gimp,
gchar *pattern_callback;
gchar *popup_title;
gchar *initial_pattern;
ProcRecord *prec;
PatternSelect *newdialog;
ProcRecord *proc;
pattern_callback = (gchar *) args[0].value.pdb_pointer;
if (pattern_callback == NULL)
@ -71,16 +70,17 @@ patterns_popup_invoker (Gimp *gimp,
if (success)
{
if ((prec = procedural_db_lookup (gimp, pattern_callback)))
if (! gimp->no_interface &&
(proc = procedural_db_lookup (gimp, pattern_callback)))
{
if (initial_pattern && strlen (initial_pattern))
newdialog = pattern_select_new (gimp, NULL, popup_title,
initial_pattern,
pattern_callback);
pattern_select_new (gimp, NULL, popup_title,
initial_pattern,
pattern_callback);
else
newdialog = pattern_select_new (gimp, NULL, popup_title,
NULL,
pattern_callback);
pattern_select_new (gimp, NULL, popup_title,
NULL,
pattern_callback);
}
else
{
@ -132,7 +132,7 @@ patterns_close_popup_invoker (Gimp *gimp,
{
gboolean success = TRUE;
gchar *pattern_callback;
ProcRecord *prec;
ProcRecord *proc;
PatternSelect *psp;
pattern_callback = (gchar *) args[0].value.pdb_pointer;
@ -141,7 +141,8 @@ patterns_close_popup_invoker (Gimp *gimp,
if (success)
{
if ((prec = procedural_db_lookup (gimp, pattern_callback)) &&
if (! gimp->no_interface &&
(proc = procedural_db_lookup (gimp, pattern_callback)) &&
(psp = pattern_select_get_by_callback (pattern_callback)))
{
pattern_select_free (psp);
@ -187,7 +188,7 @@ patterns_set_popup_invoker (Gimp *gimp,
gboolean success = TRUE;
gchar *pattern_callback;
gchar *pattern_name;
ProcRecord *prec;
ProcRecord *proc;
PatternSelect *psp;
pattern_callback = (gchar *) args[0].value.pdb_pointer;
@ -200,20 +201,18 @@ patterns_set_popup_invoker (Gimp *gimp,
if (success)
{
if ((prec = procedural_db_lookup (gimp, pattern_callback)) &&
if (! gimp->no_interface &&
(proc = procedural_db_lookup (gimp, pattern_callback)) &&
(psp = pattern_select_get_by_callback (pattern_callback)))
{
GimpPattern *active = (GimpPattern *)
gimp_container_get_child_by_name (gimp->pattern_factory->container,
pattern_name);
if (active)
{
/* Must alter the wigdets on screen as well */
gimp_context_set_pattern (psp->context, active);
}
else
success = FALSE;
success = (active != NULL);
if (success)
gimp_context_set_pattern (psp->context, active);
}
else
success = FALSE;

View File

@ -37,18 +37,18 @@
#include "core/gimppattern.h"
static ProcRecord patterns_refresh_proc;
static ProcRecord patterns_get_list_proc;
static ProcRecord patterns_get_pattern_proc;
static ProcRecord patterns_set_pattern_proc;
static ProcRecord patterns_get_list_proc;
static ProcRecord patterns_get_pattern_data_proc;
void
register_patterns_procs (Gimp *gimp)
{
procedural_db_register (gimp, &patterns_refresh_proc);
procedural_db_register (gimp, &patterns_get_list_proc);
procedural_db_register (gimp, &patterns_get_pattern_proc);
procedural_db_register (gimp, &patterns_set_pattern_proc);
procedural_db_register (gimp, &patterns_get_list_proc);
procedural_db_register (gimp, &patterns_get_pattern_data_proc);
}
@ -77,6 +77,68 @@ static ProcRecord patterns_refresh_proc =
{ { patterns_refresh_invoker } }
};
static Argument *
patterns_get_list_invoker (Gimp *gimp,
Argument *args)
{
gboolean success = TRUE;
Argument *return_args;
gchar **patterns;
GList *list;
gint i = 0;
patterns = g_new (gchar *, gimp->pattern_factory->container->num_children);
for (list = GIMP_LIST (gimp->pattern_factory->container)->list;
list;
list = g_list_next (list))
{
patterns[i++] = g_strdup (GIMP_OBJECT (list->data)->name);
}
success = (i > 0);
return_args = procedural_db_return_args (&patterns_get_list_proc, success);
if (success)
{
return_args[1].value.pdb_int = gimp->pattern_factory->container->num_children;
return_args[2].value.pdb_pointer = patterns;
}
return return_args;
}
static ProcArg patterns_get_list_outargs[] =
{
{
GIMP_PDB_INT32,
"num_patterns",
"The number of patterns in the pattern list"
},
{
GIMP_PDB_STRINGARRAY,
"pattern_list",
"The list of pattern names"
}
};
static ProcRecord patterns_get_list_proc =
{
"gimp_patterns_get_list",
"Retrieve a complete listing of the available patterns.",
"This procedure returns a complete listing of available GIMP patterns. Each name returned can be used as input to the 'gimp_patterns_set_pattern'.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
GIMP_INTERNAL,
0,
NULL,
2,
patterns_get_list_outargs,
{ { patterns_get_list_invoker } }
};
static Argument *
patterns_get_pattern_invoker (Gimp *gimp,
Argument *args)
@ -185,68 +247,6 @@ static ProcRecord patterns_set_pattern_proc =
{ { patterns_set_pattern_invoker } }
};
static Argument *
patterns_get_list_invoker (Gimp *gimp,
Argument *args)
{
gboolean success = TRUE;
Argument *return_args;
gchar **patterns;
GList *list;
gint i = 0;
patterns = g_new (gchar *, gimp->pattern_factory->container->num_children);
for (list = GIMP_LIST (gimp->pattern_factory->container)->list;
list;
list = g_list_next (list))
{
patterns[i++] = g_strdup (GIMP_OBJECT (list->data)->name);
}
success = (i > 0);
return_args = procedural_db_return_args (&patterns_get_list_proc, success);
if (success)
{
return_args[1].value.pdb_int = gimp->pattern_factory->container->num_children;
return_args[2].value.pdb_pointer = patterns;
}
return return_args;
}
static ProcArg patterns_get_list_outargs[] =
{
{
GIMP_PDB_INT32,
"num_patterns",
"The number of patterns in the pattern list"
},
{
GIMP_PDB_STRINGARRAY,
"pattern_list",
"The list of pattern names"
}
};
static ProcRecord patterns_get_list_proc =
{
"gimp_patterns_get_list",
"Retrieve a complete listing of the available patterns.",
"This procedure returns a complete listing of available GIMP patterns. Each name returned can be used as input to the 'gimp_patterns_set_pattern'.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
GIMP_INTERNAL,
0,
NULL,
2,
patterns_get_list_outargs,
{ { patterns_get_list_invoker } }
};
static Argument *
patterns_get_pattern_data_invoker (Gimp *gimp,
Argument *args)

View File

@ -29,7 +29,7 @@ typedef enum
GIMP_RUN_WITH_LAST_VALS
} GimpRunMode;
typedef enum
typedef enum /*< pdb-skip >*/ /*< skip >*/
{
PLUG_IN_RGB_IMAGE = 1 << 0,
PLUG_IN_GRAY_IMAGE = 1 << 1,

View File

@ -48,13 +48,9 @@ static void tool_options_dialog_destroy (GtkWidget *widget,
static void tool_options_dialog_tool_changed (GimpContext *context,
GimpToolInfo *tool_info,
gpointer data);
static void tool_options_dialog_drop_tool (GtkWidget *widget,
GimpViewable *viewable,
gpointer data);
static GimpViewable * tool_options_dialog_drag_tool (GtkWidget *widget,
gpointer data);
static void tool_options_dialog_save_callback (GtkWidget *widget,
GimpContext *context);
static void tool_options_dialog_restore_callback (GtkWidget *widget,
@ -249,17 +245,6 @@ tool_options_dialog_drop_tool (GtkWidget *widget,
gimp_context_set_tool (context, GIMP_TOOL_INFO (viewable));
}
GimpViewable *
tool_options_dialog_drag_tool (GtkWidget *widget,
gpointer data)
{
GimpContext *context;
context = GIMP_CONTEXT (data);
return (GimpViewable *) gimp_context_get_tool (context);
}
static void
tool_options_dialog_save_callback (GtkWidget *widget,
GimpContext *context)

View File

@ -25,6 +25,337 @@
#include "gimp.h"
/**
* gimp_brushes_refresh:
*
* Refresh current brushes.
*
* This procedure retrieves all brushes currently in the user's brush
* path and updates the brush dialog accordingly.
*
* Returns: TRUE on success.
*/
gboolean
gimp_brushes_refresh (void)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp_brushes_refresh",
&nreturn_vals,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_brushes_get_list:
* @num_brushes: The number of brushes in the brush list.
*
* Retrieve a complete listing of the available brushes.
*
* This procedure returns a complete listing of available GIMP brushes.
* Each name returned can be used as input to the
* 'gimp_brushes_set_brush'.
*
* Returns: The list of brush names.
*/
gchar **
gimp_brushes_get_list (gint *num_brushes)
{
GimpParam *return_vals;
gint nreturn_vals;
gchar **brush_list = NULL;
gint i;
return_vals = gimp_run_procedure ("gimp_brushes_get_list",
&nreturn_vals,
GIMP_PDB_END);
*num_brushes = 0;
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
{
*num_brushes = return_vals[1].data.d_int32;
brush_list = g_new (gchar *, *num_brushes);
for (i = 0; i < *num_brushes; i++)
brush_list[i] = g_strdup (return_vals[2].data.d_stringarray[i]);
}
gimp_destroy_params (return_vals, nreturn_vals);
return brush_list;
}
/**
* gimp_brushes_get_brush:
* @width: The brush width.
* @height: The brush height.
* @spacing: The brush spacing.
*
* Retrieve information about the currently active brush mask.
*
* This procedure retrieves information about the currently active
* brush mask. This includes the brush name, the width and height, and
* the brush spacing paramter. All paint operations and stroke
* operations use this mask to control the application of paint to the
* image.
*
* Returns: The brush name.
*/
gchar *
gimp_brushes_get_brush (gint *width,
gint *height,
gint *spacing)
{
GimpParam *return_vals;
gint nreturn_vals;
gchar *name = NULL;
return_vals = gimp_run_procedure ("gimp_brushes_get_brush",
&nreturn_vals,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
{
name = g_strdup (return_vals[1].data.d_string);
*width = return_vals[2].data.d_int32;
*height = return_vals[3].data.d_int32;
*spacing = return_vals[4].data.d_int32;
}
gimp_destroy_params (return_vals, nreturn_vals);
return name;
}
/**
* gimp_brushes_set_brush:
* @name: The brush name.
*
* Set the specified brush as the active brush.
*
* This procedure allows the active brush mask to be set by specifying
* its name. The name is simply a string which corresponds to one of
* the names of the installed brushes. If there is no matching brush
* found, this procedure will return an error. Otherwise, the specified
* brush becomes active and will be used in all subsequent paint
* operations.
*
* Returns: TRUE on success.
*/
gboolean
gimp_brushes_set_brush (gchar *name)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp_brushes_set_brush",
&nreturn_vals,
GIMP_PDB_STRING, name,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_brushes_get_opacity:
*
* Get the brush opacity.
*
* This procedure returns the opacity setting for brushes. This value
* is set globally and will remain the same even if the brush mask is
* changed. The return value is a floating point number between 0 and
* 100.
*
* Returns: The brush opacity.
*/
gdouble
gimp_brushes_get_opacity (void)
{
GimpParam *return_vals;
gint nreturn_vals;
gdouble opacity = 0;
return_vals = gimp_run_procedure ("gimp_brushes_get_opacity",
&nreturn_vals,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
opacity = return_vals[1].data.d_float;
gimp_destroy_params (return_vals, nreturn_vals);
return opacity;
}
/**
* gimp_brushes_set_opacity:
* @opacity: The brush opacity.
*
* Set the brush opacity.
*
* This procedure modifies the opacity setting for brushes. This value
* is set globally and will remain the same even if the brush mask is
* changed. The value should be a floating point number between 0 and
* 100.
*
* Returns: TRUE on success.
*/
gboolean
gimp_brushes_set_opacity (gdouble opacity)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp_brushes_set_opacity",
&nreturn_vals,
GIMP_PDB_FLOAT, opacity,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_brushes_get_spacing:
*
* Get the brush spacing.
*
* This procedure returns the spacing setting for brushes. This value
* is set per brush and will change if a different brush is selected.
* The return value is an integer between 0 and 1000 which represents
* percentage of the maximum of the width and height of the mask.
*
* Returns: The brush spacing.
*/
gint
gimp_brushes_get_spacing (void)
{
GimpParam *return_vals;
gint nreturn_vals;
gint spacing = 0;
return_vals = gimp_run_procedure ("gimp_brushes_get_spacing",
&nreturn_vals,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
spacing = return_vals[1].data.d_int32;
gimp_destroy_params (return_vals, nreturn_vals);
return spacing;
}
/**
* gimp_brushes_set_spacing:
* @spacing: The brush spacing.
*
* Set the brush spacing.
*
* This procedure modifies the spacing setting for the current brush.
* This value is set on a per-brush basis and will change if a
* different brush mask is selected. The value should be a integer
* between 0 and 1000.
*
* Returns: TRUE on success.
*/
gboolean
gimp_brushes_set_spacing (gint spacing)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp_brushes_set_spacing",
&nreturn_vals,
GIMP_PDB_INT32, spacing,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_brushes_get_paint_mode:
*
* Get the brush paint mode.
*
* This procedure returns the paint-mode setting for brushes. This
* value is set globally and will not change if a different brush is
* selected. The return value is an integer which corresponds to the
* values listed in the argument description.
*
* Returns: The paint mode.
*/
GimpLayerModeEffects
gimp_brushes_get_paint_mode (void)
{
GimpParam *return_vals;
gint nreturn_vals;
GimpLayerModeEffects paint_mode = 0;
return_vals = gimp_run_procedure ("gimp_brushes_get_paint_mode",
&nreturn_vals,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
paint_mode = return_vals[1].data.d_int32;
gimp_destroy_params (return_vals, nreturn_vals);
return paint_mode;
}
/**
* gimp_brushes_set_paint_mode:
* @paint_mode: The paint mode.
*
* Set the brush paint mode.
*
* This procedure modifies the paint_mode setting for the current
* brush. This value is set globally and will not change if a different
* brush mask is selected.
*
* Returns: TRUE on success.
*/
gboolean
gimp_brushes_set_paint_mode (GimpLayerModeEffects paint_mode)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp_brushes_set_paint_mode",
&nreturn_vals,
GIMP_PDB_INT32, paint_mode,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_brushes_get_brush_data:
* @name: the brush name (\"\" means current active pattern).

View File

@ -29,14 +29,26 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
gchar* gimp_brushes_get_brush_data (gchar *name,
gdouble *opacity,
gint *spacing,
GimpLayerModeEffects *paint_mode,
gint *width,
gint *height,
gint *length,
guint8 **mask_data);
gboolean gimp_brushes_refresh (void);
gchar** gimp_brushes_get_list (gint *num_brushes);
gchar* gimp_brushes_get_brush (gint *width,
gint *height,
gint *spacing);
gboolean gimp_brushes_set_brush (gchar *name);
gdouble gimp_brushes_get_opacity (void);
gboolean gimp_brushes_set_opacity (gdouble opacity);
gint gimp_brushes_get_spacing (void);
gboolean gimp_brushes_set_spacing (gint spacing);
GimpLayerModeEffects gimp_brushes_get_paint_mode (void);
gboolean gimp_brushes_set_paint_mode (GimpLayerModeEffects paint_mode);
gchar* gimp_brushes_get_brush_data (gchar *name,
gdouble *opacity,
gint *spacing,
GimpLayerModeEffects *paint_mode,
gint *width,
gint *height,
gint *length,
guint8 **mask_data);
G_END_DECLS

View File

@ -23,6 +23,8 @@
#ifndef __GIMP_COMPAT_H__
#define __GIMP_COMPAT_H__
#ifdef GIMP_ENABLE_COMPAT_CRUFT
G_BEGIN_DECLS
/* This file contains aliases that are kept for historical
@ -31,10 +33,19 @@ G_BEGIN_DECLS
* These defines will be removed in the next development cycle.
*/
#define GimpRunModeType GimpRunMode
#define GimpRunModeType GimpRunMode
#define gimp_use_xshm TRUE
#define gimp_color_cube ((guchar *) { 6, 6, 4, 24 })
#define gimp_crop gimp_image_crop
#define gimp_gradients_get_active gimp_gradients_get_gradient
#define gimp_gradients_set_active gimp_gradients_set_gradient
G_END_DECLS
#endif /* GIMP_ENABLE_COMPAT_CRUFT */
#endif /* __GIMP_COMPAT_H__ */

View File

@ -267,16 +267,6 @@ typedef enum
GIMP_INCREMENTAL
} GimpPaintApplicationMode;
typedef enum
{
GIMP_PLUG_IN_RGB_IMAGE = 1 << 0,
GIMP_PLUG_IN_GRAY_IMAGE = 1 << 1,
GIMP_PLUG_IN_INDEXED_IMAGE = 1 << 2,
GIMP_PLUG_IN_RGBA_IMAGE = 1 << 3,
GIMP_PLUG_IN_GRAYA_IMAGE = 1 << 4,
GIMP_PLUG_IN_INDEXEDA_IMAGE = 1 << 5
} GimpPlugInImageType;
typedef enum
{
GIMP_PIXELS,

View File

@ -93,7 +93,7 @@ gimp_gradients_get_list (gint *num_gradients)
}
/**
* gimp_gradients_get_active:
* gimp_gradients_get_gradient:
*
* Retrieve the name of the active gradient.
*
@ -103,13 +103,13 @@ gimp_gradients_get_list (gint *num_gradients)
* Returns: The name of the active gradient.
*/
gchar *
gimp_gradients_get_active (void)
gimp_gradients_get_gradient (void)
{
GimpParam *return_vals;
gint nreturn_vals;
gchar *name = NULL;
return_vals = gimp_run_procedure ("gimp_gradients_get_active",
return_vals = gimp_run_procedure ("gimp_gradients_get_gradient",
&nreturn_vals,
GIMP_PDB_END);
@ -122,7 +122,7 @@ gimp_gradients_get_active (void)
}
/**
* gimp_gradients_set_active:
* gimp_gradients_set_gradient:
* @name: The name of the gradient to set.
*
* Sets the specified gradient as the active gradient.
@ -137,13 +137,13 @@ gimp_gradients_get_active (void)
* Returns: TRUE on success.
*/
gboolean
gimp_gradients_set_active (gchar *name)
gimp_gradients_set_gradient (gchar *name)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp_gradients_set_active",
return_vals = gimp_run_procedure ("gimp_gradients_set_gradient",
&nreturn_vals,
GIMP_PDB_STRING, name,
GIMP_PDB_END);

View File

@ -31,8 +31,8 @@ G_BEGIN_DECLS
gboolean gimp_gradients_refresh (void);
gchar** gimp_gradients_get_list (gint *num_gradients);
gchar* gimp_gradients_get_active (void);
gboolean gimp_gradients_set_active (gchar *name);
gchar* gimp_gradients_get_gradient (void);
gboolean gimp_gradients_set_gradient (gchar *name);
gdouble* gimp_gradients_sample_uniform (gint num_samples);
gdouble* gimp_gradients_sample_custom (gint num_samples,
gdouble *positions);

View File

@ -51,6 +51,45 @@ gimp_palettes_refresh (void)
return success;
}
/**
* gimp_palettes_get_list:
* @num_palettes: The number of palettes in the list.
*
* Retrieves a list of all of the available palettes
*
* This procedure returns a complete listing of available palettes.
* Each name returned can be used as input to the command
* 'gimp_palette_set_palette'.
*
* Returns: The list of palette names.
*/
gchar **
gimp_palettes_get_list (gint *num_palettes)
{
GimpParam *return_vals;
gint nreturn_vals;
gchar **palette_list = NULL;
gint i;
return_vals = gimp_run_procedure ("gimp_palettes_get_list",
&nreturn_vals,
GIMP_PDB_END);
*num_palettes = 0;
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
{
*num_palettes = return_vals[1].data.d_int32;
palette_list = g_new (gchar *, *num_palettes);
for (i = 0; i < *num_palettes; i++)
palette_list[i] = g_strdup (return_vals[2].data.d_stringarray[i]);
}
gimp_destroy_params (return_vals, nreturn_vals);
return palette_list;
}
/**
* gimp_palettes_get_palette:
* @num_colors: The palette num_colors.
@ -118,45 +157,6 @@ gimp_palettes_set_palette (gchar *name)
return success;
}
/**
* gimp_palettes_get_list:
* @num_palettes: The number of palettes in the list.
*
* Retrieves a list of all of the available palettes
*
* This procedure returns a complete listing of available palettes.
* Each name returned can be used as input to the command
* 'gimp_palette_set_palette'.
*
* Returns: The list of palette names.
*/
gchar **
gimp_palettes_get_list (gint *num_palettes)
{
GimpParam *return_vals;
gint nreturn_vals;
gchar **palette_list = NULL;
gint i;
return_vals = gimp_run_procedure ("gimp_palettes_get_list",
&nreturn_vals,
GIMP_PDB_END);
*num_palettes = 0;
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
{
*num_palettes = return_vals[1].data.d_int32;
palette_list = g_new (gchar *, *num_palettes);
for (i = 0; i < *num_palettes; i++)
palette_list[i] = g_strdup (return_vals[2].data.d_stringarray[i]);
}
gimp_destroy_params (return_vals, nreturn_vals);
return palette_list;
}
/**
* gimp_palettes_get_palette_entry:
* @name: the palette name (\"\" means currently active palette).

View File

@ -30,9 +30,9 @@ G_BEGIN_DECLS
gboolean gimp_palettes_refresh (void);
gchar** gimp_palettes_get_list (gint *num_palettes);
gchar* gimp_palettes_get_palette (gint *num_colors);
gboolean gimp_palettes_set_palette (gchar *name);
gchar** gimp_palettes_get_list (gint *num_palettes);
gchar* gimp_palettes_get_palette_entry (gchar *name,
gint entry_num,
gint *num_colors,

View File

@ -25,6 +25,146 @@
#include "gimp.h"
/**
* gimp_patterns_refresh:
*
* Refresh current patterns.
*
* This procedure retrieves all patterns currently in the user's
* pattern path and updates the pattern dialogs accordingly.
*
* Returns: TRUE on success.
*/
gboolean
gimp_patterns_refresh (void)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp_patterns_refresh",
&nreturn_vals,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_patterns_get_list:
* @num_patterns: The number of patterns in the pattern list.
*
* Retrieve a complete listing of the available patterns.
*
* This procedure returns a complete listing of available GIMP
* patterns. Each name returned can be used as input to the
* 'gimp_patterns_set_pattern'.
*
* Returns: The list of pattern names.
*/
gchar **
gimp_patterns_get_list (gint *num_patterns)
{
GimpParam *return_vals;
gint nreturn_vals;
gchar **pattern_list = NULL;
gint i;
return_vals = gimp_run_procedure ("gimp_patterns_get_list",
&nreturn_vals,
GIMP_PDB_END);
*num_patterns = 0;
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
{
*num_patterns = return_vals[1].data.d_int32;
pattern_list = g_new (gchar *, *num_patterns);
for (i = 0; i < *num_patterns; i++)
pattern_list[i] = g_strdup (return_vals[2].data.d_stringarray[i]);
}
gimp_destroy_params (return_vals, nreturn_vals);
return pattern_list;
}
/**
* gimp_patterns_get_pattern:
* @width: The pattern width.
* @height: The pattern height.
*
* Retrieve information about the currently active pattern.
*
* This procedure retrieves information about the currently active
* pattern. This includes the pattern name, and the pattern extents
* (width and height). All clone and bucket-fill operations with
* patterns will use this pattern to control the application of paint
* to the image.
*
* Returns: The pattern name.
*/
gchar *
gimp_patterns_get_pattern (gint *width,
gint *height)
{
GimpParam *return_vals;
gint nreturn_vals;
gchar *name = NULL;
return_vals = gimp_run_procedure ("gimp_patterns_get_pattern",
&nreturn_vals,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
{
name = g_strdup (return_vals[1].data.d_string);
*width = return_vals[2].data.d_int32;
*height = return_vals[3].data.d_int32;
}
gimp_destroy_params (return_vals, nreturn_vals);
return name;
}
/**
* gimp_patterns_set_pattern:
* @name: The pattern name.
*
* Set the specified pattern as the active pattern.
*
* This procedure allows the active pattern mask to be set by
* specifying its name. The name is simply a string which corresponds
* to one of the names of the installed patterns. If there is no
* matching pattern found, this procedure will return an error.
* Otherwise, the specified pattern becomes active and will be used in
* all subsequent paint operations.
*
* Returns: TRUE on success.
*/
gboolean
gimp_patterns_set_pattern (gchar *name)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp_patterns_set_pattern",
&nreturn_vals,
GIMP_PDB_STRING, name,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_patterns_get_pattern_data:
* @name: the pattern name (\"\" means currently active pattern).

View File

@ -29,12 +29,17 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
gchar* gimp_patterns_get_pattern_data (gchar *name,
gint *width,
gint *height,
gint *mask_bpp,
gint *length,
guint8 **mask_data);
gboolean gimp_patterns_refresh (void);
gchar** gimp_patterns_get_list (gint *num_patterns);
gchar* gimp_patterns_get_pattern (gint *width,
gint *height);
gboolean gimp_patterns_set_pattern (gchar *name);
gchar* gimp_patterns_get_pattern_data (gchar *name,
gint *width,
gint *height,
gint *mask_bpp,
gint *length,
guint8 **mask_data);
G_END_DECLS

View File

@ -207,7 +207,7 @@ explorer_number_of_colors_callback (GtkAdjustment *adjustment,
g_free (gradient_samples);
if (gradient_name == NULL)
gradient_name = gimp_gradients_get_active ();
gradient_name = gimp_gradients_get_gradient ();
gimp_gradients_get_gradient_data (gradient_name, wvals.ncolors, &dummy,
&gradient_samples);
@ -893,7 +893,7 @@ explorer_dialog (void)
_("Create a color-map using a gradient from "
"the gradient editor"), NULL);
gradient_name = gimp_gradients_get_active ();
gradient_name = gimp_gradients_get_gradient ();
gradient_samples = gimp_gradients_sample_uniform (wvals.ncolors);
gradient = gimp_gradient_select_widget (_("FractalExplorer Gradient"),
gradient_name,

View File

@ -5292,16 +5292,16 @@ gradient_get_values_real_external (gchar *gradient_name,
gint i;
gint j;
old_name = gimp_gradients_get_active ();
old_name = gimp_gradients_get_gradient ();
gimp_gradients_set_active (gradient_name);
gimp_gradients_set_gradient (gradient_name);
tmp_values = gimp_gradients_sample_uniform (nvalues);
for (i = 0; i < nvalues; i++)
for (j = 0; j < 4; j++)
values[4*i+j] = (guchar) (tmp_values[4*i+j] * 255);
gimp_gradients_set_active (old_name);
gimp_gradients_set_gradient (old_name);
g_free (tmp_values);
g_free (old_name);

View File

@ -232,13 +232,6 @@ init_generated_constants (void)
setvar (cintern ("CONTINUOUS"), flocons (0), NIL);
setvar (cintern ("INCREMENTAL"), flocons (1), NIL);
setvar (cintern ("PLUG-IN-RGB-IMAGE"), flocons (1 << 0), NIL);
setvar (cintern ("PLUG-IN-GRAY-IMAGE"), flocons (1 << 1), NIL);
setvar (cintern ("PLUG-IN-INDEXED-IMAGE"), flocons (1 << 2), NIL);
setvar (cintern ("PLUG-IN-RGBA-IMAGE"), flocons (1 << 3), NIL);
setvar (cintern ("PLUG-IN-GRAYA-IMAGE"), flocons (1 << 4), NIL);
setvar (cintern ("PLUG-IN-INDEXEDA-IMAGE"), flocons (1 << 5), NIL);
setvar (cintern ("PIXELS"), flocons (0), NIL);
setvar (cintern ("POINTS"), flocons (1), NIL);

View File

@ -417,19 +417,6 @@ package Gimp::CodeGen::enums;
GIMP_RUN_NONINTERACTIVE => '1',
GIMP_RUN_WITH_LAST_VALS => '2' }
},
PlugInImageType =>
{ contig => 0,
header => 'plug-in/plug-in-types.h',
symbols => [ qw(PLUG_IN_RGB_IMAGE PLUG_IN_GRAY_IMAGE
PLUG_IN_INDEXED_IMAGE PLUG_IN_RGBA_IMAGE
PLUG_IN_GRAYA_IMAGE PLUG_IN_INDEXEDA_IMAGE) ],
mapping => { PLUG_IN_RGB_IMAGE => '1 << 0',
PLUG_IN_GRAY_IMAGE => '1 << 1',
PLUG_IN_INDEXED_IMAGE => '1 << 2',
PLUG_IN_RGBA_IMAGE => '1 << 3',
PLUG_IN_GRAYA_IMAGE => '1 << 4',
PLUG_IN_INDEXEDA_IMAGE => '1 << 5' }
},
HueRange =>
{ contig => 1,
header => 'tools/gimphuesaturationtool.h',

View File

@ -54,25 +54,26 @@ sub brushes_popup {
);
%invoke = (
vars => [ 'ProcRecord *prec', 'BrushSelect *newdialog' ],
vars => [ 'ProcRecord *proc' ],
code => <<'CODE'
{
if ((prec = procedural_db_lookup (gimp, brush_callback)))
if (! gimp->no_interface &&
(proc = procedural_db_lookup (gimp, brush_callback)))
{
if (initial_brush && strlen (initial_brush))
newdialog = brush_select_new (gimp, NULL, popup_title,
initial_brush,
opacity / 100.0,
spacing,
paint_mode,
brush_callback);
brush_select_new (gimp, NULL, popup_title,
initial_brush,
opacity / 100.0,
paint_mode,
spacing,
brush_callback);
else
newdialog = brush_select_new (gimp, NULL, popup_title,
NULL,
0.0,
0,
0,
brush_callback);
brush_select_new (gimp, NULL, popup_title,
NULL,
0.0,
0,
0,
brush_callback);
}
else
{
@ -96,10 +97,11 @@ sub brushes_close_popup {
);
%invoke = (
vars => [ 'ProcRecord *prec', 'BrushSelect *bsp' ],
vars => [ 'ProcRecord *proc', 'BrushSelect *bsp' ],
code => <<'CODE'
{
if ((prec = procedural_db_lookup (gimp, brush_callback)) &&
if (! gimp->no_interface &&
(proc = procedural_db_lookup (gimp, brush_callback)) &&
(bsp = brush_select_get_by_callback (brush_callback)))
{
brush_select_free (bsp);
@ -132,19 +134,21 @@ sub brushes_set_popup {
headers => [ qw("core/gimpbrush.h" "core/gimplist.h"
"widgets/widgets-types.h"
"widgets/gimpbrushfactoryview.h") ],
vars => [ 'ProcRecord *prec', 'BrushSelect *bsp' ],
vars => [ 'ProcRecord *proc', 'BrushSelect *bsp' ],
code => <<'CODE'
{
if ((prec = procedural_db_lookup (gimp, brush_callback)) &&
if (! gimp->no_interface &&
(proc = procedural_db_lookup (gimp, brush_callback)) &&
(bsp = brush_select_get_by_callback (brush_callback)))
{
GimpObject *object =
GimpBrush *active = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container,
brush_name);
if (object)
success = (active != NULL);
if (success)
{
GimpBrush *active = GIMP_BRUSH (object);
GtkAdjustment *spacing_adj;
spacing_adj = GIMP_BRUSH_FACTORY_VIEW (bsp->view)->spacing_adjustment;
@ -157,8 +161,6 @@ sub brushes_set_popup {
gtk_adjustment_set_value (spacing_adj, spacing);
}
else
success = FALSE;
}
else
success = FALSE;

View File

@ -91,6 +91,45 @@ CODE
);
}
sub brushes_get_list {
$blurb = 'Retrieve a complete listing of the available brushes.';
$help = <<'HELP';
This procedure returns a complete listing of available GIMP brushes. Each name
returned can be used as input to the 'gimp_brushes_set_brush'.
HELP
&std_pdb_misc;
@outargs = (
{ name => 'brush_list', type => 'stringarray',
desc => 'The list of brush names',
alias => 'brushes',
array => { name => 'num_brushes',
desc => 'The number of brushes in the brush list',
alias => 'gimp->brush_factory->container->num_children',
no_declare => 1 } }
);
%invoke = (
vars => [ 'GList *list', 'int i = 0' ],
code => <<'CODE'
{
brushes = g_new (char *, gimp->brush_factory->container->num_children);
for (list = GIMP_LIST (gimp->brush_factory->container)->list;
list;
list = g_list_next (list))
{
brushes[i++] = g_strdup (GIMP_OBJECT (list->data)->name);
}
success = (i > 0);
}
CODE
);
}
sub brushes_get_brush {
$blurb = 'Retrieve information about the currently active brush mask.';
@ -248,45 +287,6 @@ HELP
%invoke = ( code => 'gimp_context_set_paint_mode (gimp_get_current_context (gimp), paint_mode);' );
}
sub brushes_get_list {
$blurb = 'Retrieve a complete listing of the available brushes.';
$help = <<'HELP';
This procedure returns a complete listing of available GIMP brushes. Each name
returned can be used as input to the 'gimp_brushes_set_brush'.
HELP
&std_pdb_misc;
@outargs = (
{ name => 'brush_list', type => 'stringarray',
desc => 'The list of brush names',
alias => 'brushes',
array => { name => 'num_brushes',
desc => 'The number of brushes in the brush list',
alias => 'gimp->brush_factory->container->num_children',
no_declare => 1 } }
);
%invoke = (
vars => [ 'GList *list', 'int i = 0' ],
code => <<'CODE'
{
brushes = g_new (char *, gimp->brush_factory->container->num_children);
for (list = GIMP_LIST (gimp->brush_factory->container)->list;
list;
list = g_list_next (list))
{
brushes[i++] = g_strdup (GIMP_OBJECT (list->data)->name);
}
success = (i > 0);
}
CODE
);
}
sub brushes_get_brush_data {
$blurb = <<'BLURB';
Retrieve information about the currently active brush (including data).
@ -353,11 +353,13 @@ CODE
@headers = qw("core/gimp.h" "core/gimplist.h" "core/gimpbrush.h"
"core/gimpcontext.h" "core/gimpdatafactory.h" "base/temp-buf.h");
@procs = qw(brushes_refresh brushes_get_brush brushes_set_brush
brushes_get_opacity brushes_set_opacity brushes_get_spacing
brushes_set_spacing brushes_get_paint_mode brushes_set_paint_mode
brushes_get_list brushes_get_brush_data);
%exports = (app => [@procs], lib => [$procs[10]]);
@procs = qw(brushes_refresh brushes_get_list
brushes_get_brush brushes_set_brush
brushes_get_opacity brushes_set_opacity
brushes_get_spacing brushes_set_spacing
brushes_get_paint_mode brushes_set_paint_mode
brushes_get_brush_data);
%exports = (app => [@procs], lib => [@procs]);
$desc = 'Brushes';

View File

@ -51,21 +51,22 @@ sub gradients_popup {
);
%invoke = (
vars => [ 'ProcRecord *prec', 'GradientSelect *newdialog' ],
vars => [ 'ProcRecord *proc' ],
code => <<'CODE'
{
if ((prec = procedural_db_lookup (gimp, gradient_callback)))
if (! gimp->no_interface &&
(proc = procedural_db_lookup (gimp, gradient_callback)))
{
if (initial_gradient && strlen (initial_gradient))
newdialog = gradient_select_new (gimp, NULL, popup_title,
initial_gradient,
gradient_callback,
sample_size);
gradient_select_new (gimp, NULL, popup_title,
initial_gradient,
gradient_callback,
sample_size);
else
newdialog = gradient_select_new (gimp, NULL, popup_title,
NULL,
gradient_callback,
sample_size);
gradient_select_new (gimp, NULL, popup_title,
NULL,
gradient_callback,
sample_size);
}
else
{
@ -92,7 +93,8 @@ sub gradients_close_popup {
vars => [ 'ProcRecord *prec', 'GradientSelect *gsp' ],
code => <<'CODE'
{
if ((prec = procedural_db_lookup (gimp, gradient_callback)) &&
if (! gimp->no_interface &&
(prec = procedural_db_lookup (gimp, gradient_callback)) &&
(gsp = gradient_select_get_by_callback (gradient_callback)))
{
gradient_select_free (gsp);
@ -124,7 +126,8 @@ sub gradients_set_popup {
vars => [ 'ProcRecord *prec', 'GradientSelect *gsp' ],
code => <<'CODE'
{
if ((prec = procedural_db_lookup (gimp, gradient_callback)) &&
if (! gimp->no_interface &&
(prec = procedural_db_lookup (gimp, gradient_callback)) &&
(gsp = gradient_select_get_by_callback (gradient_callback)))
{
GimpGradient *active = NULL;

View File

@ -84,7 +84,7 @@ CODE
);
}
sub gradients_get_active {
sub gradients_get_gradient {
$blurb = 'Retrieve the name of the active gradient.';
$help = <<'HELP';
@ -103,7 +103,7 @@ HELP
%invoke = ( code => 'success = gimp_context_get_gradient (gimp_get_current_context (gimp)) != NULL;' );
}
sub gradients_set_active {
sub gradients_set_gradient {
$blurb = 'Sets the specified gradient as the active gradient.';
$help = <<'HELP';
@ -345,7 +345,7 @@ CODE
"core/gimplist.h" "core/gimpgradient.h");
@procs = qw(gradients_refresh gradients_get_list
gradients_get_active gradients_set_active
gradients_get_gradient gradients_set_gradient
gradients_sample_uniform gradients_sample_custom
gradients_get_gradient_data);
%exports = (app => [@procs], lib => [@procs]);

View File

@ -18,7 +18,8 @@
# "Perlized" from C source by Manish Singh <yosh@gimp.org>
sub pdb_misc {
$author = $copyright = 'Michael Natterer';
$author = 'Michael Natterer <mitch@gimp.org>';
$copyright = 'Michael Natterer';
$date = '2002';
}
@ -41,19 +42,20 @@ sub palettes_popup {
);
%invoke = (
vars => [ 'ProcRecord *prec', 'PaletteSelect *newdialog' ],
vars => [ 'ProcRecord *proc' ],
code => <<'CODE'
{
if ((prec = procedural_db_lookup (gimp, palette_callback)))
if (! gimp->no_interface &&
(proc = procedural_db_lookup (gimp, palette_callback)))
{
if (initial_palette && strlen (initial_palette))
newdialog = palette_select_new (gimp, NULL, popup_title,
initial_palette,
palette_callback);
palette_select_new (gimp, NULL, popup_title,
initial_palette,
palette_callback);
else
newdialog = palette_select_new (gimp, NULL, popup_title,
NULL,
palette_callback);
palette_select_new (gimp, NULL, popup_title,
NULL,
palette_callback);
}
else
{
@ -77,10 +79,11 @@ sub palettes_close_popup {
);
%invoke = (
vars => [ 'ProcRecord *prec', 'PaletteSelect *psp' ],
vars => [ 'ProcRecord *proc', 'PaletteSelect *psp' ],
code => <<'CODE'
{
if ((prec = procedural_db_lookup (gimp, palette_callback)) &&
if (! gimp->no_interface &&
(proc = procedural_db_lookup (gimp, palette_callback)) &&
(psp = palette_select_get_by_callback (palette_callback)))
{
palette_select_free (psp);
@ -109,23 +112,21 @@ sub palettes_set_popup {
);
%invoke = (
vars => [ 'ProcRecord *prec', 'PaletteSelect *psp' ],
vars => [ 'ProcRecord *proc', 'PaletteSelect *psp' ],
code => <<'CODE'
{
if ((prec = procedural_db_lookup (gimp, palette_callback)) &&
if (! gimp->no_interface &&
(proc = procedural_db_lookup (gimp, palette_callback)) &&
(psp = palette_select_get_by_callback (palette_callback)))
{
GimpPalette *active = (GimpPalette *)
gimp_container_get_child_by_name (gimp->palette_factory->container,
palette_name);
if (active)
{
/* Must alter the wigdets on screen as well */
gimp_context_set_palette (psp->context, active);
}
else
success = FALSE;
success = (active != NULL);
if (success)
gimp_context_set_palette (psp->context, active);
}
else
success = FALSE;

View File

@ -58,6 +58,8 @@ sub palette_outargs {
}
}
# The defs
sub palettes_refresh {
$blurb = 'Refreshes current palettes.';
@ -85,6 +87,45 @@ CODE
);
}
sub palettes_get_list {
$blurb = 'Retrieves a list of all of the available palettes';
$help = <<'HELP';
This procedure returns a complete listing of available palettes. Each name
returned can be used as input to the command 'gimp_palette_set_palette'.
HELP
&rock_pdb_misc;
@outargs = (
{ name => 'palette_list', type => 'stringarray',
desc => 'The list of palette names',
alias => 'palettes',
array => { name => 'num_palettes',
desc => 'The number of palettes in the list',
alias => 'gimp->palette_factory->container->num_children',
no_declare => 1 } }
);
%invoke = (
vars => [ 'GList *list', 'gint i = 0' ],
code => <<'CODE'
{
palettes = g_new (gchar *, gimp->palette_factory->container->num_children);
for (list = GIMP_LIST (gimp->palette_factory->container)->list;
list;
list = g_list_next (list))
{
palettes[i++] = g_strdup (GIMP_OBJECT (list->data)->name);
}
success = (i > 0);
}
CODE
);
}
sub palettes_get_palette {
$blurb = 'Retrieve information about the currently active palette.';
@ -138,45 +179,6 @@ HELP
CODE
);
}
sub palettes_get_list {
$blurb = 'Retrieves a list of all of the available palettes';
$help = <<'HELP';
This procedure returns a complete listing of available palettes. Each name
returned can be used as input to the command 'gimp_palette_set_palette'.
HELP
&rock_pdb_misc;
@outargs = (
{ name => 'palette_list', type => 'stringarray',
desc => 'The list of palette names',
alias => 'palettes',
array => { name => 'num_palettes',
desc => 'The number of palettes in the list',
alias => 'gimp->palette_factory->container->num_children',
no_declare => 1 } }
);
%invoke = (
vars => [ 'GList *list', 'gint i = 0' ],
code => <<'CODE'
{
palettes = g_new (gchar *, gimp->palette_factory->container->num_children);
for (list = GIMP_LIST (gimp->palette_factory->container)->list;
list;
list = g_list_next (list))
{
palettes[i++] = g_strdup (GIMP_OBJECT (list->data)->name);
}
success = (i > 0);
}
CODE
);
}
sub palettes_get_palette_entry {
$blurb = 'Gets the specified palette entry from the currently active palette.';
@ -246,8 +248,9 @@ CODE
@headers = qw(<string.h> "core/gimp.h" "core/gimpcontext.h" "core/gimplist.h"
"core/gimpdatafactory.h" "core/gimppalette.h");
@procs = qw(palettes_refresh palettes_get_palette palettes_set_palette
palettes_get_list palettes_get_palette_entry);
@procs = qw(palettes_refresh palettes_get_list
palettes_get_palette palettes_set_palette
palettes_get_palette_entry);
%exports = (app => [@procs], lib => [@procs]);
$desc = 'Palettes';

View File

@ -41,19 +41,20 @@ sub patterns_popup {
);
%invoke = (
vars => [ 'ProcRecord *prec', 'PatternSelect *newdialog' ],
vars => [ 'ProcRecord *proc' ],
code => <<'CODE'
{
if ((prec = procedural_db_lookup (gimp, pattern_callback)))
if (! gimp->no_interface &&
(proc = procedural_db_lookup (gimp, pattern_callback)))
{
if (initial_pattern && strlen (initial_pattern))
newdialog = pattern_select_new (gimp, NULL, popup_title,
initial_pattern,
pattern_callback);
pattern_select_new (gimp, NULL, popup_title,
initial_pattern,
pattern_callback);
else
newdialog = pattern_select_new (gimp, NULL, popup_title,
NULL,
pattern_callback);
pattern_select_new (gimp, NULL, popup_title,
NULL,
pattern_callback);
}
else
{
@ -77,10 +78,11 @@ sub patterns_close_popup {
);
%invoke = (
vars => [ 'ProcRecord *prec', 'PatternSelect *psp' ],
vars => [ 'ProcRecord *proc', 'PatternSelect *psp' ],
code => <<'CODE'
{
if ((prec = procedural_db_lookup (gimp, pattern_callback)) &&
if (! gimp->no_interface &&
(proc = procedural_db_lookup (gimp, pattern_callback)) &&
(psp = pattern_select_get_by_callback (pattern_callback)))
{
pattern_select_free (psp);
@ -109,23 +111,21 @@ sub patterns_set_popup {
);
%invoke = (
vars => [ 'ProcRecord *prec', 'PatternSelect *psp' ],
vars => [ 'ProcRecord *proc', 'PatternSelect *psp' ],
code => <<'CODE'
{
if ((prec = procedural_db_lookup (gimp, pattern_callback)) &&
if (! gimp->no_interface &&
(proc = procedural_db_lookup (gimp, pattern_callback)) &&
(psp = pattern_select_get_by_callback (pattern_callback)))
{
GimpPattern *active = (GimpPattern *)
gimp_container_get_child_by_name (gimp->pattern_factory->container,
pattern_name);
if (active)
{
/* Must alter the wigdets on screen as well */
gimp_context_set_pattern (psp->context, active);
}
else
success = FALSE;
success = (active != NULL);
if (success)
gimp_context_set_pattern (psp->context, active);
}
else
success = FALSE;

View File

@ -69,6 +69,45 @@ CODE
);
}
sub patterns_get_list {
$blurb = 'Retrieve a complete listing of the available patterns.';
$help = <<'HELP';
This procedure returns a complete listing of available GIMP patterns. Each name
returned can be used as input to the 'gimp_patterns_set_pattern'.
HELP
&std_pdb_misc;
@outargs = (
{ name => 'pattern_list', type => 'stringarray',
desc => 'The list of pattern names',
alias => 'patterns',
array => { name => 'num_patterns',
desc => 'The number of patterns in the pattern list',
alias => 'gimp->pattern_factory->container->num_children',
no_declare => 1 } }
);
%invoke = (
vars => [ 'GList *list', 'gint i = 0' ],
code => <<'CODE'
{
patterns = g_new (gchar *, gimp->pattern_factory->container->num_children);
for (list = GIMP_LIST (gimp->pattern_factory->container)->list;
list;
list = g_list_next (list))
{
patterns[i++] = g_strdup (GIMP_OBJECT (list->data)->name);
}
success = (i > 0);
}
CODE
);
}
sub patterns_get_pattern {
$blurb = 'Retrieve information about the currently active pattern.';
@ -125,45 +164,6 @@ CODE
);
}
sub patterns_get_list {
$blurb = 'Retrieve a complete listing of the available patterns.';
$help = <<'HELP';
This procedure returns a complete listing of available GIMP patterns. Each name
returned can be used as input to the 'gimp_patterns_set_pattern'.
HELP
&std_pdb_misc;
@outargs = (
{ name => 'pattern_list', type => 'stringarray',
desc => 'The list of pattern names',
alias => 'patterns',
array => { name => 'num_patterns',
desc => 'The number of patterns in the pattern list',
alias => 'gimp->pattern_factory->container->num_children',
no_declare => 1 } }
);
%invoke = (
vars => [ 'GList *list', 'gint i = 0' ],
code => <<'CODE'
{
patterns = g_new (gchar *, gimp->pattern_factory->container->num_children);
for (list = GIMP_LIST (gimp->pattern_factory->container)->list;
list;
list = g_list_next (list))
{
patterns[i++] = g_strdup (GIMP_OBJECT (list->data)->name);
}
success = (i > 0);
}
CODE
);
}
sub patterns_get_pattern_data {
$blurb = <<'BLURB';
Retrieve information about the currently active pattern (including data).
@ -228,9 +228,10 @@ CODE
@headers = qw(<string.h> "core/gimp.h" "core/gimpcontext.h" "core/gimplist.h"
"core/gimpdatafactory.h" "core/gimppattern.h" "base/temp-buf.h");
@procs = qw(patterns_refresh patterns_get_pattern patterns_set_pattern
patterns_get_list patterns_get_pattern_data);
%exports = (app => [@procs], lib => [$procs[4]]);
@procs = qw(patterns_refresh patterns_get_list
patterns_get_pattern patterns_set_pattern
patterns_get_pattern_data);
%exports = (app => [@procs], lib => [@procs]);
$desc = 'Patterns';