home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / developm / scnote / tesample.002 / TESample.r < prev    next >
Text File  |  1989-06-01  |  8KB  |  347 lines

  1. /*------------------------------------------------------------------------------
  2. #
  3. #    Apple Macintosh Developer Technical Support
  4. #
  5. #    MultiFinder-Aware TextEdit Sample Application
  6. #
  7. #    TESample
  8. #
  9. #    TESample.r    -    Rez Source
  10. #
  11. #    Copyright ⌐ 1989 Apple Computer, Inc.
  12. #    All rights reserved.
  13. #
  14. #    Versions:    
  15. #                1.00                08/88
  16. #                1.01                11/88
  17. #                1.02                04/89
  18. #                1.03                06/89
  19. #
  20. #    Components:
  21. #                TESample.p            June 1, 1989
  22. #                TESample.c            June 1, 1989
  23. #                TESampleGlue.a        June 1, 1989    -MPW only-
  24. #                TESample.r            June 1, 1989
  25. #                TESample.h            June 1, 1989
  26. #                PTESample.make        June 1, 1989    -MPW only-
  27. #                CTESample.make        June 1, 1989    -MPW only-
  28. #                TESampleGlue.s        June 1, 1989    -A/UX only-
  29. #                TESampleAUX.r        June 1, 1989    -A/UX only-
  30. #                Makefile            June 1, 1989    -A/UX only-
  31. #
  32. #    TESample is an example application that demonstrates how 
  33. #    to initialize the commonly used toolbox managers, operate 
  34. #    successfully under MultiFinder, handle desk accessories and 
  35. #    create, grow, and zoom windows. The fundamental TextEdit 
  36. #    toolbox calls and TextEdit autoscroll are demonstrated. It 
  37. #    also shows how to create and maintain scrollbar controls.
  38. #
  39. #    It does not by any means demonstrate all the techniques you 
  40. #    need for a large application. In particular, Sample does not 
  41. #    cover exception handling, multiple windows/documents, 
  42. #    sophisticated memory management, printing, or undo. All of 
  43. #    these are vital parts of a normal full-sized application.
  44. #
  45. #    This application is an example of the form of a Macintosh 
  46. #    application; it is NOT a template. It is NOT intended to be 
  47. #    used as a foundation for the next world-class, best-selling, 
  48. #    600K application. A stick figure drawing of the human body may 
  49. #    be a good example of the form for a painting, but that does not 
  50. #    mean it should be used as the basis for the next Mona Lisa.
  51. #
  52. #    We recommend that you review this program or Sample before 
  53. #    beginning a new application. Sample is a simple app. which doesn╒t 
  54. #    use TextEdit or the Control Manager.
  55. #
  56. ------------------------------------------------------------------------------*/
  57.  
  58. #include "systypes.r"
  59. #include "types.r"
  60.  
  61. #include "TESample.h"
  62.  
  63. #ifdef AUX
  64. #include "TESampleAUX.r"
  65. #endif
  66.  
  67. resource 'vers' (1) {
  68.     0x02, 0x00, release, 0x00,
  69.     verUS,
  70.     "1.02",
  71.     "1.02, Copyright \251 1989 Apple Computer, Inc."
  72. };
  73.  
  74. /* we use an MBAR resource to conveniently load all the menus */
  75.  
  76. resource 'MBAR' (rMenuBar, preload) {
  77.     { mApple, mFile, mEdit };        /* three menus */
  78. };
  79.  
  80.  
  81. resource 'MENU' (mApple, preload) {
  82.     mApple, textMenuProc,
  83.     0b1111111111111111111111111111101,    /* disable dashed line, enable About and DAs */
  84.     enabled, apple,
  85.     {
  86.         "About TESample\311",
  87.             noicon, nokey, nomark, plain;
  88.         "-",
  89.             noicon, nokey, nomark, plain
  90.     }
  91. };
  92.  
  93. resource 'MENU' (mFile, preload) {
  94.     mFile, textMenuProc,
  95.     0b0000000000000000000100000000000,    /* enable Quit only, program enables others */
  96.     enabled, "File",
  97.     {
  98.         "New",
  99.             noicon, "N", nomark, plain;
  100.         "Open",
  101.             noicon, "O", nomark, plain;
  102.         "-",
  103.             noicon, nokey, nomark, plain;
  104.         "Close",
  105.             noicon, "W", nomark, plain;
  106.         "Save",
  107.             noicon, "S", nomark, plain;
  108.         "Save As\311",
  109.             noicon, nokey, nomark, plain;
  110.         "Revert",
  111.             noicon, nokey, nomark, plain;
  112.         "-",
  113.             noicon, nokey, nomark, plain;
  114.         "Page Setup\311",
  115.             noicon, nokey, nomark, plain;
  116.         "Print\311",
  117.             noicon, nokey, nomark, plain;
  118.         "-",
  119.             noicon, nokey, nomark, plain;
  120.         "Quit",
  121.             noicon, "Q", nomark, plain
  122.     }
  123. };
  124.  
  125. resource 'MENU' (mEdit, preload) {
  126.     mEdit, textMenuProc,
  127.     0b0000000000000000000000000000000,    /* disable everything, program does the enabling */
  128.     enabled, "Edit",
  129.      {
  130.         "Undo",
  131.             noicon, "Z", nomark, plain;
  132.         "-",
  133.             noicon, nokey, nomark, plain;
  134.         "Cut",
  135.             noicon, "X", nomark, plain;
  136.         "Copy",
  137.             noicon, "C", nomark, plain;
  138.         "Paste",
  139.             noicon, "V", nomark, plain;
  140.         "Clear",
  141.             noicon, nokey, nomark, plain
  142.     }
  143. };
  144.  
  145.  
  146. /* this ALRT and DITL are used as an About screen */
  147.  
  148. resource 'ALRT' (rAboutAlert, purgeable) {
  149.     {40, 20, 160, 296}, rAboutAlert, {
  150.         OK, visible, silent;
  151.         OK, visible, silent;
  152.         OK, visible, silent;
  153.         OK, visible, silent
  154.     };
  155. };
  156.  
  157. resource 'DITL' (rAboutAlert, purgeable) {
  158.     { /* array DITLarray: 5 elements */
  159.         /* [1] */
  160.         {88, 184, 108, 264},
  161.         Button {
  162.             enabled,
  163.             "OK"
  164.         },
  165.         /* [2] */
  166.         {8, 8, 24, 274},
  167.         StaticText {
  168.             disabled,
  169.             "MultiFinder-Aware TextEdit Application"
  170.         },
  171.         /* [3] */
  172.         {32, 8, 48, 237},
  173.         StaticText {
  174.             disabled,
  175.             "Copyright \251 1989 Apple Computer"
  176.         },
  177.         /* [4] */
  178.         {56, 8, 72, 136},
  179.         StaticText {
  180.             disabled,
  181.             "Brought to you by:"
  182.         },
  183.         /* [5] */
  184.         {80, 24, 112, 167},
  185.         StaticText {
  186.             disabled,
  187.             "Macintosh Developer ╩Technical Support"
  188.         }
  189.     }
  190. };
  191.  
  192.  
  193. /* this ALRT and DITL are used as an error screen */
  194.  
  195. resource 'ALRT' (rUserAlert, purgeable) {
  196.     {40, 20, 150, 260},
  197.     rUserAlert,
  198.     { /* array: 4 elements */
  199.         /* [1] */
  200.         OK, visible, silent,
  201.         /* [2] */
  202.         OK, visible, silent,
  203.         /* [3] */
  204.         OK, visible, silent,
  205.         /* [4] */
  206.         OK, visible, silent
  207.     }
  208. };
  209.  
  210.  
  211. resource 'DITL' (rUserAlert, purgeable) {
  212.     { /* array DITLarray: 3 elements */
  213.         /* [1] */
  214.         {80, 150, 100, 230},
  215.         Button {
  216.             enabled,
  217.             "OK"
  218.         },
  219.         /* [2] */
  220.         {10, 60, 60, 230},
  221.         StaticText {
  222.             disabled,
  223.             "Error. ^0."
  224.         },
  225.         /* [3] */
  226.         {8, 8, 40, 40},
  227.         Icon {
  228.             disabled,
  229.             2
  230.         }
  231.     }
  232. };
  233.  
  234.  
  235. resource 'WIND' (rDocWindow, preload, purgeable) {
  236.     {64, 60, 314, 460},
  237.     zoomDocProc, invisible, goAway, 0x0, "untitled"
  238. };
  239.  
  240.  
  241. resource 'CNTL' (rVScroll, preload, purgeable) {
  242.     {-1, 385, 236, 401},
  243.     0, visible, 0, 0, scrollBarProc, 0, ""
  244. };
  245.  
  246.  
  247. resource 'CNTL' (rHScroll, preload, purgeable) {
  248.     {235, -1, 251, 386},
  249.     0, visible, 0, 0, scrollBarProc, 0, ""
  250. };
  251.  
  252. resource 'STR#' (kErrStrings, purgeable) {
  253.     {
  254.     "You must run on 512Ke or later";
  255.     "Application Memory Size is too small";
  256.     "Not enough memory to run TESample";
  257.     "Not enough memory to do Cut";
  258.     "Cannot do Cut";
  259.     "Cannot do Copy";
  260.     "Cannot exceed 32,000 characters with Paste";
  261.     "Not enough memory to do Paste";
  262.     "Cannot create window";
  263.     "Cannot exceed 32,000 characters";
  264.     "Cannot do Paste"
  265.     }
  266. };
  267.  
  268. /* here is the quintessential MultiFinder friendliness device, the SIZE resource */
  269.  
  270. resource 'SIZE' (-1) {
  271.     dontSaveScreen,
  272.     acceptSuspendResumeEvents,
  273.     enableOptionSwitch,
  274.     canBackground,                /* we can background; we don't currently, but our sleep value */
  275.                                 /* guarantees we don't hog the Mac while we are in the background */
  276.     multiFinderAware,            /* this says we do our own activate/deactivate; don't fake us out */
  277.     backgroundAndForeground,    /* this is definitely not a background-only application! */
  278.     dontGetFrontClicks,            /* change this is if you want "do first click" behavior like the Finder */
  279.     ignoreChildDiedEvents,        /* essentially, I'm not a debugger (sub-launching) */
  280.     not32BitCompatible,            /* this app should not be run in 32-bit address space */
  281.     reserved,
  282.     reserved,
  283.     reserved,
  284.     reserved,
  285.     reserved,
  286.     reserved,
  287.     reserved,
  288.     kPrefSize * 1024,
  289.     kMinSize * 1024    
  290. };
  291.  
  292.  
  293. type 'MOOT' as 'STR ';
  294.  
  295.  
  296. resource 'MOOT' (0) {
  297.     "MultiFinder-Aware TextEdit Sample Application"
  298. };
  299.  
  300.  
  301. resource 'BNDL' (128) {
  302.     'MOOT',
  303.     0,
  304.     {
  305.         'ICN#',
  306.         {
  307.             0, 128
  308.         },
  309.         'FREF',
  310.         {
  311.             0, 128
  312.         }
  313.     }
  314. };
  315.  
  316.  
  317. resource 'FREF' (128) {
  318.     'APPL',
  319.     0,
  320.     ""
  321. };
  322.  
  323.  
  324. resource 'ICN#' (128) {
  325.     { /* array: 2 elements */
  326.         /* [1] */
  327.         $"04 30 40 00 0A 50 A0 00 0B 91 10 02 08 22 08 03"
  328.         $"12 24 04 05 20 28 02 09 40 10 01 11 80 0C 00 A1"
  329.         $"80 03 FF C2 7E 00 FF 04 01 00 7F 04 03 00 1E 08"
  330.         $"04 E0 00 0C 08 E0 00 0A 10 E0 00 09 08 C0 00 06"
  331.         $"04 87 FE 04 02 88 01 04 01 88 00 84 00 88 00 44"
  332.         $"00 88 00 44 00 88 00 C4 01 10 01 88 02 28 03 10"
  333.         $"01 C4 04 E0 00 02 08 00 73 BF FB EE 4C A2 8A 2A"
  334.         $"40 AA AA EA 52 AA AA 24 5E A2 8A EA 73 BE FB 8E",
  335.         /* [2] */
  336.         $"04 30 40 00 0E 70 E0 00 0F F1 F0 02 0F E3 F8 03"
  337.         $"1F E7 FC 07 3F EF FE 0F 7F FF FF 1F FF FF FF BF"
  338.         $"FF FF FF FE 7F FF FF FC 01 FF FF FC 03 FF FF F8"
  339.         $"07 FF FF FC 0F FF FF FE 1F FF FF FF 0F FF FF FE"
  340.         $"07 FF FF FC 03 FF FF FC 01 FF FF FC 00 FF FF FC"
  341.         $"00 FF FF FC 00 FF FF FC 01 FF FF F8 03 EF FF F0"
  342.         $"01 C7 FC E0 00 03 F8 00 73 BF FB EE 7F BE FB EE"
  343.         $"7F BE FB EE 7F BE FB E4 7F BE FB EE 73 BE FB 8E"
  344.     }
  345. };
  346.  
  347.