home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 298.lha / FileReq / FileReq.doc < prev    next >
Text File  |  1980-12-02  |  6KB  |  133 lines

  1. /****************************************************************************
  2.  *                                                                          *
  3.  *                              File Requester                              *
  4.  *                                                                          *
  5.  *                   (c) Copyright 1989 Jonathan Potter                     *
  6.  *                                                                          *
  7.  * This program is freely redistributable, although all rights to it remain *
  8.  * with the author. It may be used freely in any program as long as this    *
  9.  * notice remains intact, however, if you do this, please mention the       *
  10.  * author in the program. If you wish to use this in a commercial program   *
  11.  * of any kind, you must register with a $15 donation.                      *
  12.  * Please send donations, bug reports, comments and suggestions to :        *
  13.  *                                                                          *
  14.  *                              Jonathan Potter                             *
  15.  *                              3 William Street                            *
  16.  *                              Clarence Park 5034                          *
  17.  *                              South Australia                             *
  18.  *                              Australia                                   *
  19.  *                                                                          *
  20.  *                         Ph : (08) 2932788  home                          *
  21.  *                                                                          *
  22.  ****************************************************************************/
  23.  
  24.  
  25. This is my second attempt at a file requester (for the first, see Fish Disk
  26. 204). However, this file requester is a very powerful one, designed for
  27. inclusion in any program. It is based upon the Sculpt 3D (Byte-by-Byte)
  28. file requester that I saw for about 3 seconds in a shop one day, however I
  29. think that it is even better than that one.
  30.  
  31.  
  32. HOW TO USE THE FILE REQUESTER
  33.  
  34.  
  35. The file requester presents a very easy way to access any file anywhere on
  36. the Amiga. It consists of several different gadgets :
  37.  
  38.    o  Directory gadgets which allow you to select a file, drawer or volume
  39.       by scrolling through a list and clicking on the one you want, or by
  40.       entering your own in a string gadget.
  41.  
  42.    o  PARENT gadget allows you to jump back to the parent of the current
  43.       directory.
  44.  
  45.    o  OKAY gadget which you use to end the requester and accept your
  46.       choices. An alternative to this is double clicking on a file name.
  47.  
  48.    o  CANCEL gadget which you use to end the requester and reject your
  49.       choices.
  50.  
  51.    o  RENAME gadget which allows you to rename the currently selected
  52.       file.
  53.  
  54.    o  DELETE gadget which allows you to delete the currently selected
  55.       file.
  56.  
  57.    o  MAKE DIR gadget which allows you to make a subdirectory in the
  58.       current directory.
  59.  
  60. To scroll through the lists of files, drawers and volumes you have a
  61. slider which lets you scan quickly through the entries, and an up and
  62. down gadget which allows you to move through the list one entry at a time.
  63. When the requester is first opened, the available volumes are read in,
  64. sorted, and added to the list. The current directory is then searched for
  65. files and subdirectories, which are then sorted.
  66. All gadgets are active while the directories are being read/sorted.
  67. The volume list is only updated on disk changes, however the file and
  68. drawer lists are updates whenever you change directory (or choose
  69. a new volume).
  70.  
  71.  
  72. HOW TO CALL THE FILE REQUESTER
  73.  
  74.  
  75. To use the file requester, you should link with the file FileReq.o, and
  76. include the file FileReq.h, to make use of return codes.
  77. FileReq.o compiles like this under Aztec:
  78.  
  79.          cc +L -S FileReq                 (complex, eh?)
  80.  
  81. and when you link you should use the +Cd option.
  82. Under Lattice, it compiles like this:
  83.  
  84.          lc -ad FileReq
  85.  
  86. You must have intuition.library, graphics.library and dos.library open
  87. before you call (in IntuitionBase, GfxBase and DosBase, of course).
  88. To call the file requester, you call the routine file_request().
  89. file_request() takes several parameters; these are :
  90.  
  91.          struct Screen *dest_scr;
  92.          char *hail;
  93.          int x, y;
  94.          char *device, *directory, *filename;
  95.          BOOL SortOn;
  96.  
  97. dest_scr is the destination screen for the file requester, or NULL if you
  98. want it to open on the Workbench screen.
  99. hail is the hailing text, or NULL if you want the default "File Request".
  100. x, y are the x and y coordinates for the file requester to open at, or
  101.  -1,-1 if you want the default 8,25.
  102. device is a pointer to a buffer for the volume name.
  103. directory is a pointer to a buffer for the directory name.
  104. filename is a pointer to a buffer for the filename.
  105. SortOn is a flag if you want directory sorting. Pass TRUE if you want
  106. all directory entries sorted, FALSE if you don't.
  107.  
  108. device, directory and filename can be initialized beforehand. device and
  109. filename must be at least 32 characters large, and directory must be 236.
  110. For instance,
  111.  
  112.    char devbuffer[32], dirbuffer[236], filebuffer[32];
  113.    file_request(NULL,"Woopee!",-1,-1,devbuffer,dirbuffer,filebuffer,TRUE);
  114.  
  115. When the file requester closes, it will return FALSE if cancel was chosen,
  116. TRUE if okay was chosen or a filename was double clicked, or another value
  117. corresponding to an error. To interpret these, include the file FileReq.h
  118. When you get back, the device buffer will contain the volume name, with a
  119. colon at the end. The directory buffer will contain the directory name,
  120. with a tailing slash. The filename buffer will contain the filename.
  121. Therefore, to get the full file/path name, you could
  122.  
  123.    char fullname[400];
  124.    strcpy(fullname,devbuffer);
  125.    strcat(fullname,dirbuffer);
  126.    strcat(fullname,filebuffer);
  127.  
  128.  
  129. IS THAT ALL THERE IS TO IT?
  130.  
  131.  
  132. Yes.
  133.