Rather than trying to implement full i18n plural support, we just remove
this failed attempt from the past. The fact is that to get proper
support, we'd basically need to reimplement a Gettext-like plural
definition syntax within our API, then ask people to write down this
plural definition for their language, then to write every plural form…
all this for custom units which only them will ever see!
Moreover code investigation shows that the singular form was simply
never used, and the plural form was always used (whatever the actual
unit value displayed).
As for the "identifier", this was a text which was never shown anywhere
(except in the unit editor) and for all built-in units, as well as
default unitrc units, it was equivalent to the English plural value.
So we now just have a unique name which is the "long label" to be used
everywhere in the GUI, and abbreviation will be basically the "short
label". That's it. No useless (or worse, not actually usable because it
was not generic internationalization) values anymore!
This fixes all our GObject Introspection issues with GimpUnit which was
both an enum and an int-derived type of user-defined units *completing*
the enum values. GIR clearly didn't like this!
Now GimpUnit is a proper class and units are unique objects, allowing to
compare them with an identity test (i.e. `unit == gimp_unit_pixel ()`
tells us if unit is the pixel unit or not), which makes it easy to use,
just like with int, yet adding also methods, making for nicer
introspected API.
As an aside, this also fixes#10738, by having all the built-in units
retrievable even if libgimpbase had not been properly initialized with
gimp_base_init().
I haven't checked in details how GIR works to introspect, but it looks
like it loads the library to inspect and runs functions, hence
triggering some CRITICALS because virtual methods (supposed to be
initialized with gimp_base_init() run by libgimp) are not set. This new
code won't trigger any critical because the vtable method are now not
necessary, at least for all built-in units.
Note that GimpUnit is still in libgimpbase. It could have been moved to
libgimp in order to avoid any virtual method table (since we need to
keep core and libgimp side's units in sync, PDB is required), but too
many libgimpwidgets widgets were already using GimpUnit. And technically
most of GimpUnit logic doesn't require PDB (only the creation/sync
part). This is one of the reasons why user-created GimpUnit list is
handled and stored differently from other types of objects.
Globally this simplifies the code a lot too and we don't need separate
implementations of various utils for core and libgimp, which means less
prone to errors.
This is meant to obsolete GeglParamColor with at least an additional argument
has_alpha which we need in GIMP. It allows to advertize when a parameter wants
an opaque color, which in particular means we know when displaying a GUI to pick
colors with alpha or not.
There are no plug-ins which uses GimpRGB for procedure argument, nor is there
any base PDB procedure. We don't pass this type anymore through from/to
core/plug-ins. So let's clean the whole code out as a next step to get rid of
GimpRGB from our codebase!
I also changed a bit the new color serialization by adding a (color …)
symbol framing the contents, for cases where we don't have a specific
property name, e.g. for the color history list stored in colorrc, unlike
for GimpConfig GeglColor properties.
While doing this, I moved GeglColor property deserialization code into
gimp_scanner_parse_color() which is now able to recognize both older
(color-rgb|rgba|hsv|hsva with no color space) and newer serialization
formats ("color", color model agnostic and space aware).
Serializing palette colors is not possible right now as far too much
additional data are required, and anyway we likely wouldn't be able to
associate back the color to the right palette on deserialization,
removing any interest of keeping the index data anyway.
With that context in mind, let's just serialize palette data as basic
RGB within the palette's space.
gimp_config_writer_printf () is used to print out a gsize variable, data_length.
gsize's actual size varies depending on platform, so using the format "%lu" throws
a warning on some platforms and switching to "%llu" throws a warning on others.
@Wormnest suggested ("%" G_GSIZE_FORMAT) as a universal format to resolve
this warning.
- file-psd, sig[4] and block_len variables are initialized to stop uninitialized warnings
- file-xpm, g_file_peek_path () is cast to (char *) to stop "discarded const" warnings
- gimpconfig-serialized.c, %llu is used instead of %lu to stop overflow warning
… fails.
This happens for plug-in settings storage. Serialization stops at first failed
property serialization, whereas we could store more. This feels like the last
settings feature is broken.
Used for instance if a plug-in had a GimpParasite argument (or aux
argument), which might not seem too useful at first. But anyway we
propose the type, so let's support it properly.
And actually I am going to use it in the next commit as a trick to save
binary data in stored last values for a plug-in.
The latter is broken and doesn't guarantee a decimal point with the
current bug. Also, g_ascii_dtostr() doesn't need the format parameter
and produces nicer output.
g_value_get_object() doesn't return a new reference, so it must
not be dropped. Fixes random crashes when a profile was chosen
in a GimpTemplate (e.g. in new image or prefs). Spotted by Elle.
Use g_file_get_parse_name() and g_file_parse_name() in order to turn
them into strings and back. Not really sure if we will end up needing
this, but I need it for current hacking. It's clean code and easy
enough to revert, so no harm done in either case.
because it confuses gtk-doc and breaks some links. Also change the
"Index of new symbols in GIMP 2.x" sections to be what seems to be the
modern standard (looked at the GLib and GTK+ docs), and update some
other stuff.
2009-01-17 Michael Natterer <mitch@gimp.org>
* all files with a GPL header and all COPYING files:
Change licence to GPLv3 (and to LGPLv3 for libgimp).
Cleaned up some copyright headers and regenerated the parsers in
the ImageMap plugin.
svn path=/trunk/; revision=27913
2008-05-18 Michael Natterer <mitch@gimp.org>
* libgimpconfig/gimpconfig-serialize.[ch]
* libgimpconfig/gimpconfig.def: add
gimp_config_serialize_property_by_name().
* app/gegl/gimpcolorbalanceconfig.c
* app/gegl/gimpcurvesconfig.c
* app/gegl/gimphuesaturationconfig.c
* app/gegl/gimplevelsconfig.c: implement serialize() and
deserialize() and make sure the properties which change when the
channel/range property changes are handled correctly. Not too
ugly but it's still a hack...
svn path=/trunk/; revision=25703
2006-08-08 Sven Neumann <sven@gimp.org>
* libgimpconfig/gimpconfig-deserialize.c
(gimp_config_deserialize_property)
* libgimpconfig/gimpconfig-serialize.c
(gimp_config_serialize_property): check if the properties
owner_type is an object type before calling g_type_class_peek().
2006-04-27 Sven Neumann <sven@gimp.org>
* libgimpcolor/gimprgb.[ch]: hide the GimpParamSpecRGB struct
again. Added getter for the has_alpha field.
* libgimpcolor/gimpcolor.def: updated.
* app/config/gimpconfig-dump.c
* libgimpconfig/gimpconfig-serialize.c: use
gimp_param_spec_rgb_has_alpha() instead of accessing the
GimpParamSpecRGB struct directly.
2006-04-27 Sven Neumann <sven@gimp.org>
* libgimpcolor/gimprgb.[ch]: added "has_alpha" to GimpParamSpecRGB.
Made the GimpParamSpecRGB struct public. When validating a color,
only look at the alpha channel if has_alpha is set.
* libgimpconfig/gimpconfig-params.h: added "has_alpha" to
GIMP_CONFIG_INSTALL_PROP_RGB macro definition.
* libgimpconfig/gimpconfig-serialize.c: serialize color values as
"(rgb r g b)" if the param-spec indicates that the alpha channel
is meaningless.
* app/config/gimpconfig-dump.c: take "has_alpha" into account when
documenting color properties.
* app/core/gimpcontext.c
* app/core/gimpgrid.c
* app/display/gimpdisplayoptions.c
* app/text/gimptext.c
* app/widgets/gimpaction.c
* app/widgets/gimpcolorbar.c
* libgimpwidgets/gimpcolorarea.c
* libgimpwidgets/gimpcolorbutton.c: specify whether color properties
have an alpha channel.
* tools/pdbgen/app.pl: handle "has_alpha" for color paramaters.
* tools/pdbgen/pdb/channel.pdb
* tools/pdbgen/pdb/context.pdb
* tools/pdbgen/pdb/grid.pdb
* tools/pdbgen/pdb/image.pdb: set the "has_alpha" flag where
appropriate.
* app/pdb/gimp-pdb-compat.c (gimp_pdb_compat_param_spec): set
"has_alpha" to TRUE for GIMP_PDB_COLOR.
* app/pdb/channel_cmds.c
* app/pdb/context_cmds.c
* app/pdb/gradient_cmds.c
* app/pdb/grid_cmds.c
* app/pdb/image_cmds.c
* app/pdb/palette_cmds.c
* app/pdb/palettes_cmds.c
* app/pdb/selection_tools_cmds.c: regenerated.
* app/config/gimpdisplayconfig.c (gimp_display_config_class_init):
removed unused code.
2005-01-25 Michael Natterer <mitch@gimp.org>
* libgimpconfig/gimpconfigtypes.h: new file holding the opaque
typedefs for libgimpconfig. Includes "libgimpbase/gimpbasetypes.h"
* libgimpconfig/Makefile.am: added the new file. Removed stuff
that is not needed.
* libgimpconfig/gimpconfigwriter.h
* libgimpconfig/gimpconfig-iface.h: removed typedefs here.
* libgimpconfig/gimpconfig-deserialize.c
* libgimpconfig/gimpconfig-iface.c
* libgimpconfig/gimpconfig-serialize.c
* libgimpconfig/gimpconfig-utils.c
* libgimpconfig/gimpconfig.h
* libgimpconfig/gimpconfigwriter.c: include it before including
any other libgimpconfig stuff.
* app/config/config-types.h: #include "libgimpbase/gimpbasetypes.h"
* app/config/gimpconfig-utils.h: changed include guards to
__APP_GIMP_CONFIG_UTILS_H__.
* app/dialogs/tips-parser.c: include <glib-object.h> instead of
just <glib.h>.
* app/tools/gimphistogramoptions.c
* app/tools/gimptextoptions.c: include "config/gimpconfig-utils.h"
* app/widgets/gimpdialogfactory.h
* app/widgets/gimpsessioninfo.h: removed inclusion of
"libgimpbase/gimpbasetypes.h".
2005-01-24 Sven Neumann <sven@gimp.org>
* app/config/gimpconfig-deserialize.[ch]
* app/config/gimpconfig-serialize.[ch]
* app/config/gimpconfig.[ch]: factored out some rather obscure
GimpConfig features that were added solely for gimprc.
* app/config/Makefile.am
* app/config/gimprc-deserialize.[ch]
* app/config/gimprc-serialize.[ch]
* app/config/gimprc-unknown.[ch]: moved gimprc-specific code to
these new files.
* app/config/gimprc.c
* app/config/test-config.c: changed accordingly.
2004-07-08 Sven Neumann <sven@gimp.org>
* app/config/gimpconfig-deserialize.c
* app/config/gimpconfig-serialize.c: removed redundant casts.
* app/widgets/gimpsessioninfo.[ch]: added convenience functions to
get and set aux-info based on object properties.
* app/widgets/gimphistogrameditor.c: use the new functions to save
a histogram's channel and scale in the sessionrc.
2004-06-16 Michael Natterer <mitch@gimp.org>
* libgimpwidgets/gimpcontroller.[ch]: added #define
GIMP_CONTROLLER_PARAM_SERIALIZE. Made all properties serializable.
* modules/controller_linux_input.c: made "device-name"
serializable.
* app/config/gimpconfig-params.h: added macro
GIMP_CONFIG_INSTALL_PROP_POINTER() which needs to be handled
by custom (de)serialize_property() implementations.
* app/config/gimpconfig-deserialize.c
* app/config/gimpconfig-serialize.c: made object (de)serialization
work for object properties which are *not* GIMP_PARAM_AGGREGATE.
Write/parse the exact type of the object to create to enable this.
* app/core/gimpmarshal.list: new marshaller for GimpControllerInfo.
* app/widgets/gimpcontrollerinfo.[ch]: implement GimpConfigInterface
and add "controller" and "mapping" properties. Add "event-mapped"
signal which carries the action_name.
* app/widgets/gimpcontrollers.c: removed all deserialization code
and simply (de)serialize the controller container. Install a
container handler for "event-mapped" and do the action_name ->
action mapping in the callback.
* etc/controllerrc: regenerated with new syntax. Delete your old one!