home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 432a.lha / ReqLibrary_v2.2 / req.doc < prev    next >
Text File  |  1990-11-10  |  68KB  |  1,867 lines

  1.  
  2.  
  3.                             ReqLibrary, release 2.2
  4.  
  5.  
  6.  
  7.     The  req.library is a run time re-entrant library that is designed
  8. to  make  it  easier  for  programmers  to  use  powerful, easy to use
  9. requesters  for  communicating  with  users.   The  requester  library
  10. includes  such functions as a color requester, file requester, message
  11. display  requester  and many functions to make the creation of gadgets
  12. for your own custom requesters easier.
  13.  
  14.     Req.library  was  written  by  Colin  Fox (of Pyramyd Designs) and
  15. Bruce  Dawson  (of  CygnusSoft  Software).   Req.library  is  a freely
  16. distributable  library that may be used in commercial products without
  17. paying  any  royalties.  We encourage you to use the requester library
  18. in all of your programs, to make them easier to write, and to use.
  19.  
  20.     Req.library  is  not public domain.  The requester library and all
  21. documentation and example programs are all copyright 1989.
  22.  
  23. //////////////////////////////////////////////////////////////////////
  24.  
  25.     The  requester  library  is  freely distributable.  If you wish to
  26. supply  the  source  code  to your program, we would ask that you also
  27. include the req.library archive file.  This is what it should contain:
  28.  
  29.     releasestuff/.info
  30.     releasestuff/customizefile
  31.     releasestuff/read.me
  32.     releasestuff/read.me.info
  33.     releasestuff/req.doc
  34.     releasestuff/req.doc.info
  35.     releasestuff/req.library
  36.     releasestuff/showoffreq
  37.     releasestuff/showoffreq.c
  38.     releasestuff/showoffreq.c.info
  39.     releasestuff/asm/customizefile.asm
  40.     releasestuff/asm/customizefile.asm.info
  41.     releasestuff/asm/reqglue.asm
  42.     releasestuff/asm/reqglue.asm.info
  43.     releasestuff/include/macros.i
  44.     releasestuff/include/macros.i.info
  45.     releasestuff/obj/areqglue.o
  46.     releasestuff/obj/lreqglue.o
  47.     releasestuff/include/clib/req_protos.h
  48.     releasestuff/include/libraries/reqbase.h
  49.     releasestuff/include/libraries/reqbase.i
  50.     releasestuff/include/pragmas/req.h
  51.     releasestuff/include/proto/req.h
  52.  
  53.  
  54.  
  55. //////////////////////////////////////////////////////////////////////
  56.  
  57. Changes from req 1.2 to req 2.2
  58.  
  59. - All requesters handle fonts properly under Workbench 2.0
  60.  
  61. - The TextRequest now has a timeout. You supply the length of time, in
  62.   seconds, and the requester will CANCEL itself after that time.
  63.  
  64. - The GetLong requester now displays the Minimum and Maximum values
  65.   on the window.
  66.  
  67. - Format() has been renamed ReqFormat(), since there is now a DOS routine
  68.   called Format() that does something significantly different.
  69.  
  70. - ReqFormat() now returns the length of the formatted string, and it is
  71.   now safe to pass a null result buffer. This is useful if you wish to
  72.   allocate space for a string without needing a buffer first. Just run
  73.   ReqFormat() on the string once without a result buffer, and it will tell
  74.   you how long the string is. Then allocate the memory and do it again
  75.   with the result buffer.
  76.  
  77. - For future compatability, you must now put REQVERSION in all Version
  78.   structure fields. This begins now, as the Timeout routine looks at
  79.   the version.
  80.  
  81. -  RealTimeScroll  now  passes, as the 5th parameter (and in A0) the scroll
  82.    structure  to ScrollAndDraw (your routine).  This allows easier creation of
  83.    re-entrant   code  (you  don't  need  to  have  a  global  pointer  to  the
  84.    scrollstruct).
  85.  
  86. - ARexx interface
  87.    Many thanks to Steve Lyons for writing the rexx module for req.library.
  88.    To hook req.library in as an ARexx function library, you must execute the
  89.    following line:
  90.  
  91.     rxlib req.library -5 -60 2
  92.  
  93.    For example, my rxlib settings read as such:
  94.  
  95.     rxlib rexxmathlib.library  5 -30 0
  96.     rxlib rexxapclib.library   0 -30 0
  97.     rxlib rexxsupport.library -5 -30 0
  98.     rxlib rexxarplib.library -10 -30 0
  99.     rxlib req.library         -5 -60 2
  100.  
  101.  
  102.    Steve also wrote the following 4 ARexx <-> Req bindings:
  103.  
  104.  
  105. ------------------------------------------------------------------------------
  106. colourreq()
  107.  
  108.     This function requires no parameters, but you CAN pass the default colour
  109.     if you like.
  110.  
  111. ------------------------------------------------------------------------------
  112. intreq("Title",min,max)
  113.  
  114.     This function now displays the min and max values, so you know what's expected.
  115.  
  116. ------------------------------------------------------------------------------
  117. stringreq("Title","initial string",StringBufSize,VisibleSize)
  118.  
  119.     The only manditory paramter is Title.
  120.     There is no default initial string, so it would be blank
  121.     StringBufSize defaults to 255
  122.     VisibleSize defaults to 40
  123. ------------------------------------------------------------------------------
  124. textreq("Text body","Title","Cancel"," Ok ","Middle",timeout)
  125.  
  126.     Something new for req.library 2.2 is timeouts. Right now the only requester
  127.     that has timeouts is TextRequest(), but they will be added to the others.
  128.  
  129.     the timeout is in seconds. When the timeout expires, it returns FALSE.
  130.  
  131.     The only required parameter is the "Text Body"
  132.  
  133. ------------------------------------------------------------------------------
  134.  
  135.  
  136. //////////////////////////////////////////////////////////////////////
  137.  
  138.  
  139.  
  140.     Req.library  is  dedicated  to  the programmers who make the Amiga
  141. shine the way it was meant to.
  142.  
  143.  
  144. OverView:
  145.  
  146.     All  of  the  req.library functions that bring up requesters allow
  147. you two ways of specifying what screen you would like the requester to
  148. appear  on.  The first way is the more efficient way, because you only
  149. have  to set it up once and then it takes care of things automatially.
  150. There  is  a  field in all process structures called the pr_WindowPtr.
  151. This  pointer  is  used by DOS to decide where to put it's requesters.
  152. If  pr_WindowPtr  contains  a  zero,  requesters  go  on the workbench
  153. screen.  If it contains the address of a window, then requesters go on
  154. that  window's  screen.   If  it  contains a negative one, then no DOS
  155. requesters come up.  The req.library requesters all use this variable,
  156. if  they  are  called from a process .  However, if the pointer is -1,
  157. the req.library functions do still appear, on the workbench screen.
  158.  
  159.     The  second  way  was  put in mainly so that the requesters can be
  160. called from tasks.  Since a task does not have a process structure, it
  161. also  lacks a pr_WindowPtr.  Therefore, all of the requester functions
  162. which  can  be  used from a task (currently everything except the file
  163. requester) can be passed a window pointer, either as a parameter or as
  164. an  element in a structure.  Important:  This pointer takes precedence
  165. over  the  pr_WindowPtr  so  if  you  wish  the  requesters to use the
  166. pr_WindowPtr  you  must  zero  the window fields that the routines are
  167. expecting.   In  the case of fields in a structure this can be easy as
  168. long   as  you  make  sure  your  structure  defaults  to  being  zero
  169. everywhere.
  170.  
  171.     Setting  the  pr_WindowPtr is quite a simple matter.  All you have
  172. to do is do a FindTask((char *)0); which returns a pointer to your own
  173. task  and your own process (a task structure is the first element of a
  174. process  structure).   Then  you  simply  preserve  the  old  value of
  175. pr_WindowPtr (VERY IMPORTANT!!!) and put a window pointer into it.
  176.  
  177. eg:
  178.                 /* Find my task. */
  179.     myprocess = (struct Process *)FindTask((char *)0);
  180.     oldwindowptr = myprocess->pr_WindowPtr;
  181.     myprocess->pr_WindowPtr = window;
  182.  
  183. or:
  184.  
  185.     MOVE.L  4,A6
  186.     MOVE.L  #0,A1
  187.     SYS     FindTask    ;Find my task.
  188.     MOVE.L  D0,_myprocess
  189.     MOVE.L  D0,A0
  190.     MOVE.L  pr_WindowPtr(A0),_oldwindowptr
  191.     MOVE.L  _window,pr_WindowPtr(A0)
  192.  
  193.     Before your program exits it is VERY important that it restore the
  194. previous  value of pr_WindowPtr.  If you don't, then your program will
  195. work  in some situations, but will BLOW UP in others.  For example, if
  196. you  execute  (without  using the 'run' command) a program, which then
  197. sets  the  pr_WindowPtr  to  point at one of its windows and the exits
  198. without  restoring  it,  then  the  next time a DOS requester tries to
  199. appear...  BOOM!  The machine will probably crash as DOS tries to open
  200. a requester on a now closed screen.  Therefore, before leaving:
  201.  
  202.     myprocess->pr_WindowPtr = oldwindowptr;
  203.  
  204. or:
  205.  
  206.     MOVE.L  _myprocess,A0
  207.     MOVE.L  _oldwindowptr,pr_WindowPtr(A0)
  208.  
  209.  
  210.  
  211.     One  final  note.   The  pr_WindowPtr  field exists in the process
  212. structure.   This  means  that  a  task  does  not  have  this  field.
  213. Therefore,  if you want to call one of the requester library functions
  214. from  a  task,  you  will not be able to specify what screen you would
  215. like  the  requester  to  appear on by setting the pr_WindowPtr field.
  216. All  of  the  functions  that open requesters and can be called from a
  217. task  (the file requester/font requester is the only one that can't be
  218. called  froma task) have some other way of specifying which screen you
  219. would like them to open on.  They will have either have a field in the
  220. structure  which you must pass them or a parameter which can contain a
  221. window  pointer  to one of the windows on your custom screen.  If this
  222. pointer is non-zero then it overrides the pr_WindowPtr field.
  223.  
  224.  
  225.  
  226.  
  227.     By  opening the requester library, you not only gain access to all
  228. of  the functions documented below, but to some other goodies as well.
  229. Req.library   needs  and  therefore  opens  several  other  libraries,
  230. including  dos.library,  intuition.library,  graphics.library  and the
  231. console  device.   All  of  these  pointers  are  stored in the ReqLib
  232. structure  which  you  get a pointer to when you open the req.library.
  233. Therefore,  you  can  save  yourself  a little bit of code by grabbing
  234. these  fields  after opening the requester library.  The only thing to
  235. beware of is don't use these values after you have close the requester
  236. library,  because  at  that point there is no guarantee that they will
  237. still be valid.
  238.  
  239.     In  addition  to  these  libraries,  the Images pointer in the req
  240. library structure points to a set of ten small images (four arrows and
  241. ssix  letters)  which have are guaranteed to be in chip memory.  These
  242. can be used if your program requires this type of images.
  243.  
  244.  
  245.  
  246.  
  247.     One  thing to keep in mind when using the gadget creation routines
  248. is  that there isn't any way for us to check that you have passed us a
  249. pointer  to  the  correct size of buffer, so you _must_ make sure that
  250. you are allocating the right amount of memory.
  251.  
  252.  
  253. --------------------------------------------------------------
  254. Here's a quick list of the functions available:
  255. --------------------------------------------------------------
  256.  
  257. Center..................Center a new window over the mouse.
  258.  
  259. SetSize.................Prop gadget handling routines (32 bit)
  260. SetLocation
  261. ReadLocation
  262.  
  263. ReqFormat..................sprintf() format routine
  264.  
  265. SimpleRequest...........Starter gluecode to TextRequest- Single gadget
  266. TwoGadRequest...........Starter gluecode to TextRequest- Two gadgets
  267.  
  268. FileRequester...........FileRequester routines
  269. PurgeFiles
  270.  
  271. ColorRequester..........a colorrequester
  272.  
  273. MakeGadget..............Gadget creation routines
  274. MakeString
  275. MakeProp
  276. MakeButton
  277.  
  278. MakeScrollBar...........3   part   gadget;   2   arrows  and  a  prop.
  279.                         Horizontal or Vertical
  280.  
  281. LinkGadget..............Gadget  creation  routines that self-hook into
  282.                         the newwindow
  283. LinkStringGadget........gadget list.
  284. LinkPropGadget
  285.  
  286. DrawBox.................Draw a box (x1y1)(x2y2) in one command
  287.  
  288. GetFontHeightAndWidth...return height and width of current font
  289.  
  290. RealTimeScroll..........scroll routine used in file requester
  291.  
  292. TextRequest.............Powerful requester function
  293.  
  294. GetString...............Get a line of text from the user
  295. GetLong.................Get a signed long from the user
  296.  
  297. RawKeyToAscii...........Convert raw key to ascii
  298. NewGetString............Get a line of text from the user - uses GSS structure
  299.  
  300. ----------------------------------------------------------------
  301.  
  302.  
  303. NAME
  304.         Center
  305.  
  306.  
  307. SYNOPSIS
  308.         Center( &nw, x, y)
  309.                  A0 D0 D1
  310.  
  311. struct NewWindow *nw;
  312. USHORT x,y;
  313.  
  314. DESCRIPTION
  315.  
  316.     Center()  is  used  to  adjust  a  NewWindow structure so that the
  317. window that it opens will appear immediately under the mouse.  The x,y
  318. values  are used to specify which part of the window you would like to
  319. appear  underneath  the mouse.  If x or y is zero, that tells Center()
  320. to  position  the  window  so  that  the  window center (in the x or y
  321. direction  respectively)  is  underneath  the  mouse.   If  x  or y is
  322. positive, that tells Center() to position the window so that the mouse
  323. is  that  many  pixels  from  the  left  or  top  edge  of  the window
  324. respectively.   If x or y is negative, that tells Center() to position
  325. the  window  structure so that the mouse appears that many pixels from
  326. the right or bottom edge of the window respectively (ie; x = -10 tells
  327. Center  to  position  the  mouse  ten  pixels to the left of the right
  328. edge).
  329.  
  330.     If it is impossible to position the window exactly where requested
  331. (if  the  mouse  pointer  is too close to the edge of the screen) then
  332. this  routine  will  position  the  window as close as possible to the
  333. correct location.
  334.  
  335.     To  allow  this routine to work accurately it is necessary to have
  336. already initialized the new window structure to specify on what screen
  337. the  window  is  going  to  be  open.  ie; you should set the Type and
  338. Screen fields before calling Center().
  339.  
  340.     This routine disturbs no registers.
  341.  
  342. RETURNS
  343.         nothing
  344. SEE
  345.  
  346. BUGS
  347.         None known
  348.  
  349.  
  350. ;--------------------------------------------------------------------
  351.  
  352. NAME
  353.             SetSize
  354. SYNOPSIS
  355.  
  356.             SizeVal=SetSize(MaxValue,ViewSize)
  357.               D0.W              D0.L  D1.L
  358.  
  359. short   SizeVal;
  360. long    MaxValue,ViewSize;
  361.  
  362. DESCRIPTION
  363.  
  364.     This  routine is designed to correctly handle sizing a prop gadget
  365. to  a range.  The range is given in in MaxValue/ViewSize.  MaxValue is
  366. the  maximum value that this prop is supposed to be able to represent.
  367. Viewsize  is  how  large  the  display area is.  For instance, if your
  368. maximum  value  was 200 (files, for example), and your viewsize was 15
  369. (lines of text), then you would call this as so:
  370.  
  371.         SizeVal=SetSize(200,15);
  372.  
  373.     Then you would put SizeVal into the appropriate PropInfo structure
  374. element (in the case of the file requester, that would be VertBody).
  375.  
  376. RETURNS
  377.         The  16 bit value to be put into the PropInfo structure of the
  378. prop gadget.
  379.  
  380. SEE
  381.         SetLocation, ReadLocation
  382. BUGS
  383.         Bugs? what bugs?
  384.  
  385.  
  386. ;--------------------------------------------------------------------
  387.  
  388. NAME
  389.             SetLocation
  390. SYNOPSIS
  391.  
  392. NewLoc = SetLocation(MaxValue,ViewSize,Value);
  393.   D0                    D0      D1      D2
  394.  
  395. short NewLoc;
  396. long MaxValue,ViewSize,Value;
  397.  
  398. DESCRIPTION
  399.  
  400.             When you have a prop gadget that you wish to directly set,
  401. then  this  is  the  routine to use.  It allows you to pass any 32 bit
  402. value and properly set the gadget.
  403.  
  404. RETURNS
  405.  
  406.     The  return  is  the value to put into either HorizPot or VertPot,
  407. depending on what orientation you have the gadget.
  408.  
  409.  
  410. BUGS
  411.  
  412.     n/a
  413.  
  414. EXAMPLE
  415.  
  416. SEE
  417.     SetSize(),ReadLocation()
  418.  
  419. ;--------------------------------------------------------------------
  420.  
  421. NAME
  422.             ReadLocation
  423. SYNOPSIS
  424.  
  425. LocVal=ReadLocation(MaxValue,ViewSize,PotValue)
  426.   D0                  D0.L    D1.L     D2.W
  427.  
  428. long LocVal,MaxVal,ViewSize;
  429. short PotValue;
  430.  
  431.  
  432. DESCRIPTION
  433.  
  434.         If  you  prop  gadget has been moved, this is the routine that
  435. you would use to determine where it's been moved to.
  436.  
  437. RETURNS
  438.         Returns  the decoded value of the prop, as an unsigned 32 bit.
  439. This  is  the  element  number  (line  number  usually) that should be
  440. displayed on the first line of your display window.
  441.  
  442. SEE
  443.  
  444.     SetSize(), SetLocation()
  445.  
  446. BUGS
  447.     n/a
  448.  
  449. EXAMPLE
  450.  
  451. ;--------------------------------------------------------------------
  452.  
  453. NAME
  454.             ReqFormat
  455. SYNOPSIS
  456.  
  457.  len =  ReqFormat(Buffer,string,values)
  458.   D0                A2      A0     A1
  459.  
  460. char *Buffer,string[];
  461. char **values;
  462. long len;
  463.  
  464. DESCRIPTION
  465.  
  466.         This does the same thing as sprintf(), except that it isn't in
  467. the  stdio  library, and doesn't use up very much room.  This function
  468. uses  the  ROM  function  RawDoFmt to do the print() style formatting.
  469. This  routine does not allow the use of all of the '%' directives (for
  470. example,  floating  point  numbers can not be printed with this).  For
  471. full   documentation   on  what  directives  are  supported,  see  the
  472. documentation  on RawDoFmt.  This is the routine that TextRequest (and
  473. therefore   SimpleRequest   and  TwoGadRequest)  use  for  their  text
  474. formatting, so these restrictions apply to them also.
  475.  
  476.         The RawDoFmt routine also assumes that 'int's are sixteen bits
  477. long.   Therefore,  if  you  are  using a compiler with an int size of
  478. thirty-two  bits and you want to print an int or a short, you must use
  479. '%ld', rather than '%d'.
  480.  
  481.         Req  2.2 now returns the length of the formatted string in D0.
  482. This can be used with passing a null buffer to do more accurate memory
  483. allocations for strings.
  484.  
  485.         It  is  now (as of req 2.2) harmless to supply an empty result
  486. buffer.   The  result  of  this  is simply obtaining the length of the
  487. formatted string.
  488.  
  489.  
  490. RETURNS
  491.         The number of characters in the formatted string.
  492. BUGS
  493.     none known
  494.  
  495. EXAMPLE
  496.  
  497.     ReqFormat(Buffer,"There are %d changes to the file %s.",numchanges,
  498. filename);
  499.  
  500.     ReqFormat(Buffer,"%x is a hex number, %c is a character.", num, chr);
  501.  
  502. SEE
  503.     TextRequest, SimpleRequest, TwoGadRequest.
  504.     Further  information  on printf() style formatting is available in
  505. the AutoDocs on RawDoFmt and in C manuals discussing printf().
  506.  
  507. ;--------------------------------------------------------------------
  508.  
  509.  
  510.  
  511. NAME
  512.             ColorRequester
  513. SYNOPSIS
  514.  
  515. NewColor=ColorRequester(DesiredColor);
  516.    D0                       D0
  517. long    DesiredColor;
  518.  
  519. DESCRIPTION
  520.  
  521.     This  is a full-fledged color requester.  It is intelligent enough
  522. to open with the right number of colours in the palette automatically.
  523. It  shows  you both the colour you are working with, and the numerical
  524. RGB  value  of  that  colour.   It  has  Spread,  Undo,  Ok and Cancel
  525. functions.  Planned is the addition of HSV.
  526.  
  527.     The  cursor  keys move the color-cursor around the palette, RETURN
  528. selects the current color and ESC cancels out.
  529.  
  530.     You  pass  this  routine  the  color that you would like initially
  531. highlighted  (typically  the  current drawing colour).
  532.  
  533.     The ExtendedColorRequester function has slightly more options, but
  534. is slightly more work to call.
  535.  
  536. RETURNS
  537.  
  538.     Color  number  that  the user selected, -1 if the user cancels the
  539. colour  requester.   The  changed  colours  will  be  in  the viewport
  540. structure for your screen.
  541.  
  542. SEE
  543.     ExtendedColorRequester
  544.  
  545. BUGS
  546.  
  547.     none known.
  548.  
  549. EXAMPLE
  550.  
  551.     newcolor = ColorRequester(oldcolor);
  552.  
  553. ;--------------------------------------------------------------------
  554.  
  555. NAME
  556.             ExtendedColorRequester
  557. SYNOPSIS
  558.  
  559. NewColor=ExtendedColorRequester(&(struct ExtendedColorRequester)
  560.    D0                                      A0
  561. struct ExtendedColorRequester   colorreqstruct;
  562.  
  563. DESCRIPTION
  564.     This  call  brings  up  exactly  the  same  color requester as the
  565. ColorRequester  call.  The only difference is that this routine allows
  566. you  to  specify  more  parameters.   The difference is actually quite
  567. small  right  now, because there is only one additional parameter that
  568. can  be  passed  through  this  entry  point.   This is the ecr_window
  569. parameter,  used  to  specify  what window (and hence what screen) the
  570. color 'requester' appears on.  This parameter is rarely needed because
  571. the  window  the requester opens up on can be specified by setting the
  572. pr_WindowPtr  field  in  your process structure to the address of your
  573. window  structure  (see  the  beginning of the docs for an overview on
  574. this procedure).  The only time this entry point is needed, currently,
  575. is  if you try to bring up the color requester on a custom screen from
  576. a  task,  since  a task does not have a pr_WindowPtr and can therefore
  577. not specify the window and screen.
  578.  
  579. RETURNS
  580.  
  581.     Color  number  that  the user selected, -1 if the user cancels the
  582. colour  requester.   The  changed  colours  will  be  in  the viewport
  583. structure for your screen.
  584.  
  585. SEE
  586.     ColorRequester
  587.  
  588. BUGS
  589.  
  590.     none known.
  591.  
  592. EXAMPLE
  593.  
  594.         /* This should generally be declared as a global variable */
  595.         /* so that all of it's elements get initialized to zero.  */
  596.         /* If you declare it as a local variable, be sure to zero */
  597.         /* all of the fields, even the unused ones. */
  598.     struct ExtendedColorRequester   colorstruct;
  599.  
  600.     colorstruct.defcolor = 0;
  601.     colorstruct.window = mywindow;
  602.     newcolor = ExtendedColorRequester(&colorstruct);
  603.  
  604. ;--------------------------------------------------------------------
  605.  
  606. NAME
  607.             MakeGadget
  608. SYNOPSIS
  609. MakeGadget(Buffer,String, X, Y)
  610.               A0    A1   D0 D1
  611. struct Buffer   *GadgetBlock;
  612. char            *String;
  613. long            D0,D1;
  614. DESCRIPTION
  615.  
  616.         This  routine  prepares a buffer to be a standard BOOLEAN text
  617. gadget.   This is a simple way of producing gadgets for code that must
  618. be  reentrant,  and it is more efficient than defining gadgets in data
  619. statements.    The  routine  initializes  the  gadgets  to  a  set  of
  620. 'standard' values that should cover most cases and then links the four
  621. parts of the GadgetBlock together.
  622.  
  623.     Buffer  is  a pointer to a unitialized GadgetBlock, which contains
  624. the  necessary  Gadget, Border, border pairs and IntuitText structures
  625. needed to render a boolean gadget with a border and some text.
  626.  
  627.     String  is  a  pointer  to  the text that should appear inside the
  628. gadget.   The  gadget  is  automatically  sized  to  match the strings
  629. length.
  630.  
  631.     X  and  Y are the gadgets initial position, they are simply copied
  632. into LeftEdge and TopEdge in the gadget structure.
  633.  
  634. RETURNS
  635. SEE
  636. BUGS
  637. EXAMPLE
  638.  
  639.  
  640. ;--------------------------------------------------------------------
  641.  
  642. NAME
  643.             MakeString
  644.  
  645. SYNOPSIS
  646. MakeString(Buffer,StringBuff,UndoBuff,MaxWidthBits,MaxNumChars, X, Y)
  647.              A0      A1          A2        D0          D1      D2  D3
  648.  
  649. struct Buffer   *StringBlock;
  650. char            *StringBuff;
  651. char            *UndoBuff;
  652. long            MaxWidthBits, MaxNumChars, X, Y;
  653.  
  654. DESCRIPTION
  655.  
  656.     As  with  all  of  the  MakeGadget  functions, this one prepares a
  657. buffer  to  be used as a string gadget, that may be used re-entrantly.
  658. The  buffer need not be cleared first.  This means that you may create
  659. a temporary gadget on the stack.
  660.  
  661.     The  StringBuff  is  where the body of text inside the gadget will
  662. reside.
  663.  
  664.     When   the   gadget  is  activated,  the  text  in  StringBuff  is
  665. automatically copied (by intuition) into UndoBuff.  This allows you to
  666. type  Amiga-Q  and get the old string back.  This field may be null if
  667. you wish to have no undo.
  668.  
  669.     MaxWidthBits is the width of the frame around the gadget.
  670.  
  671.     MaxNumChars  is  the maximum number of characters that you will be
  672. able  to  type  into the gadget, including the terminating zero on the
  673. string.  MAKE SURE that this number is no greater than your StringBuff
  674. size, or else you're going to be typing over memory that isn't yours.
  675.  
  676.     X,Y  are the position of the upper left hand corner of the gadget.
  677. The border is actually 2 pixels above and to the left of this corner.
  678.  
  679. RETURNS
  680.     Nothing
  681. SEE
  682.  
  683.     MakeGadget,MakeProp,MakeScrollbar,LinkGadget,LinkProp,LinkString
  684.  
  685.  
  686. ;--------------------------------------------------------------------
  687.  
  688. NAME
  689.             MakeProp
  690. SYNOPSIS
  691.  
  692. MakeProp(Buffer,Width,Height,Flags)
  693.          A0       D0   D1    D2
  694.  
  695. struct  Buffer  *PropBlock;
  696. long            Width, Height, Flags;
  697.  
  698. DESCRIPTION
  699.  
  700.     This  routine  prepares an un-initialized buffer for use as a prop
  701. gadget.
  702.  
  703.     Buffer,  on  return,  will  contain  the  gadget,  along  with the
  704. necessary PropInfo and Image structures, all linked together.
  705.  
  706.     Width is the with of the container, in pixels.
  707.     Height is the height of the container in pixels.
  708.  
  709.     The  Flags  parameter  is  where you decide if you want FREEHORIZ,
  710. FREEVERT, or both.  It is simply copied into the gadget flags field.
  711.  
  712.  
  713. RETURNS
  714.  
  715.     Nothing
  716.  
  717.  
  718. ;--------------------------------------------------------------------
  719.  
  720. NAME
  721.             DrawBox
  722. SYNOPSIS
  723.  
  724. DrawBox(rp,MinX,MinY,MaxX,MaxY)
  725.         A1  D0   D1   D2   D3
  726.  
  727. struct  RastPort        *rp;
  728. long    MinX,MinY,MaxX,MaxY;
  729.  
  730.  
  731. DESCRIPTION
  732.  
  733.         This  routine  allows you to draw a simple box in one command.
  734. It  draws  the  box  in APen color, in the current draw mode, with the
  735. current line pattern.
  736.  
  737.         (MinX,MinY)  are  the  upper  left  corner  of  the  box,  and
  738. (MaxX,MaxY) are the lower right.
  739.  
  740.         The pen is left at the upper left corner (MinX,MinY).
  741.  
  742. ;--------------------------------------------------------------------
  743.  
  744. NAME
  745.             MakeButton
  746. SYNOPSIS
  747.  
  748. MakeButton(Buffer,Image,Image2,Width,Height,Depth)
  749.              A0     A1    A2     D0    D1    D2
  750.  
  751.  
  752. struct  TwoImageGadget  *Buffer;
  753. char    *Image;     /* Pointer to the actual bitplane data */
  754. char    *Image2;    /* Pointer to the second image. */
  755. long    Width,Height,Depth;
  756.  
  757.  
  758.  
  759.  
  760. DESCRIPTION
  761.  
  762.     The  purpose  of  this  routine  is one similar to MakeGadget, but
  763. instead of using text for the button, it uses a graphic.  You supply a
  764. bitmap, and MakeButton will use it in it's rendering.
  765.  
  766.     You  may  have  either  one  or two images, the routine handles it
  767. routinely.   If you supply one image, then this sets GADGHCOMP, and if
  768. you  have two images, it sets GADGHIMAGE.  RELVERIFY is always set, so
  769. as  long  as  you  the  user  is  pressing  that gadget, the alternate
  770. highlight is shown.
  771.  
  772.     Buffer has room for two images.
  773.  
  774.     Image  is  a pointer to the actual image data, in CHIP memory, for
  775. this gadget.
  776.     Image2 is a pointer to the alternate image data.
  777.  
  778.     Width and Height make up the size of your image.
  779.  
  780.     Depth is how many bitplanes of data you've supplied.
  781.  
  782. BUGS
  783.     It's  not  really  a bug, but if your images aren't the same size,
  784. then one won't erase the other when it is drawn, so you may be showing
  785. an image with traces of the other one left there.
  786.  
  787. ;--------------------------------------------------------------------
  788.  
  789. NAME
  790.             MakeScrollBar
  791. SYNOPSIS
  792.  
  793. MakeScrollBar(Buffer,Flags,Size,X,Y)
  794.                 A0    D0    D1 D2 D3
  795.  
  796. struct ScrollBlock *Buffer;
  797. long    Flags,Size,X,Y;
  798.  
  799.  
  800. DESCRIPTION
  801.  
  802.     This is a special routine that creates a scrollbar (which consists
  803. of  a prop gadget and two arrows) and you handle it like it's a single
  804. gadget.   You  may  have  either a horizontal scrollbar, or a vertical
  805. scrollbar.   These scrollbars are very much like the ones in workbench
  806. window  borders.   These  use slightly different images on the arrows,
  807. however.
  808.  
  809.     The  way  you  determine  how  this set up and oriented is by flag
  810. combinations.   If  you wished to put a scrollbar in the bottom border
  811. of a window, then you would pass (in flags):
  812.  
  813.         Flags = (HORIZSLIDER | GRELBOTTOM | GRELWIDTH)
  814.  
  815.     If you wished it in the right border:
  816.  
  817.         Flags = (VERTSLIDER | GRELRIGHT | GRELHEIGHT)
  818.  
  819.     The  idea is to allow you to manipulate the scrollbar as though it
  820. were  a  single  gadget, not three.  If you pass confusing flags (like
  821. GRELBOTTOM|GRELHEIGHT) then it is undefined what will happen.
  822.  
  823.     If all you want is a simple scrollbar that doesn't size, then just
  824. set VERTSLIDER or HORIZSLIDER.
  825.  
  826. SEE
  827.  
  828.  
  829. ;--------------------------------------------------------------------
  830.  
  831. NAME
  832.             PurgeFiles
  833. SYNOPSIS
  834.     PurgeFiles(&FileRequesterStructure)
  835.                         A0
  836. DESCRIPTION
  837.     Clear  up  all  memory  and  file  locks  allocated  by  the  file
  838. requester.   This  routine must be called before your program exits if
  839. you  use  the  file requester with either FRQEXTSELECTM bit set or the
  840. FRQCACHINGM bit set.  The first bit is if you want the user to be able
  841. to select multiple files.  The file requester has to allocate a linked
  842. list  of  file  names which this function will purge.  The FRQCACHINGM
  843. bit  is set if you want the file requester to remember the contents of
  844. a directory between calls.
  845.  
  846.     This  routine can be called any time you want the buffers and file
  847. locks purge.
  848.  
  849. RETURNS
  850.     This routine does not return anything.
  851.  
  852. SEE
  853.     FileRequest
  854. BUGS
  855.     None known.
  856. EXAMPLE
  857.  
  858. main()
  859.     {
  860.     FileRequest(&FileRequesterStructure);
  861.  
  862.     .
  863.     .
  864.     .
  865.  
  866.     PurgeFiles(&FileRequesterStructure);
  867.     }
  868.  
  869.  
  870.  
  871. ;--------------------------------------------------------------------
  872.  
  873. NAME
  874.             GetFontHeightAndWidth
  875. SYNOPSIS
  876.  
  877. DESCRIPTION
  878.  
  879.         This allows you quick access to the font attributes set by the
  880. user  in preferences.  The font width is returned in D0 and the height
  881. is returned in D1.
  882.  
  883. RETURNS
  884. SEE
  885. BUGS
  886. EXAMPLE
  887.  
  888.  
  889.  
  890. ;--------------------------------------------------------------------
  891.  
  892. NAME
  893.             LinkGadget
  894. SYNOPSIS
  895.  
  896. LinkGadget(Buffer,String,nw, X, Y)
  897.              A0     A1   A3 D0 D1
  898.  
  899. struct  GadgetBlock *Buffer;
  900. char    *String;
  901. struct  NewWindow *nw;
  902. long    X,Y;
  903.  
  904. DESCRIPTION
  905.  
  906.     This  is  actually  a superset of the previous command MakeGadget.
  907. What  this  does  is automatically link the gadget into your NewWindow
  908. structure's gadget list.
  909.  
  910.         No registers are disturbed.
  911.  
  912. SEE
  913.     MakeGadget
  914. BUGS
  915.     n/a
  916.  
  917.  
  918.  
  919. ;--------------------------------------------------------------------
  920.  
  921. NAME
  922.             LinkStringGadget
  923. SYNOPSIS
  924. LinkStringGadget(Buffer,StringBuf,UndoBuf,nw, WidthBits,NumChars, X, Y)
  925.                    A0     A1        A2    A3     D0       D1     D2 D3
  926.  
  927. struct  StringBlock *Buffer;
  928. char    *StringBuf;
  929. char    *UndoBuf;
  930. struct  NewWindow *nw;
  931. long    WidthBits,NumChars,X,Y;
  932.  
  933. DESCRIPTION
  934.  
  935.     This  is  number 2 in the LinkGadget routines.  This one obviously
  936. links  the  string  gadget  to the window's gadget list.  In fact, the
  937. only  difference  between  this  and  the  MakeString  routine  is the
  938. addition of the NewWindow pointer.
  939.  
  940. SEE
  941.     MakeStringGadget
  942.  
  943.  
  944. ;--------------------------------------------------------------------
  945.  
  946. NAME
  947.             LinkPropGadget
  948. SYNOPSIS
  949.  
  950. LinkPropGadget(Buffer,nw, Width, Height, Flags, LeftEdge, TopEdge)
  951.                  A0   A3    D0     D1     D2       D3       D4
  952.  
  953. struct  PropBlock   *Buffer;
  954. struct  NewWindow   *nw
  955. long    Width,Height,Flags,LeftEdge,TopEdge;
  956.  
  957. DESCRIPTION
  958.  
  959.     Here  we  have a superset for MakeProp.  It works exactly the same
  960. as  MakeProp,  except  that  it attaches the gadget to the head of the
  961. list in the window.
  962.  
  963. SEE
  964.     MakeProp
  965.  
  966.  
  967. ;--------------------------------------------------------------------
  968.  
  969. FileRequester
  970.  
  971. NAME
  972.     FileRequester  - bring up a file/font requester.
  973.  
  974. SYNOPSIS
  975.     success = FileRequester(&FileRequesterStructure)
  976.       D0                              A0
  977.  
  978. FUNCTION
  979.     Bring  up  a  fully  intuitionized file/font requester (actually a
  980. window) and let the user select a file/font.
  981.  
  982. INPUTS
  983.     &FileRequesterStructure  -  pointer  to  an  initialized  (can  be
  984. initialized mostly to zeroes) file requester structure.
  985.  
  986. RESULT
  987.     Returns  TRUE  or FALSE to say whether the user selected a file or
  988. not.   The  file name(s) or font selected are then found by looking at
  989. the file requester structure whose address was passed.
  990.  
  991.     For  ideas  on  customizing the file requester for your particular
  992. system  (thus  overriding the defaults used by programmers who use the
  993. file requester) see the customizefile.asm file.
  994.  
  995. BUGS
  996.     Problem  with  an  Intuition bug that messes up the current active
  997. window  if  a  window  closes  when one of its string gadgets is still
  998. active.   This bug show up if you run the file requester straight from
  999. a CLI window and then exit it with Amiga-L.
  1000.     I have heard that it resets some window flags when run on a custom
  1001. screen,  but I believe this is a feature of Intuition, not of the file
  1002. requester.
  1003.  
  1004. SEE ALSO
  1005.     PurgeFiles
  1006.  
  1007.  
  1008.     The  file  requester  in  the  requester  library  allows to put a
  1009. powerful  and  easy  to  use  file requester into your programs with a
  1010. minimum of work and at a very small expense in program size.  The file
  1011. requester  was  designed  to be as easy as possible to call, while not
  1012. sacrificing power.
  1013.  
  1014.     To  get  the  file  requester to come up all you need to do (after
  1015. opening  the  requester  library of course) is to allocate space for a
  1016. FileRequester  structure  and  then  call  the file requester with the
  1017. address  of  this structure, with all fields initialized to zero, like
  1018. this:
  1019.  
  1020. struct FileRequester MyFileReqStruct;
  1021.  
  1022. success = FileRequester(&MyFileReqStruct);
  1023.  
  1024.     The function will return either one or zero for success or failure
  1025. respectively.
  1026.  
  1027.     You can specify what screen the file requester should appear on in
  1028. one  of  two  ways.  If you want it to appear on a custom screen, then
  1029. the  best  way  is  to  set  the  pr_WindowPtr  field  in your process
  1030. structure  to  point at one of the windows on your screen (this should
  1031. be  done anyway, so that DOS requesters appear on your custom screen).
  1032. This  field  is looked at by all functions in the requester library so
  1033. this  way  is the simplest method.  The other way, which overrides the
  1034. pr_WindowPtr  field  is to initialize the frq_Window field to point at
  1035. one of your windows.  If this field is non-zero, it is used instead of
  1036. the pr_WindowPtr field of your process structure.  Important note:  It
  1037. is  VERY  important  that you reset the pr_WindowPtr field back to its
  1038. original  value  before  your  program  exits.  If you don't, the next
  1039. program run may try to open a requester window on a now closed screen.
  1040.  
  1041.     The  file  requester  was  carefully  designed so that it could be
  1042. called  without  having  to  initialize  very  many  fields.   This is
  1043. demonstrated  by  seeing  that  it  is  possible  to  call  it without
  1044. initializing any fields.  There are a few fields that are necessary to
  1045. actually  get  any  use  out  of  it,  but  very  view.  Those few are
  1046. documented in the following paragraph.
  1047.  
  1048.     Although  you can bring the file requester up without initializing
  1049. any  fields there are a couple of fields that you will definitely want
  1050. to  initialize.   The  file  requester isn't much use unless you get a
  1051. file  name back out of it, and for this you need to initialize the Dir
  1052. and  File  fields.   These two fields should point to character arrays
  1053. that  are,  respectively,  DSIZE+1  and FCHARS+1 bytes long.  When the
  1054. file  requester  is first run the file requester looks in these arrays
  1055. for  the  default  directory  and file names and if the user selects a
  1056. file  name  the  directory  and  file  name are copied back into these
  1057. arrays.  You will probably want to initialize the Title field with the
  1058. message  that you want to have appear at the top of the file requester
  1059. window.
  1060.  
  1061.     If  you initialize the PathName field (it should point an array of
  1062. at least DSIZE+FCHARS+2 characters) then when the user selects a file,
  1063. the complete path name will be put into this array.
  1064.  
  1065.     The Window field is used to specify what window the file requester
  1066. is associated with.  This is used to get the file requester to show up
  1067. on  a  custom  screen.   Generally  this  field should be unnecessary.
  1068. There  is a variable provided in a process structure which is used for
  1069. this purpose.  Any program that opens a custom screen and uses any DOS
  1070. functions  should set the pr_Window pointer in their process structure
  1071. to  a  pointer  to their window so that DOS requesters will show up on
  1072. their  custom  screen.   If  you do this, then the file requester will
  1073. also  show  up  on  your custom screen.  If you are not using a custom
  1074. screen  then you don't need to set the pr_Window pointer or the Window
  1075. field  in  the  file  requester  structure.   Note:  If you do set the
  1076. pr_Window  structure in the process structure, be sure to return it to
  1077. its old value before your program exits.
  1078.  
  1079.     If  the  extended  select  bit  is set in the Flags field then the
  1080. MaxExtendedSelect  fields  specifies  the maximum number of files that
  1081. the user can select.  This is ignored if the extended bit isn't set in
  1082. the Flags field.
  1083.  
  1084.     numlines and numcolumns specify the maximum size that the file box
  1085. will  be in characters.  If the system is low on memory, or the screen
  1086. is  too  small,  these will be shrunk as necessary.  devcolumns is the
  1087. number of columns of characters wide that the device box will be.
  1088.  
  1089.     The  Flags field can currently contain seven different flags.  The
  1090. first  flag,  FRQSHOWINFOM,  specifies  whether  or not '*.info' files
  1091. (files  containing information for icons) should be filtered out.  The
  1092. default is for them to be filtered.
  1093.  
  1094.     The  FRQEXTSELECTM  flags  specifies  whether  extended  select is
  1095. wanted.   If  you  set this flag then you should probably also set the
  1096. MaxExtendedSelect  field.   If  you  don't  then the maximum number of
  1097. files  the  user  will be able to select will be 65536, which is a bit
  1098. high  for  most  purposes.  Note:  If you use this bit then you _must_
  1099. call  PurgeFiles()  with  the  address of your FileRequester structure
  1100. after  the  last time you call the file requester, in order to free up
  1101. any  memory  used  in  the  extended select structures.  When the user
  1102. selects  multiple files, a linked list of the file names selected (not
  1103. including the directory name) will appear in the ExtendedSelect field.
  1104. The  list  is a linked list of ESStructures.  The directory name which
  1105. should  be  prepended  to  all of these names will appear in the array
  1106. pointed to by the Dir field.
  1107.  
  1108.     The  FRQCACHINGM  flag  specifies  whether  or not directories are
  1109. cached  from  one  call  to  the next.  This is a very handy features,
  1110. especially  for those who lack hard drives.  However, if this features
  1111. is  used, you _must_ call the PurgeFiles() routine with the address of
  1112. your  FileRequester  structure  after  the last time you call the file
  1113. requester, in order to free up any memory used in caching.
  1114.  
  1115.     As  well  as being a file requester, this routine can be used as a
  1116. font requester too.  Just set the FRQGETFONTSM flags to turn it into a
  1117. font  requester.   You  should  also  put the name 'fonts:' in the Dir
  1118. array.   The file/font requester will return a one or zero for success
  1119. or  failure as usual, the font name will be returned in the File array
  1120. and  the  font  size  and  style will be returned in the FontYSize and
  1121. FontStyle  fields.   Note  that  the font requester allows the user to
  1122. change  the  directory  where  the  fonts are read from.  Although you
  1123. should  put  'fonts:' there, you should allow for the possibility that
  1124. the  user  might  change  the  directory.  They might, perhaps, have a
  1125. separate  disk  full  of  fonts.   The simplest way to deal with fonts
  1126. coming  from  different  directories,  is  to  set  the PathName field
  1127. instead of the Dir field.  You can then use the string in the PathName
  1128. field  (which  will  contain  the directory and font name) as the font
  1129. name.   If  you  don't  do this, then you have to concatenate the font
  1130. name  and  the  directory  name  yourself.   If  you  use the PathName
  1131. variable  then  it  is quite reasonable to leave the File field blank,
  1132. since  all  the information you need can be obtained from the PathName
  1133. string.
  1134.  
  1135.     The  FRQINFOGADGETM flag specifies whether or not a hide/show info
  1136. gadget should appear on the file requester.  This lets the user toggle
  1137. the  state  of  the  FRQSHOWINFOM flag to decide whether or not to let
  1138. '*.info'  files  show  up.  This is not recommended for most programs,
  1139. since  most  users  have  no  reason  to  look at '*.info' files.  The
  1140. default is to _not_ have this gadget show up.
  1141.  
  1142.     The FRQHIDEWILDSM flag specifies whether or not to have 'show' and
  1143. 'hide'  string  gadgets.   These gadgets let the user use wildcards to
  1144. specify  which  files  should  show  up.  All files are first compared
  1145. against  the 'show' gadget.  If they fail the comparison, they are not
  1146. displayed.  Then they are compared against the 'hide' gadget.  If they
  1147. match  here then they are not displayed.  If the gadgets are empty, no
  1148. comparisons  are done.  Important note:  Even if these gadgets are not
  1149. displayed,  the comparisons are still done on the data which is in the
  1150. Hide  and  Show  fields of the file requester structure.  The standard
  1151. AmigaDOS wildcards (including '#', '?', '|' and '*') are supported.
  1152.  
  1153.     Normally  the  file  requester  appears  centered  under the mouse
  1154. pointer.   If  you would like to specify its opening position you must
  1155. set   the   ABSOLUTEXYM   flag  and  then  put  the  x,y  position  in
  1156. WindowLeftEdge and WindowTopEdge.
  1157.  
  1158.     If you feel that the file requester's cached directories (selected
  1159. by  FRQCACHINGM)  should  be  purged  whenever  the directory has been
  1160. changed,  then  set  FRQCACHEPURGEM  field and the file requester will
  1161. check the dates whenever it is opened.
  1162.  
  1163.     If you feel that the file requester should never cache directories
  1164. unless  it  manages  to  read  in the entire directory before the user
  1165. sends  it  away,  then  set  the FRQNOHALFCACHEM flag.  This flag will
  1166. cause  the file requester to automatically flush any incompletely read
  1167. directories when it exits.
  1168.  
  1169.     If  you  would  like your directories to appear in 'natural' order
  1170. instead of alphabetically sorted, set the FRQNOSORTM flag.
  1171.  
  1172.     If you would like the file requester to appear without a drag bar
  1173. or depth arrangement gadgets, set the FRQNODRAGM flag.
  1174.  
  1175.     If  you  are using the file requester to select a filename to save
  1176. to,  you  should set the FRQSAVINGM flag.  Similarly, if you are using
  1177. the  file  requester to select a filename to load from, you should set
  1178. the  FRQLOADINGM flag.  These flags are not currently used by the file
  1179. requester,  but  they  may  be  used in the future.  They also make it
  1180. easier  for  people who want to personalize the file requester to make
  1181. it behave differently for loading vs.  saving.
  1182.  
  1183.  
  1184.     The  various  color  fields  let  you  specify  the colors of many
  1185. aspects of the file requester.  If they are left as zero then the file
  1186. requester uses various non-zero certain default values for them.
  1187.  
  1188.     The  WindowLeftEdge  and  WindowTopEdge  fields are covered in the
  1189. section on the ABSOLUTEXYM flag.
  1190.  
  1191.     The  FontYSize  and FontStyle fields are covered in the section on
  1192. the FRQGETFONTSM flag.
  1193.  
  1194.     The  ExtendedSelect  field  is  covered  in  the  section  on  the
  1195. FRQEXTSELECTM flag.
  1196.  
  1197.     The  Hide  and  Show  fields  are  covered  in  the section on the
  1198. FRQHIDEWILDSM flag.
  1199.  
  1200. Set this bit if you are selecting a file to save to.
  1201. Set this bit if you are selecting a file(s) to load from.
  1202. These two bits (save and load) aren't currently used for
  1203. anything, but they may be in the future, so you should
  1204. remember to set them.  Also, these bits make it easier if
  1205. somebody wants to customize the file requester for their
  1206. machine.  They can make it behave differently for loading
  1207. vs saving.
  1208.  
  1209.     The  four  BufferPos  and  DispPos  variables  are  copies  of the
  1210. equivalent  variables  from  the four string gadgets.  This is so that
  1211. when  the  file  requester goes away and then is brought up again, the
  1212. cursor in the string gadgets will appear in the same places as before.
  1213. These fields should not need to be touched by the programmer.
  1214.  
  1215.     The  rest  of the fields are private.  Don't go touching them.  We
  1216. guarantee  to  move them around and change their meaning, just to make
  1217. sure  that  nobody tries to use them.  They are largely concerned with
  1218. keeping  track  of  memory  used in directory caching.  This memory is
  1219. freed  with  the  PurgeFiles() routine.  That's all you should need to
  1220. know.
  1221.  
  1222.  
  1223.  
  1224.  
  1225.  
  1226. ;--------------------------------------------------------------------
  1227.  
  1228. RealTimeScroll
  1229.  
  1230. NAME
  1231.     RealTimeScroll  -  do the calculations necessary for a responsive,
  1232. pixel resolution, real time scroll routine.
  1233.  
  1234. SYNOPSIS
  1235.     RealTimeScroll(&ScrollStruct);
  1236.                          A0
  1237.  
  1238. FUNCTION
  1239.     Make  the  implementation  of  real time scrolling area easier and
  1240. make the real time scrolling area more responsive to the user by doing
  1241. pixel resolution scrolling and by checking the current position of the
  1242. scroll  bar  in mid scroll.  This routine calculates how far to scroll
  1243. each  time  and calculates which lines of text, graphics etc.  need to
  1244. be redrawn to fill in the empty area.
  1245.  
  1246. INPUTS
  1247.     &ScrollStruct - pointer to an initialized scroll structure.
  1248.  
  1249. RESULT
  1250.     This routine returns no result code.
  1251.  
  1252. BUGS
  1253.     None known
  1254.  
  1255. SEE ALSO
  1256.     n/a
  1257.  
  1258.  
  1259.     It is relatively easy to implement a real time scrolling area, but
  1260. the most obvious implementations suffer from a lack of responsiveness.
  1261. Typically  the  routines  look  at  where the scroll bar is, calculate
  1262. where  to  scroll  to,  scroll  there  in  several  jumps  to make the
  1263. scrolling  look smooth, and the examine the scroll bar again to see if
  1264. it  has  moved.  This means that there are periods, perhaps annoyingly
  1265. long,  where  the  program may be scrolling in one direction while the
  1266. scroll  bar is being dragged in another.  The answer is to examine the
  1267. scroll  bar  to  find out the desired location, scroll partway towards
  1268. the  destination and then recheck the scroll bar's location.  This can
  1269. greatly  increase  the  responsiveness,  since the program is checking
  1270. after  every  ScrollRaster()  call,  instead of after a dozen or more.
  1271. However,  the  calculations,  especially  of  which  lines  need to be
  1272. refreshed  and  where, get somewhat more complicated.  This routine is
  1273. designed  to  simplify this situation by taking care of as many of the
  1274. messy details as possible.
  1275.  
  1276.     First   you   must   initialize   the   scroll   structure.    The
  1277. TopEntryNumber, NumEntries and NumLines fields describe where the data
  1278. is  currently.   NumEntries  is  the number of lines of data in total,
  1279. NumLines  is  the number of lines that are visible, and TopEntryNumber
  1280. is the line number of the first line visible (it therefore ranges from
  1281. zero to NumEntries - 1).
  1282.  
  1283.     LineSpacing  is  the  number of pixels high that each line of data
  1284. is.   For  text  this  will  typically be eight or nine (for eighty or
  1285. sixty  column  topaz).   This  can  be  set  to  one  if  your data is
  1286. continuous (as in the case of some graphics).
  1287.  
  1288.     PropGadget  is a pointer to the prop gadget which is being used to
  1289. control this scroll area.
  1290.  
  1291.     RedrawAll  is  a  pointer  to  a  function that you must supply to
  1292. redraw the entire visible window.  This routine is called whenever the
  1293. user  gets  so far ahead of the scroll routine that scrolling to where
  1294. the  users  wants  to  be  would  take  too long.  Before calling this
  1295. routine,  the  ScrollStruct that was passed to this routine is updated
  1296. with  the  desired TopEntryNumber so that your routine will know which
  1297. data to redraw.
  1298.  
  1299.     ReadMore is an optional routine that will usually not be used.  It
  1300. is  used  if more data is being added while the scrolling is going on.
  1301. This  is  used,  for  instance,  by  the  FileRequest in the requester
  1302. library, to continue attempting to read the directoy while the user is
  1303. scrolling.   Leave  this set to zero if you don't need it.  It is only
  1304. called  when no scrolling is being done, but the user has not released
  1305. the scroll bar.
  1306.  
  1307.     ScrollAndDraw  is the most important routine.  This routine, which
  1308. you  must  supply,  is called whenever the data must be scrolled.  The
  1309. actual  scrolling  and  redrawing of the data is done by this routine,
  1310. but because the scroll amount, the lines to be drawn and the number of
  1311. lines  to  be  drawn are passed to this routine, the routine is fairly
  1312. simple.  Four parameters are passed to this routine:
  1313.  
  1314. ScrollAndDraw(firstlinenum, firstliney, scrollamount, numlines, scrollstruct);
  1315.                   D0            D1           D2          D3         A0
  1316.     All  four parameters are passed as longs, both on the stack and in
  1317. D0-D3 and A0, so that the routine can easily be written in either C or
  1318. assembler.
  1319.  
  1320.     When the ScrollAndDraw, ReadMore or RedrawAll routines are called,
  1321. A4,  A5  and  A6  all  contain  the  same  values  they contained when
  1322. RealTimeScroll  was  called.   This allows programs written in C using
  1323. the  small  data  model  to be able to access their data properly from
  1324. these  routines without any special work.  All other registers (except
  1325. those that are used to pass parameters in) could contain anything.
  1326.  
  1327.  
  1328.  
  1329.  
  1330. ;--------------------------------------------------------------------
  1331.  
  1332.  
  1333.  
  1334. TextRequest
  1335.  
  1336. NAME
  1337.     TextRequest  - bring up a text requester with one to three gadgets
  1338. and get a response.
  1339.  
  1340. SYNOPSIS
  1341.     result = TextRequest(&TRStructure);
  1342.       D0                      A0
  1343.  
  1344. FUNCTION
  1345.     Bring  up  a requester (actually a window) containing a message to
  1346. the  user  and  give  him  a  choice  of  from  one to three different
  1347. responses.   The  window  automatically  sizes  to  fit  the  text and
  1348. printf() style formatting can be used by TextRequest() to generate the
  1349. message to the user.
  1350.  
  1351. INPUTS
  1352.     &TRStructure - pointer to an initialized text requester structure.
  1353.  
  1354. RESULT
  1355.     Returns  either  zero,  one  or two, depending on which gadget the
  1356. user  clicks  on.   All  of  the  gadgets  are  optional,  so that the
  1357. requester  can  be  used  to  bring up requesters that give the user a
  1358. message,  without demanding an answer, by having only a single gadget.
  1359. The  gadget  in  the  lower  right  hand  corner (the negative gadget)
  1360. returns a zero, the gadget in the lower left hand corner (the positive
  1361. gadget)  returns a one and the gadget in the middle returns a two.  If
  1362. none  of these three gadgets are requested, a close gadget is attached
  1363. to the window and it returns a zero.
  1364.  
  1365. BUGS
  1366.     If  any  line  of  the  text  to  be printed is too long, then the
  1367. requester  will  attempt  to open up an impossibly large window, which
  1368. will fail and the requester will return a zero.
  1369.     The  buffer used for formatting the text is 5000 bytes long, so no
  1370. messages can be longer than this.
  1371.  
  1372. SEE ALSO
  1373.     SimpleRequest
  1374.     TwoGadRequest
  1375.  
  1376.  
  1377.     The  purpose  of  this  routine  is  to  make  it as easy to print
  1378. formatted  messages  in  intuitionized window with gadgets as it is to
  1379. print  them  on the CLI screen.  For maximum ease of use, at a loss of
  1380. flexibility,  please see the functions SimpleRequest and TwoGadRequest
  1381. which  are  simply  glue  code functions to make calling TextRequest a
  1382. trivial matter.
  1383.  
  1384.     If  you want the text requester to appear on a custom screen, then
  1385. you must set the pr_WindowPtr field in your process structure to point
  1386. at  one  of the windows on your screen (this should be done anyway, so
  1387. that  DOS  requesters  appear  on  your custom screen).  This field is
  1388. looked at by all functions in the requester library so this way is the
  1389. simplest method.  Important note:  It is VERY important that you reset
  1390. the  pr_WindowPtr field back to its original value before your program
  1391. exits.  If you don't, the next program run may try to open a requester
  1392. window on a now closed screen.
  1393.  
  1394.     The  structure  whose  address  is  passed to this routine must be
  1395. initialized first.
  1396.  
  1397.     The  Text field is initialized with the body of the text you would
  1398. like  displayed.  This text can contain both printf() style formatting
  1399. and  end  of  line characters ('\n' in C, ascii 10 in assembler).  The
  1400. printf()  style formatting, is expanded out into the final text string
  1401. using  the  parameter  list which is pointed to by the Controls field.
  1402. Line  feeds  are  used, as usual, to specify a new line, thus allowing
  1403. very  long  and  complex  messages  to  be  displayed.   The  are some
  1404. limitations  on  the  types  of  printf() formatting that can be used.
  1405. Since the RawDoFmt() function of the ROM is used to do the formatting,
  1406. only   functions   supported   by   it  can  be  used.   For  complete
  1407. documentation,  see  the documentation of the RawDoFmt() command.  The
  1408. main  things  to be aware of is that floating point numbers can not be
  1409. printed,  and,  if  you  are using a compiler that uses thirty-two bit
  1410. ints  then  we  will  have to specify '%ld' to print an int, since the
  1411. RawDoFmt command assumes an int size of sixteen bits.
  1412.  
  1413.     The Controls field points to a list of parameters, one for each of
  1414. the  '%'  parameters in the Text field.  Normally these will be pushed
  1415. on  to the stack and the stack pointer copied into the Controls field.
  1416. The first parameter used (the first one to occur in the string) should
  1417. be  at  the beginning of the list, that is, at the lowest address, the
  1418. one pointed at by the Controls parameter.
  1419.  
  1420.     The Window field can be used to specify what screen you would like
  1421. the requester to appear on.  This field is usually not necessary since
  1422. the same information can be conveyed in the pr_WindowPtr field of your
  1423. process  structure.   However  this  field  was  left  in  so that the
  1424. TextRequest  function  could  be  called  from  a  task (which lacks a
  1425. process  structure and therefore a pr_WindowPtr field).  If this field
  1426. is  non-zero or if the calling program is a task then this field takes
  1427. precedence over the pr_WindowPtr field.
  1428.  
  1429.     MiddleText,  PositiveText  and NegativeText are the pieces of text
  1430. used  for  the  three gadgets.  These three gadgets, when present, are
  1431. placed   in  the  middle,  the  left  and  the  right  of  the  window
  1432. respectively.   All  three  gadgets are placed along the bottom of the
  1433. window.   All of the gadgets are optional.  If a gadget is not wanted,
  1434. the  text  pointer  should be set to zero.  The values returned if the
  1435. user  clicks  on these gadgets are two, one or zero, respectively.  If
  1436. none  of  the gadgets are present (if all of the text fields are zero)
  1437. then  a  standard  CLOSEWINDOW gadget is attached to the window.  This
  1438. gadget returns a zero.
  1439.  
  1440.     The  requester  attempt  to  appear so that the negative gadget is
  1441. underneath  the  mouse pointer.  If the negative gadget is not present
  1442. it will attempt to appear so that a different gadget is underneath the
  1443. mouse  pointer.   This is to make it as convenient as possible for the
  1444. user  to  respond  to,  and  especially  to respond negatively to, the
  1445. requester.
  1446.  
  1447.     In  addition  to  responding  to  the  requester  with  the mouse,
  1448. keyboard  shortcuts are available.  The user can type ESC, 'N', 'Q' or
  1449. 'B'  as  a  shortcut to clicking on the negative gadget.  The user can
  1450. type  'Y'  or 'V' as a shortcut to clicking on the positive gadget and
  1451. can type 'M' as a shortcut to clicking on the middle gadget.
  1452.  
  1453.     The  Title  field  of  the structure should either point to a null
  1454. terminated  string  to  be  used in the windows title bar or should be
  1455. null.
  1456.  
  1457.     The  KeyMask  field  is  used  to  regulate  the  use  of keyboard
  1458. shortcuts.  The qualifier field of all keyboard messages is ANDed with
  1459. this  field,  and  the  keypress  is  ignored  if  the result is zero.
  1460. Therefore,  to enable all keypresses to be used as keyboard shortcuts,
  1461. initialize  this  field to $FFFF.  To turn off the keyboard shortcuts,
  1462. initialize  this  field to 0.  To force the user to hold down the left
  1463. or right amiga key, initialize this field to AMIGAKEYS.
  1464.  
  1465.     The  textcolor,  detailcolor  and  blockcolor  fields  can be left
  1466. unitialized (ie; set to zero) if you wish, in which case the requester
  1467. will  use  the  default values of one, zero and one respectively.  The
  1468. textcolor  field  is used for the color of the actual text message and
  1469. the detail and block color fields are simple copied into the fields of
  1470. the same name in the new window structure.
  1471.  
  1472. ;--------------------------------------------------------------------
  1473.  
  1474.  
  1475. SimpleRequest
  1476.  
  1477. NAME
  1478.     SimpleRequest - bring up a text requester and wait for the user to
  1479. acknowledge it.
  1480.  
  1481. SYNPOSIS
  1482.     SimpleRequest(string, parameterlist, , ,)
  1483.                     A0        A1
  1484.  
  1485. FUNCTION
  1486.     Bring  up  a requester (actually a window) containing a message to
  1487. the  user  and  wait  for  the  user  to  acknowledge  it.  The window
  1488. automatically  sizes to fit the text and printf() style formatting can
  1489. be used by TextRequest() to generate the message to the user.
  1490.  
  1491.                                  --------
  1492.  
  1493.     This  is  actually just if you are going to call the gluecode.  If
  1494. you  are  using  Lattice  C,  (version 5.00+) you can use pragmas, and
  1495. don't  need  glucode.   This  has the slight drawback of also removing
  1496. SimpleRequest()  and TwoGadRequest(), so here they are in C so you can
  1497. put them in your code:
  1498.  
  1499. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1500.  
  1501. void __stdargs SimpleRequest(char *str,...)
  1502.     {
  1503.     va_list ap;
  1504.     struct TRStructure trs;
  1505.  
  1506.     va_start(ap,str);
  1507.  
  1508.     trs.Text = str;
  1509.     trs.Controls = ap;
  1510.     trs.Window = 0;
  1511.     trs.MiddleText = 0;
  1512.     trs.PositiveText = 0;
  1513.     trs.NegativeText = "Resume";
  1514.     trs.Title = "Ahem...";
  1515.     trs.KeyMask = 0xFFFF;
  1516.     trs.textcolor = 2;
  1517.     trs.detailcolor = 3;
  1518.     trs.blockcolor = 2;
  1519.     trs.versionnumber = REQVERSION;
  1520.     trs.Timeout = 0;    /* you could put a timeout here if you wanted */
  1521.     trs.AbortMask = 0;    /* If you wanted to abort this requester from another */
  1522.                         /* process, pass the mask for Signal() in this element. */
  1523.                         /* Then just Signal() the process that brought up the requester */
  1524.     trs.rfu1 = 0;
  1525.     TextRequest(&trs);
  1526.     va_end(ap);
  1527.     }
  1528.  
  1529. short __stdargs TwoGadRequest(char *str,...)
  1530.     {
  1531.     va_list ap;
  1532.     struct TRStructure trs;
  1533.     short res;
  1534.  
  1535.     va_start(ap,str);
  1536.  
  1537.     trs.Text = str;
  1538.     trs.Controls = ap;
  1539.     trs.Window = 0;
  1540.     trs.MiddleText = 0;
  1541.     trs.PositiveText = "  OK  ";
  1542.     trs.NegativeText = "CANCEL";
  1543.     trs.Title = "Ahem...";
  1544.     trs.KeyMask = 0xFFFF;
  1545.     trs.textcolor = 2;
  1546.     trs.detailcolor = 3;
  1547.     trs.blockcolor = 2;
  1548.     trs.versionnumber = REQVERSION;
  1549.     trs.Timeout = 0;    /* you could put a timeout here if you wanted */
  1550.     trs.AbortMask = 0;    /* If you wanted to abort this requester from another */
  1551.                         /* process, pass the mask for Signal() in this element. */
  1552.                         /* Then just Signal() the process that brought up the requester */
  1553.     trs.rfu1 = 0;
  1554.  
  1555.     res = TextRequest(&trs);
  1556.     va_end(ap);
  1557.     return(res);
  1558.     }
  1559.  
  1560.  
  1561. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1562.  
  1563.  
  1564. INPUTS
  1565.     string  -  a  null  terminated  string,  containing printf() style
  1566. formatting commands if desired.
  1567.     parameterlist - the parameters corresponding to the printf() style
  1568. formatting  commands  in  the string.  In C these are listed after the
  1569. control  string,  exactly as with printf().  In assembler, the address
  1570. of the list of parameters is put in A1.
  1571.  
  1572. RESULT
  1573.     No result code is returned.
  1574.  
  1575. BUGS
  1576.     See TextRequest
  1577.  
  1578. SEE ALSO
  1579.     TextRequest
  1580.     TwoGadRequest
  1581.  
  1582.  
  1583.     This  function was designed to make it as easy to give messages to
  1584. the  user  and await acknowledgment in an intuition style requester as
  1585. it  is  using  printf() and getc().  Simply replace almost any call to
  1586. printf()  with a call to SimpleRequest and a requester will appear and
  1587. not  disappear until the user acknowledges it (either with a keystroke
  1588. or with the mouse).
  1589.  
  1590.     Example:
  1591.         SimpleRequest("There  have  %d  changes  made  to this file.",
  1592.                         numchanges);
  1593.  
  1594.     Please  see  the  TextRequest  documentation for further important
  1595. details.   This  routine  is simply a few lines of assembler glue code
  1596. for  the TextRequest routine.  The TextRequest routine is a little bit
  1597. more   complicated   to   use,  but  it  allows  correspondingly  more
  1598. flexibility.   It  is  fairly  simple to modify the glue code to allow
  1599. still more high level entry points to the TextRequest routine.
  1600.  
  1601.  
  1602.     This  is  a  complete  program that makes use of the SimpleRequest
  1603. function  from  assembler,  and  demonstrates a few of the features of
  1604. Format (which is used by SimpleRequest).
  1605.  
  1606. ;--------------------------------------------------------------------
  1607. ;-----CUT HERE---------------CUT HERE--------------------------------
  1608. ;--------------------------------------------------------------------
  1609.  
  1610.     INCLUDE "libraries/reqbase.i"
  1611.  
  1612.     public  SimpleRequest
  1613.     public  _ReqBase,_main
  1614.  
  1615. ;--------------------------------------------------------
  1616. ; This file should be linked with reqglue.o, for the SimpleRequest
  1617. ;function.
  1618. ;--------------------------------------------------------
  1619.  
  1620. SYS MACRO
  1621.     XREF    _LVO\1
  1622.     JSR _LVO\1(A6)
  1623.     ENDM
  1624.  
  1625. ;--------------------------------------------------------
  1626.  
  1627.  
  1628. _main
  1629.     OpenReq
  1630. mystart
  1631.  
  1632.     MOVE.L  A6,A5
  1633.     MOVE.L  A6,_ReqBase
  1634.  
  1635.  
  1636.     PEA     string
  1637.     MOVE.L  #$C0FFEE,-(SP)
  1638.     MOVE.W  #$1CE,-(SP)
  1639.     MOVE.W  #'B',-(SP)
  1640.     MOVE.L  #-12345,-(SP)
  1641.     MOVE.L  SP,A1
  1642.     LEA     Text,A0
  1643.     JSR     SimpleRequest
  1644.  
  1645.     LEA     16(SP),SP
  1646.  
  1647.     MOVE.L  A5,A1
  1648.     MOVE.L  4,A6
  1649.     SYS     CloseLibrary
  1650.  
  1651.     MOVEQ   #0,D0
  1652.     RTS
  1653. string
  1654.     DC.B    "This is a string.",0
  1655. Text
  1656.     DC.B    "A long (signed) decimal is: %ld,",10
  1657.     DC.B    "a character is: %c,",10
  1658.     DC.B    "a 16 bit hex val might be: %x, ",10
  1659.     DC.B    "a register-style format 32 bit hex: $%08lx,",10
  1660.     DC.B    "and a string might read: `%s'.",0
  1661.  
  1662.     dseg
  1663.  
  1664. _ReqBase    DC.L    0   ;The SimpleRequest function in the glue code
  1665.                         ;needs this variable.
  1666.  
  1667.     END
  1668.  
  1669. ;--------------------------------------------------------------------
  1670. ;-----CUT HERE---------------CUT HERE--------------------------------
  1671. ;--------------------------------------------------------------------
  1672.  
  1673.  
  1674.  
  1675.  
  1676. ;--------------------------------------------------------------------
  1677.  
  1678.  
  1679.  
  1680. TwoGadRequest
  1681.  
  1682. NAME
  1683.     TwoGadRequest - bring up a text requester and wait for the user to
  1684. acknowledge it.
  1685.  
  1686. SYNPOSIS
  1687.     result = TwoGadRequest(string, parameterlist, , ,)
  1688.                              A0        A1
  1689.  
  1690. FUNCTION
  1691.     Bring  up  a requester (actually a window) containing a message to
  1692. the user and wait for the user to click on either the OK or the CANCEL
  1693. gadget.   The  window automatically sizes to fit the text and printf()
  1694. style  formatting can be used by TextRequest() to generate the message
  1695. to the user.
  1696.  
  1697.                                    -----
  1698.  
  1699.     See SimpleRequest() above if you are using Lattice 5.00+.
  1700.  
  1701. INPUTS
  1702.     string  -  a  null  terminated  string,  containing printf() style
  1703. formatting commands if desired.
  1704.     parameterlist - the parameters corresponding to the printf() style
  1705. formatting  commands  in  the string.  In C these are listed after the
  1706. control  string,  exactly as with printf().  In assembler, the address
  1707. of the list of parameters is put in A1.
  1708.  
  1709. RESULT
  1710.     Either  one  or  zero  is  returned, depending on whether the user
  1711. selected, respectively, the OK or the CANCEL gadget.
  1712.  
  1713. BUGS
  1714.     See TextRequest
  1715.  
  1716. SEE ALSO
  1717.     TextRequest
  1718.     SimpleRequest
  1719.  
  1720.  
  1721.     This  function was designed to make it as easy to give messages to
  1722. the  user  and get a response in an intuition style requester as it is
  1723. using printf() and getc().  Simply replace almost any call to printf()
  1724. with  a  call  to  SimpleRequest  and  a requester will appear and not
  1725. disappear  until  the  user responds to it (either with a keystroke or
  1726. with the mouse).
  1727.  
  1728.     Example:
  1729.         if (TwoGadRequest("There have %d changes made to this file.\n"
  1730.                           "O.K. to continue?",
  1731.                           numchanges))
  1732.             exit(10);
  1733.  
  1734.     Please  see  the  TextRequest  documentation for further important
  1735. details.   This  routine  is simply a few lines of assembler glue code
  1736. for  the TextRequest routine.  The TextRequest routine is a little bit
  1737. more   complicated   to   use,  but  it  allows  correspondingly  more
  1738. flexibility.   It  is  fairly  simple to modify the glue code to allow
  1739. still more high level entry points to the TextRequest routine.
  1740.  
  1741.  
  1742.  
  1743. -------------------------------------------------------------------
  1744. NAME
  1745.     GetString
  1746.  
  1747. BOOL = GetString(buffer, title, window, visiblechars, maxchars)
  1748. D0                 A0      A1     A2        D0          D1
  1749.  
  1750. DESCRIPTION
  1751.     This  routine allows you to bring up a nice intuition style string
  1752. requester  in  its  own window and get a single line of input from the
  1753. user in just a one line function call.
  1754.  
  1755.     buffer  points  to  the  a buffer containing the string which will
  1756. appear  when  the string gadget first appears and it is also where the
  1757. result will be put, if this routine returns TRUE.
  1758.     Title  is  a pointer to a null terminated string that will be used
  1759. for the window title.
  1760.     Window  can  be  used  to  specify  what screen you would like the
  1761. requester  to  appear on.  You simply put a window pointer in it (or a
  1762. zero if you want the requester to appear on the workbench screen).  If
  1763. you have already set your pr_WindowPtr then you can simply pass a zero
  1764. for the window pointer and the pr_WindowPtr value will be used.
  1765.     visiblechars  specifies  how  many  characters  should actually be
  1766. visible at one time.
  1767.     maxchars   specifies   how  long  the  buffer  is,  including  the
  1768. terminating zero.
  1769.  
  1770. RETURNS
  1771.     This  routine returns true or false, depending on whether the user
  1772. clicked  on  the  cancel  gadget  (FALSE)  or clicked on the OK gadget
  1773. (TRUE)  or clicked on the close window gadget (FALSE) or hit return in
  1774. the string gadget (TRUE).
  1775.  
  1776. BUGS
  1777.     None known.
  1778.  
  1779.  
  1780.  
  1781. -------------------------------------------------------------------
  1782. NAME
  1783.     GetLong
  1784.  
  1785. BOOL = GetLong(&GetLongStruct)
  1786. D0                   A0
  1787.  
  1788. DESCRIPTION
  1789.     This  routine allows you to bring up a nice intuition style string
  1790. requester  in  its  own  window and get a single signed thirty-two bit
  1791. number  from the user in just a one line function call (although a few
  1792. fields in the structure must be initialized first).
  1793.  
  1794.     The  GetLongStruct  contains  fields  for  letting you specify the
  1795. title  bar  message,  the  default  value  that  should  appear in the
  1796. requester  and  the maximum and minimum values that the routine should
  1797. allow  to  be  entered.   If  the  routine  returns  TRUE  (indicating
  1798. successful  entry  of  a  number)  then  the result is returned in the
  1799. result field of the structure.
  1800.     The window field can be used to specify what screen you would like
  1801. the requester to appear on.  You simply put a window pointer in it (or
  1802. a  zero  if you want the requester to appear on the workbench screen).
  1803. If  you  have  already set your pr_WindowPtr then you can simply leave
  1804. the window field zeor and the pr_WindowPtr value will be used.
  1805.  
  1806. RETURNS
  1807.     This  routine  returns  TRUE  or  FALSE  (1 or 0) in D0 to specify
  1808. whether  or  not  the  user  successfully  entered  a number.  If this
  1809. routine  returns TRUE then you can find the result in the result field
  1810. of the GetLongStruct whose address you passed to GetLong.
  1811.  
  1812.  
  1813.  
  1814. -------------------------------------------------------------------
  1815. RawKeyToAscii
  1816.  
  1817. SYNOPSIS
  1818.  
  1819.  key = RawKeyToAscii(Code,Qualifier,IAddress)
  1820.  D0                   D0     D1        A0
  1821.  
  1822.  UWORD  Code,Qualifier;
  1823.  APTR   IAddress;
  1824.  
  1825. FUNCTION
  1826.  
  1827.     Have you ever wanted to have both RAW and COOKED keys?  You can do
  1828. it by checking the keys for whatever raw keys you want, and then using
  1829. the  console.device's RawKeyConvert routine, except that it's a hassle
  1830. to start mucking about with the device.
  1831.  
  1832.     Well, here you go!  A nice, clean way of converting from a raw key
  1833. to  a  cooked  key,  in a single call!  All you have to do is pass the
  1834. code  and  qualifier  from  your  intuimessage, and the address of the
  1835. message  itself, and you will get back the ASCII value of the key that
  1836. was  hit.  This does, in fact, use the console.device's RawKeyConvert,
  1837. so that if you have a different keymap set, it will be used.
  1838.  
  1839. EXAMPLE
  1840.  
  1841.  
  1842. struct IntuiMessage *im;
  1843.  
  1844.     key = RawKeyToAscii(im->Code,im->Qualifier,im->IAddress);
  1845.  
  1846. -------------------------------------------------------------------
  1847.  
  1848. NAME
  1849.          NewGetString
  1850.  
  1851. SYNOPSIS
  1852.  
  1853. BOOL = NewGetString(&GetStringStruct)
  1854. D0                         A0
  1855.  
  1856. DESCRIPTION
  1857.  
  1858.     This is very similar to GetLong() above, except that it allows you
  1859. to  get  an  ASCII  string.   As opposed to GetLong, however, you have
  1860. control  over  how  wide  the  window  is, and how many characters the
  1861. string gadget can contain.  All unused fields MUST be set to 0.
  1862.  
  1863. RETURNS
  1864.  
  1865.     It  returns  TRUE  if  the  user  clicked  OK or hit return, or it
  1866. returns FALSE if the user clicked the close box or CANCEL.
  1867.