Commit ce2822d5 authored by Michael Natterer's avatar Michael Natterer 😴

plug-ins: remove the old metadata plug-in

parent 21bed1e2
......@@ -2247,7 +2247,6 @@ plug-ins/lighting/Makefile
plug-ins/lighting/images/Makefile
plug-ins/map-object/Makefile
plug-ins/maze/Makefile
plug-ins/metadata/Makefile
plug-ins/pagecurl/Makefile
plug-ins/print/Makefile
plug-ins/pygimp/Makefile
......
/Makefile
/Makefile.in
/.deps
/.libs
/metadata
/metadata.exe
/testbase64
/testbase64.exe
/xmpdump
/xmpdump.exe
## Process this file with automake to produce Makefile.in
libgimpui = $(top_builddir)/libgimp/libgimpui-$(GIMP_API_VERSION).la
libgimpwidgets = $(top_builddir)/libgimpwidgets/libgimpwidgets-$(GIMP_API_VERSION).la
libgimp = $(top_builddir)/libgimp/libgimp-$(GIMP_API_VERSION).la
libgimpconfig = $(top_builddir)/libgimpconfig/libgimpconfig-$(GIMP_API_VERSION).la
libgimpcolor = $(top_builddir)/libgimpcolor/libgimpcolor-$(GIMP_API_VERSION).la
libgimpbase = $(top_builddir)/libgimpbase/libgimpbase-$(GIMP_API_VERSION).la
libgimpmath = $(top_builddir)/libgimpmath/libgimpmath-$(GIMP_API_VERSION).la
if OS_WIN32
mwindows = -mwindows
endif
if HAVE_WINDRES
include $(top_srcdir)/build/windows/gimprc-plug-ins.rule
metadata_RC = metadata.rc.o
endif
AM_LDFLAGS = $(mwindows)
libexecdir = $(gimpplugindir)/plug-ins
libexec_PROGRAMS = metadata
metadata_SOURCES = \
metadata.c \
metadata.h \
xmp-model.h \
xmp-model.c \
xmp-parse.h \
xmp-parse.c \
xmp-encode.h \
xmp-encode.c \
xmp-schemas.h \
xmp-schemas.c \
interface.h \
interface.c \
gimpxmpmodelwidget.h \
gimpxmpmodelwidget.c \
gimpxmpmodelentry.h \
gimpxmpmodelentry.c \
gimpxmpmodeltext.h \
gimpxmpmodeltext.c \
exif-decode.h \
exif-decode.c
# exif-encode.h \
# exif-encode.c \
# iptc-decode.h \
# iptc-decode.c
noinst_PROGRAMS = xmpdump
xmpdump_SOURCES = \
xmpdump.c \
xmp-schemas.h \
xmp-schemas.c \
xmp-encode.h \
xmp-encode.c \
xmp-model.h \
xmp-model.c \
xmp-parse.h \
xmp-parse.c
AM_CPPFLAGS = \
-I$(top_srcdir) \
$(GTK_CFLAGS) \
$(GEGL_CFLAGS) \
$(EXIF_CFLAGS) \
-I$(includedir)
LDADD = \
$(libgimpui) \
$(libgimpwidgets) \
$(libgimp) \
$(libgimpmath) \
$(libgimpconfig) \
$(libgimpcolor) \
$(libgimpbase) \
$(EXIF_LIBS) \
$(GTK_LIBS) \
$(RT_LIBS) \
$(INTLLIBS) \
$(metadata_RC)
What is this?
-------------
This is the beginning of an editor for metadata. It is far from
complete yet.
Current status
--------------
- It does not read metadata, except if there is an XMP block in the
image file.
- It does not write metadata, it can only export XMP into a separate
file.
- It does not edit metadata, except for some very limited editing of
basic scalar types (strings, integers, ...). It is currently not
possible to add new properties using the editor (but this can be
done via the PDB call plug_in_metadata_set_simple()).
- Basically, the current code is only useful for viewing some XMP
metadata if the image file contains an XMP block. The import/export
functions are also supposed to work. Import merges, so it is
possible for example to import a license file such as the XMP files
from Creative Commons in order to apply a license to an image.
- The metadata is saved in a persistent parasite that is overwritten
after each call. Caution: the editor should not be open while you
are trying to test some of the PDB calls, otherwise you would
discard all changes as soon as you press OK. This is a problem that
cannot be solved easily as long as the metadata editor is a plug-in.
How to find test images?
------------------------
The easiest way is to try a Google search for "<?xpacket". This is
the marker that is used at the beginning of XMP packets. Many images
or PDF files are incorrectly served as text/plain and therefore
indexed by Google as text files. By looking for XMP tags such as
"<?xpacket", it is possible to find a large number of files containing
XMP metadata.
Work in progress:
-----------------
- improve XMP code generation (xmp-gen.c) - currently, some structured
property types are not written back to the buffer, so the round-trip
decode/encode can silently discard some properties
- add tabs for easy editing of metadata, connect them to the tree
- fix the conversion to/from EXIF (exif-parse.c, exif-gen.c)
- register PDB functions correctly (for setting/getting metadata)
- update the JPEG plug-in
Near future:
- add custom callbacks for editing in the tree, validate entries, ...
- smarter display of rational values, closed sets, ...
- improve the layout of the various tabs
Not-so-near future:
- move some of this stuff into the core
-------------------------------------------------------------------------------
Files modified (2004-08-24):
configure.in (added /plug-ins/metadata/Makefile)
menus/image-menu.xml.in (added placeholder "<Image>/File/Info")
plug-ins/Makefile.am (added "metadata" in SUBDIRS)
plug-ins/common/jpeg.c (changed to get/set metadata through PDB)
New files:
plug-ins/metadata/Makefile.am (generates Makefile.in to get a Makefile)
plug-ins/metadata/metadata.c (main part: registers the plug-in, etc.)
plug-ins/metadata/interface.h
plug-ins/metadata/interface.c (user interface: widgets and callbacks)
plug-ins/metadata/xmp-model.h
plug-ins/metadata/xmp-model.c (model for the treeview, list of XMP schemas)
plug-ins/metadata/xmp-parse.h
plug-ins/metadata/xmp-parse.c (simple parser for XMP metadata)
plug-ins/metadata/xmp-gen.h
plug-ins/metadata/xmp-gen.c (generates XMP metadata from the tree model)
plug-ins/metadata/exif-parse.h
plug-ins/metadata/exif-parse.c (converts EXIF into the XMP tree model)
plug-ins/metadata/exif-gen.h
plug-ins/metadata/exif-gen.c (generates EXIF metadata from the tree model)
/* exif-decode.c - decodes exif data and converts it to XMP
*
* Copyright (C) 2004-2005, Róman Joost <romanofski@gimp.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <string.h>
#include <gtk/gtk.h>
#include <glib.h>
#include <libgimp/gimp.h>
#include <libexif/exif-data.h>
#include "xmp-schemas.h"
#include "xmp-model.h"
#include "exif-decode.h"
/* local function prototypes */
static void exif_foreach_content_cb (ExifContent *content,
XMPModel *xmp_model);
static void exif_foreach_entry_cb (ExifEntry *entry,
XMPModel *xmp_model);
/* public functions */
/**
* xmp_merge_from_exifbuffer:
* @xmp_model: pointer to the #XMPModel in which the results will be stored
* @image_ID: id of the image where the exif data parasite is attached to
* @error: return location for a #GErrror
*
* Load the Exif data, which is attached to the image as a parasite. The
* parsed Exif data is merged into the XMP model.
*
* Return value: %TRUE on success, %FALSE if an error occurred during
* reading/writing
*
**/
gboolean
xmp_merge_from_exifbuffer (XMPModel *xmp_model,
gint32 image_ID,
GError **error)
{
ExifData *exif_data;
GimpParasite *parasite = gimp_image_get_parasite (image_ID, "exif-data");
if (!parasite)
return FALSE;
exif_data = exif_data_new_from_data (gimp_parasite_data (parasite),
gimp_parasite_data_size (parasite));
if (exif_data) {
exif_data_foreach_content (exif_data,
(void *) exif_foreach_content_cb,
xmp_model);
} else {
return FALSE;
}
return TRUE;
}
/* private functions */
static void
exif_foreach_content_cb (ExifContent *content,
XMPModel *xmp_model)
{
exif_content_foreach_entry (content,
(void *) exif_foreach_entry_cb,
xmp_model);
}
static void
exif_foreach_entry_cb (ExifEntry *entry,
XMPModel *xmp_model)
{
char value[1024];
xmp_model_set_scalar_property (xmp_model,
XMP_SCHEMA_EXIF,
exif_tag_get_name (entry->tag),
exif_entry_get_value (entry, value, sizeof (value)));
}
/* exif-decode.h - decode exif data and convert it to XMP
*
* Copyright (C) 2008, Róman Joost <romanofski@gimp.org>
*
* 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 EXIF_DECODE_H
#define EXIF_DECODE_H
G_BEGIN_DECLS
gboolean xmp_merge_from_exifbuffer (XMPModel *xmp_model,
gint32 image_ID,
GError **error);
G_END_DECLS
#endif /* EXIF_DECODE_H */
/* gimpxmpmodelentry.c - custom entry widget linked to the xmp model
*
* Copyright (C) 2009, Róman Joost <romanofski@gimp.org>
*
* 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 3 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, see
* <http://www.gnu.org/licenses/>.
*/
#include <string.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
#include "xmp-schemas.h"
#include "xmp-model.h"
#include "gimpxmpmodelwidget.h"
#include "gimpxmpmodelentry.h"
static void gimp_xmp_model_entry_iface_init (GimpXmpModelWidgetInterface *iface);
static void gimp_xmp_model_entry_constructed (GObject *object);
static void gimp_xmp_model_entry_set_text (GimpXmpModelWidget *widget,
const gchar *tree_value);
static void gimp_xmp_model_entry_changed (GimpXmpModelEntry *entry);
G_DEFINE_TYPE_WITH_CODE (GimpXmpModelEntry, gimp_xmp_model_entry,
GTK_TYPE_ENTRY,
G_IMPLEMENT_INTERFACE (GIMP_TYPE_XMP_MODEL_WIDGET,
gimp_xmp_model_entry_iface_init))
#define parent_class gimp_xmp_model_entry_parent_class
static void
gimp_xmp_model_entry_class_init (GimpXmpModelEntryClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->constructed = gimp_xmp_model_entry_constructed;
object_class->set_property = gimp_xmp_model_widget_set_property;
object_class->get_property = gimp_xmp_model_widget_get_property;
gimp_xmp_model_widget_install_properties (object_class);
}
static void
gimp_xmp_model_entry_iface_init (GimpXmpModelWidgetInterface *iface)
{
iface->widget_set_text = gimp_xmp_model_entry_set_text;
}
static void
gimp_xmp_model_entry_init (GimpXmpModelEntry *entry)
{
g_signal_connect (entry, "changed",
G_CALLBACK (gimp_xmp_model_entry_changed),
NULL);
}
static void
gimp_xmp_model_entry_constructed (GObject *object)
{
G_OBJECT_CLASS (parent_class)->constructed (object);
gimp_xmp_model_widget_constructor (object);
}
static void
gimp_xmp_model_entry_set_text (GimpXmpModelWidget *widget,
const gchar *tree_value)
{
gtk_entry_set_text (GTK_ENTRY (widget), tree_value);
}
static void
gimp_xmp_model_entry_changed (GimpXmpModelEntry *entry)
{
const gchar *value = gtk_entry_get_text (GTK_ENTRY (entry));
gimp_xmp_model_widget_changed (GIMP_XMP_MODEL_WIDGET (entry), value);
}
/* GimpXmpModelEntry.h - custom entry widget linked to the xmp model
*
* Copyright (C) 2009, Róman Joost <romanofski@gimp.org>
*
* 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 3 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, see
* <http://www.gnu.org/licenses/>.
*/
#ifndef __GIMP_XMP_MODEL_ENTRY_H__
#define __GIMP_XMP_MODEL_ENTRY_H__
G_BEGIN_DECLS
#define GIMP_TYPE_XMP_MODEL_ENTRY (gimp_xmp_model_entry_get_type ())
#define GIMP_XMP_MODEL_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_XMP_MODEL_ENTRY, GimpXmpModelEntry))
#define GIMP_XMP_MODEL_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_XMP_MODEL_ENTRY, XMPModelClass))
#define GIMP_IS_XMP_MODEL_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_XMP_MODEL_ENTRY))
#define GIMP_IS_XMP_MODEL_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_XMP_MODEL_ENTRY))
#define GIMP_XMP_MODEL_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_XMP_MODEL_ENTRY, XMPModelClass))
typedef struct _GimpXmpModelEntry GimpXmpModelEntry;
typedef struct _GimpXmpModelEntryClass GimpXmpModelEntryClass;
struct _GimpXmpModelEntryClass
{
GtkEntryClass parent_class;
void (*gimp_xmp_model_set_text) (GimpXmpModelEntry *entry,
const gchar *value);
const gchar * (*gimp_xmp_model_get_text) (GimpXmpModelEntry *entry);
};
struct _GimpXmpModelEntry
{
GtkEntry parent_instance;
gpointer priv;
};
GType gimp_xmp_model_entry_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_xmp_model_entry_new (const gchar *schema_uri,
const gchar *property,
XMPModel *xmp_model);
void gimp_xmp_model_set_text (GimpXmpModelEntry *entry,
const gchar *value);
const gchar * gimp_xmp_model_get_text (GimpXmpModelEntry *entry);
G_END_DECLS
#endif /* __GIMP_XMP_MODEL_ENTRY_H__ */
/* gimpxmpmodeltext.c - custom text widget linked to the xmp model
*
* Copyright (C) 2010, Róman Joost <romanofski@gimp.org>
*
* 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 3 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, see
* <http://www.gnu.org/licenses/>.
*/
#include <string.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
#include "xmp-schemas.h"
#include "xmp-model.h"
#include "gimpxmpmodelwidget.h"
#include "gimpxmpmodeltext.h"
static void gimp_xmp_model_text_iface_init (GimpXmpModelWidgetInterface *iface);
static void gimp_xmp_model_text_constructed (GObject *object);
static void gimp_xmp_model_text_changed (GtkTextBuffer *text_buffer,
gpointer *user_data);
void gimp_xmp_model_text_set_text (GimpXmpModelWidget *widget,
const gchar *tree_value);
G_DEFINE_TYPE_WITH_CODE (GimpXmpModelText, gimp_xmp_model_text,
GTK_TYPE_TEXT_VIEW,
G_IMPLEMENT_INTERFACE (GIMP_TYPE_XMP_MODEL_WIDGET,
gimp_xmp_model_text_iface_init))
#define parent_class gimp_xmp_model_text_parent_class
static void
gimp_xmp_model_text_class_init (GimpXmpModelTextClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->constructed = gimp_xmp_model_text_constructed;
object_class->set_property = gimp_xmp_model_widget_set_property;
object_class->get_property = gimp_xmp_model_widget_get_property;
gimp_xmp_model_widget_install_properties (object_class);
}
static void
gimp_xmp_model_text_iface_init (GimpXmpModelWidgetInterface *iface)
{
iface->widget_set_text = gimp_xmp_model_text_set_text;
}
static void
gimp_xmp_model_text_init (GimpXmpModelText *text)
{
GtkTextBuffer *text_buffer;
text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text));
g_signal_connect (text_buffer, "end-user-action",
G_CALLBACK (gimp_xmp_model_text_changed),
text);
}
static void
gimp_xmp_model_text_constructed (GObject *object)
{
G_OBJECT_CLASS (parent_class)->constructed (object);
gimp_xmp_model_widget_constructor (object);
}
static void
gimp_xmp_model_text_changed (GtkTextBuffer *text_buffer,
gpointer *user_data)
{
GimpXmpModelText *text = GIMP_XMP_MODEL_TEXT (user_data);
GtkTextIter start;
GtkTextIter end;
const gchar *value;
gtk_text_buffer_get_bounds (text_buffer, &start, &end);
value = gtk_text_buffer_get_text (text_buffer, &start, &end, FALSE);
gimp_xmp_model_widget_changed (GIMP_XMP_MODEL_WIDGET (text), value);
}
void
gimp_xmp_model_text_set_text (GimpXmpModelWidget *widget,
const gchar *tree_value)
{
GtkTextBuffer *text_buffer;
text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget));
gtk_text_buffer_set_text (text_buffer, tree_value, -1);
}
/* GimpXmpModelText.h - custom text widget linked to the xmp model
*
* Copyright (C) 2010, Róman Joost <romanofski@gimp.org>
*
* 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 3 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, see
* <http://www.gnu.org/licenses/>.
*/
#ifndef __GIMP_XMP_MODEL_TEXT_H__
#define __GIMP_XMP_MODEL_TEXT_H__
G_BEGIN_DECLS
#define GIMP_TYPE_XMP_MODEL_TEXT (gimp_xmp_model_text_get_type ())
#define GIMP_XMP_MODEL_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_XMP_MODEL_TEXT, GimpXmpModelText))
#define GIMP_XMP_MODEL_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_XMP_MODEL_TEXT, XMPModelClass))
#define GIMP_IS_XMP_MODEL_TEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_XMP_MODEL_TEXT))
#define GIMP_IS_XMP_MODEL_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_XMP_MODEL_TEXT))
#define GIMP_XMP_MODEL_TEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_XMP_MODEL_TEXT, XMPModelClass))
typedef struct _GimpXmpModelText GimpXmpModelText;
typedef struct _GimpXmpModelTextClass GimpXmpModelTextClass;
struct _GimpXmpModelTextClass
{
GtkTextViewClass parent_class;
void (*gimp_xmp_model_set_text_text) (GimpXmpModelText *text,
const gchar *value);
const gchar * (*gimp_xmp_model_get_text_text) (GimpXmpModelText *text);
};
struct _GimpXmpModelText
{
GtkTextView parent_instance;
gpointer priv;
};
GType gimp_xmp_model_text_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_xmp_model_text_new (const gchar *schema_uri,