home *** CD-ROM | disk | FTP | other *** search
/ Carousel Volume 2 #1 / carousel.iso / mactosh / code / cshar_sa.sit < prev    next >
Encoding:
Text File  |  1988-06-20  |  22.3 KB  |  723 lines

  1. 18-Jun-88 14:53:08-MDT,23484;000000000001
  2. Return-Path: <u-lchoqu%sunset@cs.utah.edu>
  3. Received: from cs.utah.edu by SIMTEL20.ARPA with TCP; Sat, 18 Jun 88 14:52:42 MDT
  4. Received: by cs.utah.edu (5.54/utah-2.0-cs)
  5.     id AA22829; Sat, 18 Jun 88 14:52:36 MDT
  6. Received: by sunset.utah.edu (5.54/utah-2.0-leaf)
  7.     id AA24902; Sat, 18 Jun 88 14:52:33 MDT
  8. Date: Sat, 18 Jun 88 14:52:33 MDT
  9. From: u-lchoqu%sunset@cs.utah.edu (Lee Choquette)
  10. Message-Id: <8806182052.AA24902@sunset.utah.edu>
  11. To: rthum@simtel20.arpa
  12. Subject: sampler.c.shar
  13.  
  14. #! /bin/sh
  15. #
  16. # This is a shell archive.  Save this into a file, edit it
  17. # and delete all lines above this comment.  Then give this
  18. # file to sh by executing the command "sh file".  The files
  19. # will be extracted into the current directory owned by
  20. # you with default permissions.
  21. #
  22. # The files contained herein are:
  23. #
  24. #   10 sampler.c
  25. #    5 sampler.doc
  26. #    6 sampler.r
  27. #
  28. echo 'Extracting sampler.c'
  29. if test -f sampler.c; then echo 'shar: will not overwrite sampler.c'; else
  30. sed 's/^X//' << '________This_Is_The_END________' > sampler.c
  31. X/***************************************************************************/
  32. X/*      Desk Accessory Sampler                           */
  33. X/*                                       */
  34. X/*      Copyright (C) 1985 Thomas D. Newton                      */
  35. X/*    Based on SKEL 2.2.3C by Steve Maker, translated by Bill Jefferys   */
  36. X/*    Modified to Consulair C by Brian Bechtel 11/20/85           */
  37. X/*                                       */
  38. X/*      This program may be copied, used, and modified freely so long as   */
  39. X/*    it is only done for noncommercial purposes, this copyright notice  */
  40. X/*      remains attached to any copy of the program, and any modified      */
  41. X/*      version carries a comment identifying who last changed it.         */
  42. X/*                                       */
  43. X/* This program has a similar function to the shareware "DA Sampler" which */
  44. X/* appeared a while back on net.sources.mac.  My reaction to the shareware */
  45. X/* program was that it was handy but that it was not worth $10; the Mac OS */
  46. X/* makes this type of program entirely too easy to write. Instead of using */
  47. X/* the program without paying for it, I decided to write a similar program */
  48. X/* (which would be free) to see if my intuition was correct; the result is */
  49. X/* the program you currently see before you. If you enjoy it, please don't */
  50. X/* send any money -- keep both the program and your money.           */
  51. X/***************************************************************************/
  52. X
  53. X/* Compile time options: verbose errors, put procedure names in
  54. X   output so that MACSBUG displays procedures by name */
  55. X#Options +E +K
  56. X/* Since Consulair 4.0 only runs on a 512K Mac or above, use
  57. X   include files instead of in-line stuff. */
  58. X
  59. X#include <memory.h>
  60. X#include <window.h>
  61. X#include <menu.h>
  62. X#include <events.h>
  63. X#include <osio.h>
  64. X#include <packages.h>
  65. X#include <dialog.h>
  66. X#include <quickdraw.h>
  67. Xtypedef int    boolean;
  68. Xshort GetVol(), SetVol();
  69. X
  70. X
  71. X/*    
  72. X    The following two constants are not defined in any .h file.  They
  73. X    are described in "Inside Macintosh" - Event Manager, pp. 14-15.
  74. X*/
  75. X#define charcodemask 255  
  76. X#define cmdKey 256        
  77. X
  78. X#define NULL     0L
  79. X#define lastmenu 3        /* number of menus */
  80. X#define applemenu 1
  81. X#define filemenu  2
  82. X#define editmenu  3
  83. X
  84. X#define iopen     1
  85. X#define iclose    2
  86. X#define itoggle   4
  87. X#define iquit     6
  88. X
  89. X#define iundo     1
  90. X#define icut      3
  91. X#define icopy     4
  92. X#define ipaste    5
  93. X#define iclear    6
  94. X
  95. XGrafPtr screenport;        /* a port for the whole screen */
  96. XMenuHandle mymenus[lastmenu + 1];/* our menus */
  97. X
  98. XEventRecord myevent;
  99. XWindowPtr whichwindow;        /* points to window of mouseDown */
  100. Xint     windowcode;        /* what mouse was in when event posted */
  101. Xboolean userdone;        /* true when user wants to exit program */
  102. Xboolean open_file;        /* true when there is an open resource file */
  103. Xint the_ref_num;        /* reference number of open resource file   */
  104. Xboolean open_any_file;        /* true when there's no SFGetFile filtering */
  105. X
  106. X
  107. X/*
  108. X############################   SetUpMenus   #############################
  109. X*/
  110. Xsetupmenus () {
  111. X    
  112. X    /* Desk Accessory menu */
  113. X    mymenus[1] = GetMenu(1);
  114. X    AddResMenu(mymenus[1], 'DRVR');    
  115. X    InsertMenu(mymenus[1],0);
  116. X    /* "File" menu */
  117. X    mymenus[2] = GetMenu(2);    
  118. X    InsertMenu(mymenus[2],0);
  119. X    /* Edit menu */
  120. X    mymenus[3] = GetMenu(3);
  121. X    InsertMenu(mymenus[3],0);
  122. X
  123. X    DrawMenuBar();
  124. X}
  125. X
  126. Xresetmenus () {
  127. X    DeleteMenu(1);
  128. X    ReleaseResource(mymenus[1]);
  129. X    mymenus[1] = GetMenu(1);
  130. X    AddResMenu(mymenus[1], 'DRVR');    
  131. X    InsertMenu(mymenus[1],2);            /* Insert before FILE menu */
  132. X    DrawMenuBar();
  133. X}
  134. X
  135. X/*
  136. Xbody of SetUp
  137. XOnce-only initialization for Skel
  138. X############################   SetUp   ##############################
  139. X
  140. X   Initialize our program.  It seems best to Handle:
  141. X   Memory inits first, ToolBox inits second, then the program variables'
  142. X   inits. Note that the order of inits is important; see "Using the
  143. X   Dialog Manager" in the Dialog Mgr section.
  144. X
  145. X*/
  146. X
  147. Xsetup () {
  148. X
  149. X/*  init QuickDraw, and everybody else */
  150. X/***    InitGraf (&thePort);    These 3 are done by Consulair for you***/
  151. X/***    InitFonts ();        ***/
  152. X/***    InitWindows ();        ***/
  153. X    InitDialogs (NULL);        /* NULL => no Restart proc; see Dialog Mgr
  154. X                   and System Error Handler */
  155. X    TEInit ();
  156. X    InitMenus ();
  157. X    InitCursor ();
  158. X
  159. X/* set up our menus */
  160. X    setupmenus ();
  161. X    
  162. X/* set up program variables */
  163. X    open_file = 0;
  164. X    open_any_file = 0;
  165. X}
  166. X
  167. X/*
  168. XClose all currently open desk accessories
  169. X############################   closeaccs   ##############################
  170. X*/
  171. XCloseAllAccs()
  172. X{   int i;
  173. X    for (i = 12; i < 26; i++) CloseDeskAcc(-i-1);
  174. X}
  175. X
  176. X/*
  177. XHandle a command given through a menu selection
  178. X############################   DoCommand   ##############################
  179. X
  180. X   We carry out the command indicated by mResult.
  181. X   If it was Quit, we return true, else false.  Since the menu was
  182. X   highlighted by MenuSelect, we must finish by unhighlighting it
  183. X   to indicate we're done.
  184. X*/
  185. Xint     docommand (mresult)
  186. Xlong    mresult;
  187. X
  188. X
  189. X{
  190. X    short   refnum;
  191. X    short   themenu,
  192. X            theitem;
  193. X    char    name[255];
  194. X    GrafPtr saveport;        /* for saving current port in when opening
  195. X                   a desk accessory */
  196. X    int     returns;
  197. X    
  198. X    Point where;
  199. X    SFReply InRecord;
  200. X    OsType FileType;
  201. X    
  202. X#define aboutboxid 257
  203. X    DialogPtr theDialog;
  204. X    int itemhit;
  205. X
  206. X    returns = 0;        /* assume Quit not selected */
  207. X    themenu = HiWord (mresult);    /* get the menu selected */
  208. X    theitem = LoWord (mresult);    /* ... and the Item of that menu */
  209. X    switch (themenu) {
  210. X    case 0: 
  211. X        break;        /* user made no selection; do nothing */
  212. X
  213. X    case applemenu: 
  214. X        if (theitem == 1) { /* tell about the program */
  215. X        theDialog = GetNewDialog(aboutboxid, 0L, -1L);
  216. X        ModalDialog(0L, &itemhit);
  217. X        DisposeDialog(theDialog);
  218. X        }
  219. X        else {        /* run a desk accessory; make sure port is preserved */
  220. X        GetPort (&saveport);
  221. X        GetItem (mymenus[applemenu], theitem, name);  /* get name */
  222. X        refnum = OpenDeskAcc (name);/* run the desk accessory */
  223. X        SetPort (saveport);
  224. X            }
  225. X        break;
  226. X
  227. X    case filemenu: 
  228. X        switch (theitem) {
  229. X        case iopen:        /* Open */
  230. X            where.h = 82; 
  231. X            where.v = 100; 
  232. X            FileType = 'DFIL';
  233. X            
  234. X            SFGetFile(&where, 0, 0, ((open_any_file == 1) ? -1 : 1), 
  235. X                      &FileType, 0L, &InRecord);
  236. X            if (InRecord.good) {
  237. X            if (open_file) {
  238. X                /* Make sure that there are no open accessories from */
  239. X                /* the old resource file, then close it.             */
  240. X                CloseAllAccs();
  241. X                CloseResFile(the_ref_num);
  242. X                }
  243. X
  244. X            GetVol(name, &refnum);            /* Save the current default */
  245. X            SetVol(0L,InRecord.vRefNum);    /* Resource file is here */
  246. X            the_ref_num = OpenResFile(&(InRecord.Namelength));    /* Open it */
  247. X            SetVol(0L, refnum);                /* Restore default volume */
  248. X                
  249. X            open_file = 0;
  250. X            if (the_ref_num != -1) {
  251. X                open_file = 1;
  252. X                EnableItem(mymenus[filemenu],iclose);
  253. X                }
  254. X            resetmenus();
  255. X            }
  256. X            break;
  257. X        case iclose:    /* Close */
  258. X            if (open_file) {
  259. X            /* Make sure that there are no open accessories from */
  260. X            /* the old resource file, then close it.             */
  261. X            CloseAllAccs();
  262. X            CloseResFile(the_ref_num);
  263. X            open_file = 0;
  264. X            DisableItem(mymenus[filemenu],iclose);
  265. X            resetmenus();
  266. X            }
  267. X            break;
  268. X        case itoggle:   /* Toggle filter for Font/DA Mover files */
  269. X            CheckItem(mymenus[filemenu],itoggle,open_any_file);
  270. X            open_any_file = 1 - open_any_file;
  271. X            break;
  272. X        case iquit:     /* Quit */
  273. X            CloseAllAccs();
  274. X            if (open_file) { CloseResFile(the_ref_num); open_file = 0; }
  275. X            returns = 1;
  276. X        }            /* fileMenu case */
  277. X        
  278. X    case editmenu:
  279. X        SystemEdit(theitem-1);
  280. X    }                /* menu case */
  281. X
  282. X    HiliteMenu (0);        /* turn off hilighting on the menu just used */
  283. X    return (returns);
  284. X}                /* DoCommand */
  285. X
  286. X
  287. X/* 
  288. Xthe main loop that handles events
  289. X############################   MainEventLoop  ##########################  
  290. X*/
  291. X
  292. Xmaineventloop () {
  293. X
  294. X/* body of MainEventLoop */
  295. X
  296. X    FlushEvents (everyEvent);    /* discard leftover events */
  297. X
  298. X/* get next event, and Handle it appropriately, until user QUITs */
  299. X
  300. X    userdone = 0;
  301. X    do {
  302. X    SystemTask ();        /* Handle desk accessories */
  303. X    if (GetNextEvent (everyEvent, &myevent)) {
  304. X                /* get event; if for us... */
  305. X        switch (myevent.what) {/* Handle each kind of event */
  306. X        case mouseDown: /* find out what window the mouse went
  307. X                   down in, and where in it */
  308. X            windowcode = FindWindow (&myevent.where, &whichwindow);
  309. X            switch (windowcode) { /* Handle mouse-down for each place */
  310. X            case inSysWindow:
  311. X                /* Handle the desk accessories */
  312. X                SystemClick (&myevent, whichwindow);
  313. X                break;/* inSysWindow */
  314. X            case inMenuBar: /* Handle the command */
  315. X                userdone = docommand (MenuSelect (&myevent.where));
  316. X                break;  /* doesn't have Aztec's compiler error */
  317. X            }
  318. X            break;    /* switch */
  319. X
  320. X        case keyDown: 
  321. X        case autoKey:     /* if command key, pass the char to MenuKey */
  322. X            if ((myevent.modifiers & cmdKey) != 0)
  323. X            userdone = docommand (MenuKey ((char) (myevent.message & charcodemask)));
  324. X        case updateEvt:
  325. X            break;
  326. X        case activateEvt:
  327. X            break;
  328. X        }
  329. X    }
  330. X
  331. X    } while (userdone == 0);
  332. X}
  333. X
  334. X/*
  335. X  body of Skel
  336. X*/
  337. X
  338. Xmain () {
  339. X    setup ();
  340. X    maineventloop ();
  341. X}
  342. X
  343. X/* needed to be added for Consulair */
  344. XSFGetFile(where, prompt, fileFilter, numTypes, typeList, dlgHook, reply)
  345. X    long *where;        // really address of a point
  346. X    struct PStr *prompt;
  347. X    int (*fileFilter)();
  348. X    short numTypes;
  349. X    SFTypeList *typeList;
  350. X    int (*dlgHook)();
  351. X    SFReply *reply;
  352. X    {
  353. X    #asm
  354. X    MOVE.L D0,A0
  355. X    MOVE.L (A0),-(SP)        ; WHERE
  356. X    MOVE.L D1,-(SP)        ; PROMPT
  357. X    MOVE.L D2,-(SP)        ; FILTER PROC
  358. X    MOVE.W D3,-(SP)        ; numTypes
  359. X    MOVE.L D4,-(SP)        ; typeList
  360. X    MOVE.L D5,-(SP)        ; dlgHook
  361. X    MOVE.L D6,-(SP)        ; reply
  362. X    MOVE #2,-(SP)        ; PARM
  363. X    DC.W $A9EA        ; PACK3
  364. X    #endasm
  365. X      };
  366. X
  367. X#include <pbdefs.h>
  368. X
  369. Xshort
  370. XGetVol(volName, vRefNum) 
  371. Xchar *volName; 
  372. Xshort *vRefNum;
  373. X{
  374. X    ioParam iop;
  375. X    iop.ioCompletion = 0;    /* address of IO completion routine */
  376. X    PBGetVol(&iop, 0);        /* PBGetVol, synchronous */
  377. X    volName = iop.ioNamePtr;
  378. X    *vRefNum = iop.ioVRefNum;
  379. X    return(iop.ioResult);
  380. X}
  381. X
  382. Xshort
  383. XSetVol(volName, vRefNum) 
  384. Xchar *volName; 
  385. Xshort vRefNum;
  386. X{
  387. X    ioParam iop;
  388. X    iop.ioCompletion = 0;    /* address of IO completion routine */
  389. X    iop.ioNamePtr = volName;
  390. X    iop.ioVRefNum = vRefNum;
  391. X    PBSetVol(&iop, 0);        /* PBSetVol, synchronous */
  392. X    return(iop.ioResult);
  393. X}
  394. ________This_Is_The_END________
  395. if test `wc -l < sampler.c` -ne 363; then
  396.     echo 'shar: sampler.c was damaged during transit'
  397.   echo '      (should have been 363 bytes)'
  398. fi
  399. fi        ; : end of overwriting check
  400. echo 'Extracting sampler.doc'
  401. if test -f sampler.doc; then echo 'shar: will not overwrite sampler.doc'; else
  402. sed 's/^X//' << '________This_Is_The_END________' > sampler.doc
  403. XWell, *I* took Thomas Newton's Desk Sampler, converted it to Consulair
  404. XMac C, and
  405. X  * fixed the program so it doesn't try to close DRVR resources numbered
  406. X    27-31 (used for run-time drivers instead of desk accessories, as
  407. X    documented in "Life After the Font/DA Mover" by Apple).
  408. X    
  409. X  * Made it use resources for the Menus, thereby making it possible to
  410. X    "internationalize" the program with ResEdit.
  411. X
  412. XHere it is.  Newton gave it to the non-commercial public; I can do no less.
  413. X
  414. X--Brian Bechtel        {oliveb, apple, bnrmtv}!3comvax!brianb
  415. X------------------------------------------------------------------------
  416. XA while back, someone posted a desk accessory sampler program which was called
  417. X"Whitman's 'Desk Accessory' Sampler" to the net.  This program was distributed
  418. Xas shareware, with a fee of $10.  My first reaction upon using the program was
  419. Xthat it performed a useful function but that it must have been utterly trivial
  420. Xto write, given the Mac's support for resources (such as desk accessories...).
  421. XThus, I stopped using the program (rather than forking over $10 or using it on
  422. Xa regular basis without paying for it), and resolved to write and give away my
  423. Xown program to do the same thing.
  424. X
  425. XOn Friday night, I decided to kill some time, so I sat down at my Mac with my
  426. Xcopies of Megamax C v2.1, Inside Mac, and SKEL 2.2.3C.  By the time that I was
  427. Xready to go to sleep, I had the program working with the exception that (a) it
  428. Xdidn't do anything in response to the "About..." menu item, and (b) it didn't
  429. Xhave a special icon.  A lot of the time that I spent on it was occupied by one
  430. Xof two tasks:  (a) cutting things out of SKEL that my program didn't need, and
  431. X(b) replacing "#include" statements with selected definitions from the Megamax
  432. Xheader files (I have a 128K Mac, and MMC 2.1b tends to run out of symbol table
  433. Xspace on 128K Macs for programs that have lots of "#include" statements).  As
  434. Xof some time tonight, I finished up the task of making an "About..." dialog
  435. Xbox and a special icon for the program and was finished.
  436. X
  437. XThe advantages that my Desk Accessory Sampler has over the other version are:
  438. X
  439. X    1.  It's free.  You don't need to make a choice between giving up
  440. X        $10 or giving up the use of the program in order to be honest.
  441. X    2.  It comes with source code.  If you think that it could use any
  442. X        changes, you can hack on it to your heart's content.
  443. X    3.  It changes the highlighting status of the "Close" menu item to
  444. X        let you know whether or not you currently have a resource file
  445. X        open (the shareware program doesn't give any such indication).
  446. X        (Note: as in the other program, "Open" can be selected while a
  447. X        resource file is open; in this case, the program closes the old
  448. X        resource file before opening the new one.)
  449. X    4.  It provides all five of the standard editing commands (UNDO, CUT,
  450. X        COPY, PASTE, CLEAR) in the EDIT menu, as opposed to the three
  451. X        (CUT, COPY, PASTE) supported by the shareware program.  Note: I
  452. X        was really amazed to see this -- setting up a menu with all five
  453. X    commands is *very* easy (as in "editing cmd # = menu item #-1").
  454. X    5.  It attempts to avoid situations of the type "there is an accessory
  455. X        running whose resource file we have just closed" since these lead
  456. X        directly to system crashes.  Unfortunately, I don't know of a good
  457. X        way to keep track of which accessories are active (while OpenDeskAcc
  458. X        returns a reference number if it succeeds, it may return garbage if
  459. X        it fails).  The approach that my program takes, therefore, is to try
  460. X    to close every driver with a resource ID between 12 and 31; this seems
  461. X        to work fairly well.  It certainly works better than the approach of
  462. X        doing nothing and letting the system crash and burn. . .
  463. X    6.  It has a toggle switch in the FILE menu that allows you to open *any*
  464. X        Macintosh file and use its "DRVR" resources.  This isn't a very major
  465. X        feature; on the other hand, it wasn't hard to put in . . .
  466. X
  467. XIt's bad enough that someone is trying to collect money for a program that
  468. Xis obviously doing very trivial things.  What's even worse is that it isn't
  469. Xeven very competent at what it does do!!!  Is it too much to ask that people
  470. Xrefrain from marking every hack they throw together as shareware requiring a
  471. Xdonation for continued use?
  472. X
  473. XAnyway, I'm posting both the program's source form (Sampler.c, Sampler.R)
  474. Xand its binary form (Sampler.Hqx) to net.sources.mac.  Enjoy.
  475. X
  476. X                                        -- Thomas Newton
  477. X                                           Thomas.Newton@spice.cs.cmu.edu
  478. X
  479. X
  480. ________This_Is_The_END________
  481. if test `wc -l < sampler.doc` -ne 77; then
  482.     echo 'shar: sampler.doc was damaged during transit'
  483.   echo '      (should have been 77 bytes)'
  484. fi
  485. fi        ; : end of overwriting check
  486. echo 'Extracting sampler.r'
  487. if test -f sampler.r; then echo 'shar: will not overwrite sampler.r'; else
  488. sed 's/^X//' << '________This_Is_The_END________' > sampler.r
  489. X*  Sampler.R -- resource definition file for Desk Accessory Sampler
  490. X*           Adapted from the SkelR file in Skel 2.2.3C by Thomas Newton
  491. X*          modified some more by Brian Bechtel 11/20/85 Consulair C
  492. X*
  493. X* I prefer putting the resources into a linker-compatable file. Advantages:
  494. X*   You typically don't change the resources that often
  495. X*   The linker can set the bundle bit instead of using FEDIT
  496. X*   One less program in the program cycle.
  497. XSamplerR.rel
  498. X
  499. X* Version data for the finder
  500. X*    Our signature is "TDN1"
  501. X*    res. ID = 0, by convention
  502. X*    finder version data
  503. X*    Note that the blank in 'STR ' is significant 3/8/85 WHJ
  504. XTYPE TDN1 = STR 
  505. X  ,0
  506. X  Desk Accessory Sampler v1.15 -- November 20, 1985
  507. X
  508. X* dialog box for About command
  509. X*   ID (4 => pre-loaded; 32 => purgeable)
  510. X*   title
  511. X*   BoundsRect(global: TLBR)
  512. X*   Vis NoGo: it's visible, but has no close box
  513. X*   ProcID: Window type is modal dialog
  514. X*   RefCon: Unused user variable
  515. X*   res. ID of item list
  516. XType DLOG
  517. X  ,257(4)
  518. X  About Box
  519. X  35 16 285 496
  520. X  Visible NoGoAway
  521. X  1
  522. X  0
  523. X  257
  524. X
  525. X* dialog item list for About command
  526. X*   ID (4 => pre-loaded; 32 => purgeable - it should always be purgeable.)
  527. X*   # Items
  528. X*   the first item:
  529. X*      a Button you can select
  530. X*      display rect (local coords)
  531. X*      title
  532. X*   the second-last items:
  533. X*     Static text, disabled (i.e. can't select it)
  534. X*     display rect
  535. X*     text to be displayed
  536. XType DITL
  537. X  ,257(36)
  538. X  8
  539. X    button Enabled
  540. X    220 370 241 470
  541. XOK
  542. X
  543. X    staticText Disabled
  544. X    5 145 20 481
  545. XDesk Accessory Sampler v1.15
  546. X
  547. X    staticText Disabled
  548. X    20 10 35 481
  549. XCopyright \A91985 Thomas D. Newton (modified: Brian Bechtel 11/20/85)
  550. X
  551. X    staticText Disabled
  552. X    65 0 80 481
  553. XThis program allows one to use desk accessories stored in resource files
  554. X
  555. X    staticText Disabled
  556. X    80 0 95 481
  557. X(such as the ones produced by Apple's Font/DA Mover) without installing
  558. X
  559. X    staticText Disabled
  560. X    95 0 110 481
  561. Xthose accessories into a System file.
  562. X
  563. X    staticText Disabled
  564. X    140 0 155 481
  565. XDesk Accessory Sampler may be copied and used by anyone, so long as
  566. X
  567. X    staticText Disabled
  568. X    155 0 170 481
  569. Xthat use is not for commercial purposes.
  570. X
  571. X* For proper support of the Desk accessories, the Apple menu
  572. X* should be first, and the Edit menu should be third.  The first 5 items
  573. X* in the Edit menu should be identical to those used below.  This makes 
  574. X* it possible for the desk accessories to share the Edit menu with your
  575. X* application.
  576. X*
  577. X
  578. XType MENU
  579. X  ,1
  580. X\14
  581. X About Sampler...
  582. X (-
  583. X
  584. X  ,2
  585. XFile
  586. XOpen Desk Accessory File.../O
  587. X(Close current accessory file/K
  588. X(-
  589. XShow only Apple DA Mover files!\12/T
  590. X(-
  591. XQuit/Q
  592. X
  593. X
  594. X  ,3
  595. XEdit
  596. X  (Undo/Z
  597. X  (-
  598. X  Cut/X
  599. X  Copy/C
  600. X  Paste/V
  601. X  Clear/B
  602. X
  603. X****************************************************************************
  604. X****        This section contains information for the Finder;           ****
  605. X****     the program never accesses this information directly.          ****
  606. X****        The entire section can be omitted from the first versions   ****
  607. X****     of a program (you must then set the application's type to      ****
  608. X****     APPL, the creator to ????, and don't set the bundle bit);      ****
  609. X****     the default application icon will be used.                     ****
  610. X****        For more info, read "Putting together a Mac Application"    ****
  611. X****     and "The Structure of a Mac Application".                      ****
  612. X*
  613. X* a Bundle: contains references to other finder info, (below)
  614. X*   ID (32 => purgeable)
  615. X*   Bundle owner: TDN1 (our signature), Res ID of version data = 0
  616. X*   "ICN#" (means icon list), # of icon resources in bndl = 1
  617. X*   local ID 0 maps to global ID 128 (the FREF uses a local ID, to refer to
  618. X*      an icon which has a global ID. See the FREF resource, below);
  619. X*   "FREF" (means file reference), # of FREF res in bndl = 1
  620. X*   local ID 0 maps to global ID 128
  621. X
  622. XType BNDL
  623. X   ,128(32)
  624. X   TDN1 0
  625. X   ICN# 1
  626. X   0 128
  627. X   FREF 1
  628. X   0 128
  629. X
  630. X* a File Reference
  631. X*   ID, (32 => purgeable)
  632. X*   "APPL" : a file of type APPL gets the following icon (a suitcase);
  633. X*       local icon ID; maps to global ID as specified in BNDL
  634. X*   name of file that must accompany application if transferred; omit if none.
  635. X  Type FREF
  636. X   ,128(32)
  637. X   APPL 0
  638. X
  639. X* An icon list for the application icon (a partially opened suitcase)
  640. X* REdit 1.0 (resource decompile option)
  641. X*   ID (the application icon), (32 => purgeable)
  642. X*   Data is Hex data (.H)
  643. X*   the icon data: 32 lines of 8 hex chars each
  644. X*   the icon mask: 32 lines of 8 hex chars each
  645. XType ICN# = GNRL
  646. X ,128(32)
  647. X.H
  648. X00000000
  649. X7245D1DC
  650. X456D5112
  651. X7755D1DC
  652. X15451112
  653. X75451DD2
  654. X00000000
  655. X00007E00
  656. X00008100
  657. X00FF7EFE
  658. X01014283
  659. X0203C385
  660. X04000009
  661. X0FFFFFF1
  662. X0AAAAAB1
  663. X0D555551
  664. X0AAAAAB1
  665. XFFFFFF51
  666. X800002B1
  667. X8FFFF351
  668. X480011B1
  669. X4FFFF151
  670. X449249B1
  671. X27FFF8D1
  672. X249248B1
  673. X27FFFCD1
  674. X12492471
  675. X13FFFC51
  676. X11249272
  677. X09FFFE34
  678. X08000018
  679. X07FFFFF0
  680. X*
  681. XFFFFFFFF
  682. XFFFFFFFF
  683. XFFFFFFFF
  684. XFFFFFFFF
  685. XFFFFFFFF
  686. XFFFFFFFF
  687. XFFFFFFFF
  688. X00007E00
  689. X0000FF00
  690. X00FFFFFE
  691. X01FFFFFF
  692. X03FFFFFF
  693. X07FFFFFF
  694. X0FFFFFFF
  695. X0FFFFFFF
  696. X0FFFFFFF
  697. X0FFFFFFF
  698. XFFFFFFFF
  699. XFFFFFFFF
  700. XFFFFFFFF
  701. X7FFFFFFF
  702. X7FFFFFFF
  703. X7FFFFFFF
  704. X3FFFFFFF
  705. X3FFFFFFF
  706. X3FFFFFFF
  707. X1FFFFFFF
  708. X1FFFFFFF
  709. X1FFFFFFE
  710. X0FFFFFFC
  711. X0FFFFFF8
  712. X07FFFFF0
  713. X
  714. X****    end of information for the finder                          ****
  715. X***********************************************************************
  716. ________This_Is_The_END________
  717. if test `wc -l < sampler.r` -ne 227; then
  718.     echo 'shar: sampler.r was damaged during transit'
  719.   echo '      (should have been 227 bytes)'
  720. fi
  721. fi        ; : end of overwriting check
  722. exit 0
  723.