Ressurection #

This was the first program that I released publically, it's a simple tool to insert 'cicn' (color icon) resources into Kaleidoscope schemes (Kaleidoscope uses 'cicn's as its primary storage method, and the editor that ResEdit provides is limited (can't create icons with a size bigger than 64 x 64, can't import custom color tables) and broken (it thinks resources with a size above 32K are corrupted), so I made this free insertion tool (this is all happened in the beginning of the summer of 1998). Since then it had been pretty much left alone, since it seemed to cover everyone's needs, and as a freeware niche product it had no competition and I had no incentive to add features. After I had finished the initial work on Icon Mangler (as Iconographer was then known) I decided that it had fallen behind enough that it needed an upgrade (I had created a similar program, clip2icns, designed to insert and extract 32-bit icons, this one was shareware and did have competition so it was updated more often), so I merged the source code, so that it could have the UI-style that I had create for clip2icns. I had started on this in April, but got distracted after a few days, and forgot about the whole program until I got back from Stanford in August. Then someone asked me if I could fix a bug in it, and I realized that the new version that I had been working on had that fixed, so I finished it up and released it. I had thought that this would have been the end of it, especially since I gave the source code to some else who was working on a full Kaleidoscope editor.

Then last week someone contacted me about adding a feature (extracting 'cicn's to the clipboard, essentially the opposite of the current command which took the clipboard and put it in a 'cicn' resource). Considering that clip2icns already had a similar feature, and that Iconographer included full copy and paste support, I figured that I knew enough about the Scrap Manager (that's what's used to manage the clipboard) to do this. I opened up the clip2cicn CodeWarrior and its associated resource file, and added an Extract button to the dialog (this required a reorganization of the dialog layout, since it was getting rather wide) and then the relevant code so that it would beep when clicked (as a place holder for the eventual cicn2clip funnction). Then when I tried to compile and run it, I discovered that I got all these errors about functions that didn't exist in my commonFunctions.c shared file. Then I remembered that I had begun to convert my code to Carbon (which makes some structures, e.g. dialogs and controls), and so some of those functions didn't work with the standard Toolbox. In the end I had to create a special version of the Universal Headers (I have them precompiled so compile times are faster) with the Carbon flags turned off, and include that in clip2cicn. After this little hidrance, I implemented a basic version of the cicn2clip function. My main problem was that the resource contained a normal PixMap, but I couldn't use CopyBits with it, since the pointer to the pixel data was screwed up (when the PixMap is stored, the pointer becomes meaningless, since chances are very small that it'll be loaded in the exact same location in memory). I used the function PlotCIcon to draw it into a 32-bit GWorld, and the exported that to the clipboard. I sent off the new version to the user who had requested the feature, and he liked it, except that I wasn't extracting the custom color table. In the end I figured out how to fix the pixel data pointer (the 'cicn' handle included a part where the icon data was stored, so I set the pointer to the address of the resource plus the offset to the pixel data), and did a CopyBits straight from the icon into the picture I was putting in the clipboard, and that seems to work perfectly. Another user also asked me to fix/add some IDs in the pop-up menus I provide for the easy selection of the 'cicn' that should be inserted/extracted, so I did that too.

And now that I think about it the person I gave the source code to still hasn't done anything with it. I guess the moral of this long-winded, not-very-interesting story is that you should never throw any code away, or give up any project for dead.

Post a Comment