home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 October: Mac OS SDK / Dev.CD Oct 00 SDK1.toast / Development Kits / Mac OS / MLTE SDK / TEtoMLTESample / CommonSources / TECommon.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-09-10  |  6.3 KB  |  171 lines  |  [TEXT/MPS ]

  1. /*------------------------------------------------------------------------------
  2. #
  3. #    Apple Macintosh Developer Technical Support
  4. #
  5. #    MultiFinder-Aware Simple TextEdit Sample Application
  6. #
  7. #    CPlusTESample
  8. #
  9. #    TECommon.h    -    C++ and Rez source
  10. #
  11. #    Copyright © 1989, 1993 Apple Computer, Inc.
  12. #    All rights reserved.
  13. #
  14. #    Versions:
  15. #            2.00                    03/93        for PowerPC
  16. #            1.10                     07/89
  17. #            1.00                     04/89
  18. #
  19. #    Components:
  20. #            TEDocument.o.make        July 9, 1989
  21. #            TDocument.h                July 9, 1989
  22. #            TECommon.h                July 9, 1989
  23. #            TESample.h                July 9, 1989
  24. #            TEDocument.h            July 9, 1989
  25. #            TEDocument.cp            July 9, 1989
  26. #            TESampleGlue.a            July 9, 1989
  27. #
  28. #    CPlusTESample is an example application that demonstrates
  29. #    how to initialize the commonly used toolbox managers,
  30. #    operate successfully under MultiFinder, handle desk
  31. #    accessories and create, grow, and zoom windows. The
  32. #    fundamental TextEdit toolbox calls and TextEdit autoscroll
  33. #    are demonstrated. It also shows how to create and maintain
  34. #    scrollbar controls. 
  35. #
  36. #    This version of TESample has been substantially reworked in
  37. #    C++ to show how a "typical" object oriented program could
  38. #    be written. To this end, what was once a single source code
  39. #    file has been restructured into a set of classes which
  40. #    demonstrate the advantages of object-oriented programming.
  41. #   
  42. ------------------------------------------------------------------------------*/
  43.  
  44. #ifndef TECommon_Defs
  45. #define TECommon_Defs
  46.  
  47. /*
  48.     These definitions are shared by Rez and C++. We use #define statements
  49.     instead of constants in this file because Rez doesn't support constants,
  50.     and since the 3.0b1 version of Rez doesn't like the C++ comments, we use
  51.     C style comments in this file as well.
  52.  */
  53.  
  54. /*    Determining an application's minimum size to request from MultiFinder depends
  55.     on many things, each of which can be unique to an application's function,
  56.     the anticipated environment, the developer's attitude of what constitutes
  57.     reasonable functionality and performance, etc. Here is a list of some things to
  58.     consider when determining the minimum size (and preferred size) for your
  59.     application. The list is pretty much in order of importance, but by no means
  60.     complete.
  61.     
  62.     1.    What is the minimum size needed to give almost 100 percent assurance
  63.         that the application won't crash because it ran out of memory? This
  64.         includes not only things that you do have direct control over such as
  65.         checking for NIL handles and pointers, but also things that some
  66.         feel are not so much under their control such as QuickDraw and the
  67.         Segment Loader.
  68.         
  69.     2.    What kind of performance can a user expect from the application when
  70.         it is running in the minimum memory configuration? Performance includes
  71.         not only speed in handling data, but also things like how many documents
  72.         can be opened, etc.
  73.         
  74.     3.    What are the typical sizes of scraps that a user might wish to work
  75.         with when lauching or switching to your application? If the amount
  76.         of memory is too small, the scrap will be purged from memory. This
  77.         can be quite frustrating to the user.
  78.         
  79.     4.    The previous items have concentrated on topics that tend to cause an
  80.         increase in the minimum size to request from MultiFinder. On the flip
  81.         side, however, should be the consideration of what environments the
  82.         application may be running in. There may be a high probability that
  83.         many users with relatively small memory configurations will want to
  84.         avail themselves of your application. Or, many users might want to use it
  85.         while several other, possibly related/complementary applications are
  86.         running. If that is the case, it would be helpful to have a fairly
  87.         small minimum size.
  88.     
  89.     What we did for CPlusTESample:
  90.     
  91.         We determined the smallest heap size that CPlusTESample could have and
  92.         still run (24K). For the preferred size we added enough space to permit:
  93.             a. a maximum size TextEdit text handle (32000 characters)
  94.             b. a maximum usable TextEdit scrap (32000 characters)
  95.             b. a maximum scrap as a result of Copy (32000 characters)
  96.             d. a little performance cushion (see 2, above) (10K)
  97.         Result: 124K for preferred size
  98.         
  99.         For the minimum size we took the 22K and then scaled down our requirements
  100.         for a,b, and c above. We thought that providing 16K more would be lean
  101.         and mean (see 4, above).
  102.         Result: 40K for minimum size
  103. */
  104.  
  105. #define kPrefSize                124
  106. #define kMinSize                40
  107.     
  108. /* kMinHeap - This is the minimum result from the following
  109.      equation:
  110.             
  111.             ORD(GetApplLimit) - ORD(ApplicZone)
  112.             
  113.      for the application to run. It will insure that enough memory will
  114.      be around for reasonable-sized scraps, FKEYs, etc. to exist with the
  115.      application, and still give the application some 'breathing room'.
  116.      To derive this number, we ran under a MultiFinder partition that was
  117.      our requested minimum size, as given in the 'SIZE' resource. */
  118.      
  119. #define    kMinHeap                 (34 * 1024)
  120.     
  121. /* kMinSpace - This is the minimum result from PurgeSpace, when called
  122.      at initialization time, for the application to run. This number acts
  123.      as a double-check to insure that there really is enough memory for the
  124.      application to run, including what has been taken up already by
  125.      pre-loaded resources, the scrap, code, and other sundry memory blocks. */
  126.      
  127. #define    kMinSpace                (20 * 1024)
  128.  
  129. /* id of our STR# for error strings */
  130. #define kTEDocErrStrings     129
  131.  
  132. /* The following are indicies into STR# resources. */
  133. #define    eNoMemory                1
  134. #define    eNoSpaceCut                2
  135. #define    eNoCut                    3
  136. #define    eNoCopy                    4
  137. #define    eExceedPaste            5
  138. #define    eNoSpacePaste            6
  139. #define    eNoWindow                7
  140. #define    eExceedChar                8
  141. #define    eNoPaste                9
  142.  
  143. #define    rMenuBar    128                /* application's menu bar */
  144. #define    rAboutAlert    128                /* about alert */
  145. #define    rUserAlert    129                /* user error alert */
  146. #define    rDocWindow    128                /* application's window */
  147. #define    rVScroll    128                /* vertical scrollbar control */
  148. #define    rHScroll    129                /* horizontal scrollbar control */
  149.  
  150. /* The following constants are used to identify menus and their items. The menu IDs
  151.    have an "m" prefix and the item numbers within each menu have an "i" prefix. */
  152. #define    mApple                    128        /* Apple menu */
  153. #define    iAbout                    1
  154.  
  155. #define    mFile                    129        /* File menu */
  156. #define    iNew                    1
  157. #define    iClose                    4
  158. #define    iQuit                    12
  159.  
  160. #define    mEdit                    130        /* Edit menu */
  161. #define    iUndo                    1
  162. #define    iCut                    3
  163. #define    iCopy                    4
  164. #define    iPaste                    5
  165. #define    iClear                    6
  166.  
  167. #define mDebug                    131        /* Debugging menu */
  168. #define iDebug                    1
  169.  
  170. #endif // TECommon_Defs
  171.