Re: Named connection points?



Since you understand your need and desire for documentation better than anyone, perhaps you are the best one to add the explanation?

M

On Sat, Feb 18, 2012 at 3:34 PM, Dan Katz <dpkatz bc gmail com> wrote:

On Feb 17, 2012, at 3:43 PM, Hans Breuer wrote:

> But I don't see why you could not use named constants for the connection point index instead.
> The connection points are parsed in the order in the shape (see objects/custom/shape_info.c) and put into the connection point array in that order.

Ah - so the ordering of the connections points is guaranteed to be stable?  In that case, I agree that connection point order is a reasonable way to do this.

I didn't do that to begin with because I couldn't convince myself that the order was stable - there was nothing I saw in the Custom Shape Module documentation online or in the comments of the custom shape code that  made clear that this was part of the API.  Did I miss something in the documentation?  If not, perhaps it would be useful to add a line to the Custom Shape Module documentation (http://dia-installer.de/doc/en/custom-shapes-chapter.html) that programmers can depend on the ordering stability of the connection points.

> In any case (either with index or names) you have to ensure that your script and your shapes are matching.

Yes of course.  I think it's a bit easier with names because you can introspect on them in the python REPL using 'dir' and 'help' and such, but looking up the text of the shape module isn't very hard either.  It's a bit harder with built-in shapes since you have to read the C code for those, but that's not my use case here.  I consider that the having a stable ordering of connection points is sufficient for my purposes.

Thanks.

Dan
_______________________________________________
dia-list mailing list
dia-list gnome org
http://mail.gnome.org/mailman/listinfo/dia-list
FAQ at http://live.gnome.org/Dia/Faq
Main page at http://live.gnome.org/Dia




--
Put this question to yourself: should I use everyone else to attain happiness, or should I help others gain happiness?  
Dalai Lama 

To invent, you need a good imagination and a pile of junk.
Thomas A. Edison

A public-opinion poll is no substitute for thought.
Warren Buffet

Michael E. Ross
(919) 550-2430 Land
(919) 576-0824 Google Phone
(919) 631-1451 Cell
(919) 513-0418 Desk

michael e ross gmail com






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