On 2001.08.10 10:24 Cyrille Chepelov wrote:
> Also, your module is likely to set the properties of "this or that" object
> (UML classes, certainly). I'm currently rewriting the StdProp code, so that
> UML class and UML association become simple StdProp objects -- please see my
> recent announce post. One interesting effect is that you'll be able to *NOT*
> know what the internal structure of UML - Class (or whatever) is doing.
> What you'll be able to do is just pass a list of property values, and call
> class_object->ops->set_props(class_object,props).
> This is what xfig and dxf are already doing ; unfortunately, my rewrite
> completely changes the interface to do this (struct Property and the ways to
> access its data members changes).... I expect it to be committed, or at
> least in a visible and useable state by monday (the version I posted does
> not work -- I've fixed a few bugs since, and I can now proudly announce that
> it loads all samples and passes running under Electric Fence -- but I must
> fix the plug-ins ASAP so you can see how they do. And of course, I must use
> the shiny new "nested array" property types to let you modify the Class
> object through the StdProp interface).
About that... I've gotten as far as being ready to set the "name" property of
the UML class (may not have the terminology correct here...still learning the
StdProp interface), but now I'm kind of stuck and could use some help.
The code leading up to it is:
/* these should be probably changed to more useful defaults
eventually */
startpoint.x = 0.0;
startpoint.y = 0.0;
umlclass_obj = otype->ops->create(&startpoint, otype->default_user_data,
&h1, &h2);
layer_add_object(layer, umlclass_obj);
props = prop_list_from_descs(sql_prop_descs, pdtpp_true);
g_assert(props->len == 11);
which should look familiar, because I just nicked it from dxf-import.c and
renamed some variables. In the next line, I think I need to set up the "name"
property of UML class I created in umlclass_obj. In the DXF import plug-in, you
have:
((PointProperty *)(g_ptr_array_index(props,0)))->point_data.x = start.x;
and I assume I need to do something similar, but with different casts and
structure references. Where should I look to relate the 4th element of
sql_prop_descs:
{ "name", PROP_TYPE_STRING, PROP_FLAG_VISIBLE, N_("Name"), NULL, NULL },
to the type of structure pointer cast I need to do?
Also, of course I was wondering if there was some luxurious plug-in writer's
documentation I could add this to once I figure it out? If not, I can attempt
to cook one up while I'm doing this.
Thanks,
Andy