home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 August: Tool Chest / Dev.CD Aug 94.toast / New System Software Extensions / PlainTalk™ Speech Technologies / Text to Speech / Programming Stuff / Examples / TESample with TTS / TESample.r < prev    next >
Encoding:
Text File  |  1993-09-15  |  8.4 KB  |  367 lines  |  [TEXT/MPS ]

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