Re: [Re-posting] Adding object-specific properties to customobjects
From: Lars Clausen <lrclause cs uiuc edu>
To: dia-list gnome org
Subject: Re: [Re-posting] Adding object-specific properties to customobjects
Date: Sun, 09 Nov 2003 11:20:50 -0600
On 9 Nov 2003, Marco Contenti wrote:
> ----- Original Message -----
> From: "Marco Contenti" <m.contenti@libero.it>
> To: <dia-list@gnome.org>
> Sent: Friday, November 07, 2003 11:45 PM
> Subject: [Re-posting] Adding object-specific properties to custom objects
>
>
>> So, I'm going to implement this right away, but I'd like to:
>> 1. share what I'm doing with the community and, if possible, make it a
> part
>> of the Dia project;
>> 2. do it the most standard way possible;
>> 3. know if someone has already thought or made something, not to waste
>> effort.
>>
>> My ideas are: - use standard properties (of course); - use the existing
>> dia:attribute tag in .dia files; - create a new tag in .shape files to
>> describe attributes, supporting all standard types including composite;
>> - modify the custom object plug-in adding code that interprets
>> additional shape info and compiles PropDescription and PropOffset
>> accordingly, plus code to load and save the additional info. If I
>> understood well the Dia architecture, all this should be enough, and can
>> be accomplished in a matter of days.
>
> Getting more into detail, here is a s summary of changes in file formats
> required to implement custom object properties. The changes proposed
> consist in additions only and preserve backward compatibility with the
> present format.
>
> Again, Please let me know your comments and suggestions.
>
> Regards.
>
> Marco Contenti
> (m dot contenti at libero dot it)
> ----------------------------------------------------------------------------
> -------
> Proposed change to shape files (in .dtd notation)
>
> A new child type "properties" is added to the "shape" element:
[...]
> where "type" may be one of the standard property types: composite, int,
> enum, real, boolean, color, point, rectangle, string, font.
> The attribute element should be empty except for type composite.
These custom properties should work kinda like the "comment" attribute in
the UML class, in that it has rendering effect, but shows up in the
properties dialog, yes?
> The code loading shape info should automatically enclose all custom
> properties in a single composite attribute (say: "custom_properties") to
> avoid namespace conflicts with existing dia:attribute tags.
[...]
> Note: this is not really a change in .dia format, since the present
> syntax already allows this construct and such a file should be loaded by
> the present Dia without problems (ignoring the custom attributes). Also
> changed .shape files shouldn't cause problems.
Why have this extra attribute? You could just have the properties
internally named e.g. "custom:foo", and they would be saved along with the
rest of the properties, quite automagically.
-Lars
--
Lars Clausen (http://shasta.cs.uiuc.edu/~lrclause)| HĂ„rdgrim of Numenor
"I do not agree with a word that you say, but I |----------------------------
will defend to the death your right to say it." | Where are we going, and
--Evelyn Beatrice Hall paraphrasing Voltaire | what's with the handbasket?