I just thought I would post something about the code I am working on in
dia at the moment -- the properties interfaces.

These interfaces give a standard way to programatically get or set
properties (eg. border width, text font, etc) of an object in dia.  For
more information on this, see some of the earlier posts in the archives
at:
  http://www.mail-archive.com/dia-list@lysator.liu.se/

The new code adds three new methods to objects: describe_props, get_props
and set_props.  Describe_props passes back an array of PropDescription
structures describing the properties of an object.  Get_props returns the
current values of properties, and set_props sets the properties.
Describe_props is not an object type method, as the properties may not be
the same for all instances of an object type (the group object being a
good example -- its properties should be dependent on the grouped
objects).

The information from the properties interface is usually enough to
construct the properties dialog for a particular object.  This cuts down
on the ammount of work for the person writing the object.

I have converted the flowchart/box object over to using the properties
as a test case.  It has reduced the code size by a fair ammount (there is
still a bit of dead code I haven't trimmed out yet, but it looks like it
cuts off around 100 lines of code).  The automatically generated
properties dialog works pretty well, and even undo with it works
correctly.  It doesn't seem to crash either, which is good :)

The following lists a number of things that still need to be done with
respect to the properties interface:
 1) convert more objects to new interface.  This will probably also help
    find problems with the implementation.
 2) Add ability to add extra properties to custom shapes.  This would
    allow you to add some non visible data to certain shape types, which
    could be useful if exporting diagrams to some other format.
 3) Add support in the python plug-in.  The plug-in should then be
    powerful enough to do things such as extracting the information from a
    UML diagram for use with a code generator for instance.

If you find any problems with the interface, or have any comments, post
them on the list.

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/

Reply via email to