diff --git a/ChangeLog b/ChangeLog index 8a80ba0055..dcaf2914ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,67 @@ +2000-05-31 Michael Natterer + Sven Neumann + + Episode IV... + + * app/Makefile.am + + * app/message_cmds.c: new name + * app/interface_cmds.c: removed + + * app/help_cmds.c: new name + * app/gimphelp_cmds.c: removed + + * app/internal_procs.c + * app/gimphelp_cmds.c + * app/plug_in_cmds.c: moved gimp_plugin_help_register to + plug_in_cmds.c, s/gimp_plugin_domain_add/gimp_plugin_domain_register/ + + * libgimp/Makefile.am + * libgimp/gimp_pdb.h + * libgimp/gimpfileops_pdb.[ch] + * libgimp/gimpguides_pdb.[ch] + * libgimp/gimpmessage_pdb.[ch] + * libgimp/gimpprocedural_db_pdb.[ch] + * libgimp/gimpplugin_pdb.[ch]: new files containing PDB wrappers + moved out of libgimp/gimp.[ch] + + * libgimp/gimpchannel_pdb.c + * libgimp/gimpdisplay_pdb.[ch] + * libgimp/gimpdrawable_pdb.[ch] + * libgimp/gimphelp_pdb.[ch] + * libgimp/gimpimage_pdb.[ch] + * libgimp/gimplayer_pdb.c + * libgimp/gimpparasite_pdb.c + * libgimp/gimpselection_pdb.c: various changes. + + * libgimp/gimpunit.c: new file + * libgimp/gimpunit_pdb.[ch]: contains only PDB wrappers prefixed + with "_" which are called from libgimp/gimpunit.c only. + + * libgimp/gimpunit.h: minor stuff + + * libgimp/gimpcompat.h: declared the following functions obsolete: + gimp_query_database + gimp_query_images + + * libgimp/gimp.[ch]: removed all PDB wrappers. + + * tools/pdbgen/Makefile.am + * tools/pdbgen/groups.pl: changed + + * tools/pdbgen/lib.pl: tried to fix libgimp autogeneration and + fixed just a few comments. + + * tools/pdbgen/pdb/interface.pdb + * tools/pdbgen/pdb/gimphelp.pdb: removed + + * tools/pdbgen/pdb/help.pdb + * tools/pdbgen/pdb/message.pdb: new names + + * plug-ins/script-fu/script-fu.c + * plug-ins/perl/Gimp/Lib.xs: + s/gimp_plugin_domain_add/gimp_plugin_domain_register/ + 2000-05-31 Michael Natterer Sven Neumann diff --git a/app/Makefile.am b/app/Makefile.am index cd73cd9909..350faceb84 100644 --- a/app/Makefile.am +++ b/app/Makefile.am @@ -198,7 +198,6 @@ gimp_SOURCES = \ gimpdnd.h \ gimphelp.c \ gimphelp.h \ - gimphelp_cmds.c \ gimphistogram.c \ gimphistogram.h \ gimphistogramP.h \ @@ -240,6 +239,7 @@ gimp_SOURCES = \ guides_cmds.c \ gximage.c \ gximage.h \ + help_cmds.c \ histogramwidget.c \ histogramwidget.h \ histogram_tool.c \ @@ -262,7 +262,6 @@ gimp_SOURCES = \ ink.h \ interface.c \ interface.h \ - interface_cmds.c \ internal_procs.c \ internal_procs.h \ invert.c \ @@ -294,6 +293,7 @@ gimp_SOURCES = \ measure.h \ menus.c \ menus.h \ + message_cmds.c \ misc_cmds.c \ module_db.c \ module_db.h \ diff --git a/app/gimphelp_cmds.c b/app/help_cmds.c similarity index 61% rename from app/gimphelp_cmds.c rename to app/help_cmds.c index da0b18de3f..c10a6eb223 100644 --- a/app/gimphelp_cmds.c +++ b/app/help_cmds.c @@ -21,16 +21,13 @@ #include "procedural_db.h" #include "gimphelp.h" -#include "plug_in.h" static ProcRecord help_proc; -static ProcRecord plugin_help_register_proc; void -register_gimphelp_procs (void) +register_help_procs (void) { procedural_db_register (&help_proc); - procedural_db_register (&plugin_help_register_proc); } static Argument * @@ -83,54 +80,3 @@ static ProcRecord help_proc = NULL, { { help_invoker } } }; - -static Argument * -plugin_help_register_invoker (Argument *args) -{ - gboolean success = TRUE; - gchar *help_path; - PlugInDef *plug_in_def; - - help_path = (gchar *) args[0].value.pdb_pointer; - if (help_path == NULL) - success = FALSE; - - if (success) - { - if (current_plug_in && current_plug_in->query) - { - plug_in_def = current_plug_in->user_data; - - if (plug_in_def->help_path) - g_free (plug_in_def->help_path); - plug_in_def->help_path = g_strdup (help_path); - } - } - - return procedural_db_return_args (&plugin_help_register_proc, success); -} - -static ProcArg plugin_help_register_inargs[] = -{ - { - PDB_STRING, - "help_path", - "The rootdir of the plug-in's help pages" - } -}; - -static ProcRecord plugin_help_register_proc = -{ - "gimp_plugin_help_register", - "Register a help path for a plug-in.", - "This procedure changes the help rootdir for the plug-in which calls it. All subsequent calls of gimp_help from this plug-in will be interpreted relative to this rootdir. This procedure can only be called in the query function of a plug-in and it has to be called before any procedure is installed.", - "Michael Natterer ", - "Michael Natterer ", - "2000", - PDB_INTERNAL, - 1, - plugin_help_register_inargs, - 0, - NULL, - { { plugin_help_register_invoker } } -}; diff --git a/app/internal_procs.c b/app/internal_procs.c index 0d14205157..cacbd2db4f 100644 --- a/app/internal_procs.c +++ b/app/internal_procs.c @@ -41,12 +41,12 @@ void register_gdisplay_procs (void); void register_gimage_procs (void); void register_gimage_mask_procs (void); void register_gimprc_procs (void); -void register_gimphelp_procs (void); void register_gradient_procs (void); void register_gradient_select_procs (void); void register_guides_procs (void); -void register_interface_procs (void); +void register_help_procs (void); void register_layer_procs (void); +void register_message_procs (void); void register_misc_procs (void); void register_palette_procs (void); void register_parasite_procs (void); @@ -107,43 +107,43 @@ internal_procs_init (void) app_init_update_status (NULL, _("Gimprc procedures"), 0.517); register_gimprc_procs (); - app_init_update_status (NULL, _("Help procedures"), 0.526); - register_gimphelp_procs (); - - app_init_update_status (NULL, _("Gradients"), 0.533); + app_init_update_status (NULL, _("Gradients"), 0.526); register_gradient_procs (); - app_init_update_status (NULL, _("Gradient UI"), 0.548); + app_init_update_status (NULL, _("Gradient UI"), 0.542); register_gradient_select_procs (); - app_init_update_status (NULL, _("Guide procedures"), 0.56); + app_init_update_status (NULL, _("Guide procedures"), 0.554); register_guides_procs (); - app_init_update_status (NULL, _("Interface"), 0.579); - register_interface_procs (); + app_init_update_status (NULL, _("Help procedures"), 0.573); + register_help_procs (); - app_init_update_status (NULL, _("Layer"), 0.588); + app_init_update_status (NULL, _("Layer"), 0.576); register_layer_procs (); - app_init_update_status (NULL, _("Miscellaneous"), 0.684); + app_init_update_status (NULL, _("Interface"), 0.672); + register_message_procs (); + + app_init_update_status (NULL, _("Miscellaneous"), 0.681); register_misc_procs (); - app_init_update_status (NULL, _("Palette"), 0.69); + app_init_update_status (NULL, _("Palette"), 0.687); register_palette_procs (); - app_init_update_status (NULL, _("Parasite procedures"), 0.712); + app_init_update_status (NULL, _("Parasite procedures"), 0.709); register_parasite_procs (); - app_init_update_status (NULL, _("Paths"), 0.752); + app_init_update_status (NULL, _("Paths"), 0.749); register_paths_procs (); - app_init_update_status (NULL, _("Pattern UI"), 0.793); + app_init_update_status (NULL, _("Pattern UI"), 0.789); register_pattern_select_procs (); - app_init_update_status (NULL, _("Patterns"), 0.802); + app_init_update_status (NULL, _("Patterns"), 0.799); register_patterns_procs (); - app_init_update_status (NULL, _("Plug-in"), 0.814); + app_init_update_status (NULL, _("Plug-in"), 0.811); register_plug_in_procs (); app_init_update_status (NULL, _("Procedural database"), 0.83); diff --git a/app/interface_cmds.c b/app/message_cmds.c similarity index 99% rename from app/interface_cmds.c rename to app/message_cmds.c index 4ce0466ced..f563d91c75 100644 --- a/app/interface_cmds.c +++ b/app/message_cmds.c @@ -27,7 +27,7 @@ static ProcRecord message_get_handler_proc; static ProcRecord message_set_handler_proc; void -register_interface_procs (void) +register_message_procs (void) { procedural_db_register (&message_proc); procedural_db_register (&message_get_handler_proc); diff --git a/app/plug_in_cmds.c b/app/plug_in_cmds.c index 9c3100c841..abc70ac81d 100644 --- a/app/plug_in_cmds.c +++ b/app/plug_in_cmds.c @@ -31,7 +31,8 @@ static ProcRecord progress_init_proc; static ProcRecord progress_update_proc; static ProcRecord temp_PDB_name_proc; static ProcRecord plugins_query_proc; -static ProcRecord plugin_domain_add_proc; +static ProcRecord plugin_domain_register_proc; +static ProcRecord plugin_help_register_proc; void register_plug_in_procs (void) @@ -40,7 +41,8 @@ register_plug_in_procs (void) procedural_db_register (&progress_update_proc); procedural_db_register (&temp_PDB_name_proc); procedural_db_register (&plugins_query_proc); - procedural_db_register (&plugin_domain_add_proc); + procedural_db_register (&plugin_domain_register_proc); + procedural_db_register (&plugin_help_register_proc); } static int @@ -387,7 +389,7 @@ static ProcRecord plugins_query_proc = }; static Argument * -plugin_domain_add_invoker (Argument *args) +plugin_domain_register_invoker (Argument *args) { gboolean success = TRUE; gchar *domain_name; @@ -416,10 +418,10 @@ plugin_domain_add_invoker (Argument *args) } } - return procedural_db_return_args (&plugin_domain_add_proc, success); + return procedural_db_return_args (&plugin_domain_register_proc, success); } -static ProcArg plugin_domain_add_inargs[] = +static ProcArg plugin_domain_register_inargs[] = { { PDB_STRING, @@ -433,18 +435,69 @@ static ProcArg plugin_domain_add_inargs[] = } }; -static ProcRecord plugin_domain_add_proc = +static ProcRecord plugin_domain_register_proc = { - "gimp_plugin_domain_add", - "Adds a textdomain for localisation.", + "gimp_plugin_domain_register", + "Registers a textdomain for localisation.", "This procedure adds a textdomain to the list of domains Gimp searches for strings when translating its menu entries. There is no need to call this function for plug-ins that have their strings included in the gimp-std-plugins domain as that is used by default. If the compiled message catalog is not in the standard location, you may specify an absolute path to another location. This procedure can only be called in the query function of a plug-in and it has to be called before any procedure is installed.", "Sven Neumann", "Sven Neumann", "2000", PDB_INTERNAL, 2, - plugin_domain_add_inargs, + plugin_domain_register_inargs, 0, NULL, - { { plugin_domain_add_invoker } } + { { plugin_domain_register_invoker } } +}; + +static Argument * +plugin_help_register_invoker (Argument *args) +{ + gboolean success = TRUE; + gchar *help_path; + PlugInDef *plug_in_def; + + help_path = (gchar *) args[0].value.pdb_pointer; + if (help_path == NULL) + success = FALSE; + + if (success) + { + if (current_plug_in && current_plug_in->query) + { + plug_in_def = current_plug_in->user_data; + + if (plug_in_def->help_path) + g_free (plug_in_def->help_path); + plug_in_def->help_path = g_strdup (help_path); + } + } + + return procedural_db_return_args (&plugin_help_register_proc, success); +} + +static ProcArg plugin_help_register_inargs[] = +{ + { + PDB_STRING, + "help_path", + "The rootdir of the plug-in's help pages" + } +}; + +static ProcRecord plugin_help_register_proc = +{ + "gimp_plugin_help_register", + "Register a help path for a plug-in.", + "This procedure changes the help rootdir for the plug-in which calls it. All subsequent calls of gimp_help from this plug-in will be interpreted relative to this rootdir. This procedure can only be called in the query function of a plug-in and it has to be called before any procedure is installed.", + "Michael Natterer ", + "Michael Natterer ", + "2000", + PDB_INTERNAL, + 1, + plugin_help_register_inargs, + 0, + NULL, + { { plugin_help_register_invoker } } }; diff --git a/libgimp/Makefile.am b/libgimp/Makefile.am index 8f879109f2..4627831182 100644 --- a/libgimp/Makefile.am +++ b/libgimp/Makefile.am @@ -80,6 +80,7 @@ endif libgimp_la_SOURCES = \ gimp.c \ gimp.h \ + gimp_pdb.h \ gimpchannel_pdb.h \ gimpchannel_pdb.c \ gimpcolorspace.c \ @@ -92,7 +93,10 @@ libgimp_la_SOURCES = \ gimpdrawable_pdb.h \ gimpenv.c \ gimpenv.h \ + gimpfileops_pdb.c \ + gimpfileops_pdb.h \ gimpgradient_pdb.c \ + gimpguides_pdb.c \ gimphelp.c \ gimphelp_pdb.c \ gimphelp_pdb.h \ @@ -102,6 +106,8 @@ libgimp_la_SOURCES = \ gimplayer_pdb.h \ gimpmatrix.c \ gimpmatrix.h \ + gimpmessage_pdb.c \ + gimpmessage_pdb.h \ gimppalette_pdb.c \ gimpparasite.c \ gimpparasite.h \ @@ -111,6 +117,10 @@ libgimp_la_SOURCES = \ gimpparasite_pdb.h \ gimppixelrgn.c \ gimppixelrgn.h \ + gimpplugin_pdb.c \ + gimpplugin_pdb.h \ + gimpproceduraldb_pdb.c \ + gimpproceduraldb_pdb.h \ gimpprotocol.c \ gimpprotocol.h \ gimpselection_pdb.c \ @@ -121,6 +131,7 @@ libgimp_la_SOURCES = \ gimptile.h \ gimpunit_pdb.c \ gimpunit_pdb.h \ + gimpunit.c \ gimpunit.h \ gimputils.c \ gimputils.h \ @@ -153,15 +164,20 @@ libgimpui_la_SOURCES = \ gimpinclude_HEADERS = \ gimp.h \ + gimp_pdb.h \ gimpchannel_pdb.h \ gimpdisplay_pdb.h \ gimpdrawable_pdb.h \ + gimpfileops_pdb.h \ gimpgradient_pdb.h \ gimphelp_pdb.h \ gimpimage_pdb.h \ gimplayer_pdb.h \ + gimpmessage_pdb.h \ gimppalette_pdb.h \ gimpparasite_pdb.h \ + gimpplugin_pdb.h \ + gimpproceduraldb_pdb.h \ gimpselection_pdb.h \ gimpchainbutton.h \ gimpcolorbutton.h \ @@ -169,6 +185,7 @@ gimpinclude_HEADERS = \ gimpcolorselector.h \ gimpcolorspace.h \ gimpcompat.h \ + gimpdrawable.h \ gimpdialog.h \ gimpenums.h \ gimpenv.h \ @@ -193,7 +210,6 @@ gimpinclude_HEADERS = \ gimptypes.h \ gimpui.h \ gimpunit.h \ - gimpunit_pdb.h \ gimpunitmenu.h \ gimputils.h \ gimpvector.h \ diff --git a/libgimp/gimp.c b/libgimp/gimp.c index dba1abeb48..3e1f4e7ecc 100644 --- a/libgimp/gimp.c +++ b/libgimp/gimp.c @@ -310,100 +310,6 @@ gimp_quit (void) exit (0); } -void -gimp_set_data (gchar *id, - gpointer data, - guint32 length) -{ - GimpParam *return_vals; - int nreturn_vals; - - return_vals = gimp_run_procedure ("gimp_procedural_db_set_data", - &nreturn_vals, - PARAM_STRING, id, - PARAM_INT32, length, - PARAM_INT8ARRAY, data, - PARAM_END); - - gimp_destroy_params (return_vals, nreturn_vals); -} - -guint32 -gimp_get_data_size (gchar *id) -{ - GimpParam *return_vals; - gint nreturn_vals; - guint32 length; - - return_vals = gimp_run_procedure ("gimp_procedural_db_get_data_size", - &nreturn_vals, - PARAM_STRING, id, - PARAM_END); - - if (return_vals[0].data.d_status == STATUS_SUCCESS) - length= return_vals[1].data.d_int32; - else - length= 0; - - gimp_destroy_params (return_vals, nreturn_vals); - return length; -} - - -void -gimp_get_data (gchar *id, - gpointer data) -{ - GimpParam *return_vals; - gint nreturn_vals; - gint length; - gchar *returned_data; - - return_vals = gimp_run_procedure ("gimp_procedural_db_get_data", - &nreturn_vals, - PARAM_STRING, id, - PARAM_END); - - if (return_vals[0].data.d_status == STATUS_SUCCESS) - { - length = return_vals[1].data.d_int32; - returned_data = (gchar *) return_vals[2].data.d_int8array; - - memcpy (data, returned_data, length); - } - - gimp_destroy_params (return_vals, nreturn_vals); -} - - -void -gimp_progress_init (char *message) -{ - GimpParam *return_vals; - gint nreturn_vals; - - return_vals = gimp_run_procedure ("gimp_progress_init", - &nreturn_vals, - PARAM_STRING, message, - PARAM_INT32, _gdisp_ID, - PARAM_END); - - gimp_destroy_params (return_vals, nreturn_vals); -} - -void -gimp_progress_update (gdouble percentage) -{ - GimpParam *return_vals; - gint nreturn_vals; - - return_vals = gimp_run_procedure ("gimp_progress_update", - &nreturn_vals, - PARAM_FLOAT, percentage, - PARAM_END); - - gimp_destroy_params (return_vals, nreturn_vals); -} gint32 gimp_default_display (void) @@ -411,193 +317,12 @@ gimp_default_display (void) return _gdisp_ID; } - -void -gimp_message (const gchar *message) -{ - GimpParam *return_vals; - gint nreturn_vals; - - return_vals = gimp_run_procedure ("gimp_message", - &nreturn_vals, - PARAM_STRING, message, - PARAM_END); - - gimp_destroy_params (return_vals, nreturn_vals); -} - static void gimp_message_func (gchar *str) { gimp_message (str); } - -void -gimp_query_database (gchar *name_regexp, - gchar *blurb_regexp, - gchar *help_regexp, - gchar *author_regexp, - gchar *copyright_regexp, - gchar *date_regexp, - gchar *proc_type_regexp, - gint *nprocs, - gchar ***proc_names) -{ - GimpParam *return_vals; - gint nreturn_vals; - gint i; - - return_vals = gimp_run_procedure ("gimp_procedural_db_query", - &nreturn_vals, - PARAM_STRING, name_regexp, - PARAM_STRING, blurb_regexp, - PARAM_STRING, help_regexp, - PARAM_STRING, author_regexp, - PARAM_STRING, copyright_regexp, - PARAM_STRING, date_regexp, - PARAM_STRING, proc_type_regexp, - PARAM_END); - - *nprocs = 0; - *proc_names = NULL; - - if (return_vals[0].data.d_status == STATUS_SUCCESS) - { - *nprocs = return_vals[1].data.d_int32; - *proc_names = g_new (gchar*, *nprocs); - - for (i = 0; i < *nprocs; i++) - (*proc_names)[i] = g_strdup (return_vals[2].data.d_stringarray[i]); - } - - gimp_destroy_params (return_vals, nreturn_vals); -} - -gboolean -gimp_query_procedure (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) -{ - GimpParam *ret_vals; - gint nret_vals; - gint i; - gboolean success = TRUE; - - ret_vals = gimp_run_procedure ("gimp_procedural_db_proc_info", - &nret_vals, - PARAM_STRING, proc_name, - PARAM_END); - - if (ret_vals[0].data.d_status == STATUS_SUCCESS) - { - *proc_blurb = g_strdup (ret_vals[1].data.d_string); - *proc_help = g_strdup (ret_vals[2].data.d_string); - *proc_author = g_strdup (ret_vals[3].data.d_string); - *proc_copyright = g_strdup (ret_vals[4].data.d_string); - *proc_date = g_strdup (ret_vals[5].data.d_string); - *proc_type = ret_vals[6].data.d_int32; - *nparams = ret_vals[7].data.d_int32; - *nreturn_vals = ret_vals[8].data.d_int32; - *params = g_new (GimpParamDef, *nparams); - *return_vals = g_new (GimpParamDef, *nreturn_vals); - - 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 - { - g_free (*params); - g_free (*return_vals); - gimp_destroy_params (rvals, nrvals); - 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 - { - g_free (*params); - g_free (*return_vals); - gimp_destroy_params (rvals, nrvals); - return FALSE; - } - - gimp_destroy_params (rvals, nrvals); - } - } - else - success = FALSE; - - gimp_destroy_params (ret_vals, nret_vals); - - return success; -} - -gint32 * -gimp_query_images (gint *nimages) -{ - GimpParam *return_vals; - gint nreturn_vals; - gint32 *images; - - return_vals = gimp_run_procedure ("gimp_image_list", - &nreturn_vals, - PARAM_END); - - images = NULL; - if (return_vals[0].data.d_status == STATUS_SUCCESS) - { - *nimages = return_vals[1].data.d_int32; - images = g_new (gint32, *nimages); - memcpy (images, return_vals[2].data.d_int32array, *nimages * 4); - } - - gimp_destroy_params (return_vals, nreturn_vals); - - return images; -} - void gimp_install_procedure (gchar *name, gchar *blurb, @@ -681,62 +406,6 @@ gimp_uninstall_temp_proc (gchar *name) } } -void -gimp_register_magic_load_handler (gchar *name, - gchar *extensions, - gchar *prefixes, - gchar *magics) -{ - GimpParam *return_vals; - gint nreturn_vals; - - return_vals = gimp_run_procedure ("gimp_register_magic_load_handler", - &nreturn_vals, - PARAM_STRING, name, - PARAM_STRING, extensions, - PARAM_STRING, prefixes, - PARAM_STRING, magics, - PARAM_END); - - gimp_destroy_params (return_vals, nreturn_vals); -} - -void -gimp_register_load_handler (gchar *name, - gchar *extensions, - gchar *prefixes) -{ - GimpParam *return_vals; - gint nreturn_vals; - - return_vals = gimp_run_procedure ("gimp_register_load_handler", - &nreturn_vals, - PARAM_STRING, name, - PARAM_STRING, extensions, - PARAM_STRING, prefixes, - PARAM_END); - - gimp_destroy_params (return_vals, nreturn_vals); -} - -void -gimp_register_save_handler (gchar *name, - gchar *extensions, - gchar *prefixes) -{ - GimpParam *return_vals; - gint nreturn_vals; - - return_vals = gimp_run_procedure ("gimp_register_save_handler", - &nreturn_vals, - PARAM_STRING, name, - PARAM_STRING, extensions, - PARAM_STRING, prefixes, - PARAM_END); - - gimp_destroy_params (return_vals, nreturn_vals); -} - GimpParam * gimp_run_procedure (gchar *name, gint *nreturn_vals, @@ -1477,8 +1146,8 @@ gimp_temp_proc_run (GPProcRun *proc_run) gint nreturn_vals; GimpRunProc run_proc; - run_proc = (GimpRunProc)g_hash_table_lookup (temp_proc_ht, - (gpointer) proc_run->name); + run_proc = (GimpRunProc) g_hash_table_lookup (temp_proc_ht, + (gpointer) proc_run->name); if (run_proc) { @@ -1497,34 +1166,3 @@ gimp_temp_proc_run (GPProcRun *proc_run) /* gimp_quit (); */ } } - -void -gimp_plugin_domain_add (gchar *domain_name) -{ - GimpParam *return_vals; - gint nreturn_vals; - - return_vals = gimp_run_procedure ("gimp_plugin_domain_add", - &nreturn_vals, - PARAM_STRING, domain_name, - PARAM_STRING, NULL, - PARAM_END); - - gimp_destroy_params (return_vals, nreturn_vals); -} - -void -gimp_plugin_domain_add_with_path (gchar *domain_name, - gchar *domain_path) -{ - GimpParam *return_vals; - gint nreturn_vals; - - return_vals = gimp_run_procedure ("gimp_plugin_domain_add", - &nreturn_vals, - PARAM_STRING, domain_name, - PARAM_STRING, domain_path, - PARAM_END); - - gimp_destroy_params (return_vals, nreturn_vals); -} diff --git a/libgimp/gimp.h b/libgimp/gimp.h index 3365e6cd4d..7dd9fb4c4a 100644 --- a/libgimp/gimp.h +++ b/libgimp/gimp.h @@ -1,6 +1,8 @@ /* LIBGIMP - The GIMP Library * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball * + * gimp.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 @@ -26,6 +28,7 @@ #include #include +#include #include #include #include @@ -37,17 +40,7 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include #include /* to be removed in 1.3 */ @@ -66,6 +59,11 @@ 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 GIMPVAR guint gimp_major_version; GIMPVAR guint gimp_minor_version; @@ -224,87 +222,11 @@ gint gimp_main (gint argc, */ void G_GNUC_NORETURN gimp_quit (void); -/* Specify a range of data to be associated with 'id'. - * The data will exist for as long as the main gimp - * application is running. - */ -void gimp_set_data (gchar *id, - gpointer data, - guint32 length); - -/* Retrieve the piece of data stored within the main - * gimp application specified by 'id'. The data is - * stored in the supplied buffer. Make sure enough - * space is allocated. - */ -void gimp_get_data (gchar *id, - gpointer data); - -/* Get the size in bytes of the data stored by a gimp_get_data - * id. As size of zero may indicate that there is no such - * identifier in the database. - */ -guint32 gimp_get_data_size (gchar *id); - -/* Initialize the progress bar with "message". If "message" - * is NULL, the message displayed in the progress window will - * be the name of the plug-in. - */ -void gimp_progress_init (gchar *message); - -/* Update the progress bar. If the progress bar has not been - * initialized then it will be automatically initialized as if - * "gimp_progress_init (NULL)" were called. "percentage" is a - * value between 0 and 1. - */ -void gimp_progress_update (gdouble percentage); - /* Returns the default gdisplay (given at plug-in config time). */ gint32 gimp_default_display (void); -/* Pops up a dialog box with "message". Useful for status and - * error reports. If "message" is NULL, do nothing. - */ -void gimp_message (const gchar *message); - - -/* Query the gimp application's procedural database. - * The arguments are regular expressions which select - * which procedure names will be returned in 'proc_names'. - */ -void gimp_query_database (gchar *name_regexp, - gchar *blurb_regexp, - gchar *help_regexp, - gchar *author_regexp, - gchar *copyright_regexp, - gchar *date_regexp, - gchar *proc_type_regexp, - gint *nprocs, - gchar ***proc_names); - -/* Query the gimp application's procedural database - * regarding a particular procedure. - */ -gboolean gimp_query_procedure (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); - -/* Query the gimp application regarding all open images. - * The list of open image id's is returned in 'image_ids'. - */ -gint32 * gimp_query_images (gint *nimages); - - /* Install a procedure in the procedure database. */ void gimp_install_procedure (gchar *name, @@ -342,25 +264,6 @@ void gimp_install_temp_proc (gchar *name, */ void gimp_uninstall_temp_proc (gchar *name); -/* Install a load file format handler in the procedure database. - */ -void gimp_register_magic_load_handler (gchar *name, - gchar *extensions, - gchar *prefixes, - gchar *magics); - -/* Install a load file format handler in the procedure database. - */ -void gimp_register_load_handler (gchar *name, - gchar *extensions, - gchar *prefixes); - -/* Install a save file format handler in the procedure database. - */ -void gimp_register_save_handler (gchar *name, - gchar *extensions, - gchar *prefixes); - /* Run a procedure in the procedure database. The parameters are * specified via the variable length argument list. The return * values are returned in the 'GimpParam*' array. @@ -402,15 +305,6 @@ void gimp_request_wakeups (void); gchar * gimp_get_progname (void); -/**************************************** - * Localisation * - ****************************************/ - -void gimp_plugin_domain_add (gchar *domain_name); -void gimp_plugin_domain_add_with_path (gchar *domain_name, - gchar *domain_path); - - #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/libgimp/gimp_pdb.h b/libgimp/gimp_pdb.h new file mode 100644 index 0000000000..3a259260bc --- /dev/null +++ b/libgimp/gimp_pdb.h @@ -0,0 +1,41 @@ +/* LIBGIMP - The GIMP Library + * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball + * + * gimp_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. + */ + +#ifndef __GIMP_PDB_H__ +#define __GIMP_PDB_H__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif /* __GIMP_PDB_H__ */ diff --git a/libgimp/gimpchannel_pdb.c b/libgimp/gimpchannel_pdb.c index 125cebda6a..8e0de44e9e 100644 --- a/libgimp/gimpchannel_pdb.c +++ b/libgimp/gimpchannel_pdb.c @@ -1,21 +1,23 @@ -/* LIBGIMP - The GIMP Library - * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball +/* LIBGIMP - The GIMP Library + * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball + * + * gimpchannel_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 + * 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 * Library 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" diff --git a/libgimp/gimpcompat.h b/libgimp/gimpcompat.h index 86b6181f3d..f2d73cbad6 100644 --- a/libgimp/gimpcompat.h +++ b/libgimp/gimpcompat.h @@ -62,6 +62,9 @@ extern "C" { #define gimp_plugin_help_func gimp_standard_help_func +#define gimp_query_database gimp_procedural_db_query +#define gimp_query_images gimp_image_list + #define Parasite GimpParasite #define PARASITE_PERSISTENT GIMP_PARASITE_PERSISTENT #define PARASITE_UNDOABLE GIMP_PARASITE_UNDOABLE diff --git a/libgimp/gimpdisplay_pdb.c b/libgimp/gimpdisplay_pdb.c index b4d7af6c12..d7ca40bafd 100644 --- a/libgimp/gimpdisplay_pdb.c +++ b/libgimp/gimpdisplay_pdb.c @@ -1,21 +1,24 @@ -/* LIBGIMP - The GIMP Library - * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball +/* LIBGIMP - The GIMP Library + * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball + * + * gimpdisplay_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 + * 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 * Library 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" @@ -23,7 +26,7 @@ gint32 gimp_display_new (gint32 image_ID) { GParam *return_vals; - int nreturn_vals; + gint nreturn_vals; gint32 display_ID; return_vals = gimp_run_procedure ("gimp_display_new", @@ -44,7 +47,7 @@ void gimp_display_delete (gint32 display_ID) { GParam *return_vals; - int nreturn_vals; + gint nreturn_vals; return_vals = gimp_run_procedure ("gimp_display_delete", &nreturn_vals, @@ -55,10 +58,10 @@ gimp_display_delete (gint32 display_ID) } void -gimp_displays_flush () +gimp_displays_flush (void) { GParam *return_vals; - int nreturn_vals; + gint nreturn_vals; return_vals = gimp_run_procedure ("gimp_displays_flush", &nreturn_vals, diff --git a/libgimp/gimpdisplay_pdb.h b/libgimp/gimpdisplay_pdb.h index 4ac71bcd75..445bf86e45 100644 --- a/libgimp/gimpdisplay_pdb.h +++ b/libgimp/gimpdisplay_pdb.h @@ -29,9 +29,9 @@ extern "C" { /* For information look into the C source or the html documentation */ -gint32 gimp_display_new (gint32 image_ID); -void gimp_display_delete (gint32 display_ID); -void gimp_displays_flush (void); +gint32 gimp_display_new (gint32 image_ID); +void gimp_display_delete (gint32 display_ID); +void gimp_displays_flush (void); #ifdef __cplusplus diff --git a/libgimp/gimpdrawable.c b/libgimp/gimpdrawable.c index f658126ec2..fcbbbf3f59 100644 --- a/libgimp/gimpdrawable.c +++ b/libgimp/gimpdrawable.c @@ -19,12 +19,11 @@ * Boston, MA 02111-1307, USA. */ -#include - #include #include "gimp.h" + #define TILE_WIDTH _gimp_tile_width #define TILE_HEIGHT _gimp_tile_height @@ -109,7 +108,7 @@ gimp_drawable_delete (GimpDrawable *drawable) } -gchar* +gchar * gimp_drawable_name (gint32 drawable_ID) { if (gimp_drawable_is_layer (drawable_ID)) diff --git a/libgimp/gimpdrawable_pdb.c b/libgimp/gimpdrawable_pdb.c index 9a006bb593..b77b0b7efb 100644 --- a/libgimp/gimpdrawable_pdb.c +++ b/libgimp/gimpdrawable_pdb.c @@ -19,10 +19,9 @@ * Boston, MA 02111-1307, USA. */ -#include - #include "gimp.h" + void gimp_drawable_update (gint32 drawable_ID, gint x, diff --git a/libgimp/gimpdrawable_pdb.h b/libgimp/gimpdrawable_pdb.h index f7e2d8d196..f84f3adf92 100644 --- a/libgimp/gimpdrawable_pdb.h +++ b/libgimp/gimpdrawable_pdb.h @@ -29,23 +29,6 @@ extern "C" { /* For information look into the C source or the html documentation */ -struct _GimpDrawable -{ - gint32 id; /* drawable ID */ - guint width; /* width of drawble */ - guint height; /* height of drawble */ - guint bpp; /* bytes per pixel of drawable */ - guint ntile_rows; /* # of tile rows */ - guint ntile_cols; /* # of tile columns */ - GimpTile *tiles; /* the normal tiles */ - GimpTile *shadow_tiles; /* the shadow tiles */ -}; - - -GimpDrawable * gimp_drawable_get (gint32 drawable_ID); -void gimp_drawable_detach (GimpDrawable *drawable); -void gimp_drawable_flush (GimpDrawable *drawable); -void gimp_drawable_delete (GimpDrawable *drawable); void gimp_drawable_update (gint32 drawable_ID, gint x, gint y, @@ -54,12 +37,10 @@ void gimp_drawable_update (gint32 drawable_ID, void gimp_drawable_merge_shadow (gint32 drawable_ID, gboolean undoable); gint32 gimp_drawable_image_id (gint32 drawable_ID); -gchar * gimp_drawable_name (gint32 drawable_ID); guint gimp_drawable_width (gint32 drawable_ID); guint gimp_drawable_height (gint32 drawable_ID); guint gimp_drawable_bpp (gint32 drawable_ID); GimpImageType gimp_drawable_type (gint32 drawable_ID); -gboolean gimp_drawable_visible (gint32 drawable_ID); gboolean gimp_drawable_is_channel (gint32 drawable_ID); gboolean gimp_drawable_is_rgb (gint32 drawable_ID); gboolean gimp_drawable_is_gray (gint32 drawable_ID); @@ -77,18 +58,8 @@ void gimp_drawable_offsets (gint32 drawable_ID, gint *offset_y); void gimp_drawable_fill (gint32 drawable_ID, GimpFillType fill_type); -void gimp_drawable_set_name (gint32 drawable_ID, - gchar *name); void gimp_drawable_set_visible (gint32 drawable_ID, gint visible); -GimpTile * gimp_drawable_get_tile (GimpDrawable *drawable, - gint shadow, - gint row, - gint col); -GimpTile * gimp_drawable_get_tile2 (GimpDrawable *drawable, - gint shadow, - gint x, - gint y); GimpParasite * gimp_drawable_parasite_find (gint32 drawable_ID, const gchar *name); void gimp_drawable_parasite_attach (gint32 drawable_ID, diff --git a/libgimp/gimpfileops_pdb.c b/libgimp/gimpfileops_pdb.c new file mode 100644 index 0000000000..39a3f7938c --- /dev/null +++ b/libgimp/gimpfileops_pdb.c @@ -0,0 +1,79 @@ +/* LIBGIMP - The GIMP Library + * Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis + * + * gimpfileops_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 + * Library 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" + + +void +gimp_register_magic_load_handler (gchar *name, + gchar *extensions, + gchar *prefixes, + gchar *magics) +{ + GimpParam *return_vals; + gint nreturn_vals; + + return_vals = gimp_run_procedure ("gimp_register_magic_load_handler", + &nreturn_vals, + PARAM_STRING, name, + PARAM_STRING, extensions, + PARAM_STRING, prefixes, + PARAM_STRING, magics, + PARAM_END); + + gimp_destroy_params (return_vals, nreturn_vals); +} + +void +gimp_register_load_handler (gchar *name, + gchar *extensions, + gchar *prefixes) +{ + GimpParam *return_vals; + gint nreturn_vals; + + return_vals = gimp_run_procedure ("gimp_register_load_handler", + &nreturn_vals, + PARAM_STRING, name, + PARAM_STRING, extensions, + PARAM_STRING, prefixes, + PARAM_END); + + gimp_destroy_params (return_vals, nreturn_vals); +} + +void +gimp_register_save_handler (gchar *name, + gchar *extensions, + gchar *prefixes) +{ + GimpParam *return_vals; + gint nreturn_vals; + + return_vals = gimp_run_procedure ("gimp_register_save_handler", + &nreturn_vals, + PARAM_STRING, name, + PARAM_STRING, extensions, + PARAM_STRING, prefixes, + PARAM_END); + + gimp_destroy_params (return_vals, nreturn_vals); +} diff --git a/libgimp/gimpfileops_pdb.h b/libgimp/gimpfileops_pdb.h new file mode 100644 index 0000000000..0eb8c5b09b --- /dev/null +++ b/libgimp/gimpfileops_pdb.h @@ -0,0 +1,56 @@ +/* LIBGIMP - The GIMP Library + * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball + * + * gimpfileops_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. + */ + +#ifndef __GIMP_FILE_OPS_PDB_H__ +#define __GIMP_FILE_OPS_PDB_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* For information look into the C source or the html documentation */ + + +/* Install a load file format handler in the procedure database. + */ +void gimp_register_magic_load_handler (gchar *name, + gchar *extensions, + gchar *prefixes, + gchar *magics); + +/* Install a load file format handler in the procedure database. + */ +void gimp_register_load_handler (gchar *name, + gchar *extensions, + gchar *prefixes); + +/* Install a save file format handler in the procedure database. + */ +void gimp_register_save_handler (gchar *name, + gchar *extensions, + gchar *prefixes); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __GIMP_FILE_OPS_PDB_H__ */ diff --git a/libgimp/gimpguides_pdb.c b/libgimp/gimpguides_pdb.c new file mode 100644 index 0000000000..508461745e --- /dev/null +++ b/libgimp/gimpguides_pdb.c @@ -0,0 +1,154 @@ +/* LIBGIMP - The GIMP Library + * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball + * + * gimpguides_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 + * Library 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" + + +gint32 +gimp_image_add_hguide (gint32 image_ID, + gint32 yposition) +{ + GParam *return_vals; + gint nreturn_vals; + gint32 guide_ID; + + return_vals = gimp_run_procedure ("gimp_image_add_hguide", + &nreturn_vals, + PARAM_IMAGE, image_ID, + PARAM_INT32, yposition, + PARAM_END); + + guide_ID = -1; + if (return_vals[0].data.d_status == STATUS_SUCCESS) + guide_ID = return_vals[1].data.d_int32; + + gimp_destroy_params (return_vals, nreturn_vals); + + return guide_ID; +} + +gint32 +gimp_image_add_vguide (gint32 image_ID, + gint32 xposition) +{ + GParam *return_vals; + gint nreturn_vals; + gint32 guide_ID; + + return_vals = gimp_run_procedure ("gimp_image_add_vguide", + &nreturn_vals, + PARAM_IMAGE, image_ID, + PARAM_INT32, xposition, + PARAM_END); + + guide_ID = -1; + if (return_vals[0].data.d_status == STATUS_SUCCESS) + guide_ID = return_vals[1].data.d_int32; + + gimp_destroy_params (return_vals, nreturn_vals); + + return guide_ID; +} + +void +gimp_image_delete_guide (gint32 image_ID, + gint32 guide_ID) +{ + GParam *return_vals; + gint nreturn_vals; + + return_vals = gimp_run_procedure ("gimp_image_delete_guide", + &nreturn_vals, + PARAM_IMAGE, image_ID, + PARAM_INT32, guide_ID, + PARAM_END); + + gimp_destroy_params (return_vals, nreturn_vals); +} + +gint32 +gimp_image_find_next_guide (gint32 image_ID, + gint32 guide_ID) +{ + GParam *return_vals; + gint nreturn_vals; + gint32 rtn_guide_ID; + + return_vals = gimp_run_procedure ("gimp_image_find_next_guide", + &nreturn_vals, + PARAM_IMAGE, image_ID, + PARAM_INT32, guide_ID, + PARAM_END); + + rtn_guide_ID = -1; + if (return_vals[0].data.d_status == STATUS_SUCCESS) + rtn_guide_ID = return_vals[1].data.d_int32; + + gimp_destroy_params (return_vals, nreturn_vals); + + return rtn_guide_ID; +} + +GOrientation +gimp_image_get_guide_orientation (gint32 image_ID, + gint32 guide_ID) +{ + GParam *return_vals; + gint nreturn_vals; + GOrientation guide_orientation; + + return_vals = gimp_run_procedure ("gimp_image_get_guide_orientation", + &nreturn_vals, + PARAM_IMAGE, image_ID, + PARAM_INT32, guide_ID, + PARAM_END); + + guide_orientation = ORIENTATION_UNKNOWN; + if (return_vals[0].data.d_status == STATUS_SUCCESS) + guide_orientation = return_vals[1].data.d_int32; + + gimp_destroy_params (return_vals, nreturn_vals); + + return guide_orientation; +} + +gint32 +gimp_image_get_guide_position (gint32 image_ID, + gint32 guide_ID) +{ + GParam *return_vals; + gint nreturn_vals; + gint32 guide_position; + + return_vals = gimp_run_procedure ("gimp_image_get_guide_position", + &nreturn_vals, + PARAM_IMAGE, image_ID, + PARAM_INT32, guide_ID, + PARAM_END); + + guide_position = -1; + if (return_vals[0].data.d_status == STATUS_SUCCESS) + guide_position = return_vals[1].data.d_int32; + + gimp_destroy_params (return_vals, nreturn_vals); + + return guide_position; +} diff --git a/libgimp/gimpguides_pdb.h b/libgimp/gimpguides_pdb.h new file mode 100644 index 0000000000..31610c3557 --- /dev/null +++ b/libgimp/gimpguides_pdb.h @@ -0,0 +1,50 @@ +/* LIBGIMP - The GIMP Library + * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball + * + * gimpguides_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. + */ + +#ifndef __GIMP_GUIDES_PDB_H__ +#define __GIMP_GUIDES_PDB_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* For information look into the C source or the html documentation */ + + +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); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __GIMP_GUIDES_PDB_H__ */ diff --git a/libgimp/gimphelp_pdb.c b/libgimp/gimphelp_pdb.c index fd69d2e233..0f466b9364 100644 --- a/libgimp/gimphelp_pdb.c +++ b/libgimp/gimphelp_pdb.c @@ -37,17 +37,3 @@ gimp_help (gchar *prog_name, gimp_destroy_params (return_vals, nreturn_vals); } - -void -gimp_plugin_help_register (gchar *help_path) -{ - GParam *return_vals; - gint nreturn_vals; - - return_vals = gimp_run_procedure ("gimp_plugin_help_register", - &nreturn_vals, - PARAM_STRING, help_path, - PARAM_END); - - gimp_destroy_params (return_vals, nreturn_vals); -} diff --git a/libgimp/gimphelp_pdb.h b/libgimp/gimphelp_pdb.h index 7bdc94b8f8..33fe85e7ed 100644 --- a/libgimp/gimphelp_pdb.h +++ b/libgimp/gimphelp_pdb.h @@ -2,6 +2,7 @@ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball * * gimphelp_pdb.h + * Copyright (C) 2000 Michael Natterer * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -29,9 +30,8 @@ extern "C" { /* For information look into the C source or the html documentation */ -void gimp_help (gchar *prog_name, - gchar *help_data); -void gimp_plugin_help_register (gchar *help_path); +void gimp_help (gchar *prog_name, + gchar *help_data); #ifdef __cplusplus diff --git a/libgimp/gimpimage_pdb.c b/libgimp/gimpimage_pdb.c index 31b7c9d727..5f6e1916a9 100644 --- a/libgimp/gimpimage_pdb.c +++ b/libgimp/gimpimage_pdb.c @@ -19,144 +19,9 @@ * Boston, MA 02111-1307, USA. */ -#include - #include "gimp.h" -gint32 -gimp_image_add_hguide (gint32 image_id, - gint32 yposition) -{ - GParam *return_vals; - gint nreturn_vals; - gint32 guide_id; - - return_vals = gimp_run_procedure ("gimp_image_add_hguide", - &nreturn_vals, - PARAM_IMAGE, image_id, - PARAM_INT32, yposition, - PARAM_END); - - guide_id = -1; - if (return_vals[0].data.d_status == STATUS_SUCCESS) - guide_id = return_vals[1].data.d_int32; - - gimp_destroy_params (return_vals, nreturn_vals); - - return guide_id; -} - -gint32 -gimp_image_add_vguide (gint32 image_id, - gint32 xposition) -{ - GParam *return_vals; - gint nreturn_vals; - gint32 guide_id; - - return_vals = gimp_run_procedure ("gimp_image_add_vguide", - &nreturn_vals, - PARAM_IMAGE, image_id, - PARAM_INT32, xposition, - PARAM_END); - - guide_id = -1; - if (return_vals[0].data.d_status == STATUS_SUCCESS) - guide_id = return_vals[1].data.d_int32; - - gimp_destroy_params (return_vals, nreturn_vals); - - return guide_id; -} - -void -gimp_image_delete_guide (gint32 image_id, - gint32 guide_id) -{ - GParam *return_vals; - gint nreturn_vals; - - return_vals = gimp_run_procedure ("gimp_image_delete_guide", - &nreturn_vals, - PARAM_IMAGE, image_id, - PARAM_INT32, guide_id, - PARAM_END); - - gimp_destroy_params (return_vals, nreturn_vals); -} - -gint32 -gimp_image_find_next_guide (gint32 image_id, - gint32 guide_id) -{ - GParam *return_vals; - gint nreturn_vals; - gint32 rtn_guide_id; - - return_vals = gimp_run_procedure ("gimp_image_find_next_guide", - &nreturn_vals, - PARAM_IMAGE, image_id, - PARAM_INT32, guide_id, - PARAM_END); - - rtn_guide_id = -1; - if (return_vals[0].data.d_status == STATUS_SUCCESS) - rtn_guide_id = return_vals[1].data.d_int32; - - gimp_destroy_params (return_vals, nreturn_vals); - - return rtn_guide_id; -} - -GOrientation -gimp_image_get_guide_orientation (gint32 image_id, - gint32 guide_id) -{ - GParam *return_vals; - gint nreturn_vals; - GOrientation rtn_guide_orientation; - - return_vals = gimp_run_procedure ("gimp_image_get_guide_orientation", - &nreturn_vals, - PARAM_IMAGE, image_id, - PARAM_INT32, guide_id, - PARAM_END); - - rtn_guide_orientation = ORIENTATION_UNKNOWN; - if (return_vals[0].data.d_status == STATUS_SUCCESS) - rtn_guide_orientation = return_vals[1].data.d_int32; - - gimp_destroy_params (return_vals, nreturn_vals); - - return rtn_guide_orientation; -} - -gint32 -gimp_image_get_guide_position (gint32 image_id, - gint32 guide_id) -{ - GParam *return_vals; - gint nreturn_vals; - gint32 rtn_guide_position; - - return_vals = gimp_run_procedure ("gimp_image_get_guide_position", - &nreturn_vals, - PARAM_IMAGE, image_id, - PARAM_INT32, guide_id, - PARAM_END); - - rtn_guide_position = -1; - if (return_vals[0].data.d_status == STATUS_SUCCESS) - rtn_guide_position = return_vals[1].data.d_int32; - - gimp_destroy_params (return_vals, nreturn_vals); - - return rtn_guide_position; -} - - - gint32 gimp_image_new (guint width, guint height, @@ -343,7 +208,7 @@ gimp_image_add_layer_mask (gint32 image_ID, gint32 mask_ID) { GParam *return_vals; - int nreturn_vals; + gint nreturn_vals; return_vals = gimp_run_procedure ("gimp_image_add_layer_mask", &nreturn_vals, @@ -479,7 +344,7 @@ gimp_image_lower_channel (gint32 image_ID, gint32 channel_ID) { GParam *return_vals; - int nreturn_vals; + gint nreturn_vals; return_vals = gimp_run_procedure ("gimp_image_lower_channel", &nreturn_vals, @@ -800,7 +665,7 @@ gchar* gimp_image_get_filename (gint32 image_ID) { GParam *return_vals; - int nreturn_vals; + gint nreturn_vals; char *filename; return_vals = gimp_run_procedure ("gimp_image_get_filename", @@ -1061,8 +926,8 @@ gimp_image_get_resolution (gint32 image_ID, { GParam *return_vals; gint nreturn_vals; - double xres; - double yres; + gdouble xres; + gdouble yres; g_return_if_fail (xresolution && yresolution); @@ -1274,3 +1139,28 @@ gimp_image_convert_indexed (gint32 image_ID, gimp_destroy_params (return_vals, nreturn_vals); } + +gint32 * +gimp_image_list (gint *nimages) +{ + GimpParam *return_vals; + gint nreturn_vals; + gint32 *images; + + return_vals = gimp_run_procedure ("gimp_image_list", + &nreturn_vals, + PARAM_END); + + images = NULL; + if (return_vals[0].data.d_status == STATUS_SUCCESS) + { + *nimages = return_vals[1].data.d_int32; + images = g_new (gint32, *nimages); + memcpy (images, return_vals[2].data.d_int32array, *nimages * 4); + } + + gimp_destroy_params (return_vals, nreturn_vals); + + return images; +} + diff --git a/libgimp/gimpimage_pdb.h b/libgimp/gimpimage_pdb.h index 0a91e1a67d..4768c91485 100644 --- a/libgimp/gimpimage_pdb.h +++ b/libgimp/gimpimage_pdb.h @@ -148,6 +148,8 @@ void gimp_image_convert_indexed (gint32 image_ID, gint alpha_dither, gint remove_unused, gchar *palette); +gint32 * gimp_image_list (gint *nimages); + /**************************************** * Guides * diff --git a/libgimp/gimplayer_pdb.c b/libgimp/gimplayer_pdb.c index a5770864df..8de26a569b 100644 --- a/libgimp/gimplayer_pdb.c +++ b/libgimp/gimplayer_pdb.c @@ -187,12 +187,12 @@ gimp_layer_translate (gint32 layer_ID, gimp_destroy_params (return_vals, nreturn_vals); } -gint +gboolean gimp_layer_is_floating_selection (gint32 layer_ID) { GParam *return_vals; gint nreturn_vals; - gint result; + gboolean result; return_vals = gimp_run_procedure ("gimp_layer_is_floating_sel", &nreturn_vals, @@ -201,7 +201,7 @@ gimp_layer_is_floating_selection (gint32 layer_ID) result = FALSE; if (return_vals[0].data.d_status == STATUS_SUCCESS) - result = return_vals[1].data.d_int32; + result = return_vals[1].data.d_int32 ? TRUE : FALSE; gimp_destroy_params (return_vals, nreturn_vals); @@ -235,42 +235,42 @@ gimp_layer_get_mask_id (gint32 layer_ID) return mask_ID; } -gint +gboolean gimp_layer_get_apply_mask (gint32 layer_ID) { GParam *return_vals; gint nreturn_vals; - gint result; + gboolean result; return_vals = gimp_run_procedure ("gimp_layer_get_apply_mask", &nreturn_vals, PARAM_LAYER, layer_ID, PARAM_END); - result = 0; + result = FALSE; if (return_vals[0].data.d_status == STATUS_SUCCESS) - result = return_vals[1].data.d_int32; + result = return_vals[1].data.d_int32 ? TRUE : FALSE; gimp_destroy_params (return_vals, nreturn_vals); return result; } -gint +gboolean gimp_layer_get_edit_mask (gint32 layer_ID) { GParam *return_vals; gint nreturn_vals; - gint result; + gboolean result; return_vals = gimp_run_procedure ("gimp_layer_get_edit_mask", &nreturn_vals, PARAM_LAYER, layer_ID, PARAM_END); - result = 0; + result = FALSE; if (return_vals[0].data.d_status == STATUS_SUCCESS) - result = return_vals[1].data.d_int32; + result = return_vals[1].data.d_int32 ? TRUE : FALSE; gimp_destroy_params (return_vals, nreturn_vals); @@ -340,7 +340,7 @@ gimp_layer_get_opacity (gint32 layer_ID) return result; } -gint +gboolean gimp_layer_get_preserve_transparency (gint32 layer_ID) { GParam *return_vals; @@ -352,51 +352,51 @@ gimp_layer_get_preserve_transparency (gint32 layer_ID) PARAM_LAYER, layer_ID, PARAM_END); - result = 0; + result = FALSE; if (return_vals[0].data.d_status == STATUS_SUCCESS) - result = return_vals[1].data.d_int32; + result = return_vals[1].data.d_int32 ? TRUE : FALSE; gimp_destroy_params (return_vals, nreturn_vals); return result; } -gint +gboolean gimp_layer_get_show_mask (gint32 layer_ID) { GParam *return_vals; gint nreturn_vals; - gint result; + gboolean result; return_vals = gimp_run_procedure ("gimp_layer_get_show_mask", &nreturn_vals, PARAM_LAYER, layer_ID, PARAM_END); - result = 0; + result = FALSE; if (return_vals[0].data.d_status == STATUS_SUCCESS) - result = return_vals[1].data.d_int32; + result = return_vals[1].data.d_int32 ? TRUE : FALSE; gimp_destroy_params (return_vals, nreturn_vals); return result; } -gint +gboolean gimp_layer_get_visible (gint32 layer_ID) { GParam *return_vals; gint nreturn_vals; - gint result; + gboolean result; return_vals = gimp_run_procedure ("gimp_layer_get_visible", &nreturn_vals, PARAM_LAYER, layer_ID, PARAM_END); - result = 0; + result = FALSE; if (return_vals[0].data.d_status == STATUS_SUCCESS) - result = return_vals[1].data.d_int32; + result = return_vals[1].data.d_int32 ? TRUE : FALSE; gimp_destroy_params (return_vals, nreturn_vals); @@ -404,8 +404,8 @@ gimp_layer_get_visible (gint32 layer_ID) } void -gimp_layer_set_apply_mask (gint32 layer_ID, - gint apply_mask) +gimp_layer_set_apply_mask (gint32 layer_ID, + gboolean apply_mask) { GParam *return_vals; gint nreturn_vals; @@ -420,8 +420,8 @@ gimp_layer_set_apply_mask (gint32 layer_ID, } void -gimp_layer_set_edit_mask (gint32 layer_ID, - gint edit_mask) +gimp_layer_set_edit_mask (gint32 layer_ID, + gboolean edit_mask) { GParam *return_vals; gint nreturn_vals; diff --git a/libgimp/gimpmessage_pdb.c b/libgimp/gimpmessage_pdb.c new file mode 100644 index 0000000000..62894801fc --- /dev/null +++ b/libgimp/gimpmessage_pdb.c @@ -0,0 +1,36 @@ +/* LIBGIMP - The GIMP Library + * Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis + * + * gimpmessage_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 + * Library 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" + +void +gimp_message (const gchar *message) +{ + GimpParam *return_vals; + gint nreturn_vals; + + return_vals = gimp_run_procedure ("gimp_message", + &nreturn_vals, + PARAM_STRING, message, + PARAM_END); + + gimp_destroy_params (return_vals, nreturn_vals); +} diff --git a/libgimp/gimpmessage_pdb.h b/libgimp/gimpmessage_pdb.h new file mode 100644 index 0000000000..b67f995173 --- /dev/null +++ b/libgimp/gimpmessage_pdb.h @@ -0,0 +1,40 @@ +/* LIBGIMP - The GIMP Library + * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball + * + * gimpmessage_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. + */ + +#ifndef __GIMP_MESSAGE_PDB_H__ +#define __GIMP_MESSAGE_PDB_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* For information look into the C source or the html documentation */ + +/* Pops up a dialog box with "message". Useful for status and + * error reports. If "message" is NULL, do nothing. + */ +void gimp_message (const gchar *message); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __GIMP_PLUG_IN_PDB_H__ */ diff --git a/libgimp/gimpparasite_pdb.c b/libgimp/gimpparasite_pdb.c index 282ef795d8..c37f370848 100644 --- a/libgimp/gimpparasite_pdb.c +++ b/libgimp/gimpparasite_pdb.c @@ -28,17 +28,15 @@ gimp_parasite_find (const gchar *name) GParam *return_vals; gint nreturn_vals; GimpParasite *parasite; + return_vals = gimp_run_procedure ("gimp_parasite_find", &nreturn_vals, PARAM_STRING, name, PARAM_END); + parasite = NULL; if (return_vals[0].data.d_status == STATUS_SUCCESS) - { - parasite = gimp_parasite_copy (&return_vals[1].data.d_parasite); - } - else - parasite = NULL; + parasite = gimp_parasite_copy (&return_vals[1].data.d_parasite); gimp_destroy_params (return_vals, nreturn_vals); @@ -67,14 +65,14 @@ gimp_attach_new_parasite (const gchar *name, { GParam *return_vals; gint nreturn_vals; - GimpParasite *p = gimp_parasite_new (name, flags, size, data); + GimpParasite *parasite = gimp_parasite_new (name, flags, size, data); return_vals = gimp_run_procedure ("gimp_parasite_attach", &nreturn_vals, - PARAM_PARASITE, p, + PARAM_PARASITE, parasite, PARAM_END); - gimp_parasite_free (p); + gimp_parasite_free (parasite); gimp_destroy_params (return_vals, nreturn_vals); } diff --git a/libgimp/gimpplugin_pdb.c b/libgimp/gimpplugin_pdb.c new file mode 100644 index 0000000000..fe6b228148 --- /dev/null +++ b/libgimp/gimpplugin_pdb.c @@ -0,0 +1,82 @@ +/* LIBGIMP - The GIMP Library + * Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis + * + * gimpplugin_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 + * Library 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" + + +void +gimp_progress_init (gchar *message) +{ + GimpParam *return_vals; + gint nreturn_vals; + + return_vals = gimp_run_procedure ("gimp_progress_init", + &nreturn_vals, + PARAM_STRING, message, + PARAM_INT32, gimp_default_display (), + PARAM_END); + + gimp_destroy_params (return_vals, nreturn_vals); +} + +void +gimp_progress_update (gdouble percentage) +{ + GimpParam *return_vals; + gint nreturn_vals; + + return_vals = gimp_run_procedure ("gimp_progress_update", + &nreturn_vals, + PARAM_FLOAT, percentage, + PARAM_END); + + gimp_destroy_params (return_vals, nreturn_vals); +} + +void +gimp_plugin_domain_register (gchar *domain_name, + gchar *domain_path) +{ + GimpParam *return_vals; + gint nreturn_vals; + + return_vals = gimp_run_procedure ("gimp_plugin_domain_register", + &nreturn_vals, + PARAM_STRING, domain_name, + PARAM_STRING, domain_path, + PARAM_END); + + gimp_destroy_params (return_vals, nreturn_vals); +} + +void +gimp_plugin_help_register (gchar *help_path) +{ + GParam *return_vals; + gint nreturn_vals; + + return_vals = gimp_run_procedure ("gimp_plugin_help_register", + &nreturn_vals, + PARAM_STRING, help_path, + PARAM_END); + + gimp_destroy_params (return_vals, nreturn_vals); +} diff --git a/libgimp/gimpplugin_pdb.h b/libgimp/gimpplugin_pdb.h new file mode 100644 index 0000000000..fdc9aee0ca --- /dev/null +++ b/libgimp/gimpplugin_pdb.h @@ -0,0 +1,55 @@ +/* LIBGIMP - The GIMP Library + * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball + * + * gimpplugin_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. + */ + +#ifndef __GIMP_PLUG_IN_PDB_H__ +#define __GIMP_PLUG_IN_PDB_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* For information look into the C source or the html documentation */ + + +/* Initialize the progress bar with "message". If "message" + * is NULL, the message displayed in the progress window will + * be the name of the plug-in. + */ +void gimp_progress_init (gchar *message); + +/* Update the progress bar. If the progress bar has not been + * initialized then it will be automatically initialized as if + * "gimp_progress_init (NULL)" were called. "percentage" is a + * value between 0 and 1. + */ +void gimp_progress_update (gdouble percentage); + +void gimp_plugin_domain_register (gchar *domain_name, + gchar *domain_path); + +void gimp_plugin_help_register (gchar *help_path); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __GIMP_PLUG_IN_PDB_H__ */ diff --git a/libgimp/gimpproceduraldb_pdb.c b/libgimp/gimpproceduraldb_pdb.c new file mode 100644 index 0000000000..f7abc023ef --- /dev/null +++ b/libgimp/gimpproceduraldb_pdb.c @@ -0,0 +1,227 @@ +/* LIBGIMP - The GIMP Library + * Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis + * + * gimpproceduraldb_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 + * Library 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" + +void +gimp_procedural_db_set_data (gchar *id, + gpointer data, + guint32 length) +{ + GimpParam *return_vals; + int nreturn_vals; + + return_vals = gimp_run_procedure ("gimp_procedural_db_set_data", + &nreturn_vals, + PARAM_STRING, id, + PARAM_INT32, length, + PARAM_INT8ARRAY, data, + PARAM_END); + + gimp_destroy_params (return_vals, nreturn_vals); +} + +guint32 +gimp_procedural_db_get_data_size (gchar *id) +{ + GimpParam *return_vals; + gint nreturn_vals; + guint32 length; + + return_vals = gimp_run_procedure ("gimp_procedural_db_get_data_size", + &nreturn_vals, + PARAM_STRING, id, + PARAM_END); + + if (return_vals[0].data.d_status == STATUS_SUCCESS) + length= return_vals[1].data.d_int32; + else + length= 0; + + gimp_destroy_params (return_vals, nreturn_vals); + return length; +} + +void +gimp_procedural_db_get_data (gchar *id, + gpointer data) +{ + GimpParam *return_vals; + gint nreturn_vals; + gint length; + gchar *returned_data; + + return_vals = gimp_run_procedure ("gimp_procedural_db_get_data", + &nreturn_vals, + PARAM_STRING, id, + PARAM_END); + + if (return_vals[0].data.d_status == STATUS_SUCCESS) + { + length = return_vals[1].data.d_int32; + returned_data = (gchar *) return_vals[2].data.d_int8array; + + memcpy (data, returned_data, length); + } + + gimp_destroy_params (return_vals, nreturn_vals); +} + +void +gimp_procedural_db_query (gchar *name_regexp, + gchar *blurb_regexp, + gchar *help_regexp, + gchar *author_regexp, + gchar *copyright_regexp, + gchar *date_regexp, + gchar *proc_type_regexp, + gint *nprocs, + gchar ***proc_names) +{ + GimpParam *return_vals; + gint nreturn_vals; + gint i; + + return_vals = gimp_run_procedure ("gimp_procedural_db_query", + &nreturn_vals, + PARAM_STRING, name_regexp, + PARAM_STRING, blurb_regexp, + PARAM_STRING, help_regexp, + PARAM_STRING, author_regexp, + PARAM_STRING, copyright_regexp, + PARAM_STRING, date_regexp, + PARAM_STRING, proc_type_regexp, + PARAM_END); + + *nprocs = 0; + *proc_names = NULL; + + if (return_vals[0].data.d_status == STATUS_SUCCESS) + { + *nprocs = return_vals[1].data.d_int32; + *proc_names = g_new (gchar*, *nprocs); + + for (i = 0; i < *nprocs; i++) + (*proc_names)[i] = g_strdup (return_vals[2].data.d_stringarray[i]); + } + + gimp_destroy_params (return_vals, nreturn_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) +{ + GimpParam *ret_vals; + gint nret_vals; + gint i; + gboolean success = TRUE; + + ret_vals = gimp_run_procedure ("gimp_procedural_db_proc_info", + &nret_vals, + PARAM_STRING, proc_name, + PARAM_END); + + if (ret_vals[0].data.d_status == STATUS_SUCCESS) + { + *proc_blurb = g_strdup (ret_vals[1].data.d_string); + *proc_help = g_strdup (ret_vals[2].data.d_string); + *proc_author = g_strdup (ret_vals[3].data.d_string); + *proc_copyright = g_strdup (ret_vals[4].data.d_string); + *proc_date = g_strdup (ret_vals[5].data.d_string); + *proc_type = ret_vals[6].data.d_int32; + *nparams = ret_vals[7].data.d_int32; + *nreturn_vals = ret_vals[8].data.d_int32; + *params = g_new (GimpParamDef, *nparams); + *return_vals = g_new (GimpParamDef, *nreturn_vals); + + 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 + { + g_free (*params); + g_free (*return_vals); + gimp_destroy_params (rvals, nrvals); + 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 + { + g_free (*params); + g_free (*return_vals); + gimp_destroy_params (rvals, nrvals); + return FALSE; + } + + gimp_destroy_params (rvals, nrvals); + } + } + else + success = FALSE; + + gimp_destroy_params (ret_vals, nret_vals); + + return success; +} diff --git a/libgimp/gimpproceduraldb_pdb.h b/libgimp/gimpproceduraldb_pdb.h new file mode 100644 index 0000000000..0d99e1f65a --- /dev/null +++ b/libgimp/gimpproceduraldb_pdb.h @@ -0,0 +1,91 @@ +/* LIBGIMP - The GIMP Library + * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball + * + * gimpproceduraldb_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. + */ + +#ifndef __GIMP_PROCEDURAL_DB_PDB_H__ +#define __GIMP_PROCEDURAL_DB_PDB_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* For information look into the C source or the html documentation */ + + +/* Specify a range of data to be associated with 'id'. + * The data will exist for as long as the main gimp + * application is running. + */ +void gimp_procedural_db_set_data (gchar *id, + gpointer data, + guint32 length); + +/* Retrieve the piece of data stored within the main + * gimp application specified by 'id'. The data is + * stored in the supplied buffer. Make sure enough + * space is allocated. + */ +void gimp_procedural_db_get_data (gchar *id, + gpointer data); + +/* Get the size in bytes of the data stored by a gimp_get_data + * id. As size of zero may indicate that there is no such + * identifier in the database. + */ +guint32 gimp_procedural_db_get_data_size (gchar *id); + +/* Query the gimp application's procedural database. + * The arguments are regular expressions which select + * which procedure names will be returned in 'proc_names'. + */ +void gimp_procedural_db_query (gchar *name_regexp, + gchar *blurb_regexp, + gchar *help_regexp, + gchar *author_regexp, + gchar *copyright_regexp, + gchar *date_regexp, + gchar *proc_type_regexp, + gint *nprocs, + gchar ***proc_names); + +/* 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); + + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __GIMP_PROCEDURAL_DB_PDB_H__ */ + + diff --git a/libgimp/gimpselection_pdb.c b/libgimp/gimpselection_pdb.c index 3132746fef..76d8aa1f22 100644 --- a/libgimp/gimpselection_pdb.c +++ b/libgimp/gimpselection_pdb.c @@ -21,6 +21,7 @@ #include "gimp.h" + gint32 gimp_selection_bounds (gint32 image_ID, gint *non_empty, @@ -37,8 +38,8 @@ gimp_selection_bounds (gint32 image_ID, &nreturn_vals, PARAM_IMAGE, image_ID, PARAM_END); - result = FALSE; + result = FALSE; if (return_vals[0].data.d_status == STATUS_SUCCESS) { result = TRUE; @@ -81,12 +82,12 @@ gimp_selection_float (gint32 image_ID, return layer_ID; } -gint32 +gboolean gimp_selection_is_empty (gint32 image_ID) { GParam *return_vals; gint nreturn_vals; - gint32 is_empty; + gboolean is_empty; return_vals = gimp_run_procedure ("gimp_selection_is_empty", &nreturn_vals, @@ -94,7 +95,7 @@ gimp_selection_is_empty (gint32 image_ID) PARAM_END); is_empty = TRUE; if (return_vals[0].data.d_status == STATUS_SUCCESS) - is_empty = return_vals[1].data.d_int32; + is_empty = return_vals[1].data.d_int32 ? TRUE : FALSE; gimp_destroy_params (return_vals, nreturn_vals); @@ -111,7 +112,6 @@ gimp_selection_none (gint32 image_ID) &nreturn_vals, PARAM_IMAGE, image_ID, PARAM_END); - gimp_destroy_params (return_vals, nreturn_vals); - return; + gimp_destroy_params (return_vals, nreturn_vals); } diff --git a/libgimp/gimpunit.c b/libgimp/gimpunit.c new file mode 100644 index 0000000000..c518cead09 --- /dev/null +++ b/libgimp/gimpunit.c @@ -0,0 +1,357 @@ +/* LIBGIMP - The GIMP Library + * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball + * + * gimpunit.c + * Copyright (C) 1999-2000 Michael Natterer + * + * 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 + * Library 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 "config.h" + +#include + +#include "gimpunit.h" +#include "gimpunit_pdb.h" + +#include "libgimp-intl.h" + +/* internal structures */ + +typedef struct +{ + gboolean delete_on_exit; + gdouble factor; + gint digits; + gchar *identifier; + gchar *symbol; + gchar *abbreviation; + gchar *singular; + gchar *plural; +} GimpUnitDef; + +static GimpUnitDef gimp_unit_defs[GIMP_UNIT_END] = +{ + /* pseudo unit */ + { FALSE, 0.0, 0, "pixels", "px", "px", N_("pixel"), N_("pixels") }, + + /* standard units */ + { FALSE, 1.0, 2, "inches", "''", "in", N_("inch"), N_("inches") }, + { FALSE, 25.4, 1, "millimeters", "mm", "mm", N_("millimeter"), N_("millimeters") }, + + /* professional units */ + { FALSE, 72.0, 0, "points", "pt", "pt", N_("point"), N_("points") }, + { FALSE, 6.0, 1, "picas", "pc", "pc", N_("pica"), N_("picas") }, +}; + +/* not a unit at all but kept here to have the strings in one place + */ +static GimpUnitDef gimp_unit_percent = +{ + FALSE, 0.0, 0, "percent", "%", "%", N_("percent"), N_("percent") +}; + + +/** + * gimp_unit_get_number_of_units: + * + * Returns the number of units which are known to the #GimpUnit system. + * + * Returns: The number of defined units. + * + */ +gint +gimp_unit_get_number_of_units (void) +{ + return _gimp_unit_get_number_of_units (); +} + +/** + * gimp_unit_get_number_of_built_in_units: + * + * Returns the number of #GimpUnit's which are hardcoded in the unit system + * (UNIT_INCH, UNIT_MM, UNIT_POINT, UNIT_PICA and the two "pseudo unit" + * UNIT_PIXEL). + * + * Returns: The number of built-in units. + * + */ +gint +gimp_unit_get_number_of_built_in_units (void) +{ + return GIMP_UNIT_END; +} + +/** + * gimp_unit_new: + * @identifier: The unit's identifier string. + * @factor: The unit's factor (how many units are in one inch). + * @digits: The unit's suggested number of digits (see gimp_unit_get_digits()). + * @symbol: The symbol of the unit (e.g. "''" for inch). + * @abbreviation: The abbreviation of the unit. + * @singular: The singular form of the unit. + * @plural: The plural form of the unit. + * + * Returns the integer ID of the new #GimpUnit. + * + * Note that a new unit is always created with it's deletion flag + * set to #TRUE. You will have to set it to #FALSE with + * gimp_unit_set_deletion_flag() to make the unit definition persistent. + * + * Returns: The ID of the new unit. + * + */ +GimpUnit +gimp_unit_new (gchar *identifier, + gdouble factor, + gint digits, + gchar *symbol, + gchar *abbreviation, + gchar *singular, + gchar *plural) +{ + return _gimp_unit_new (identifier, + factor, + digits, + symbol, + abbreviation, + singular, + plural); +} + +/** + * gimp_unit_get_deletion_flag: + * @unit: The unit you want to know the @deletion_flag of. + * + * Returns: The unit's @deletion_flag. + * + */ +gboolean +gimp_unit_get_deletion_flag (GimpUnit unit) +{ + g_return_val_if_fail (unit >= GIMP_UNIT_PIXEL, TRUE); + + if (unit < GIMP_UNIT_END) + return FALSE; + + return _gimp_unit_get_deletion_flag (unit); +} + +/** + * gimp_unit_set_deletion_flag: + * @unit: The unit you want to set the @deletion_flag for. + * @deletion_flag: The new deletion_flag. + * + * Sets a #GimpUnit's @deletion_flag. If the @deletion_flag of a unit is + * #TRUE when GIMP exits, this unit will not be saved in the uses's + * "unitrc" file. + * + * Trying to change the @deletion_flag of a built-in unit will be silently + * ignored. + * + */ +void +gimp_unit_set_deletion_flag (GimpUnit unit, + gboolean deletion_flag) +{ + g_return_if_fail (unit >= GIMP_UNIT_PIXEL); + + if (unit < GIMP_UNIT_END) + return; + + _gimp_unit_set_deletion_flag (unit, + deletion_flag); +} + +/** + * gimp_unit_get_factor: + * @unit: The unit you want to know the factor of. + * + * A #GimpUnit's @factor is defined to be: + * + * distance_in_units == (@factor * distance_in_inches) + * + * Returns 0 for @unit == GIMP_UNIT_PIXEL. + * + * Returns: The unit's factor. + * + */ +gdouble +gimp_unit_get_factor (GimpUnit unit) +{ + g_return_val_if_fail (unit >= GIMP_UNIT_INCH, 1.0); + + if (unit < GIMP_UNIT_END) + return gimp_unit_defs[unit].factor; + + return _gimp_unit_get_factor (unit); +} + +/** + * gimp_unit_get_digits: + * @unit: The unit you want to know the digits. + * + * Returns the number of digits an entry field should provide to get + * approximately the same accuracy as an inch input field with two digits. + * + * Returns 0 for @unit == GIMP_UNIT_PIXEL. + * + * Returns: The suggested number of digits. + * + */ +gint +gimp_unit_get_digits (GimpUnit unit) +{ + g_return_val_if_fail (unit >= GIMP_UNIT_INCH, 0); + + if (unit < GIMP_UNIT_END) + return gimp_unit_defs[unit].digits; + + return _gimp_unit_get_digits (unit); +} + +/** + * gimp_unit_get_identifier: + * @unit: The unit you want to know the identifier of. + * + * This is an unstranslated string. + * + * NOTE: This string has to be g_free()'d by plugins but is a pointer to a + * constant string when this function is used from inside the GIMP. + * + * Returns: The unit's identifier. + * + */ +gchar * +gimp_unit_get_identifier (GimpUnit unit) +{ + g_return_val_if_fail (unit >= GIMP_UNIT_PIXEL, g_strdup ("")); + + if (unit < GIMP_UNIT_END) + return g_strdup (gimp_unit_defs[unit].identifier); + + if (unit == GIMP_UNIT_PERCENT) + return g_strdup (gimp_unit_percent.identifier); + + return _gimp_unit_get_identifier (unit); +} + +/** + * gimp_unit_get_symbol: + * @unit: The unit you want to know the symbol of. + * + * This is e.g. "''" for UNIT_INCH. + * + * NOTE: This string has to be g_free()'d by plugins but is a pointer to a + * constant string when this function is used from inside the GIMP. + * + * Returns: The unit's symbol. + * + */ +gchar * +gimp_unit_get_symbol (GimpUnit unit) +{ + g_return_val_if_fail (unit >= GIMP_UNIT_PIXEL, g_strdup ("")); + + if (unit < GIMP_UNIT_END) + return g_strdup (gimp_unit_defs[unit].symbol); + + if (unit == GIMP_UNIT_PERCENT) + return g_strdup (gimp_unit_percent.symbol); + + return _gimp_unit_get_symbol (unit); +} + +/** + * gimp_unit_get_abbreviation: + * @unit: The unit you want to know the abbreviation of. + * + * For built-in units, this function returns the translated abbreviation + * of the unit. + * + * NOTE: This string has to be g_free()'d by plugins but is a pointer to a + * constant string when this function is used from inside the GIMP. + * + * Returns: The unit's abbreviation. + * + */ +gchar * +gimp_unit_get_abbreviation (GimpUnit unit) +{ + g_return_val_if_fail (unit >= GIMP_UNIT_PIXEL, g_strdup ("")); + + if (unit < GIMP_UNIT_END) + return g_strdup (gimp_unit_defs[unit].abbreviation); + + if (unit == GIMP_UNIT_PERCENT) + return g_strdup (gimp_unit_percent.abbreviation); + + return _gimp_unit_get_abbreviation (unit); +} + +/** + * gimp_unit_get_singular: + * @unit: The unit you want to know the singular form of. + * + * For built-in units, this function returns the translated singular form + * of the unit's name. + * + * NOTE: This string has to be g_free()'d by plugins but is a pointer to a + * constant string when this function is used from inside the GIMP. + * + * Returns: The unit's singular form. + * + */ +gchar * +gimp_unit_get_singular (GimpUnit unit) +{ + g_return_val_if_fail (unit >= GIMP_UNIT_PIXEL, g_strdup ("")); + + if (unit < GIMP_UNIT_END) + return g_strdup (gettext (gimp_unit_defs[unit].singular)); + + if (unit == GIMP_UNIT_PERCENT) + return g_strdup (gettext (gimp_unit_percent.singular)); + + return _gimp_unit_get_singular (unit); +} + +/** + * gimp_unit_get_plural: + * @unit: The unit you want to know the plural form of. + * + * For built-in units, this function returns the translated plural form + * of the unit's name. + * + * NOTE: This string has to be g_free()'d by plugins but is a pointer to a + * constant string when this function is used from inside the GIMP. + * + * Returns: The unit's plural form. + * + */ +gchar * +gimp_unit_get_plural (GimpUnit unit) +{ + g_return_val_if_fail (unit >= GIMP_UNIT_PIXEL, g_strdup ("")); + + if (unit < GIMP_UNIT_END) + return g_strdup (gettext (gimp_unit_defs[unit].plural)); + + if (unit == GIMP_UNIT_PERCENT) + return g_strdup (gettext (gimp_unit_percent.plural)); + + return _gimp_unit_get_plural (unit); +} diff --git a/libgimp/gimpunit.h b/libgimp/gimpunit.h index dbf9045672..85efd5f2a7 100644 --- a/libgimp/gimpunit.h +++ b/libgimp/gimpunit.h @@ -2,7 +2,7 @@ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball * * gimpunit.h - * Copyright (C) 1999 Michael Natterer + * Copyright (C) 1999-2000 Michael Natterer * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -27,8 +27,8 @@ * the gimp app and plugins. */ -#ifndef __GIMPUNIT_H__ -#define __GIMPUNIT_H__ +#ifndef __GIMP_UNIT_H__ +#define __GIMP_UNIT_H__ #ifdef __cplusplus extern "C" { @@ -83,4 +83,4 @@ gchar * gimp_unit_get_plural (GimpUnit unit); } #endif /* __cplusplus */ -#endif /* __GIMPUNIT_H__ */ +#endif /* __GIMP_UNIT_H__ */ diff --git a/libgimp/gimpunit_pdb.c b/libgimp/gimpunit_pdb.c index 3739063645..6eca72a1aa 100644 --- a/libgimp/gimpunit_pdb.c +++ b/libgimp/gimpunit_pdb.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball * * gimpunit_pdb.c - * Copyright (C) 1999 Michael Natterer + * Copyright (C) 1999-2000 Michael Natterer * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,59 +20,11 @@ * Boston, MA 02111-1307, USA. */ -#include "config.h" - #include "gimp.h" -#include "gimpunit.h" - -#include "libgimp-intl.h" - -/* internal structures */ - -typedef struct -{ - gboolean delete_on_exit; - gdouble factor; - gint digits; - gchar *identifier; - gchar *symbol; - gchar *abbreviation; - gchar *singular; - gchar *plural; -} GimpUnitDef; - -static GimpUnitDef gimp_unit_defs[GIMP_UNIT_END] = -{ - /* pseudo unit */ - { FALSE, 0.0, 0, "pixels", "px", "px", N_("pixel"), N_("pixels") }, - - /* standard units */ - { FALSE, 1.0, 2, "inches", "''", "in", N_("inch"), N_("inches") }, - { FALSE, 25.4, 1, "millimeters", "mm", "mm", N_("millimeter"), N_("millimeters") }, - - /* professional units */ - { FALSE, 72.0, 0, "points", "pt", "pt", N_("point"), N_("points") }, - { FALSE, 6.0, 1, "picas", "pc", "pc", N_("pica"), N_("picas") }, -}; - -/* not a unit at all but kept here to have the strings in one place - */ -static GimpUnitDef gimp_unit_percent = -{ - FALSE, 0.0, 0, "percent", "%", "%", N_("percent"), N_("percent") -}; -/** - * gimp_unit_get_number_of_units: - * - * Returns the number of units which are known to the #GimpUnit system. - * - * Returns: The number of defined units. - * - */ gint -gimp_unit_get_number_of_units (void) +_gimp_unit_get_number_of_units (void) { GParam *return_vals; gint nreturn_vals; @@ -92,49 +44,35 @@ gimp_unit_get_number_of_units (void) return number; } -/** - * gimp_unit_get_number_of_built_in_units: - * - * Returns the number of #GimpUnit's which are hardcoded in the unit system - * (UNIT_INCH, UNIT_MM, UNIT_POINT, UNIT_PICA and the two "pseudo unit" - * UNIT_PIXEL). - * - * Returns: The number of built-in units. - * - */ gint -gimp_unit_get_number_of_built_in_units (void) +_gimp_unit_get_number_of_built_in_units (void) { - return GIMP_UNIT_END; + GParam *return_vals; + gint nreturn_vals; + + gint number; + + return_vals = gimp_run_procedure ("gimp_unit_get_number_of_built_in_units", + &nreturn_vals, + PARAM_END); + + number = GIMP_UNIT_END; + if (return_vals[0].data.d_status == STATUS_SUCCESS) + number = return_vals[1].data.d_int32; + + gimp_destroy_params (return_vals, nreturn_vals); + + return number; } -/** - * gimp_unit_new: - * @identifier: The unit's identifier string. - * @factor: The unit's factor (how many units are in one inch). - * @digits: The unit's suggested number of digits (see gimp_unit_get_digits()). - * @symbol: The symbol of the unit (e.g. "''" for inch). - * @abbreviation: The abbreviation of the unit. - * @singular: The singular form of the unit. - * @plural: The plural form of the unit. - * - * Returns the integer ID of the new #GimpUnit. - * - * Note that a new unit is always created with it's deletion flag - * set to #TRUE. You will have to set it to #FALSE with - * gimp_unit_set_deletion_flag() to make the unit definition persistent. - * - * Returns: The ID of the new unit. - * - */ GimpUnit -gimp_unit_new (gchar *identifier, - gdouble factor, - gint digits, - gchar *symbol, - gchar *abbreviation, - gchar *singular, - gchar *plural) +_gimp_unit_new (gchar *identifier, + gdouble factor, + gint digits, + gchar *symbol, + gchar *abbreviation, + gchar *singular, + gchar *plural) { GParam *return_vals; gint nreturn_vals; @@ -143,13 +81,13 @@ gimp_unit_new (gchar *identifier, return_vals = gimp_run_procedure ("gimp_unit_new", &nreturn_vals, - PARAM_STRING, g_strdup (identifier), + PARAM_STRING, identifier, PARAM_FLOAT, factor, PARAM_INT32, digits, - PARAM_STRING, g_strdup (symbol), - PARAM_STRING, g_strdup (abbreviation), - PARAM_STRING, g_strdup (singular), - PARAM_STRING, g_strdup (plural), + PARAM_STRING, symbol, + PARAM_STRING, abbreviation, + PARAM_STRING, singular, + PARAM_STRING, plural, PARAM_END); unit = GIMP_UNIT_INCH; @@ -161,15 +99,8 @@ gimp_unit_new (gchar *identifier, return unit; } -/** - * gimp_unit_get_deletion_flag: - * @unit: The unit you want to know the @deletion_flag of. - * - * Returns: The unit's @deletion_flag. - * - */ gboolean -gimp_unit_get_deletion_flag (GimpUnit unit) +_gimp_unit_get_deletion_flag (GimpUnit unit) { GParam *return_vals; gint nreturn_vals; @@ -195,31 +126,13 @@ gimp_unit_get_deletion_flag (GimpUnit unit) return flag; } -/** - * gimp_unit_set_deletion_flag: - * @unit: The unit you want to set the @deletion_flag for. - * @deletion_flag: The new deletion_flag. - * - * Sets a #GimpUnit's @deletion_flag. If the @deletion_flag of a unit is - * #TRUE when GIMP exits, this unit will not be saved in the uses's - * "unitrc" file. - * - * Trying to change the @deletion_flag of a built-in unit will be silently - * ignored. - * - */ void -gimp_unit_set_deletion_flag (GimpUnit unit, - gboolean deletion_flag) +_gimp_unit_set_deletion_flag (GimpUnit unit, + gboolean deletion_flag) { GParam *return_vals; gint nreturn_vals; - g_return_if_fail (unit >= GIMP_UNIT_PIXEL); - - if (unit < GIMP_UNIT_END) - return; - return_vals = gimp_run_procedure ("gimp_unit_set_deletion_flag", &nreturn_vals, PARAM_INT32, unit, @@ -229,32 +142,14 @@ gimp_unit_set_deletion_flag (GimpUnit unit, gimp_destroy_params (return_vals, nreturn_vals); } -/** - * gimp_unit_get_factor: - * @unit: The unit you want to know the factor of. - * - * A #GimpUnit's @factor is defined to be: - * - * distance_in_units == (@factor * distance_in_inches) - * - * Returns 0 for @unit == GIMP_UNIT_PIXEL. - * - * Returns: The unit's factor. - * - */ gdouble -gimp_unit_get_factor (GimpUnit unit) +_gimp_unit_get_factor (GimpUnit unit) { GParam *return_vals; gint nreturn_vals; gdouble factor; - g_return_val_if_fail (unit >= GIMP_UNIT_INCH, 1.0); - - if (unit < GIMP_UNIT_END) - return gimp_unit_defs[unit].factor; - return_vals = gimp_run_procedure ("gimp_unit_get_factor", &nreturn_vals, PARAM_INT32, unit, @@ -269,38 +164,20 @@ gimp_unit_get_factor (GimpUnit unit) return factor; } -/** - * gimp_unit_get_digits: - * @unit: The unit you want to know the digits. - * - * Returns the number of digits an entry field should provide to get - * approximately the same accuracy as an inch input field with two digits. - * - * Returns 0 for @unit == GIMP_UNIT_PIXEL. - * - * Returns: The suggested number of digits. - * - */ gint -gimp_unit_get_digits (GimpUnit unit) +_gimp_unit_get_digits (GimpUnit unit) { GParam *return_vals; gint nreturn_vals; gint digits; - if (unit < 0) - return 0; - - if (unit < GIMP_UNIT_END) - return gimp_unit_defs[unit].digits; - return_vals = gimp_run_procedure ("gimp_unit_get_digits", &nreturn_vals, PARAM_INT32, unit, PARAM_END); - digits = gimp_unit_defs[GIMP_UNIT_INCH].digits; + digits = 2; /* == gimp_unit_defs[GIMP_UNIT_INCH].digits */ if (return_vals[0].data.d_status == STATUS_SUCCESS) digits = return_vals[1].data.d_int32; @@ -309,34 +186,14 @@ gimp_unit_get_digits (GimpUnit unit) return digits; } -/** - * gimp_unit_get_identifier: - * @unit: The unit you want to know the identifier of. - * - * This is an unstranslated string. - * - * NOTE: This string has to be g_free()'d by plugins but is a pointer to a - * constant string when this function is used from inside the GIMP. - * - * Returns: The unit's identifier. - * - */ gchar * -gimp_unit_get_identifier (GimpUnit unit) +_gimp_unit_get_identifier (GimpUnit unit) { GParam *return_vals; gint nreturn_vals; gchar *identifier; - g_return_val_if_fail (unit >= GIMP_UNIT_PIXEL, g_strdup ("")); - - if (unit < GIMP_UNIT_END) - return g_strdup (gimp_unit_defs[unit].identifier); - - if (unit == GIMP_UNIT_PERCENT) - return g_strdup (gimp_unit_percent.identifier); - return_vals = gimp_run_procedure ("gimp_unit_get_identifier", &nreturn_vals, PARAM_INT32, unit, @@ -351,34 +208,14 @@ gimp_unit_get_identifier (GimpUnit unit) return identifier ? identifier : g_strdup (""); } -/** - * gimp_unit_get_symbol: - * @unit: The unit you want to know the symbol of. - * - * This is e.g. "''" for UNIT_INCH. - * - * NOTE: This string has to be g_free()'d by plugins but is a pointer to a - * constant string when this function is used from inside the GIMP. - * - * Returns: The unit's symbol. - * - */ gchar * -gimp_unit_get_symbol (GimpUnit unit) +_gimp_unit_get_symbol (GimpUnit unit) { GParam *return_vals; gint nreturn_vals; gchar *symbol; - g_return_val_if_fail (unit >= GIMP_UNIT_PIXEL, g_strdup ("")); - - if (unit < GIMP_UNIT_END) - return g_strdup (gimp_unit_defs[unit].symbol); - - if (unit == GIMP_UNIT_PERCENT) - return g_strdup (gimp_unit_percent.symbol); - return_vals = gimp_run_procedure ("gimp_unit_get_symbol", &nreturn_vals, PARAM_INT32, unit, @@ -393,36 +230,14 @@ gimp_unit_get_symbol (GimpUnit unit) return symbol ? symbol : g_strdup (""); } - -/** - * gimp_unit_get_abbreviation: - * @unit: The unit you want to know the abbreviation of. - * - * For built-in units, this function returns the translated abbreviation - * of the unit. - * - * NOTE: This string has to be g_free()'d by plugins but is a pointer to a - * constant string when this function is used from inside the GIMP. - * - * Returns: The unit's abbreviation. - * - */ gchar * -gimp_unit_get_abbreviation (GimpUnit unit) +_gimp_unit_get_abbreviation (GimpUnit unit) { GParam *return_vals; gint nreturn_vals; gchar *abbreviation; - g_return_val_if_fail (unit >= GIMP_UNIT_PIXEL, g_strdup ("")); - - if (unit < GIMP_UNIT_END) - return g_strdup (gimp_unit_defs[unit].abbreviation); - - if (unit == GIMP_UNIT_PERCENT) - return g_strdup (gimp_unit_percent.abbreviation); - return_vals = gimp_run_procedure ("gimp_unit_get_abbreviation", &nreturn_vals, PARAM_INT32, unit, @@ -437,36 +252,14 @@ gimp_unit_get_abbreviation (GimpUnit unit) return abbreviation ? abbreviation : g_strdup (""); } - -/** - * gimp_unit_get_singular: - * @unit: The unit you want to know the singular form of. - * - * For built-in units, this function returns the translated singular form - * of the unit's name. - * - * NOTE: This string has to be g_free()'d by plugins but is a pointer to a - * constant string when this function is used from inside the GIMP. - * - * Returns: The unit's singular form. - * - */ gchar * -gimp_unit_get_singular (GimpUnit unit) +_gimp_unit_get_singular (GimpUnit unit) { GParam *return_vals; gint nreturn_vals; gchar *singular; - g_return_val_if_fail (unit >= GIMP_UNIT_PIXEL, g_strdup ("")); - - if (unit < GIMP_UNIT_END) - return g_strdup (gettext (gimp_unit_defs[unit].singular)); - - if (unit == GIMP_UNIT_PERCENT) - return g_strdup (gettext (gimp_unit_percent.singular)); - return_vals = gimp_run_procedure ("gimp_unit_get_singular", &nreturn_vals, PARAM_INT32, unit, @@ -481,35 +274,14 @@ gimp_unit_get_singular (GimpUnit unit) return singular ? singular : g_strdup (""); } -/** - * gimp_unit_get_plural: - * @unit: The unit you want to know the plural form of. - * - * For built-in units, this function returns the translated plural form - * of the unit's name. - * - * NOTE: This string has to be g_free()'d by plugins but is a pointer to a - * constant string when this function is used from inside the GIMP. - * - * Returns: The unit's plural form. - * - */ gchar * -gimp_unit_get_plural (GimpUnit unit) +_gimp_unit_get_plural (GimpUnit unit) { GParam *return_vals; gint nreturn_vals; gchar *plural; - g_return_val_if_fail (unit >= GIMP_UNIT_PIXEL, g_strdup ("")); - - if (unit < GIMP_UNIT_END) - return g_strdup (gettext (gimp_unit_defs[unit].plural)); - - if (unit == GIMP_UNIT_PERCENT) - return g_strdup (gettext (gimp_unit_percent.plural)); - return_vals = gimp_run_procedure ("gimp_unit_get_plural", &nreturn_vals, PARAM_INT32, unit, diff --git a/libgimp/gimpunit_pdb.h b/libgimp/gimpunit_pdb.h index 208296a6f6..f95cfb636b 100644 --- a/libgimp/gimpunit_pdb.h +++ b/libgimp/gimpunit_pdb.h @@ -1,23 +1,24 @@ -/* LIBGIMP - The GIMP Library - * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball +/* LIBGIMP - The GIMP Library + * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball * * gimpunit_pdb.h + * Copyright (C) 1999-2000 Michael Natterer * * 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 + * 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. - */ + */ #ifndef __GIMP_UNIT_PDB_H__ #define __GIMP_UNIT_PDB_H__ @@ -29,6 +30,33 @@ extern "C" { /* For information look into the C source or the html documentation */ +gint _gimp_unit_get_number_of_units (void); +gint _gimp_unit_get_number_of_built_in_units (void); + +GimpUnit _gimp_unit_new (gchar *identifier, + gdouble factor, + gint digits, + gchar *symbol, + gchar *abbreviation, + gchar *singular, + gchar *plural); + +gboolean _gimp_unit_get_deletion_flag (GimpUnit unit); +void _gimp_unit_set_deletion_flag (GimpUnit unit, + gboolean deletion_flag); + +gdouble _gimp_unit_get_factor (GimpUnit unit); + +gint _gimp_unit_get_digits (GimpUnit unit); + +gchar * _gimp_unit_get_identifier (GimpUnit unit); + +gchar * _gimp_unit_get_symbol (GimpUnit unit); +gchar * _gimp_unit_get_abbreviation (GimpUnit unit); +gchar * _gimp_unit_get_singular (GimpUnit unit); +gchar * _gimp_unit_get_plural (GimpUnit unit); + + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/libgimp/gimpunitcache.c b/libgimp/gimpunitcache.c new file mode 100644 index 0000000000..c518cead09 --- /dev/null +++ b/libgimp/gimpunitcache.c @@ -0,0 +1,357 @@ +/* LIBGIMP - The GIMP Library + * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball + * + * gimpunit.c + * Copyright (C) 1999-2000 Michael Natterer + * + * 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 + * Library 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 "config.h" + +#include + +#include "gimpunit.h" +#include "gimpunit_pdb.h" + +#include "libgimp-intl.h" + +/* internal structures */ + +typedef struct +{ + gboolean delete_on_exit; + gdouble factor; + gint digits; + gchar *identifier; + gchar *symbol; + gchar *abbreviation; + gchar *singular; + gchar *plural; +} GimpUnitDef; + +static GimpUnitDef gimp_unit_defs[GIMP_UNIT_END] = +{ + /* pseudo unit */ + { FALSE, 0.0, 0, "pixels", "px", "px", N_("pixel"), N_("pixels") }, + + /* standard units */ + { FALSE, 1.0, 2, "inches", "''", "in", N_("inch"), N_("inches") }, + { FALSE, 25.4, 1, "millimeters", "mm", "mm", N_("millimeter"), N_("millimeters") }, + + /* professional units */ + { FALSE, 72.0, 0, "points", "pt", "pt", N_("point"), N_("points") }, + { FALSE, 6.0, 1, "picas", "pc", "pc", N_("pica"), N_("picas") }, +}; + +/* not a unit at all but kept here to have the strings in one place + */ +static GimpUnitDef gimp_unit_percent = +{ + FALSE, 0.0, 0, "percent", "%", "%", N_("percent"), N_("percent") +}; + + +/** + * gimp_unit_get_number_of_units: + * + * Returns the number of units which are known to the #GimpUnit system. + * + * Returns: The number of defined units. + * + */ +gint +gimp_unit_get_number_of_units (void) +{ + return _gimp_unit_get_number_of_units (); +} + +/** + * gimp_unit_get_number_of_built_in_units: + * + * Returns the number of #GimpUnit's which are hardcoded in the unit system + * (UNIT_INCH, UNIT_MM, UNIT_POINT, UNIT_PICA and the two "pseudo unit" + * UNIT_PIXEL). + * + * Returns: The number of built-in units. + * + */ +gint +gimp_unit_get_number_of_built_in_units (void) +{ + return GIMP_UNIT_END; +} + +/** + * gimp_unit_new: + * @identifier: The unit's identifier string. + * @factor: The unit's factor (how many units are in one inch). + * @digits: The unit's suggested number of digits (see gimp_unit_get_digits()). + * @symbol: The symbol of the unit (e.g. "''" for inch). + * @abbreviation: The abbreviation of the unit. + * @singular: The singular form of the unit. + * @plural: The plural form of the unit. + * + * Returns the integer ID of the new #GimpUnit. + * + * Note that a new unit is always created with it's deletion flag + * set to #TRUE. You will have to set it to #FALSE with + * gimp_unit_set_deletion_flag() to make the unit definition persistent. + * + * Returns: The ID of the new unit. + * + */ +GimpUnit +gimp_unit_new (gchar *identifier, + gdouble factor, + gint digits, + gchar *symbol, + gchar *abbreviation, + gchar *singular, + gchar *plural) +{ + return _gimp_unit_new (identifier, + factor, + digits, + symbol, + abbreviation, + singular, + plural); +} + +/** + * gimp_unit_get_deletion_flag: + * @unit: The unit you want to know the @deletion_flag of. + * + * Returns: The unit's @deletion_flag. + * + */ +gboolean +gimp_unit_get_deletion_flag (GimpUnit unit) +{ + g_return_val_if_fail (unit >= GIMP_UNIT_PIXEL, TRUE); + + if (unit < GIMP_UNIT_END) + return FALSE; + + return _gimp_unit_get_deletion_flag (unit); +} + +/** + * gimp_unit_set_deletion_flag: + * @unit: The unit you want to set the @deletion_flag for. + * @deletion_flag: The new deletion_flag. + * + * Sets a #GimpUnit's @deletion_flag. If the @deletion_flag of a unit is + * #TRUE when GIMP exits, this unit will not be saved in the uses's + * "unitrc" file. + * + * Trying to change the @deletion_flag of a built-in unit will be silently + * ignored. + * + */ +void +gimp_unit_set_deletion_flag (GimpUnit unit, + gboolean deletion_flag) +{ + g_return_if_fail (unit >= GIMP_UNIT_PIXEL); + + if (unit < GIMP_UNIT_END) + return; + + _gimp_unit_set_deletion_flag (unit, + deletion_flag); +} + +/** + * gimp_unit_get_factor: + * @unit: The unit you want to know the factor of. + * + * A #GimpUnit's @factor is defined to be: + * + * distance_in_units == (@factor * distance_in_inches) + * + * Returns 0 for @unit == GIMP_UNIT_PIXEL. + * + * Returns: The unit's factor. + * + */ +gdouble +gimp_unit_get_factor (GimpUnit unit) +{ + g_return_val_if_fail (unit >= GIMP_UNIT_INCH, 1.0); + + if (unit < GIMP_UNIT_END) + return gimp_unit_defs[unit].factor; + + return _gimp_unit_get_factor (unit); +} + +/** + * gimp_unit_get_digits: + * @unit: The unit you want to know the digits. + * + * Returns the number of digits an entry field should provide to get + * approximately the same accuracy as an inch input field with two digits. + * + * Returns 0 for @unit == GIMP_UNIT_PIXEL. + * + * Returns: The suggested number of digits. + * + */ +gint +gimp_unit_get_digits (GimpUnit unit) +{ + g_return_val_if_fail (unit >= GIMP_UNIT_INCH, 0); + + if (unit < GIMP_UNIT_END) + return gimp_unit_defs[unit].digits; + + return _gimp_unit_get_digits (unit); +} + +/** + * gimp_unit_get_identifier: + * @unit: The unit you want to know the identifier of. + * + * This is an unstranslated string. + * + * NOTE: This string has to be g_free()'d by plugins but is a pointer to a + * constant string when this function is used from inside the GIMP. + * + * Returns: The unit's identifier. + * + */ +gchar * +gimp_unit_get_identifier (GimpUnit unit) +{ + g_return_val_if_fail (unit >= GIMP_UNIT_PIXEL, g_strdup ("")); + + if (unit < GIMP_UNIT_END) + return g_strdup (gimp_unit_defs[unit].identifier); + + if (unit == GIMP_UNIT_PERCENT) + return g_strdup (gimp_unit_percent.identifier); + + return _gimp_unit_get_identifier (unit); +} + +/** + * gimp_unit_get_symbol: + * @unit: The unit you want to know the symbol of. + * + * This is e.g. "''" for UNIT_INCH. + * + * NOTE: This string has to be g_free()'d by plugins but is a pointer to a + * constant string when this function is used from inside the GIMP. + * + * Returns: The unit's symbol. + * + */ +gchar * +gimp_unit_get_symbol (GimpUnit unit) +{ + g_return_val_if_fail (unit >= GIMP_UNIT_PIXEL, g_strdup ("")); + + if (unit < GIMP_UNIT_END) + return g_strdup (gimp_unit_defs[unit].symbol); + + if (unit == GIMP_UNIT_PERCENT) + return g_strdup (gimp_unit_percent.symbol); + + return _gimp_unit_get_symbol (unit); +} + +/** + * gimp_unit_get_abbreviation: + * @unit: The unit you want to know the abbreviation of. + * + * For built-in units, this function returns the translated abbreviation + * of the unit. + * + * NOTE: This string has to be g_free()'d by plugins but is a pointer to a + * constant string when this function is used from inside the GIMP. + * + * Returns: The unit's abbreviation. + * + */ +gchar * +gimp_unit_get_abbreviation (GimpUnit unit) +{ + g_return_val_if_fail (unit >= GIMP_UNIT_PIXEL, g_strdup ("")); + + if (unit < GIMP_UNIT_END) + return g_strdup (gimp_unit_defs[unit].abbreviation); + + if (unit == GIMP_UNIT_PERCENT) + return g_strdup (gimp_unit_percent.abbreviation); + + return _gimp_unit_get_abbreviation (unit); +} + +/** + * gimp_unit_get_singular: + * @unit: The unit you want to know the singular form of. + * + * For built-in units, this function returns the translated singular form + * of the unit's name. + * + * NOTE: This string has to be g_free()'d by plugins but is a pointer to a + * constant string when this function is used from inside the GIMP. + * + * Returns: The unit's singular form. + * + */ +gchar * +gimp_unit_get_singular (GimpUnit unit) +{ + g_return_val_if_fail (unit >= GIMP_UNIT_PIXEL, g_strdup ("")); + + if (unit < GIMP_UNIT_END) + return g_strdup (gettext (gimp_unit_defs[unit].singular)); + + if (unit == GIMP_UNIT_PERCENT) + return g_strdup (gettext (gimp_unit_percent.singular)); + + return _gimp_unit_get_singular (unit); +} + +/** + * gimp_unit_get_plural: + * @unit: The unit you want to know the plural form of. + * + * For built-in units, this function returns the translated plural form + * of the unit's name. + * + * NOTE: This string has to be g_free()'d by plugins but is a pointer to a + * constant string when this function is used from inside the GIMP. + * + * Returns: The unit's plural form. + * + */ +gchar * +gimp_unit_get_plural (GimpUnit unit) +{ + g_return_val_if_fail (unit >= GIMP_UNIT_PIXEL, g_strdup ("")); + + if (unit < GIMP_UNIT_END) + return g_strdup (gettext (gimp_unit_defs[unit].plural)); + + if (unit == GIMP_UNIT_PERCENT) + return g_strdup (gettext (gimp_unit_percent.plural)); + + return _gimp_unit_get_plural (unit); +} diff --git a/libgimpbase/gimpunit.h b/libgimpbase/gimpunit.h index dbf9045672..85efd5f2a7 100644 --- a/libgimpbase/gimpunit.h +++ b/libgimpbase/gimpunit.h @@ -2,7 +2,7 @@ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball * * gimpunit.h - * Copyright (C) 1999 Michael Natterer + * Copyright (C) 1999-2000 Michael Natterer * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -27,8 +27,8 @@ * the gimp app and plugins. */ -#ifndef __GIMPUNIT_H__ -#define __GIMPUNIT_H__ +#ifndef __GIMP_UNIT_H__ +#define __GIMP_UNIT_H__ #ifdef __cplusplus extern "C" { @@ -83,4 +83,4 @@ gchar * gimp_unit_get_plural (GimpUnit unit); } #endif /* __cplusplus */ -#endif /* __GIMPUNIT_H__ */ +#endif /* __GIMP_UNIT_H__ */ diff --git a/plug-ins/perl/Changes b/plug-ins/perl/Changes index 780e777fe2..f0deffa9fb 100644 --- a/plug-ins/perl/Changes +++ b/plug-ins/perl/Changes @@ -1,5 +1,6 @@ Revision history for Gimp-Perl extension. + - s/gimp_plugin_domain_add/gimp_plugin_domain_register/ - really moved sethspin into /Filters (neo) - moved sethspin back to Filters/Animation (sjb) - fixed problem in Net.pm/try_connect (AF_LOCAL vs. PF_UNIX, or diff --git a/plug-ins/perl/Gimp/Lib.xs b/plug-ins/perl/Gimp/Lib.xs index b2b7ed99d8..4d9f4f9e67 100644 --- a/plug-ins/perl/Gimp/Lib.xs +++ b/plug-ins/perl/Gimp/Lib.xs @@ -1641,10 +1641,7 @@ gimp_install_procedure(name, blurb, help, author, copyright, date, menu_path, im type,nparams,nreturn_vals,apd,rpd,pii_run); else { - /* this is horrendously ugly :( */ -#if GIMP_CHECK_VERSION(1,1,18) - gimp_plugin_domain_add_with_path ("gimp-perl", datadir "/locale"); -#endif + gimp_plugin_domain_register ("gimp-perl", datadir "/locale"); gimp_install_procedure(name,blurb,help,author,copyright,date,SvPv(menu_path),SvPv(image_types), type,nparams,nreturn_vals,apd,rpd); diff --git a/plug-ins/script-fu/script-fu.c b/plug-ins/script-fu/script-fu.c index eaa169dbe4..b23b66cc70 100644 --- a/plug-ins/script-fu/script-fu.c +++ b/plug-ins/script-fu/script-fu.c @@ -142,7 +142,7 @@ query (void) }; static gint nserver_args = sizeof (server_args) / sizeof (server_args[0]); - gimp_plugin_domain_add ("gimp-script-fu"); + gimp_plugin_domain_register ("gimp-script-fu", NULL); gimp_install_procedure ("extension_script_fu", "A scheme interpreter for scripting GIMP operations", diff --git a/po-libgimp/ChangeLog b/po-libgimp/ChangeLog index 50ffd3aad7..19967d0977 100644 --- a/po-libgimp/ChangeLog +++ b/po-libgimp/ChangeLog @@ -1,3 +1,7 @@ +2000-05-31 Michael Natterer + + * POTFILES.in: s/gimpunit_pdb/gimpunit/ + Wed May 31 13:38:07 CEST 2000 Stanislav Brabec * cs.po: Updated translation. diff --git a/po-libgimp/POTFILES.in b/po-libgimp/POTFILES.in index e29e0ecc9d..796baf0630 100644 --- a/po-libgimp/POTFILES.in +++ b/po-libgimp/POTFILES.in @@ -6,6 +6,6 @@ libgimp/gimpexport.c libgimp/gimpfileselection.c libgimp/gimpquerybox.c libgimp/gimpunitmenu.c -libgimp/gimpunit_pdb.c +libgimp/gimpunit.c libgimp/gimpunitmenu.c libgimp/gimpwidgets.c diff --git a/tools/pdbgen/Makefile.am b/tools/pdbgen/Makefile.am index 4e76208b93..8309d335f3 100644 --- a/tools/pdbgen/Makefile.am +++ b/tools/pdbgen/Makefile.am @@ -16,12 +16,12 @@ pdb_sources = \ pdb/gimage.pdb \ pdb/gimage_mask.pdb \ pdb/gimprc.pdb \ - pdb/gimphelp.pdb \ pdb/gradient.pdb \ pdb/gradient_select.pdb \ pdb/guides.pdb \ - pdb/interface.pdb \ + pdb/help.pdb \ pdb/layer.pdb \ + pdb/message.pdb \ pdb/misc.pdb \ pdb/palette.pdb \ pdb/parasite.pdb \ diff --git a/tools/pdbgen/groups.pl b/tools/pdbgen/groups.pl index e2cade9ae1..eec1b82415 100644 --- a/tools/pdbgen/groups.pl +++ b/tools/pdbgen/groups.pl @@ -14,12 +14,12 @@ gimage gimage_mask gimprc - gimphelp gradient gradient_select guides - interface + help layer + message misc palette parasite diff --git a/tools/pdbgen/lib.pl b/tools/pdbgen/lib.pl index 1fd9d5e2c0..cd76664b86 100644 --- a/tools/pdbgen/lib.pl +++ b/tools/pdbgen/lib.pl @@ -379,31 +379,31 @@ CODE } my $lgpl = <<'LGPL'; -/* LIBGIMP - The GIMP Library - * Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball +/* LIBGIMP - The GIMP Library + * Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball * * 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 + * 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 */ LGPL - # We generate two files, a .h file with prototypes for all the functions - # we make, and a .c file for the actual implementation + # 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"; diff --git a/tools/pdbgen/pdb/gimphelp.pdb b/tools/pdbgen/pdb/help.pdb similarity index 66% rename from tools/pdbgen/pdb/gimphelp.pdb rename to tools/pdbgen/pdb/help.pdb index 7e0e50d23d..e2ff42a1f6 100644 --- a/tools/pdbgen/pdb/gimphelp.pdb +++ b/tools/pdbgen/pdb/help.pdb @@ -50,44 +50,9 @@ HELP ); } -sub plugin_help_register { - $blurb = "Register a help path for a plug-in."; +@headers = qw("gimphelp.h"); - $help = < 'help_path', type => 'string', - desc => 'The rootdir of the plug-in\'s help pages' } - ); - - %invoke = ( - success => 'TRUE', - vars => [ 'PlugInDef *plug_in_def' ], - code => <<'CODE', -{ - if (current_plug_in && current_plug_in->query) - { - plug_in_def = current_plug_in->user_data; - - if (plug_in_def->help_path) - g_free (plug_in_def->help_path); - plug_in_def->help_path = g_strdup (help_path); - } -} -CODE - ); -} - -@headers = qw("gimphelp.h" "plug_in.h"); - -@procs = qw(help plugin_help_register); +@procs = qw(help); %exports = (app => [@procs]); $desc = 'Help procedures'; diff --git a/tools/pdbgen/pdb/interface.pdb b/tools/pdbgen/pdb/message.pdb similarity index 100% rename from tools/pdbgen/pdb/interface.pdb rename to tools/pdbgen/pdb/message.pdb diff --git a/tools/pdbgen/pdb/plug_in.pdb b/tools/pdbgen/pdb/plug_in.pdb index d8ba364299..e602955be7 100644 --- a/tools/pdbgen/pdb/plug_in.pdb +++ b/tools/pdbgen/pdb/plug_in.pdb @@ -22,6 +22,11 @@ sub andy_pdb_misc { $date = '1998'; } +sub mitch_misc { + $author = $copyright = 'Michael Natterer '; + $date = '2000'; +} + sub neo_pdb_misc { $author = $copyright = 'Sven Neumann'; $date = '2000'; @@ -245,8 +250,8 @@ CODE ); } -sub plugin_domain_add { - $blurb = 'Adds a textdomain for localisation.'; +sub plugin_domain_register { + $blurb = 'Registers a textdomain for localisation.'; $help = <<'HELP'; This procedure adds a textdomain to the list of domains Gimp searches @@ -292,6 +297,40 @@ CODE ); } +sub plugin_help_register { + $blurb = "Register a help path for a plug-in."; + + $help = < 'help_path', type => 'string', + desc => 'The rootdir of the plug-in\'s help pages' } + ); + + %invoke = ( + success => 'TRUE', + vars => [ 'PlugInDef *plug_in_def' ], + code => <<'CODE', +{ + if (current_plug_in && current_plug_in->query) + { + plug_in_def = current_plug_in->user_data; + + if (plug_in_def->help_path) + g_free (plug_in_def->help_path); + plug_in_def->help_path = g_strdup (help_path); + } +} +CODE + ); +} @headers = qw("plug_in.h" "regex.h" "appenv.h" ); @@ -306,7 +345,7 @@ match_strings (regex_t *preg, CODE @procs = qw(progress_init progress_update temp_PDB_name plugins_query - plugin_domain_add); + plugin_domain_register plugin_help_register); %exports = (app => [@procs], lib => [@procs[0..2]]); $desc = 'Plug-in';