Today, after much procrastination I started to work on selections. The first step was to figure out how to draw the marching ants. Somehow the method of drawing little lines on the border of a rectangle by hand didn't seem right. So I made a photoshop image, in which I had a layer with a little one pixel wide "slit", behing which I could place a pattern. It turned out that if you had a pattern of diagonal stripes, and moved it slowly sideways, you got the effect of marching ants. Surely enough, in the resource fork of the Photoshop application, there was such a pattern.
The next step was to figure out the shape of the selection. I decided that regions would be most appropriate for storing it, since they allow many operations to be done to them, like union, difference, etc. which would be useful in the future when I add additive/substractive selections (again, just like photoshop). It turned out that I needed two regions, one to store the shape at the real size, and one for displaying it at a magnified size. To get the outline of a selection I simply made a copy, did an InsetRegion, and then a difference between the two. Then I filled it with the pattern, and I got the marching ants. I added a currentMarqueePattern counter to the class, and used that to cycle among them. It worked beautifully, except the drawing was too fast (and this was just on my 8500, it would have been even faster on a G3). So I added another counter, which measure the ticks from the last time the pattern counter was incremented, and limited it so that it would move once every two ticks. This way there should be a constant speed on all machines (unless they're so slow that it takes more than two ticks to update the marquee, then it would still draw as fast as it can).
So, I got my selections to draw, but you can't move them around (yet).
I think I should create a global structure in which I should store all the frequently used resources, like the marquee patterns and the cursors, so that I don't have to keep on loading them everytime....