[PythonCAD] state table?

Russ Nelson nelson at crynwr.com
Thu Jun 8 22:23:46 CEST 2006


I've been looking at the way various components get specified, and
there seems to be a fair amount of overlap.  And yet the callback
system of gtk doesn't lend itself well to subroutines.  I wonder if it
might be a great simplification to have a state table?

Instead of changing the callback handlers, they would stay the same,
and do different things depending on the current state.  So, for
example, an angled construction line takes:

State    Pointer       Entry               Action      Next State
 21      a click       a pair of points    Save Point       22
 22      rubberband    an angle            Save Angle       23
 23                                        Add ACLine at Point, Angle

This needs more fleshing out with details, but I think you can see
that it would eliminate a lot of code, and allow new commands to be
added without needing to reinvent rubber-banding every time.  Should I
continue the design, or is this a bad idea?

I don't know how this design change would affect the Cocoa interface,
if at all.

-- 
--my blog is at    http://blog.russnelson.com   | When immigration is
Crynwr sells support for free software  | PGPok | outlawed, only criminals
521 Pleasant Valley Rd. | +1 315-323-1241       | will immigrate.  Illegal
Potsdam, NY 13676-3213  |     Sheepdog          | immigration causes crime.


More information about the PythonCAD mailing list