diff --git a/ChangeLog b/ChangeLog index dcaf2914ec..9a2a529ddc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,44 @@ +2000-05-31 Michael Natterer + Sven Neumann + + Coming closer to our goal of autogenerating the + libgimp PDB wrappers... + + * app/internal_procs.c + * app/parasite_cmds.c + * tools/pdbgen/pdb/parasite.pdb: removed parasite_new PDB call. + + * libgimp/gimp.h + * libgimp/gimp_pdb.h + * libgimp/gimpbrushmenu.c + * libgimp/gimpcompat.h + * libgimp/gimpdrawable_pdb.[ch] + * libgimp/gimpexport.c + * libgimp/gimpgradientmenu.c + * libgimp/gimpimage_pdb.[ch] + * libgimp/gimpmenu.[ch] + * libgimp/gimpparasite.[ch] + * libgimp/gimpparasite_pdb.[ch] + * libgimp/gimppatternmenu.c + * libgimp/gimpproceduraldb_pdb.[ch]: changes to incorporate the new + files listed below + + * libgimp/Makefile.am + * libgimp/gimpbrushes_pdb.[ch] + * libgimp/gimpbrushselect_pdb.[ch] + * libgimp/gimpconvert_pdb.[ch] + * libgimp/gimpgradientselect_pdb.[ch] + * libgimp/gimppatterns_pdb.[ch] + * libgimp/gimppatternselect_pdb.[ch]: new files partly generated + using pdbgen + + * tools/pdbgen/lib.pl: some adjustments and fixes to the libgimp + pdbgen code + + * tools/pdbgen/pdb/help.pdb + * tools/pdbgen/pdb/pattern_select.pdb: make them generate PDB + wrappers for libgimp too. + 2000-05-31 Michael Natterer Sven Neumann diff --git a/app/internal_procs.c b/app/internal_procs.c index cacbd2db4f..f872336b20 100644 --- a/app/internal_procs.c +++ b/app/internal_procs.c @@ -60,7 +60,7 @@ void register_tools_procs (void); void register_undo_procs (void); void register_unit_procs (void); -/* 323 procedures registered total */ +/* 322 procedures registered total */ void internal_procs_init (void) @@ -80,79 +80,79 @@ internal_procs_init (void) app_init_update_status (NULL, _("Color"), 0.096); register_color_procs (); - app_init_update_status (NULL, _("Convert"), 0.133); + app_init_update_status (NULL, _("Convert"), 0.134); register_convert_procs (); - app_init_update_status (NULL, _("Drawable procedures"), 0.142); + app_init_update_status (NULL, _("Drawable procedures"), 0.143); register_drawable_procs (); app_init_update_status (NULL, _("Edit procedures"), 0.211); register_edit_procs (); - app_init_update_status (NULL, _("File Operations"), 0.229); + app_init_update_status (NULL, _("File Operations"), 0.23); register_fileops_procs (); - app_init_update_status (NULL, _("Floating selections"), 0.254); + app_init_update_status (NULL, _("Floating selections"), 0.255); register_floating_sel_procs (); - app_init_update_status (NULL, _("GDisplay procedures"), 0.272); + app_init_update_status (NULL, _("GDisplay procedures"), 0.273); register_gdisplay_procs (); - app_init_update_status (NULL, _("Image"), 0.282); + app_init_update_status (NULL, _("Image"), 0.283); register_gimage_procs (); - app_init_update_status (NULL, _("Image mask"), 0.464); + app_init_update_status (NULL, _("Image mask"), 0.466); register_gimage_mask_procs (); - app_init_update_status (NULL, _("Gimprc procedures"), 0.517); + app_init_update_status (NULL, _("Gimprc procedures"), 0.519); register_gimprc_procs (); - app_init_update_status (NULL, _("Gradients"), 0.526); + app_init_update_status (NULL, _("Gradients"), 0.528); register_gradient_procs (); - app_init_update_status (NULL, _("Gradient UI"), 0.542); + app_init_update_status (NULL, _("Gradient UI"), 0.543); register_gradient_select_procs (); - app_init_update_status (NULL, _("Guide procedures"), 0.554); + app_init_update_status (NULL, _("Guide procedures"), 0.556); register_guides_procs (); - app_init_update_status (NULL, _("Help procedures"), 0.573); + app_init_update_status (NULL, _("Help procedures"), 0.575); register_help_procs (); - app_init_update_status (NULL, _("Layer"), 0.576); + app_init_update_status (NULL, _("Layer"), 0.578); register_layer_procs (); - app_init_update_status (NULL, _("Interface"), 0.672); + app_init_update_status (NULL, _("Interface"), 0.674); register_message_procs (); - app_init_update_status (NULL, _("Miscellaneous"), 0.681); + app_init_update_status (NULL, _("Miscellaneous"), 0.683); register_misc_procs (); - app_init_update_status (NULL, _("Palette"), 0.687); + app_init_update_status (NULL, _("Palette"), 0.689); register_palette_procs (); - app_init_update_status (NULL, _("Parasite procedures"), 0.709); + app_init_update_status (NULL, _("Parasite procedures"), 0.711); register_parasite_procs (); - app_init_update_status (NULL, _("Paths"), 0.749); + app_init_update_status (NULL, _("Paths"), 0.748); register_paths_procs (); app_init_update_status (NULL, _("Pattern UI"), 0.789); register_pattern_select_procs (); - app_init_update_status (NULL, _("Patterns"), 0.799); + app_init_update_status (NULL, _("Patterns"), 0.798); register_patterns_procs (); app_init_update_status (NULL, _("Plug-in"), 0.811); register_plug_in_procs (); - app_init_update_status (NULL, _("Procedural database"), 0.83); + app_init_update_status (NULL, _("Procedural database"), 0.829); register_procedural_db_procs (); app_init_update_status (NULL, _("Text procedures"), 0.854); register_text_tool_procs (); - app_init_update_status (NULL, _("Tool procedures"), 0.867); + app_init_update_status (NULL, _("Tool procedures"), 0.866); register_tools_procs (); app_init_update_status (NULL, _("Undo"), 0.96); diff --git a/app/parasite_cmds.c b/app/parasite_cmds.c index 5697a893e8..e33e25c0b3 100644 --- a/app/parasite_cmds.c +++ b/app/parasite_cmds.c @@ -27,7 +27,6 @@ #include "libgimp/gimpparasite.h" -static ProcRecord parasite_new_proc; static ProcRecord parasite_find_proc; static ProcRecord parasite_attach_proc; static ProcRecord parasite_detach_proc; @@ -44,7 +43,6 @@ static ProcRecord image_parasite_list_proc; void register_parasite_procs (void) { - procedural_db_register (¶site_new_proc); procedural_db_register (¶site_find_proc); procedural_db_register (¶site_attach_proc); procedural_db_register (¶site_detach_proc); @@ -59,94 +57,6 @@ register_parasite_procs (void) procedural_db_register (&image_parasite_list_proc); } -static Argument * -parasite_new_invoker (Argument *args) -{ - gboolean success = TRUE; - Argument *return_args; - gchar *name; - gint32 flags; - gint32 size; - gchar *data; - GimpParasite *parasite = NULL; - - name = (gchar *) args[0].value.pdb_pointer; - if (name == NULL) - success = FALSE; - - flags = args[1].value.pdb_int; - - size = args[2].value.pdb_int; - if (size < 0) - success = FALSE; - - data = (gchar *) args[3].value.pdb_pointer; - - if (success) - { - if (size > 0 && data == NULL) - success = FALSE; - else - success = (parasite = gimp_parasite_new (name, flags, size, data)) != NULL; - } - - return_args = procedural_db_return_args (¶site_new_proc, success); - - if (success) - return_args[1].value.pdb_pointer = parasite; - - return return_args; -} - -static ProcArg parasite_new_inargs[] = -{ - { - PDB_STRING, - "name", - "The name of the parasite to create" - }, - { - PDB_INT32, - "flags", - "The flags (1 == persistance)" - }, - { - PDB_INT32, - "size", - "The size of the data in bytes" - }, - { - PDB_STRING, - "data", - "The data" - } -}; - -static ProcArg parasite_new_outargs[] = -{ - { - PDB_PARASITE, - "parasite", - "The new parasite" - } -}; - -static ProcRecord parasite_new_proc = -{ - "gimp_parasite_new", - "Creates a new parasite.", - "Creates a new parasite unatached to to any image or drawable.", - "Jay Cox", - "Jay Cox", - "1998", - PDB_INTERNAL, - 4, - parasite_new_inargs, - 1, - parasite_new_outargs, - { { parasite_new_invoker } } -}; - static Argument * parasite_find_invoker (Argument *args) { diff --git a/libgimp/Makefile.am b/libgimp/Makefile.am index 4627831182..ce965a7770 100644 --- a/libgimp/Makefile.am +++ b/libgimp/Makefile.am @@ -81,10 +81,16 @@ libgimp_la_SOURCES = \ gimp.c \ gimp.h \ gimp_pdb.h \ - gimpchannel_pdb.h \ + gimpbrushes_pdb.c \ + gimpbrushes_pdb.h \ + gimpbrushselect_pdb.c \ + gimpbrushselect_pdb.h \ gimpchannel_pdb.c \ + gimpchannel_pdb.h \ gimpcolorspace.c \ gimpcolorspace.h \ + gimpconvert_pdb.c \ + gimpconvert_pdb.h \ gimpdisplay_pdb.c \ gimpdisplay_pdb.h \ gimpdrawable.c \ @@ -96,7 +102,11 @@ libgimp_la_SOURCES = \ gimpfileops_pdb.c \ gimpfileops_pdb.h \ gimpgradient_pdb.c \ + gimpgradient_pdb.h \ + gimpgradientselect_pdb.c \ + gimpgradientselect_pdb.h \ gimpguides_pdb.c \ + gimpguides_pdb.h \ gimphelp.c \ gimphelp_pdb.c \ gimphelp_pdb.h \ @@ -115,6 +125,10 @@ libgimp_la_SOURCES = \ gimpparasiteio.h \ gimpparasite_pdb.c \ gimpparasite_pdb.h \ + gimppatterns_pdb.c \ + gimppatterns_pdb.h \ + gimppatternselect_pdb.c \ + gimppatternselect_pdb.h \ gimppixelrgn.c \ gimppixelrgn.h \ gimpplugin_pdb.c \ @@ -165,11 +179,16 @@ libgimpui_la_SOURCES = \ gimpinclude_HEADERS = \ gimp.h \ gimp_pdb.h \ + gimpbrushes_pdb.h \ + gimpbrushselect_pdb.h \ gimpchannel_pdb.h \ + gimpconvert_pdb.h \ gimpdisplay_pdb.h \ gimpdrawable_pdb.h \ gimpfileops_pdb.h \ gimpgradient_pdb.h \ + gimpgradientselect_pdb.h \ + gimpguides_pdb.h \ gimphelp_pdb.h \ gimpimage_pdb.h \ gimplayer_pdb.h \ @@ -201,6 +220,8 @@ gimpinclude_HEADERS = \ gimpparasite.h \ gimpparasiteio.h \ gimppatheditor.h \ + gimppatterns_pdb.h \ + gimppatternselect_pdb.h \ gimppixelrgn.h \ gimppixmap.h \ gimpquerybox.h \ diff --git a/libgimp/gimp.h b/libgimp/gimp.h index 7dd9fb4c4a..453978ad16 100644 --- a/libgimp/gimp.h +++ b/libgimp/gimp.h @@ -59,11 +59,18 @@ extern "C" { #endif /* __cplusplus */ + /* more convenient names for some pdb functions */ -#define gimp_get_data gimp_procedural_db_get_data -#define gimp_get_data_size gimp_procedural_db_get_data_size -#define gimp_set_data gimp_procedural_db_set_data -#define gimp_query_procedure gimp_procedural_db_proc_info + +#define gimp_get_data gimp_procedural_db_get_data +#define gimp_get_data_size gimp_procedural_db_get_data_size +#define gimp_set_data gimp_procedural_db_set_data +#define gimp_query_procedure gimp_procedural_db_proc_info + +#define gimp_image_convert_rgb gimp_convert_rgb +#define gimp_image_convert_grayscale gimp_convert_grayscale +#define gimp_image_convert_indexed gimp_convert_indexed + GIMPVAR guint gimp_major_version; GIMPVAR guint gimp_minor_version; @@ -140,12 +147,14 @@ union _GimpParamData gint32 d_display; gint32 d_image; gint32 d_layer; + gint32 d_layer_mask; gint32 d_channel; gint32 d_drawable; gint32 d_selection; gint32 d_boundary; gint32 d_path; GimpParasite d_parasite; + gint32 d_tattoo; gint32 d_status; }; diff --git a/libgimp/gimp_pdb.h b/libgimp/gimp_pdb.h index 3a259260bc..6e201c7a66 100644 --- a/libgimp/gimp_pdb.h +++ b/libgimp/gimp_pdb.h @@ -22,11 +22,15 @@ #ifndef __GIMP_PDB_H__ #define __GIMP_PDB_H__ +#include +#include #include +#include #include #include #include #include +#include #include #include #include @@ -34,6 +38,8 @@ #include #include #include +#include +#include #include #include #include diff --git a/libgimp/gimpbrushes_pdb.c b/libgimp/gimpbrushes_pdb.c new file mode 100644 index 0000000000..54f1fbe885 --- /dev/null +++ b/libgimp/gimpbrushes_pdb.c @@ -0,0 +1,60 @@ +/* LIBGIMP - The GIMP Library + * Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball + * + * gimpbrushes_pdb.c + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "gimp.h" + +gchar * +gimp_brushes_get_brush_data (gchar *brush_name, + gdouble *opacity, + gint *spacing, + GimpLayerModeEffects *paint_mode, + gint *width, + gint *height, + guint8 **mask_data) +{ + GParam *return_vals; + gint nreturn_vals; + gint num_mask_data; + + return_vals = gimp_run_procedure ("gimp_brushes_get_brush_data", + &nreturn_vals, + PARAM_STRING, brush_name, + PARAM_END); + + brush_name = NULL; + if (return_vals[0].data.d_status == STATUS_SUCCESS) + { + brush_name = g_strdup (return_vals[1].data.d_string); + *opacity = return_vals[2].data.d_float; + *spacing = return_vals[3].data.d_int32; + *paint_mode = return_vals[4].data.d_int32; + *width = return_vals[5].data.d_int32; + *height = return_vals[6].data.d_int32; + num_mask_data = return_vals[7].data.d_int32; + *mask_data = g_new (guint8, num_mask_data); + memcpy (*mask_data, return_vals[8].data.d_int8array, + num_mask_data * sizeof (guint8)); + } + + gimp_destroy_params (return_vals, nreturn_vals); + + return brush_name; +} diff --git a/libgimp/gimpbrushes_pdb.h b/libgimp/gimpbrushes_pdb.h new file mode 100644 index 0000000000..7e918166b6 --- /dev/null +++ b/libgimp/gimpbrushes_pdb.h @@ -0,0 +1,47 @@ +/* LIBGIMP - The GIMP Library + * Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball + * + * gimpbrushes_pdb.h + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* NOTE: This file is autogenerated by pdbgen.pl */ + +#ifndef __GIMP_BRUSHES_PDB_H__ +#define __GIMP_BRUSHES_PDB_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* For information look into the C source or the html documentation */ + + +gchar* gimp_brushes_get_brush_data (gchar *brush_name, + gdouble *opacity, + gint *spacing, + GimpLayerModeEffects *paint_mode, + gint *width, + gint *height, + guint8 **mask_data); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __GIMP_BRUSHES_PDB_H__ */ diff --git a/libgimp/gimpbrushmenu.c b/libgimp/gimpbrushmenu.c index 0bc54df106..ab567c2052 100644 --- a/libgimp/gimpbrushmenu.c +++ b/libgimp/gimpbrushmenu.c @@ -192,10 +192,10 @@ brush_preview_events (GtkWidget *widget, } static void -brush_pre_update(GtkWidget *brush_preview, - gint brush_width, - gint brush_height, - gchar *mask_data) +brush_pre_update (GtkWidget *brush_preview, + gint brush_width, + gint brush_height, + gchar *mask_data) { gint y; gint i; @@ -324,9 +324,9 @@ gimp_brush_select_widget (gchar *dname, gint width; gint height; gint init_spacing; - gint init_paint_mode; + GimpLayerModeEffects init_paint_mode; gdouble init_opacity; - gchar *mask_data; + guint8 *mask_data; gchar *brush_name; BSelect *bsel; @@ -405,37 +405,33 @@ gimp_brush_select_widget (gchar *dname, } -gboolean +void gimp_brush_select_widget_close_popup (GtkWidget *widget) { - gboolean ret_val = FALSE; BSelect *bsel; bsel = (BSelect *) gtk_object_get_data (GTK_OBJECT (widget), BSEL_DATA_KEY); if (bsel && bsel->brush_popup_pnt) { - ret_val = gimp_brush_close_popup (bsel->brush_popup_pnt); + gimp_brushes_close_popup (bsel->brush_popup_pnt); bsel->brush_popup_pnt = NULL; } - - return ret_val; } -gboolean +void gimp_brush_select_widget_set_popup (GtkWidget *widget, gchar *bname, gdouble opacity, gint spacing, gint paint_mode) { - gboolean ret_val = FALSE; gint width; gint height; gint init_spacing; - gint init_paint_mode; + GimpLayerModeEffects init_paint_mode; gdouble init_opacity; - gchar *mask_data; + guint8 *mask_data; gchar *brush_name; BSelect *bsel; @@ -451,23 +447,20 @@ gimp_brush_select_widget_set_popup (GtkWidget *widget, &height, &mask_data); - if(opacity == -1.0) + if (opacity == -1.0) opacity = init_opacity; - if(spacing == -1) + if (spacing == -1) spacing = init_spacing; - if(paint_mode == -1) + if (paint_mode == -1) paint_mode = init_paint_mode; brush_select_invoker (bname, opacity, spacing, paint_mode, width, height, mask_data, 0, bsel); - if (bsel->brush_popup_pnt && - gimp_brush_set_popup (bsel->brush_popup_pnt, - bname, opacity, spacing, paint_mode)) - ret_val = TRUE; + if (bsel->brush_popup_pnt) + gimp_brushes_set_popup (bsel->brush_popup_pnt, + bname, opacity, spacing, paint_mode); } - - return ret_val; } diff --git a/libgimp/gimpbrushselect_pdb.c b/libgimp/gimpbrushselect_pdb.c new file mode 100644 index 0000000000..1e98d77de3 --- /dev/null +++ b/libgimp/gimpbrushselect_pdb.c @@ -0,0 +1,84 @@ +/* LIBGIMP - The GIMP Library + * Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball + * + * gimpbrushselect_pdb.c + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* NOTE: This file is autogenerated by pdbgen.pl */ + +#include "gimp.h" + +void +gimp_brushes_popup (gchar *brush_callback, + gchar *popup_title, + gchar *initial_brush, + gdouble opacity, + gint spacing, + GimpLayerModeEffects paint_mode) +{ + GParam *return_vals; + gint nreturn_vals; + + return_vals = gimp_run_procedure ("gimp_brushes_popup", + &nreturn_vals, + PARAM_STRING, brush_callback, + PARAM_STRING, popup_title, + PARAM_STRING, initial_brush, + PARAM_FLOAT, opacity, + PARAM_INT32, spacing, + PARAM_INT32, paint_mode, + PARAM_END); + + gimp_destroy_params (return_vals, nreturn_vals); +} + +void +gimp_brushes_close_popup (gchar *brush_callback) +{ + GParam *return_vals; + gint nreturn_vals; + + return_vals = gimp_run_procedure ("gimp_brushes_close_popup", + &nreturn_vals, + PARAM_STRING, brush_callback, + PARAM_END); + + gimp_destroy_params (return_vals, nreturn_vals); +} + +void +gimp_brushes_set_popup (gchar *brush_callback, + gchar *brush_name, + gdouble opacity, + gint spacing, + GimpLayerModeEffects paint_mode) +{ + GParam *return_vals; + gint nreturn_vals; + + return_vals = gimp_run_procedure ("gimp_brushes_set_popup", + &nreturn_vals, + PARAM_STRING, brush_callback, + PARAM_STRING, brush_name, + PARAM_FLOAT, opacity, + PARAM_INT32, spacing, + PARAM_INT32, paint_mode, + PARAM_END); + + gimp_destroy_params (return_vals, nreturn_vals); +} diff --git a/libgimp/gimpbrushselect_pdb.h b/libgimp/gimpbrushselect_pdb.h new file mode 100644 index 0000000000..45891eaaf0 --- /dev/null +++ b/libgimp/gimpbrushselect_pdb.h @@ -0,0 +1,52 @@ +/* LIBGIMP - The GIMP Library + * Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball + * + * gimpbrushselect_pdb.h + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* NOTE: This file is autogenerated by pdbgen.pl */ + +#ifndef __GIMP_BRUSH_SELECT_PDB_H__ +#define __GIMP_BRUSH_SELECT_PDB_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* For information look into the C source or the html documentation */ + + +void gimp_brushes_popup (gchar *brush_callback, + gchar *popup_title, + gchar *initial_brush, + gdouble opacity, + gint spacing, + GimpLayerModeEffects paint_mode); +void gimp_brushes_close_popup (gchar *brush_callback); +void gimp_brushes_set_popup (gchar *brush_callback, + gchar *brush_name, + gdouble opacity, + gint spacing, + GimpLayerModeEffects paint_mode); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __GIMP_BRUSH_SELECT_PDB_H__ */ diff --git a/libgimp/gimpcompat.h b/libgimp/gimpcompat.h index f2d73cbad6..533fda1383 100644 --- a/libgimp/gimpcompat.h +++ b/libgimp/gimpcompat.h @@ -60,6 +60,9 @@ extern "C" { #define gimp_layer_bpp gimp_drawable_bpp #define gimp_layer_type gimp_drawable_type +#define gimp_gradient_get_gradient_data(a,b,c,d) \ + gimp_gradients_get_gradient_data (a,c,b,d) + #define gimp_plugin_help_func gimp_standard_help_func #define gimp_query_database gimp_procedural_db_query diff --git a/libgimp/gimpconvert_pdb.c b/libgimp/gimpconvert_pdb.c new file mode 100644 index 0000000000..0b1625f1c9 --- /dev/null +++ b/libgimp/gimpconvert_pdb.c @@ -0,0 +1,78 @@ +/* LIBGIMP - The GIMP Library + * Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball + * + * gimpconvert_pdb.c + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* NOTE: This file is autogenerated by pdbgen.pl */ + +#include "gimp.h" + +void +gimp_convert_rgb (gint32 image_ID) +{ + GParam *return_vals; + gint nreturn_vals; + + return_vals = gimp_run_procedure ("gimp_convert_rgb", + &nreturn_vals, + PARAM_IMAGE, image_ID, + PARAM_END); + + gimp_destroy_params (return_vals, nreturn_vals); +} + +void +gimp_convert_grayscale (gint32 image_ID) +{ + GParam *return_vals; + gint nreturn_vals; + + return_vals = gimp_run_procedure ("gimp_convert_grayscale", + &nreturn_vals, + PARAM_IMAGE, image_ID, + PARAM_END); + + gimp_destroy_params (return_vals, nreturn_vals); +} + +void +gimp_convert_indexed (gint32 image_ID, + GimpConvertDitherType dither_type, + GimpConvertPaletteType palette_type, + gint num_cols, + gboolean alpha_dither, + gboolean remove_unused, + gchar *palette) +{ + GParam *return_vals; + gint nreturn_vals; + + return_vals = gimp_run_procedure ("gimp_convert_indexed", + &nreturn_vals, + PARAM_IMAGE, image_ID, + PARAM_INT32, dither_type, + PARAM_INT32, palette_type, + PARAM_INT32, num_cols, + PARAM_INT32, alpha_dither, + PARAM_INT32, remove_unused, + PARAM_STRING, palette, + PARAM_END); + + gimp_destroy_params (return_vals, nreturn_vals); +} diff --git a/libgimp/gimpconvert_pdb.h b/libgimp/gimpconvert_pdb.h new file mode 100644 index 0000000000..ccfeec9800 --- /dev/null +++ b/libgimp/gimpconvert_pdb.h @@ -0,0 +1,49 @@ +/* LIBGIMP - The GIMP Library + * Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball + * + * gimpconvert_pdb.h + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* NOTE: This file is autogenerated by pdbgen.pl */ + +#ifndef __GIMP_CONVERT_PDB_H__ +#define __GIMP_CONVERT_PDB_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* For information look into the C source or the html documentation */ + + +void gimp_convert_rgb (gint32 image_ID); +void gimp_convert_grayscale (gint32 image_ID); +void gimp_convert_indexed (gint32 image_ID, + GimpConvertDitherType dither_type, + GimpConvertPaletteType palette_type, + gint num_cols, + gboolean alpha_dither, + gboolean remove_unused, + gchar *palette); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __GIMP_CONVERT_PDB_H__ */ diff --git a/libgimp/gimpdrawable_pdb.c b/libgimp/gimpdrawable_pdb.c index b77b0b7efb..f4344c9693 100644 --- a/libgimp/gimpdrawable_pdb.c +++ b/libgimp/gimpdrawable_pdb.c @@ -19,6 +19,8 @@ * Boston, MA 02111-1307, USA. */ +#include + #include "gimp.h" @@ -381,87 +383,6 @@ gimp_drawable_fill (gint32 drawable_ID, gimp_destroy_params (return_vals, nreturn_vals); } -GimpParasite * -gimp_drawable_parasite_find (gint32 drawable_ID, - const gchar *name) - -{ - GParam *return_vals; - gint nreturn_vals; - GimpParasite *parasite; - return_vals = gimp_run_procedure ("gimp_drawable_parasite_find", - &nreturn_vals, - PARAM_DRAWABLE, drawable_ID, - PARAM_STRING, name, - PARAM_END); - - if (return_vals[0].data.d_status == STATUS_SUCCESS) - { - parasite = gimp_parasite_copy (&return_vals[1].data.d_parasite); - } - else - parasite = NULL; - - gimp_destroy_params (return_vals, nreturn_vals); - - return parasite; -} - -void -gimp_drawable_parasite_attach (gint32 drawable_ID, - const GimpParasite *parasite) -{ - GParam *return_vals; - gint nreturn_vals; - - return_vals = gimp_run_procedure ("gimp_drawable_parasite_attach", - &nreturn_vals, - PARAM_DRAWABLE, drawable_ID, - PARAM_PARASITE, parasite, - PARAM_END); - - gimp_destroy_params (return_vals, nreturn_vals); -} - - -void -gimp_drawable_attach_new_parasite (gint32 drawable, - const gchar *name, - gint flags, - gint size, - const gpointer data) -{ - GParam *return_vals; - gint nreturn_vals; - GimpParasite *p = gimp_parasite_new (name, flags, size, data); - - return_vals = gimp_run_procedure ("gimp_drawable_parasite_attach", - &nreturn_vals, - PARAM_DRAWABLE, drawable, - PARAM_PARASITE, p, - PARAM_END); - - gimp_parasite_free(p); - gimp_destroy_params (return_vals, nreturn_vals); -} - -void -gimp_drawable_parasite_detach (gint32 drawable_ID, - const gchar *name) -{ - GParam *return_vals; - gint nreturn_vals; - - return_vals = gimp_run_procedure ("gimp_drawable_parasite_detach", - &nreturn_vals, - PARAM_DRAWABLE, drawable_ID, - PARAM_STRING, name, - PARAM_END); - - - gimp_destroy_params (return_vals, nreturn_vals); -} - guchar * gimp_drawable_get_thumbnail_data (gint32 drawable_ID, gint *width, diff --git a/libgimp/gimpdrawable_pdb.h b/libgimp/gimpdrawable_pdb.h index f84f3adf92..93a6f4e12a 100644 --- a/libgimp/gimpdrawable_pdb.h +++ b/libgimp/gimpdrawable_pdb.h @@ -60,17 +60,6 @@ void gimp_drawable_fill (gint32 drawable_ID, GimpFillType fill_type); void gimp_drawable_set_visible (gint32 drawable_ID, gint visible); -GimpParasite * gimp_drawable_parasite_find (gint32 drawable_ID, - const gchar *name); -void gimp_drawable_parasite_attach (gint32 drawable_ID, - const GimpParasite *parasite); -void gimp_drawable_attach_new_parasite (gint32 drawable_ID, - const gchar *name, - gint flags, - gint size, - const gpointer data); -void gimp_drawable_parasite_detach (gint32 drawable_ID, - const gchar *name); guchar * gimp_drawable_get_thumbnail_data (gint32 drawable_ID, gint *width, gint *height, diff --git a/libgimp/gimpexport.c b/libgimp/gimpexport.c index a8c9e7f81d..313b958a58 100644 --- a/libgimp/gimpexport.c +++ b/libgimp/gimpexport.c @@ -19,17 +19,17 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ + #include "config.h" #include #include "gimp.h" -#include "gimpdialog.h" -#include "gimpenums.h" -#include "gimpexport.h" +#include "gimpui.h" #include "libgimp-intl.h" + typedef void (* ExportFunc) (gint32 imageID, gint32 *drawable_ID); /* the export action structure */ diff --git a/libgimp/gimpgradientmenu.c b/libgimp/gimpgradientmenu.c index f26a865d8d..f6c505cbd8 100644 --- a/libgimp/gimpgradientmenu.c +++ b/libgimp/gimpgradientmenu.c @@ -49,7 +49,7 @@ struct __gradients_sel GimpRunGradientCallback cback; GtkWidget *gradient_preview; GtkWidget *button; - GtkWidget *gradient_popup_pnt; + gchar *gradient_popup_pnt; gint width; gchar *gradient_name; /* Local copy */ gdouble *grad_data; /* local copy */ @@ -219,7 +219,7 @@ gimp_gradient_select_widget (gchar *dname, /* Do initial gradient setup */ gradient_name = - gimp_gradient_get_gradient_data (igradient, &width, CELL_SIZE_WIDTH, &grad_data); + gimp_gradients_get_gradient_data (igradient, CELL_SIZE_WIDTH, &width, &grad_data); if (gradient_name) { @@ -241,28 +241,24 @@ gimp_gradient_select_widget (gchar *dname, } -gboolean +void gimp_gradient_select_widget_close_popup (GtkWidget *widget) { - gboolean ret_val = FALSE; GSelect *gsel; gsel = (GSelect*) gtk_object_get_data (GTK_OBJECT (widget), GSEL_DATA_KEY); if (gsel && gsel->gradient_popup_pnt) { - ret_val = gimp_gradient_close_popup (gsel->gradient_popup_pnt); + gimp_gradients_close_popup (gsel->gradient_popup_pnt); gsel->gradient_popup_pnt = NULL; } - - return ret_val; } -gboolean +void gimp_gradient_select_widget_set_popup (GtkWidget *widget, gchar *gname) { - gboolean ret_val = FALSE; gint width; gdouble *grad_data; gchar *gradient_name; @@ -273,17 +269,14 @@ gimp_gradient_select_widget_set_popup (GtkWidget *widget, if (gsel) { gradient_name = - gimp_gradient_get_gradient_data (gname, &width, gsel->sample_size, &grad_data); + gimp_gradients_get_gradient_data (gname, gsel->sample_size, &width, &grad_data); if (gradient_name) { gradient_select_invoker (gname, width, grad_data, 0, gsel); - if (gsel->gradient_popup_pnt && - gimp_gradient_set_popup (gsel->gradient_popup_pnt, gname)) - ret_val = TRUE; + if (gsel->gradient_popup_pnt) + gimp_gradients_set_popup (gsel->gradient_popup_pnt, gname); } } - - return ret_val; } diff --git a/libgimp/gimpgradientselect_pdb.c b/libgimp/gimpgradientselect_pdb.c new file mode 100644 index 0000000000..f5f767b8e1 --- /dev/null +++ b/libgimp/gimpgradientselect_pdb.c @@ -0,0 +1,106 @@ +/* LIBGIMP - The GIMP Library + * Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball + * + * gimpgradientselect_pdb.c + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* NOTE: This file is autogenerated by pdbgen.pl */ + +#include "gimp.h" + +void +gimp_gradients_popup (gchar *gradients_callback, + gchar *popup_title, + gchar *initial_gradient, + gint sample_size) +{ + GParam *return_vals; + gint nreturn_vals; + + return_vals = gimp_run_procedure ("gimp_gradients_popup", + &nreturn_vals, + PARAM_STRING, gradients_callback, + PARAM_STRING, popup_title, + PARAM_STRING, initial_gradient, + PARAM_INT32, sample_size, + PARAM_END); + + gimp_destroy_params (return_vals, nreturn_vals); +} + +void +gimp_gradients_close_popup (gchar *gradients_callback) +{ + GParam *return_vals; + gint nreturn_vals; + + return_vals = gimp_run_procedure ("gimp_gradients_close_popup", + &nreturn_vals, + PARAM_STRING, gradients_callback, + PARAM_END); + + gimp_destroy_params (return_vals, nreturn_vals); +} + +void +gimp_gradients_set_popup (gchar *gradients_callback, + gchar *gradient_name) +{ + GParam *return_vals; + gint nreturn_vals; + + return_vals = gimp_run_procedure ("gimp_gradients_set_popup", + &nreturn_vals, + PARAM_STRING, gradients_callback, + PARAM_STRING, gradient_name, + PARAM_END); + + gimp_destroy_params (return_vals, nreturn_vals); +} + +gchar * +gimp_gradients_get_gradient_data (gchar *name, + gint sample_size, + gint *width, + gdouble **grad_data) +{ + GParam *return_vals; + gint nreturn_vals; + + return_vals = gimp_run_procedure ("gimp_gradients_get_gradient_data", + &nreturn_vals, + PARAM_STRING, name, + PARAM_INT32, sample_size, + PARAM_END); + + *width = 0; + name = NULL; + + if (return_vals[0].data.d_status == STATUS_SUCCESS) + { + name = g_strdup (return_vals[1].data.d_string); + *width = return_vals[2].data.d_int32; + *grad_data = g_new (gdouble, *width); + memcpy (*grad_data, return_vals[3].data.d_floatarray, + *width * sizeof (gdouble)); + } + + gimp_destroy_params (return_vals, nreturn_vals); + + return name; +} diff --git a/libgimp/gimpgradientselect_pdb.h b/libgimp/gimpgradientselect_pdb.h new file mode 100644 index 0000000000..f2ddf33480 --- /dev/null +++ b/libgimp/gimpgradientselect_pdb.h @@ -0,0 +1,51 @@ +/* LIBGIMP - The GIMP Library + * Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball + * + * gimpgradientselect_pdb.h + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* NOTE: This file is autogenerated by pdbgen.pl */ + +#ifndef __GIMP_GRADIENT_SELECT_PDB_H__ +#define __GIMP_GRADIENT_SELECT_PDB_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* For information look into the C source or the html documentation */ + + +void gimp_gradients_popup (gchar *gradients_callback, + gchar *popup_title, + gchar *initial_gradient, + gint sample_size); +void gimp_gradients_close_popup (gchar *gradients_callback); +void gimp_gradients_set_popup (gchar *gradients_callback, + gchar *gradient_name); +gchar* gimp_gradients_get_gradient_data (gchar *name, + gint sample_size, + gint *width, + gdouble **grad_data); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __GIMP_GRADIENT_SELECT_PDB_H__ */ diff --git a/libgimp/gimpimage_pdb.c b/libgimp/gimpimage_pdb.c index 5f6e1916a9..3617063751 100644 --- a/libgimp/gimpimage_pdb.c +++ b/libgimp/gimpimage_pdb.c @@ -19,6 +19,8 @@ * Boston, MA 02111-1307, USA. */ +#include + #include "gimp.h" @@ -841,84 +843,6 @@ gimp_image_set_filename (gint32 image_ID, gimp_destroy_params (return_vals, nreturn_vals); } -GimpParasite * -gimp_image_parasite_find (gint32 image_ID, - const gchar *name) -{ - GParam *return_vals; - gint nreturn_vals; - GimpParasite *parasite; - return_vals = gimp_run_procedure ("gimp_image_parasite_find", - &nreturn_vals, - PARAM_IMAGE, image_ID, - PARAM_STRING, name, - PARAM_END); - - if (return_vals[0].data.d_status == STATUS_SUCCESS) - { - parasite = gimp_parasite_copy (&return_vals[1].data.d_parasite); - } - else - parasite = NULL; - - gimp_destroy_params (return_vals, nreturn_vals); - - return parasite; -} - -void -gimp_image_parasite_attach (gint32 image_ID, - const GimpParasite *parasite) -{ - GParam *return_vals; - gint nreturn_vals; - - return_vals = gimp_run_procedure ("gimp_image_parasite_attach", - &nreturn_vals, - PARAM_IMAGE, image_ID, - PARAM_PARASITE, parasite, - PARAM_END); - - gimp_destroy_params (return_vals, nreturn_vals); -} - -void -gimp_image_attach_new_parasite (gint32 image_ID, - const gchar *name, - gint flags, - gint size, - const gpointer data) -{ - GParam *return_vals; - gint nreturn_vals; - GimpParasite *p = gimp_parasite_new (name, flags, size, data); - - return_vals = gimp_run_procedure ("gimp_image_parasite_attach", - &nreturn_vals, - PARAM_IMAGE, image_ID, - PARAM_PARASITE, p, - PARAM_END); - - gimp_parasite_free (p); - gimp_destroy_params (return_vals, nreturn_vals); -} - -void -gimp_image_parasite_detach (gint32 image_ID, - const gchar *name) -{ - GParam *return_vals; - gint nreturn_vals; - - return_vals = gimp_run_procedure ("gimp_image_parasite_detach", - &nreturn_vals, - PARAM_IMAGE, image_ID, - PARAM_STRING, name, - PARAM_END); - - gimp_destroy_params (return_vals, nreturn_vals); -} - void gimp_image_get_resolution (gint32 image_ID, double *xresolution, @@ -1086,60 +1010,6 @@ gimp_image_get_thumbnail_data (gint32 image_ID, return image_data; } -void -gimp_image_convert_rgb (gint32 image_ID) -{ - GParam *return_vals; - gint nreturn_vals; - - return_vals = gimp_run_procedure ("gimp_convert_rgb", - &nreturn_vals, - PARAM_IMAGE, image_ID, - PARAM_END); - - gimp_destroy_params (return_vals, nreturn_vals); -} - -void -gimp_image_convert_grayscale (gint32 image_ID) -{ - GParam *return_vals; - gint nreturn_vals; - - return_vals = gimp_run_procedure ("gimp_convert_grayscale", - &nreturn_vals, - PARAM_IMAGE, image_ID, - PARAM_END); - - gimp_destroy_params (return_vals, nreturn_vals); -} - -void -gimp_image_convert_indexed (gint32 image_ID, - GimpConvertDitherType dither_type, - GimpConvertPaletteType palette_type, - gint num_colors, - gint alpha_dither, - gint remove_unused, - gchar *palette) -{ - GParam *return_vals; - gint nreturn_vals; - - return_vals = gimp_run_procedure ("gimp_convert_indexed", - &nreturn_vals, - PARAM_IMAGE, image_ID, - PARAM_INT32, dither_type, - PARAM_INT32, palette_type, - PARAM_INT32, num_colors, - PARAM_INT32, alpha_dither, - PARAM_INT32, remove_unused, - PARAM_STRING, palette, - PARAM_END); - - gimp_destroy_params (return_vals, nreturn_vals); -} - gint32 * gimp_image_list (gint *nimages) { diff --git a/libgimp/gimpimage_pdb.h b/libgimp/gimpimage_pdb.h index 4768c91485..f8acfaf719 100644 --- a/libgimp/gimpimage_pdb.h +++ b/libgimp/gimpimage_pdb.h @@ -110,17 +110,6 @@ void gimp_image_set_component_visible (gint32 image_ID, gboolean visible); void gimp_image_set_filename (gint32 image_ID, gchar *name); -GimpParasite * gimp_image_parasite_find (gint32 image_ID, - const gchar *name); -void gimp_image_parasite_attach (gint32 image_ID, - const GimpParasite *parasite); -void gimp_image_attach_new_parasite (gint32 image_ID, - const gchar *name, - gint flags, - gint size, - const gpointer data); -void gimp_image_parasite_detach (gint32 image_ID, - const gchar *name); void gimp_image_set_resolution (gint32 image_ID, gdouble xresolution, gdouble yresolution); @@ -139,34 +128,7 @@ guchar * gimp_image_get_thumbnail_data (gint32 image_ID, gint *width, gint *height, gint *bytes); -void gimp_image_convert_rgb (gint32 image_ID); -void gimp_image_convert_grayscale (gint32 image_ID); -void gimp_image_convert_indexed (gint32 image_ID, - GimpConvertDitherType dither_type, - GimpConvertPaletteType palette_type, - gint num_colors, - gint alpha_dither, - gint remove_unused, - gchar *palette); -gint32 * gimp_image_list (gint *nimages); - - -/**************************************** - * Guides * - ****************************************/ - -gint32 gimp_image_add_hguide (gint32 image_ID, - gint32 yposition); -gint32 gimp_image_add_vguide (gint32 image_ID, - gint32 xposition); -void gimp_image_delete_guide (gint32 image_ID, - gint32 guide_ID); -gint32 gimp_image_find_next_guide (gint32 image_ID, - gint32 guide_ID); -GOrientation gimp_image_get_guide_orientation (gint32 image_ID, - gint32 guide_ID); -gint32 gimp_image_get_guide_position (gint32 image_ID, - gint32 guide_ID); +gint32 * gimp_image_list (gint *nimages); #ifdef __cplusplus diff --git a/libgimp/gimpmenu.c b/libgimp/gimpmenu.c index 61b36c82f4..05dca40ce1 100644 --- a/libgimp/gimpmenu.c +++ b/libgimp/gimpmenu.c @@ -967,7 +967,7 @@ gen_temp_plugin_name (void) /* Can only be used in conjuction with gdk since we need to tie into the input * selection mech. */ -gpointer +gchar * gimp_interactive_selection_brush (gchar *dialogname, gchar *brush_name, gdouble opacity, @@ -1048,92 +1048,7 @@ gimp_interactive_selection_brush (gchar *dialogname, return pdbname; } - gchar * -gimp_brushes_get_brush_data (gchar *bname, - gdouble *opacity, - gint *spacing, - gint *paint_mode, - gint *width, - gint *height, - gchar **mask_data) -{ - GimpParam *return_vals; - gint nreturn_vals; - gchar *ret_name = NULL; - - return_vals = gimp_run_procedure ("gimp_brushes_get_brush_data", - &nreturn_vals, - PARAM_STRING, bname, - PARAM_END); - - if (return_vals[0].data.d_status == STATUS_SUCCESS) - { - ret_name = g_strdup (return_vals[1].data.d_string); - *opacity = return_vals[2].data.d_float; - *spacing = return_vals[3].data.d_int32; - *paint_mode = return_vals[4].data.d_int32; - *width = return_vals[5].data.d_int32; - *height = return_vals[6].data.d_int32; - *mask_data = g_new (gchar, return_vals[7].data.d_int32); - g_memmove (*mask_data, - return_vals[8].data.d_int32array, return_vals[7].data.d_int32); - } - - gimp_destroy_params (return_vals, nreturn_vals); - - return ret_name; -} - -gint -gimp_brush_close_popup (gpointer popup_pnt) -{ - GimpParam *return_vals; - gint nreturn_vals; - gint retval; - - return_vals = gimp_run_procedure ("gimp_brushes_close_popup", - &nreturn_vals, - PARAM_STRING, popup_pnt, - PARAM_END); - - gimp_destroy_params (return_vals, nreturn_vals); - - retval = (return_vals[0].data.d_status == STATUS_SUCCESS); - - return retval; -} - -gint -gimp_brush_set_popup (gpointer popup_pnt, - gchar *pname, - gdouble opacity, - gint spacing, - gint paint_mode) -{ - GimpParam *return_vals; - gint nreturn_vals; - gint retval; - - return_vals = gimp_run_procedure ("gimp_brushes_set_popup", - &nreturn_vals, - PARAM_STRING, popup_pnt, - PARAM_STRING, pname, - PARAM_FLOAT, opacity, - PARAM_INT32, spacing, - PARAM_INT32, paint_mode, - PARAM_END); - - gimp_destroy_params (return_vals, nreturn_vals); - - retval = (return_vals[0].data.d_status == STATUS_SUCCESS); - - return retval; -} - - - -gpointer gimp_interactive_selection_pattern (gchar *dialogname, gchar *pattern_name, GimpRunPatternCallback callback, @@ -1197,80 +1112,7 @@ gimp_interactive_selection_pattern (gchar *dialogname, return pdbname; } - gchar * -gimp_pattern_get_pattern_data (gchar *pname, - gint *width, - gint *height, - gint *bytes, - gchar **mask_data) -{ - GimpParam *return_vals; - gint nreturn_vals; - gchar *ret_name = NULL; - - return_vals = gimp_run_procedure ("gimp_patterns_get_pattern_data", - &nreturn_vals, - PARAM_STRING, pname, - PARAM_END); - - if (return_vals[0].data.d_status == STATUS_SUCCESS) - { - ret_name = g_strdup(return_vals[1].data.d_string); - *width = return_vals[2].data.d_int32; - *height = return_vals[3].data.d_int32; - *bytes = return_vals[4].data.d_int32; - *mask_data = g_new (gchar,return_vals[5].data.d_int32); - g_memmove (*mask_data, - return_vals[6].data.d_int32array, return_vals[5].data.d_int32); - } - - gimp_destroy_params (return_vals, nreturn_vals); - - return ret_name; -} - -gint -gimp_pattern_close_popup (gpointer popup_pnt) -{ - GimpParam *return_vals; - gint nreturn_vals; - gint retval; - - return_vals = gimp_run_procedure ("gimp_patterns_close_popup", - &nreturn_vals, - PARAM_STRING, popup_pnt, - PARAM_END); - - gimp_destroy_params (return_vals, nreturn_vals); - - retval = (return_vals[0].data.d_status == STATUS_SUCCESS); - - return retval; -} - -gint -gimp_pattern_set_popup (gpointer popup_pnt, - gchar *pname) -{ - GimpParam *return_vals; - gint nreturn_vals; - gint retval; - - return_vals = gimp_run_procedure ("gimp_patterns_set_popup", - &nreturn_vals, - PARAM_STRING, popup_pnt, - PARAM_STRING, pname, - PARAM_END); - - gimp_destroy_params (return_vals, nreturn_vals); - - retval = (return_vals[0].data.d_status == STATUS_SUCCESS); - - return retval; -} - -gpointer gimp_interactive_selection_gradient (gchar *dialogname, gchar *gradient_name, gint sample_sz, @@ -1332,77 +1174,3 @@ gimp_interactive_selection_gradient (gchar *dialogname, return pdbname; } - -gchar * -gimp_gradient_get_gradient_data (gchar *gname, - gint *width, - gint sample_sz, - gdouble **grad_data) -{ - GimpParam *return_vals; - gint nreturn_vals; - gchar *ret_name = NULL; - - return_vals = gimp_run_procedure ("gimp_gradients_get_gradient_data", - &nreturn_vals, - PARAM_STRING, gname, - PARAM_INT32, sample_sz, - PARAM_END); - - if (return_vals[0].data.d_status == STATUS_SUCCESS) - { - gint i; - - ret_name = g_strdup (return_vals[1].data.d_string); - *width = return_vals[2].data.d_int32; - *grad_data = g_new (gdouble, *width); - - for (i = 0; i < *width; i++) - (*grad_data)[i] = return_vals[3].data.d_floatarray[i]; - } - - gimp_destroy_params (return_vals, nreturn_vals); - - return ret_name; -} - - -gint -gimp_gradient_close_popup (gpointer popup_pnt) -{ - GimpParam *return_vals; - gint nreturn_vals; - gint retval; - - return_vals = gimp_run_procedure ("gimp_gradients_close_popup", - &nreturn_vals, - PARAM_STRING, popup_pnt, - PARAM_END); - - gimp_destroy_params (return_vals, nreturn_vals); - - retval = (return_vals[0].data.d_status == STATUS_SUCCESS); - - return retval; -} - -gint -gimp_gradient_set_popup (gpointer popup_pnt, - gchar *gname) -{ - GimpParam *return_vals; - gint nreturn_vals; - gint retval; - - return_vals = gimp_run_procedure ("gimp_gradients_set_popup", - &nreturn_vals, - PARAM_STRING, popup_pnt, - PARAM_STRING, gname, - PARAM_END); - - gimp_destroy_params (return_vals, nreturn_vals); - - retval = (return_vals[0].data.d_status == STATUS_SUCCESS); - - return retval; -} diff --git a/libgimp/gimpmenu.h b/libgimp/gimpmenu.h index 05b1d3be6d..73f50e2983 100644 --- a/libgimp/gimpmenu.h +++ b/libgimp/gimpmenu.h @@ -80,7 +80,7 @@ GtkWidget * gimp_drawable_menu_new (GimpConstraintFunc constraint, gint32 active_drawable); -gpointer gimp_interactive_selection_brush (gchar *dialogname, +gchar * gimp_interactive_selection_brush (gchar *dialogname, gchar *brush_name, gdouble opacity, gint spacing, @@ -96,30 +96,14 @@ GtkWidget * gimp_brush_select_widget (gchar *dname, GimpRunBrushCallback cback, gpointer data); -gboolean gimp_brush_select_widget_set_popup (GtkWidget *widget, +void gimp_brush_select_widget_set_popup (GtkWidget *widget, gchar *pname, gdouble opacity, gint spacing, gint paint_mode); -gboolean gimp_brush_select_widget_close_popup (GtkWidget *widget); +void gimp_brush_select_widget_close_popup (GtkWidget *widget); -gchar * gimp_brushes_get_brush_data (gchar *pname, - gdouble *opacity, - gint *spacing, - gint *paint_mode, - gint *width, - gint *height, - gchar **mask_data); - -gboolean gimp_brush_set_popup (gpointer popup_pnt, - gchar *pname, - gdouble opacity, - gint spacing, - gint paint_mode); -gboolean gimp_brush_close_popup (gpointer popup_pnt); - - -gpointer gimp_interactive_selection_pattern (gchar *dialogtitle, +gchar * gimp_interactive_selection_pattern (gchar *dialogtitle, gchar *pattern_name, GimpRunPatternCallback callback, gpointer data); @@ -129,21 +113,11 @@ GtkWidget * gimp_pattern_select_widget (gchar *dname, GimpRunPatternCallback cback, gpointer data); -gboolean gimp_pattern_select_widget_close_popup (GtkWidget *widget); -gboolean gimp_pattern_select_widget_set_popup (GtkWidget *widget, +void gimp_pattern_select_widget_close_popup (GtkWidget *widget); +void gimp_pattern_select_widget_set_popup (GtkWidget *widget, gchar *pname); -gchar * gimp_pattern_get_pattern_data (gchar *pname, - gint *width, - gint *height, - gint *bytes, - gchar **mask_data); - -gboolean gimp_pattern_set_popup (gpointer popup_pnt, - gchar *pname); -gboolean gimp_pattern_close_popup (gpointer popup_pnt); - -gpointer gimp_interactive_selection_gradient (gchar *dialogtitle, +gchar * gimp_interactive_selection_gradient (gchar *dialogtitle, gchar *gradient_name, gint sample_sz, GimpRunGradientCallback callback, @@ -154,18 +128,9 @@ GtkWidget * gimp_gradient_select_widget (gchar *gname, GimpRunGradientCallback cback, gpointer data); -gboolean gimp_gradient_select_widget_set_popup (GtkWidget *widget, - gchar *pname); -gboolean gimp_gradient_select_widget_close_popup (GtkWidget *widget); - -gchar * gimp_gradient_get_gradient_data (gchar *pname, - gint *width, - gint sample_sz, - gdouble **mask_data); - -gboolean gimp_gradient_set_popup (gpointer popup_pnt, - gchar *pname); -gboolean gimp_gradient_close_popup (gpointer popup_pnt); +void gimp_gradient_select_widget_close_popup (GtkWidget *widget); +void gimp_gradient_select_widget_set_popup (GtkWidget *widget, + gchar *gname); #ifdef __cplusplus diff --git a/libgimp/gimpparasite.c b/libgimp/gimpparasite.c index e42566e05e..bf96c45b15 100644 --- a/libgimp/gimpparasite.c +++ b/libgimp/gimpparasite.c @@ -33,6 +33,7 @@ #endif #include "gimpparasite.h" +#include "gimpparasite_pdb.h" #ifdef DEBUG @@ -181,7 +182,7 @@ gimp_parasite_name (const GimpParasite *parasite) return NULL; } -void * +gpointer gimp_parasite_data (const GimpParasite *parasite) { if (parasite) @@ -198,3 +199,44 @@ gimp_parasite_data_size (const GimpParasite *parasite) return 0; } + +void +gimp_attach_new_parasite (const gchar *name, + gint flags, + gint size, + const gpointer data) +{ + GimpParasite *parasite = gimp_parasite_new (name, flags, size, data); + + gimp_parasite_attach (parasite); + + gimp_parasite_free (parasite); +} + +void +gimp_drawable_attach_new_parasite (gint32 drawable, + const gchar *name, + gint flags, + gint size, + const gpointer data) +{ + GimpParasite *parasite = gimp_parasite_new (name, flags, size, data); + + gimp_drawable_parasite_attach (drawable, parasite); + + gimp_parasite_free (parasite); +} + +void +gimp_image_attach_new_parasite (gint32 image_ID, + const gchar *name, + gint flags, + gint size, + const gpointer data) +{ + GimpParasite *parasite = gimp_parasite_new (name, flags, size, data); + + gimp_image_parasite_attach (image_ID, parasite); + + gimp_parasite_free (parasite); +} diff --git a/libgimp/gimpparasite.h b/libgimp/gimpparasite.h index f7f4d291e3..d7303ef49e 100644 --- a/libgimp/gimpparasite.h +++ b/libgimp/gimpparasite.h @@ -54,27 +54,42 @@ struct _GimpParasite }; -GimpParasite * gimp_parasite_new (const gchar *name, - guint32 flags, - guint32 size, - const gpointer data); -void gimp_parasite_free (GimpParasite *parasite); +GimpParasite * gimp_parasite_new (const gchar *name, + guint32 flags, + guint32 size, + const gpointer data); +void gimp_parasite_free (GimpParasite *parasite); -GimpParasite * gimp_parasite_copy (const GimpParasite *parasite); +GimpParasite * gimp_parasite_copy (const GimpParasite *parasite); -gboolean gimp_parasite_compare (const GimpParasite *a, - const GimpParasite *b); +gboolean gimp_parasite_compare (const GimpParasite *a, + const GimpParasite *b); -gboolean gimp_parasite_is_type (const GimpParasite *parasite, - const gchar *name); -gboolean gimp_parasite_is_persistent (const GimpParasite *parasite); -gboolean gimp_parasite_is_undoable (const GimpParasite *parasite); -gboolean gimp_parasite_has_flag (const GimpParasite *parasite, - gulong flag); -gulong gimp_parasite_flags (const GimpParasite *parasite); -const gchar * gimp_parasite_name (const GimpParasite *parasite); -void * gimp_parasite_data (const GimpParasite *parasite); -glong gimp_parasite_data_size (const GimpParasite *parasite); +gboolean gimp_parasite_is_type (const GimpParasite *parasite, + const gchar *name); +gboolean gimp_parasite_is_persistent (const GimpParasite *parasite); +gboolean gimp_parasite_is_undoable (const GimpParasite *parasite); +gboolean gimp_parasite_has_flag (const GimpParasite *parasite, + gulong flag); +gulong gimp_parasite_flags (const GimpParasite *parasite); +const gchar * gimp_parasite_name (const GimpParasite *parasite); +gpointer gimp_parasite_data (const GimpParasite *parasite); +glong gimp_parasite_data_size (const GimpParasite *parasite); + +void gimp_attach_new_parasite (const gchar *name, + gint flags, + gint size, + const gpointer data); +void gimp_drawable_attach_new_parasite (gint32 drawable_ID, + const gchar *name, + gint flags, + gint size, + const gpointer data); +void gimp_image_attach_new_parasite (gint32 image_ID, + const gchar *name, + gint flags, + gint size, + const gpointer data); #ifdef __cplusplus diff --git a/libgimp/gimpparasite_pdb.c b/libgimp/gimpparasite_pdb.c index c37f370848..a2054d4815 100644 --- a/libgimp/gimpparasite_pdb.c +++ b/libgimp/gimpparasite_pdb.c @@ -57,25 +57,6 @@ gimp_parasite_attach (const GimpParasite *parasite) gimp_destroy_params (return_vals, nreturn_vals); } -void -gimp_attach_new_parasite (const gchar *name, - gint flags, - gint size, - const gpointer data) -{ - GParam *return_vals; - gint nreturn_vals; - GimpParasite *parasite = gimp_parasite_new (name, flags, size, data); - - return_vals = gimp_run_procedure ("gimp_parasite_attach", - &nreturn_vals, - PARAM_PARASITE, parasite, - PARAM_END); - - gimp_parasite_free (parasite); - gimp_destroy_params (return_vals, nreturn_vals); -} - void gimp_parasite_detach (const gchar *name) { @@ -89,3 +70,119 @@ gimp_parasite_detach (const gchar *name) gimp_destroy_params (return_vals, nreturn_vals); } + +GimpParasite * +gimp_drawable_parasite_find (gint32 drawable_ID, + const gchar *name) + +{ + GParam *return_vals; + gint nreturn_vals; + GimpParasite *parasite; + return_vals = gimp_run_procedure ("gimp_drawable_parasite_find", + &nreturn_vals, + PARAM_DRAWABLE, drawable_ID, + PARAM_STRING, name, + PARAM_END); + + if (return_vals[0].data.d_status == STATUS_SUCCESS) + { + parasite = gimp_parasite_copy (&return_vals[1].data.d_parasite); + } + else + parasite = NULL; + + gimp_destroy_params (return_vals, nreturn_vals); + + return parasite; +} + +void +gimp_drawable_parasite_attach (gint32 drawable_ID, + const GimpParasite *parasite) +{ + GParam *return_vals; + gint nreturn_vals; + + return_vals = gimp_run_procedure ("gimp_drawable_parasite_attach", + &nreturn_vals, + PARAM_DRAWABLE, drawable_ID, + PARAM_PARASITE, parasite, + PARAM_END); + + gimp_destroy_params (return_vals, nreturn_vals); +} + +void +gimp_drawable_parasite_detach (gint32 drawable_ID, + const gchar *name) +{ + GParam *return_vals; + gint nreturn_vals; + + return_vals = gimp_run_procedure ("gimp_drawable_parasite_detach", + &nreturn_vals, + PARAM_DRAWABLE, drawable_ID, + PARAM_STRING, name, + PARAM_END); + + + gimp_destroy_params (return_vals, nreturn_vals); +} + +GimpParasite * +gimp_image_parasite_find (gint32 image_ID, + const gchar *name) +{ + GParam *return_vals; + gint nreturn_vals; + GimpParasite *parasite; + return_vals = gimp_run_procedure ("gimp_image_parasite_find", + &nreturn_vals, + PARAM_IMAGE, image_ID, + PARAM_STRING, name, + PARAM_END); + + if (return_vals[0].data.d_status == STATUS_SUCCESS) + { + parasite = gimp_parasite_copy (&return_vals[1].data.d_parasite); + } + else + parasite = NULL; + + gimp_destroy_params (return_vals, nreturn_vals); + + return parasite; +} + +void +gimp_image_parasite_attach (gint32 image_ID, + const GimpParasite *parasite) +{ + GParam *return_vals; + gint nreturn_vals; + + return_vals = gimp_run_procedure ("gimp_image_parasite_attach", + &nreturn_vals, + PARAM_IMAGE, image_ID, + PARAM_PARASITE, parasite, + PARAM_END); + + gimp_destroy_params (return_vals, nreturn_vals); +} + +void +gimp_image_parasite_detach (gint32 image_ID, + const gchar *name) +{ + GParam *return_vals; + gint nreturn_vals; + + return_vals = gimp_run_procedure ("gimp_image_parasite_detach", + &nreturn_vals, + PARAM_IMAGE, image_ID, + PARAM_STRING, name, + PARAM_END); + + gimp_destroy_params (return_vals, nreturn_vals); +} diff --git a/libgimp/gimpparasite_pdb.h b/libgimp/gimpparasite_pdb.h index b03773dcd6..42d320467f 100644 --- a/libgimp/gimpparasite_pdb.h +++ b/libgimp/gimpparasite_pdb.h @@ -29,13 +29,22 @@ extern "C" { /* For information look into the C source or the html documentation */ -GimpParasite * gimp_parasite_find (const gchar *name); -void gimp_parasite_attach (const GimpParasite *parasite); -void gimp_attach_new_parasite (const gchar *name, - gint flags, - gint size, - const gpointer data); -void gimp_parasite_detach (const gchar *name); +GimpParasite * gimp_parasite_find (const gchar *name); +void gimp_parasite_attach (const GimpParasite *parasite); +void gimp_parasite_detach (const gchar *name); + +GimpParasite * gimp_drawable_parasite_find (gint32 drawable_ID, + const gchar *name); +void gimp_drawable_parasite_attach (gint32 drawable_ID, + const GimpParasite *parasite); +void gimp_drawable_parasite_detach (gint32 drawable_ID, + const gchar *name); +GimpParasite * gimp_image_parasite_find (gint32 image_ID, + const gchar *name); +void gimp_image_parasite_attach (gint32 image_ID, + const GimpParasite *parasite); +void gimp_image_parasite_detach (gint32 image_ID, + const gchar *name); #ifdef __cplusplus diff --git a/libgimp/gimppatternmenu.c b/libgimp/gimppatternmenu.c index 8fb15233b1..89a262d093 100644 --- a/libgimp/gimppatternmenu.c +++ b/libgimp/gimppatternmenu.c @@ -58,7 +58,7 @@ struct __patterns_sel gint height; gint bytes; gchar *mask_data; /* local copy */ - void *pattern_popup_pnt; /* Pointer use to control the popup */ + gchar *pattern_popup_pnt; /* Pointer use to control the popup */ gpointer data; }; @@ -291,10 +291,11 @@ gimp_pattern_select_widget (gchar *dname, GtkWidget *hbox; GtkWidget *pattern; GtkWidget *button; + gint length; gint width; gint height; gint bytes; - gchar *mask_data; + guint8 *mask_data; gchar *pattern_name; PSelect *psel; @@ -329,7 +330,7 @@ gimp_pattern_select_widget (gchar *dname, /* Do initial pattern setup */ pattern_name = - gimp_pattern_get_pattern_data (ipattern, &width, &height, &bytes, &mask_data); + gimp_patterns_get_pattern_data (ipattern, &length, &width, &height, &bytes, &mask_data); if(pattern_name) { @@ -357,33 +358,29 @@ gimp_pattern_select_widget (gchar *dname, return hbox; } - -gboolean +void gimp_pattern_select_widget_close_popup (GtkWidget *widget) { - gboolean ret_val = FALSE; PSelect *psel; psel = (PSelect *) gtk_object_get_data (GTK_OBJECT (widget), PSEL_DATA_KEY); if (psel && psel->pattern_popup_pnt) { - ret_val = gimp_pattern_close_popup (psel->pattern_popup_pnt); + gimp_patterns_close_popup (psel->pattern_popup_pnt); psel->pattern_popup_pnt = NULL; } - - return ret_val; } -gboolean +void gimp_pattern_select_widget_set_popup (GtkWidget *widget, gchar *pname) { - gboolean ret_val = FALSE; + gint length; gint width; gint height; gint bytes; - gchar *mask_data; + guint8 *mask_data; gchar *pattern_name; PSelect *psel; @@ -392,15 +389,13 @@ gimp_pattern_select_widget_set_popup (GtkWidget *widget, if (psel) { pattern_name = - gimp_pattern_get_pattern_data (pname, - &width, &height, &bytes, &mask_data); + gimp_patterns_get_pattern_data (pname, + &length, &width, &height, &bytes, &mask_data); pattern_select_invoker (pname, width, height, bytes, mask_data, 0, psel); - - if (psel->pattern_popup_pnt && - gimp_pattern_set_popup (psel->pattern_popup_pnt, pname)) - ret_val = TRUE; + + if (psel->pattern_popup_pnt) + gimp_patterns_set_popup (psel->pattern_popup_pnt, pname); } - - return ret_val; } + diff --git a/libgimp/gimppatterns_pdb.c b/libgimp/gimppatterns_pdb.c new file mode 100644 index 0000000000..bfbf332e56 --- /dev/null +++ b/libgimp/gimppatterns_pdb.c @@ -0,0 +1,59 @@ +/* LIBGIMP - The GIMP Library + * Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball + * + * gimppatterns_pdb.c + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* NOTE: This file is autogenerated by pdbgen.pl */ + +#include "gimp.h" + +gchar * +gimp_patterns_get_pattern_data (gchar *name, + gint *length, + gint *width, + gint *height, + gint *mask_bpp, + guint8 **mask_data) +{ + GParam *return_vals; + gint nreturn_vals; + + return_vals = gimp_run_procedure ("gimp_patterns_get_pattern_data", + &nreturn_vals, + PARAM_STRING, name, + PARAM_END); + + *length = 0; + name = NULL; + if (return_vals[0].data.d_status == STATUS_SUCCESS) + { + name = g_strdup (return_vals[1].data.d_string); + *width = return_vals[2].data.d_int32; + *height = return_vals[3].data.d_int32; + *mask_bpp = return_vals[4].data.d_int32; + *length = return_vals[5].data.d_int32; + *mask_data = g_new (guint8, *length); + memcpy (*mask_data, return_vals[6].data.d_int8array, + *length * sizeof (guint8)); + } + + gimp_destroy_params (return_vals, nreturn_vals); + + return name; +} diff --git a/libgimp/gimppatterns_pdb.h b/libgimp/gimppatterns_pdb.h new file mode 100644 index 0000000000..d91b6ada0f --- /dev/null +++ b/libgimp/gimppatterns_pdb.h @@ -0,0 +1,46 @@ +/* LIBGIMP - The GIMP Library + * Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball + * + * gimppatterns_pdb.h + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* NOTE: This file is autogenerated by pdbgen.pl */ + +#ifndef __GIMP_PATTERNS_H__ +#define __GIMP_PATTERNS_H__ + + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +gchar* gimp_patterns_get_pattern_data (gchar *name, + gint *length, + gint *width, + gint *height, + gint *mask_bpp, + guint8 **mask_data); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* __GIMP_PATTERNS_H__ */ diff --git a/libgimp/gimppatternselect_pdb.c b/libgimp/gimppatternselect_pdb.c new file mode 100644 index 0000000000..803240ebb7 --- /dev/null +++ b/libgimp/gimppatternselect_pdb.c @@ -0,0 +1,72 @@ +/* LIBGIMP - The GIMP Library + * Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball + * + * gimppatternselect_pdb.c + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* NOTE: This file is autogenerated by pdbgen.pl */ + +#include "gimp.h" + +void +gimp_patterns_popup (gchar *pattern_callback, + gchar *popup_title, + gchar *initial_pattern) +{ + GParam *return_vals; + gint nreturn_vals; + + return_vals = gimp_run_procedure ("gimp_patterns_popup", + &nreturn_vals, + PARAM_STRING, pattern_callback, + PARAM_STRING, popup_title, + PARAM_STRING, initial_pattern, + PARAM_END); + + gimp_destroy_params (return_vals, nreturn_vals); +} + +void +gimp_patterns_close_popup (gchar *pattern_callback) +{ + GParam *return_vals; + gint nreturn_vals; + + return_vals = gimp_run_procedure ("gimp_patterns_close_popup", + &nreturn_vals, + PARAM_STRING, pattern_callback, + PARAM_END); + + gimp_destroy_params (return_vals, nreturn_vals); +} + +void +gimp_patterns_set_popup (gchar *pattern_callback, + gchar *pattern_name) +{ + GParam *return_vals; + gint nreturn_vals; + + return_vals = gimp_run_procedure ("gimp_patterns_set_popup", + &nreturn_vals, + PARAM_STRING, pattern_callback, + PARAM_STRING, pattern_name, + PARAM_END); + + gimp_destroy_params (return_vals, nreturn_vals); +} diff --git a/libgimp/gimppatternselect_pdb.h b/libgimp/gimppatternselect_pdb.h new file mode 100644 index 0000000000..30b392fe73 --- /dev/null +++ b/libgimp/gimppatternselect_pdb.h @@ -0,0 +1,46 @@ +/* LIBGIMP - The GIMP Library + * Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball + * + * gimppatternselect_pdb.h + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* NOTE: This file is autogenerated by pdbgen.pl */ + +#ifndef __GIMP_PATTERN_SELECT_PDB_H__ +#define __GIMP_PATTERN_SELECT_PDB_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* For information look into the C source or the html documentation */ + + +void gimp_patterns_popup (gchar *pattern_callback, + gchar *popup_title, + gchar *initial_pattern); +void gimp_patterns_close_popup (gchar *pattern_callback); +void gimp_patterns_set_popup (gchar *pattern_callback, + gchar *pattern_name); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __GIMP_PATTERN_SELECT_PDB_H__ */ diff --git a/libgimp/gimpproceduraldb_pdb.c b/libgimp/gimpproceduraldb_pdb.c index f7abc023ef..744eeca415 100644 --- a/libgimp/gimpproceduraldb_pdb.c +++ b/libgimp/gimpproceduraldb_pdb.c @@ -19,6 +19,8 @@ * Boston, MA 02111-1307, USA. */ +#include + #include "gimp.h" void @@ -126,6 +128,62 @@ gimp_procedural_db_query (gchar *name_regexp, gimp_destroy_params (return_vals, nreturn_vals); } +gboolean +gimp_procedural_db_proc_arg (gchar *proc_name, + gint nth_arg, + GimpParamDef *param) +{ + GimpParam *return_vals; + gint nreturn_vals; + gboolean success; + + return_vals = gimp_run_procedure ("gimp_procedural_db_proc_arg", + &nreturn_vals, + PARAM_STRING, proc_name, + PARAM_INT32, nth_arg, + PARAM_END); + + success = (return_vals[0].data.d_status == STATUS_SUCCESS); + if (success) + { + param->type = return_vals[1].data.d_int32; + param->name = g_strdup (return_vals[2].data.d_string); + param->description = g_strdup (return_vals[3].data.d_string); + } + + gimp_destroy_params (return_vals, nreturn_vals); + + return success; +} + +gboolean +gimp_procedural_db_proc_val (gchar *proc_name, + gint nth_val, + GimpParamDef *param) +{ + GimpParam *return_vals; + gint nreturn_vals; + gboolean success; + + return_vals = gimp_run_procedure ("gimp_procedural_db_proc_val", + &nreturn_vals, + PARAM_STRING, proc_name, + PARAM_INT32, nth_val, + PARAM_END); + + success = (return_vals[0].data.d_status == STATUS_SUCCESS); + if (success) + { + param->type = return_vals[1].data.d_int32; + param->name = g_strdup (return_vals[2].data.d_string); + param->description = g_strdup (return_vals[3].data.d_string); + } + + gimp_destroy_params (return_vals, nreturn_vals); + + return success; +} + gboolean gimp_procedural_db_proc_info (gchar *proc_name, gchar **proc_blurb, @@ -164,58 +222,26 @@ gimp_procedural_db_proc_info (gchar *proc_name, for (i = 0; i < *nparams; i++) { - GimpParam *rvals; - gint nrvals; - - rvals = gimp_run_procedure ("gimp_procedural_db_proc_arg", - &nrvals, - PARAM_STRING, proc_name, - PARAM_INT32, i, - PARAM_END); - - if (rvals[0].data.d_status == STATUS_SUCCESS) - { - (* params) [i].type = rvals[1].data.d_int32; - (* params) [i].name = g_strdup (rvals[2].data.d_string); - (* params) [i].description = g_strdup (rvals[3].data.d_string); - } - else + if (! gimp_procedural_db_proc_arg (proc_name, i, &(*params)[i])) { g_free (*params); g_free (*return_vals); - gimp_destroy_params (rvals, nrvals); + gimp_destroy_params (ret_vals, nret_vals); + return FALSE; } - - gimp_destroy_params (rvals, nrvals); } for (i = 0; i < *nreturn_vals; i++) { - GimpParam *rvals; - gint nrvals; - - rvals = gimp_run_procedure ("gimp_procedural_db_proc_val", - &nrvals, - PARAM_STRING, proc_name, - PARAM_INT32, i, - PARAM_END); - - if (rvals[0].data.d_status == STATUS_SUCCESS) - { - (* return_vals)[i].type = rvals[1].data.d_int32; - (* return_vals)[i].name = g_strdup (rvals[2].data.d_string); - (* return_vals)[i].description = g_strdup (rvals[3].data.d_string); - } - else + if (! gimp_procedural_db_proc_val (proc_name, i, &(*return_vals)[i])) { g_free (*params); g_free (*return_vals); - gimp_destroy_params (rvals, nrvals); + gimp_destroy_params (ret_vals, nret_vals); + return FALSE; } - - gimp_destroy_params (rvals, nrvals); } } else diff --git a/libgimp/gimpproceduraldb_pdb.h b/libgimp/gimpproceduraldb_pdb.h index 0d99e1f65a..4e8ce0513b 100644 --- a/libgimp/gimpproceduraldb_pdb.h +++ b/libgimp/gimpproceduraldb_pdb.h @@ -65,22 +65,28 @@ void gimp_procedural_db_query (gchar *name_regexp, gint *nprocs, gchar ***proc_names); + +gboolean gimp_procedural_db_proc_arg (gchar *proc_name, + gint nth_arg, + GimpParamDef *param); +gboolean gimp_procedural_db_proc_val (gchar *proc_name, + gint nth_val, + GimpParamDef *param); + /* Query the gimp application's procedural database * regarding a particular procedure. */ -gboolean gimp_procedural_db_query_proc (gchar *proc_name, - gchar **proc_blurb, - gchar **proc_help, - gchar **proc_author, - gchar **proc_copyright, - gchar **proc_date, - gint *proc_type, - gint *nparams, - gint *nreturn_vals, - GimpParamDef **params, - GimpParamDef **return_vals); - - +gboolean gimp_procedural_db_proc_info (gchar *proc_name, + gchar **proc_blurb, + gchar **proc_help, + gchar **proc_author, + gchar **proc_copyright, + gchar **proc_date, + gint *proc_type, + gint *nparams, + gint *nreturn_vals, + GimpParamDef **params, + GimpParamDef **return_vals); #ifdef __cplusplus } diff --git a/libgimpbase/gimpparasite.c b/libgimpbase/gimpparasite.c index e42566e05e..bf96c45b15 100644 --- a/libgimpbase/gimpparasite.c +++ b/libgimpbase/gimpparasite.c @@ -33,6 +33,7 @@ #endif #include "gimpparasite.h" +#include "gimpparasite_pdb.h" #ifdef DEBUG @@ -181,7 +182,7 @@ gimp_parasite_name (const GimpParasite *parasite) return NULL; } -void * +gpointer gimp_parasite_data (const GimpParasite *parasite) { if (parasite) @@ -198,3 +199,44 @@ gimp_parasite_data_size (const GimpParasite *parasite) return 0; } + +void +gimp_attach_new_parasite (const gchar *name, + gint flags, + gint size, + const gpointer data) +{ + GimpParasite *parasite = gimp_parasite_new (name, flags, size, data); + + gimp_parasite_attach (parasite); + + gimp_parasite_free (parasite); +} + +void +gimp_drawable_attach_new_parasite (gint32 drawable, + const gchar *name, + gint flags, + gint size, + const gpointer data) +{ + GimpParasite *parasite = gimp_parasite_new (name, flags, size, data); + + gimp_drawable_parasite_attach (drawable, parasite); + + gimp_parasite_free (parasite); +} + +void +gimp_image_attach_new_parasite (gint32 image_ID, + const gchar *name, + gint flags, + gint size, + const gpointer data) +{ + GimpParasite *parasite = gimp_parasite_new (name, flags, size, data); + + gimp_image_parasite_attach (image_ID, parasite); + + gimp_parasite_free (parasite); +} diff --git a/libgimpbase/gimpparasite.h b/libgimpbase/gimpparasite.h index f7f4d291e3..d7303ef49e 100644 --- a/libgimpbase/gimpparasite.h +++ b/libgimpbase/gimpparasite.h @@ -54,27 +54,42 @@ struct _GimpParasite }; -GimpParasite * gimp_parasite_new (const gchar *name, - guint32 flags, - guint32 size, - const gpointer data); -void gimp_parasite_free (GimpParasite *parasite); +GimpParasite * gimp_parasite_new (const gchar *name, + guint32 flags, + guint32 size, + const gpointer data); +void gimp_parasite_free (GimpParasite *parasite); -GimpParasite * gimp_parasite_copy (const GimpParasite *parasite); +GimpParasite * gimp_parasite_copy (const GimpParasite *parasite); -gboolean gimp_parasite_compare (const GimpParasite *a, - const GimpParasite *b); +gboolean gimp_parasite_compare (const GimpParasite *a, + const GimpParasite *b); -gboolean gimp_parasite_is_type (const GimpParasite *parasite, - const gchar *name); -gboolean gimp_parasite_is_persistent (const GimpParasite *parasite); -gboolean gimp_parasite_is_undoable (const GimpParasite *parasite); -gboolean gimp_parasite_has_flag (const GimpParasite *parasite, - gulong flag); -gulong gimp_parasite_flags (const GimpParasite *parasite); -const gchar * gimp_parasite_name (const GimpParasite *parasite); -void * gimp_parasite_data (const GimpParasite *parasite); -glong gimp_parasite_data_size (const GimpParasite *parasite); +gboolean gimp_parasite_is_type (const GimpParasite *parasite, + const gchar *name); +gboolean gimp_parasite_is_persistent (const GimpParasite *parasite); +gboolean gimp_parasite_is_undoable (const GimpParasite *parasite); +gboolean gimp_parasite_has_flag (const GimpParasite *parasite, + gulong flag); +gulong gimp_parasite_flags (const GimpParasite *parasite); +const gchar * gimp_parasite_name (const GimpParasite *parasite); +gpointer gimp_parasite_data (const GimpParasite *parasite); +glong gimp_parasite_data_size (const GimpParasite *parasite); + +void gimp_attach_new_parasite (const gchar *name, + gint flags, + gint size, + const gpointer data); +void gimp_drawable_attach_new_parasite (gint32 drawable_ID, + const gchar *name, + gint flags, + gint size, + const gpointer data); +void gimp_image_attach_new_parasite (gint32 image_ID, + const gchar *name, + gint flags, + gint size, + const gpointer data); #ifdef __cplusplus diff --git a/tools/pdbgen/lib.pl b/tools/pdbgen/lib.pl index cd76664b86..ed962e01bc 100644 --- a/tools/pdbgen/lib.pl +++ b/tools/pdbgen/lib.pl @@ -252,7 +252,9 @@ CODE $arglist .= "$datatype **$_->{name}"; } - $return_args .= "\n" . ' ' x 2 . "gint i;"; + if ($ch || $cf) { + $return_args .= "\n" . ' ' x 2 . "gint i;"; + } my $numvar = '*' . $_->{array}->{name}; $numvar = "num_$_->{name}" if exists $_->{array}->{no_lib}; @@ -264,7 +266,7 @@ NEW for (i = 0; i < $numvar; i++) $dh$_->{name}$df\[i] = ${ch}return_vals[$argc].data.d_$type\[i]${cf}; CP1 - memcpy ($var, return_vals[$argc].data.d_$type\[i], + memcpy ($var, return_vals[$argc].data.d_$type, $numvar * sizeof ($datatype)); CP2 } @@ -378,10 +380,14 @@ $funcname ($clist) CODE } - my $lgpl = <<'LGPL'; + my $lgpl_top = <<'LGPL'; /* LIBGIMP - The GIMP Library * Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball * +LGPL + + my $lgpl_bottom = <<'LGPL'; + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either @@ -396,7 +402,7 @@ CODE * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. - */ + */ /* NOTE: This file is autogenerated by pdbgen.pl */ @@ -405,10 +411,12 @@ LGPL # We generate two files, a _pdb.h file with prototypes for all # the functions we make, and a _pdb.c file for the actual implementation while (my($group, $out) = each %out) { - my $hfile = "$destdir/gimp${group}pdb.h$FILE_EXT"; - my $cfile = "$destdir/gimp${group}pdb.c$FILE_EXT"; - - foreach ($hfile $cfile) { s/_//g; s/pdb\./_pdb./ } + my $hname = "gimp${group}pdb.h"; + my $cname = "gimp${group}pdb.c"; + $hname =~ s/_//g; $hname =~ s/pdb\./_pdb./; + $cname =~ s/_//g; $cname =~ s/pdb\./_pdb./; + my $hfile = "$destdir/$hname$FILE_EXT"; + my $cfile = "$destdir/$cname$FILE_EXT"; my $extra = {}; if (exists $main::grp{$group}->{extra}->{lib}) { @@ -482,21 +490,20 @@ LGPL chomp $body; open HFILE, "> $hfile" or die "Can't open $hfile: $!\n"; - print HFILE $lgpl; - my $guard = "__GIMP_\U$group\E_H__"; + print HFILE $lgpl_top; + print HFILE " * $hname\n"; + print HFILE $lgpl_bottom; + my $guard = "__GIMP_\U$group\E_PDB_H__"; print HFILE < -#include - - #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ +/* For information look into the C source or the html documentation */ + $body @@ -505,15 +512,16 @@ $body } #endif /* __cplusplus */ - #endif /* $guard */ HEADER close HFILE; &write_file($hfile); open CFILE, "> $cfile" or die "Can't open $cfile: $!\n"; - print CFILE $lgpl; - print CFILE qq/#include "gimp${group}.h"\n/; + print CFILE $lgpl_top; + print CFILE " * $cname\n"; + print CFILE $lgpl_bottom; + print CFILE qq/#include "gimp.h"\n/; print CFILE qq/#include "gimpprivate.h"\n/ if $privatevars; print CFILE "\n", $extra->{code} if exists $extra->{code}; print CFILE $out->{code}; diff --git a/tools/pdbgen/pdb/help.pdb b/tools/pdbgen/pdb/help.pdb index e2ff42a1f6..78056391bf 100644 --- a/tools/pdbgen/pdb/help.pdb +++ b/tools/pdbgen/pdb/help.pdb @@ -53,7 +53,7 @@ HELP @headers = qw("gimphelp.h"); @procs = qw(help); -%exports = (app => [@procs]); +%exports = (app => [@procs], lib => [@procs]); $desc = 'Help procedures'; diff --git a/tools/pdbgen/pdb/parasite.pdb b/tools/pdbgen/pdb/parasite.pdb index 99831aeb9f..513404b30a 100644 --- a/tools/pdbgen/pdb/parasite.pdb +++ b/tools/pdbgen/pdb/parasite.pdb @@ -63,37 +63,6 @@ sub convert_proc { # The defs -sub parasite_new { - $blurb = 'Creates a new parasite.'; - - $help = 'Creates a new parasite unatached to to any image or drawable.'; - - &pdb_misc; - - @inargs = ( - &name_arg('create'), - { name => 'flags', type => 'int32', - desc => 'The flags (1 == persistance)' }, - { name => 'size', type => '0 <= int32', - desc => 'The size of the data in bytes' }, - { name => 'data', type => 'string', - desc => 'The data', no_success => 1 } - ); - - @outargs = ( ¶site_outarg('new') ); - - %invoke = ( - code => <<'CODE' -{ - if (size > 0 && data == NULL) - success = FALSE; - else - success = (parasite = gimp_parasite_new (name, flags, size, data)) != NULL; -} -CODE - ); -} - sub parasite_find { $blurb = 'Finds the named parasite.'; @@ -185,15 +154,15 @@ gimp_parasite_attach_new (gchar *name, gint size, gpointer data) { - GimpParasite *p = gimp_parasite_new (name, flags, size, data); - gimp_parasite_attach (p); - gimp_parasite_free (p); + GimpParasite *parasite = gimp_parasite_new (name, flags, size, data); + + gimp_parasite_attach (parasite); + gimp_parasite_free (parasite); } CODE -@procs = qw(parasite_new parasite_find parasite_attach parasite_detach - parasite_list); +@procs = qw(parasite_find parasite_attach parasite_detach parasite_list); @types = ( ['drawable', '&drawable_arg' , 'drawable'], @@ -203,7 +172,7 @@ CODE my %code; foreach $type (@types) { - foreach (@procs[1..4]) { + foreach (@procs[0..3]) { my $desc = ($type->[0] =~ /^[aeiou]/ ? 'an ' : 'a ') . $type->[0]; my $args = join(', ', map { /^&/ ? $_ : "'$_'" } @$type); my $pre = ""; my $post = ""; diff --git a/tools/pdbgen/pdb/pattern_select.pdb b/tools/pdbgen/pdb/pattern_select.pdb index f554678ea1..470d1ec33e 100644 --- a/tools/pdbgen/pdb/pattern_select.pdb +++ b/tools/pdbgen/pdb/pattern_select.pdb @@ -157,7 +157,7 @@ pattern_get_patternselect (gchar *name) CODE @procs = qw(patterns_popup patterns_close_popup patterns_set_popup); -%exports = (app => [@procs]); +%exports = (app => [@procs], lib => [@procs]); $desc = 'Pattern UI';