I have been experimenting with doing something
like that, too. Why? I want to be able to have a set
of "idiot-proof" objects for a Dia user to lay out a
computer network diagram. For example, the user
shouldnt be able to connect something like a PC object
directly to something like a microwave transmitter
object. Or, a USB printer object shouldnt be
connectable to a 10BaseT repeater object.
I had pretty good success with the following (crude!)
approach:
1. hack diagram_update_connections_object()
to force a redraw of the connected object
2. for specific objects that you want restricted
connection functionality, add code to the
DrawFunc routine to analyze (and disconnect
as appropriate) the objects that are
connected.
Definitely not ideal (DrawFunc gets fired for a
variety of reasons), but it worked.
--- Lars Clausen <lrclause@cs.uiuc.edu> wrote:
> On Wed, 23 Oct 2002, ml@knorke.in-berlin.de wrote:
> > Hi,
> >
> > I think about writing a new dia module, where
> certain
> > objects can be connected only to certain others.
> (How) can
> > I disallow connections between arbitrary objects?
> I.e. I
> > have object types A, B, and C - while connections
> between
> > A-B and A-C are allowed, but B-C should not be
> possible.
>
> That's a good question. There's no callback on
> connection, so there isn't
> a direct way to do that. Can you give an example of
> where this would be
> useful? Wouldn't be hard to add something to ask
> the object if it'll
> accept the connection, and have it default to always
> accepting.
>
> -Lars
>
> --
> Lars Clausen (http://shasta.cs.uiuc.edu/~lrclause)|
__________________________________________________
Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site
http://webhosting.yahoo.com/