home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d5xx / d584 / wizardfiler.lha / WizardFiler / WizardFiler.c < prev    next >
C/C++ Source or Header  |  1992-01-04  |  96KB  |  3,242 lines

  1. /* \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  2.  
  3.   WizardFiler v1.00
  4.   -----------------
  5.  
  6.   [ Enhanced version of FileWindow v1.20 by Anders Bjerin ]
  7.  
  8.  
  9.   HOW TO USE IT:
  10.   --------------
  11.  
  12.   operation=WizardFiler( title, ToShow, ToHide, x, y, screen, file );
  13.  
  14.   operation: a variable which will contain the "flags" WizardFiler returned.
  15.   title:     string containing the name of the WizardFiler window.
  16.   ToShow:    string to be used as a file pattern.
  17.   ToHide:    string to be used as a file pattern.
  18.   x:         x position of the WizardFiler window.
  19.   y:         y position of the WizardFiler window.
  20.   screen:    pointer to a screen if there exists one.
  21.   file:      a string which will contain the file name together with
  22.              the entire path. (For example: "df0:letters/payments.doc")
  23.  
  24.  
  25.   Title is a string which will appear on the drag gadget. Write NULL if
  26.   you do not want any string there.
  27.  
  28.   ToShow is a 100 character long string. 99 letters and the NULL ('\0')
  29.   sign. If you give WizardFiler a string, the program will only display
  30.   the files which endings match with your string. (Directories will always
  31.   be displayed.) If you do not want to use a file pattern you simply
  32.   write NULL.
  33.  
  34.   It's the same with ToHide, except that the files matching this pattern
  35.   will NOT be shown.
  36.   
  37.   On a NTSC screen (200 lines) y can be between 0 and 15. On a PAL screen
  38.   (256 lines) between 0 and 71.
  39.   
  40.   If your program is using a CUSTOM SCREEN you should give WizardFiler a
  41.   pointer to your screen. Otherwise, if you are using a WBENCH SCREEN you
  42.   simply write NULL.
  43.   
  44.   Name is a string which can already contain a file name with path if
  45.   you want. If the string is empty, WizardFiler will start to display the
  46.   current directory. When the user has selected the file to LOAD or SAVE it
  47.   is here you should look for the file name with path.
  48.   
  49.   For example:
  50.     
  51.     1. operation=WizardFiler( NULL, NULL, NULL, 0, 0, NULL, file);
  52.  
  53.        operation has been declared as: USHORT operation;
  54.        file has been declared as     : UBYTE file[TOTAL_LENGTH];
  55.     
  56.  
  57.     2. operation=WizardFiler(title, toshow, tohide , x, y, my_screen, file);
  58.        
  59.        operation has been declared as: USHORT operation;
  60.        title           -"-           : UBYTE title[ANY_LENGTH];
  61.        toshow          -"-           : UBYTE toshow[100];
  62.        tohide          -"-           : UBYTE tohide[100];
  63.        x, y            -"-           : SHORT x, y;
  64.        my_screen       -"-           : struct Screen *my_screen;
  65.        file            -"-           : UBYTE file[TOTAL_LENGTH];
  66.  
  67.  
  68.   Remember to "include" the file "WizardFiler.h"!
  69.   ex: #include "WizardFiler.h"
  70.  
  71.   Program:                 WizardFiler
  72.   Version:                 1.00
  73.   Authors:                 Stefan Zeiger (WizardFiler)
  74.                            Anders Bjerin (Original "FileWindow")
  75.   Language:                C (100%)
  76.   Compiler:                SAS/C (Lattice-C) C Compiler, V5.10
  77.   Linker:                  Blink, V5.10
  78.   AmigaDOS:                Tested with 1.3
  79.  
  80.  
  81.   Amiga is a registered trademark of Commodore-Amiga Inc.
  82.   AmigaDOS is a registered trademark of Commodore-Amiga Inc.
  83.   Lattice is a registered trademark of Lattice Inc.
  84.   SAS/C is a registrated trademark of SAS Institute Inc.
  85.  
  86. \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  87.  
  88.   This file requester is public domain. Enjoy it and use it in all of your
  89.   programs.
  90.               Be C'ing you,
  91.                             Stefan
  92.  
  93. \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  94.  
  95.   Stefan Zeiger                          VOICE: (49)-6188-2525
  96.   Seligenstaedter Weg 24
  97.   D-W-8756 Kahl
  98.   West Germany
  99.  
  100. \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ */
  101.  
  102.  
  103. #include <exec/types.h>
  104. #include <exec/nodes.h>
  105. #include <exec/lists.h>
  106. #include <exec/libraries.h>
  107. #include <exec/ports.h>
  108. #include <exec/interrupts.h>
  109. #include <exec/io.h>
  110. #include <exec/memory.h>
  111. #include <libraries/dos.h>
  112. #include <libraries/dosextens.h>
  113. #include <intuition/intuition.h>
  114. #include <string.h>
  115. #include <stdio.h>
  116. #include <ctype.h>
  117.  
  118. #include "WizardFiler.h"
  119.  
  120.  
  121. #define UP 59
  122.  
  123. #define POS TRUE
  124. #define NEG FALSE
  125.  
  126.  
  127. /* ********************************************************************* */
  128. /* * Get device list                                                   * */
  129. /* ********************************************************************* */
  130.  
  131. #ifndef toAPTR
  132. #define toAPTR(b) ((b)<<2)
  133. #endif
  134. #ifndef toBPTR
  135. #define toBPTR(a) ((a)>>2)
  136. #endif
  137.  
  138. struct DeviceList *list;
  139.  
  140. void OpenDevList(void)
  141. {
  142.   extern struct DosLibrary *DOSBase;
  143.   struct RootNode *root;
  144.   struct DosInfo *info;
  145.   root=(struct RootNode *)DOSBase->dl_Root;
  146.   info=(struct DosInfo *)(toAPTR(root->rn_Info));
  147.   list=(struct DeviceList *)(toAPTR(info->di_DevInfo));
  148. }
  149.  
  150. BOOL ReadDevList(name,criterion)
  151. char name[32];
  152. UWORD criterion;
  153. {
  154.   struct DeviceList *next;
  155.   char *ptr;
  156.   int count;
  157.   while(list)
  158.   {
  159.     next=(struct DeviceList *)(toAPTR(list->dl_Next));
  160.     if(list->dl_Type==criterion)
  161.     {
  162.       ptr=(char *)(toAPTR((BPTR)list->dl_Name));
  163.       count=*ptr++;
  164.       if(count>30)
  165.       count=30;
  166.       strncpy(name,ptr,count);
  167.       name[count++]=':';
  168.       name[count]=0;
  169.       list=next;
  170.       return(TRUE);
  171.     }
  172.     list=next;
  173.   }
  174.   return(FALSE);
  175. }
  176.  
  177.  
  178. /* Pattern matching main program variables */
  179. WORD Aux1[128];
  180. int CompiledOK1;
  181. WORD Aux2[128];
  182. int CompiledOK2;
  183. char ShowPat[100];
  184. char HidePat[100];
  185.  
  186.  
  187. /* Device names */
  188.  
  189. char mydev[21][32];
  190. char mydevname[21][5];
  191.  
  192.  
  193. /* Declare the functions we are going to use: */
  194. USHORT FileWindow();
  195. STRPTR right_pos();
  196. APTR save_file_info();
  197. BOOL file_comp();
  198. BOOL directory();
  199. BOOL last_check();
  200. BOOL new_drawer();
  201. BOOL pick_file();
  202. BOOL request_ask();
  203. void put_in();
  204. void deallocate_file_info();
  205. void change_device();
  206. void parent();
  207. void request_ok();
  208. void display_list();
  209. void connect_dir_file();
  210. void adjust_string_gadgets();
  211. void delete_file_dir();
  212. void __regargs Draw3D(struct RastPort *,ULONG,ULONG,ULONG,ULONG,BOOL,BOOL);
  213.  
  214.  
  215. extern struct IntuitionBase *IntuitionBase;
  216.  
  217. struct Window *file_window;
  218. struct IntuiMessage *my_gadget_message;
  219.  
  220.  
  221. /* We will allocate memory, using this structure, for every file/    */
  222. /* directory we find. They will be linked to each otherer, in such a */
  223. /* way that all directories will come first (sorted alphabetically), */
  224. /* and after them will the files come (also sorted alphabetically).  */
  225. struct file_info
  226. {
  227.   BYTE name[28];          /* Name of the file/directory, 27 characters. */
  228.   BOOL directory;         /* If it is a directory.                      */
  229.   struct file_info *next; /* Pointer to the next file_info structure.   */
  230. };
  231.  
  232.  
  233. struct FileInfoBlock *file_info;
  234. struct FileLock *lock, *Lock();
  235.  
  236.  
  237. BOOL file_lock;  /* Have we locked a file?       */
  238. BOOL more_files; /* More files in the directory? */
  239. BOOL first_file; /* First file?                  */
  240.  
  241.  
  242. struct file_info *first_pointer; /* Pointing to the first structure. */
  243.  
  244.  
  245. /* The program will use a ROM-font, 80 characters wide (40 LOWRES). */
  246. /* This is to make sure that all the text will fit in nicely in the */
  247. /* window, even if the calling program is using another font.       */
  248. struct TextAttr my_font=
  249. {
  250.   "topaz.font", /* Font Name */
  251.   TOPAZ_EIGHTY, /* Font Height */
  252.   FS_NORMAL,    /* Style */
  253.   FPF_ROMFONT   /* Preferences */
  254. };
  255.  
  256.  
  257. /* ********************************************************************* */
  258. /* * IntuiText structures for the requesters                           * */
  259. /* ********************************************************************* */
  260.  
  261. struct IntuiText text_request=
  262. {
  263.   0, 2,                        /* FrontPen, BackPen */
  264.   JAM1,                        /* DrawMode */
  265.   15, 5,                       /* LewftEdge, TopEdge */
  266.   &my_font,                    /* *ITextFont */
  267.   NULL,                        /* *IText */
  268.   NULL                         /* *NextText */
  269. };
  270.  
  271. struct IntuiText ok_request=
  272. {
  273.   0, 2,     /* FrontPen, BackPen */
  274.   JAM1,     /* DrawMode */
  275.   6, 3,     /* LewftEdge, TopEdge */
  276.   &my_font, /* *ITextFont */
  277.   "OK",     /* *IText */
  278.   NULL      /* *NextText */
  279. };
  280.  
  281. struct IntuiText option1_request=
  282. {
  283.   0, 2,     /* FrontPen, BackPen */
  284.   JAM1,     /* DrawMode */
  285.   6, 3,     /* LewftEdge, TopEdge */
  286.   &my_font, /* *ITextFont */
  287.   NULL,     /* *IText */
  288.   NULL      /* *NextText */
  289. };
  290.  
  291. struct IntuiText option2_request=
  292. {
  293.   0, 2,     /* FrontPen, BackPen */
  294.   JAM1,     /* DrawMode */
  295.   6, 3,     /* LewftEdge, TopEdge */
  296.   &my_font, /* *ITextFont */
  297.   NULL,     /* *IText */
  298.   NULL      /* *NextText */
  299. };
  300.  
  301.  
  302. /* Values for a 6-letter box: */
  303. SHORT points6[]=
  304. {
  305.    0,  0,
  306.   60,  0,
  307.   60, 14,
  308.    0, 14,
  309.    0,  0
  310. };
  311.  
  312. /* A border for a 6-letter box: */
  313. struct Border border_text6=
  314. {
  315.   0, 0,         /* LeftEdge, TopEdge */
  316.   1, 2, JAM1,   /* FrontPen, BackPen, DrawMode */
  317.   5,            /* Count */
  318.   points6,      /* *XY */
  319.   NULL          /* *NextBorder */
  320. };
  321.  
  322.  
  323. /* ********************************************************************* */
  324. /* * Information for the proportional gadget                           * */
  325. /* ********************************************************************* */
  326.  
  327. /* Since we are using the auto-knob we set GadgetRender to point to an   */
  328. /* Image. In this case we do not need to initialize the Image structure: */
  329. struct Image image_prop;
  330.  
  331. /* This is the special data required by the proportional gadget: */
  332. struct PropInfo prop_info=
  333. {
  334.   PROPBORDERLESS|
  335.   AUTOKNOB| /* We want to use the auto-knob. */
  336.   FREEVERT, /* The knob should move vertically. */
  337.   0,0,      /* HorizPot, VertPot: will be initialized later. */
  338.   0,        /* HorizBody                 -"-                 */
  339.   0xFFFF,   /* VertBody: No data to show, maximum. */
  340.   
  341.   0,0,0,0,0,0 /* Intuition sets and maintains these variables. */
  342. };
  343.  
  344. struct Gadget gadget_proportional=
  345. {
  346.   NULL,                     /* *NextGadget */
  347.   294, 15, 13, 89,          /* LeftEdge, TopEdge, Width, Height */
  348.   GADGHCOMP,                /* Flags */
  349.   GADGIMMEDIATE|FOLLOWMOUSE|RELVERIFY, /* Activation */
  350.   PROPGADGET,               /* GadgetType */
  351.   (APTR) &image_prop,       /* GadgetRender */
  352.   NULL,                     /* SelectRender */
  353.   NULL,                     /* *GadgetText */
  354.   NULL,                     /* MutualExclude */
  355.   (APTR) &prop_info,        /* SpecialInfo */
  356.   NULL,                     /* GadgetID */
  357.   NULL                      /* UserData */
  358. };
  359.  
  360.  
  361. /* UndoBuffer for the string gadgets: */
  362. UBYTE name_backup[DRAWER_LENGTH];
  363.  
  364.  
  365. /* ********************************************************************* */
  366. /* * Information for the string gadget "Drawer:"                       * */
  367. /* ********************************************************************* */
  368.  
  369. UBYTE drawer_name[DRAWER_LENGTH];
  370.  
  371. struct IntuiText text_drawer=
  372. {
  373.   1, 2,       /* FrontPen, BackPen */
  374.   JAM1,       /* DrawMode */
  375.   -69, 0,     /* LeftEdge, TopEdge */
  376.   &my_font,   /* *ITextFont */
  377.   "Drawer:",  /* *IText */
  378.   NULL        /* *NextText */
  379. };
  380.  
  381. struct StringInfo string_drawer=
  382. {
  383.   drawer_name,        /* *Buffer */
  384.   name_backup,        /* *UndoBuffer */
  385.   0,                  /* BufferPos */
  386.   70,                 /* MaxChars (Including NULL) */
  387.   0,                  /* DispPos */
  388.   /* Intuition initializes and maintains these variables for you: */
  389.   0,                 /* UndoPos */
  390.   0, 0,              /* CLeft, CTop */
  391.   NULL,              /* *LayerPtr */
  392.   NULL,              /* LongInt */
  393.   NULL,              /* *AltKeyMap */
  394. };
  395.  
  396. struct Gadget gadget_drawer=
  397. {
  398.   &gadget_proportional,    /* *NextGadget */
  399.   81, 132, 230, 8,          /* LeftEdge, TopEdge, Width, Height */
  400.   GADGHCOMP,               /* Flags */
  401.   RELVERIFY,               /* Activation */
  402.   STRGADGET,               /* GadgetType */
  403.   NULL,
  404.   NULL,                    /* SelectRender */
  405.   &text_drawer,            /* *GadgetText */
  406.   NULL,                    /* MutualExclude */
  407.   (APTR) &string_drawer,   /* SpecialInfo */
  408.   NULL,                    /* GadgetID */
  409.   NULL                     /* UserData */
  410. };
  411.  
  412.  
  413. /* ********************************************************************* */
  414. /* * Information for the string gadget "File:"                         * */
  415. /* ********************************************************************* */
  416.  
  417. UBYTE file_name[FILE_LENGTH];
  418.  
  419. struct IntuiText text_file=
  420. {
  421.   1, 2,     /* FrontPen, BackPen */
  422.   JAM1,     /* DrawMode */
  423.   -52, 0,   /* LewftEdge, TopEdge */
  424.   &my_font, /* *ITextFont */
  425.   "File:",  /* *IText */
  426.   NULL      /* *NextText */
  427. };
  428.  
  429. struct StringInfo string_file=
  430. {
  431.   file_name,         /* *Buffer */
  432.   name_backup,       /* *UndoBuffer */
  433.   0,                 /* BufferPos */
  434.   40,                /* MaxChars (Including NULL) */
  435.   0,                 /* DispPos */
  436.   /* Intuition initializes and maintains these variables for you: */
  437.   0,                 /* UndoPos */
  438.   0, 0,              /* CLeft, CTop */
  439.   NULL,              /* *LayerPtr */
  440.   NULL,              /* LongInt */
  441.   NULL,              /* *AltKeyMap */
  442. };
  443.  
  444. struct Gadget gadget_file=
  445. {
  446.   &gadget_drawer,         /* *NextGadget */
  447.   65, 151, 240, 8,        /* LeftEdge, TopEdge, Width, Height */
  448.   GADGHCOMP,              /* Flags */
  449.   NULL,                   /* Activation */
  450.   STRGADGET,              /* GadgetType */
  451.   NULL,
  452.   NULL,                   /* SelectRender */
  453.   &text_file,             /* *GadgetText */
  454.   NULL,                   /* MutualExclude */
  455.   (APTR) &string_file,    /* SpecialInfo */
  456.   NULL,                   /* GadgetID */
  457.   NULL                    /* UserData */
  458. };
  459.  
  460.  
  461. /* ********************************************************************* */
  462. /* * Information for the string gadget "ToHide"                        * */
  463. /* ********************************************************************* */
  464.  
  465. UBYTE ToHide_name[100]; /* 100 characters including NULL. */
  466.  
  467. struct IntuiText text_ToHide=
  468. {
  469.   1, 2,     /* FrontPen, BackPen */
  470.   JAM1,     /* DrawMode */
  471.   -33, 0,   /* LeftEdge, TopEdge */
  472.   &my_font, /* *ITextFont */
  473.   "Hi:",    /* *IText */
  474.   NULL      /* *NextText */
  475. };
  476.  
  477. struct StringInfo string_ToHide=
  478. {
  479.   ToHide_name,       /* *Buffer */
  480.   name_backup,       /* *UndoBuffer */
  481.   0,                 /* BufferPos */
  482.   100,               /* MaxChars (Including NULL) */
  483.   0,                 /* DispPos */
  484.   /* Intuition initializes and maintains these variables for you: */
  485.   0,                 /* UndoPos */
  486.   0, 0,              /* CLeft, CTop */
  487.   NULL,              /* *LayerPtr */
  488.   NULL,              /* LongInt */
  489.   NULL,              /* *AltKeyMap */
  490. };
  491.  
  492. struct Gadget gadget_ToHide=
  493. {
  494.   &gadget_file,             /* *NextGadget */
  495.   359,169, 110, 8,          /* LeftEdge, TopEdge, Width, Height */
  496.   GADGHCOMP,                /* Flags */
  497.   RELVERIFY,                /* Activation */
  498.   STRGADGET,                /* GadgetType */
  499.   NULL,                     /* GadgetRender */
  500.   NULL,                     /* SelectRender */
  501.   &text_ToHide,             /* *GadgetText */
  502.   NULL,                     /* MutualExclude */
  503.   (APTR) &string_ToHide,    /* SpecialInfo */
  504.   NULL,                     /* GadgetID */
  505.   NULL                      /* UserData */
  506. };
  507.  
  508.  
  509. /* ********************************************************************* */
  510. /* * Information for the string gadget "ToShow"                        * */
  511. /* ********************************************************************* */
  512.  
  513. UBYTE ToShow_name[100]; /* 100 characters including NULL. */
  514.  
  515. struct IntuiText text_ToShow=
  516. {
  517.   1, 2,     /* FrontPen, BackPen */
  518.   JAM1,     /* DrawMode */
  519.   -33, 0,   /* LeftEdge, TopEdge */
  520.   &my_font, /* *ITextFont */
  521.   "Sh:",    /* *IText */
  522.   NULL      /* *NextText */
  523. };
  524.  
  525. struct StringInfo string_ToShow=
  526. {
  527.   ToShow_name,       /* *Buffer */
  528.   name_backup,       /* *UndoBuffer */
  529.   0,                 /* BufferPos */
  530.   100,               /* MaxChars (Including NULL) */
  531.   0,                 /* DispPos */
  532.   /* Intuition initializes and maintains these variables for you: */
  533.   0,                 /* UndoPos */
  534.   0, 0,              /* CLeft, CTop */
  535.   NULL,              /* *LayerPtr */
  536.   NULL,              /* LongInt */
  537.   NULL,              /* *AltKeyMap */
  538. };
  539.  
  540. struct Gadget gadget_ToShow=
  541. {
  542.   &gadget_ToHide,           /* *NextGadget */
  543.   359,151, 110, 8,          /* LeftEdge, TopEdge, Width, Height */
  544.   GADGHCOMP,                /* Flags */
  545.   RELVERIFY,                /* Activation */
  546.   STRGADGET,                /* GadgetType */
  547.   NULL,                     /* GadgetRender */
  548.   NULL,                     /* SelectRender */
  549.   &text_ToShow,             /* *GadgetText */
  550.   NULL,                     /* MutualExclude */
  551.   (APTR) &string_ToShow,    /* SpecialInfo */
  552.   NULL,                     /* GadgetID */
  553.   NULL                      /* UserData */
  554. };
  555.  
  556.  
  557. /* ********************************************************************* */
  558. /* * Information for the boolean gadget parent "<"                     * */
  559. /* ********************************************************************* */
  560.  
  561. struct IntuiText text_parent=
  562. {
  563.   1, 2,     /* FrontPen, BackPen */
  564.   JAM1,     /* DrawMode */
  565.   7,4,      /* LeftEdge, TopEdge */
  566.   &my_font, /* *ITextFont, (Topaz, 80) */
  567.   "<",      /* *IText */
  568.   NULL      /* *NextText */
  569. };
  570.  
  571. struct Gadget gadget_parent=
  572. {
  573.   &gadget_ToShow,      /* *NextGadget */
  574.   290, 109, 21, 16,        /* LeftEdge, TopEdge, Width, Height */
  575.   GADGHCOMP,              /* Flags */
  576.   RELVERIFY,              /* Activation */
  577.   BOOLGADGET,             /* GadgetType */
  578.   NULL,                   /* GadgetRender */
  579.   NULL,                   /* SelectRender */
  580.   &text_parent,           /* *GadgetText */
  581.   NULL,                   /* MutualExclude */
  582.   NULL,                   /* SpecialInfo */
  583.   NULL,                   /* GadgetID */
  584.   NULL                    /* UserData */
  585. };
  586.  
  587.  
  588. /* ********************************************************************* */
  589. /* * Information for the boolean gadget 3A                             * */
  590. /* ********************************************************************* */
  591.  
  592. struct IntuiText text_3A=
  593. {
  594.   1, 2,     /* FrontPen, BackPen */
  595.   JAM1,     /* DrawMode */
  596.   7,4,      /* LeftEdge, TopEdge */
  597.   &my_font, /* *ITextFont, (Topaz, 80) */
  598.   NULL,    /* *IText */
  599.   NULL      /* *NextText */
  600. };
  601.  
  602. struct Gadget gadget_3A=
  603. {
  604.   &gadget_parent,         /* *NextGadget */
  605.   428, 13, 45, 15,        /* LeftEdge, TopEdge, Width, Height */
  606.   GADGHCOMP,              /* Flags */
  607.   RELVERIFY,              /* Activation */
  608.   BOOLGADGET,             /* GadgetType */
  609.   NULL,
  610.   NULL,                   /* SelectRender */
  611.   &text_3A,               /* *GadgetText */
  612.   NULL,                   /* MutualExclude */
  613.   NULL,                   /* SpecialInfo */
  614.   NULL,                   /* GadgetID */
  615.   NULL                    /* UserData */
  616. };
  617.  
  618.  
  619. /* ********************************************************************* */
  620. /* * Information for the boolean gadget "3D:"                          * */
  621. /* ********************************************************************* */
  622.  
  623. struct IntuiText text_3D=
  624. {
  625.   1, 2,     /* FrontPen, BackPen */
  626.   JAM1,     /* DrawMode */
  627.   7,4,      /* LeftEdge, TopEdge */
  628.   &my_font, /* *ITextFont, (Topaz, 80) */
  629.   NULL,    /* *IText */
  630.   NULL      /* *NextText */
  631. };
  632.  
  633. struct Gadget gadget_3D=
  634. {
  635.   &gadget_3A,             /* *NextGadget */
  636.   428, 67, 45, 15,        /* LeftEdge, TopEdge, Width, Height */
  637.   GADGHCOMP,              /* Flags */
  638.   RELVERIFY,              /* Activation */
  639.   BOOLGADGET,             /* GadgetType */
  640.   NULL,
  641.   NULL,                   /* SelectRender */
  642.   &text_3D,               /* *GadgetText */
  643.   NULL,                   /* MutualExclude */
  644.   NULL,                   /* SpecialInfo */
  645.   NULL,                   /* GadgetID */
  646.   NULL                    /* UserData */
  647. };
  648.  
  649.  
  650. /* ********************************************************************* */
  651. /* * Information for the boolean gadget "3B:"                          * */
  652. /* ********************************************************************* */
  653.  
  654. struct IntuiText text_3B=
  655. {
  656.   1, 2,     /* FrontPen, BackPen */
  657.   JAM1,     /* DrawMode */
  658.   7,4,      /* LeftEdge, TopEdge */
  659.   &my_font, /* *ITextFont, (Topaz, 80) */
  660.   NULL,    /* *IText */
  661.   NULL      /* *NextText */
  662. };
  663.  
  664. struct Gadget gadget_3B=
  665. {
  666.   &gadget_3D,             /* *NextGadget */
  667.   428, 31, 45, 15,        /* LeftEdge, TopEdge, Width, Height */
  668.   GADGHCOMP,              /* Flags */
  669.   RELVERIFY,              /* Activation */
  670.   BOOLGADGET,             /* GadgetType */
  671.   NULL,
  672.   NULL,                   /* SelectRender */
  673.   &text_3B,               /* *GadgetText */
  674.   NULL,                   /* MutualExclude */
  675.   NULL,                   /* SpecialInfo */
  676.   NULL,                   /* GadgetID */
  677.   NULL                    /* UserData */
  678. };
  679.  
  680.  
  681. /* ********************************************************************* */
  682. /* * Information for the boolean gadget "3C:"                          * */
  683. /* ********************************************************************* */
  684.  
  685. struct IntuiText text_3C=
  686. {
  687.   1, 2,     /* FrontPen, BackPen */
  688.   JAM1,     /* DrawMode */
  689.   7,4,      /* LeftEdge, TopEdge */
  690.   &my_font, /* *ITextFont, (Topaz, 80) */
  691.   NULL,    /* *IText */
  692.   NULL      /* *NextText */
  693. };
  694.  
  695. struct Gadget gadget_3C=
  696. {
  697.   &gadget_3B,             /* *NextGadget */
  698.   428, 49, 45, 15,        /* LeftEdge, TopEdge, Width, Height */
  699.   GADGHCOMP,              /* Flags */
  700.   RELVERIFY,              /* Activation */
  701.   BOOLGADGET,             /* GadgetType */
  702.   NULL,
  703.   NULL,                   /* SelectRender */
  704.   &text_3C,               /* *GadgetText */
  705.   NULL,                   /* MutualExclude */
  706.   NULL,                   /* SpecialInfo */
  707.   NULL,                   /* GadgetID */
  708.   NULL                    /* UserData */
  709. };
  710.  
  711.  
  712. /* ********************************************************************* */
  713. /* * Information for the boolean gadget "3E"                           * */
  714. /* ********************************************************************* */
  715.  
  716. struct IntuiText text_3E=
  717. {
  718.   1, 2,     /* FrontPen, BackPen */
  719.   JAM1,     /* DrawMode */
  720.   7,4,      /* LeftEdge, TopEdge */
  721.   &my_font, /* *ITextFont, (Topaz, 80) */
  722.   NULL,    /* *IText */
  723.   NULL      /* *NextText */
  724. };
  725.  
  726. struct Gadget gadget_3E=
  727. {
  728.   &gadget_3C,            /* *NextGadget */
  729.   428, 85, 45, 15,        /* LeftEdge, TopEdge, Width, Height */
  730.   GADGHCOMP,              /* Flags */
  731.   RELVERIFY,              /* Activation */
  732.   BOOLGADGET,             /* GadgetType */
  733.   NULL,
  734.   NULL,                   /* SelectRender */
  735.   &text_3E,               /* *GadgetText */
  736.   NULL,                   /* MutualExclude */
  737.   NULL,                   /* SpecialInfo */
  738.   NULL,                   /* GadgetID */
  739.   NULL                    /* UserData */
  740. };
  741.  
  742.  
  743. /* ********************************************************************* */
  744. /* * Information for the boolean gadget "3F"                           * */
  745. /* ********************************************************************* */
  746.  
  747. struct IntuiText text_3F=
  748. {
  749.   1, 2,     /* FrontPen, BackPen */
  750.   JAM1,     /* DrawMode */
  751.   7,4,      /* LeftEdge, TopEdge */
  752.   &my_font, /* *ITextFont, (Topaz, 80) */
  753.   NULL,    /* *IText */
  754.   NULL      /* *NextText */
  755. };
  756.  
  757. struct Gadget gadget_3F=
  758. {
  759.   &gadget_3E,             /* *NextGadget */
  760.   428, 103, 45, 15,       /* LeftEdge, TopEdge, Width, Height */
  761.   GADGHCOMP,              /* Flags */
  762.   RELVERIFY,              /* Activation */
  763.   BOOLGADGET,             /* GadgetType */
  764.   NULL,
  765.   NULL,                   /* SelectRender */
  766.   &text_3F,               /* *GadgetText */
  767.   NULL,                   /* MutualExclude */
  768.   NULL,                   /* SpecialInfo */
  769.   NULL,                   /* GadgetID */
  770.   NULL                    /* UserData */
  771. };
  772.  
  773.  
  774. /* ********************************************************************* */
  775. /* * Information for the boolean gadget "3G:"                          * */
  776. /* ********************************************************************* */
  777.  
  778. struct IntuiText text_3G=
  779. {
  780.   1, 2,     /* FrontPen, BackPen */
  781.   JAM1,     /* DrawMode */
  782.   7,4,      /* LeftEdge, TopEdge */
  783.   &my_font, /* *ITextFont, (Topaz, 80) */
  784.   NULL,    /* *IText */
  785.   NULL      /* *NextText */
  786. };
  787.  
  788. struct Gadget gadget_3G=
  789. {
  790.   &gadget_3F,              /* *NextGadget */
  791.   428, 121, 45, 15,       /* LeftEdge, TopEdge, Width, Height */
  792.   GADGHCOMP,              /* Flags */
  793.   RELVERIFY,              /* Activation */
  794.   BOOLGADGET,             /* GadgetType */
  795.   NULL,
  796.   NULL,                   /* SelectRender */
  797.   &text_3G,               /* *GadgetText */
  798.   NULL,                   /* MutualExclude */
  799.   NULL,                   /* SpecialInfo */
  800.   NULL,                   /* GadgetID */
  801.   NULL                    /* UserData */
  802. };
  803.  
  804.  
  805. /* ********************************************************************* */
  806. /* * Information for the boolean gadget 2A                             * */
  807. /* ********************************************************************* */
  808.  
  809. struct IntuiText text_2A=
  810. {
  811.   1, 2,     /* FrontPen, BackPen */
  812.   JAM1,     /* DrawMode */
  813.   7,4,      /* LeftEdge, TopEdge */
  814.   &my_font, /* *ITextFont, (Topaz, 80) */
  815.   NULL,    /* *IText */
  816.   NULL      /* *NextText */
  817. };
  818.  
  819. struct Gadget gadget_2A=
  820. {
  821.   &gadget_3G,             /* *NextGadget */
  822.   377, 13, 45, 15,        /* LeftEdge, TopEdge, Width, Height */
  823.   GADGHCOMP,              /* Flags */
  824.   RELVERIFY,              /* Activation */
  825.   BOOLGADGET,             /* GadgetType */
  826.   NULL,
  827.   NULL,                   /* SelectRender */
  828.   &text_2A,               /* *GadgetText */
  829.   NULL,                   /* MutualExclude */
  830.   NULL,                   /* SpecialInfo */
  831.   NULL,                   /* GadgetID */
  832.   NULL                    /* UserData */
  833. };
  834.  
  835.  
  836. /* ********************************************************************* */
  837. /* * Information for the boolean gadget "2D:"                          * */
  838. /* ********************************************************************* */
  839.  
  840. struct IntuiText text_2D=
  841. {
  842.   1, 2,     /* FrontPen, BackPen */
  843.   JAM1,     /* DrawMode */
  844.   7,4,      /* LeftEdge, TopEdge */
  845.   &my_font, /* *ITextFont, (Topaz, 80) */
  846.   NULL,    /* *IText */
  847.   NULL      /* *NextText */
  848. };
  849.  
  850. struct Gadget gadget_2D=
  851. {
  852.   &gadget_2A,             /* *NextGadget */
  853.   377, 67, 45, 15,        /* LeftEdge, TopEdge, Width, Height */
  854.   GADGHCOMP,              /* Flags */
  855.   RELVERIFY,              /* Activation */
  856.   BOOLGADGET,             /* GadgetType */
  857.   NULL,
  858.   NULL,                   /* SelectRender */
  859.   &text_2D,               /* *GadgetText */
  860.   NULL,                   /* MutualExclude */
  861.   NULL,                   /* SpecialInfo */
  862.   NULL,                   /* GadgetID */
  863.   NULL                    /* UserData */
  864. };
  865.  
  866.  
  867. /* ********************************************************************* */
  868. /* * Information for the boolean gadget "2B:"                          * */
  869. /* ********************************************************************* */
  870.  
  871. struct IntuiText text_2B=
  872. {
  873.   1, 2,     /* FrontPen, BackPen */
  874.   JAM1,     /* DrawMode */
  875.   7,4,      /* LeftEdge, TopEdge */
  876.   &my_font, /* *ITextFont, (Topaz, 80) */
  877.   NULL,    /* *IText */
  878.   NULL      /* *NextText */
  879. };
  880.  
  881. struct Gadget gadget_2B=
  882. {
  883.   &gadget_2D,             /* *NextGadget */
  884.   377, 31, 45, 15,        /* LeftEdge, TopEdge, Width, Height */
  885.   GADGHCOMP,              /* Flags */
  886.   RELVERIFY,              /* Activation */
  887.   BOOLGADGET,             /* GadgetType */
  888.   NULL,
  889.   NULL,                   /* SelectRender */
  890.   &text_2B,               /* *GadgetText */
  891.   NULL,                   /* MutualExclude */
  892.   NULL,                   /* SpecialInfo */
  893.   NULL,                   /* GadgetID */
  894.   NULL                    /* UserData */
  895. };
  896.  
  897.  
  898. /* ********************************************************************* */
  899. /* * Information for the boolean gadget "2C:"                          * */
  900. /* ********************************************************************* */
  901.  
  902. struct IntuiText text_2C=
  903. {
  904.   1, 2,     /* FrontPen, BackPen */
  905.   JAM1,     /* DrawMode */
  906.   7,4,      /* LeftEdge, TopEdge */
  907.   &my_font, /* *ITextFont, (Topaz, 80) */
  908.   NULL,    /* *IText */
  909.   NULL      /* *NextText */
  910. };
  911.  
  912. struct Gadget gadget_2C=
  913. {
  914.   &gadget_2B,             /* *NextGadget */
  915.   377, 49, 45, 15,        /* LeftEdge, TopEdge, Width, Height */
  916.   GADGHCOMP,              /* Flags */
  917.   RELVERIFY,              /* Activation */
  918.   BOOLGADGET,             /* GadgetType */
  919.   NULL,
  920.   NULL,                   /* SelectRender */
  921.   &text_2C,               /* *GadgetText */
  922.   NULL,                   /* MutualExclude */
  923.   NULL,                   /* SpecialInfo */
  924.   NULL,                   /* GadgetID */
  925.   NULL                    /* UserData */
  926. };
  927.  
  928.  
  929. /* ********************************************************************* */
  930. /* * Information for the boolean gadget "2E"                           * */
  931. /* ********************************************************************* */
  932.  
  933. struct IntuiText text_2E=
  934. {
  935.   1, 2,     /* FrontPen, BackPen */
  936.   JAM1,     /* DrawMode */
  937.   7,4,      /* LeftEdge, TopEdge */
  938.   &my_font, /* *ITextFont, (Topaz, 80) */
  939.   NULL,    /* *IText */
  940.   NULL      /* *NextText */
  941. };
  942.  
  943. struct Gadget gadget_2E=
  944. {
  945.   &gadget_2C,            /* *NextGadget */
  946.   377, 85, 45, 15,        /* LeftEdge, TopEdge, Width, Height */
  947.   GADGHCOMP,              /* Flags */
  948.   RELVERIFY,              /* Activation */
  949.   BOOLGADGET,             /* GadgetType */
  950.   NULL,
  951.   NULL,                   /* SelectRender */
  952.   &text_2E,               /* *GadgetText */
  953.   NULL,                   /* MutualExclude */
  954.   NULL,                   /* SpecialInfo */
  955.   NULL,                   /* GadgetID */
  956.   NULL                    /* UserData */
  957. };
  958.  
  959.  
  960. /* ********************************************************************* */
  961. /* * Information for the boolean gadget "2F"                           * */
  962. /* ********************************************************************* */
  963.  
  964. struct IntuiText text_2F=
  965. {
  966.   1, 2,     /* FrontPen, BackPen */
  967.   JAM1,     /* DrawMode */
  968.   7,4,      /* LeftEdge, TopEdge */
  969.   &my_font, /* *ITextFont, (Topaz, 80) */
  970.   NULL,    /* *IText */
  971.   NULL      /* *NextText */
  972. };
  973.  
  974. struct Gadget gadget_2F=
  975. {
  976.   &gadget_2E,             /* *NextGadget */
  977.   377, 103, 45, 15,       /* LeftEdge, TopEdge, Width, Height */
  978.   GADGHCOMP,              /* Flags */
  979.   RELVERIFY,              /* Activation */
  980.   BOOLGADGET,             /* GadgetType */
  981.   NULL,
  982.   NULL,                   /* SelectRender */
  983.   &text_2F,               /* *GadgetText */
  984.   NULL,                   /* MutualExclude */
  985.   NULL,                   /* SpecialInfo */
  986.   NULL,                   /* GadgetID */
  987.   NULL                    /* UserData */
  988. };
  989.  
  990.  
  991. /* ********************************************************************* */
  992. /* * Information for the boolean gadget "2G:"                          * */
  993. /* ********************************************************************* */
  994.  
  995. struct IntuiText text_2G=
  996. {
  997.   1, 2,     /* FrontPen, BackPen */
  998.   JAM1,     /* DrawMode */
  999.   7,4,      /* LeftEdge, TopEdge */
  1000.   &my_font, /* *ITextFont, (Topaz, 80) */
  1001.   NULL,    /* *IText */
  1002.   NULL      /* *NextText */
  1003. };
  1004.  
  1005. struct Gadget gadget_2G=
  1006. {
  1007.   &gadget_2F,              /* *NextGadget */
  1008.   377, 121, 45, 15,       /* LeftEdge, TopEdge, Width, Height */
  1009.   GADGHCOMP,              /* Flags */
  1010.   RELVERIFY,              /* Activation */
  1011.   BOOLGADGET,             /* GadgetType */
  1012.   NULL,
  1013.   NULL,                   /* SelectRender */
  1014.   &text_2G,               /* *GadgetText */
  1015.   NULL,                   /* MutualExclude */
  1016.   NULL,                   /* SpecialInfo */
  1017.   NULL,                   /* GadgetID */
  1018.   NULL                    /* UserData */
  1019. };
  1020.  
  1021.  
  1022. /* ********************************************************************* */
  1023. /* * Information for the boolean gadget 1A                             * */
  1024. /* ********************************************************************* */
  1025.  
  1026. struct IntuiText text_1A=
  1027. {
  1028.   1, 2,     /* FrontPen, BackPen */
  1029.   JAM1,     /* DrawMode */
  1030.   7,4,      /* LeftEdge, TopEdge */
  1031.   &my_font, /* *ITextFont, (Topaz, 80) */
  1032.   NULL,    /* *IText */
  1033.   NULL      /* *NextText */
  1034. };
  1035.  
  1036. struct Gadget gadget_1A=
  1037. {
  1038.   &gadget_2G,             /* *NextGadget */
  1039.   326, 13, 45, 15,        /* LeftEdge, TopEdge, Width, Height */
  1040.   GADGHCOMP,              /* Flags */
  1041.   RELVERIFY,              /* Activation */
  1042.   BOOLGADGET,             /* GadgetType */
  1043.   NULL,
  1044.   NULL,                   /* SelectRender */
  1045.   &text_1A,               /* *GadgetText */
  1046.   NULL,                   /* MutualExclude */
  1047.   NULL,                   /* SpecialInfo */
  1048.   NULL,                   /* GadgetID */
  1049.   NULL                    /* UserData */
  1050. };
  1051.  
  1052.  
  1053. /* ********************************************************************* */
  1054. /* * Information for the boolean gadget "1D:"                          * */
  1055. /* ********************************************************************* */
  1056.  
  1057. struct IntuiText text_1D=
  1058. {
  1059.   1, 2,     /* FrontPen, BackPen */
  1060.   JAM1,     /* DrawMode */
  1061.   7,4,      /* LeftEdge, TopEdge */
  1062.   &my_font, /* *ITextFont, (Topaz, 80) */
  1063.   NULL,    /* *IText */
  1064.   NULL      /* *NextText */
  1065. };
  1066.  
  1067. struct Gadget gadget_1D=
  1068. {
  1069.   &gadget_1A,             /* *NextGadget */
  1070.   326, 67, 45, 15,        /* LeftEdge, TopEdge, Width, Height */
  1071.   GADGHCOMP,              /* Flags */
  1072.   RELVERIFY,              /* Activation */
  1073.   BOOLGADGET,             /* GadgetType */
  1074.   NULL,
  1075.   NULL,                   /* SelectRender */
  1076.   &text_1D,               /* *GadgetText */
  1077.   NULL,                   /* MutualExclude */
  1078.   NULL,                   /* SpecialInfo */
  1079.   NULL,                   /* GadgetID */
  1080.   NULL                    /* UserData */
  1081. };
  1082.  
  1083.  
  1084. /* ********************************************************************* */
  1085. /* * Information for the boolean gadget "1B:"                          * */
  1086. /* ********************************************************************* */
  1087.  
  1088. struct IntuiText text_1B=
  1089. {
  1090.   1, 2,     /* FrontPen, BackPen */
  1091.   JAM1,     /* DrawMode */
  1092.   7,4,      /* LeftEdge, TopEdge */
  1093.   &my_font, /* *ITextFont, (Topaz, 80) */
  1094.   NULL,    /* *IText */
  1095.   NULL      /* *NextText */
  1096. };
  1097.  
  1098. struct Gadget gadget_1B=
  1099. {
  1100.   &gadget_1D,             /* *NextGadget */
  1101.   326, 31, 45, 15,        /* LeftEdge, TopEdge, Width, Height */
  1102.   GADGHCOMP,              /* Flags */
  1103.   RELVERIFY,              /* Activation */
  1104.   BOOLGADGET,             /* GadgetType */
  1105.   NULL,
  1106.   NULL,                   /* SelectRender */
  1107.   &text_1B,               /* *GadgetText */
  1108.   NULL,                   /* MutualExclude */
  1109.   NULL,                   /* SpecialInfo */
  1110.   NULL,                   /* GadgetID */
  1111.   NULL                    /* UserData */
  1112. };
  1113.  
  1114.  
  1115. /* ********************************************************************* */
  1116. /* * Information for the boolean gadget "1C:"                          * */
  1117. /* ********************************************************************* */
  1118.  
  1119. struct IntuiText text_1C=
  1120. {
  1121.   1, 2,     /* FrontPen, BackPen */
  1122.   JAM1,     /* DrawMode */
  1123.   7,4,      /* LeftEdge, TopEdge */
  1124.   &my_font, /* *ITextFont, (Topaz, 80) */
  1125.   NULL,    /* *IText */
  1126.   NULL      /* *NextText */
  1127. };
  1128.  
  1129. struct Gadget gadget_1C=
  1130. {
  1131.   &gadget_1B,             /* *NextGadget */
  1132.   326, 49, 45, 15,        /* LeftEdge, TopEdge, Width, Height */
  1133.   GADGHCOMP,              /* Flags */
  1134.   RELVERIFY,              /* Activation */
  1135.   BOOLGADGET,             /* GadgetType */
  1136.   NULL,
  1137.   NULL,                   /* SelectRender */
  1138.   &text_1C,               /* *GadgetText */
  1139.   NULL,                   /* MutualExclude */
  1140.   NULL,                   /* SpecialInfo */
  1141.   NULL,                   /* GadgetID */
  1142.   NULL                    /* UserData */
  1143. };
  1144.  
  1145.  
  1146. /* ********************************************************************* */
  1147. /* * Information for the boolean gadget "1E"                           * */
  1148. /* ********************************************************************* */
  1149.  
  1150. struct IntuiText text_1E=
  1151. {
  1152.   1, 2,     /* FrontPen, BackPen */
  1153.   JAM1,     /* DrawMode */
  1154.   7,4,      /* LeftEdge, TopEdge */
  1155.   &my_font, /* *ITextFont, (Topaz, 80) */
  1156.   NULL,    /* *IText */
  1157.   NULL      /* *NextText */
  1158. };
  1159.  
  1160. struct Gadget gadget_1E=
  1161. {
  1162.   &gadget_1C,            /* *NextGadget */
  1163.   326, 85, 45, 15,        /* LeftEdge, TopEdge, Width, Height */
  1164.   GADGHCOMP,              /* Flags */
  1165.   RELVERIFY,              /* Activation */
  1166.   BOOLGADGET,             /* GadgetType */
  1167.   NULL,
  1168.   NULL,                   /* SelectRender */
  1169.   &text_1E,               /* *GadgetText */
  1170.   NULL,                   /* MutualExclude */
  1171.   NULL,                   /* SpecialInfo */
  1172.   NULL,                   /* GadgetID */
  1173.   NULL                    /* UserData */
  1174. };
  1175.  
  1176.  
  1177. /* ********************************************************************* */
  1178. /* * Information for the boolean gadget "1F"                           * */
  1179. /* ********************************************************************* */
  1180.  
  1181. struct IntuiText text_1F=
  1182. {
  1183.   1, 2,     /* FrontPen, BackPen */
  1184.   JAM1,     /* DrawMode */
  1185.   7,4,      /* LeftEdge, TopEdge */
  1186.   &my_font, /* *ITextFont, (Topaz, 80) */
  1187.   NULL,    /* *IText */
  1188.   NULL      /* *NextText */
  1189. };
  1190.  
  1191. struct Gadget gadget_1F=
  1192. {
  1193.   &gadget_1E,             /* *NextGadget */
  1194.   326, 103, 45, 15,       /* LeftEdge, TopEdge, Width, Height */
  1195.   GADGHCOMP,              /* Flags */
  1196.   RELVERIFY,              /* Activation */
  1197.   BOOLGADGET,             /* GadgetType */
  1198.   NULL,
  1199.   NULL,                   /* SelectRender */
  1200.   &text_1F,               /* *GadgetText */
  1201.   NULL,                   /* MutualExclude */
  1202.   NULL,                   /* SpecialInfo */
  1203.   NULL,                   /* GadgetID */
  1204.   NULL                    /* UserData */
  1205. };
  1206.  
  1207.  
  1208. /* ********************************************************************* */
  1209. /* * Information for the boolean gadget "1G:"                          * */
  1210. /* ********************************************************************* */
  1211.  
  1212. struct IntuiText text_1G=
  1213. {
  1214.   1, 2,     /* FrontPen, BackPen */
  1215.   JAM1,     /* DrawMode */
  1216.   7,4,      /* LeftEdge, TopEdge */
  1217.   &my_font, /* *ITextFont, (Topaz, 80) */
  1218.   NULL,    /* *IText */
  1219.   NULL      /* *NextText */
  1220. };
  1221.  
  1222. struct Gadget gadget_1G=
  1223. {
  1224.   &gadget_1F,              /* *NextGadget */
  1225.   326, 121, 45, 15,       /* LeftEdge, TopEdge, Width, Height */
  1226.   GADGHCOMP,              /* Flags */
  1227.   RELVERIFY,              /* Activation */
  1228.   BOOLGADGET,             /* GadgetType */
  1229.   NULL,
  1230.   NULL,                   /* SelectRender */
  1231.   &text_1G,               /* *GadgetText */
  1232.   NULL,                   /* MutualExclude */
  1233.   NULL,                   /* SpecialInfo */
  1234.   NULL,                   /* GadgetID */
  1235.   NULL                    /* UserData */
  1236. };
  1237.  
  1238.  
  1239. /* ********************************************************************* */
  1240. /* * Information for the boolean gadget "GET DIR"                      * */
  1241. /* ********************************************************************* */
  1242.  
  1243. struct IntuiText text_getdir=
  1244. {
  1245.   1, 2,     /* FrontPen, BackPen */
  1246.   JAM1,     /* DrawMode */
  1247.   7,4,      /* LeftEdge, TopEdge */
  1248.   &my_font, /* *ITextFont, (Topaz, 80) */
  1249.   "GET DIR",/* *IText */
  1250.   NULL      /* *NextText */
  1251. };
  1252.  
  1253. struct Gadget gadget_getdir=
  1254. {
  1255.   &gadget_1G,             /* *NextGadget */
  1256.   244, 166, 68, 15,       /* LeftEdge, TopEdge, Width, Height */
  1257.   GADGHCOMP,              /* Flags */
  1258.   RELVERIFY,              /* Activation */
  1259.   BOOLGADGET,             /* GadgetType */
  1260.   NULL,
  1261.   NULL,                   /* SelectRender */
  1262.   &text_getdir,           /* *GadgetText */
  1263.   NULL,                   /* MutualExclude */
  1264.   NULL,                   /* SpecialInfo */
  1265.   NULL,                   /* GadgetID */
  1266.   NULL                    /* UserData */
  1267. };
  1268.  
  1269.  
  1270. /* ********************************************************************* */
  1271. /* * Information for the boolean gadget "CANCEL"                       * */
  1272. /* ********************************************************************* */
  1273.  
  1274. struct IntuiText text_cancel=
  1275. {
  1276.   1, 2,     /* FrontPen, BackPen */
  1277.   JAM1,     /* DrawMode */
  1278.   7,4,      /* LeftEdge, TopEdge */
  1279.   &my_font, /* *ITextFont, (Topaz, 80) */
  1280.   "CANCEL", /* *IText */
  1281.   NULL      /* *NextText */
  1282. };
  1283.  
  1284. struct Gadget gadget_cancel=
  1285. {
  1286.   &gadget_getdir,         /* *NextGadget */
  1287.   177, 166, 61, 15,       /* LeftEdge, TopEdge, Width, Height */
  1288.   GADGHCOMP,              /* Flags */
  1289.   RELVERIFY,              /* Activation */
  1290.   BOOLGADGET,             /* GadgetType */
  1291.   NULL,
  1292.   NULL,                   /* SelectRender */
  1293.   &text_cancel,           /* *GadgetText */
  1294.   NULL,                   /* MutualExclude */
  1295.   NULL,                   /* SpecialInfo */
  1296.   NULL,                   /* GadgetID */
  1297.   NULL                    /* UserData */
  1298. };
  1299.  
  1300.  
  1301. /* ********************************************************************* */
  1302. /* * Information for the boolean gadget "DELETE"                       * */
  1303. /* ********************************************************************* */
  1304.  
  1305. struct IntuiText text_delete=
  1306. {
  1307.   1, 2,     /* FrontPen, BackPen */
  1308.   JAM1,     /* DrawMode */
  1309.   7,4,      /* LeftEdge, TopEdge */
  1310.   &my_font, /* *ITextFont, (Topaz, 80) */
  1311.   "DELETE", /* *IText */
  1312.   NULL      /* *NextText */
  1313. };
  1314.  
  1315. struct Gadget gadget_delete=
  1316. {
  1317.   &gadget_cancel,         /* *NextGadget */
  1318.   110, 166, 61, 15,       /* LeftEdge, TopEdge, Width, Height */
  1319.   GADGHCOMP,              /* Flags */
  1320.   RELVERIFY,              /* Activation */
  1321.   BOOLGADGET,             /* GadgetType */
  1322.   NULL,
  1323.   NULL,                   /* SelectRender */
  1324.   &text_delete,           /* *GadgetText */
  1325.   NULL,                   /* MutualExclude */
  1326.   NULL,                   /* SpecialInfo */
  1327.   NULL,                   /* GadgetID */
  1328.   NULL                    /* UserData */
  1329. };
  1330.  
  1331.  
  1332. /* ********************************************************************* */
  1333. /* * Information for the boolean gadget "SAVE"                         * */
  1334. /* ********************************************************************* */
  1335.  
  1336. struct IntuiText text_save=
  1337. {
  1338.   1, 2,     /* FrontPen, BackPen */
  1339.   JAM1,     /* DrawMode */
  1340.   7,4,      /* LeftEdge, TopEdge */
  1341.   &my_font, /* *ITextFont, (Topaz, 80) */
  1342.   "SAVE",   /* *IText */
  1343.   NULL      /* *NextText */
  1344. };
  1345.  
  1346. struct Gadget gadget_save=
  1347. {
  1348.   &gadget_delete,         /* *NextGadget */
  1349.   59, 166, 45, 15,        /* LeftEdge, TopEdge, Width, Height */
  1350.   GADGHCOMP,              /* Flags */
  1351.   RELVERIFY,              /* Activation */
  1352.   BOOLGADGET,             /* GadgetType */
  1353.   NULL,
  1354.   NULL,                   /* SelectRender */
  1355.   &text_save,             /* *GadgetText */
  1356.   NULL,                   /* MutualExclude */
  1357.   NULL,                   /* SpecialInfo */
  1358.   NULL,                   /* GadgetID */
  1359.   NULL                    /* UserData */
  1360. };
  1361.  
  1362.  
  1363. /* ********************************************************************* */
  1364. /* * Information for the boolean gadget "LOAD"                         * */
  1365. /* ********************************************************************* */
  1366.  
  1367. struct IntuiText text_load=
  1368. {
  1369.   1, 2,     /* FrontPen, BackPen */
  1370.   JAM1,     /* DrawMode */
  1371.   7,4,      /* LeftEdge, TopEdge */
  1372.   &my_font, /* *ITextFont, (Topaz, 80) */
  1373.   "LOAD",   /* *IText */
  1374.   NULL      /* *NextText */
  1375. };
  1376.  
  1377. struct Gadget gadget_load=
  1378. {
  1379.   &gadget_save,           /* *NextGadget */
  1380.   8, 166, 45, 15,         /* LeftEdge, TopEdge, Width, Height */
  1381.   GADGHCOMP,              /* Flags */
  1382.   RELVERIFY,              /* Activation */
  1383.   BOOLGADGET,             /* GadgetType */
  1384.   NULL,
  1385.   NULL,                   /* SelectRender */
  1386.   &text_load,             /* *GadgetText */
  1387.   NULL,                   /* MutualExclude */
  1388.   NULL,                   /* SpecialInfo */
  1389.   NULL,                   /* GadgetID */
  1390.   NULL                    /* UserData */
  1391. };
  1392.  
  1393.  
  1394. UBYTE display_text[13][34];
  1395.  
  1396. struct IntuiText text_list[13]=
  1397. {
  1398.   {
  1399.     1, 0,            /* FrontPen, BackPen */
  1400.     JAM2,            /* DrawMode */
  1401.     0,22-UP,             /* LeftEdge, TopEdge */
  1402.     &my_font,        /* *ITextFont */
  1403.     display_text[0], /* IText */
  1404.     &text_list[1]    /* *NextText */
  1405.   },
  1406.   {
  1407.     1, 0,            /* FrontPen, BackPen */
  1408.     JAM2,            /* DrawMode */
  1409.     0,30-UP,             /* LeftEdge, TopEdge */
  1410.     &my_font,        /* *ITextFont */
  1411.     display_text[1], /* IText */
  1412.     &text_list[2]    /* *NextText */
  1413.   },
  1414.   {
  1415.     1, 0,            /* FrontPen, BackPen */
  1416.     JAM2,            /* DrawMode */
  1417.     0,38-UP,            /* LeftEdge, TopEdge */
  1418.     &my_font,        /* *ITextFont */
  1419.     display_text[2], /* IText */
  1420.     &text_list[3]    /* *NextText */
  1421.   },
  1422.   {
  1423.     1, 0,            /* FrontPen, BackPen */
  1424.     JAM2,            /* DrawMode */
  1425.     0,46-UP,            /* LeftEdge, TopEdge */
  1426.     &my_font,        /* *ITextFont */
  1427.     display_text[3], /* IText */
  1428.     &text_list[4]    /* *NextText */
  1429.   },
  1430.   {
  1431.     1, 0,            /* FrontPen, BackPen */
  1432.     JAM2,            /* DrawMode */
  1433.     0,54-UP,            /* LeftEdge, TopEdge */
  1434.     &my_font,        /* *ITextFont */
  1435.     display_text[4], /* IText */
  1436.     &text_list[5]    /* *NextText */
  1437.   },
  1438.   {
  1439.     1, 0,            /* FrontPen, BackPen */
  1440.     JAM2,            /* DrawMode */
  1441.     0,62-UP,            /* LeftEdge, TopEdge */
  1442.     &my_font,        /* *ITextFont */
  1443.     display_text[5], /* IText */
  1444.     &text_list[6]    /* *NextText */
  1445.   },
  1446.   {
  1447.     1, 0,            /* FrontPen, BackPen */
  1448.     JAM2,            /* DrawMode */
  1449.     0,70-UP,            /* LeftEdge, TopEdge */
  1450.     &my_font,        /* *ITextFont */
  1451.     display_text[6], /* IText */
  1452.     &text_list[7]    /* *NextText */
  1453.   },
  1454.   {
  1455.     1, 0,            /* FrontPen, BackPen */
  1456.     JAM2,            /* DrawMode */
  1457.     0,78-UP,            /* LeftEdge, TopEdge */
  1458.     &my_font,        /* *ITextFont */
  1459.     display_text[7], /* IText */
  1460.     &text_list[8]    /* *NextText */
  1461.   },
  1462.   {
  1463.     1, 0,            /* FrontPen, BackPen */
  1464.     JAM2,            /* DrawMode */
  1465.     0,86-UP,             /* LeftEdge, TopEdge */
  1466.     &my_font,        /* *ITextFont */
  1467.     display_text[8], /* IText */
  1468.     &text_list[9]    /* *NextText */
  1469.   },
  1470.   {
  1471.     1, 0,            /* FrontPen, BackPen */
  1472.     JAM2,            /* DrawMode */
  1473.     0,94-UP,             /* LeftEdge, TopEdge */
  1474.     &my_font,        /* *ITextFont */
  1475.     display_text[9], /* IText */
  1476.     &text_list[10]    /* *NextText */
  1477.   },
  1478.   {
  1479.     1, 0,            /* FrontPen, BackPen */
  1480.     JAM2,            /* DrawMode */
  1481.     0,102-UP,            /* LeftEdge, TopEdge */
  1482.     &my_font,        /* *ITextFont */
  1483.     display_text[10], /* IText */
  1484.     &text_list[11]    /* *NextText */
  1485.   },
  1486.   {
  1487.     1, 0,            /* FrontPen, BackPen */
  1488.     JAM2,            /* DrawMode */
  1489.     0,110-UP,            /* LeftEdge, TopEdge */
  1490.     &my_font,        /* *ITextFont */
  1491.     display_text[11], /* IText */
  1492.     &text_list[12]    /* *NextText */
  1493.   },
  1494.   {
  1495.     1, 0,            /* FrontPen, BackPen */
  1496.     JAM2,            /* DrawMode */
  1497.     0,118-UP,            /* LeftEdge, TopEdge */
  1498.     &my_font,        /* *ITextFont */
  1499.     display_text[12], /* IText */
  1500.     NULL              /* *NextText */
  1501.   }
  1502. };
  1503.  
  1504.  
  1505. struct Gadget gadget_display[13]=
  1506. {
  1507.   {
  1508.     &gadget_display[1], /* *NextGadget */
  1509.     8, 72-UP, 276, 12,     /* LeftEdge, TopEdge, Width, Height */
  1510.     GADGHNONE,          /* Flags */
  1511.     GADGIMMEDIATE,      /* Activation */
  1512.     BOOLGADGET,         /* GadgetType */
  1513.     NULL,               /* GadgetRender */
  1514.     NULL,               /* SelectRender */
  1515.     NULL,               /* *GadgetText */
  1516.     NULL,               /* MutualExclude */
  1517.     NULL,               /* SpecialInfo */
  1518.     NULL,               /* GadgetID */
  1519.     NULL                /* UserData */
  1520.   },
  1521.   {
  1522.     &gadget_display[2], /* *NextGadget */
  1523.     8, 84-UP, 276, 8,      /* LeftEdge, TopEdge, Width, Height */
  1524.     GADGHNONE,          /* Flags */
  1525.     GADGIMMEDIATE,      /* Activation */
  1526.     BOOLGADGET,         /* GadgetType */
  1527.     NULL,               /* GadgetRender */
  1528.     NULL,               /* SelectRender */
  1529.     NULL,               /* *GadgetText */
  1530.     NULL,               /* MutualExclude */
  1531.     NULL,               /* SpecialInfo */
  1532.     NULL,               /* GadgetID */
  1533.     NULL                /* UserData */
  1534.   },
  1535.   {
  1536.     &gadget_display[3], /* *NextGadget */
  1537.     8, 92-UP, 276, 8,      /* LeftEdge, TopEdge, Width, Height */
  1538.     GADGHNONE,          /* Flags */
  1539.     GADGIMMEDIATE,      /* Activation */
  1540.     BOOLGADGET,         /* GadgetType */
  1541.     NULL,               /* GadgetRender */
  1542.     NULL,               /* SelectRender */
  1543.     NULL,               /* *GadgetText */
  1544.     NULL,               /* MutualExclude */
  1545.     NULL,               /* SpecialInfo */
  1546.     NULL,               /* GadgetID */
  1547.     NULL                /* UserData */
  1548.   },
  1549.   {
  1550.     &gadget_display[4], /* *NextGadget */
  1551.     8, 100-UP, 276, 8,     /* LeftEdge, TopEdge, Width, Height */
  1552.     GADGHNONE,          /* Flags */
  1553.     GADGIMMEDIATE,      /* Activation */
  1554.     BOOLGADGET,         /* GadgetType */
  1555.     NULL,               /* GadgetRender */
  1556.     NULL,               /* SelectRender */
  1557.     NULL,               /* *GadgetText */
  1558.     NULL,               /* MutualExclude */
  1559.     NULL,               /* SpecialInfo */
  1560.     NULL,               /* GadgetID */
  1561.     NULL                /* UserData */
  1562.   },
  1563.   {
  1564.     &gadget_display[5], /* *NextGadget */
  1565.     8,108-UP, 276, 8,      /* LeftEdge, TopEdge, Width, Height */
  1566.     GADGHNONE,          /* Flags */
  1567.     GADGIMMEDIATE,      /* Activation */
  1568.     BOOLGADGET,         /* GadgetType */
  1569.     NULL,               /* GadgetRender */
  1570.     NULL,               /* SelectRender */
  1571.     NULL,               /* *GadgetText */
  1572.     NULL,               /* MutualExclude */
  1573.     NULL,               /* SpecialInfo */
  1574.     NULL,               /* GadgetID */
  1575.     NULL                /* UserData */
  1576.   },
  1577.   {
  1578.     &gadget_display[6], /* *NextGadget */
  1579.     8,116-UP, 276, 8,      /* LeftEdge, TopEdge, Width, Height */
  1580.     GADGHNONE,          /* Flags */
  1581.     GADGIMMEDIATE,      /* Activation */
  1582.     BOOLGADGET,         /* GadgetType */
  1583.     NULL,               /* GadgetRender */
  1584.     NULL,               /* SelectRender */
  1585.     NULL,               /* *GadgetText */
  1586.     NULL,               /* MutualExclude */
  1587.     NULL,               /* SpecialInfo */
  1588.     NULL,               /* GadgetID */
  1589.     NULL                /* UserData */
  1590.   },
  1591.   {
  1592.     &gadget_display[7], /* *NextGadget */
  1593.     8, 124-UP, 276, 8,      /* LeftEdge, TopEdge, Width, Height */
  1594.     GADGHNONE,          /* Flags */
  1595.     GADGIMMEDIATE,      /* Activation */
  1596.     BOOLGADGET,         /* GadgetType */
  1597.     NULL,               /* GadgetRender */
  1598.     NULL,               /* SelectRender */
  1599.     NULL,               /* *GadgetText */
  1600.     NULL,               /* MutualExclude */
  1601.     NULL,               /* SpecialInfo */
  1602.     NULL,               /* GadgetID */
  1603.     NULL                /* UserData */
  1604.   },
  1605.   {
  1606.     &gadget_display[8],       /* *NextGadget */
  1607.     8, 132-UP, 276, 12,    /* LeftEdge, TopEdge, Width, Height */
  1608.     GADGHNONE,          /* Flags */
  1609.     GADGIMMEDIATE,      /* Activation */
  1610.     BOOLGADGET,         /* GadgetType */
  1611.     NULL,               /* GadgetRender */
  1612.     NULL,               /* SelectRender */
  1613.     NULL,               /* *GadgetText */
  1614.     NULL,               /* MutualExclude */
  1615.     NULL,               /* SpecialInfo */
  1616.     NULL,               /* GadgetID */
  1617.     NULL                /* UserData */
  1618.   },
  1619.   {
  1620.     &gadget_display[9], /* *NextGadget */
  1621.     8, 140-UP, 276, 8,     /* LeftEdge, TopEdge, Width, Height */
  1622.     GADGHNONE,          /* Flags */
  1623.     GADGIMMEDIATE,      /* Activation */
  1624.     BOOLGADGET,         /* GadgetType */
  1625.     NULL,               /* GadgetRender */
  1626.     NULL,               /* SelectRender */
  1627.     NULL,               /* *GadgetText */
  1628.     NULL,               /* MutualExclude */
  1629.     NULL,               /* SpecialInfo */
  1630.     NULL,               /* GadgetID */
  1631.     NULL                /* UserData */
  1632.   },
  1633.   {
  1634.     &gadget_display[10], /* *NextGadget */
  1635.     8,148-UP, 276, 8,      /* LeftEdge, TopEdge, Width, Height */
  1636.     GADGHNONE,          /* Flags */
  1637.     GADGIMMEDIATE,      /* Activation */
  1638.     BOOLGADGET,         /* GadgetType */
  1639.     NULL,               /* GadgetRender */
  1640.     NULL,               /* SelectRender */
  1641.     NULL,               /* *GadgetText */
  1642.     NULL,               /* MutualExclude */
  1643.     NULL,               /* SpecialInfo */
  1644.     NULL,               /* GadgetID */
  1645.     NULL                /* UserData */
  1646.   },
  1647.   {
  1648.     &gadget_display[11], /* *NextGadget */
  1649.     8,156-UP, 276, 8,      /* LeftEdge, TopEdge, Width, Height */
  1650.     GADGHNONE,          /* Flags */
  1651.     GADGIMMEDIATE,      /* Activation */
  1652.     BOOLGADGET,         /* GadgetType */
  1653.     NULL,               /* GadgetRender */
  1654.     NULL,               /* SelectRender */
  1655.     NULL,               /* *GadgetText */
  1656.     NULL,               /* MutualExclude */
  1657.     NULL,               /* SpecialInfo */
  1658.     NULL,               /* GadgetID */
  1659.     NULL                /* UserData */
  1660.   },
  1661.   {
  1662.     &gadget_display[12], /* *NextGadget */
  1663.     8, 164-UP, 276, 8,      /* LeftEdge, TopEdge, Width, Height */
  1664.     GADGHNONE,          /* Flags */
  1665.     GADGIMMEDIATE,      /* Activation */
  1666.     BOOLGADGET,         /* GadgetType */
  1667.     NULL,               /* GadgetRender */
  1668.     NULL,               /* SelectRender */
  1669.     NULL,               /* *GadgetText */
  1670.     NULL,               /* MutualExclude */
  1671.     NULL,               /* SpecialInfo */
  1672.     NULL,               /* GadgetID */
  1673.     NULL                /* UserData */
  1674.   },
  1675.   {
  1676.     &gadget_load,       /* *NextGadget */
  1677.     8, 172-UP, 276, 12,    /* LeftEdge, TopEdge, Width, Height */
  1678.     GADGHNONE,          /* Flags */
  1679.     GADGIMMEDIATE,      /* Activation */
  1680.     BOOLGADGET,         /* GadgetType */
  1681.     NULL,               /* GadgetRender */
  1682.     NULL,               /* SelectRender */
  1683.     NULL,               /* *GadgetText */
  1684.     NULL,               /* MutualExclude */
  1685.     NULL,               /* SpecialInfo */
  1686.     NULL,               /* GadgetID */
  1687.     NULL                /* UserData */
  1688.   }
  1689. };
  1690.  
  1691.  
  1692. /* ********************************************************************* */
  1693. /* * Information for the window                                          */
  1694. /* ********************************************************************* */
  1695.  
  1696. struct NewWindow new_file_window=
  1697. {
  1698.   0,11,              /* LeftEdge, TopEdge */
  1699.   481, 185,         /* Width, Height */
  1700.   0,1,              /* DetailPen, BlockPen */
  1701.   CLOSEWINDOW|      /* IDCMPFlags */
  1702.   GADGETDOWN|
  1703.   MOUSEMOVE|
  1704.   GADGETUP,
  1705.   ACTIVATE|         /* Flags */
  1706.   WINDOWDEPTH|
  1707.   WINDOWDRAG|
  1708.   WINDOWCLOSE|
  1709.   SMART_REFRESH,
  1710.   &gadget_display[0], /* *FirstGadget */
  1711.   NULL,               /* *CheckMark */
  1712.   NULL,               /* *Title */
  1713.   NULL,               /* *Screen */
  1714.   NULL,               /* *BitMap */
  1715.   0,0,                /* MinWidth, MinHeight */
  1716.   0,0,                /* MaxWidth, MaxHeight */
  1717.   WBENCHSCREEN        /* Type */
  1718. };
  1719.  
  1720.  
  1721. /* ======================== THE WIZARD FILER FUNCTION ============== */
  1722.  
  1723. USHORT WizardFiler( title, ToShow, ToHide, x, y, screen, total_file_name )
  1724. STRPTR title;
  1725. STRPTR ToShow;
  1726. STRPTR ToHide;
  1727. SHORT  x,y;
  1728. struct Screen *screen;
  1729. STRPTR total_file_name;
  1730. {
  1731.   int temp2;
  1732.   int temp1; /* Variable used for loops etc. */
  1733.   int file_count; /* How many files/directories there are. */
  1734.  
  1735.   ULONG class;  /* Saved IntuiMessage: IDCMP flags. */
  1736.   APTR address; /*        -"-        : The address of the object. */
  1737.  
  1738.   int position; /* The number of the first file in the display. */
  1739.  
  1740.   BOOL working;     /* Wants the user to quit? */
  1741.   BOOL fix_display; /* Should we update the file-display? */
  1742.  
  1743.   STRPTR string_pointer; /* Pointer to a string. */
  1744.   struct file_info *pointer; /* Pointer to a file_info structure. */
  1745.  
  1746.   USHORT operation; /* What operation WizardFiler will return. */
  1747.   
  1748.  
  1749.   file_lock=FALSE; /* We have not locked any file/directory. */
  1750.   more_files=FALSE; /* Do not list any files yet. */
  1751.  
  1752.  
  1753.   /* Make sure the proportional gadget is at the top, showing 100%: */
  1754.   prop_info.VertBody=0xFFFF;
  1755.   prop_info.HorizBody=0;
  1756.   prop_info.VertPot=0;
  1757.   prop_info.HorizPot=0;
  1758.   
  1759.  
  1760.   /* Copy the ToShow extension into the string gadget: */
  1761.   if(ToShow==NULL) strcpy(ToShow_name,"#?");
  1762.   else strcpy(ToShow_name, ToShow);
  1763.  
  1764.   /* Copy the ToHide extension into the string gadget: */
  1765.   strcpy(ToHide_name, ToHide);
  1766.  
  1767.  
  1768.   /* Change some values in the new_file_window structure: */
  1769.   new_file_window.LeftEdge=x;
  1770.   new_file_window.TopEdge=y;
  1771.   new_file_window.Title=title;
  1772.  
  1773.   /* Does the user want to use one of his own screens? */
  1774.   if(screen)
  1775.   {
  1776.     new_file_window.Screen=screen;
  1777.     new_file_window.Type=CUSTOMSCREEN;
  1778.   }    
  1779.  
  1780.  
  1781.   text_1A.IText=mydevname[0];
  1782.   text_1B.IText=mydevname[1];
  1783.   text_1C.IText=mydevname[2];
  1784.   text_1D.IText=mydevname[3];
  1785.   text_1E.IText=mydevname[4];
  1786.   text_1F.IText=mydevname[5];
  1787.   text_1G.IText=mydevname[6];
  1788.   text_2A.IText=mydevname[7];
  1789.   text_2B.IText=mydevname[8];
  1790.   text_2C.IText=mydevname[9];
  1791.   text_2D.IText=mydevname[10];
  1792.   text_2E.IText=mydevname[11];
  1793.   text_2F.IText=mydevname[12];
  1794.   text_2G.IText=mydevname[13];
  1795.   text_3A.IText=mydevname[14];
  1796.   text_3B.IText=mydevname[15];
  1797.   text_3C.IText=mydevname[16];
  1798.   text_3D.IText=mydevname[17];
  1799.   text_3E.IText=mydevname[18];
  1800.   text_3F.IText=mydevname[19];
  1801.   text_3G.IText=mydevname[20];
  1802.  
  1803.   OpenDevList();
  1804.   for(temp2=0;temp2<21;temp2++)
  1805.   {
  1806.     if(ReadDevList(mydev[temp2],DLT_DEVICE)==0) break;
  1807.     mydevname[temp2][0]=mydev[temp2][0];
  1808.     mydevname[temp2][1]=mydev[temp2][1];
  1809.     mydevname[temp2][2]=mydev[temp2][2];
  1810.     mydevname[temp2][3]=mydev[temp2][3];
  1811.     mydevname[temp2][4]=0;
  1812.   }
  1813.  
  1814.   OpenDevList();
  1815.   for(;temp2<21;temp2++)
  1816.   {
  1817.     if(ReadDevList(mydev[temp2],DLT_DIRECTORY)==0) break;
  1818.     mydevname[temp2][0]=mydev[temp2][0];
  1819.     mydevname[temp2][1]=mydev[temp2][1];
  1820.     mydevname[temp2][2]=mydev[temp2][2];
  1821.     mydevname[temp2][3]=mydev[temp2][3];
  1822.     mydevname[temp2][4]=0;
  1823.   }
  1824.  
  1825.   OpenDevList();
  1826.   for(;temp2<21;temp2++)
  1827.   {
  1828.     if(ReadDevList(mydev[temp2],DLT_VOLUME)==0) break;
  1829.     mydevname[temp2][0]=mydev[temp2][0];
  1830.     mydevname[temp2][1]=mydev[temp2][1];
  1831.     mydevname[temp2][2]=mydev[temp2][2];
  1832.     mydevname[temp2][3]=mydev[temp2][3];
  1833.     mydevname[temp2][4]=0;
  1834.   }
  1835.  
  1836.  
  1837.   /* Open the window: */
  1838.   if( (file_window = (struct Window *) OpenWindow(&new_file_window)) == NULL )
  1839.   {
  1840.     /* We could NOT open the window! */
  1841.   
  1842.     /* Leave: */
  1843.     return(PANIC);
  1844.   }
  1845.  
  1846.  
  1847.   Draw3D(file_window->RPort,8,72-UP,276,112,FALSE,POS);   /* Big box      */
  1848.   Draw3D(file_window->RPort,290, 13, 21, 93,FALSE,POS);   /* Prop gadget  */
  1849.   Draw3D(file_window->RPort,290,109, 21, 16,FALSE,POS);   /* Parent       */
  1850.   Draw3D(file_window->RPort,244,166, 68, 15,FALSE,POS);   /* GET DIR      */
  1851.   Draw3D(file_window->RPort,177,166, 61, 15,FALSE,POS);   /* CANCEL       */
  1852.   Draw3D(file_window->RPort,110,166, 61, 15,FALSE,POS);   /* DELETE       */
  1853.   Draw3D(file_window->RPort, 59,166, 45, 15,FALSE,POS);   /* SAVE         */
  1854.   Draw3D(file_window->RPort,  8,166, 45, 15,FALSE,POS);   /* LOAD         */
  1855.   Draw3D(file_window->RPort,352,147,121, 16,FALSE,POS);   /* ToShow a     */
  1856.   Draw3D(file_window->RPort,354,148,117, 14,FALSE,NEG);   /* ToShow i     */
  1857.   Draw3D(file_window->RPort,352,165,121, 16,FALSE,POS);   /* ToHide a     */
  1858.   Draw3D(file_window->RPort,354,166,117, 14,FALSE,NEG);   /* ToHide i     */
  1859.   Draw3D(file_window->RPort, 58,147,254, 16,FALSE,POS);   /* File a       */
  1860.   Draw3D(file_window->RPort, 60,148,250, 14,FALSE,NEG);   /* File i       */
  1861.   Draw3D(file_window->RPort, 74,128,238, 16,FALSE,POS);   /* Drawer a     */
  1862.   Draw3D(file_window->RPort, 76,129,234, 14,FALSE,NEG);   /* Drawer i     */
  1863.  
  1864.   Draw3D(file_window->RPort,326, 13, 45, 15,FALSE,POS);   /* 1A           */
  1865.   Draw3D(file_window->RPort,326, 31, 45, 15,FALSE,POS);   /* 1B           */
  1866.   Draw3D(file_window->RPort,326, 49, 45, 15,FALSE,POS);   /* 1C           */
  1867.   Draw3D(file_window->RPort,326, 67, 45, 15,FALSE,POS);   /* 1D           */
  1868.   Draw3D(file_window->RPort,326, 85, 45, 15,FALSE,POS);   /* 1E           */
  1869.   Draw3D(file_window->RPort,326,103, 45, 15,FALSE,POS);   /* 1F           */
  1870.   Draw3D(file_window->RPort,326,121, 45, 15,FALSE,POS);   /* 1G           */
  1871.  
  1872.   Draw3D(file_window->RPort,377, 13, 45, 15,FALSE,POS);   /* 2A           */
  1873.   Draw3D(file_window->RPort,377, 31, 45, 15,FALSE,POS);   /* 2B           */
  1874.   Draw3D(file_window->RPort,377, 49, 45, 15,FALSE,POS);   /* 2C           */
  1875.   Draw3D(file_window->RPort,377, 67, 45, 15,FALSE,POS);   /* 2D           */
  1876.   Draw3D(file_window->RPort,377, 85, 45, 15,FALSE,POS);   /* 2E           */
  1877.   Draw3D(file_window->RPort,377,103, 45, 15,FALSE,POS);   /* 2F           */
  1878.   Draw3D(file_window->RPort,377,121, 45, 15,FALSE,POS);   /* 2G           */
  1879.  
  1880.   Draw3D(file_window->RPort,428, 13, 45, 15,FALSE,POS);   /* 3A           */
  1881.   Draw3D(file_window->RPort,428, 31, 45, 15,FALSE,POS);   /* 3B           */
  1882.   Draw3D(file_window->RPort,428, 49, 45, 15,FALSE,POS);   /* 3C           */
  1883.   Draw3D(file_window->RPort,428, 67, 45, 15,FALSE,POS);   /* 3D           */
  1884.   Draw3D(file_window->RPort,428, 85, 45, 15,FALSE,POS);   /* 3E           */
  1885.   Draw3D(file_window->RPort,428,103, 45, 15,FALSE,POS);   /* 3F           */
  1886.   Draw3D(file_window->RPort,428,121, 45, 15,FALSE,POS);   /* 3G           */
  1887.  
  1888.  
  1889.   /* Allocate memory for the FileInfoBlock: */
  1890.   if((file_info=(struct FileInfoBlock *)
  1891.     AllocMem(sizeof(struct FileInfoBlock), MEMF_PUBLIC|MEMF_CLEAR))==NULL)
  1892.   {
  1893.     /* Could not allocate memory for the FileInfoBlock! */
  1894.     /* Inform the user about the problem, and leave. */
  1895.     request_ok("NOT enough memory!");
  1896.     return(PANIC);
  1897.   }
  1898.  
  1899.  
  1900.   /* Is the there anything in the total_file_name string? */
  1901.   if(*total_file_name != '\0')
  1902.   {
  1903.     /* Yes! */
  1904.     /* Try to "lock" the file/directory: */
  1905.     if((lock=Lock(total_file_name, ACCESS_READ))==NULL)
  1906.     {
  1907.       /* PROBLEMS! */
  1908.       /* File/directory/device did NOT exist! */
  1909.     }
  1910.     else
  1911.     {
  1912.       /* Could lock the file/directory! */
  1913.       file_lock=TRUE;
  1914.   
  1915.       /* Get some information of the file/directory: */
  1916.       if((Examine(lock, file_info))==NULL)
  1917.       {
  1918.         /* Could NOT examine the object! */
  1919.         request_ok("ERROR reading file/directory!");
  1920.       }
  1921.       else
  1922.       {
  1923.         /* Is it a directory or a file? */
  1924.         if(directory(file_info))
  1925.         {
  1926.           /* It is a directory! */
  1927.  
  1928.           *file_name='\0'; /* Clear file_name string. */
  1929.           /* Copy total_file_name into drawer_name string: */
  1930.           strcpy(drawer_name, total_file_name);
  1931.  
  1932.           /* Since it is a directory, we will look for more files: */
  1933.           more_files=TRUE;
  1934.         }
  1935.         else
  1936.         {
  1937.           /* It is a file! */
  1938.           
  1939.           /* Separate the file name from the path: */
  1940.           if(string_pointer=right_pos(total_file_name, '/'))
  1941.           {
  1942.             /* Copy the file name into file_name string: */
  1943.             strcpy(file_name, string_pointer+1);
  1944.             *string_pointer='\0';
  1945.           }
  1946.           else
  1947.           {
  1948.             if(string_pointer=right_pos(total_file_name, ':'))
  1949.             {
  1950.               /* Copy the file name into file_name string: */
  1951.               strcpy(file_name, string_pointer+1);
  1952.               *(string_pointer+1)='\0';
  1953.             }
  1954.             else
  1955.             {
  1956.               strcpy(file_name, total_file_name);        
  1957.               *drawer_name='\0';
  1958.               *total_file_name='\0';
  1959.             }
  1960.           }
  1961.           strcpy(drawer_name, total_file_name);
  1962.  
  1963.           /* Since it is a file, we will NOT look for more files: */
  1964.           /* However, more_files is already FALSE. */
  1965.  
  1966.         } /* Is it a directory? */
  1967.  
  1968.       } /* Could we examine the object? */
  1969.  
  1970.     } /* Could we "lock" the file/directory? */
  1971.  
  1972.   } /* Anything in the total_file_name string? */
  1973.  
  1974.  
  1975.   /* Since we have messed around with the string gadgets it is best */
  1976.   /* to adjust them so the user can see them clearly:               */
  1977.   adjust_string_gadgets();
  1978.  
  1979.  
  1980.   new_drawer(); /* Start to show us the files. */
  1981.  
  1982.  
  1983.   position=0;        /* The display will show the first file. */
  1984.   fix_display=FALSE; /* We do not need to fix the display. */
  1985.   first_file=TRUE;   /* No files saved. */
  1986.   file_count=0;      /* No files saved. */
  1987.  
  1988.  
  1989.   working=TRUE;
  1990.   do
  1991.   {
  1992.     /* If we have shown all files in the directory, we put our task */
  1993.     /* to sleep. That will speed up other programs, and we will not */
  1994.     /* use unnecessary processing time:                             */
  1995.     if(more_files==FALSE)
  1996.       Wait(1 << file_window->UserPort->mp_SigBit);
  1997.  
  1998.  
  1999.     /* Has something has happened with the gadgets in the file_window? */
  2000.     while(my_gadget_message = (struct IntuiMessage *)
  2001.       GetMsg(file_window->UserPort))
  2002.     {
  2003.       /* As long as something is happening with the gadgets we will     */
  2004.       /* stay in the while loop. This is very handy since we can        */
  2005.       /* recieve hundereds of messages if the mouse is moving, and      */
  2006.       /* we only want to update the display when the mouse has stopped: */
  2007.       
  2008.       /* Collect some interesting values: */
  2009.       class = my_gadget_message->Class;
  2010.       address = my_gadget_message->IAddress;
  2011.  
  2012.       /* We have now saved some important values, and can now reply: */
  2013.       /* (Do NEVER try to get some values after you have replied!)   */
  2014.       ReplyMsg((struct Message *)my_gadget_message);
  2015.  
  2016.  
  2017.       /* What has actually happened? */
  2018.       switch(class)
  2019.       {
  2020.         case MOUSEMOVE:
  2021.           /* The proportional gadget is selected, and the mouse is  */ 
  2022.           /* moving; we must update the file_display when the mouse */
  2023.           /* has stopped: */
  2024.           fix_display=TRUE;
  2025.           break;
  2026.  
  2027.         case CLOSEWINDOW:
  2028.           /* The user wants to quit. */
  2029.           connect_dir_file(total_file_name);
  2030.           working=FALSE;
  2031.           operation=QUIT;
  2032.           break;
  2033.  
  2034.         case GADGETDOWN:
  2035.            /* A gadget has been pressed down. */
  2036.            /* Which gadget has been clicked on? */
  2037.            
  2038.            /* DISPLAY */
  2039.            /* Is the user clicking inside the file display? */
  2040.            for(temp1=0; temp1 < 13; temp1++)
  2041.            {
  2042.              if(address == (APTR)&gadget_display[temp1])
  2043.              {
  2044.                /* The user wants to select a file/directory: */
  2045.                pick_file(temp1+position);
  2046.              }
  2047.            }
  2048.            break;
  2049.  
  2050.  
  2051.         case GADGETUP:
  2052.            /* A gadget has been released. */
  2053.            /* Which gadget has been clicked on? */
  2054.  
  2055.  
  2056.            /* LOAD */
  2057.            if(address == (APTR)&gadget_load)
  2058.            {
  2059.              if(last_check(total_file_name))
  2060.              {
  2061.                working=FALSE;
  2062.                operation=LOAD;
  2063.              }
  2064.              break;
  2065.            }
  2066.  
  2067.  
  2068.            /* SAVE */
  2069.            if(address == (APTR)&gadget_save)
  2070.            {
  2071.              if(last_check(total_file_name))
  2072.              {
  2073.                working=FALSE;
  2074.                operation=SAVE;
  2075.              }
  2076.              break;
  2077.            }
  2078.  
  2079.  
  2080.            /* DELETE */
  2081.            if(address == (APTR)&gadget_delete)
  2082.            {
  2083.              delete_file_dir(total_file_name);
  2084.              break;
  2085.            }
  2086.  
  2087.  
  2088.            /* CANCEL */
  2089.            if(address == (APTR)&gadget_cancel)
  2090.            {
  2091.              connect_dir_file(total_file_name);
  2092.              working=FALSE;
  2093.              operation=CANCEL;
  2094.              break;
  2095.            }
  2096.  
  2097.  
  2098.            /* 1A */
  2099.            if(address == (APTR)&gadget_1A)
  2100.            {
  2101.              change_device(mydev[0]);
  2102.              break;
  2103.            }
  2104.  
  2105.  
  2106.            /* 1B */
  2107.            if(address == (APTR)&gadget_1B)
  2108.            {
  2109.              change_device(mydev[1]);
  2110.              break;
  2111.            }
  2112.  
  2113.  
  2114.            /* 1C */
  2115.            if(address == (APTR)&gadget_1C)
  2116.            {
  2117.              change_device(mydev[2]);
  2118.              break;
  2119.            }
  2120.  
  2121.  
  2122.            /* 1D */
  2123.            if(address == (APTR)&gadget_1D)
  2124.            {
  2125.              change_device(mydev[3]);
  2126.              break;
  2127.            }
  2128.  
  2129.  
  2130.            /* 1E */
  2131.            if(address == (APTR)&gadget_1E)
  2132.            {
  2133.              change_device(mydev[4]);
  2134.              break;
  2135.            }
  2136.  
  2137.  
  2138.            /* 1F */
  2139.            if(address == (APTR)&gadget_1F)
  2140.            {
  2141.              change_device(mydev[5]);
  2142.              break;
  2143.            }
  2144.  
  2145.  
  2146.            /* 1G */
  2147.            if(address == (APTR)&gadget_1G)
  2148.            {
  2149.              change_device(mydev[6]);
  2150.              break;
  2151.            }
  2152.  
  2153.  
  2154.            /* 2A */
  2155.            if(address == (APTR)&gadget_2A)
  2156.            {
  2157.              change_device(mydev[7]);
  2158.              break;
  2159.            }
  2160.  
  2161.  
  2162.            /* 2B */
  2163.            if(address == (APTR)&gadget_2B)
  2164.            {
  2165.              change_device(mydev[8]);
  2166.              break;
  2167.            }
  2168.  
  2169.  
  2170.            /* 2C */
  2171.            if(address == (APTR)&gadget_2C)
  2172.            {
  2173.              change_device(mydev[9]);
  2174.              break;
  2175.            }
  2176.  
  2177.  
  2178.            /* 2D */
  2179.            if(address == (APTR)&gadget_2D)
  2180.            {
  2181.              change_device(mydev[10]);
  2182.              break;
  2183.            }
  2184.  
  2185.  
  2186.            /* 2E */
  2187.            if(address == (APTR)&gadget_2E)
  2188.            {
  2189.              change_device(mydev[11]);
  2190.              break;
  2191.            }
  2192.  
  2193.  
  2194.            /* 2F */
  2195.            if(address == (APTR)&gadget_2F)
  2196.            {
  2197.              change_device(mydev[12]);
  2198.              break;
  2199.            }
  2200.  
  2201.  
  2202.            /* 2G */
  2203.            if(address == (APTR)&gadget_2G)
  2204.            {
  2205.              change_device(mydev[13]);
  2206.              break;
  2207.            }
  2208.  
  2209.  
  2210.            /* 3A */
  2211.            if(address == (APTR)&gadget_3A)
  2212.            {
  2213.              change_device(mydev[14]);
  2214.              break;
  2215.            }
  2216.  
  2217.  
  2218.            /* 1B */
  2219.            if(address == (APTR)&gadget_1B)
  2220.            {
  2221.              change_device(mydev[15]);
  2222.              break;
  2223.            }
  2224.  
  2225.  
  2226.            /* 3C */
  2227.            if(address == (APTR)&gadget_3C)
  2228.            {
  2229.              change_device(mydev[16]);
  2230.              break;
  2231.            }
  2232.  
  2233.  
  2234.            /* 3D */
  2235.            if(address == (APTR)&gadget_3D)
  2236.            {
  2237.              change_device(mydev[17]);
  2238.              break;
  2239.            }
  2240.  
  2241.  
  2242.            /* 3E */
  2243.            if(address == (APTR)&gadget_3E)
  2244.            {
  2245.              change_device(mydev[18]);
  2246.              break;
  2247.            }
  2248.  
  2249.  
  2250.            /* 3F */
  2251.            if(address == (APTR)&gadget_3F)
  2252.            {
  2253.              change_device(mydev[19]);
  2254.              break;
  2255.            }
  2256.  
  2257.  
  2258.            /* 3G */
  2259.            if(address == (APTR)&gadget_3G)
  2260.            {
  2261.              change_device(mydev[20]);
  2262.              break;
  2263.            }
  2264.  
  2265.  
  2266.            /* DRAWER: */
  2267.            if(address == (APTR)&gadget_drawer)
  2268.            {
  2269.              /* The user has entered something new in the drawer: */
  2270.              new_drawer();
  2271.              break;
  2272.            }
  2273.  
  2274.  
  2275.            /* ToShow: */
  2276.            if(address == (APTR)&gadget_ToShow)
  2277.            {
  2278.              new_drawer();
  2279.              break;
  2280.            }
  2281.  
  2282.  
  2283.            /* ToHide: */
  2284.            if(address == (APTR)&gadget_ToHide)
  2285.            {
  2286.              new_drawer();
  2287.              break;
  2288.            }
  2289.  
  2290.  
  2291.            /* GET DIR */
  2292.            if(address == (APTR)&gadget_getdir)
  2293.            {
  2294.              new_drawer();
  2295.              break;
  2296.            }
  2297.  
  2298.  
  2299.            /* PARENT: "<" */
  2300.            if(address == (APTR)&gadget_parent)
  2301.            {
  2302.              parent();
  2303.              break;
  2304.            }
  2305.  
  2306.  
  2307.            /* PROPORTIONAL */
  2308.            if(address == (APTR)&gadget_proportional)
  2309.            {
  2310.              /* The user has released the proprtional gadget, update */
  2311.              /* the display: */
  2312.              fix_display=TRUE;
  2313.              break;
  2314.            }
  2315.       }
  2316.     }
  2317.  
  2318.  
  2319.     /* Do we need to update the file display? */
  2320.     if(fix_display)
  2321.     {
  2322.       fix_display=FALSE;
  2323.  
  2324.       /* Which file should we start to show in the display? */
  2325.       if(file_count > 13)
  2326.         position=(int)((LONG)(prop_info.VertPot)*(LONG)(file_count-13)/(LONG)0xFFFF);
  2327.       else
  2328.         position=0;
  2329.  
  2330.       /* List the files: (Starting with position) */
  2331.       display_list(position);
  2332.     }
  2333.  
  2334.  
  2335.     if(more_files)
  2336.     {
  2337.       /* Are there more files/dirtectories left to be collected? */    
  2338.       if(ExNext(lock, file_info))
  2339.       {
  2340.         /* List the file/directory if it is: */
  2341.         /* 1. A file which has the right pattern. */
  2342.         /* 2. A directory. */
  2343.  
  2344.         if(CompiledOK1 && CompiledOK2)
  2345.         {
  2346.         if((Match(ShowPat,Aux1,file_info->fib_FileName)==TRUE &&
  2347.           Match(HidePat,Aux2,file_info->fib_FileName)==FALSE) ||
  2348.           directory(file_info) )
  2349.         {
  2350.           /* Is this the first file/directory? */
  2351.           if(first_file)
  2352.           {
  2353.             /* first_pointer will point at the first file in our list: */
  2354.             first_pointer=(struct file_info *) save_file_info(file_info);
  2355.             
  2356.             if(first_pointer != NULL)
  2357.             {
  2358.               /* There are no more elements (for the moment) in our list: */ 
  2359.               first_pointer->next=NULL; 
  2360.               first_file=FALSE;
  2361.             }
  2362.             file_count=1;
  2363.             position=1;
  2364.           }
  2365.           else
  2366.           {
  2367.             /* save_file_info will return a pointer to the allocated */
  2368.             /* structure: */
  2369.             pointer=(struct file_info *) save_file_info(file_info);
  2370.             
  2371.             /* If we have been able to allocate space for the file we */
  2372.             /* put it into our list: */
  2373.             if(pointer !=NULL)
  2374.             {
  2375.               /* Put the new structure into the list: */
  2376.               put_in(first_pointer, pointer);       
  2377.               file_count++;
  2378.             }
  2379.           }
  2380.         
  2381.           /* If there are more than 13 files/directories we modify */
  2382.           /* the proportional gadget: */
  2383.           if(file_count > 13)
  2384.           {
  2385.             ModifyProp
  2386.             (
  2387.               &gadget_proportional,       /* PropGadget */
  2388.               file_window,                /* Pointer */
  2389.               NULL,                       /* Requester */
  2390.               prop_info.Flags,            /* Flags */
  2391.               0,                          /* HorizPot */
  2392.               prop_info.VertPot,          /* VertPot */
  2393.               0,                          /* HorizBody */
  2394.               (ULONG) 0xFFFF*13/file_count /* VerBody */
  2395.             );            
  2396.             position=(int)((LONG)(prop_info.VertPot)*(LONG)(file_count-13)/(LONG)0xFFFF);
  2397.           }
  2398.           else
  2399.            position=0;
  2400.  
  2401.  
  2402.           /* List all the files: */
  2403.           display_list(position);
  2404.         }}
  2405.       }
  2406.       else
  2407.       {
  2408.         /* ExNext() failed: */
  2409.         
  2410.         more_files=FALSE; /* Do not try to list any more files. */
  2411.  
  2412.         /* Check what went wrong: */
  2413.         /* If the error message is NOT "ERROR_NO_MORE_ENTRIES" something */
  2414.         /* went terrible wrong while reading: */
  2415.         if(IoErr() != ERROR_NO_MORE_ENTRIES)
  2416.         {
  2417.           request_ok("ERROR reading file/directory!");
  2418.         }
  2419.       }
  2420.     }
  2421.   } while(working);
  2422.  
  2423.   /* Clean up and leave: */
  2424.  
  2425.  
  2426.   /* This will clear the IDCMP port: */
  2427.   while( (my_gadget_message = (struct IntuiMessage *)
  2428.            GetMsg(file_window->UserPort)) )
  2429.   {
  2430.     ReplyMsg((struct Message *)my_gadget_message);
  2431.   }
  2432.  
  2433.  
  2434.   /* Deallocate the memory we have dynamically allocated: */ 
  2435.   deallocate_file_info();
  2436.  
  2437.  
  2438.   /* If we have "locked" a file/directory, "unlock" it: */
  2439.   if(file_lock)
  2440.   {
  2441.     UnLock(lock);
  2442.     file_lock=FALSE;
  2443.   }
  2444.   
  2445.   
  2446.   /* Deallocate FileInfoBlock: */
  2447.   if(file_info) FreeMem(file_info, sizeof(struct FileInfoBlock));
  2448.  
  2449.  
  2450.   /* If we have successfully opened the file_window, we close it: */
  2451.   if(file_window)
  2452.     CloseWindow(file_window);
  2453.   
  2454.   /* Leave with a message: */
  2455.   return(operation);
  2456. }
  2457.  
  2458.  
  2459.  
  2460. /* ============= Deallocate the memory we have dynamically allocated: == */ 
  2461.  
  2462. void deallocate_file_info()
  2463. {
  2464.   struct file_info *pointer, *temp_pointer;
  2465.  
  2466.   /* Does the first pointer point to an allocated structure? */   
  2467.   if(first_pointer)
  2468.   {
  2469.     /* Save the address of the next structure: */
  2470.     pointer=first_pointer->next;
  2471.     
  2472.     /* Deallocate the first structure: */
  2473.     FreeMem( first_pointer, sizeof(struct file_info));
  2474.  
  2475.     /* As long as pointer points to an allocated structure: */
  2476.     while(pointer)
  2477.     {
  2478.       /* Save the address of the next structure: */    
  2479.       temp_pointer=pointer->next;
  2480.       
  2481.       FreeMem( pointer, sizeof(struct file_info));
  2482.       pointer=temp_pointer;
  2483.     }
  2484.   }
  2485.   
  2486.   /* Clear first_pointer: */
  2487.   first_pointer=NULL;
  2488.  
  2489.   /* Next time we try to list the files, we start with the first_file: */
  2490.   first_file=TRUE;
  2491. }
  2492.  
  2493.  
  2494. /* =================================================================== */
  2495. /* Allocate memory for the new file/directory, and fills the structure */
  2496. /* with information. (name of the object, and if it is a directory.)   */
  2497. /* Returns a memory pointer to the allocated structure, or NULL.       */
  2498.  
  2499. APTR save_file_info(info)
  2500. struct FileInfoBlock *info;
  2501. {
  2502.   struct file_info *pointer;
  2503.  
  2504.   if((pointer=(struct file_info *)
  2505.     AllocMem(sizeof(struct file_info), MEMF_PUBLIC|MEMF_CLEAR))==NULL)
  2506.   {
  2507.     /* We could NOT allocate memory for the structure! */
  2508.     request_ok("NOT enough memory!"); /* Inform the user. */
  2509.     more_files=FALSE; /* Do not list any more files/directories. */
  2510.     return(NULL);
  2511.   }
  2512.   else
  2513.   {
  2514.     /* If the file/directory name is not too long, we copy it into the */
  2515.     /* new stucture: */
  2516.     if(strlen(info->fib_FileName) < 28)
  2517.       strcpy(pointer->name, info->fib_FileName);
  2518.     else
  2519.     {
  2520.       /* The file/directory name is too long! */
  2521.       /* Inform the user: */
  2522.       
  2523.       if( directory(info))
  2524.         request_ok("Directory name too long!"); /* It is a directory. */
  2525.       else    
  2526.         request_ok("File name too long!"); /* It is a file. */
  2527.  
  2528.       /* Deallocate the structure: */
  2529.       FreeMem( pointer, sizeof(struct file_info));
  2530.       return(NULL);
  2531.     }
  2532.  
  2533.     /* Is it a file or a directory? */
  2534.     if( directory(info))
  2535.       pointer->directory=TRUE; /* It is a directory. */
  2536.     else    
  2537.       pointer->directory=FALSE; /* It is a file. */
  2538.   }
  2539.   
  2540.   /* Return the address of the allocated structure: */
  2541.   return( (APTR) pointer);
  2542. }
  2543.  
  2544.  
  2545. /* ========================================================== */
  2546. /* Will check a FileInfoBlock if it is a file or a directory. */
  2547. /* Return TRUE if it is a directory, FALSE if it is a file.   */
  2548.  
  2549. BOOL directory(info)
  2550. struct FileInfoBlock *info;
  2551. {
  2552.   if(info->fib_DirEntryType < 0)
  2553.     return(FALSE);
  2554.   else
  2555.     return(TRUE);
  2556. }
  2557.  
  2558.  
  2559. /* ================================================================ */
  2560. /* Put the new structure into the dynamically allocated list at the */
  2561. /* right place (sorted alphabetically, directories first):          */
  2562.  
  2563. void put_in(a_pointer, pointer)
  2564. struct file_info *a_pointer, *pointer;
  2565. {
  2566.   struct file_info *old_pointer=NULL;
  2567.  
  2568.   /* Move slowly down the list and try to fit in the structure: */
  2569.   while( a_pointer && file_comp(a_pointer->name, pointer->name) )
  2570.   {
  2571.     old_pointer=a_pointer;
  2572.     a_pointer=a_pointer->next;
  2573.   }
  2574.  
  2575.   if(a_pointer)
  2576.   {
  2577.     if(old_pointer)
  2578.     {
  2579.       /* Put the structure into the list: */
  2580.       pointer->next=old_pointer->next;
  2581.       old_pointer->next=pointer;
  2582.     }
  2583.     else
  2584.     {
  2585.       /* First in the list! */
  2586.       pointer->next=first_pointer;
  2587.       first_pointer=pointer;
  2588.     }
  2589.   }
  2590.   else
  2591.   {
  2592.     /* Last int the list: */
  2593.     old_pointer->next=pointer;
  2594.     pointer->next=NULL;
  2595.   }
  2596. }
  2597.  
  2598.  
  2599. /* =============================================================== */
  2600. /* This function will return TRUE if the first pointer (a_pointer) */
  2601. /* points to a file structure which should come before the second  */
  2602. /* pointers file structure.                                        */
  2603. /* ORDER: */
  2604. /* 1. DIRECTORIES sorted alphabetically. */
  2605. /* 2. FILES       sorted alphabetically. */
  2606.  
  2607. BOOL file_comp(a_pointer, pointer)
  2608. struct file_info *a_pointer, *pointer;
  2609. {
  2610.   if(a_pointer->directory == FALSE && pointer->directory)
  2611.     return(FALSE);
  2612.     
  2613.   if(a_pointer->directory == pointer->directory)
  2614.   {
  2615.     if(stricmp(a_pointer->name, pointer->name) <= 0 )
  2616.       return(TRUE);
  2617.     else
  2618.       return(FALSE);
  2619.   } 
  2620.   return(TRUE);
  2621. }
  2622.  
  2623.  
  2624. /* ================================================================= */
  2625. /* Give this function a string and a character, and it will return a */
  2626. /* pointer to the right most occurance character in you string which */
  2627. /* match your character.                                             */
  2628.  
  2629. STRPTR right_pos(string, sign)
  2630. STRPTR string;
  2631. char sign;
  2632. {
  2633.   STRPTR start_pos;
  2634.   
  2635.   start_pos=string;
  2636.   
  2637.   /* Go to the end: */
  2638.   while(*string != '\0')
  2639.     string++;
  2640.  
  2641.   /* Start to go backwards and check the string: */
  2642.   while(*string != sign && string > start_pos)
  2643.     string--;
  2644.     
  2645.   if(*string==sign)
  2646.     return(string); /* We have found a matching character. */
  2647.  
  2648.   return(NULL); /* We could not find a matching character. */
  2649. }
  2650.  
  2651.  
  2652. /* ============================================================ */
  2653. /* This function will change to a new device, for example df0:. */
  2654. /* Does not return anything.                                    */
  2655.  
  2656. void change_device(device)
  2657. STRPTR device;
  2658. {
  2659.   strcpy(drawer_name, device); /* Change the drawer string. */
  2660.  
  2661.   adjust_string_gadgets(); /* Adjust the string gadgets. */
  2662.  
  2663.   new_drawer(); /* Start to show us the new files/directories */
  2664. }
  2665.  
  2666.  
  2667. /* ===================================================================== */
  2668. /* When the user or the program has changed the drawer string, this      */
  2669. /* function is called, and will do what is necessary to start to collect */
  2670. /* the new files/directories from the disk.                              */
  2671. /* Returns TRUE if everything is OK, and FALSE if something went wrong.  */
  2672.  
  2673. BOOL new_drawer()
  2674. {
  2675.   STRPTR string_pointer;
  2676.  
  2677.   /* Compile Patterns: */
  2678.   if(ToShow_name[0]=='\0') strcpy(ShowPat,"/");
  2679.   else strcpy(ShowPat, ToShow_name);
  2680.   if(ToHide_name[0]=='\0') strcpy(HidePat,"/");
  2681.   else strcpy(HidePat, ToHide_name);
  2682.   CompiledOK1=CmplPat(ShowPat,Aux1);
  2683.   CompiledOK2=CmplPat(HidePat,Aux2);
  2684.  
  2685.   /* Unlock: */
  2686.   if(file_lock)
  2687.   {
  2688.     UnLock(lock);
  2689.     file_lock=FALSE;
  2690.   }
  2691.  
  2692.   /* Deallocate the memory we have dynamically allocated: */ 
  2693.   deallocate_file_info();
  2694.  
  2695.   /* Change the proportianal gadget: */
  2696.   ModifyProp
  2697.   (
  2698.     &gadget_proportional, /* PropGadget */
  2699.     file_window,          /* Pointer */
  2700.     NULL,                 /* Requester */
  2701.     prop_info.Flags,      /* Flags */
  2702.     0,                    /* HorizPot */
  2703.     0,                    /* VertPot */
  2704.     0,                    /* HorizBody */
  2705.     (ULONG) 0xFFFF        /* VerBody */
  2706.   );
  2707.  
  2708.   /* Clear the display: */
  2709.   display_list(0);
  2710.  
  2711.   more_files=FALSE;
  2712.  
  2713.   /* Try to "lock" the file/directory: */
  2714.   if((lock=Lock(drawer_name, ACCESS_READ))==NULL)
  2715.   {
  2716.     /* We could NOT lock the file/directory/device! */
  2717.     /* Inform the user: */
  2718.     string_pointer=drawer_name+strlen(drawer_name)-1;
  2719.     if(*string_pointer==':')
  2720.       request_ok("Device NOT found!");
  2721.     else
  2722.       request_ok("Device/Directory NOT found!");
  2723.  
  2724.     return(FALSE); /* ERROR */
  2725.   }
  2726.   else
  2727.   {
  2728.     /* We "locked" the file/directory! */
  2729.     file_lock=TRUE;
  2730.   }
  2731.  
  2732.   /* Now try to get some information from the file/directory: */
  2733.   if((Examine(lock, file_info))==NULL)
  2734.   {
  2735.     /* We could NOT examine the file/directory! */
  2736.  
  2737.     request_ok("ERROR reading file/directory!"); /* Inform the user. */
  2738.  
  2739.     return(FALSE); /* ERROR */
  2740.   }
  2741.  
  2742.   /* Is it a directory or a file? */
  2743.   if(directory(file_info))
  2744.   {
  2745.     /* It is a directory! */
  2746.  
  2747.     /* Since it is a directory, we will look for more files: */
  2748.     more_files=TRUE;
  2749.   }
  2750.   else
  2751.   {
  2752.     /* It is a file! */
  2753.     request_ok("NOT a valid directory name!"); /* Inform the user. */
  2754.     return(FALSE);
  2755.   }  
  2756.   return(TRUE);
  2757. }
  2758.  
  2759.  
  2760. /* ============================================================== */
  2761. /* The function parent() will try to go backwards one step in the */
  2762. /* directory path.                                                */
  2763. /* Does not return anything.                                      */
  2764.  
  2765. void parent()
  2766. {
  2767.   STRPTR string_pointer;
  2768.  
  2769.   /* Separate the last directory from the path: */
  2770.   if(string_pointer=right_pos(drawer_name, '/'))
  2771.   {
  2772.     /* Take away the last directory: */
  2773.     *string_pointer='\0';
  2774.   }
  2775.   else
  2776.   {
  2777.     if(string_pointer=right_pos(drawer_name, ':'))
  2778.     {
  2779.       /* Take away the last directory: */
  2780.       /* Only the device ("df0:" for example) left: */
  2781.       *(string_pointer+1)='\0';
  2782.     }
  2783.     else
  2784.     {
  2785.       /* Strange drawer_name, clear it: */
  2786.       *drawer_name='\0';
  2787.     }
  2788.   }
  2789.  
  2790.   /* Since we have messed around with the string gadgets, adjust them: */
  2791.   adjust_string_gadgets();
  2792.   
  2793.   /* Start to show the user the files etc in the new directory: */
  2794.   new_drawer();
  2795. }
  2796.  
  2797.  
  2798. /* ===================================================================== */
  2799. /* You give this function a pointer to an error string, and it will open */
  2800. /* a simple requester displaying the message. The requester will go away */
  2801. /* first when the user has selected the button "OK".                     */
  2802. /* Does not return anything.                                             */
  2803.  
  2804. void request_ok(message)
  2805. STRPTR message;
  2806. {
  2807.   text_request.IText=message;
  2808.   
  2809.   AutoRequest
  2810.   (
  2811.     file_window,   /* Window */
  2812.     &text_request, /* BodyText */
  2813.     NULL,          /* PositiveText nothing */
  2814.     &ok_request,   /* NegativeText OK */
  2815.     NULL,          /* PositiveFlags */
  2816.     NULL,          /* NegativeFlags */
  2817.     320,           /* Width */
  2818.     72             /* Height */
  2819.   );
  2820. }
  2821.  
  2822.  
  2823. /* ====================================================================== */
  2824. /* This function will also open a simple requester, but will instead      */
  2825. /* ask the user to make a choice between option1 or option2               */
  2826. /* If the user selects option1 the function returns TRUE, else it returns */
  2827. /* FALSE.                                                                 */
  2828.  
  2829. BOOL request_ask(message, option1, option2)
  2830. STRPTR message, option1, option2;
  2831. {
  2832.   text_request.IText=message;
  2833.   option1_request.IText=option1;
  2834.   option2_request.IText=option2;
  2835.   
  2836.   
  2837.   return( (BOOL) AutoRequest
  2838.   (
  2839.     file_window,       /* Window */
  2840.     &text_request,     /* BodyText */
  2841.     &option1_request,  /* PositiveText, TRUE */
  2842.     &option2_request,  /* NegativeText, FALSE */
  2843.     NULL,              /* PositiveFlags */
  2844.     NULL,              /* NegativeFlags */
  2845.     320,               /* Width */
  2846.     72                 /* Height */
  2847.   ));
  2848. }
  2849.  
  2850.  
  2851. /* ============================================================= */
  2852. /* This function will display the files etc which are inside the */
  2853. /* directory, starting with the file number start_pos.           */
  2854. /* Does not return anything.                                     */
  2855.  
  2856. void display_list(start_pos)
  2857. int start_pos;
  2858. {
  2859.   struct file_info *pointer;
  2860.   int pos, temp1;
  2861.                   /* 123456789012345678901234567890123 */
  2862.   char empty_name[]="                                 ";
  2863.   STRPTR string_pointer;
  2864.   BOOL clear;
  2865.   
  2866.   pos=0;
  2867.   
  2868.   /* Does it exist any files at all? */
  2869.   if(first_pointer)
  2870.   {
  2871.     pointer=first_pointer;
  2872.  
  2873.     /* Go through the list until you have found the file/directory */
  2874.     /* which should be shown first:                                */
  2875.     while(pointer && pos < start_pos)
  2876.     {
  2877.       pos++;
  2878.       pointer=pointer->next;
  2879.     }
  2880.     
  2881.     /* Try to show the eight files: */
  2882.     pos=0;
  2883.     while(pointer && pos < 13)
  2884.     {
  2885.       strcpy(display_text[pos], pointer->name);
  2886.       
  2887.       clear=FALSE;
  2888.       temp1=0;
  2889.       string_pointer=display_text[pos];
  2890.  
  2891.       if(pointer->directory)
  2892.       {
  2893.         /* It is a directory: */
  2894.         text_list[pos].FrontPen=3; /* Highlight it. */
  2895.  
  2896.         /* Clear everything after the name, and add the string "(Dir)". */
  2897.         while(temp1 < 28)
  2898.         {
  2899.           if(*string_pointer=='\0')
  2900.             clear=TRUE;
  2901.           if(clear)
  2902.             *string_pointer=' ';
  2903.           string_pointer++;
  2904.           temp1++;
  2905.         }
  2906.         *string_pointer='\0';
  2907.         strcat(display_text[pos], "(Dir)");
  2908.       }
  2909.       else
  2910.       {
  2911.         /* It is a file: */
  2912.         text_list[pos].FrontPen=1; /* Normal colour. */
  2913.  
  2914.         /* Clear everything after the name: */
  2915.         while(temp1 < 33)
  2916.         {
  2917.           if(*string_pointer=='\0')
  2918.             clear=TRUE;
  2919.           if(clear)
  2920.             *string_pointer=' ';
  2921.           string_pointer++;
  2922.           temp1++;
  2923.         }
  2924.         *string_pointer='\0';
  2925.       }      
  2926.       pos++;
  2927.       pointer=pointer->next; /* Next. */
  2928.     }
  2929.   }
  2930.  
  2931.   /* If there are less than eight files, show clear the rest of the */
  2932.   /* display: */
  2933.   while(pos < 13)
  2934.   {
  2935.     strcpy(display_text[pos], empty_name);
  2936.     pos++;
  2937.   }
  2938.   
  2939.   /* Show the user the new display: */
  2940.   PrintIText(file_window->RPort, text_list, 13+3, 53+1);
  2941. }
  2942.  
  2943.  
  2944. /* =================================================================== */
  2945. /* The user has selected a file or a directory. If it is a file put it */
  2946. /* into the file string, otherwise put it into the drawer string.      */
  2947. /* Returns TRUE if everything went OK, FALSE if there was a problem.   */
  2948.  
  2949. BOOL pick_file(file_pos)
  2950. int file_pos;
  2951. {
  2952.   struct file_info *pointer=NULL;
  2953.   STRPTR string_pointer;
  2954.   int pos=0;
  2955.   
  2956.   /* Go through the allocated list untill we find the file/directory: */
  2957.   if(first_pointer)
  2958.   {
  2959.     pointer=first_pointer;
  2960.     
  2961.     while(pointer && pos < file_pos)
  2962.     {
  2963.       pos++;
  2964.       pointer=pointer->next;
  2965.     }
  2966.   }
  2967.  
  2968.   /* Have we found the file/directory? */
  2969.   if(pointer)
  2970.   {
  2971.     if(pointer->directory)
  2972.     {
  2973.       /* It is a directory! */
  2974.       
  2975.       /* Is the drawer_name string long enough? */
  2976.       /* (+2: 1 for the NULL ('\0') character, 1 for the '\' character) */
  2977.       if((strlen(pointer->name)+strlen(drawer_name)+2) <= DRAWER_LENGTH)
  2978.       {
  2979.         /* YES!, there is enough room for it. */
  2980.         string_pointer=drawer_name+strlen(drawer_name)-1;
  2981.         if(*string_pointer==':'  || *string_pointer=='\0' )
  2982.           strcat(drawer_name, pointer->name);
  2983.         else
  2984.         {
  2985.           /* We need to add a '/' before we can add the directory. */
  2986.           strcat(drawer_name, "/");
  2987.           strcat(drawer_name, pointer->name);
  2988.         }
  2989.         
  2990.         /* Adjust the string gadgets: */
  2991.         adjust_string_gadgets();
  2992.       }
  2993.       else
  2994.       {
  2995.         /* The drawer_name is NOT big enough! */
  2996.         request_ok("Too long drawer string"); /* Inform the user. */
  2997.         return(FALSE); /* ERROR */
  2998.       }
  2999.       new_drawer();
  3000.       return(TRUE); /* OK */
  3001.     }
  3002.     else
  3003.     {
  3004.       /* It is a File! */
  3005.       /* Is the file_name string long enough? */
  3006.       /* (+1 for the NULL ('\0') character.) */
  3007.       if((strlen(pointer->name)+1) <= FILE_LENGTH)
  3008.       {
  3009.         strcpy(file_name, pointer->name);
  3010.         adjust_string_gadgets();
  3011.       }
  3012.       else
  3013.       {
  3014.         /* The file_name is NOT big enough! */
  3015.         request_ok("File name too long!"); /* Inform the user. */
  3016.         return(FALSE); /* ERROR */
  3017.       }
  3018.       return(TRUE); /* OK */
  3019.     }
  3020.   }
  3021. }
  3022.  
  3023.  
  3024. /* ========================================== */
  3025. /* Adjust the string gadgets, so the user can */
  3026. /* at least see the last 28/22 characters.    */
  3027. /* Does not return anything.                  */
  3028. void adjust_string_gadgets()
  3029. {
  3030.   int length;
  3031.  
  3032.   length=strlen(file_name);        
  3033.  
  3034.   if(length > 28)
  3035.     string_file.DispPos=length-28;
  3036.   else
  3037.     string_file.DispPos=0;
  3038.  
  3039.   string_file.BufferPos=string_file.DispPos;
  3040.   
  3041.  
  3042.   length=strlen(drawer_name);        
  3043.  
  3044.   if(length > 22)
  3045.     string_drawer.DispPos=length-22;
  3046.   else
  3047.     string_drawer.DispPos=0;
  3048.  
  3049.   string_drawer.BufferPos=string_drawer.DispPos;
  3050.  
  3051.   /* Display the changes. */
  3052.   RefreshGadgets(&gadget_file, file_window, NULL);
  3053. }
  3054.  
  3055.  
  3056. /* ========= Returns TRUE if there exist a file name, otherwise FALSE. == */
  3057.  
  3058. BOOL last_check(name)
  3059. STRPTR name;
  3060. {
  3061.   if(*file_name == '\0')
  3062.   {
  3063.     /* No file name! */
  3064.     request_ok("NO filename selected!"); /* Inform the user. */
  3065.     return(FALSE);
  3066.   }
  3067.   else
  3068.   {
  3069.     /* Change the total_file_name. Drawer + File. */
  3070.     connect_dir_file(name);
  3071.   }
  3072.   return(TRUE);
  3073. }
  3074.  
  3075.  
  3076.  
  3077. /* ============== Connect the drawer string with the file string. ======= */
  3078. /* Does not return anything.                                              */
  3079.  
  3080. void connect_dir_file(name)
  3081. STRPTR name;
  3082. {
  3083.   STRPTR string_pointer;
  3084.  
  3085.   strcpy(name, drawer_name); /* Copy the drawer string into name. */
  3086.  
  3087.   /* Does it exist a file name? */
  3088.   if(*file_name != '\0')
  3089.   {
  3090.     /* Yes! */
  3091.     string_pointer=drawer_name+strlen(drawer_name)-1;
  3092.     if(*string_pointer==':'  || *string_pointer=='\0' )
  3093.     {
  3094.       strcat(name, file_name); /* Add the file name. */
  3095.     }
  3096.     else
  3097.     {
  3098.       strcat(name, "/"); /* Add a '\'. */
  3099.       strcat(name, file_name); /* Add the file name. */
  3100.     }
  3101.   }
  3102. }
  3103.  
  3104.  
  3105. /* ========================= */
  3106. /* Does not return anything. */
  3107.  
  3108. void delete_file_dir(total_file_name)
  3109. STRPTR total_file_name;
  3110. {
  3111.   BOOL delete_it;
  3112.  
  3113.   /* Presume the user do not want to deleta the file/dir: */
  3114.   delete_it=FALSE;
  3115.   
  3116.   if(*file_name == '\0' && *drawer_name != '\0')
  3117.   {
  3118.     /* There is no filename string, but there is something */
  3119.     /* in the drawer string. The user wants to delete a */
  3120.     /* directory: */
  3121.                  
  3122.     /* Is it a device or a directory? */
  3123.     if( *(drawer_name+strlen(drawer_name)-1) ==':')
  3124.     {
  3125.       /* The user wants to delete a device: */
  3126.       /* Not a very good idea! */
  3127.       request_ok("You can NOT delete a device!");
  3128.     }
  3129.     else
  3130.     {
  3131.       /* The user wants to delete a directory: */
  3132.                    
  3133.       /* However, it is important to check that the user */
  3134.       /* realy wants to delete it:                       */
  3135.       delete_it=request_ask("OK to delete directory?","DELETE","CANCEL");
  3136.                    
  3137.       if(delete_it)
  3138.       {
  3139.         /* YES! The user wanted to delete the directory.  */
  3140.         /* Before we try to delete it we must "unlock" it */
  3141.         if(file_lock)
  3142.         {
  3143.           UnLock(lock);
  3144.           file_lock=FALSE;
  3145.         }
  3146.       }
  3147.     }
  3148.   }
  3149.   else
  3150.   {
  3151.     if(*file_name != '\0')
  3152.     {
  3153.       /* There is something in the file_name string. The user */
  3154.       /* wants to delete a file: */
  3155.       
  3156.       /* We will here again give the user a last chance to */
  3157.       /* make up his/her mind: */
  3158.       delete_it=request_ask("OK to delete file?","DELETE","CANCEL");
  3159.     }
  3160.     else
  3161.     {
  3162.       /* Nothing in the drawer string, nor in the file string. */
  3163.       /* The user wants to delete something, but has NOT       */
  3164.       /* declared which file/directory he/she wants to delete: */
  3165.       request_ok("NO file/directory selected!");
  3166.     }
  3167.   }
  3168.   
  3169.   /* Should we delete the file/directory? */
  3170.   if(delete_it)
  3171.   {
  3172.     /* Yes! */
  3173.     
  3174.     /* Put the drawer name together with the file name: */
  3175.     connect_dir_file(total_file_name);
  3176.     
  3177.     /* We try to delete the file/directory: */
  3178.     if(DeleteFile(total_file_name))
  3179.     {
  3180.       /* We have deleted the file/directory successfully: */
  3181.               if(*file_name != '\0')
  3182.       {
  3183.         /* A file was deleted: */
  3184.         *file_name='\0'; /* Take away the file name. */
  3185.         adjust_string_gadgets(); /* Adjust the string gadgets. */
  3186.         new_drawer(); /* Show the user the remaining files. */
  3187.       }
  3188.       else
  3189.       {
  3190.         /* A directory was deleted: */
  3191.         parent(); /* Go back one directory. */  
  3192.       }
  3193.     }
  3194.     else
  3195.     {
  3196.       /* Something went wrong: */
  3197.       if(*file_name != '\0')
  3198.         request_ok("Could NOT delete the file!");
  3199.       else
  3200.         request_ok("Could NOT delete directory!");
  3201.       
  3202.       /* Since we have unlocked the directory/file we have */
  3203.       /* to lock it again, and clean up the display: */
  3204.       new_drawer();
  3205.     }
  3206.   }
  3207. }
  3208.  
  3209.  
  3210. /* ==================== DRAW A 3D GADGET ======================= */
  3211.  
  3212. void __regargs Draw3D(struct RastPort *rp,ULONG x,ULONG y,ULONG w,ULONG h,BOOL cl,BOOL posneg)
  3213. {
  3214.   h--;
  3215.   w--;
  3216.  
  3217.   if(cl)
  3218.   {
  3219.     SetAPen(rp,0);
  3220.     RectFill(rp,x+2,y+1,x+w-2,y+h-1);
  3221.   }
  3222.  
  3223.   if(posneg==POS) SetAPen(rp,2);
  3224.   else SetAPen(rp,1);
  3225.   Move(rp,x+w,y);
  3226.   Draw(rp,x,y);
  3227.   Draw(rp,x,y+h);
  3228.   Move(rp,x+1,y);
  3229.   Draw(rp,x+1,y+h-1);
  3230.  
  3231.   if(posneg==POS) SetAPen(rp,1);
  3232.   else SetAPen(rp,2);
  3233.   Move(rp,x+1,y+h);
  3234.   Draw(rp,x+w,y+h);
  3235.   Draw(rp,x+w,y);
  3236.   Move(rp,x+w-1,y+h);
  3237.   Draw(rp,x+w-1,y+1);
  3238. }
  3239.  
  3240.  
  3241. /* THE END */
  3242.