Custom Event Filters Rock My World #

I only did a very simple thing today, but it'll aid me in testing. When the "Do you want to save..." dialog shows up, it has three buttons. The default is mapped to return/enter, cancel to escape, but the don't save one (which I'll most likely be using when testing has to be clicked manually). To get rid of this annoyance, I added a check in the custom dialog filter, to see if the the key being hit equaled the first letter of the third button, and if it did to simulate a click there. So now I can just hit the D key to click the "Don't Save" button. Very small, but otherwise when quitting i'd have to click thet button for each open editor.

Overlays #

I've noticed that when quitting, if you clicked cancel, it would just keep asking you if you wanted to save. So I added a simple check to continue with the quitting process if the CloseIcon function returned true, otherwise we go back into the EventLoop function.

Then I worked on improving the overlay. The overlay is used for the rectangle, line and lasso tools. Basically it provides another (temporary layer) for displaying stuff (ie for the rectangle it is used to show the size of the rectangle being drawn, and only when the user lets go is it actually drawn on the icon's pixmap). Until now, when I created the overlay I used the current depth and color table. However, I realized that this was unecessary. All it needed was to have a 2 color color table, with the foreground color, and the transparent one (actually until now I was using white for the transparent color, which caused problems when drawing white lines). The transparent color is the same one that's used for determining the shape of irregular selections pasted in from other programs, 0xFFFFFE.

Dragging: I 0wnz j00 #

I finally managed to squash the bug. When dragging, if there is a selection, I have to merge it with the current icon contents, and put that into the drag image. After the drag I had a check to see if the temporary gworld was created (which contained the merged data) and it would dispose of it. The check for this was whether or not there was a floated selection. However when dragging to the current gworld, a floated selection wold be always created, so it would attempt to dispose of the temporary gworld (which wasn't there, and it was grabbing the source).

Then I worked on one of the final human interface additions, the "Do you want to save...." alert. This was rather simple, I used the StandardAlert function to display a movable dialog, and specified the buttons as "Save", "Cancel", and "Don't Save". The hardest part was writing a string search and replace function, so that I could include the file name in the prompt string. I also made it so that these dialogs show up when quitting, if an icon hasn't been saved.

The Quest Continues... #

Tried to work some more on that bug some more, but the absence of the debugger prevented (I think it'll work once I install the 3.1 update, but it didn't finish downloading before class was over). Again, no time to work on it at home.

Curiouser and curiouser #

I've found this very weird drag and drop related bug. When dragging from a size to the current size, the source gworld would get set to null. This is very weird since I'm not supposed to be changing it at all. Debugging was rather hard at school (since the debugger doesn't work :p) and I didn't have any time to work on it at home.

Happy Birthday #

[15 years ago the Mac 128K was introduced]

I tweaked the state saving some more, so that when clicking on a different icon size, an undo would bring you back to your previous position.

Another Day, Another Bug(s) Squashed #

First thing I did today was to fix an undo bug. When switching between different sizes, the drawing area has to be resized (obviously). However, when undoing this change, the drawing area would not get resized. It turned out that when I redid the size switching part of the HandleContentClick function I changed the order in which the state was stored and the new size was set. While I was doing this I also removed some redundant MagnifySelectionRgn calls, and made the ones left in check to see if there was a selection in the first place.

Then I worked on removing leaks in clip2icns (it leaked about 1K for each icon viewed, and 5K when the current icon was exported to the clipboard). Using Spotlight it was rather easy, it turned out I wasn't disposing of the picture after I had placed it in the clipboard. I had also missed disposing a GWorld.