home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / Misc Utils / ResHelper / RH Help < prev    next >
Encoding:
Text File  |  1991-03-03  |  16.2 KB  |  334 lines  |  [TEXT/MSWD]

  1.                         ResHelper - Version 0.80
  2.  
  3.  
  4. A Quick Word from the Author:
  5. ============================
  6. I've been working on ResHelper off and on for nearly a year as of March, 
  7. 1991.  I wrote this program to address some complaints I had about other 
  8. resource building programs and learn more about the internals of the 
  9. Mac.  Early on, I decided to solicit suggestions from readers of the 
  10. INFO-MAC digest available on the BITNET and INTERNET computer networks 
  11. to see if there were other features that might prove useful to other 
  12. users.  Several readers (maybe 15) responded and some of their 
  13. suggestions have been incorporated into this program.
  14.  
  15. At this point, I think I've met most of the goals I set for myself in 
  16. writing this.  Since the program seems to be fairly well behaved, I've 
  17. decided to try my luck at shareware and make it available to INFO-MAC 
  18. readers.  Because I graduated from Washington University in May of 1990, 
  19. I no longer have direct access to INFO-MAC.  However, I still have 
  20. connections!  Eric Oberle, Manager - Computer Consulting at Washington 
  21. University not only tried out early versions and provided some helpful 
  22. suggestions, but has graciously volunteered to post the program to INFO-
  23. MAC and accept comments from users via electronic mail and forward them 
  24. to me.  Eric's e-mail address is:
  25.  
  26.              Eric Oberle <C09615EO@WUVMD.BITNET>
  27.  
  28. Thank you Eric!  You can also send comments directly to me at the 
  29. following address:
  30.  
  31.              Michael Hanrahan
  32.              1142 West College - Apt K
  33.              Liberty, MO  64068
  34.              USA
  35.  
  36. Now is your chance to actively participate in the development of 
  37. something designed to help YOU!  I cannot promise this program will be 
  38. supported with an 800 number and quarterly newsletters but then you 
  39. aren't expected to pay for that either.  Version 0.80 is being offered 
  40. as shareware for a fee of $30 (US funds).  If you send in your shareware 
  41. fee to me at the above address, I will send you a copy of the latest 
  42. version on a new diskette.
  43.  
  44. NOTE: This release of ResHelper has a 60-day "timer" within it which 
  45.       will disable all commands but Help and Quit 60 days after you
  46.       first run the program.  This "timer" is not intended to punish
  47.       users who don't send in shareware fees but rather to prevent
  48.       obsolete versions of the program from persisting in the
  49.       electronic ether indefinitely.  Users who send in their shareware
  50.       fee will be provided a version which does not include the timer.
  51.  
  52.  
  53.                         (now the real help file!)
  54.  
  55. Introduction
  56. ============
  57. One of the most tedious aspects of Macintosh software development is the 
  58. creation of resources used within the program.  Despite the Macintosh's 
  59. status as the most elegant graphics-based computer on the market, some 
  60. resource builders for Macintosh developers require resource "source 
  61. code" to be written and "compiled" into the final form or require the 
  62. same type of information to be specified via dialogs rather than point-
  63. click-drag techniques.  
  64.  
  65. ResHelper was written to yield the following capabilities:
  66.  
  67.     1) Allow programmers to specify Finder Bundles in a way that the
  68.        user sees them, without worrying about local resource IDs,
  69.        global resource IDs, maps between the BNDL and FREFs, etc.
  70.     2) Allow dialogs to be edited using standard draw program methods.
  71.        Select and move multiple items (ResEdit can't do this).  Change
  72.        control names/edit text without having to open a separate dialog.
  73.        Support clipboard functions while editing dialogs.  Allow all
  74.        item numbers to be seen and modified in one dialog.  
  75.     3) Allow menus to be created and "test-driven" within the program
  76.        to verify the placement of separator bars, command key 
  77.        equivalents, etc.  
  78.     4) Perform the above functions and others without costing the
  79.        developer an arm and a leg.  
  80.  
  81. ResHelper has been written with safety in mind as well.  When you edit 
  82. resources in a file, ResHelper actually makes a copy of the file and 
  83. applies your changes to the copy.  The original input file remains 
  84. untouched while you edit resources until you issue a Save command.  This 
  85. disk-based approach may be a tad slow for users without hard drives but 
  86. it guarantees that your input file will NEVER be corrupted by the 
  87. program and it allows the program to run in a fairly small 350k 
  88. partition under MultiFinder.
  89.  
  90.  
  91. History
  92. =======
  93. ResHelper was written using THINK's Pascal Version 3.0 on a Macintosh SE 
  94. (for the first four months) and IIci (the remainder).  It has been 
  95. thoroughly tested on System 6.0.5 on the IIci and will run in as little 
  96. as 350k under MultiFinder.  By the way, a big hats off to the people at 
  97. Symantec.  THINK Pascal is the only program I've used for EXTENDED (and 
  98. I mean EXTENDED!) periods of time without having the phrase "I really 
  99. wish they had thought of _____ when they wrote this" pop into my head  A 
  100. very well thought out product, to say the least...
  101.  
  102.  
  103. Behind the Scenes
  104. =================
  105. After you select a file for editing, ResHelper creates a copy of the 
  106. input file and places the copy, named $$$TEMP RESOURCE$$$ in your System 
  107. folder.  The program also adds an extra resource (named 'fnam') to the 
  108. copy which contains the name of the input file name and its Finder 
  109. information.  After making any desired changes and issuing a Save 
  110. command, ResHelper deletes the old version of your input file, then 
  111. copies the temp file back to the original's folder (or a different 
  112. folder and name if you did a Save As...).  It then removes the 'fnam' 
  113. resource from the newly saved file.  
  114.  
  115. Why is the 'fnam' resource added and removed?  If ResHelper ever 
  116. terminates abnormally (or something else in your Mac hangs), the temp 
  117. file with that 'fnam' resource will be left in your System folder.  The 
  118. next time ResHelper is launched, it will detect the presence of that old 
  119. work file and use the filename within the 'fnam' resource to remind you 
  120. of the old session and ask if you wish to continue.  Since the program 
  121. immediately writes out all resources to that temp file as they are 
  122. created/changed, you should never lose more work than the changes to a 
  123. single resource.  EVER.  
  124.  
  125.  
  126. Using the Resource Editors
  127. ==========================
  128. The use of most of the resource editors in ResHelper is fairly obvious.  
  129. However, the Bundle and Dialog editors deserve some special coverage 
  130. since they combine the process of editing several different resources 
  131. into a single integrated environment.  Detailed descriptions of these 
  132. editors are given below.
  133.  
  134. Editing Your Application's Finder Information
  135. ---------------------------------------------
  136. The Finder uses three pre-defined resources types (BNDL, FREF, and SIZE) 
  137. and a user-defined resource (referred to as a signature) to control the 
  138. application's appearance in the Finder and its use of memory when 
  139. launched under MultiFinder.  A quick description of these resources is 
  140. given below.
  141.  
  142.     Type    Purpose
  143.     ----    -------------------------------------------------
  144.     BNDL    Provides a summary to the Finder of how many unique file
  145.             types your program uses.  It contains a map of all the 
  146.             FREF resources which define those types.  It also contains
  147.             the (hopefully) unique signature of your application.
  148.     FREF    Provide a one-to-one map between a four-character file type
  149.             and an ICN# resource to display for files of that file type.
  150.             There is one FREF resource for each file type your program.
  151.             creates.
  152.     SIZE    Used by the Finder to provide a memory partition if your
  153.             program is run under MultiFinder.  It also contains a set
  154.             of flags which you use to tell the System how MultiFinder
  155.             "smart" your application is.  Always saved with id = -1.
  156.     sign    If your application's signature was 'sign', you would have
  157.             a resource of type 'sign' which contains a string which will
  158.             be displayed in the Version field when the user chooses the
  159.             Get Info command in Finder's File menu on your final
  160.             application.
  161.  
  162. Sounds simple, huh?  In fact, the process of creating all these 
  163. resources is normally rather confusing and tedious.  ResHelper provides 
  164. three dialogs which greatly simplify this process.  
  165.  
  166. The Size Dialog
  167. ---------------
  168. The suggested memory partition field should contain the amount of memory 
  169. (in kilobytes) in which your program operates most efficiently.  The 
  170. minimum should specify the smallest amount of memory in which your 
  171. program can operate without encountering memory allocation problems.  
  172.  
  173. The flags deserve some special explanation.  Some key points are 
  174. summarized in the table below.  (By the way, I have no idea what the 
  175. Save Screen flag's function is.)
  176.  
  177.   32 bit clean    
  178.  
  179.     You probably shouldn't check this unless you've successfully
  180.     tested your program under A/UX.
  181.  
  182.   getFrontClicks
  183.  
  184.     When your program has been placed in the background under 
  185.     MultiFinder and the user clicks on a window to bring your program 
  186.     back to the foreground, MultiFinder will normally NOT pass your 
  187.     program the mouse-down event which brought it back to the front (you 
  188.     probably don't need to see the event anyway).  If you DO wish to 
  189.     receive this event, check this box.
  190.  
  191.   acceptSuspendResumeEvents
  192.  
  193.     Set this flag if your event handling routine includes support for 
  194.     processing suspend/resume events.  If you don't check this option, 
  195.     MF will generate extra "bogus" events designed to trick your program 
  196.     into performing any clipboard housekeeping.  For this to have any
  197.     effect, the MultiFinder aware flag should also be set.
  198.  
  199.   MultiFinder aware 
  200.  
  201.     Setting this flag tells MultiFinder that it won't need to generate
  202.     activate/deactivate events along with the resume/suspend
  203.  
  204.   canBackground  
  205.  
  206.     MultiFinder provides "time slices" to background applications by 
  207.     passing null events to them.  If your program doesn't do anything 
  208.     for null events, don't set this flag.
  209.  
  210.   onlyBackground  
  211.  
  212.    If your program doesn't have a user interface (no menus, dialogs, 
  213.    etc.) and cannot run in the foreground, set this flag.
  214.  
  215.    getChildDiedEvents
  216.  
  217.     If your program launches other applications and you want to know if
  218.     they terminated abnormally, set this flag.
  219.  
  220.  
  221. The Bundle Dialog
  222. -----------------
  223. The Bundle dialog allows you to specify your application's four-
  224. character signature, its Get Info string ("signature string"), and lists 
  225. all the file types (FREFs) you've defined with their associated ICN#.  
  226. If you need to create a new FREF, click on the New FREF button.  A 
  227. second dialog will appear which displays all defined ICN#s and provides 
  228. a field for your new file type.  Type in your new file type, select an 
  229. ICN# then click on Select.  Cancel returns you to the main Bundle 
  230. dialog.  Clicking on Save in the Bundle dialog saves all of the various 
  231. resources and construct the maps between your FREFs and ICN#s.  (If this 
  232. sounds complicated, you should try it the old way once just for fun!)
  233.  
  234.  
  235. Editing Dialogs
  236. ---------------
  237. Editing dialogs is also much easier using ResHelper.  Choosing the 
  238. Dialogs command in the Resource menu displays a list of all defined 
  239. DLOGs.  Double-clicking on an item will display that dialog as the end 
  240. user will see it.  Once a dialog is displayed you can perform all of the 
  241. following functions:
  242.  
  243.     • Create an item by clicking on the desired tool in the palette then
  244.       clicking where you want it in the dialog window.
  245.     • Reposition an item by clicking on it and dragging it to the proper
  246.       position.
  247.     • Resize an item by dragging its bottom right selection handle. When
  248.       resizing text boxes, the height will automatically be rounded to
  249.       the nearest integral multiple of the Chicago font size.
  250.     • Select multiple items by holding down Shift while clicking on the
  251.       items.  You can also drag a rectangle around items to select them 
  252.       (as you do in the Finder).
  253.     • Hold down Shift while dragging to limit movement to the horizontal
  254.       or vertical direction.
  255.     • Change a control's title or the text in a statText or editText 
  256.       item by double clicking on that item to select the text, type the
  257.       new title, then press Esc or click outside the item's rectangle to
  258.       finish editing.
  259.     • Resize the dialog window by dragging in the lower right corner.
  260.     • Move the dialog window around the screen by dragging its title bar
  261.       (if it has one) or by clicking in the first four rows of pixels at
  262.       the top of the window and dragging.
  263.     • Add PICTs or ICONs by clicking on the appropriate tool, click in
  264.       the window where you wish to place it, then select the desired 
  265.       PICT/ICON from a list of defined resources.  Poof!  It's added.
  266.       You can edit the ICONs in the dialog by double clicking on them.
  267.  
  268. The Windows Options... dialog allows you to specify the type of window 
  269. for the dialog and indicate whether the dialog window should be 
  270. initially hidden (useful if you wish to center the window before showing 
  271. it to the user) or have a close box (for document-type windows).  You 
  272. can change window types even if you've already added items to the 
  273. dialog.
  274.  
  275. The Set Item Numbers... dialog lists all defined dialog items in 
  276. numerical order.  You can renumber an item by dragging it on top of the 
  277. item it should follow in the list.  Clicking on Finish returns you to 
  278. your dialog for more editing.
  279.  
  280. When you save a new dialog, you will be prompted for the dialog's title 
  281. and the resource IDs of the DLOG and DITL resources (normally you'll 
  282. want to keep these the same).  The title will be used to provide a name 
  283. to the resource which helps identify them later.  You can change this 
  284. information later by choosing the Save As.. command in the Dialog menu 
  285. instead of Save.  If you create a dialog window which is larger than the 
  286. 9-inch screen on the compact Macintosh models or you positioned the 
  287. window so it is not entirely visible on the classic screens, you'll be 
  288. warned of this fact at the time you save the dialog.
  289.  
  290. MF Strings
  291. ----------
  292. If your program uses non-standard command names for "Open..." and "Quit" 
  293. or places them in a menu called something other than "File", your 
  294. program will not support MultiFinder's ability to open documents from 
  295. the Finder while your program is already loaded or quit when the user 
  296. selects Restart/Shutdown.  If you wish to support these features, you 
  297. need to tell MultiFinder which menu contains these commands and the 
  298. exact name of the commands.  The MF Strings dialog allows you to specify 
  299. the strings needed to pass this information to MultiFinder.  
  300.  
  301. After filling in the fields in the dialog, ResHelper will save the 
  302. strings out as type 'mstr' with ids 100-103.  When your program is 
  303. running, if MultiFinder can't find the Open or Quit command in their 
  304. normal menu, it will look for these resources in its attempt to find 
  305. them.
  306.  
  307.  
  308. Unfinished Business
  309. ===================
  310.      I'm hoping that many users will provide some feedback about 
  311. features they like or found lacking in the program.  However, I'm sure I 
  312. can guess what some of them are.  The following is a list of the 
  313. features I'm still trying to implement in the program.
  314.  
  315.   1) I have the routines to draw lines and boxes and outline the default
  316.      button in a dialog working but haven't figured out a viable way to 
  317.      save them.  Actually, saving them as PICTs is easy but when a 
  318.      dialog is opened for editing and read from the DITL on disk, I'll
  319.      need to be able to determine if the PICT is something I created or
  320.      a random PICT representing a digitized Van Gogh or something 
  321.      meaningless to ResHelper. (Sounds like a job for picComments!)
  322.   2) A better algorithm for automatically building an icon mask for 
  323.      ICN#s is needed.
  324.   3) Support for running in a shared environment.  I hope to dynamically 
  325.      assign temp file filenames yet continue to allow sessions to be
  326.      restarted.  This will require checking along the lines of "1) does
  327.      a temp file exist?" and "2) does it belong to THIS user?"
  328.   4) Support for editing color icons.  I don't know of any program that
  329.      edits cicn's in a Paint-like environment so I imagine this could be
  330.      VERY difficult to implement.
  331.  
  332. Even without these features, I think/hope most programmers will find 
  333. ResHelper very useful in developing their own software.
  334.