home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 206.lha / C-Functions / maker.doc < prev    next >
Text File  |  1996-02-14  |  7KB  |  223 lines

  1.  
  2. Thanks Amiga!
  3.  
  4.  
  5. maker.lib   14 sep 1988   (C) Copyright by Lars Thuring
  6.  
  7. The following is a short description of the routines supplied with the
  8. library maker.lib, of various usefullness.  This is public domain and may
  9. be freely used and distributed. This goes for commercial programs as well,
  10. however, anyone is free to contribute to my happiness.
  11.  
  12. The routines are:    MakeAutoRequest()
  13.                      MakeBox()
  14.                      MakeMenu()
  15.                      MakeName()
  16.  
  17. There are also some shorties (like upper() etc. which were all made in
  18. the time when I misstrusted library routines and got scared when using
  19. printf() meant an additional 4 kB of programcode ...) and one spinoff
  20. routine, GetBoxCoordinates().
  21.  
  22. Compiler: Lattice 3.10.
  23.  
  24. --8<-----------------------------------------------------------------------
  25.  
  26. Generic Info.
  27. These routines use string arrays as their main arguments. The format of
  28. each text string is:
  29.  
  30.             "[command / option]TextIfAny"
  31.  
  32.    ex:      "[M]Project"                       or
  33.             "[]Please insert MyDisk !"
  34.  
  35.  
  36. The '[' and the ']' is NOT indicating an optional field as usuall. These
  37. must be present even if a default command is used. If the routine should
  38. use a text (f.x. for rendering a menu header) this is supplied after the
  39. right ']'.
  40.  
  41. The string array must end with a NULL pointer to indicate end of array.
  42. F.x a small array for rendering a requester might look like:
  43.  
  44.  
  45. UBYTE *InformUser[] =
  46.    {
  47.    "[T] No CHIP memory ",
  48.    "[ ] is available ! ",
  49.    "[]",
  50.    "[N]OK",
  51.    NULL                       /* Last argument is null */
  52.    };
  53.  
  54.  
  55. The commands in [] are usually only an ASCII character, sometimes followed
  56. by a digit. The usage of characters differ between routines.
  57.  
  58.  
  59.  
  60. int MakeAutoRequest( w, data )
  61.  
  62. This routine uses AutoRequest() to make a simple yes/no requester
  63. in a window.
  64.  
  65. Input:   struct Window *w;          A pointer to a window.
  66.          UBYTE *data[];             Commands/texts to be used (see below).
  67.  
  68. Return:  int result;                Return value: TRUE/FALSE or -1 if error.
  69.  
  70. The text string commands available are:
  71.  
  72.    Bnn   - Set background colour to nn.
  73.    Fnn   - Set frontpen colour to nn.
  74.    Jn    - Set drawing mode; if n=1 select JAM1, else select JAM2.
  75.    Lnn   - Set new line spacing in pixels.
  76.    N     - The following text goes to the "negative" gadget.
  77.    P     - The following text goes to the "positive" gadget (if any).
  78.    T     - The following text(s) is the requester information.
  79.  
  80. NOTE: The AutoRequest() routine return values are TRUE or FALSE. A return
  81.       value of -1 means an error have occured.
  82.  
  83.  
  84.  
  85. VOID MakeBox( rp, x,y, w,h, data)
  86.  
  87. Draw a box or contour, possibly with a text.
  88.  
  89. Inputs:  struct RastPort *rp;          Where to put result.
  90.          SHORT x,y;                    Offset into raster.
  91.          SHORT w,h;                    Size of box (may be zero).
  92.          UBYTE *data;                  A single command string.
  93.  
  94. Return:  none.
  95.  
  96. This routine can draw a box of a predefined size by supplying the w & h
  97. arguments. If these are ==0 then the command string is checked for a text
  98. to fit the box around.
  99.  
  100. The following commands are available:
  101.  
  102.    Bnn   - Set background colour to nn.
  103.    C     - Set drawing mode to COMPLEMENT.
  104.    Fnn   - Set frontpen colour to nn.
  105.    J     - Set drawing mode to JAM2.
  106.    S     - Make solid background.
  107.    0     - Draw a regular box.
  108.    1     - Draw a dropshadow for a box.
  109.    2     - Draw perspective depth lines for a box.
  110.    3     - Ditto, but with fixed depth.
  111.  
  112. NOTE: The boxtypes can be combined to get a box with a dropshadow or to
  113.       get a box with "depth look". If more than one box type argument
  114.       is given, the routine will call itself with the rest of the string
  115.       as argument. Some weird effects may occur.
  116.       It is recomended that the 'C' option is used.
  117.       This routine sets the FgPen and BgPen in the host rp (which may be
  118.       undesirable).
  119.  
  120.    e.x. of data string: "[C0C1C]Df1:"
  121.  
  122.  
  123.  
  124. VOID MakeMenu( data, M, I, T )
  125.  
  126. Fill in supplied structs to render a menu.
  127.  
  128. Inputs:  UBYTE *data[];                Command string arrary.
  129.          struct Menu      M[];         Uninitilized Menu structs to use.
  130.          struct MenuItem  I[];         Ditto for menu items.
  131.          struct IntuiText T[];         Ditto intuition text structs.
  132.  
  133. Return:  none.
  134.  
  135. The default settings for a Menu or MenuItem is:
  136.  
  137.       MENUENABLED
  138.       ITEMTEXT | ITEMENABLED | HIGHCOMP
  139.       JAM1
  140.  
  141. in respective variables.
  142.  
  143. Each datastring corresponds to a Menu, MenuItem or SubItem [-struct].
  144. Each MenuItem is assumed to belong to the last Menu datastring and
  145. each SubItem is assumed to belong to the last MenuItem declaration made.
  146. See the mtest.c file.
  147.  
  148. The following commands are available in strings ("This is" refers to the
  149. text after ']'):
  150.  
  151.    _c       - This item may be selected by right amiga-key + chr( c ).
  152.    A        - This is a alternate text for previous item.
  153.    B        - Highlight this item by drawing a box.
  154.    C        - This item may be 'CHECKED' by selecting it.
  155.    D        - This menu/item is disabled at start.
  156.    H        - Start adding items in next column.
  157.    I        - This is a menuitem.
  158.    J        - Set drawmode for this menu/item to JAM2.
  159.    M        - This is a menu (header).
  160.    N        - No highlightning when selected.
  161.    S        - This is a subitem.
  162.    V        - Item is checked at start.
  163.    a-z,0-4  - Mutual Exclude corresponding MenuItem. I.e. an 'a' deselects
  164.               the first menuitem under this menu (-struct), a 'b' the
  165.               second etc.etc. and a '4' deselects the 32:nd.
  166.  
  167. NOTE: To render the menues after call MakeMenu(), use the address of the
  168.       first Menu struct with SetMenuStrip().
  169.  
  170.  
  171.  
  172. int MakeName( result, func, sex)
  173.  
  174. Return a random name.
  175.  
  176. Inputs:  UBYTE *result;                Where to put result (should be big).
  177.          USHORT func;                  What type of result is wanted.
  178.          USHORT sex;                   Boy / girl.
  179.  
  180. Result:  0.
  181.  
  182. This routine doesn't use a command string.
  183.  
  184. The following defines are included in MakeName.h and will controll the
  185. result as described:
  186.  
  187. func defines:
  188.  
  189.       FIRSTNAME         only.
  190.       LASTNAME          only.
  191.       FULLNAME          both firstname and lastname, seperated by a ' '.
  192.       TITLENAME         put "Mr " or "Ms " in front of name.
  193.       MARRIEDNAME       will put "Mrs " instead of "Ms " if TITLENAME also
  194.                         was selected.
  195.  
  196. sex defines:
  197.  
  198.       GIRLNAME          ...
  199.       BOYNAME           ...
  200.  
  201.  
  202. NOTE: See the RANDOM define for something to change.
  203.       Some names were added during daylight which might explain their
  204.       oddness.
  205.  
  206.  
  207.  
  208. Finally, if you liked/disliked this let me know. Also, there is a next
  209. version. AutoDocs 1.3 anyone ?? My address:
  210.  
  211. Lars Thuring
  212. Turkosgatan 29
  213. 421 50 Vastra Frolunda
  214. Sweden
  215.  
  216. Phone: 031-497508
  217.  
  218.  
  219. (eller som AUGS medlem 690)
  220.  
  221.  
  222.  
  223.