Re2: extending dia



Hi,

What I need to do is write an extension to dia. I guess I'll have to
write C-code (I'd be more comfortable with C++, do I have to use C?). I
need the ability to introduce custom shapes that have properties
dialogs, that let me set internal parameters, that would mostly only
effect the xml, not stuff that happens on the dia screen.
That (and an xml parser which I would have to implement) would give me
an extremely powerful and easy to use cybernetics/artificial neural
networks ... simulator.


Could probably be done. Depending on what your exact needs are, it could be
possible to implement everything as plain dia files with custom shapes (in
dia parlance = bits of SVG) and then parse the generated dia files into your
application. Or, you could indeed write full-fledged objects (= C code) to 
handle the cases too complex to be handled by simple SVG. It could be
possible to write parts in C++, but you'd still have to provide a complete C
interface, and at this point you'd be spending most of your time converting
between the C API and your C++ stuff -- I can't estimate whether it would be
worth the trouble.

I've just written an extension to ease drawing cybernetic diagrams. It
might even be of general interest ... where should I send it?

My precise requirements:
I have written shapes in xml/dia/svg. That approach could completely
cover my drawing needs. I do however need a way to add "invisible"
properties to my shapes. These properties - parameters - would be edited
in property dialogs like the ones for UML but would assumedly only
necessarily affect the xml output of dia.
It might be possible to hack this in xml using the textbox, but that
seems to be a rather dirty approach that would also make for ugly
parsing in my backend.
The ideal would look somehow like this:
Let's assume I want to have an element that represents a line-function
(y = slope*x + offset). I edit the xml/svg file:
[.. header, connections ...]
        <attribute name="slope">
                <real val=""/>
        </attribute>
        <attribute name="offset">
                <real val=""/>
        </attribute>
[... shape definition in svg ...]
If I create that shape in dia, I can set slope and offset in the
properties dialog - the displayed shape would not be affected, but the
values would be stored in the *.dia file in xml.
As far as I can tell that is not yet possible, right?
It might also be nice to have svg:text supported, but that might not be
essential.
So, what do you think? How much effort?

 




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