/**************************
**
** $Id:  Finder.c
** $VER: Finder.c V3.00r2 (22.06.97) by Chris Jones
**
** File Finder Utility with wildcards.
** Based on Amiga Shopper Tutorial by Toby Simpson.
**
** Creation Date: 17.01.96
** Revision History:
**                2.00 : (17.01.96) Initial version (beta release)
**                2.01 : (18.01.96) Added AppMenu support
**                                   (Public Release #1 - AUI May '96)
**                2.02 : (04.02.96) Added option to start program
**                                   iconified via tooltype.
**                                   (Beta Release)
**                2.03 : (04.04.96) Added 'Busy Pointer' while
**                                   searching for files.
**                                   (Not Released)
**                2.04 : (19.07.96) Finder's window will now open on
**                                   the default public screen, not
**                                   on Workbench. (Workbench is
**                                   usually the default public
**                                   screen, but not always).
**                                  When the Zoom gadget is used, the
**                                   ListView no longer forgets what it
**                                   was displaying.
**                                  Major bug fix - In previous
**                                   versions, the Listview would
**                                   'forget' any filenames which left
**                                   the current view.
**                                  Source cleaned up a bit. Some of
**                                   functions generated by GadToolsBox
**                                   which have to be modified have been
**                                   moved from "Finder_GUI.c" to 
**                                   "Finder.c". This makes redesigning
**                                   the GUI easier as the file needs
**                                   less editing.
**                                   NOTE: See "Finder_GUI.c" for the
**                                          Instructions on the changes
**                                          necessary.
**                                   (Not Released)
**                2.05 : (27.07.96) MAJOR bug fix. The IDCMP handler has
**                                   been altered so that is uses no CPU
**                                   time at all instead of (as was the
**                                   case in earlier versions) swallowing
**                                   all spare CPU time and thereby
**                                   causing slow down on everything else.
**                                  Totally new error handling system.
**                                   Up until now I never tested Finder
**                                   in any situation which might cause
**                                   it to fail. When I did, I noticed
**                                   that the error handling system was
**                                   massively flawed. I was using the
**                                   function "sprintf" which copies text
**                                   to a variable, but I was passing it
**                                   a file pointer (stderr). If any of
**                                   the error messages were called this
**                                   caused a crash (e.g. If it is run on
**                                   <OS3.0). Now, Finder opens a small
**                                   CON: window as soon as any faults
**                                   appear and leaves the window until
**                                   the user closes it. It also gives
**                                   a rough idea of a possible solution
**                                   to the problem.
**                                  Changed the ListView from being Read-
**                                   Only to the Show Selected option.
**                                   This has no effect on the operation
**                                   of Finder, but it does mean that
**                                   when you are trying to remember the
**                                   name/path of a file in the display
**                                   while scrolling around, you can mark
**                                   it by clicking on it and it will
**                                   change colour to blue and remain so.
**                                   (I only added this as I thought it
**                                   might be useful).
**                                   (Public Release #2 - Aminet)
**                2.06 : (04.10.96) Nothing particularly new, just added
**                                   the checking for a keyfile. However,
**                                   the program IS NOT shareware, the
**                                   keys are available freely from me.
**                                   This is simply a way of keeping track
**                                   of how many people (if any!) use
**                                   Finder and if it is worth me 
**                                   continuing development. If you use it
**                                   PLEASE register it. IT IS FREE!!!
**                                  Ooops! Just noticed another silly bug!
**                                   If your started Finder via wb, it would
**                                   open the libraries twice (silly me!)
**                                   I only spotted this because the
**                                   registration req. is in the library
**                                   opening routine, so it popped up twice!
**                                   This has now been removed!
**                2.07 : (29.10.96) Due to a good response to the registration
**                                   (thanks - you know who you are) I have
**                                   changed the about requester so it shows
**                                   who the program is registered to.
**                3.00r1 : (24.03.97) Still in heavy development. This is an
**                                   internal, un-finished release. Do not
**                                   distribute this version.
**                                  The major addition to this release is the
**                                   use of MUI for the GUI.
**                                  Basic GUI layout has stayed the same, but
**                                   with a few minor additions like an
**                                   ASL requester available for the drawer
**                                   option.
**                                  DICE re-compiling support removed (MUI problems).
**                3.00r2 : (22.06.97) Total re-write of ALL code.
**                                   I got very annoyed with the way 3.00r1 was
**                                   working out, the code never reall worked
**                                   properly. I know where the problem is;
**                                   The string gadgets like their contents to
**                                   be stored in "char *<variable>" form. The
**                                   function to setup for the search
**                                   (ParsePatternNoCase) needs it's input to be
**                                   an STRPTR which is an unsigned char thingy.
**                                   Basically, as yet, I have been unsuccessful
**                                   in getting these two to tango.
**                                  I have decided to re-write the entire
**                                   program in an attempt to find alternate
**                                   ways around the problem. I hope that this
**                                   will be the very last major revision of Finder.
**                                  This is also a good excuse for me to play
**                                   around with some of MUI's neat features.
**                                   Because of this, I have added:
**                                     Cute little Finder logo in the About
**                                        requester.
**                                     Improvements in the Iconification code
**                                     Drag&Drop!!!! Hurrah, the wonder marvel
**                                        of the 90's MUI. You can now use this
**                                        fantastic invention to drag drawers onto
**                                        the drawer string (and iconified AppIcon).
**                                        Also, if you drag a file, it will be stripped
**                                        so that the drawer it is in is put in the
**                                        string object.
**                                     You can now choose if you want the search to
**                                      be case sensitive or not and recursive or not.
**                                  Gimmicks still to add:
**                                     Finder Icon as the AppIcon
**                                     Abort for the search (useful on CDs!)
**                                        It is possible to abort a search by sending
**                                        Finder a Ctrl-C, but it can't be directed at
**                                        the window, it must be sent directly to the
**                                        process. This is no problem if Finder is run
**                                        from CLI, but causes difficulties if it was
**                                        run from Wb as you will need an external program
**                                        to send the abort signal (eg 'Commander', part of
**                                        the excellent Executive system).
**
**                                  Update: Wow! I have done it, Finder works!
**                                   I really am quite surprised. It just started working
**                                   when I used a pointer to an array. My thanks to Dave
**                                   Michael for 'poking' me into looking at this problem.
**                                  Even more surprising is that the list saving code worked
**                                   basically first time with no major problems :)
**                                   (I must be getting better at this! )
**                                  Update2: Wow again! I have done the case sensitivity/
**                                   recursion code with no problems too!
**                                   All that is left is the abort stuff (DOH!)
**
** To compile, type "sc FinderV3.c" at a command line.
** You would be well advised to turn on the stack check/stack extend options
**  in ENV:SCOptions, without this, Finder will crash on long searches. The reason
**  is that the SearchDir function is able to calll itself. Therefore, for a search
**  with lots of sub-dirs, you will have MASSIVE recursion of this function. That eats
**  into the stack. I am looking into a workround for this, as I intend to use some
**  hooks in Finder soon which means I will have to remove the stack extend option as
**  it confuses hooks quite a lot (to the extent that they stop working!).
** Finder V3 is not finished yet, it still has a way to go on the object orientation front
**  (in that it still uses Return_IDs which are a bad thing. I just need a bit more time to
**  get to grips with hooks). This move to greater object orientation will also allow an
**  easier implementation of the search abort.
**
** VERY IMPORTANT: If you are using MUIBuilder and wish to alter the
**  GUI and re-generate it's source code....DONT! I have had to change the
**  original GenCodeC quite a bit as it does have some holes. Sorry!
**  If anyone wants info about how to re-compile, just e-mail me.
**
** There are a very large number of changes from the original MUIBuilder source
**  (mostly involved with the object/class names and the helpnodes).
**
** Wherever possible, I have put comments in the source so it
** should be fairly easy to follow.
**
** My very largest thanks _MUST_ go to Toby Simpson who wrote the
** C Tutorial that this is based on. He is entirely responsible
** for my desire to program. I saw the first 'episode' of his
** tutorial and knew I had bought 'Complete Amiga C' (by Cliff
** Ramshaw) for a good reason. After many months playing with the
** very excellent 'GadToolsBox' (nice one Jan) with not a ROM
** Kernel manual in sight (not easy!) my Finder was born.
** Without Toby, this would be a program which did nothing except
** appear in the 'Tools' menu and read ToolTypes (not very useful)!
**
** However, that doesn't change the fact that Toby's version of Finder
** was seriously flawed. It handles memory VERY badly, the GUI sucks
** and I didn't write it ;)
**
** I would also like to thank my C programming lecturer, Dr. David
** Hamill who has cleaned up sections of this code with stunning
** speed (well, he should be good to be a lecturer!)
**
**                                                       Chris.
*/

#include "FinderV3Main.c"
