Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site spice.cs.cmu.edu Path: utzoo!watmath!clyde!bonnie!akgua!gatech!seismo!rochester!pt.cs.cmu.edu!spice.cs.cmu.edu!tdn From: tdn@spice.cs.cmu.edu (Thomas Newton) Newsgroups: net.micro.mac,net.sources.mac Subject: A program and a flame. . . Message-ID: <480@spice.cs.cmu.edu> Date: Sun, 10-Nov-85 05:28:08 EST Article-I.D.: spice.480 Posted: Sun Nov 10 05:28:08 1985 Date-Received: Tue, 12-Nov-85 06:29:41 EST Organization: Carnegie-Mellon University, CS/RI Lines: 62 Xref: watmath net.micro.mac:3406 net.sources.mac:710 A while back, someone posted a desk accessory sampler program which was called "Whitman's 'Desk Accessory' Sampler" to the net. This program was distributed as shareware, with a fee of $10. My first reaction upon using the program was that it performed a useful function but that it must have been utterly trivial to write, given the Mac's support for resources (such as desk accessories...). Thus, I stopped using the program (rather than forking over $10 or using it on a regular basis without paying for it), and resolved to write and give away my own program to do the same thing. On Friday night, I decided to kill some time, so I sat down at my Mac with my copies of Megamax C v2.1, Inside Mac, and SKEL 2.2.3C. By the time that I was ready to go to sleep, I had the program working with the exception that (a) it didn't do anything in response to the "About..." menu item, and (b) it didn't have a special icon. A lot of the time that I spent on it was occupied by one of two tasks: (a) cutting things out of SKEL that my program didn't need, and (b) replacing "#include" statements with selected definitions from the Megamax header files (I have a 128K Mac, and MMC 2.1b tends to run out of symbol table space on 128K Macs for programs that have lots of "#include" statements). As of some time tonight, I finished up the task of making an "About..." dialog box and a special icon for the program and was finished. The advantages that my Desk Accessory Sampler has over the other version are: 1. It's free. You don't need to make a choice between giving up $10 or giving up the use of the program in order to be honest. 2. It comes with source code. If you think that it could use any changes, you can hack on it to your heart's content. 3. It changes the highlighting status of the "Close" menu item to let you know whether or not you currently have a resource file open (the shareware program doesn't give any such indication). (Note: as in the other program, "Open" can be selected while a resource file is open; in this case, the program closes the old resource file before opening the new one.) 4. It provides all five of the standard editing commands (UNDO, CUT, COPY, PASTE, CLEAR) in the EDIT menu, as opposed to the three (CUT, COPY, PASTE) supported by the shareware program. Note: I was really amazed to see this -- setting up a menu with all five commands is *very* easy (as in "editing cmd # = menu item #-1"). 5. It attempts to avoid situations of the type "there is an accessory running whose resource file we have just closed" since these lead directly to system crashes. Unfortunately, I don't know of a good way to keep track of which accessories are active (while OpenDeskAcc returns a reference number if it succeeds, it may return garbage if it fails). The approach that my program takes, therefore, is to try to close every driver with a resource ID between 12 and 31; this seems to work fairly well. It certainly works better than the approach of doing nothing and letting the system crash and burn. . . 6. It has a toggle switch in the FILE menu that allows you to open *any* Macintosh file and use its "DRVR" resources. This isn't a very major feature; on the other hand, it wasn't hard to put in . . . It's bad enough that someone is trying to collect money for a program that is obviously doing very trivial things. What's even worse is that it isn't even very competent at what it does do!!! Is it too much to ask that people refrain from marking every hack they throw together as shareware requiring a donation for continued use? Anyway, I'm posting both the program's source form (Sampler.c, Sampler.R) and its binary form (Sampler.Hqx) to net.sources.mac. Enjoy. -- Thomas Newton Thomas.Newton@spice.cs.cmu.edu