[Gimp-developer] Problem with creating/compiling XMPModel which inherits from GObject
Hi, I thought it would be handy, if my XMPModel which stores the XMP metadata could emit it's own signals if properties or schemas change. The model now inherits from GObject and but most of the data structure is unchanged: struct _XMPModel { GObject parent_instance; GtkTreeStore *treestore; GSList *custom_schemas; GSList *custom_properties; XMPSchema*cached_schema; GtkTreeIter cached_schema_iter; }; My problem now is, that: 1. to get it some sort to compile is to include header files in my xmp-model.h header file (gtk.h, glib-object.h, xmp-schemas.h) and I don't know why. 2. which actually prevents me from working on that more is the following error: In file included from /usr/include/glib-2.0/glib/gmacros.h:40, from /usr/lib/glib-2.0/include/glibconfig.h:9, from /usr/include/glib-2.0/glib/gtypes.h:34, from /usr/include/glib-2.0/glib/galloca.h:34, from /usr/include/glib-2.0/glib.h:32, from /usr/include/glib-2.0/gobject/gtype.h:26, from /usr/include/glib-2.0/gobject/gboxed.h:26, from /usr/include/glib-2.0/glib-object.h:25, from /usr/include/glib-2.0/gio/gioenums.h:30, from /usr/include/glib-2.0/gio/giotypes.h:30, from /usr/include/glib-2.0/gio/gio.h:28, from /usr/include/gtk-2.0/gdk/gdkapplaunchcontext.h:30, from /usr/include/gtk-2.0/gdk/gdk.h:32, from /usr/include/gtk-2.0/gtk/gtk.h:32, from xmp-model.h:25, from xmp-schemas.c:21: /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stddef.h:152: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘typedef’ I'm just wondering what I'm doing wrong here. If there is more code needed, I could probably attach it to a bug or put it on the net somewhere. Am I mixing some fundamentals of Gtk and GObject programming here? Cheers, -- Roman Joost www: http://www.romanofski.de email: romanof...@gimp.org signature.asc Description: Digital signature ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
Re: [Gimp-developer] Problem with creating/compiling XMPModel which inherits from GObject
On Thu, Jul 16, 2009 at 04:26:41PM +1000, Roman Joost wrote: Hi, I thought it would be handy, if my XMPModel which stores the XMP metadata could emit it's own signals if properties or schemas change. The model now inherits from GObject and but most of the data structure is unchanged: [...] I'm just wondering what I'm doing wrong here. If there is more code needed, I could probably attach it to a bug or put it on the net somewhere. Just in case someone needs to look at the patch: http://amy.gocept.com/~roman/0001-WIP-XMPModel-object-with-custom-signals.patch Cheers, -- Roman Joost www: http://www.romanofski.de email: romanof...@gimp.org signature.asc Description: Digital signature ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
Re: [Gimp-developer] Switch language via menu
On 07/16/2009 03:44 AM, Khoem Sokhem wrote: Hello list members, I just want to ask one question on how to switch langugage in Gimp via menu, It will be good if Gimp can switch language via menu like VLC, Pidgin. Any one know, will Gimp have this feature in the future? Thank in advance for your respone. Sokhem Hi There is work ongoing in this direction, see Bug 132509 – Allow to choose language in text tool editor http://bugzilla.gnome.org/show_bug.cgi?id=132509 While the bug report is for the text tool, the work done there will bring us closer to UI for selecting language. / Martin ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
Re: [Gimp-developer] Problem with creating/compiling XMPModel which inherits from GObject
On 07/16/2009 08:26 AM, Roman Joost wrote: Hi, I thought it would be handy, if my XMPModel which stores the XMP metadata could emit it's own signals if properties or schemas change. I'm just wondering what I'm doing wrong here. If there is more code needed, I could probably attach it to a bug or put it on the net somewhere. Am I mixing some fundamentals of Gtk and GObject programming here? Hi, The errors are due to that header files are included in the wrong order in the translation units (c files). Moving these around a bit solves your compilation problems, I've attached a patch that should be applied on top of your patch. (You can squash the commits together with an interactive git rebase) There are alternative ways to attack this problem, one is to add a metadata-types.h header file with typedef struct _XMPType XMPType; ... and then include that early in the .c files. That way the order of inclusion below does not matter BR, Martin From a6793ad5b6c8048bbbdb4678048cfa41d3fc934a Mon Sep 17 00:00:00 2001 From: Martin Nordholts mart...@src.gnome.org Date: Thu, 16 Jul 2009 16:19:34 +0200 Subject: [PATCH] Fix compilation for WiP metadata plug-in --- plug-ins/metadata/exif-decode.c |2 +- plug-ins/metadata/interface.c |3 ++- plug-ins/metadata/interface.h |1 - plug-ins/metadata/metadata.c|3 +++ plug-ins/metadata/xmp-encode.c |2 +- plug-ins/metadata/xmp-encode.h |1 + plug-ins/metadata/xmp-model.c |6 ++ plug-ins/metadata/xmp-schemas.c |5 - 8 files changed, 18 insertions(+), 5 deletions(-) diff --git a/plug-ins/metadata/exif-decode.c b/plug-ins/metadata/exif-decode.c index 8123ad0..013d0be 100644 --- a/plug-ins/metadata/exif-decode.c +++ b/plug-ins/metadata/exif-decode.c @@ -28,8 +28,8 @@ #include libexif/exif-data.h -#include xmp-model.h #include xmp-schemas.h +#include xmp-model.h #include exif-decode.h diff --git a/plug-ins/metadata/interface.c b/plug-ins/metadata/interface.c index 12cf001..8cf9614 100644 --- a/plug-ins/metadata/interface.c +++ b/plug-ins/metadata/interface.c @@ -48,9 +48,10 @@ #include libgimp/stdplugins-intl.h +#include xmp-schemas.h +#include xmp-model.h #include interface.h #include metadata.h -#include xmp-schemas.h #include xmp-encode.h diff --git a/plug-ins/metadata/interface.h b/plug-ins/metadata/interface.h index efe1ae3..804a36c 100644 --- a/plug-ins/metadata/interface.h +++ b/plug-ins/metadata/interface.h @@ -21,7 +21,6 @@ #define INTERFACE_H #include glib.h -#include xmp-model.h G_BEGIN_DECLS diff --git a/plug-ins/metadata/metadata.c b/plug-ins/metadata/metadata.c index 8e59a2f..1b3fda3 100644 --- a/plug-ins/metadata/metadata.c +++ b/plug-ins/metadata/metadata.c @@ -21,6 +21,8 @@ #include string.h +#include gtk/gtk.h + #include libgimp/gimp.h #include libexif/exif-data.h @@ -28,6 +30,7 @@ #include libgimp/stdplugins-intl.h #include metadata.h +#include xmp-schemas.h #include xmp-encode.h #include interface.h #include exif-decode.h diff --git a/plug-ins/metadata/xmp-encode.c b/plug-ins/metadata/xmp-encode.c index 485dfc0..7d85171 100644 --- a/plug-ins/metadata/xmp-encode.c +++ b/plug-ins/metadata/xmp-encode.c @@ -21,7 +21,7 @@ #include string.h -#include glib-object.h +#include gtk/gtk.h #include libgimp/gimp.h diff --git a/plug-ins/metadata/xmp-encode.h b/plug-ins/metadata/xmp-encode.h index e546730..1959d4f 100644 --- a/plug-ins/metadata/xmp-encode.h +++ b/plug-ins/metadata/xmp-encode.h @@ -20,6 +20,7 @@ #define XMP_ENCODE_H #include glib.h +#include xmp-schemas.h #include xmp-model.h G_BEGIN_DECLS diff --git a/plug-ins/metadata/xmp-model.c b/plug-ins/metadata/xmp-model.c index 8f4cccf..9bf9f69 100644 --- a/plug-ins/metadata/xmp-model.c +++ b/plug-ins/metadata/xmp-model.c @@ -58,6 +58,12 @@ xmp_model_class_init (XMPModelClass *klass) klass-property_changed = NULL; } + +static void +xmp_model_init (XMPModel *xmp_model) +{ +} + /** * xmp_model_new: * diff --git a/plug-ins/metadata/xmp-schemas.c b/plug-ins/metadata/xmp-schemas.c index e97b1f8..08a8e02 100644 --- a/plug-ins/metadata/xmp-schemas.c +++ b/plug-ins/metadata/xmp-schemas.c @@ -18,8 +18,11 @@ */ #include config.h -#include xmp-model.h + +#include gtk/gtk.h + #include xmp-schemas.h +#include xmp-model.h static XMPProperty dc_properties[] = { -- 1.6.2.5 ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
[Gimp-developer] file_jpeg_save in a c plugin
Hola, hi. I am trying to save an image as a jpeg file in a c-plugin. The problem is that I have not been able to use the file_jpeg_save function. Any help appreciated! Thanks! (code excerpt) // works! gimp_file_save(GIMP_RUN_INTERACTIVE, nimage, vector_drawables[i]-drawable_id, name, name); // DOES NOT WORK! :( file_jpeg_save(GIMP_RUN_NONINTERACTIVE, nimage, vector_drawables[i]-drawable_id, name, name, quality, 0, 1, 1, , 0, 1, 0, 2); // 14 parameters -- Javier R. (via www.gimpusers.com) ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
Re: [Gimp-developer] file_jpeg_save in a c plugin
On 07/16/2009 04:52 PM, Javier R. wrote: Hola, hi. I am trying to save an image as a jpeg file in a c-plugin. The problem is that I have not been able to use the file_jpeg_save function. There is no such function in the C plug-in API, but you can invoke the PDB function called file-jpeg-save with gimp_run_procedure() like this: gimp_run_procedure (file-jpeg-save ... etc) Grep the source for gimp_run_procedure() for samples on how to invoke it and pass parameters to functions, you may also refer to its documentation: http://developer.gimp.org/api/2.0/libgimp/libgimp-gimp.html#gimp-run-procedure / Martin ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
[Gimp-developer] file_jpeg_save in a c plugin
?Many thanks for your fast response, Martin! I'll check the documentation link that you propose and see if I can work this out. Muchas gracias de nuevo, Javier Ruiz There is no such function in the C plug-in API, but you can invoke the PDB function called file-jpeg-save with gimp_run_procedure() like this: gimp_run_procedure (file-jpeg-save ... etc) Grep the source for gimp_run_procedure() for samples on how to invoke it and pass parameters to functions, you may also refer to its documentation: http://developer.gimp.org/api/2.0/libgimp/libgimp-gimp.html#gimp-run-procedure / Martin -- Javier R. (via www.gimpusers.com) ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
[Gimp-developer] Plugin Development
I have a (hopefully simple) question that I can not seem to find the answer for anywhere... When is it appropriate to write: - a script - a python plugin - a compiled plugin Specifically, If I have written a script and want better speed, should I write it as a python plugin, or as a C plugin? Looking at the examples provided on C plugins (or at the code for these plugins themselves), they mostly seem to work at a low level, on a drawable/pixel. Would there be any advantage to a C plugin that just combines other PDB functions? Here is an example. I want to make a drop shadow based on the alpha of a layer or a selection, with an offset, direction, colour and hardnessbut want a preview for the user to see what their choices are doing. This could be done by pdb calls to duplicate layers, lock alpha, fill, blur, translate, etc. without having to access the pixel data of an image itself. I could do it with a script, but get no preview. I could do it with a python plugin, but still wouldn't get a preview (though I have read the the preview window widget is supported, I can't get it to work and have seen no example), or I could write it as a C plugin. But as a C plugin it would just be a bunch of calls to gimp_run_procedure? Does this make sense to do? Would any speed improvement be worth it? Thanks in advance- -Rob A ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
Re: [Gimp-developer] Plugin Development
On 07/16/2009 05:39 PM, Rob Antonishen wrote: I have a (hopefully simple) question that I can not seem to find the answer for anywhere... When is it appropriate to write: - a script - a python plugin - a compiled plugin Specifically, If I have written a script and want better speed, should I write it as a python plugin, or as a C plugin? The first thing you should do is to benchmark your current plug-in, what exactly is slow? The algorithm you use? Then switching language won't help. Is it the manipulation of individual pixels that is slow? Then switching to C might help as it enables you to be more clever about memory and CPU usage. Looking at the examples provided on C plugins (or at the code for these plugins themselves), they mostly seem to work at a low level, on a drawable/pixel. Would there be any advantage to a C plugin that just combines other PDB functions? No not that I can see, if all you do is invoke other procedures in the PDP, C is a bad language choice. One slight drawback of plug-ins written in Python is that it is not trivial to get Python working on a Windows install. Here is an example. I want to make a drop shadow based on the alpha of a layer or a selection, with an offset, direction, colour and hardnessbut want a preview for the user to see what their choices are doing. The current script infrastructure is terrible for doing live previews, IMHO you should help getting GEGL integrated instead so that we can do this in a proper way. This could be done by pdb calls to duplicate layers, lock alpha, fill, blur, translate, etc. without having to access the pixel data of an image itself. I could do it with a script, but get no preview. I could do it with a python plugin, but still wouldn't get a preview (though I have read the the preview window widget is supported, I can't get it to work and have seen no example), or I could write it as a C plugin. But as a C plugin it would just be a bunch of calls to gimp_run_procedure? Does this make sense to do? Would any speed improvement be worth it? Again, if all you do is invoke other procedures, C won't give you any notable performance improvement as most of the processing will occur in the GIMP core anyway. HTH, / Martin ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
Re: [Gimp-developer] Plugin Development
On Thu, Jul 16, 2009 at 11:57 AM, Martin Nordholts wrote: On 07/16/2009 05:39 PM, Rob Antonishen wrote: Specifically, If I have written a script and want better speed, should I write it as a python plugin, or as a C plugin? The first thing you should do is to benchmark your current plug-in, what exactly is slow? The algorithm you use? Then switching language won't help. Is it the manipulation of individual pixels that is slow? Then switching to C might help as it enables you to be more clever about memory and CPU usage. HTH, / Martin Thanks, Martin. I that clarifies things for me a bit more. Specifically, I wrote a script: http://registry.gimp.org/node/14051 that is quite slow as it does a lot of calls to gimp-selection-value to find a point inside a selection (using the gimp-selection-bounds results as the extents of the loop). So my though is a C (or even python?) implementation would be significantly faster. -Rob A ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
Re: [Gimp-developer] Switch language via menu
On Thu, 2009-07-16 at 10:55 +0200, Martin Nordholts wrote: I just want to ask one question on how to switch langugage in Gimp via menu, It will be good if Gimp can switch language via menu like VLC, Pidgin. Any one know, will Gimp have this feature in the future? Thank in advance for your respone. Sokhem Hi There is work ongoing in this direction, see Bug 132509 – Allow to choose language in text tool editor http://bugzilla.gnome.org/show_bug.cgi?id=132509 While the bug report is for the text tool, the work done there will bring us closer to UI for selecting language. The actual bug report for this is http://bugzilla.gnome.org/show_bug.cgi?id=576910 The text tool language is only related so much as that some of the more lower-level infrastructure that has already been added for this feature will be reused for the UI language selection. Sven ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer