/usr/include/gegl-0.2/gegl-chant.h is in libgegl-dev 0.2.0-7+b1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 | /* gegl-chant contains incantations to that produce the boilerplate
* needed to write GEGL operation plug-ins. It abstracts away inheritance
* by giving a limited amount of base classes, and reduced creation of
* a properties struct and registration of properties for that structure to
* a minimum amount of code through use of the C preprocessor. You should
* look at the operations implemented using chanting (they #include this file)
* to see how it is used in practice.
*
* GEGL 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.
*
* GEGL 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 GEGL; if not, see <http://www.gnu.org/licenses/>.
*
* 2006-2008 © Øyvind Kolås.
*/
#ifndef GEGL_CHANT_C_FILE
#error "GEGL_CHANT_C_FILE not defined"
#endif
#include <gegl-plugin.h>
G_BEGIN_DECLS
GType gegl_chant_get_type (void);
typedef struct _GeglChantO GeglChantO;
typedef struct _GeglChant GeglChant;
static void gegl_chant_register_type (GTypeModule *module);
static void gegl_chant_init_properties (GeglChant *self);
static void gegl_chant_class_intern_init (gpointer klass);
static gpointer gegl_chant_parent_class = NULL;
#define GEGL_DEFINE_DYNAMIC_OPERATION(T_P) GEGL_DEFINE_DYNAMIC_OPERATION_EXTENDED (GEGL_CHANT_C_FILE, GeglChant, gegl_chant, T_P, 0, {})
#define GEGL_DEFINE_DYNAMIC_OPERATION_EXTENDED(C_FILE, TypeName, type_name, TYPE_PARENT, flags, CODE) \
static void type_name##_init (TypeName *self); \
static void type_name##_class_init (TypeName##Class *klass); \
static void type_name##_class_finalize (TypeName##Class *klass); \
static GType type_name##_type_id = 0; \
static void type_name##_class_chant_intern_init (gpointer klass) \
{ \
gegl_chant_parent_class = g_type_class_peek_parent (klass); \
type_name##_class_init ((TypeName##Class*) klass); \
gegl_chant_class_intern_init (klass); \
} \
GType \
type_name##_get_type (void) \
{ \
return type_name##_type_id; \
} \
static void \
type_name##_register_type (GTypeModule *type_module) \
{ \
gchar tempname[256]; \
gchar *p; \
const GTypeInfo g_define_type_info = \
{ \
sizeof (TypeName##Class), \
(GBaseInitFunc) NULL, \
(GBaseFinalizeFunc) NULL, \
(GClassInitFunc) type_name##_class_chant_intern_init, \
(GClassFinalizeFunc) type_name##_class_finalize, \
NULL, /* class_data */ \
sizeof (TypeName), \
0, /* n_preallocs */ \
(GInstanceInitFunc) type_name##_init, \
NULL /* value_table */ \
}; \
g_snprintf (tempname, sizeof (tempname), \
"%s", #TypeName GEGL_CHANT_C_FILE); \
for (p = tempname; *p; p++) \
if (*p=='.') *p='_'; \
\
type_name##_type_id = g_type_module_register_type (type_module, \
TYPE_PARENT, \
tempname, \
&g_define_type_info, \
(GTypeFlags) flags); \
{ CODE ; } \
}
#define GEGL_CHANT_PROPERTIES(op) \
((GeglChantO *) (((GeglChant *) (op))->properties))
/****************************************************************************/
#ifdef GEGL_CHANT_TYPE_OPERATION
struct _GeglChant
{
GeglOperation parent_instance;
gpointer properties;
};
typedef struct
{
GeglOperationClass parent_class;
} GeglChantClass;
GEGL_DEFINE_DYNAMIC_OPERATION(GEGL_TYPE_OPERATION)
#endif
#ifdef GEGL_CHANT_TYPE_META
#include <operation/gegl-operation-meta.h>
struct _GeglChant
{
GeglOperationMeta parent_instance;
gpointer properties;
};
typedef struct
{
GeglOperationMetaClass parent_class;
} GeglChantClass;
GEGL_DEFINE_DYNAMIC_OPERATION(GEGL_TYPE_OPERATION_META)
#endif
#ifdef GEGL_CHANT_TYPE_SOURCE
struct _GeglChant
{
GeglOperationSource parent_instance;
gpointer properties;
};
typedef struct
{
GeglOperationSourceClass parent_class;
} GeglChantClass;
GEGL_DEFINE_DYNAMIC_OPERATION(GEGL_TYPE_OPERATION_SOURCE)
#endif
#ifdef GEGL_CHANT_TYPE_SINK
struct _GeglChant
{
GeglOperationSink parent_instance;
gpointer properties;
};
typedef struct
{
GeglOperationSinkClass parent_class;
} GeglChantClass;
GEGL_DEFINE_DYNAMIC_OPERATION(GEGL_TYPE_OPERATION_SINK)
#endif
#ifdef GEGL_CHANT_TYPE_FILTER
struct _GeglChant
{
GeglOperationFilter parent_instance;
gpointer properties;
};
typedef struct
{
GeglOperationFilterClass parent_class;
} GeglChantClass;
GEGL_DEFINE_DYNAMIC_OPERATION(GEGL_TYPE_OPERATION_FILTER)
#endif
#ifdef GEGL_CHANT_TYPE_COMPOSER
struct _GeglChant
{
GeglOperationComposer parent_instance;
gpointer properties;
};
typedef struct
{
GeglOperationComposerClass parent_class;
} GeglChantClass;
GEGL_DEFINE_DYNAMIC_OPERATION(GEGL_TYPE_OPERATION_COMPOSER)
#endif
#ifdef GEGL_CHANT_TYPE_COMPOSER3
struct _GeglChant
{
GeglOperationComposer3 parent_instance;
gpointer properties;
};
typedef struct
{
GeglOperationComposer3Class parent_class;
} GeglChantClass;
GEGL_DEFINE_DYNAMIC_OPERATION(GEGL_TYPE_OPERATION_COMPOSER3)
#endif
#ifdef GEGL_CHANT_TYPE_POINT_FILTER
struct _GeglChant
{
GeglOperationPointFilter parent_instance;
gpointer properties;
};
typedef struct
{
GeglOperationPointFilterClass parent_class;
} GeglChantClass;
GEGL_DEFINE_DYNAMIC_OPERATION(GEGL_TYPE_OPERATION_POINT_FILTER)
#endif
#ifdef GEGL_CHANT_TYPE_POINT_RENDER
struct _GeglChant
{
GeglOperationPointRender parent_instance;
gpointer properties;
};
typedef struct
{
GeglOperationPointRenderClass parent_class;
} GeglChantClass;
GEGL_DEFINE_DYNAMIC_OPERATION(GEGL_TYPE_OPERATION_POINT_RENDER)
#endif
#ifdef GEGL_CHANT_TYPE_TEMPORAL
struct _GeglChant
{
GeglOperationTemporal parent_instance;
gpointer properties;
};
typedef struct
{
GeglOperationTemporalClass parent_class;
} GeglChantClass;
GEGL_DEFINE_DYNAMIC_OPERATION(GEGL_TYPE_OPERATION_TEMPORAL)
#endif
#ifdef GEGL_CHANT_TYPE_AREA_FILTER
struct _GeglChant
{
GeglOperationAreaFilter parent_instance;
gpointer properties;
};
typedef struct
{
GeglOperationAreaFilterClass parent_class;
} GeglChantClass;
GEGL_DEFINE_DYNAMIC_OPERATION(GEGL_TYPE_OPERATION_AREA_FILTER)
#endif
#ifdef GEGL_CHANT_TYPE_POINT_COMPOSER
struct _GeglChant
{
GeglOperationPointComposer parent_instance;
gpointer properties;
};
typedef struct
{
GeglOperationPointComposerClass parent_class;
} GeglChantClass;
GEGL_DEFINE_DYNAMIC_OPERATION(GEGL_TYPE_OPERATION_POINT_COMPOSER)
#endif
#ifdef GEGL_CHANT_TYPE_POINT_COMPOSER3
struct _GeglChant
{
GeglOperationPointComposer3 parent_instance;
gpointer properties;
};
typedef struct
{
GeglOperationPointComposer3Class parent_class;
} GeglChantClass;
GEGL_DEFINE_DYNAMIC_OPERATION(GEGL_TYPE_OPERATION_POINT_COMPOSER3)
#endif
#define GEGL_CHANT(obj) ((GeglChant*)(obj))
/* if GEGL_CHANT_CUSTOM is defined you have to provide the following
* code or your own implementation of it
*/
#ifndef GEGL_CHANT_CUSTOM
static void
gegl_chant_init (GeglChant *self)
{
gegl_chant_init_properties (self);
}
static void
gegl_chant_class_finalize (GeglChantClass *self)
{
}
static const GeglModuleInfo modinfo =
{
GEGL_MODULE_ABI_VERSION
};
/* prototypes added to silence warnings from gcc for -Wmissing-prototypes*/
gboolean gegl_module_register (GTypeModule *module);
const GeglModuleInfo * gegl_module_query (GTypeModule *module);
G_MODULE_EXPORT const GeglModuleInfo *
gegl_module_query (GTypeModule *module)
{
return &modinfo;
}
G_MODULE_EXPORT gboolean
gegl_module_register (GTypeModule *module)
{
gegl_chant_register_type (module);
return TRUE;
}
#endif
struct _GeglChantO
{
gpointer chant_data; /* Unused by the chanting framework can be used by operations
* for storage of a private struct, (remember to clean up
* in finalize). Also serves as a filler making sure that we
* do not create an empty struct if there are no chanted properties.
*/
#define gegl_chant_int(name, nick, min, max, def, blurb) gint name;
#define gegl_chant_int_ui(name, nick, min, max, def, ui_min, ui_max, ui_gamma, blurb) gint name;
#define gegl_chant_double(name, nick, min, max, def, blurb) gdouble name;
#define gegl_chant_double_ui(name, nick, min, max, def, ui_min, ui_max, ui_gamma, blurb) gdouble name;
#define gegl_chant_boolean(name, nick, def, blurb) gboolean name;
#define gegl_chant_string(name, nick, def, blurb) gchar *name;
#define gegl_chant_enum(name, nick, enum, type, def, blurb) enum name;
#define gegl_chant_file_path(name, nick, def, blurb) gchar *name;
#define gegl_chant_multiline(name, nick, def, blurb) gchar *name;
#define gegl_chant_object(name,nick, blurb) GObject *name;
#define gegl_chant_pointer(name, nick, blurb) gpointer name;
#define gegl_chant_color(name, nick, def, blurb) GeglColor *name;
#define gegl_chant_curve(name, nick, blurb) GeglCurve *name;
#define gegl_chant_path(name, nick, blurb) GeglPath *name;\
guint path_changed_handler;
#include GEGL_CHANT_C_FILE
#undef gegl_chant_int
#undef gegl_chant_int_ui
#undef gegl_chant_double
#undef gegl_chant_double_ui
#undef gegl_chant_boolean
#undef gegl_chant_string
#undef gegl_chant_enum
#undef gegl_chant_file_path
#undef gegl_chant_multiline
#undef gegl_chant_object
#undef gegl_chant_pointer
#undef gegl_chant_color
#undef gegl_chant_curve
#undef gegl_chant_path
};
#define GEGL_CHANT_OPERATION(obj) ((Operation*)(obj))
enum
{
PROP_0,
#define gegl_chant_int(name, nick, min, max, def, blurb) PROP_##name,
#define gegl_chant_int_ui(name, nick, min, max, def, ui_min, ui_max, ui_gamma, blurb) PROP_##name,
#define gegl_chant_double(name, nick, min, max, def, blurb) PROP_##name,
#define gegl_chant_double_ui(name, nick, min, max, def, ui_min, ui_max, ui_gamma, blurb) PROP_##name,
#define gegl_chant_boolean(name, nick, def, blurb) PROP_##name,
#define gegl_chant_string(name, nick, def, blurb) PROP_##name,
#define gegl_chant_enum(name, nick, enum, type, def, blurb) PROP_##name,
#define gegl_chant_file_path(name, nick, def, blurb) PROP_##name,
#define gegl_chant_multiline(name, nick, def, blurb) PROP_##name,
#define gegl_chant_object(name, nick, blurb) PROP_##name,
#define gegl_chant_pointer(name, nick, blurb) PROP_##name,
#define gegl_chant_color(name, nick, def, blurb) PROP_##name,
#define gegl_chant_curve(name, nick, blurb) PROP_##name,
#define gegl_chant_path(name, nick, blurb) PROP_##name,
#include GEGL_CHANT_C_FILE
#undef gegl_chant_int
#undef gegl_chant_int_ui
#undef gegl_chant_double
#undef gegl_chant_double_ui
#undef gegl_chant_boolean
#undef gegl_chant_string
#undef gegl_chant_enum
#undef gegl_chant_file_path
#undef gegl_chant_multiline
#undef gegl_chant_object
#undef gegl_chant_pointer
#undef gegl_chant_color
#undef gegl_chant_curve
#undef gegl_chant_path
PROP_LAST
};
static void
get_property (GObject *gobject,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
GeglChantO *properties;
properties = GEGL_CHANT_PROPERTIES(gobject);
switch (property_id)
{
#define gegl_chant_int(name, nick, min, max, def, blurb) \
case PROP_##name: \
g_value_set_int (value, properties->name); \
break;
#define gegl_chant_int_ui(name, nick, min, max, def, ui_min, ui_max, ui_gamma, blurb) \
case PROP_##name: \
g_value_set_int (value, properties->name); \
break;
#define gegl_chant_double(name,nick, min, max, def, blurb) \
case PROP_##name: \
g_value_set_double (value, properties->name); \
break;
#define gegl_chant_double_ui(name,nick, min, max, def, ui_min, ui_max, ui_gamma, blurb) \
case PROP_##name: \
g_value_set_double (value, properties->name); \
break;
#define gegl_chant_boolean(name, nick, def, blurb) \
case PROP_##name: \
g_value_set_boolean (value, properties->name); \
break;
#define gegl_chant_string(name, nick, def, blurb) \
case PROP_##name: \
g_value_set_string (value, properties->name); \
break;
#define gegl_chant_enum(name, nick, enum, type, def, blurb) \
case PROP_##name: \
g_value_set_enum (value, properties->name); \
break;
#define gegl_chant_file_path(name, nick, def, blurb) \
case PROP_##name: \
g_value_set_string (value, properties->name); \
break;
#define gegl_chant_multiline(name, nick, def, blurb) \
case PROP_##name: \
g_value_set_string (value, properties->name); \
break;
#define gegl_chant_object(name, nick, blurb) \
case PROP_##name: \
g_value_set_object (value, properties->name); \
break;
#define gegl_chant_pointer(name, nick, blurb) \
case PROP_##name: \
g_value_set_pointer (value, properties->name); \
break;
#define gegl_chant_color(name, nick, def, blurb) \
case PROP_##name: \
g_value_set_object (value, properties->name); \
break;
#define gegl_chant_curve(name, nick, blurb) \
case PROP_##name: \
g_value_set_object (value, properties->name); \
break;
#define gegl_chant_path(name, nick, blurb) \
case PROP_##name: \
if (!properties->name)properties->name = gegl_path_new (); /* this feels ugly */\
g_value_set_object (value, properties->name); \
break;/*XXX*/
#include GEGL_CHANT_C_FILE
#undef gegl_chant_int
#undef gegl_chant_int_ui
#undef gegl_chant_double
#undef gegl_chant_double_ui
#undef gegl_chant_boolean
#undef gegl_chant_string
#undef gegl_chant_enum
#undef gegl_chant_file_path
#undef gegl_chant_multiline
#undef gegl_chant_object
#undef gegl_chant_pointer
#undef gegl_chant_color
#undef gegl_chant_curve
#undef gegl_chant_path
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, property_id, pspec);
break;
}
properties ++; /* evil hack to silence gcc */
}
static void
set_property (GObject *gobject,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
GeglChantO *properties;
properties = GEGL_CHANT_PROPERTIES(gobject);
switch (property_id)
{
#define gegl_chant_int(name, nick, min, max, def, blurb) \
case PROP_##name: \
properties->name = g_value_get_int (value); \
break;
#define gegl_chant_int_ui(name, nick, min, max, def, ui_min, ui_max, ui_gamma, blurb) \
case PROP_##name: \
properties->name = g_value_get_int (value); \
break;
#define gegl_chant_double(name, nick, min, max, def, blurb) \
case PROP_##name: \
properties->name = g_value_get_double (value); \
break;
#define gegl_chant_double_ui(name, nick, min, max, def, ui_min, ui_max, ui_gamma, blurb) \
case PROP_##name: \
properties->name = g_value_get_double (value); \
break;
#define gegl_chant_boolean(name, nick, def, blurb) \
case PROP_##name: \
properties->name = g_value_get_boolean (value); \
break;
#define gegl_chant_string(name, nick, def, blurb) \
case PROP_##name: \
if (properties->name) \
g_free (properties->name); \
properties->name = g_strdup (g_value_get_string (value)); \
break;
#define gegl_chant_enum(name, nick, enum, type, def, blurb) \
case PROP_##name: \
properties->name = g_value_get_enum (value); \
break;
#define gegl_chant_file_path(name, nick, def, blurb) \
case PROP_##name: \
if (properties->name) \
g_free (properties->name); \
properties->name = g_strdup (g_value_get_string (value)); \
break;
#define gegl_chant_multiline(name, nick, def, blurb) \
case PROP_##name: \
if (properties->name) \
g_free (properties->name); \
properties->name = g_strdup (g_value_get_string (value)); \
break;
#define gegl_chant_object(name, nick, blurb) \
case PROP_##name: \
if (properties->name != NULL) \
g_object_unref (properties->name); \
properties->name = g_value_dup_object (value); \
break;
#define gegl_chant_pointer(name, nick, blurb) \
case PROP_##name: \
properties->name = g_value_get_pointer (value); \
break;
#define gegl_chant_color(name, nick, def, blurb) \
case PROP_##name: \
if (properties->name != NULL) \
g_object_unref (properties->name); \
properties->name = g_value_dup_object (value); \
break;
#define gegl_chant_curve(name, nick, blurb) \
case PROP_##name: \
if (properties->name != NULL) \
g_object_unref (properties->name); \
properties->name = g_value_dup_object (value); \
break;
#define gegl_chant_path(name, nick, blurb) \
case PROP_##name: \
if (properties->name != NULL) \
{\
if (properties->path_changed_handler) \
g_signal_handler_disconnect (G_OBJECT (properties->name), properties->path_changed_handler);\
properties->path_changed_handler = 0;\
} \
properties->name = NULL; \
if (g_value_peek_pointer (value)) \
{ \
properties->name = g_value_dup_object (value); \
properties->path_changed_handler = g_signal_connect (G_OBJECT (properties->name), "changed", \
G_CALLBACK(path_changed), gobject); \
}\
break; /*XXX*/
#include GEGL_CHANT_C_FILE
#undef gegl_chant_int
#undef gegl_chant_int_ui
#undef gegl_chant_double
#undef gegl_chant_double_ui
#undef gegl_chant_boolean
#undef gegl_chant_string
#undef gegl_chant_enum
#undef gegl_chant_file_path
#undef gegl_chant_multiline
#undef gegl_chant_object
#undef gegl_chant_pointer
#undef gegl_chant_color
#undef gegl_chant_curve
#undef gegl_chant_path
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, property_id, pspec);
break;
}
properties ++; /* evil hack to silence gcc */
}
static void gegl_chant_destroy_notify (gpointer data)
{
GeglChantO *properties = GEGL_CHANT_PROPERTIES (data);
#define gegl_chant_int(name, nick, min, max, def, blurb)
#define gegl_chant_int_ui(name, nick, min, max, def, ui_min, ui_max, ui_gamma, blurb)
#define gegl_chant_double(name, nick, min, max, def, blurb)
#define gegl_chant_double_ui(name, nick, min, max, def, ui_min, ui_max, ui_gamma, blurb)
#define gegl_chant_boolean(name, nick, def, blurb)
#define gegl_chant_string(name, nick, def, blurb) \
if (properties->name) \
{ \
g_free (properties->name); \
properties->name = NULL; \
}
#define gegl_chant_enum(name, nick, enum, type, def, blurb)
#define gegl_chant_file_path(name, nick, def, blurb) \
if (properties->name) \
{ \
g_free (properties->name); \
properties->name = NULL; \
}
#define gegl_chant_multiline(name, nick, def, blurb)\
if (properties->name) \
{ \
g_free (properties->name); \
properties->name = NULL; \
}
#define gegl_chant_object(name, nick, blurb) \
if (properties->name) \
{ \
g_object_unref (properties->name); \
properties->name = NULL; \
}
#define gegl_chant_pointer(name, nick, blurb)
#define gegl_chant_color(name, nick, def, blurb) \
if (properties->name) \
{ \
g_object_unref (properties->name); \
properties->name = NULL; \
}
#define gegl_chant_curve(name, nick, blurb) \
if (properties->name) \
{\
g_object_unref (properties->name); \
properties->name = NULL; \
}
#define gegl_chant_path(name, nick, blurb) \
if (properties->name) \
{ \
g_object_unref (properties->name); \
properties->name = NULL; \
}
#include GEGL_CHANT_C_FILE
#undef gegl_chant_int
#undef gegl_chant_int_ui
#undef gegl_chant_double
#undef gegl_chant_double_ui
#undef gegl_chant_boolean
#undef gegl_chant_string
#undef gegl_chant_enum
#undef gegl_chant_file_path
#undef gegl_chant_multiline
#undef gegl_chant_object
#undef gegl_chant_pointer
#undef gegl_chant_color
#undef gegl_chant_curve
#undef gegl_chant_path
g_slice_free (GeglChantO, properties);
}
static GObject *
gegl_chant_constructor (GType type,
guint n_construct_properties,
GObjectConstructParam *construct_properties)
{
GObject *obj;
GeglChantO *properties;
obj = G_OBJECT_CLASS (gegl_chant_parent_class)->constructor (
type, n_construct_properties, construct_properties);
/* create dummy colors and vectors */
properties = GEGL_CHANT_PROPERTIES (obj);
#define gegl_chant_int(name, nick, min, max, def, blurb)
#define gegl_chant_int_ui(name, nick, min, max, def, ui_min, ui_max, ui_gamma, blurb)
#define gegl_chant_double(name, nick, min, max, def, blurb)
#define gegl_chant_double_ui(name, nick, min, max, def, ui_min, ui_max, ui_gamma, blurb)
#define gegl_chant_boolean(name, nick, def, blurb)
#define gegl_chant_string(name, nick, def, blurb)
#define gegl_chant_enum(name, nick, enum, type, def, blurb)
#define gegl_chant_file_path(name, nick, def, blurb)
#define gegl_chant_multiline(name, nick, def, blurb)
#define gegl_chant_object(name, nick, blurb)
#define gegl_chant_pointer(name, nick, blurb)
#define gegl_chant_color(name, nick, def, blurb) \
if (properties->name == NULL) \
{properties->name = gegl_color_new(def?def:"black");}
#define gegl_chant_path(name, nick, blurb)
#define gegl_chant_curve(name, nick, blurb)
#include GEGL_CHANT_C_FILE
#undef gegl_chant_int
#undef gegl_chant_int_ui
#undef gegl_chant_double
#undef gegl_chant_double_ui
#undef gegl_chant_boolean
#undef gegl_chant_string
#undef gegl_chant_enum
#undef gegl_chant_file_path
#undef gegl_chant_multiline
#undef gegl_chant_object
#undef gegl_chant_pointer
#undef gegl_chant_color
#undef gegl_chant_curve
#undef gegl_chant_path
g_object_set_data_full (obj, "chant-data", obj, gegl_chant_destroy_notify);
properties ++; /* evil hack to silence gcc */
return obj;
}
static void
gegl_chant_class_intern_init (gpointer klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->set_property = set_property;
object_class->get_property = get_property;
object_class->constructor = gegl_chant_constructor;
#define gegl_chant_int(name, nick, min, max, def, blurb) \
g_object_class_install_property (object_class, PROP_##name, \
g_param_spec_int (#name, nick, blurb, \
min, max, def, \
(GParamFlags) ( \
G_PARAM_READWRITE | \
G_PARAM_CONSTRUCT | \
GEGL_PARAM_PAD_INPUT)));
#define gegl_chant_int_ui(name, nick, min, max, def, ui_min, ui_max, ui_gamma, blurb) \
g_object_class_install_property (object_class, PROP_##name, \
gegl_param_spec_int (#name, nick, blurb, \
min, max, def, ui_min, ui_max, ui_gamma, \
(GParamFlags) ( \
G_PARAM_READWRITE | \
G_PARAM_CONSTRUCT | \
GEGL_PARAM_PAD_INPUT)));
#define gegl_chant_double(name, nick, min, max, def, blurb) \
g_object_class_install_property (object_class, PROP_##name, \
g_param_spec_double (#name, nick, blurb, \
min, max, def, \
(GParamFlags) ( \
G_PARAM_READWRITE | \
G_PARAM_CONSTRUCT | \
GEGL_PARAM_PAD_INPUT)));
#define gegl_chant_double_ui(name, nick, min, max, def, ui_min, ui_max, ui_gamma, blurb) \
g_object_class_install_property (object_class, PROP_##name, \
gegl_param_spec_double (#name, nick, blurb, \
min, max, def, ui_min, ui_max, ui_gamma, \
(GParamFlags) ( \
G_PARAM_READWRITE | \
G_PARAM_CONSTRUCT | \
GEGL_PARAM_PAD_INPUT)));
#define gegl_chant_boolean(name, nick, def, blurb) \
g_object_class_install_property (object_class, PROP_##name, \
g_param_spec_boolean (#name, nick, blurb, \
def, \
(GParamFlags) ( \
G_PARAM_READWRITE | \
G_PARAM_CONSTRUCT | \
GEGL_PARAM_PAD_INPUT)));
#define gegl_chant_string(name, nick, def, blurb) \
g_object_class_install_property (object_class, PROP_##name, \
g_param_spec_string (#name, nick, blurb, \
def, \
(GParamFlags) ( \
G_PARAM_READWRITE | \
G_PARAM_CONSTRUCT | \
GEGL_PARAM_PAD_INPUT)));
#define gegl_chant_enum(name, nick, enum, type, def, blurb) \
g_object_class_install_property (object_class, PROP_##name, \
g_param_spec_enum (#name, nick, blurb, \
type, \
def, \
(GParamFlags) ( \
G_PARAM_READWRITE | \
G_PARAM_CONSTRUCT | \
GEGL_PARAM_PAD_INPUT)));
#define gegl_chant_file_path(name, nick, def, blurb) \
g_object_class_install_property (object_class, PROP_##name, \
gegl_param_spec_file_path (#name, nick, blurb, \
FALSE, FALSE, \
def, \
(GParamFlags) ( \
G_PARAM_READWRITE | \
G_PARAM_CONSTRUCT | \
GEGL_PARAM_PAD_INPUT)));
#define gegl_chant_multiline(name, nick, def, blurb) \
g_object_class_install_property (object_class, PROP_##name, \
gegl_param_spec_multiline (#name, nick, blurb, \
def, \
(GParamFlags) ( \
G_PARAM_READWRITE | \
G_PARAM_CONSTRUCT | \
GEGL_PARAM_PAD_INPUT)));
#define gegl_chant_object(name, nick, blurb) \
g_object_class_install_property (object_class, PROP_##name, \
g_param_spec_object (#name, nick, blurb, \
G_TYPE_OBJECT, \
(GParamFlags) ( \
G_PARAM_READWRITE | \
G_PARAM_CONSTRUCT | \
GEGL_PARAM_PAD_INPUT)));
#define gegl_chant_pointer(name, nick, blurb) \
g_object_class_install_property (object_class, PROP_##name, \
g_param_spec_pointer (#name, nick, blurb, \
(GParamFlags) ( \
G_PARAM_READWRITE | \
G_PARAM_CONSTRUCT | \
GEGL_PARAM_PAD_INPUT)));
#define gegl_chant_color(name, nick, def, blurb) \
g_object_class_install_property (object_class, PROP_##name, \
gegl_param_spec_color_from_string (#name, nick, blurb,\
def, \
(GParamFlags) ( \
G_PARAM_READWRITE |\
G_PARAM_CONSTRUCT | \
GEGL_PARAM_PAD_INPUT)));
#define gegl_chant_path(name, nick, blurb) \
g_object_class_install_property (object_class, PROP_##name, \
gegl_param_spec_path (#name, nick, blurb,\
NULL, \
(GParamFlags) ( \
G_PARAM_READWRITE |\
G_PARAM_CONSTRUCT |\
GEGL_PARAM_PAD_INPUT)));
#define gegl_chant_curve(name, nick, blurb) \
g_object_class_install_property (object_class, PROP_##name, \
gegl_param_spec_curve (#name, nick, blurb,\
gegl_curve_default_curve(),\
(GParamFlags) ( \
G_PARAM_READWRITE |\
G_PARAM_CONSTRUCT |\
GEGL_PARAM_PAD_INPUT)));
#include GEGL_CHANT_C_FILE
#undef gegl_chant_int
#undef gegl_chant_int_ui
#undef gegl_chant_double
#undef gegl_chant_double_ui
#undef gegl_chant_boolean
#undef gegl_chant_string
#undef gegl_chant_enum
#undef gegl_chant_file_path
#undef gegl_chant_multiline
#undef gegl_chant_object
#undef gegl_chant_pointer
#undef gegl_chant_color
#undef gegl_chant_curve
#undef gegl_chant_path
}
static void
gegl_chant_init_properties (GeglChant *self)
{
self->properties = g_slice_new0 (GeglChantO);
}
G_END_DECLS
/****************************************************************************/
|