Re: access to custom object properties in plugin



But for the core of
plugin i must use the property of object. Example i have an object :

dia/objects/Bay/boundary.c
...
typedef enum { BAY_BOUNDARY_BEGIN, BAY_BOUNDARY_END } BayBoundaryValue;

/* Object Boundary definition */
typedef struct _Boundary {
   Element element;

   ConnectionPoint connections[BAY_BOUNDARY_NUM_CNX];

        /* Custom inner color */
   Color fill_color;

        /* boundary type */
   BayBoundaryValue value;
}
...

and in my plugin  : dia/plugin/foo/render_foo.c
I have an object DiaObject *obj with the type defined in boundary.c
it's good BUT now i would like acces to property "value" ??
My question is  : How to do that ?


Oh i'm alone here ;)
Ok for my last question i found myself the answer. Pffff ! Dia is very good but the doc is very light :)
for my problem i use "object_prop_by_name" like this :

dObj = (DiaObject *)list->data;
type = object_get_type(object_get_displayname(dObj));
if(!strcmp(type->name,IVR_BAY_BOUNDARY)){
        dia_assert_file(FALSE,"Boundary object found\n");
        /* test boundary begin */
        /*
           get propertie
           see lib/properties.h
           see lib/prop_intypes.h
           StringProperty : string_data
           EnumProperty : enum_data
        */
        prop = object_prop_by_name(dObj, "value");
        val = ((EnumProperty *)prop)->enum_data;
        if(val == BAY_BOUNDARY_BEGIN){
                /* ... */
        }
                
It's work... that's cool ! I like dia :)
It's time for me to finish my plugin.

Thanks for you attention ;)

Hum when my lib an plugin will be ready who i contact for a possible addition in dia ??

lidiriel




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]