Re: Patch to custom object: object-specific properties (preliminary)



----- Original Message -----
From: "Lars Clausen"
Sent: Wednesday, November 26, 2003 6:25 PM

Reloading is a separate issue, let's get the attributes for shapes thing
right first.
Agree.

I applied your patch (though didn't commit that yet), and notice that you
actually do what I was suggesting, kinda.
I think it's really too preliminary to commit. I'm still making changes and
will send an update quite soon.

You're adding the custom
attributes to the normal attributes in describe_props (I think it should be
a part of shape loading, then we're sure it's done in time).
Among the changes I made, I needed to check whether custom_describe_props
has been called before custom_load, to avoid a crash.

However, the saving part didn't seem to work.
Strange, it works fine to me, the code is there, at the end of custom_save.
If you send me your test case, I'll try tomorrow (it's getting late in my
time zone).

I tried replacing the save function with object_save_using_properties,
and it saved nicely (though without the 'custom:' prefix).
I didn't even know of that function, my knowledge of Dia internals is really
limited.

You should be aware of the distinction between 'name'
and the 'description' field of the props -- 'name' is only for internal
identification (including in the save format), while 'description' is
what's shown in the dialog.  You're using the same string for both, and
then doing a hack in saving to mark them as custom.  I'd suggest adding the
"custom:" mark in the name as soon as you create the property, then you're
sure you won't be confused about when it's there.  Essentially, it should
be done for the ShapeInfo, not for the Custom.
I'll check this, I should also add more attributes to the XML tag to
describe it better (description, default value...).

Using object_load_using_properties to load (wrapped to give appropriate
type) is a mite trickier, as you'll need to ensure the right shape is used
in time for the rest of the load.  Moving the addition of extended
attributes into the ShapeInfo creation code should help with this.
How should I use these functions and what's the advantage?

You may want to ocnsider if the shape designer should be able to specify a
default value.  It'd have to be used in custom_create.
See above.

Marco




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