home *** CD-ROM | disk | FTP | other *** search
- ANOTHER FILE REQUESTER
-
- 1) Features
-
- Another file requester, intended to out-do all others. You be the judge of
- that. This is NOT really a requester, but a window. It is easier to do
- this with a window and the user can drag the window around. You also get
- a few other neat features if you use a window.
-
- The file requester will accept file and directory names up to the max
- allowable by Amiga DOS. This feat is accomplished by the use of a
- horisontal scroll bar.
-
- Arrow gadgets are provided to allow the user to scroll the screen around
- in one line increments. If you hold down the arrow gadgets the screen
- will scroll by one line every time an INTUITICK happens.
-
- The scroll bars update the screen without letting up on them.
-
- You can use the window on any Amiga screen and use the colors that
- the file requester was designed with.
-
- The file requester can operate simultaneously (almost) with input from
- other windows. A user function is called whenever one of a spcified set of
- signals arrives.
-
- Directory entries are packed in such a way as to minimize memory useage
- and maximize speed.
-
- Entries are sorted in alpabetical order with the sub-directories appearing
- first. A very fast recursive sorting function is used and the sort is
- done on an index of pointers instead of the data itself.
-
- The code compiles with Aztec C small and large (+p) memory models. Since
- the source compiles with the +p option in Aztec I assume it will work well
- with lattice. A minimal demonstration program is provided.
-
-
- 2) Function description
-
- NAME
- file_requester
-
- SYNOPSIS
- #include "req.h"
-
- long file_requester(r)
- FileReq *r;
-
- FUNCTION
- Allows the user to browse through the filing system. If the user
- presses OKAY then the selected path and file are stored in the
- FileReq structure.
-
- ARGUMENT
- r - A pointer to a filled out FileReq structure.
-
- RETURNS
- OKAY is returned if the user has selected the okay button.
- If the user selected OKAY the selected path and file will be
- copied to the appropriate members of the FileReq structure.
-
- CANCEL is returned if the user pressed the cancel button.
-
- FILEREQ_ERROR is returned if there was an error.
-
-
- 3) The FileReq structure
-
- typedef struct
- {
- struct Screen *screen;
- UBYTE *path;
- UBYTE *file;
- UBYTE *heading;
- UBYTE *buf;
- long bufsize;
- long n_entries;
- UWORD flags;
- ULONG user_signals;
- PFV user_func;
- } FileReq;
-
-
- Here are the meanings of the variables and flags in the FileReq structure:
-
-
- screen
- A pointer to an intuition custom screen or NULL if you are using the
- workbench screen.
-
- path
- A pointer to a buffer to contain the initial path used by the file
- requester. Also if the user selects the OAKY button the path the
- user selected will be copied to this buffer, so it better be big
- enough.
-
- file
- A pointer to a buffer to contain the initial file used by the file
- requester. If the user selects the OKAY button the file the user
- selected will be copied to this buffer.
-
- heading
- A pointer to a null-terminated string that will appear centered
- at the top of the window.
-
- buf
- A pointer to a buffer to be used as storage for the directory entries
- and an index of the directory entries. This variable may be set to
- NULL and space will be allocated for the buffer with AllocMem.
-
- bufsize
- The size of the provided buffer in bytes, or the size of the buffer
- to be allocated (if the buf variable is NULL).
-
- n_entries
- The maximum number of entries to be used by the file requester. The
- file requester creates an index of pointers to entries depending
- on this variable.
-
- flags
- The flags variable has two possible flags to be set.
-
- CLI_BIT is set by you if your program was executed from the CLI.
- The full path name of the current directory can be easily
- discovered from programs executed from the CLI. If the argc argument
- to main is not zero then it was executed from the CLI.
-
- NATURAL_COLOR_BIT is set by you if you want to change the colors of
- the view port to those used to design this function. You are
- responsible for setting them back again. This is not recomended for
- programs that operate on the workbench screen.
-
- user_signals
- A set of signals that will trigger the execution of the user function.
- Set user_signals to zero if they are not being used. You sould know
- about signals before you use it.
-
- user_func
- The function that gets called when one of the specified signals is
- received. The function is called with a long integer that contains
- the signals that triggered the calling of this function. Set this
- variable to NULL if you are not using it.
-
-
- 4) Credits
-
- This blasted thing took longer than one might expect to write. I did it
- because I kept seeing things on BBS's that said 'File Requester just like
- the one in DPaint'. Big Deal! it doesn't take much to copy someone else's
- work. This one is LIKE NO ONE ELSES (I hope). It was written with Aztec
- C 3.40a. Also I wrote a similar one for IBM PC's and got a lot of feed-
- back from users about it, made improvements, and wrote this one. I added
- another vertical scroll-bar on the left for left-handed mouse users and
- had to put in the horisontal scroll bar because the Amiga file names can
- be longer than could normally fit in the window. Also I hope you don't
- mind that I erase the drag-gadget on the window.
-
- I am giving this code away. It is in the public domain and may not be
- sold. Use it at your own risk (it has been tested well). If you use the
- file requester in any commercial program please send me a copy of your
- program. If you don't send me a copy of your program you will be given
- bad reviews or something else equally horrible. Even if you write a
- shareware or PD program using the file requester you should send me a
- copy of it.
-
-
- Robert W. Albrecht
- 1457 Zion Way
- Ventura CA 93003
-
-
-
-
-
-
-