app, libgimpbase, libgimpconfig: make our custom GParamFlags definitions…

… more robust.

GIMP_PARAM_NO_VALIDATE and GIMP_CONFIG_PARAM_DONT_COMPARE were the same
value, most likely because when GIMP_CONFIG_PARAM_DONT_COMPARE got added
(commit c5c807d191), the comment to keep in sync
libgimpbase/gimpparamspecs.h and libgimpconfig/gimpconfig-params.h was
missed.

Instead, since libgimpconfig can include libgimpbase, do the other way
around: first non-GLib param flags are in libgimpbase, then we add a
GIMP_PARAM_FLAG_SHIFT, then we increment from it in libgimpconfig, and
finally we increment from GIMP_CONFIG_PARAM_FLAG_SHIFT if ever we add
more flags in app/ (right now GIMP_SYMMETRY_PARAM_GUI is apparently the
only one, but this may change).
This commit is contained in:
Jehan 2024-08-31 00:45:15 +02:00
parent f4fb6db331
commit f7aaba9fc9
5 changed files with 28 additions and 12 deletions

View File

@ -25,8 +25,8 @@
#include "gimpobject.h"
/* shift one more than GIMP_CONFIG_PARAM_DONT_COMPARE */
#define GIMP_SYMMETRY_PARAM_GUI (1 << (7 + G_PARAM_USER_SHIFT))
/* shift one more than latest GIMP_CONFIG_PARAM_* */
#define GIMP_SYMMETRY_PARAM_GUI (1 << (0 + GIMP_CONFIG_PARAM_FLAG_SHIFT))
#define GIMP_TYPE_SYMMETRY (gimp_symmetry_get_type ())

View File

@ -23,6 +23,7 @@
#include <gegl.h>
#include <gtk/gtk.h>
#include "libgimpconfig/gimpconfig.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "propgui/propgui-types.h" /* ugly, but what the heck */

View File

@ -35,10 +35,15 @@ G_BEGIN_DECLS
*
* Since 3.0
*/
/*
* Keep in sync with libgimpconfig/gimpconfig-params.h
#define GIMP_PARAM_NO_VALIDATE (1 << (0 + G_PARAM_USER_SHIFT))
/**
* GIMP_PARAM_FLAG_SHIFT:
*
* Minimum shift count to be used for libgimpconfig defined
* [flags@GObject.ParamFlags] (see libgimpconfig/gimpconfig-params.h).
*/
#define GIMP_PARAM_NO_VALIDATE (1 << (6 + G_PARAM_USER_SHIFT))
#define GIMP_PARAM_FLAG_SHIFT (1 + G_PARAM_USER_SHIFT)
/**
* GIMP_PARAM_STATIC_STRINGS:

View File

@ -37,21 +37,21 @@ G_BEGIN_DECLS
*
* A property that can and should be serialized and deserialized.
**/
#define GIMP_CONFIG_PARAM_SERIALIZE (1 << (0 + G_PARAM_USER_SHIFT))
#define GIMP_CONFIG_PARAM_SERIALIZE (1 << (0 + GIMP_PARAM_FLAG_SHIFT))
/**
* GIMP_CONFIG_PARAM_AGGREGATE:
*
* The object property is to be treated as part of the parent object.
**/
#define GIMP_CONFIG_PARAM_AGGREGATE (1 << (1 + G_PARAM_USER_SHIFT))
#define GIMP_CONFIG_PARAM_AGGREGATE (1 << (1 + GIMP_PARAM_FLAG_SHIFT))
/**
* GIMP_CONFIG_PARAM_RESTART:
*
* Changes to this property take effect only after a restart.
**/
#define GIMP_CONFIG_PARAM_RESTART (1 << (2 + G_PARAM_USER_SHIFT))
#define GIMP_CONFIG_PARAM_RESTART (1 << (2 + GIMP_PARAM_FLAG_SHIFT))
/**
* GIMP_CONFIG_PARAM_CONFIRM:
@ -59,14 +59,14 @@ G_BEGIN_DECLS
* Changes to this property should be confirmed by the user before
* being applied.
**/
#define GIMP_CONFIG_PARAM_CONFIRM (1 << (3 + G_PARAM_USER_SHIFT))
#define GIMP_CONFIG_PARAM_CONFIRM (1 << (3 + GIMP_PARAM_FLAG_SHIFT))
/**
* GIMP_CONFIG_PARAM_DEFAULTS:
*
* Don't serialize this property if it has the default value.
**/
#define GIMP_CONFIG_PARAM_DEFAULTS (1 << (4 + G_PARAM_USER_SHIFT))
#define GIMP_CONFIG_PARAM_DEFAULTS (1 << (4 + GIMP_PARAM_FLAG_SHIFT))
/**
* GIMP_CONFIG_PARAM_IGNORE:
@ -74,14 +74,22 @@ G_BEGIN_DECLS
* This property exists for obscure reasons or is needed for backward
* compatibility. Ignore the value read and don't serialize it.
**/
#define GIMP_CONFIG_PARAM_IGNORE (1 << (5 + G_PARAM_USER_SHIFT))
#define GIMP_CONFIG_PARAM_IGNORE (1 << (5 + GIMP_PARAM_FLAG_SHIFT))
/**
* GIMP_CONFIG_PARAM_DONT_COMPARE:
*
* Ignore this property when comparing objects.
**/
#define GIMP_CONFIG_PARAM_DONT_COMPARE (1 << (6 + G_PARAM_USER_SHIFT))
#define GIMP_CONFIG_PARAM_DONT_COMPARE (1 << (6 + GIMP_PARAM_FLAG_SHIFT))
/**
* GIMP_CONFIG_PARAM_FLAG_SHIFT:
*
* Minimum shift count to be used for core application defined
* [flags@GObject.ParamFlags].
*/
#define GIMP_CONFIG_PARAM_FLAG_SHIFT (7 + GIMP_PARAM_FLAG_SHIFT)
/**
* GIMP_CONFIG_PARAM_FLAGS:

View File

@ -21,6 +21,8 @@
#include <gegl.h>
#include <libgimpbase/gimpbase.h>
#define __GIMP_CONFIG_H_INSIDE__
#include <libgimpconfig/gimpconfigtypes.h>