home *** CD-ROM | disk | FTP | other *** search
- /****************************************************************************
- * *
- * File Requester *
- * *
- * (c) Copyright 1989 Jonathan Potter *
- * *
- * This program is freely redistributable, although all rights to it remain *
- * with the author. It may be used freely in any program as long as this *
- * notice remains intact, however, if you do this, please mention the *
- * author in the program. If you wish to use this in a commercial program *
- * of any kind, you must register with a $15 donation. *
- * Please send donations, bug reports, comments and suggestions to : *
- * *
- * Jonathan Potter *
- * 3 William Street *
- * Clarence Park 5034 *
- * South Australia *
- * Australia *
- * *
- * Ph : (08) 2932788 home *
- * *
- ****************************************************************************/
-
-
- This is my second attempt at a file requester (for the first, see Fish Disk
- 204). However, this file requester is a very powerful one, designed for
- inclusion in any program. It is based upon the Sculpt 3D (Byte-by-Byte)
- file requester that I saw for about 3 seconds in a shop one day, however I
- think that it is even better than that one.
-
-
- HOW TO USE THE FILE REQUESTER
-
-
- The file requester presents a very easy way to access any file anywhere on
- the Amiga. It consists of several different gadgets :
-
- o Directory gadgets which allow you to select a file, drawer or volume
- by scrolling through a list and clicking on the one you want, or by
- entering your own in a string gadget.
-
- o PARENT gadget allows you to jump back to the parent of the current
- directory.
-
- o OKAY gadget which you use to end the requester and accept your
- choices. An alternative to this is double clicking on a file name.
-
- o CANCEL gadget which you use to end the requester and reject your
- choices.
-
- o RENAME gadget which allows you to rename the currently selected
- file.
-
- o DELETE gadget which allows you to delete the currently selected
- file.
-
- o MAKE DIR gadget which allows you to make a subdirectory in the
- current directory.
-
- To scroll through the lists of files, drawers and volumes you have a
- slider which lets you scan quickly through the entries, and an up and
- down gadget which allows you to move through the list one entry at a time.
- When the requester is first opened, the available volumes are read in,
- sorted, and added to the list. The current directory is then searched for
- files and subdirectories, which are then sorted.
- All gadgets are active while the directories are being read/sorted.
- The volume list is only updated on disk changes, however the file and
- drawer lists are updates whenever you change directory (or choose
- a new volume).
-
-
- HOW TO CALL THE FILE REQUESTER
-
-
- To use the file requester, you should link with the file FileReq.o, and
- include the file FileReq.h, to make use of return codes.
- FileReq.o compiles like this under Aztec:
-
- cc +L -S FileReq (complex, eh?)
-
- and when you link you should use the +Cd option.
- Under Lattice, it compiles like this:
-
- lc -ad FileReq
-
- You must have intuition.library, graphics.library and dos.library open
- before you call (in IntuitionBase, GfxBase and DosBase, of course).
- To call the file requester, you call the routine file_request().
- file_request() takes several parameters; these are :
-
- struct Screen *dest_scr;
- char *hail;
- int x, y;
- char *device, *directory, *filename;
- BOOL SortOn;
-
- dest_scr is the destination screen for the file requester, or NULL if you
- want it to open on the Workbench screen.
- hail is the hailing text, or NULL if you want the default "File Request".
- x, y are the x and y coordinates for the file requester to open at, or
- -1,-1 if you want the default 8,25.
- device is a pointer to a buffer for the volume name.
- directory is a pointer to a buffer for the directory name.
- filename is a pointer to a buffer for the filename.
- SortOn is a flag if you want directory sorting. Pass TRUE if you want
- all directory entries sorted, FALSE if you don't.
-
- device, directory and filename can be initialized beforehand. device and
- filename must be at least 32 characters large, and directory must be 236.
- For instance,
-
- char devbuffer[32], dirbuffer[236], filebuffer[32];
- file_request(NULL,"Woopee!",-1,-1,devbuffer,dirbuffer,filebuffer,TRUE);
-
- When the file requester closes, it will return FALSE if cancel was chosen,
- TRUE if okay was chosen or a filename was double clicked, or another value
- corresponding to an error. To interpret these, include the file FileReq.h
- When you get back, the device buffer will contain the volume name, with a
- colon at the end. The directory buffer will contain the directory name,
- with a tailing slash. The filename buffer will contain the filename.
- Therefore, to get the full file/path name, you could
-
- char fullname[400];
- strcpy(fullname,devbuffer);
- strcat(fullname,dirbuffer);
- strcat(fullname,filebuffer);
-
-
- IS THAT ALL THERE IS TO IT?
-
-
- Yes.
-