Remove necessity for defineShapeWithClass; magically fix line and rect drawing

I decided to try writing out the CoffeeScript class code by hand to get a cleaner interface to `defineShape`. It worked.

I also fixed a bug in the eraser that was probably masked somehow - it was only setting eraser-mode on the main context, not the buffer context.

Somehow this also fixes the rect/line bug I was seeing.

There's still an unrelated bug with the text tool's editor. Not sure what's causing it yet, but it's probably unrelated. Will fix before merge anyway.