Undo Bugs, Swatches #

Main thing I did today was to remove (yet another) annoying undo bug. Actually it was a couple of bugs. One was when I was restoring the selection, I was using UpdateGWorld to reset the selection GWorld to the proper size. However, once in a while it simply wouldn't change the selection bounds, resulting in part of the selection being garbage. When I replace the UpdateGWorld with a DisposeGWorld and NewGWorld, everything worked. Weird, but in some ways the new is even better (since UpdateGWorld allocates temporary memory to save the current contents, but I didn't care about that).

The second bug was more of an error in thinking. When a selection was made, I didn't set the hasSelection bit of the status right away, instead that was in my DoIdle function, which periodically looked to see if the selection region was empty, and if it was then the bit would be set. However the storing of the state came before the DoIdle, so the status that was saved had the hasSelection bit off. Fixing this was rather simple, I added a check after the selection tools or commands were used, and this came before the state was saved.

Finally I tried to make the code look much more professional by using a generic linked list class. My idea was to use templates, and then to derive my icns editor and drawing state classes from that (they both use linked lists to keep track of the open editors/saved states). I got to the point where I had a basic framework, and as a simple test (before I went in and tore out all the old code) I was making a simple program to have a linked list of integers. However, it won't compile, and the error it gives is that the constructor of the linked list class is bad. The Metrowerks site says that CodeWarrior Pro 4 has soem new features/fixes relating to templates, so I'll try it again on Monday, with the newest version (and if it works then I guess I'll have to upgrade). Speaking of CW Pro4, earlier I had said that it wasn't fully Appearance Manager savvy. However it turns out I was wrong. Instead it's Kaleidoscope's fault, since it doesn't patch all the AM controls (which CW seems to be using).

Finally I worked on making the color swatch control more like Photoshop's. This meant adding the two little widgets in the top-right/bottom-left corners, the one to swap the fore/background colors and the one to reset them to black/white. This also involved adding icons (for the controls, with an active and inactive state each) to the statics structure (since they're shared by all the editors). All that remains now are the preferences, I hope.

Post a Comment