diff --git a/ChangeLog b/ChangeLog index 718a861219..10bd600af7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2005-08-18 Michael Natterer + + * plug-ins/common/animoptimize.c + * plug-ins/common/pnm.c + * plug-ins/metadata/interface.c + * plug-ins/metadata/metadata.c: some forgotten canonical names. + + * plug-ins/metadata/Makefile.am + * plug-ins/metadata/metadata.h: new header containing the + procedure name #defines for metadata. + 2005-08-17 Sven Neumann * configure.in: check for langinfo.h and _NL_MEASUREMENT_MEASUREMENT. diff --git a/plug-ins/common/animoptimize.c b/plug-ins/common/animoptimize.c index e96865ea96..18fc08fb76 100644 --- a/plug-ins/common/animoptimize.c +++ b/plug-ins/common/animoptimize.c @@ -37,6 +37,13 @@ #include "libgimp/stdplugins-intl.h" +#define OPTIMIZE_PROC "plug-in-animationoptimize" +#define OPTIMIZE_DIFF_PROC "plug-in-animationoptimize-diff" +#define UNOPTIMIZE_PROC "plug-in-animationunoptimize" +#define REMOVE_BACKDROP_PROC "plug-in-animation-remove-backdrop" +#define FIND_BACKDROP_PROC "plug-in-animation-find-backdrop" + + typedef enum { DISPOSE_UNDEFINED = 0x00, @@ -62,8 +69,8 @@ static void run (const gchar *name, gint *nreturn_vals, GimpParam **return_vals); -static gint32 do_optimizations (GimpRunMode run_mode, - gboolean diff_only); +static gint32 do_optimizations (GimpRunMode run_mode, + gboolean diff_only); /* tag util functions*/ static gint parse_ms_tag (const gchar *str); @@ -113,16 +120,16 @@ query (void) { static GimpParamDef args[] = { - { GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" }, - { GIMP_PDB_IMAGE, "image", "Input image" }, - { GIMP_PDB_DRAWABLE, "drawable", "Input drawable (unused)" } + { GIMP_PDB_INT32, "run-mode", "Interactive, non-interactive" }, + { GIMP_PDB_IMAGE, "image", "Input image" }, + { GIMP_PDB_DRAWABLE, "drawable", "Input drawable (unused)" } }; static GimpParamDef return_args[] = { { GIMP_PDB_IMAGE, "result", "Resulting image" } }; - gimp_install_procedure ("plug_in_animationoptimize", + gimp_install_procedure (OPTIMIZE_PROC, "This procedure applies various optimizations to" " a GIMP layer-based animation in an attempt to" " reduce the final file size. If a frame of the" @@ -142,7 +149,7 @@ query (void) G_N_ELEMENTS (return_args), args, return_args); - gimp_install_procedure ("plug_in_animationoptimize_diff", + gimp_install_procedure (OPTIMIZE_DIFF_PROC, "This procedure applies various optimizations to" " a GIMP layer-based animation in an attempt to" " reduce the final file size. If a frame of the" @@ -160,7 +167,7 @@ query (void) G_N_ELEMENTS (return_args), args, return_args); - gimp_install_procedure ("plug_in_animationunoptimize", + gimp_install_procedure (UNOPTIMIZE_PROC, "This procedure 'simplifies' a GIMP layer-based" " animation that has been AnimationOptimized. This" " makes the animation much easier to work with if," @@ -177,15 +184,12 @@ query (void) G_N_ELEMENTS (return_args), args, return_args); - gimp_plugin_menu_register ("plug_in_animationoptimize", - "/Filters/Animation"); - gimp_plugin_menu_register ("plug_in_animationoptimize_diff", - "/Filters/Animation"); - gimp_plugin_menu_register ("plug_in_animationunoptimize", - "/Filters/Animation"); + gimp_plugin_menu_register (OPTIMIZE_PROC, "/Filters/Animation"); + gimp_plugin_menu_register (OPTIMIZE_DIFF_PROC, "/Filters/Animation"); + gimp_plugin_menu_register (UNOPTIMIZE_PROC, "/Filters/Animation"); #ifdef EXPERIMENTAL_BACKDROP_CODE - gimp_install_procedure ("plug_in_animation_remove_backdrop", + gimp_install_procedure (REMOVE_BACKDROP_PROC, "This procedure attempts to remove the backdrop" " from a GIMP layer-based animation, leaving" " the foreground animation over transparency.", @@ -200,7 +204,7 @@ query (void) G_N_ELEMENTS (return_args), args, return_args); - gimp_install_procedure ("plug_in_animation_find_backdrop", + gimp_install_procedure (FIND_BACKDROP_PROC, "This procedure attempts to remove the foreground" " from a GIMP layer-based animation, leaving" " a one-layered image containing only the" @@ -216,10 +220,8 @@ query (void) G_N_ELEMENTS (return_args), args, return_args); - gimp_plugin_menu_register ("plug_in_animation_remove_backdrop", - "/Filters/Animation"); - gimp_plugin_menu_register ("plug_in_animation_find_backdrop", - "/Filters/Animation"); + gimp_plugin_menu_register (REMOVE_BACKDROP_PROC, "/Filters/Animation"); + gimp_plugin_menu_register (FIND_BACKDROP_PROC, "/Filters/Animation"); #endif } @@ -232,11 +234,11 @@ run (const gchar *name, { static GimpParam values[2]; GimpRunMode run_mode; - GimpPDBStatusType status = GIMP_PDB_SUCCESS; + GimpPDBStatusType status = GIMP_PDB_SUCCESS; gboolean diff_only = FALSE; *nreturn_vals = 2; - *return_vals = values; + *return_vals = values; run_mode = param[0].data.d_int32; @@ -249,18 +251,18 @@ run (const gchar *name, /* Check the procedure name we were called with, to decide what needs to be done. */ - if (strcmp (name, "plug_in_animationoptimize") == 0) + if (strcmp (name, OPTIMIZE_PROC) == 0) opmode = OPOPTIMIZE; - else if (strcmp (name, "plug_in_animationoptimize_diff") == 0) + else if (strcmp (name, OPTIMIZE_DIFF_PROC) == 0) { opmode = OPOPTIMIZE; diff_only = TRUE; } - else if (strcmp (name, "plug_in_animationunoptimize") == 0) + else if (strcmp (name, UNOPTIMIZE_PROC) == 0) opmode = OPUNOPTIMIZE; - else if (strcmp (name, "plug_in_animation_find_backdrop") == 0) + else if (strcmp (name, FIND_BACKDROP_PROC) == 0) opmode = OPBACKGROUND; - else if (strcmp (name, "plug_in_animation_remove_backdrop") == 0) + else if (strcmp (name, REMOVE_BACKDROP_PROC) == 0) opmode = OPFOREGROUND; else g_error("GAH!!!"); @@ -275,10 +277,10 @@ run (const gchar *name, gimp_displays_flush(); } - values[0].type = GIMP_PDB_STATUS; + values[0].type = GIMP_PDB_STATUS; values[0].data.d_status = status; - values[1].type = GIMP_PDB_IMAGE; + values[1].type = GIMP_PDB_IMAGE; values[1].data.d_image = new_image_id; } diff --git a/plug-ins/common/pnm.c b/plug-ins/common/pnm.c index f22d589981..d06dd4b522 100644 --- a/plug-ins/common/pnm.c +++ b/plug-ins/common/pnm.c @@ -56,6 +56,14 @@ #define _O_BINARY 0 #endif + +#define LOAD_PROC "file-pnm-load" +#define PNM_SAVE_PROC "file-pnm-save" +#define PGM_SAVE_PROC "file-pgm-save" +#define PPM_SAVE_PROC "file-ppm-save" +#define PLUG_IN_BINARY "pnm" + + /* Declare local data types */ @@ -203,9 +211,9 @@ query (void) { static GimpParamDef load_args[] = { - { GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" }, - { GIMP_PDB_STRING, "filename", "The name of the file to load" }, - { GIMP_PDB_STRING, "raw_filename", "The name of the file to load" } + { GIMP_PDB_INT32, "run-mode", "Interactive, non-interactive" }, + { GIMP_PDB_STRING, "filename", "The name of the file to load" }, + { GIMP_PDB_STRING, "raw-filename", "The name of the file to load" } }; static GimpParamDef load_return_vals[] = { @@ -214,15 +222,15 @@ query (void) static GimpParamDef save_args[] = { - { GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" }, - { GIMP_PDB_IMAGE, "image", "Input image" }, - { GIMP_PDB_DRAWABLE, "drawable", "Drawable to save" }, + { GIMP_PDB_INT32, "run-mode", "Interactive, non-interactive" }, + { GIMP_PDB_IMAGE, "image", "Input image" }, + { GIMP_PDB_DRAWABLE, "drawable", "Drawable to save" }, { GIMP_PDB_STRING, "filename", "The name of the file to save the image in" }, - { GIMP_PDB_STRING, "raw_filename", "The name of the file to save the image in" }, + { GIMP_PDB_STRING, "raw-filename", "The name of the file to save the image in" }, { GIMP_PDB_INT32, "raw", "Specify non-zero for raw output, zero for ascii output" } }; - gimp_install_procedure ("file_pnm_load", + gimp_install_procedure (LOAD_PROC, "loads files of the pnm file format", "FIXME: write help for pnm_load", "Erik Nygren", @@ -235,14 +243,14 @@ query (void) G_N_ELEMENTS (load_return_vals), load_args, load_return_vals); - gimp_register_file_handler_mime ("file_pnm_load", "image/x-portable-anymap"); - gimp_register_magic_load_handler ("file_pnm_load", + gimp_register_file_handler_mime (LOAD_PROC, "image/x-portable-anymap"); + gimp_register_magic_load_handler (LOAD_PROC, "pnm,ppm,pgm,pbm", "", "0,string,P1,0,string,P2,0,string,P3,0," "string,P4,0,string,P5,0,string,P6"); - gimp_install_procedure ("file_pnm_save", + gimp_install_procedure (PNM_SAVE_PROC, "saves files in the pnm file format", "PNM saving handles all image types without transparency.", "Erik Nygren", @@ -254,7 +262,7 @@ query (void) G_N_ELEMENTS (save_args), 0, save_args, NULL); - gimp_install_procedure ("file_pgm_save", + gimp_install_procedure (PGM_SAVE_PROC, "saves files in the pnm file format", "PGM saving produces grayscale images without transparency.", "Erik Nygren", @@ -266,7 +274,7 @@ query (void) G_N_ELEMENTS (save_args), 0, save_args, NULL); - gimp_install_procedure ("file_ppm_save", + gimp_install_procedure (PPM_SAVE_PROC, "saves files in the pnm file format", "PPM saving handles RGB images without transparency.", "Erik Nygren", @@ -278,10 +286,10 @@ query (void) G_N_ELEMENTS (save_args), 0, save_args, NULL); - gimp_register_file_handler_mime ("file_pgm_save", "image/x-portable-graymap"); - gimp_register_file_handler_mime ("file_ppm_save", "image/x-portable-pixmap"); - gimp_register_save_handler ("file_pgm_save", "pgm", ""); - gimp_register_save_handler ("file_ppm_save", "ppm", ""); + gimp_register_file_handler_mime (PGM_SAVE_PROC, "image/x-portable-graymap"); + gimp_register_file_handler_mime (PPM_SAVE_PROC, "image/x-portable-pixmap"); + gimp_register_save_handler (PGM_SAVE_PROC, "pgm", ""); + gimp_register_save_handler (PPM_SAVE_PROC, "ppm", ""); } static void @@ -307,7 +315,7 @@ run (const gchar *name, INIT_I18N (); - if (strcmp (name, "file_pnm_load") == 0) + if (strcmp (name, LOAD_PROC) == 0) { image_ID = load_image (param[1].data.d_string); @@ -322,25 +330,25 @@ run (const gchar *name, status = GIMP_PDB_EXECUTION_ERROR; } } - else if (strcmp (name, "file_pnm_save") == 0 - || strcmp (name, "file_pgm_save") == 0 - || strcmp (name, "file_ppm_save") == 0 ) + else if (strcmp (name, PNM_SAVE_PROC) == 0 || + strcmp (name, PGM_SAVE_PROC) == 0 || + strcmp (name, PPM_SAVE_PROC) == 0) { - image_ID = param[1].data.d_int32; - drawable_ID = param[2].data.d_int32; + image_ID = param[1].data.d_int32; + drawable_ID = param[2].data.d_int32; /* eventually export the image */ switch (run_mode) { case GIMP_RUN_INTERACTIVE: case GIMP_RUN_WITH_LAST_VALS: - gimp_ui_init ("pnm", FALSE); - if (strcmp (name, "file_pnm_save") == 0) + gimp_ui_init (PLUG_IN_BINARY, FALSE); + if (strcmp (name, PNM_SAVE_PROC) == 0) export = gimp_export_image (&image_ID, &drawable_ID, "PNM", (GIMP_EXPORT_CAN_HANDLE_RGB | GIMP_EXPORT_CAN_HANDLE_GRAY | GIMP_EXPORT_CAN_HANDLE_INDEXED)); - else if (strcmp (name, "file_pgm_save") == 0) + else if (strcmp (name, PGM_SAVE_PROC) == 0) export = gimp_export_image (&image_ID, &drawable_ID, "PGM", (GIMP_EXPORT_CAN_HANDLE_GRAY)); else @@ -416,15 +424,15 @@ run (const gchar *name, static gint32 load_image (const gchar *filename) { - GimpPixelRgn pixel_rgn; + GimpPixelRgn pixel_rgn; gint32 volatile image_ID = -1; - gint32 layer_ID; - GimpDrawable *drawable; - int fd; /* File descriptor */ - char buf[BUFLEN]; /* buffer for random things like scanning */ - PNMInfo *pnminfo; + gint32 layer_ID; + GimpDrawable *drawable; + int fd; /* File descriptor */ + char buf[BUFLEN]; /* buffer for random things like scanning */ + PNMInfo *pnminfo; PNMScanner * volatile scan; - int ctr; + int ctr; /* open the file */ fd = g_open (filename, O_RDONLY | _O_BINARY, 0); @@ -457,8 +465,8 @@ load_image (const gchar *filename) return -1; } - if (!(scan = pnmscanner_create(fd))) - longjmp(pnminfo->jmpbuf,1); + if (!(scan = pnmscanner_create (fd))) + longjmp (pnminfo->jmpbuf, 1); /* Get magic number */ pnmscanner_gettoken (scan, buf, BUFLEN); @@ -476,6 +484,7 @@ load_image (const gchar *filename) pnminfo->maxval = pnm_types[ctr].maxval; pnminfo->loader = pnm_types[ctr].loader; } + if (!pnminfo->loader) { g_message (_("File not in a supported format.")); @@ -544,9 +553,9 @@ load_image (const gchar *filename) } static void -pnm_load_ascii (PNMScanner *scan, - PNMInfo *info, - GimpPixelRgn *pixel_rgn) +pnm_load_ascii (PNMScanner *scan, + PNMInfo *info, + GimpPixelRgn *pixel_rgn) { unsigned char *data, *d; int x, y, i, b; @@ -606,9 +615,9 @@ pnm_load_ascii (PNMScanner *scan, } static void -pnm_load_raw (PNMScanner *scan, - PNMInfo *info, - GimpPixelRgn *pixel_rgn) +pnm_load_raw (PNMScanner *scan, + PNMInfo *info, + GimpPixelRgn *pixel_rgn) { guchar *data, *d; gint x, y, i; @@ -654,9 +663,9 @@ pnm_load_raw (PNMScanner *scan, } static void -pnm_load_rawpbm (PNMScanner *scan, - PNMInfo *info, - GimpPixelRgn *pixel_rgn) +pnm_load_rawpbm (PNMScanner *scan, + PNMInfo *info, + GimpPixelRgn *pixel_rgn) { unsigned char *buf; unsigned char curbyte; @@ -772,23 +781,23 @@ save_image (const gchar *filename, gint32 image_ID, gint32 drawable_ID) { - GimpPixelRgn pixel_rgn; - GimpDrawable *drawable; - GimpImageType drawable_type; - PNMRowInfo rowinfo; + GimpPixelRgn pixel_rgn; + GimpDrawable *drawable; + GimpImageType drawable_type; + PNMRowInfo rowinfo; void (*saverow) (PNMRowInfo *, unsigned char *) = NULL; - unsigned char red[256]; - unsigned char grn[256]; - unsigned char blu[256]; + unsigned char red[256]; + unsigned char grn[256]; + unsigned char blu[256]; unsigned char *data, *d; - char *rowbuf; - char buf[BUFLEN]; - char *temp; - int np = 0; - int xres, yres; - int ypos, yend; - int rowbufsize = 0; - int fd; + char *rowbuf; + char buf[BUFLEN]; + char *temp; + int np = 0; + int xres, yres; + int ypos, yend; + int rowbufsize = 0; + int fd; drawable = gimp_drawable_get (drawable_ID); drawable_type = gimp_drawable_type (drawable_ID); @@ -947,19 +956,19 @@ save_dialog (void) GtkWidget *frame; gboolean run; - dlg = gimp_dialog_new (_("Save as PNM"), "pnm", + dlg = gimp_dialog_new (_("Save as PNM"), PLUG_IN_BINARY, NULL, 0, - gimp_standard_help_func, "file-pnm-save", + gimp_standard_help_func, PNM_SAVE_PROC, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OK, GTK_RESPONSE_OK, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OK, GTK_RESPONSE_OK, - NULL); + NULL); gtk_dialog_set_alternative_button_order (GTK_DIALOG (dlg), - GTK_RESPONSE_OK, - GTK_RESPONSE_CANCEL, - -1); + GTK_RESPONSE_OK, + GTK_RESPONSE_CANCEL, + -1); /* file save type */ frame = gimp_int_radio_group_new (TRUE, _("Data formatting"), diff --git a/plug-ins/metadata/Makefile.am b/plug-ins/metadata/Makefile.am index 833c51da02..c9fad1de95 100644 --- a/plug-ins/metadata/Makefile.am +++ b/plug-ins/metadata/Makefile.am @@ -18,6 +18,7 @@ libexec_PROGRAMS = metadata metadata_SOURCES = \ metadata.c \ + metadata.h \ interface.h \ interface.c \ base64.h \ diff --git a/plug-ins/metadata/interface.c b/plug-ins/metadata/interface.c index 28088adaf5..7097b7aa09 100644 --- a/plug-ins/metadata/interface.c +++ b/plug-ins/metadata/interface.c @@ -50,6 +50,7 @@ #include "libgimp/stdplugins-intl.h" #include "interface.h" +#include "metadata.h" #include "xmp-schemas.h" #include "xmp-encode.h" @@ -656,11 +657,11 @@ metadata_dialog (gint32 image_ID, MetadataGui mgui; GtkWidget *notebook; - gimp_ui_init ("metadata", FALSE); + gimp_ui_init (PLUG_IN_BINARY, FALSE); - mgui.dlg = gimp_dialog_new (_("Image Properties"), "metadata", + mgui.dlg = gimp_dialog_new (_("Image Properties"), PLUG_IN_BINARY, NULL, 0, - gimp_standard_help_func, "plug-in-metadata", + gimp_standard_help_func, EDITOR_PROC, _("_Import XMP"), RESPONSE_IMPORT, _("_Export XMP"), RESPONSE_EXPORT, diff --git a/plug-ins/metadata/metadata.c b/plug-ins/metadata/metadata.c index 88fb22af65..b332c99710 100644 --- a/plug-ins/metadata/metadata.c +++ b/plug-ins/metadata/metadata.c @@ -30,6 +30,7 @@ #include "libgimp/stdplugins-intl.h" #include "interface.h" +#include "metadata.h" #include "xmp-encode.h" /* FIXME: uncomment when these are working #include "exif-decode.h" @@ -37,12 +38,11 @@ #include "iptc-decode.h" */ + #define METADATA_PARASITE "gimp-metadata" #define METADATA_MARKER "GIMP_XMP_1" #define METADATA_MARKER_LEN (sizeof (METADATA_MARKER) - 1) -#define HELP_ID "plug-in-metadata" - /* prototypes of local functions */ static void query (void); @@ -69,7 +69,7 @@ query (void) { static GimpParamDef editor_args[] = { - { GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" }, + { GIMP_PDB_INT32, "run-mode", "Interactive, non-interactive" }, { GIMP_PDB_IMAGE, "image", "Input image" }, { GIMP_PDB_DRAWABLE, "drawable", "Input drawable (unused)" } }; @@ -93,7 +93,7 @@ query (void) static GimpParamDef decode_exif_args[] = { { GIMP_PDB_IMAGE, "image", "Input image" }, - { GIMP_PDB_INT32, "exif_size", "size of the EXIF block" }, + { GIMP_PDB_INT32, "exif-size", "size of the EXIF block" }, { GIMP_PDB_INT8ARRAY, "exif", "EXIF block" } }; @@ -103,7 +103,7 @@ query (void) }; static GimpParamDef encode_exif_return_vals[] = { - { GIMP_PDB_INT32, "exif_size", "size of the EXIF block" }, + { GIMP_PDB_INT32, "exif-size", "size of the EXIF block" }, { GIMP_PDB_INT8ARRAY, "exif", "EXIF block" } }; */ @@ -117,7 +117,7 @@ query (void) static GimpParamDef get_return_vals[] = { { GIMP_PDB_INT32, "type", "XMP property type" }, - { GIMP_PDB_INT32, "num_vals", "number of values" }, + { GIMP_PDB_INT32, "num-vals", "number of values" }, { GIMP_PDB_STRINGARRAY, "vals", "XMP property values" } }; @@ -127,7 +127,7 @@ query (void) { GIMP_PDB_STRING, "schema", "XMP schema prefix or URI" }, { GIMP_PDB_STRING, "property", "XMP property name" }, { GIMP_PDB_INT32, "type", "XMP property type" }, - { GIMP_PDB_INT32, "num_vals", "number of values" }, + { GIMP_PDB_INT32, "num-vals", "number of values" }, { GIMP_PDB_STRINGARRAY, "vals", "XMP property values" } }; @@ -168,7 +168,7 @@ query (void) static GimpParamDef import_args[] = { - { GIMP_PDB_IMAGE, "image", "Input image" }, + { GIMP_PDB_IMAGE, "image", "Input image" }, { GIMP_PDB_STRING, "filename", "The name of the XMP file to import" } }; @@ -179,7 +179,7 @@ query (void) { GIMP_PDB_INT32, "overwrite", "Overwrite existing file: { FALSE (0), TRUE (1) }" } }; - gimp_install_procedure ("plug_in_metadata_editor", + gimp_install_procedure (EDITOR_PROC, "View and edit metadata (EXIF, IPTC, XMP)", "View and edit metadata information attached to the " "current image. This can include EXIF, IPTC and/or " @@ -194,12 +194,13 @@ query (void) GIMP_PLUGIN, G_N_ELEMENTS (editor_args), 0, editor_args, NULL); - gimp_plugin_menu_register ("plug_in_metadata_editor", "/File/Info"); - gimp_plugin_icon_register ("plug_in_metadata_editor", + + gimp_plugin_menu_register (EDITOR_PROC, "/File/Info"); + gimp_plugin_icon_register (EDITOR_PROC, GIMP_ICON_TYPE_STOCK_ID, GTK_STOCK_PROPERTIES); /* FIXME: The GNOME HIG recommends using the accel Alt+Return for this */ - gimp_install_procedure ("plug_in_metadata_decode_xmp", + gimp_install_procedure (DECODE_XMP_PROC, "Decode an XMP packet", "Parse an XMP packet and merge the results with " "any metadata already attached to the image. This " @@ -214,7 +215,7 @@ query (void) G_N_ELEMENTS (decode_xmp_args), 0, decode_xmp_args, NULL); - gimp_install_procedure ("plug_in_metadata_encode_xmp", + gimp_install_procedure (ENCODE_XMP_PROC, "Encode metadata into an XMP packet", "Generate an XMP packet from the metadata " "information attached to the image. The new XMP " @@ -230,7 +231,7 @@ query (void) encode_xmp_args, encode_xmp_return_vals); /* FIXME: uncomment when these are working - gimp_install_procedure ("plug_in_metadata_decode_exif", + gimp_install_procedure (DECODE_EXIF_PROC, "Decode an EXIF block", "Parse an EXIF block and merge the results with " "any metadata already attached to the image. This " @@ -245,7 +246,7 @@ query (void) G_N_ELEMENTS (decode_exif_args), 0, decode_exif_args, NULL); - gimp_install_procedure ("plug_in_metadata_encode_exif", + gimp_install_procedure (ENCODE_EXIF_PROC, "Encode metadata into an EXIF block", "Generate an EXIF block from the metadata " "information attached to the image. The new EXIF " @@ -261,7 +262,7 @@ query (void) encode_exif_args, encode_exif_return_vals); */ - gimp_install_procedure ("plug_in_metadata_get", + gimp_install_procedure (GET_PROC, "Retrieve the values of an XMP property", "Retrieve the list of values associated with " "an XMP property.", @@ -275,7 +276,7 @@ query (void) G_N_ELEMENTS (get_return_vals), get_args, get_return_vals); - gimp_install_procedure ("plug_in_metadata_set", + gimp_install_procedure (SET_PROC, "Set the values of an XMP property", "Set the list of values associated with " "an XMP property. If a property with the same " @@ -289,7 +290,7 @@ query (void) G_N_ELEMENTS (set_args), 0, set_args, NULL); - gimp_install_procedure ("plug_in_metadata_get_simple", + gimp_install_procedure (GET_SIMPLE_PROC, "Retrieve the value of an XMP property", "Retrieve value associated with a scalar XMP " "property. This can only be done for simple " @@ -306,7 +307,7 @@ query (void) G_N_ELEMENTS (get_simple_return_vals), get_simple_args, get_simple_return_vals); - gimp_install_procedure ("plug_in_metadata_set_simple", + gimp_install_procedure (SET_SIMPLE_PROC, "Set the value of an XMP property", "Set the value of a scalar XMP property. This " "can only be done for simple property types such " @@ -321,7 +322,7 @@ query (void) G_N_ELEMENTS (set_simple_args), 0, set_simple_args, NULL); - gimp_install_procedure ("plug_in_metadata_import", + gimp_install_procedure (IMPORT_PROC, "Import XMP from a file into the current image", "Load an XMP packet from a file and import it into " "the current image. This can be used to add a " @@ -336,7 +337,7 @@ query (void) G_N_ELEMENTS (import_args), 0, import_args, NULL); - gimp_install_procedure ("plug_in_metadata_export", + gimp_install_procedure (EXPORT_PROC, "Export XMP from the current image to a file", "Export the metadata associated with the current " "image into a file. The metadata will be saved as " @@ -375,7 +376,7 @@ run (const gchar *name, INIT_I18N(); - if (! strcmp (name, "plug_in_metadata_editor")) + if (! strcmp (name, EDITOR_PROC)) image_ID = param[1].data.d_image; else image_ID = param[0].data.d_image; @@ -410,7 +411,7 @@ run (const gchar *name, * thing when loading their files. */ if (xmp_model_is_empty (xmp_model) - && !! strcmp (name, "plug_in_metadata_decode_xmp")) + && !! strcmp (name, DECODE_XMP_PROC)) { const gchar *filename; GError *error = NULL; @@ -422,7 +423,7 @@ run (const gchar *name, } /* Now check what we are supposed to do */ - if (! strcmp (name, "plug_in_metadata_editor")) + if (! strcmp (name, EDITOR_PROC)) { GimpRunMode run_mode; @@ -434,7 +435,7 @@ run (const gchar *name, status = GIMP_PDB_CANCEL; } } - else if (! strcmp (name, "plug_in_metadata_decode_xmp")) + else if (! strcmp (name, DECODE_XMP_PROC)) { const gchar *buffer; GError *error = NULL; @@ -444,21 +445,21 @@ run (const gchar *name, FALSE, &error)) status = GIMP_PDB_EXECUTION_ERROR; } - else if (! strcmp (name, "plug_in_metadata_encode_xmp")) + else if (! strcmp (name, ENCODE_XMP_PROC)) { /* done below together with the parasite */ } - else if (! strcmp (name, "plug_in_metadata_get")) + else if (! strcmp (name, GET_PROC)) { g_warning ("Not implemented yet\n"); /* FIXME */ status = GIMP_PDB_EXECUTION_ERROR; } - else if (! strcmp (name, "plug_in_metadata_set")) + else if (! strcmp (name, SET_PROC)) { g_warning ("Not implemented yet\n"); /* FIXME */ status = GIMP_PDB_EXECUTION_ERROR; } - else if (! strcmp (name, "plug_in_metadata_get_simple")) + else if (! strcmp (name, GET_SIMPLE_PROC)) { const gchar *schema_name; const gchar *property_name; @@ -477,7 +478,7 @@ run (const gchar *name, else status = GIMP_PDB_EXECUTION_ERROR; } - else if (! strcmp (name, "plug_in_metadata_set_simple")) + else if (! strcmp (name, SET_SIMPLE_PROC)) { const gchar *schema_name; const gchar *property_name; @@ -490,7 +491,7 @@ run (const gchar *name, property_name, property_value)) status = GIMP_PDB_EXECUTION_ERROR; } - else if (! strcmp (name, "plug_in_metadata_import")) + else if (! strcmp (name, IMPORT_PROC)) { const gchar *filename; gchar *buffer; @@ -511,7 +512,7 @@ run (const gchar *name, } g_free (buffer); } - else if (! strcmp (name, "plug_in_metadata_export")) + else if (! strcmp (name, EXPORT_PROC)) { /* FIXME: this is easy to implement, but the first thing to do is */ /* to improve the code of export_dialog_response() in interface.c */ @@ -535,7 +536,7 @@ run (const gchar *name, buffer->len, (gpointer) buffer->str); gimp_image_parasite_attach (image_ID, parasite); - if (! strcmp (name, "plug_in_metadata_encode_xmp")) + if (! strcmp (name, ENCODE_XMP_PROC)) { *nreturn_vals = 2; values[1].type = GIMP_PDB_STRING; diff --git a/plug-ins/metadata/metadata.h b/plug-ins/metadata/metadata.h new file mode 100644 index 0000000000..c696726e14 --- /dev/null +++ b/plug-ins/metadata/metadata.h @@ -0,0 +1,39 @@ +/* metadata.h - defines for the metadata editor + * + * Copyright (C) 2004-2005, Raphaƫl Quinet + * + * 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 __METADATA_H__ +#define __HATADATA_H__ + + +#define EDITOR_PROC "plug-in-metadata-editor" +#define DECODE_XMP_PROC "plug-in-metadata-decode-xmp" +#define ENCODE_XMP_PROC "plug-in-metadata-encode-xmp" +#define DECODE_EXIF_PROC "plug-in-metadata-decode-exif" +#define ENCODE_EXIF_PROC "plug-in-metadata-encode-exif" +#define GET_PROC "plug-in-metadata-get" +#define SET_PROC "plug-in-metadata-set" +#define GET_SIMPLE_PROC "plug-in-metadata-get-simple" +#define SET_SIMPLE_PROC "plug-in-metadata-set-simple" +#define IMPORT_PROC "plug-in-metadata-import" +#define EXPORT_PROC "plug-in-metadata-export" +#define PLUG_IN_BINARY "metadata" + + +#endif /* __METADATA_H__ */