gimpconfig-params.h 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. /* LIBGIMP - The GIMP Library
  2. * Copyright (C) 1995 Spencer Kimball and Peter Mattis
  3. *
  4. * ParamSpecs for config objects
  5. * Copyright (C) 2001 Sven Neumann <sven@gimp.org>
  6. *
  7. * This library is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2 of the License, or (at your option) any later version.
  11. *
  12. * This library is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Library General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with this library; if not, write to the
  19. * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  20. * Boston, MA 02111-1307, USA.
  21. */
  22. #ifndef __GIMP_CONFIG_PARAMS_H__
  23. #define __GIMP_CONFIG_PARAMS_H__
  24. G_BEGIN_DECLS
  25. /* For information look into the C source or the html documentation */
  26. /*
  27. * GIMP_CONFIG_PARAM_SERIALIZE - A property that can and should be
  28. * serialized and deserialized.
  29. * GIMP_CONFIG_PARAM_AGGREGATE - The object property is to be treated as
  30. * part of the parent object.
  31. * GIMP_CONFIG_PARAM_RESTART - Changes to this property take effect only
  32. * after a restart.
  33. * GIMP_CONFIG_PARAM_CONFIRM - Changes to this property should be
  34. * confirmed by the user before being applied.
  35. * GIMP_CONFIG_PARAM_DEFAULTS - Don't serialize this property if it has the
  36. * default value.
  37. * GIMP_CONFIG_PARAM_IGNORE - This property exists for obscure reasons
  38. * and is needed for backward compatibility.
  39. * Ignore the value read and don't serialize it.
  40. */
  41. #define GIMP_CONFIG_PARAM_SERIALIZE (1 << (0 + G_PARAM_USER_SHIFT))
  42. #define GIMP_CONFIG_PARAM_AGGREGATE (1 << (1 + G_PARAM_USER_SHIFT))
  43. #define GIMP_CONFIG_PARAM_RESTART (1 << (2 + G_PARAM_USER_SHIFT))
  44. #define GIMP_CONFIG_PARAM_CONFIRM (1 << (3 + G_PARAM_USER_SHIFT))
  45. #define GIMP_CONFIG_PARAM_DEFAULTS (1 << (4 + G_PARAM_USER_SHIFT))
  46. #define GIMP_CONFIG_PARAM_IGNORE (1 << (5 + G_PARAM_USER_SHIFT))
  47. #define GIMP_CONFIG_PARAM_FLAGS (G_PARAM_READWRITE | \
  48. G_PARAM_CONSTRUCT | \
  49. GIMP_CONFIG_PARAM_SERIALIZE)
  50. /* some convenience macros to install object properties */
  51. #define GIMP_CONFIG_INSTALL_PROP_BOOLEAN(class, id, name, blurb, default, flags)\
  52. g_object_class_install_property (class, id,\
  53. g_param_spec_boolean (name, NULL, blurb,\
  54. default,\
  55. flags | GIMP_CONFIG_PARAM_FLAGS))
  56. #define GIMP_CONFIG_INSTALL_PROP_RGB(class, id, name, blurb, has_alpha, default, flags) \
  57. g_object_class_install_property (class, id,\
  58. gimp_param_spec_rgb (name, NULL, blurb,\
  59. has_alpha, default, \
  60. flags | GIMP_CONFIG_PARAM_FLAGS))
  61. #define GIMP_CONFIG_INSTALL_PROP_DOUBLE(class, id, name, blurb, min, max, default, flags)\
  62. g_object_class_install_property (class, id,\
  63. g_param_spec_double (name, NULL, blurb,\
  64. min, max, default,\
  65. flags | GIMP_CONFIG_PARAM_FLAGS))
  66. #define GIMP_CONFIG_INSTALL_PROP_RESOLUTION(class, id, name, blurb, default, flags)\
  67. g_object_class_install_property (class, id,\
  68. g_param_spec_double (name, NULL, blurb,\
  69. GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION, \
  70. default,\
  71. flags | GIMP_CONFIG_PARAM_FLAGS))
  72. #define GIMP_CONFIG_INSTALL_PROP_ENUM(class, id, name, blurb, enum_type, default, flags)\
  73. g_object_class_install_property (class, id,\
  74. g_param_spec_enum (name, NULL, blurb,\
  75. enum_type, default,\
  76. flags | GIMP_CONFIG_PARAM_FLAGS))
  77. #define GIMP_CONFIG_INSTALL_PROP_INT(class, id, name, blurb, min, max, default, flags)\
  78. g_object_class_install_property (class, id,\
  79. g_param_spec_int (name, NULL, blurb,\
  80. min, max, default,\
  81. flags | GIMP_CONFIG_PARAM_FLAGS))
  82. #define GIMP_CONFIG_INSTALL_PROP_MATRIX2(class, id, name, blurb, default, flags)\
  83. g_object_class_install_property (class, id,\
  84. gimp_param_spec_matrix2 (name, NULL, blurb,\
  85. default,\
  86. flags | GIMP_CONFIG_PARAM_FLAGS))
  87. #define GIMP_CONFIG_INSTALL_PROP_MEMSIZE(class, id, name, blurb, min, max, default, flags)\
  88. g_object_class_install_property (class, id,\
  89. gimp_param_spec_memsize (name, NULL, blurb,\
  90. min, max, default,\
  91. flags | GIMP_CONFIG_PARAM_FLAGS))
  92. #define GIMP_CONFIG_INSTALL_PROP_PATH(class, id, name, blurb, path_type, default, flags)\
  93. g_object_class_install_property (class, id,\
  94. gimp_param_spec_config_path (name, NULL, blurb,\
  95. path_type, default,\
  96. flags | GIMP_CONFIG_PARAM_FLAGS))
  97. #define GIMP_CONFIG_INSTALL_PROP_STRING(class, id, name, blurb, default, flags)\
  98. g_object_class_install_property (class, id,\
  99. g_param_spec_string (name, NULL, blurb,\
  100. default,\
  101. flags | GIMP_CONFIG_PARAM_FLAGS))
  102. #define GIMP_CONFIG_INSTALL_PROP_UINT(class, id, name, blurb, min, max, default, flags)\
  103. g_object_class_install_property (class, id,\
  104. g_param_spec_uint (name, NULL, blurb,\
  105. min, max, default,\
  106. flags | GIMP_CONFIG_PARAM_FLAGS))
  107. #define GIMP_CONFIG_INSTALL_PROP_UNIT(class, id, name, blurb, pixels, percent, default, flags)\
  108. g_object_class_install_property (class, id,\
  109. gimp_param_spec_unit (name, NULL, blurb,\
  110. pixels, percent, default,\
  111. flags | GIMP_CONFIG_PARAM_FLAGS))
  112. /* object and pointer properties are _not_ G_PARAM_CONSTRUCT */
  113. #define GIMP_CONFIG_INSTALL_PROP_OBJECT(class, id, name, blurb, object_type, flags)\
  114. g_object_class_install_property (class, id,\
  115. g_param_spec_object (name, NULL, blurb,\
  116. object_type,\
  117. flags |\
  118. G_PARAM_READWRITE |\
  119. GIMP_CONFIG_PARAM_SERIALIZE))
  120. #define GIMP_CONFIG_INSTALL_PROP_POINTER(class, id, name, blurb, flags)\
  121. g_object_class_install_property (class, id,\
  122. g_param_spec_pointer (name, NULL, blurb,\
  123. flags |\
  124. G_PARAM_READWRITE |\
  125. GIMP_CONFIG_PARAM_SERIALIZE))
  126. G_END_DECLS
  127. #endif /* __GIMP_CONFIG_PARAMS_H__ */