Re: Dia VDX plug-in 0.1



On Fri, 2006-05-12 at 11:29 +0200, Lars Clausen wrote:
On Thu, 2006-05-11 at 13:33 +0100, Ian Redfern wrote:
> I've been working on a plug-in for Dia to allow it to read Visio VDX
> files.

I'm *very* glad to hear that.  I'd been just about to myself, but had to
put the new release in front.  I'd like to get your code into the main
code quickly, but I also want it to be good so it's not too hard to get
it to a high level of compatibility.  For that, I'd like to 1) do a code
review with you soon, please let me know when would be good for you, and
2) set up some automatic regression testing for the importer.
Sounds excellent to me. Much of the code is not yet production quality, as I'm still exploring the GLib, libxml and Dia APIs. I would appreciate guidance as to whether I'm using them sensibly before I write anything more. I'm then happy to redo anything that isn't up to scratch - I have to do a major rewrite anyway to handle Masters, and the uglier experimental parts of the current code (plot_text, vdx_add_shape) won't survive in their current form.

I'm happy for the code to get into CVS as soon as it's good enough - I expect to be making a lot of changes over the next couple of months. I thought I'd get it out now, when it at least handles some real files, before I made any lasting mistakes. Code review - most times over the next couple of weeks - contact me directly to arrange details.

> I've not done XML parsing in C before, and it shows - I may switch to a
> generic string-based internal model, rather than C structures, as it's
> much more flexible.

You have looked at what the diagram loader and other XML-using parts of
Dia does, right?
I looked at the SVG and xfig importers, but unfortunately the VDX format can't be parsed locally - it uses a lot of inheritance and context. For example, a Geom element can contain a drawn box, or the bounding box of a later Text element - and you don't know which until you read to the end of the enclosing Shape and see if it contains a Text element. You also don't know how to draw anything until you look through its stylesheet inheritance chain for the relevant fill, line and text styles. Masters get even worse - and then there's partial deletions...

I've tried parsing the XML tree into (sometimes polymorphic) C structures for future reference, and that works, but it leads to a lot of boilerplate. There are over 60 Visio structures with a total of over 600 members - most of these aren't needed, but probably over 100 will be. Many of these structures that affect a single drawing object can be in multiple places in the document - in Masters, in StyleSheets and locally. They also get aggregated, and I don't think I can create the Dia object until the actual Shape, so I need an intermediate format. Maybe I should stick with C structures and just write lots of small constructors, but I'm open to ideas - I can probably automate their generation, like I did for visio-types.h, which will strip out a lot of the current junk.

I've tried to stick to GArray, GSList and XML tree walking, plus the Dia interface code I've lifted from xfig-import.c.

Advice and suggestions welcome!

-Lars

_______________________________________________
Dia-list mailing list
Dia-list gnome org
http://mail.gnome.org/mailman/listinfo/dia-list
FAQ at http://www.gnome.org/projects/dia/faq.html
Main page at http://www.gnome.org/projects/dia


Ian Redfern MIET
Telecoms Consultant
_________________________________________
LogicaCMG - Releasing your potential
75 Hampstead Road
London NW1 2PL, UK
T: +44 (0) 20 7637 9111
E: Ian Redfern LogicaCMG Com
www.logicacmg.com


This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.



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