home *** CD-ROM | disk | FTP | other *** search
- /* \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
-
- WizardFiler v1.00
- -----------------
-
- [ Enhanced version of FileWindow v1.20 by Anders Bjerin ]
-
-
- HOW TO USE IT:
- --------------
-
- operation=WizardFiler( title, ToShow, ToHide, x, y, screen, file );
-
- operation: a variable which will contain the "flags" WizardFiler returned.
- title: string containing the name of the WizardFiler window.
- ToShow: string to be used as a file pattern.
- ToHide: string to be used as a file pattern.
- x: x position of the WizardFiler window.
- y: y position of the WizardFiler window.
- screen: pointer to a screen if there exists one.
- file: a string which will contain the file name together with
- the entire path. (For example: "df0:letters/payments.doc")
-
-
- Title is a string which will appear on the drag gadget. Write NULL if
- you do not want any string there.
-
- ToShow is a 100 character long string. 99 letters and the NULL ('\0')
- sign. If you give WizardFiler a string, the program will only display
- the files which endings match with your string. (Directories will always
- be displayed.) If you do not want to use a file pattern you simply
- write NULL.
-
- It's the same with ToHide, except that the files matching this pattern
- will NOT be shown.
-
- On a NTSC screen (200 lines) y can be between 0 and 15. On a PAL screen
- (256 lines) between 0 and 71.
-
- If your program is using a CUSTOM SCREEN you should give WizardFiler a
- pointer to your screen. Otherwise, if you are using a WBENCH SCREEN you
- simply write NULL.
-
- Name is a string which can already contain a file name with path if
- you want. If the string is empty, WizardFiler will start to display the
- current directory. When the user has selected the file to LOAD or SAVE it
- is here you should look for the file name with path.
-
- For example:
-
- 1. operation=WizardFiler( NULL, NULL, NULL, 0, 0, NULL, file);
-
- operation has been declared as: USHORT operation;
- file has been declared as : UBYTE file[TOTAL_LENGTH];
-
-
- 2. operation=WizardFiler(title, toshow, tohide , x, y, my_screen, file);
-
- operation has been declared as: USHORT operation;
- title -"- : UBYTE title[ANY_LENGTH];
- toshow -"- : UBYTE toshow[100];
- tohide -"- : UBYTE tohide[100];
- x, y -"- : SHORT x, y;
- my_screen -"- : struct Screen *my_screen;
- file -"- : UBYTE file[TOTAL_LENGTH];
-
-
- Remember to "include" the file "WizardFiler.h"!
- ex: #include "WizardFiler.h"
-
- Program: WizardFiler
- Version: 1.00
- Authors: Stefan Zeiger (WizardFiler)
- Anders Bjerin (Original "FileWindow")
- Language: C (100%)
- Compiler: SAS/C (Lattice-C) C Compiler, V5.10
- Linker: Blink, V5.10
- AmigaDOS: Tested with 1.3
-
-
- Amiga is a registered trademark of Commodore-Amiga Inc.
- AmigaDOS is a registered trademark of Commodore-Amiga Inc.
- Lattice is a registered trademark of Lattice Inc.
- SAS/C is a registrated trademark of SAS Institute Inc.
-
- \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
-
- This file requester is public domain. Enjoy it and use it in all of your
- programs.
- Be C'ing you,
- Stefan
-
- \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
-
- Stefan Zeiger VOICE: (49)-6188-2525
- Seligenstaedter Weg 24
- D-W-8756 Kahl
- West Germany
-
- \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ */
-
-
- #include <exec/types.h>
- #include <exec/nodes.h>
- #include <exec/lists.h>
- #include <exec/libraries.h>
- #include <exec/ports.h>
- #include <exec/interrupts.h>
- #include <exec/io.h>
- #include <exec/memory.h>
- #include <libraries/dos.h>
- #include <libraries/dosextens.h>
- #include <intuition/intuition.h>
- #include <string.h>
- #include <stdio.h>
- #include <ctype.h>
-
- #include "WizardFiler.h"
-
-
- #define UP 59
-
- #define POS TRUE
- #define NEG FALSE
-
-
- /* ********************************************************************* */
- /* * Get device list * */
- /* ********************************************************************* */
-
- #ifndef toAPTR
- #define toAPTR(b) ((b)<<2)
- #endif
- #ifndef toBPTR
- #define toBPTR(a) ((a)>>2)
- #endif
-
- struct DeviceList *list;
-
- void OpenDevList(void)
- {
- extern struct DosLibrary *DOSBase;
- struct RootNode *root;
- struct DosInfo *info;
- root=(struct RootNode *)DOSBase->dl_Root;
- info=(struct DosInfo *)(toAPTR(root->rn_Info));
- list=(struct DeviceList *)(toAPTR(info->di_DevInfo));
- }
-
- BOOL ReadDevList(name,criterion)
- char name[32];
- UWORD criterion;
- {
- struct DeviceList *next;
- char *ptr;
- int count;
- while(list)
- {
- next=(struct DeviceList *)(toAPTR(list->dl_Next));
- if(list->dl_Type==criterion)
- {
- ptr=(char *)(toAPTR((BPTR)list->dl_Name));
- count=*ptr++;
- if(count>30)
- count=30;
- strncpy(name,ptr,count);
- name[count++]=':';
- name[count]=0;
- list=next;
- return(TRUE);
- }
- list=next;
- }
- return(FALSE);
- }
-
-
- /* Pattern matching main program variables */
- WORD Aux1[128];
- int CompiledOK1;
- WORD Aux2[128];
- int CompiledOK2;
- char ShowPat[100];
- char HidePat[100];
-
-
- /* Device names */
-
- char mydev[21][32];
- char mydevname[21][5];
-
-
- /* Declare the functions we are going to use: */
- USHORT FileWindow();
- STRPTR right_pos();
- APTR save_file_info();
- BOOL file_comp();
- BOOL directory();
- BOOL last_check();
- BOOL new_drawer();
- BOOL pick_file();
- BOOL request_ask();
- void put_in();
- void deallocate_file_info();
- void change_device();
- void parent();
- void request_ok();
- void display_list();
- void connect_dir_file();
- void adjust_string_gadgets();
- void delete_file_dir();
- void __regargs Draw3D(struct RastPort *,ULONG,ULONG,ULONG,ULONG,BOOL,BOOL);
-
-
- extern struct IntuitionBase *IntuitionBase;
-
- struct Window *file_window;
- struct IntuiMessage *my_gadget_message;
-
-
- /* We will allocate memory, using this structure, for every file/ */
- /* directory we find. They will be linked to each otherer, in such a */
- /* way that all directories will come first (sorted alphabetically), */
- /* and after them will the files come (also sorted alphabetically). */
- struct file_info
- {
- BYTE name[28]; /* Name of the file/directory, 27 characters. */
- BOOL directory; /* If it is a directory. */
- struct file_info *next; /* Pointer to the next file_info structure. */
- };
-
-
- struct FileInfoBlock *file_info;
- struct FileLock *lock, *Lock();
-
-
- BOOL file_lock; /* Have we locked a file? */
- BOOL more_files; /* More files in the directory? */
- BOOL first_file; /* First file? */
-
-
- struct file_info *first_pointer; /* Pointing to the first structure. */
-
-
- /* The program will use a ROM-font, 80 characters wide (40 LOWRES). */
- /* This is to make sure that all the text will fit in nicely in the */
- /* window, even if the calling program is using another font. */
- struct TextAttr my_font=
- {
- "topaz.font", /* Font Name */
- TOPAZ_EIGHTY, /* Font Height */
- FS_NORMAL, /* Style */
- FPF_ROMFONT /* Preferences */
- };
-
-
- /* ********************************************************************* */
- /* * IntuiText structures for the requesters * */
- /* ********************************************************************* */
-
- struct IntuiText text_request=
- {
- 0, 2, /* FrontPen, BackPen */
- JAM1, /* DrawMode */
- 15, 5, /* LewftEdge, TopEdge */
- &my_font, /* *ITextFont */
- NULL, /* *IText */
- NULL /* *NextText */
- };
-
- struct IntuiText ok_request=
- {
- 0, 2, /* FrontPen, BackPen */
- JAM1, /* DrawMode */
- 6, 3, /* LewftEdge, TopEdge */
- &my_font, /* *ITextFont */
- "OK", /* *IText */
- NULL /* *NextText */
- };
-
- struct IntuiText option1_request=
- {
- 0, 2, /* FrontPen, BackPen */
- JAM1, /* DrawMode */
- 6, 3, /* LewftEdge, TopEdge */
- &my_font, /* *ITextFont */
- NULL, /* *IText */
- NULL /* *NextText */
- };
-
- struct IntuiText option2_request=
- {
- 0, 2, /* FrontPen, BackPen */
- JAM1, /* DrawMode */
- 6, 3, /* LewftEdge, TopEdge */
- &my_font, /* *ITextFont */
- NULL, /* *IText */
- NULL /* *NextText */
- };
-
-
- /* Values for a 6-letter box: */
- SHORT points6[]=
- {
- 0, 0,
- 60, 0,
- 60, 14,
- 0, 14,
- 0, 0
- };
-
- /* A border for a 6-letter box: */
- struct Border border_text6=
- {
- 0, 0, /* LeftEdge, TopEdge */
- 1, 2, JAM1, /* FrontPen, BackPen, DrawMode */
- 5, /* Count */
- points6, /* *XY */
- NULL /* *NextBorder */
- };
-
-
- /* ********************************************************************* */
- /* * Information for the proportional gadget * */
- /* ********************************************************************* */
-
- /* Since we are using the auto-knob we set GadgetRender to point to an */
- /* Image. In this case we do not need to initialize the Image structure: */
- struct Image image_prop;
-
- /* This is the special data required by the proportional gadget: */
- struct PropInfo prop_info=
- {
- PROPBORDERLESS|
- AUTOKNOB| /* We want to use the auto-knob. */
- FREEVERT, /* The knob should move vertically. */
- 0,0, /* HorizPot, VertPot: will be initialized later. */
- 0, /* HorizBody -"- */
- 0xFFFF, /* VertBody: No data to show, maximum. */
-
- 0,0,0,0,0,0 /* Intuition sets and maintains these variables. */
- };
-
- struct Gadget gadget_proportional=
- {
- NULL, /* *NextGadget */
- 294, 15, 13, 89, /* LeftEdge, TopEdge, Width, Height */
- GADGHCOMP, /* Flags */
- GADGIMMEDIATE|FOLLOWMOUSE|RELVERIFY, /* Activation */
- PROPGADGET, /* GadgetType */
- (APTR) &image_prop, /* GadgetRender */
- NULL, /* SelectRender */
- NULL, /* *GadgetText */
- NULL, /* MutualExclude */
- (APTR) &prop_info, /* SpecialInfo */
- NULL, /* GadgetID */
- NULL /* UserData */
- };
-
-
- /* UndoBuffer for the string gadgets: */
- UBYTE name_backup[DRAWER_LENGTH];
-
-
- /* ********************************************************************* */
- /* * Information for the string gadget "Drawer:" * */
- /* ********************************************************************* */
-
- UBYTE drawer_name[DRAWER_LENGTH];
-
- struct IntuiText text_drawer=
- {
- 1, 2, /* FrontPen, BackPen */
- JAM1, /* DrawMode */
- -69, 0, /* LeftEdge, TopEdge */
- &my_font, /* *ITextFont */
- "Drawer:", /* *IText */
- NULL /* *NextText */
- };
-
- struct StringInfo string_drawer=
- {
- drawer_name, /* *Buffer */
- name_backup, /* *UndoBuffer */
- 0, /* BufferPos */
- 70, /* MaxChars (Including NULL) */
- 0, /* DispPos */
- /* Intuition initializes and maintains these variables for you: */
- 0, /* UndoPos */
- 0, 0, /* CLeft, CTop */
- NULL, /* *LayerPtr */
- NULL, /* LongInt */
- NULL, /* *AltKeyMap */
- };
-
- struct Gadget gadget_drawer=
- {
- &gadget_proportional, /* *NextGadget */
- 81, 132, 230, 8, /* LeftEdge, TopEdge, Width, Height */
- GADGHCOMP, /* Flags */
- RELVERIFY, /* Activation */
- STRGADGET, /* GadgetType */
- NULL,
- NULL, /* SelectRender */
- &text_drawer, /* *GadgetText */
- NULL, /* MutualExclude */
- (APTR) &string_drawer, /* SpecialInfo */
- NULL, /* GadgetID */
- NULL /* UserData */
- };
-
-
- /* ********************************************************************* */
- /* * Information for the string gadget "File:" * */
- /* ********************************************************************* */
-
- UBYTE file_name[FILE_LENGTH];
-
- struct IntuiText text_file=
- {
- 1, 2, /* FrontPen, BackPen */
- JAM1, /* DrawMode */
- -52, 0, /* LewftEdge, TopEdge */
- &my_font, /* *ITextFont */
- "File:", /* *IText */
- NULL /* *NextText */
- };
-
- struct StringInfo string_file=
- {
- file_name, /* *Buffer */
- name_backup, /* *UndoBuffer */
- 0, /* BufferPos */
- 40, /* MaxChars (Including NULL) */
- 0, /* DispPos */
- /* Intuition initializes and maintains these variables for you: */
- 0, /* UndoPos */
- 0, 0, /* CLeft, CTop */
- NULL, /* *LayerPtr */
- NULL, /* LongInt */
- NULL, /* *AltKeyMap */
- };
-
- struct Gadget gadget_file=
- {
- &gadget_drawer, /* *NextGadget */
- 65, 151, 240, 8, /* LeftEdge, TopEdge, Width, Height */
- GADGHCOMP, /* Flags */
- NULL, /* Activation */
- STRGADGET, /* GadgetType */
- NULL,
- NULL, /* SelectRender */
- &text_file, /* *GadgetText */
- NULL, /* MutualExclude */
- (APTR) &string_file, /* SpecialInfo */
- NULL, /* GadgetID */
- NULL /* UserData */
- };
-
-
- /* ********************************************************************* */
- /* * Information for the string gadget "ToHide" * */
- /* ********************************************************************* */
-
- UBYTE ToHide_name[100]; /* 100 characters including NULL. */
-
- struct IntuiText text_ToHide=
- {
- 1, 2, /* FrontPen, BackPen */
- JAM1, /* DrawMode */
- -33, 0, /* LeftEdge, TopEdge */
- &my_font, /* *ITextFont */
- "Hi:", /* *IText */
- NULL /* *NextText */
- };
-
- struct StringInfo string_ToHide=
- {
- ToHide_name, /* *Buffer */
- name_backup, /* *UndoBuffer */
- 0, /* BufferPos */
- 100, /* MaxChars (Including NULL) */
- 0, /* DispPos */
- /* Intuition initializes and maintains these variables for you: */
- 0, /* UndoPos */
- 0, 0, /* CLeft, CTop */
- NULL, /* *LayerPtr */
- NULL, /* LongInt */
- NULL, /* *AltKeyMap */
- };
-
- struct Gadget gadget_ToHide=
- {
- &gadget_file, /* *NextGadget */
- 359,169, 110, 8, /* LeftEdge, TopEdge, Width, Height */
- GADGHCOMP, /* Flags */
- RELVERIFY, /* Activation */
- STRGADGET, /* GadgetType */
- NULL, /* GadgetRender */
- NULL, /* SelectRender */
- &text_ToHide, /* *GadgetText */
- NULL, /* MutualExclude */
- (APTR) &string_ToHide, /* SpecialInfo */
- NULL, /* GadgetID */
- NULL /* UserData */
- };
-
-
- /* ********************************************************************* */
- /* * Information for the string gadget "ToShow" * */
- /* ********************************************************************* */
-
- UBYTE ToShow_name[100]; /* 100 characters including NULL. */
-
- struct IntuiText text_ToShow=
- {
- 1, 2, /* FrontPen, BackPen */
- JAM1, /* DrawMode */
- -33, 0, /* LeftEdge, TopEdge */
- &my_font, /* *ITextFont */
- "Sh:", /* *IText */
- NULL /* *NextText */
- };
-
- struct StringInfo string_ToShow=
- {
- ToShow_name, /* *Buffer */
- name_backup, /* *UndoBuffer */
- 0, /* BufferPos */
- 100, /* MaxChars (Including NULL) */
- 0, /* DispPos */
- /* Intuition initializes and maintains these variables for you: */
- 0, /* UndoPos */
- 0, 0, /* CLeft, CTop */
- NULL, /* *LayerPtr */
- NULL, /* LongInt */
- NULL, /* *AltKeyMap */
- };
-
- struct Gadget gadget_ToShow=
- {
- &gadget_ToHide, /* *NextGadget */
- 359,151, 110, 8, /* LeftEdge, TopEdge, Width, Height */
- GADGHCOMP, /* Flags */
- RELVERIFY, /* Activation */
- STRGADGET, /* GadgetType */
- NULL, /* GadgetRender */
- NULL, /* SelectRender */
- &text_ToShow, /* *GadgetText */
- NULL, /* MutualExclude */
- (APTR) &string_ToShow, /* SpecialInfo */
- NULL, /* GadgetID */
- NULL /* UserData */
- };
-
-
- /* ********************************************************************* */
- /* * Information for the boolean gadget parent "<" * */
- /* ********************************************************************* */
-
- struct IntuiText text_parent=
- {
- 1, 2, /* FrontPen, BackPen */
- JAM1, /* DrawMode */
- 7,4, /* LeftEdge, TopEdge */
- &my_font, /* *ITextFont, (Topaz, 80) */
- "<", /* *IText */
- NULL /* *NextText */
- };
-
- struct Gadget gadget_parent=
- {
- &gadget_ToShow, /* *NextGadget */
- 290, 109, 21, 16, /* LeftEdge, TopEdge, Width, Height */
- GADGHCOMP, /* Flags */
- RELVERIFY, /* Activation */
- BOOLGADGET, /* GadgetType */
- NULL, /* GadgetRender */
- NULL, /* SelectRender */
- &text_parent, /* *GadgetText */
- NULL, /* MutualExclude */
- NULL, /* SpecialInfo */
- NULL, /* GadgetID */
- NULL /* UserData */
- };
-
-
- /* ********************************************************************* */
- /* * Information for the boolean gadget 3A * */
- /* ********************************************************************* */
-
- struct IntuiText text_3A=
- {
- 1, 2, /* FrontPen, BackPen */
- JAM1, /* DrawMode */
- 7,4, /* LeftEdge, TopEdge */
- &my_font, /* *ITextFont, (Topaz, 80) */
- NULL, /* *IText */
- NULL /* *NextText */
- };
-
- struct Gadget gadget_3A=
- {
- &gadget_parent, /* *NextGadget */
- 428, 13, 45, 15, /* LeftEdge, TopEdge, Width, Height */
- GADGHCOMP, /* Flags */
- RELVERIFY, /* Activation */
- BOOLGADGET, /* GadgetType */
- NULL,
- NULL, /* SelectRender */
- &text_3A, /* *GadgetText */
- NULL, /* MutualExclude */
- NULL, /* SpecialInfo */
- NULL, /* GadgetID */
- NULL /* UserData */
- };
-
-
- /* ********************************************************************* */
- /* * Information for the boolean gadget "3D:" * */
- /* ********************************************************************* */
-
- struct IntuiText text_3D=
- {
- 1, 2, /* FrontPen, BackPen */
- JAM1, /* DrawMode */
- 7,4, /* LeftEdge, TopEdge */
- &my_font, /* *ITextFont, (Topaz, 80) */
- NULL, /* *IText */
- NULL /* *NextText */
- };
-
- struct Gadget gadget_3D=
- {
- &gadget_3A, /* *NextGadget */
- 428, 67, 45, 15, /* LeftEdge, TopEdge, Width, Height */
- GADGHCOMP, /* Flags */
- RELVERIFY, /* Activation */
- BOOLGADGET, /* GadgetType */
- NULL,
- NULL, /* SelectRender */
- &text_3D, /* *GadgetText */
- NULL, /* MutualExclude */
- NULL, /* SpecialInfo */
- NULL, /* GadgetID */
- NULL /* UserData */
- };
-
-
- /* ********************************************************************* */
- /* * Information for the boolean gadget "3B:" * */
- /* ********************************************************************* */
-
- struct IntuiText text_3B=
- {
- 1, 2, /* FrontPen, BackPen */
- JAM1, /* DrawMode */
- 7,4, /* LeftEdge, TopEdge */
- &my_font, /* *ITextFont, (Topaz, 80) */
- NULL, /* *IText */
- NULL /* *NextText */
- };
-
- struct Gadget gadget_3B=
- {
- &gadget_3D, /* *NextGadget */
- 428, 31, 45, 15, /* LeftEdge, TopEdge, Width, Height */
- GADGHCOMP, /* Flags */
- RELVERIFY, /* Activation */
- BOOLGADGET, /* GadgetType */
- NULL,
- NULL, /* SelectRender */
- &text_3B, /* *GadgetText */
- NULL, /* MutualExclude */
- NULL, /* SpecialInfo */
- NULL, /* GadgetID */
- NULL /* UserData */
- };
-
-
- /* ********************************************************************* */
- /* * Information for the boolean gadget "3C:" * */
- /* ********************************************************************* */
-
- struct IntuiText text_3C=
- {
- 1, 2, /* FrontPen, BackPen */
- JAM1, /* DrawMode */
- 7,4, /* LeftEdge, TopEdge */
- &my_font, /* *ITextFont, (Topaz, 80) */
- NULL, /* *IText */
- NULL /* *NextText */
- };
-
- struct Gadget gadget_3C=
- {
- &gadget_3B, /* *NextGadget */
- 428, 49, 45, 15, /* LeftEdge, TopEdge, Width, Height */
- GADGHCOMP, /* Flags */
- RELVERIFY, /* Activation */
- BOOLGADGET, /* GadgetType */
- NULL,
- NULL, /* SelectRender */
- &text_3C, /* *GadgetText */
- NULL, /* MutualExclude */
- NULL, /* SpecialInfo */
- NULL, /* GadgetID */
- NULL /* UserData */
- };
-
-
- /* ********************************************************************* */
- /* * Information for the boolean gadget "3E" * */
- /* ********************************************************************* */
-
- struct IntuiText text_3E=
- {
- 1, 2, /* FrontPen, BackPen */
- JAM1, /* DrawMode */
- 7,4, /* LeftEdge, TopEdge */
- &my_font, /* *ITextFont, (Topaz, 80) */
- NULL, /* *IText */
- NULL /* *NextText */
- };
-
- struct Gadget gadget_3E=
- {
- &gadget_3C, /* *NextGadget */
- 428, 85, 45, 15, /* LeftEdge, TopEdge, Width, Height */
- GADGHCOMP, /* Flags */
- RELVERIFY, /* Activation */
- BOOLGADGET, /* GadgetType */
- NULL,
- NULL, /* SelectRender */
- &text_3E, /* *GadgetText */
- NULL, /* MutualExclude */
- NULL, /* SpecialInfo */
- NULL, /* GadgetID */
- NULL /* UserData */
- };
-
-
- /* ********************************************************************* */
- /* * Information for the boolean gadget "3F" * */
- /* ********************************************************************* */
-
- struct IntuiText text_3F=
- {
- 1, 2, /* FrontPen, BackPen */
- JAM1, /* DrawMode */
- 7,4, /* LeftEdge, TopEdge */
- &my_font, /* *ITextFont, (Topaz, 80) */
- NULL, /* *IText */
- NULL /* *NextText */
- };
-
- struct Gadget gadget_3F=
- {
- &gadget_3E, /* *NextGadget */
- 428, 103, 45, 15, /* LeftEdge, TopEdge, Width, Height */
- GADGHCOMP, /* Flags */
- RELVERIFY, /* Activation */
- BOOLGADGET, /* GadgetType */
- NULL,
- NULL, /* SelectRender */
- &text_3F, /* *GadgetText */
- NULL, /* MutualExclude */
- NULL, /* SpecialInfo */
- NULL, /* GadgetID */
- NULL /* UserData */
- };
-
-
- /* ********************************************************************* */
- /* * Information for the boolean gadget "3G:" * */
- /* ********************************************************************* */
-
- struct IntuiText text_3G=
- {
- 1, 2, /* FrontPen, BackPen */
- JAM1, /* DrawMode */
- 7,4, /* LeftEdge, TopEdge */
- &my_font, /* *ITextFont, (Topaz, 80) */
- NULL, /* *IText */
- NULL /* *NextText */
- };
-
- struct Gadget gadget_3G=
- {
- &gadget_3F, /* *NextGadget */
- 428, 121, 45, 15, /* LeftEdge, TopEdge, Width, Height */
- GADGHCOMP, /* Flags */
- RELVERIFY, /* Activation */
- BOOLGADGET, /* GadgetType */
- NULL,
- NULL, /* SelectRender */
- &text_3G, /* *GadgetText */
- NULL, /* MutualExclude */
- NULL, /* SpecialInfo */
- NULL, /* GadgetID */
- NULL /* UserData */
- };
-
-
- /* ********************************************************************* */
- /* * Information for the boolean gadget 2A * */
- /* ********************************************************************* */
-
- struct IntuiText text_2A=
- {
- 1, 2, /* FrontPen, BackPen */
- JAM1, /* DrawMode */
- 7,4, /* LeftEdge, TopEdge */
- &my_font, /* *ITextFont, (Topaz, 80) */
- NULL, /* *IText */
- NULL /* *NextText */
- };
-
- struct Gadget gadget_2A=
- {
- &gadget_3G, /* *NextGadget */
- 377, 13, 45, 15, /* LeftEdge, TopEdge, Width, Height */
- GADGHCOMP, /* Flags */
- RELVERIFY, /* Activation */
- BOOLGADGET, /* GadgetType */
- NULL,
- NULL, /* SelectRender */
- &text_2A, /* *GadgetText */
- NULL, /* MutualExclude */
- NULL, /* SpecialInfo */
- NULL, /* GadgetID */
- NULL /* UserData */
- };
-
-
- /* ********************************************************************* */
- /* * Information for the boolean gadget "2D:" * */
- /* ********************************************************************* */
-
- struct IntuiText text_2D=
- {
- 1, 2, /* FrontPen, BackPen */
- JAM1, /* DrawMode */
- 7,4, /* LeftEdge, TopEdge */
- &my_font, /* *ITextFont, (Topaz, 80) */
- NULL, /* *IText */
- NULL /* *NextText */
- };
-
- struct Gadget gadget_2D=
- {
- &gadget_2A, /* *NextGadget */
- 377, 67, 45, 15, /* LeftEdge, TopEdge, Width, Height */
- GADGHCOMP, /* Flags */
- RELVERIFY, /* Activation */
- BOOLGADGET, /* GadgetType */
- NULL,
- NULL, /* SelectRender */
- &text_2D, /* *GadgetText */
- NULL, /* MutualExclude */
- NULL, /* SpecialInfo */
- NULL, /* GadgetID */
- NULL /* UserData */
- };
-
-
- /* ********************************************************************* */
- /* * Information for the boolean gadget "2B:" * */
- /* ********************************************************************* */
-
- struct IntuiText text_2B=
- {
- 1, 2, /* FrontPen, BackPen */
- JAM1, /* DrawMode */
- 7,4, /* LeftEdge, TopEdge */
- &my_font, /* *ITextFont, (Topaz, 80) */
- NULL, /* *IText */
- NULL /* *NextText */
- };
-
- struct Gadget gadget_2B=
- {
- &gadget_2D, /* *NextGadget */
- 377, 31, 45, 15, /* LeftEdge, TopEdge, Width, Height */
- GADGHCOMP, /* Flags */
- RELVERIFY, /* Activation */
- BOOLGADGET, /* GadgetType */
- NULL,
- NULL, /* SelectRender */
- &text_2B, /* *GadgetText */
- NULL, /* MutualExclude */
- NULL, /* SpecialInfo */
- NULL, /* GadgetID */
- NULL /* UserData */
- };
-
-
- /* ********************************************************************* */
- /* * Information for the boolean gadget "2C:" * */
- /* ********************************************************************* */
-
- struct IntuiText text_2C=
- {
- 1, 2, /* FrontPen, BackPen */
- JAM1, /* DrawMode */
- 7,4, /* LeftEdge, TopEdge */
- &my_font, /* *ITextFont, (Topaz, 80) */
- NULL, /* *IText */
- NULL /* *NextText */
- };
-
- struct Gadget gadget_2C=
- {
- &gadget_2B, /* *NextGadget */
- 377, 49, 45, 15, /* LeftEdge, TopEdge, Width, Height */
- GADGHCOMP, /* Flags */
- RELVERIFY, /* Activation */
- BOOLGADGET, /* GadgetType */
- NULL,
- NULL, /* SelectRender */
- &text_2C, /* *GadgetText */
- NULL, /* MutualExclude */
- NULL, /* SpecialInfo */
- NULL, /* GadgetID */
- NULL /* UserData */
- };
-
-
- /* ********************************************************************* */
- /* * Information for the boolean gadget "2E" * */
- /* ********************************************************************* */
-
- struct IntuiText text_2E=
- {
- 1, 2, /* FrontPen, BackPen */
- JAM1, /* DrawMode */
- 7,4, /* LeftEdge, TopEdge */
- &my_font, /* *ITextFont, (Topaz, 80) */
- NULL, /* *IText */
- NULL /* *NextText */
- };
-
- struct Gadget gadget_2E=
- {
- &gadget_2C, /* *NextGadget */
- 377, 85, 45, 15, /* LeftEdge, TopEdge, Width, Height */
- GADGHCOMP, /* Flags */
- RELVERIFY, /* Activation */
- BOOLGADGET, /* GadgetType */
- NULL,
- NULL, /* SelectRender */
- &text_2E, /* *GadgetText */
- NULL, /* MutualExclude */
- NULL, /* SpecialInfo */
- NULL, /* GadgetID */
- NULL /* UserData */
- };
-
-
- /* ********************************************************************* */
- /* * Information for the boolean gadget "2F" * */
- /* ********************************************************************* */
-
- struct IntuiText text_2F=
- {
- 1, 2, /* FrontPen, BackPen */
- JAM1, /* DrawMode */
- 7,4, /* LeftEdge, TopEdge */
- &my_font, /* *ITextFont, (Topaz, 80) */
- NULL, /* *IText */
- NULL /* *NextText */
- };
-
- struct Gadget gadget_2F=
- {
- &gadget_2E, /* *NextGadget */
- 377, 103, 45, 15, /* LeftEdge, TopEdge, Width, Height */
- GADGHCOMP, /* Flags */
- RELVERIFY, /* Activation */
- BOOLGADGET, /* GadgetType */
- NULL,
- NULL, /* SelectRender */
- &text_2F, /* *GadgetText */
- NULL, /* MutualExclude */
- NULL, /* SpecialInfo */
- NULL, /* GadgetID */
- NULL /* UserData */
- };
-
-
- /* ********************************************************************* */
- /* * Information for the boolean gadget "2G:" * */
- /* ********************************************************************* */
-
- struct IntuiText text_2G=
- {
- 1, 2, /* FrontPen, BackPen */
- JAM1, /* DrawMode */
- 7,4, /* LeftEdge, TopEdge */
- &my_font, /* *ITextFont, (Topaz, 80) */
- NULL, /* *IText */
- NULL /* *NextText */
- };
-
- struct Gadget gadget_2G=
- {
- &gadget_2F, /* *NextGadget */
- 377, 121, 45, 15, /* LeftEdge, TopEdge, Width, Height */
- GADGHCOMP, /* Flags */
- RELVERIFY, /* Activation */
- BOOLGADGET, /* GadgetType */
- NULL,
- NULL, /* SelectRender */
- &text_2G, /* *GadgetText */
- NULL, /* MutualExclude */
- NULL, /* SpecialInfo */
- NULL, /* GadgetID */
- NULL /* UserData */
- };
-
-
- /* ********************************************************************* */
- /* * Information for the boolean gadget 1A * */
- /* ********************************************************************* */
-
- struct IntuiText text_1A=
- {
- 1, 2, /* FrontPen, BackPen */
- JAM1, /* DrawMode */
- 7,4, /* LeftEdge, TopEdge */
- &my_font, /* *ITextFont, (Topaz, 80) */
- NULL, /* *IText */
- NULL /* *NextText */
- };
-
- struct Gadget gadget_1A=
- {
- &gadget_2G, /* *NextGadget */
- 326, 13, 45, 15, /* LeftEdge, TopEdge, Width, Height */
- GADGHCOMP, /* Flags */
- RELVERIFY, /* Activation */
- BOOLGADGET, /* GadgetType */
- NULL,
- NULL, /* SelectRender */
- &text_1A, /* *GadgetText */
- NULL, /* MutualExclude */
- NULL, /* SpecialInfo */
- NULL, /* GadgetID */
- NULL /* UserData */
- };
-
-
- /* ********************************************************************* */
- /* * Information for the boolean gadget "1D:" * */
- /* ********************************************************************* */
-
- struct IntuiText text_1D=
- {
- 1, 2, /* FrontPen, BackPen */
- JAM1, /* DrawMode */
- 7,4, /* LeftEdge, TopEdge */
- &my_font, /* *ITextFont, (Topaz, 80) */
- NULL, /* *IText */
- NULL /* *NextText */
- };
-
- struct Gadget gadget_1D=
- {
- &gadget_1A, /* *NextGadget */
- 326, 67, 45, 15, /* LeftEdge, TopEdge, Width, Height */
- GADGHCOMP, /* Flags */
- RELVERIFY, /* Activation */
- BOOLGADGET, /* GadgetType */
- NULL,
- NULL, /* SelectRender */
- &text_1D, /* *GadgetText */
- NULL, /* MutualExclude */
- NULL, /* SpecialInfo */
- NULL, /* GadgetID */
- NULL /* UserData */
- };
-
-
- /* ********************************************************************* */
- /* * Information for the boolean gadget "1B:" * */
- /* ********************************************************************* */
-
- struct IntuiText text_1B=
- {
- 1, 2, /* FrontPen, BackPen */
- JAM1, /* DrawMode */
- 7,4, /* LeftEdge, TopEdge */
- &my_font, /* *ITextFont, (Topaz, 80) */
- NULL, /* *IText */
- NULL /* *NextText */
- };
-
- struct Gadget gadget_1B=
- {
- &gadget_1D, /* *NextGadget */
- 326, 31, 45, 15, /* LeftEdge, TopEdge, Width, Height */
- GADGHCOMP, /* Flags */
- RELVERIFY, /* Activation */
- BOOLGADGET, /* GadgetType */
- NULL,
- NULL, /* SelectRender */
- &text_1B, /* *GadgetText */
- NULL, /* MutualExclude */
- NULL, /* SpecialInfo */
- NULL, /* GadgetID */
- NULL /* UserData */
- };
-
-
- /* ********************************************************************* */
- /* * Information for the boolean gadget "1C:" * */
- /* ********************************************************************* */
-
- struct IntuiText text_1C=
- {
- 1, 2, /* FrontPen, BackPen */
- JAM1, /* DrawMode */
- 7,4, /* LeftEdge, TopEdge */
- &my_font, /* *ITextFont, (Topaz, 80) */
- NULL, /* *IText */
- NULL /* *NextText */
- };
-
- struct Gadget gadget_1C=
- {
- &gadget_1B, /* *NextGadget */
- 326, 49, 45, 15, /* LeftEdge, TopEdge, Width, Height */
- GADGHCOMP, /* Flags */
- RELVERIFY, /* Activation */
- BOOLGADGET, /* GadgetType */
- NULL,
- NULL, /* SelectRender */
- &text_1C, /* *GadgetText */
- NULL, /* MutualExclude */
- NULL, /* SpecialInfo */
- NULL, /* GadgetID */
- NULL /* UserData */
- };
-
-
- /* ********************************************************************* */
- /* * Information for the boolean gadget "1E" * */
- /* ********************************************************************* */
-
- struct IntuiText text_1E=
- {
- 1, 2, /* FrontPen, BackPen */
- JAM1, /* DrawMode */
- 7,4, /* LeftEdge, TopEdge */
- &my_font, /* *ITextFont, (Topaz, 80) */
- NULL, /* *IText */
- NULL /* *NextText */
- };
-
- struct Gadget gadget_1E=
- {
- &gadget_1C, /* *NextGadget */
- 326, 85, 45, 15, /* LeftEdge, TopEdge, Width, Height */
- GADGHCOMP, /* Flags */
- RELVERIFY, /* Activation */
- BOOLGADGET, /* GadgetType */
- NULL,
- NULL, /* SelectRender */
- &text_1E, /* *GadgetText */
- NULL, /* MutualExclude */
- NULL, /* SpecialInfo */
- NULL, /* GadgetID */
- NULL /* UserData */
- };
-
-
- /* ********************************************************************* */
- /* * Information for the boolean gadget "1F" * */
- /* ********************************************************************* */
-
- struct IntuiText text_1F=
- {
- 1, 2, /* FrontPen, BackPen */
- JAM1, /* DrawMode */
- 7,4, /* LeftEdge, TopEdge */
- &my_font, /* *ITextFont, (Topaz, 80) */
- NULL, /* *IText */
- NULL /* *NextText */
- };
-
- struct Gadget gadget_1F=
- {
- &gadget_1E, /* *NextGadget */
- 326, 103, 45, 15, /* LeftEdge, TopEdge, Width, Height */
- GADGHCOMP, /* Flags */
- RELVERIFY, /* Activation */
- BOOLGADGET, /* GadgetType */
- NULL,
- NULL, /* SelectRender */
- &text_1F, /* *GadgetText */
- NULL, /* MutualExclude */
- NULL, /* SpecialInfo */
- NULL, /* GadgetID */
- NULL /* UserData */
- };
-
-
- /* ********************************************************************* */
- /* * Information for the boolean gadget "1G:" * */
- /* ********************************************************************* */
-
- struct IntuiText text_1G=
- {
- 1, 2, /* FrontPen, BackPen */
- JAM1, /* DrawMode */
- 7,4, /* LeftEdge, TopEdge */
- &my_font, /* *ITextFont, (Topaz, 80) */
- NULL, /* *IText */
- NULL /* *NextText */
- };
-
- struct Gadget gadget_1G=
- {
- &gadget_1F, /* *NextGadget */
- 326, 121, 45, 15, /* LeftEdge, TopEdge, Width, Height */
- GADGHCOMP, /* Flags */
- RELVERIFY, /* Activation */
- BOOLGADGET, /* GadgetType */
- NULL,
- NULL, /* SelectRender */
- &text_1G, /* *GadgetText */
- NULL, /* MutualExclude */
- NULL, /* SpecialInfo */
- NULL, /* GadgetID */
- NULL /* UserData */
- };
-
-
- /* ********************************************************************* */
- /* * Information for the boolean gadget "GET DIR" * */
- /* ********************************************************************* */
-
- struct IntuiText text_getdir=
- {
- 1, 2, /* FrontPen, BackPen */
- JAM1, /* DrawMode */
- 7,4, /* LeftEdge, TopEdge */
- &my_font, /* *ITextFont, (Topaz, 80) */
- "GET DIR",/* *IText */
- NULL /* *NextText */
- };
-
- struct Gadget gadget_getdir=
- {
- &gadget_1G, /* *NextGadget */
- 244, 166, 68, 15, /* LeftEdge, TopEdge, Width, Height */
- GADGHCOMP, /* Flags */
- RELVERIFY, /* Activation */
- BOOLGADGET, /* GadgetType */
- NULL,
- NULL, /* SelectRender */
- &text_getdir, /* *GadgetText */
- NULL, /* MutualExclude */
- NULL, /* SpecialInfo */
- NULL, /* GadgetID */
- NULL /* UserData */
- };
-
-
- /* ********************************************************************* */
- /* * Information for the boolean gadget "CANCEL" * */
- /* ********************************************************************* */
-
- struct IntuiText text_cancel=
- {
- 1, 2, /* FrontPen, BackPen */
- JAM1, /* DrawMode */
- 7,4, /* LeftEdge, TopEdge */
- &my_font, /* *ITextFont, (Topaz, 80) */
- "CANCEL", /* *IText */
- NULL /* *NextText */
- };
-
- struct Gadget gadget_cancel=
- {
- &gadget_getdir, /* *NextGadget */
- 177, 166, 61, 15, /* LeftEdge, TopEdge, Width, Height */
- GADGHCOMP, /* Flags */
- RELVERIFY, /* Activation */
- BOOLGADGET, /* GadgetType */
- NULL,
- NULL, /* SelectRender */
- &text_cancel, /* *GadgetText */
- NULL, /* MutualExclude */
- NULL, /* SpecialInfo */
- NULL, /* GadgetID */
- NULL /* UserData */
- };
-
-
- /* ********************************************************************* */
- /* * Information for the boolean gadget "DELETE" * */
- /* ********************************************************************* */
-
- struct IntuiText text_delete=
- {
- 1, 2, /* FrontPen, BackPen */
- JAM1, /* DrawMode */
- 7,4, /* LeftEdge, TopEdge */
- &my_font, /* *ITextFont, (Topaz, 80) */
- "DELETE", /* *IText */
- NULL /* *NextText */
- };
-
- struct Gadget gadget_delete=
- {
- &gadget_cancel, /* *NextGadget */
- 110, 166, 61, 15, /* LeftEdge, TopEdge, Width, Height */
- GADGHCOMP, /* Flags */
- RELVERIFY, /* Activation */
- BOOLGADGET, /* GadgetType */
- NULL,
- NULL, /* SelectRender */
- &text_delete, /* *GadgetText */
- NULL, /* MutualExclude */
- NULL, /* SpecialInfo */
- NULL, /* GadgetID */
- NULL /* UserData */
- };
-
-
- /* ********************************************************************* */
- /* * Information for the boolean gadget "SAVE" * */
- /* ********************************************************************* */
-
- struct IntuiText text_save=
- {
- 1, 2, /* FrontPen, BackPen */
- JAM1, /* DrawMode */
- 7,4, /* LeftEdge, TopEdge */
- &my_font, /* *ITextFont, (Topaz, 80) */
- "SAVE", /* *IText */
- NULL /* *NextText */
- };
-
- struct Gadget gadget_save=
- {
- &gadget_delete, /* *NextGadget */
- 59, 166, 45, 15, /* LeftEdge, TopEdge, Width, Height */
- GADGHCOMP, /* Flags */
- RELVERIFY, /* Activation */
- BOOLGADGET, /* GadgetType */
- NULL,
- NULL, /* SelectRender */
- &text_save, /* *GadgetText */
- NULL, /* MutualExclude */
- NULL, /* SpecialInfo */
- NULL, /* GadgetID */
- NULL /* UserData */
- };
-
-
- /* ********************************************************************* */
- /* * Information for the boolean gadget "LOAD" * */
- /* ********************************************************************* */
-
- struct IntuiText text_load=
- {
- 1, 2, /* FrontPen, BackPen */
- JAM1, /* DrawMode */
- 7,4, /* LeftEdge, TopEdge */
- &my_font, /* *ITextFont, (Topaz, 80) */
- "LOAD", /* *IText */
- NULL /* *NextText */
- };
-
- struct Gadget gadget_load=
- {
- &gadget_save, /* *NextGadget */
- 8, 166, 45, 15, /* LeftEdge, TopEdge, Width, Height */
- GADGHCOMP, /* Flags */
- RELVERIFY, /* Activation */
- BOOLGADGET, /* GadgetType */
- NULL,
- NULL, /* SelectRender */
- &text_load, /* *GadgetText */
- NULL, /* MutualExclude */
- NULL, /* SpecialInfo */
- NULL, /* GadgetID */
- NULL /* UserData */
- };
-
-
- UBYTE display_text[13][34];
-
- struct IntuiText text_list[13]=
- {
- {
- 1, 0, /* FrontPen, BackPen */
- JAM2, /* DrawMode */
- 0,22-UP, /* LeftEdge, TopEdge */
- &my_font, /* *ITextFont */
- display_text[0], /* IText */
- &text_list[1] /* *NextText */
- },
- {
- 1, 0, /* FrontPen, BackPen */
- JAM2, /* DrawMode */
- 0,30-UP, /* LeftEdge, TopEdge */
- &my_font, /* *ITextFont */
- display_text[1], /* IText */
- &text_list[2] /* *NextText */
- },
- {
- 1, 0, /* FrontPen, BackPen */
- JAM2, /* DrawMode */
- 0,38-UP, /* LeftEdge, TopEdge */
- &my_font, /* *ITextFont */
- display_text[2], /* IText */
- &text_list[3] /* *NextText */
- },
- {
- 1, 0, /* FrontPen, BackPen */
- JAM2, /* DrawMode */
- 0,46-UP, /* LeftEdge, TopEdge */
- &my_font, /* *ITextFont */
- display_text[3], /* IText */
- &text_list[4] /* *NextText */
- },
- {
- 1, 0, /* FrontPen, BackPen */
- JAM2, /* DrawMode */
- 0,54-UP, /* LeftEdge, TopEdge */
- &my_font, /* *ITextFont */
- display_text[4], /* IText */
- &text_list[5] /* *NextText */
- },
- {
- 1, 0, /* FrontPen, BackPen */
- JAM2, /* DrawMode */
- 0,62-UP, /* LeftEdge, TopEdge */
- &my_font, /* *ITextFont */
- display_text[5], /* IText */
- &text_list[6] /* *NextText */
- },
- {
- 1, 0, /* FrontPen, BackPen */
- JAM2, /* DrawMode */
- 0,70-UP, /* LeftEdge, TopEdge */
- &my_font, /* *ITextFont */
- display_text[6], /* IText */
- &text_list[7] /* *NextText */
- },
- {
- 1, 0, /* FrontPen, BackPen */
- JAM2, /* DrawMode */
- 0,78-UP, /* LeftEdge, TopEdge */
- &my_font, /* *ITextFont */
- display_text[7], /* IText */
- &text_list[8] /* *NextText */
- },
- {
- 1, 0, /* FrontPen, BackPen */
- JAM2, /* DrawMode */
- 0,86-UP, /* LeftEdge, TopEdge */
- &my_font, /* *ITextFont */
- display_text[8], /* IText */
- &text_list[9] /* *NextText */
- },
- {
- 1, 0, /* FrontPen, BackPen */
- JAM2, /* DrawMode */
- 0,94-UP, /* LeftEdge, TopEdge */
- &my_font, /* *ITextFont */
- display_text[9], /* IText */
- &text_list[10] /* *NextText */
- },
- {
- 1, 0, /* FrontPen, BackPen */
- JAM2, /* DrawMode */
- 0,102-UP, /* LeftEdge, TopEdge */
- &my_font, /* *ITextFont */
- display_text[10], /* IText */
- &text_list[11] /* *NextText */
- },
- {
- 1, 0, /* FrontPen, BackPen */
- JAM2, /* DrawMode */
- 0,110-UP, /* LeftEdge, TopEdge */
- &my_font, /* *ITextFont */
- display_text[11], /* IText */
- &text_list[12] /* *NextText */
- },
- {
- 1, 0, /* FrontPen, BackPen */
- JAM2, /* DrawMode */
- 0,118-UP, /* LeftEdge, TopEdge */
- &my_font, /* *ITextFont */
- display_text[12], /* IText */
- NULL /* *NextText */
- }
- };
-
-
- struct Gadget gadget_display[13]=
- {
- {
- &gadget_display[1], /* *NextGadget */
- 8, 72-UP, 276, 12, /* LeftEdge, TopEdge, Width, Height */
- GADGHNONE, /* Flags */
- GADGIMMEDIATE, /* Activation */
- BOOLGADGET, /* GadgetType */
- NULL, /* GadgetRender */
- NULL, /* SelectRender */
- NULL, /* *GadgetText */
- NULL, /* MutualExclude */
- NULL, /* SpecialInfo */
- NULL, /* GadgetID */
- NULL /* UserData */
- },
- {
- &gadget_display[2], /* *NextGadget */
- 8, 84-UP, 276, 8, /* LeftEdge, TopEdge, Width, Height */
- GADGHNONE, /* Flags */
- GADGIMMEDIATE, /* Activation */
- BOOLGADGET, /* GadgetType */
- NULL, /* GadgetRender */
- NULL, /* SelectRender */
- NULL, /* *GadgetText */
- NULL, /* MutualExclude */
- NULL, /* SpecialInfo */
- NULL, /* GadgetID */
- NULL /* UserData */
- },
- {
- &gadget_display[3], /* *NextGadget */
- 8, 92-UP, 276, 8, /* LeftEdge, TopEdge, Width, Height */
- GADGHNONE, /* Flags */
- GADGIMMEDIATE, /* Activation */
- BOOLGADGET, /* GadgetType */
- NULL, /* GadgetRender */
- NULL, /* SelectRender */
- NULL, /* *GadgetText */
- NULL, /* MutualExclude */
- NULL, /* SpecialInfo */
- NULL, /* GadgetID */
- NULL /* UserData */
- },
- {
- &gadget_display[4], /* *NextGadget */
- 8, 100-UP, 276, 8, /* LeftEdge, TopEdge, Width, Height */
- GADGHNONE, /* Flags */
- GADGIMMEDIATE, /* Activation */
- BOOLGADGET, /* GadgetType */
- NULL, /* GadgetRender */
- NULL, /* SelectRender */
- NULL, /* *GadgetText */
- NULL, /* MutualExclude */
- NULL, /* SpecialInfo */
- NULL, /* GadgetID */
- NULL /* UserData */
- },
- {
- &gadget_display[5], /* *NextGadget */
- 8,108-UP, 276, 8, /* LeftEdge, TopEdge, Width, Height */
- GADGHNONE, /* Flags */
- GADGIMMEDIATE, /* Activation */
- BOOLGADGET, /* GadgetType */
- NULL, /* GadgetRender */
- NULL, /* SelectRender */
- NULL, /* *GadgetText */
- NULL, /* MutualExclude */
- NULL, /* SpecialInfo */
- NULL, /* GadgetID */
- NULL /* UserData */
- },
- {
- &gadget_display[6], /* *NextGadget */
- 8,116-UP, 276, 8, /* LeftEdge, TopEdge, Width, Height */
- GADGHNONE, /* Flags */
- GADGIMMEDIATE, /* Activation */
- BOOLGADGET, /* GadgetType */
- NULL, /* GadgetRender */
- NULL, /* SelectRender */
- NULL, /* *GadgetText */
- NULL, /* MutualExclude */
- NULL, /* SpecialInfo */
- NULL, /* GadgetID */
- NULL /* UserData */
- },
- {
- &gadget_display[7], /* *NextGadget */
- 8, 124-UP, 276, 8, /* LeftEdge, TopEdge, Width, Height */
- GADGHNONE, /* Flags */
- GADGIMMEDIATE, /* Activation */
- BOOLGADGET, /* GadgetType */
- NULL, /* GadgetRender */
- NULL, /* SelectRender */
- NULL, /* *GadgetText */
- NULL, /* MutualExclude */
- NULL, /* SpecialInfo */
- NULL, /* GadgetID */
- NULL /* UserData */
- },
- {
- &gadget_display[8], /* *NextGadget */
- 8, 132-UP, 276, 12, /* LeftEdge, TopEdge, Width, Height */
- GADGHNONE, /* Flags */
- GADGIMMEDIATE, /* Activation */
- BOOLGADGET, /* GadgetType */
- NULL, /* GadgetRender */
- NULL, /* SelectRender */
- NULL, /* *GadgetText */
- NULL, /* MutualExclude */
- NULL, /* SpecialInfo */
- NULL, /* GadgetID */
- NULL /* UserData */
- },
- {
- &gadget_display[9], /* *NextGadget */
- 8, 140-UP, 276, 8, /* LeftEdge, TopEdge, Width, Height */
- GADGHNONE, /* Flags */
- GADGIMMEDIATE, /* Activation */
- BOOLGADGET, /* GadgetType */
- NULL, /* GadgetRender */
- NULL, /* SelectRender */
- NULL, /* *GadgetText */
- NULL, /* MutualExclude */
- NULL, /* SpecialInfo */
- NULL, /* GadgetID */
- NULL /* UserData */
- },
- {
- &gadget_display[10], /* *NextGadget */
- 8,148-UP, 276, 8, /* LeftEdge, TopEdge, Width, Height */
- GADGHNONE, /* Flags */
- GADGIMMEDIATE, /* Activation */
- BOOLGADGET, /* GadgetType */
- NULL, /* GadgetRender */
- NULL, /* SelectRender */
- NULL, /* *GadgetText */
- NULL, /* MutualExclude */
- NULL, /* SpecialInfo */
- NULL, /* GadgetID */
- NULL /* UserData */
- },
- {
- &gadget_display[11], /* *NextGadget */
- 8,156-UP, 276, 8, /* LeftEdge, TopEdge, Width, Height */
- GADGHNONE, /* Flags */
- GADGIMMEDIATE, /* Activation */
- BOOLGADGET, /* GadgetType */
- NULL, /* GadgetRender */
- NULL, /* SelectRender */
- NULL, /* *GadgetText */
- NULL, /* MutualExclude */
- NULL, /* SpecialInfo */
- NULL, /* GadgetID */
- NULL /* UserData */
- },
- {
- &gadget_display[12], /* *NextGadget */
- 8, 164-UP, 276, 8, /* LeftEdge, TopEdge, Width, Height */
- GADGHNONE, /* Flags */
- GADGIMMEDIATE, /* Activation */
- BOOLGADGET, /* GadgetType */
- NULL, /* GadgetRender */
- NULL, /* SelectRender */
- NULL, /* *GadgetText */
- NULL, /* MutualExclude */
- NULL, /* SpecialInfo */
- NULL, /* GadgetID */
- NULL /* UserData */
- },
- {
- &gadget_load, /* *NextGadget */
- 8, 172-UP, 276, 12, /* LeftEdge, TopEdge, Width, Height */
- GADGHNONE, /* Flags */
- GADGIMMEDIATE, /* Activation */
- BOOLGADGET, /* GadgetType */
- NULL, /* GadgetRender */
- NULL, /* SelectRender */
- NULL, /* *GadgetText */
- NULL, /* MutualExclude */
- NULL, /* SpecialInfo */
- NULL, /* GadgetID */
- NULL /* UserData */
- }
- };
-
-
- /* ********************************************************************* */
- /* * Information for the window */
- /* ********************************************************************* */
-
- struct NewWindow new_file_window=
- {
- 0,11, /* LeftEdge, TopEdge */
- 481, 185, /* Width, Height */
- 0,1, /* DetailPen, BlockPen */
- CLOSEWINDOW| /* IDCMPFlags */
- GADGETDOWN|
- MOUSEMOVE|
- GADGETUP,
- ACTIVATE| /* Flags */
- WINDOWDEPTH|
- WINDOWDRAG|
- WINDOWCLOSE|
- SMART_REFRESH,
- &gadget_display[0], /* *FirstGadget */
- NULL, /* *CheckMark */
- NULL, /* *Title */
- NULL, /* *Screen */
- NULL, /* *BitMap */
- 0,0, /* MinWidth, MinHeight */
- 0,0, /* MaxWidth, MaxHeight */
- WBENCHSCREEN /* Type */
- };
-
-
- /* ======================== THE WIZARD FILER FUNCTION ============== */
-
- USHORT WizardFiler( title, ToShow, ToHide, x, y, screen, total_file_name )
- STRPTR title;
- STRPTR ToShow;
- STRPTR ToHide;
- SHORT x,y;
- struct Screen *screen;
- STRPTR total_file_name;
- {
- int temp2;
- int temp1; /* Variable used for loops etc. */
- int file_count; /* How many files/directories there are. */
-
- ULONG class; /* Saved IntuiMessage: IDCMP flags. */
- APTR address; /* -"- : The address of the object. */
-
- int position; /* The number of the first file in the display. */
-
- BOOL working; /* Wants the user to quit? */
- BOOL fix_display; /* Should we update the file-display? */
-
- STRPTR string_pointer; /* Pointer to a string. */
- struct file_info *pointer; /* Pointer to a file_info structure. */
-
- USHORT operation; /* What operation WizardFiler will return. */
-
-
- file_lock=FALSE; /* We have not locked any file/directory. */
- more_files=FALSE; /* Do not list any files yet. */
-
-
- /* Make sure the proportional gadget is at the top, showing 100%: */
- prop_info.VertBody=0xFFFF;
- prop_info.HorizBody=0;
- prop_info.VertPot=0;
- prop_info.HorizPot=0;
-
-
- /* Copy the ToShow extension into the string gadget: */
- if(ToShow==NULL) strcpy(ToShow_name,"#?");
- else strcpy(ToShow_name, ToShow);
-
- /* Copy the ToHide extension into the string gadget: */
- strcpy(ToHide_name, ToHide);
-
-
- /* Change some values in the new_file_window structure: */
- new_file_window.LeftEdge=x;
- new_file_window.TopEdge=y;
- new_file_window.Title=title;
-
- /* Does the user want to use one of his own screens? */
- if(screen)
- {
- new_file_window.Screen=screen;
- new_file_window.Type=CUSTOMSCREEN;
- }
-
-
- text_1A.IText=mydevname[0];
- text_1B.IText=mydevname[1];
- text_1C.IText=mydevname[2];
- text_1D.IText=mydevname[3];
- text_1E.IText=mydevname[4];
- text_1F.IText=mydevname[5];
- text_1G.IText=mydevname[6];
- text_2A.IText=mydevname[7];
- text_2B.IText=mydevname[8];
- text_2C.IText=mydevname[9];
- text_2D.IText=mydevname[10];
- text_2E.IText=mydevname[11];
- text_2F.IText=mydevname[12];
- text_2G.IText=mydevname[13];
- text_3A.IText=mydevname[14];
- text_3B.IText=mydevname[15];
- text_3C.IText=mydevname[16];
- text_3D.IText=mydevname[17];
- text_3E.IText=mydevname[18];
- text_3F.IText=mydevname[19];
- text_3G.IText=mydevname[20];
-
- OpenDevList();
- for(temp2=0;temp2<21;temp2++)
- {
- if(ReadDevList(mydev[temp2],DLT_DEVICE)==0) break;
- mydevname[temp2][0]=mydev[temp2][0];
- mydevname[temp2][1]=mydev[temp2][1];
- mydevname[temp2][2]=mydev[temp2][2];
- mydevname[temp2][3]=mydev[temp2][3];
- mydevname[temp2][4]=0;
- }
-
- OpenDevList();
- for(;temp2<21;temp2++)
- {
- if(ReadDevList(mydev[temp2],DLT_DIRECTORY)==0) break;
- mydevname[temp2][0]=mydev[temp2][0];
- mydevname[temp2][1]=mydev[temp2][1];
- mydevname[temp2][2]=mydev[temp2][2];
- mydevname[temp2][3]=mydev[temp2][3];
- mydevname[temp2][4]=0;
- }
-
- OpenDevList();
- for(;temp2<21;temp2++)
- {
- if(ReadDevList(mydev[temp2],DLT_VOLUME)==0) break;
- mydevname[temp2][0]=mydev[temp2][0];
- mydevname[temp2][1]=mydev[temp2][1];
- mydevname[temp2][2]=mydev[temp2][2];
- mydevname[temp2][3]=mydev[temp2][3];
- mydevname[temp2][4]=0;
- }
-
-
- /* Open the window: */
- if( (file_window = (struct Window *) OpenWindow(&new_file_window)) == NULL )
- {
- /* We could NOT open the window! */
-
- /* Leave: */
- return(PANIC);
- }
-
-
- Draw3D(file_window->RPort,8,72-UP,276,112,FALSE,POS); /* Big box */
- Draw3D(file_window->RPort,290, 13, 21, 93,FALSE,POS); /* Prop gadget */
- Draw3D(file_window->RPort,290,109, 21, 16,FALSE,POS); /* Parent */
- Draw3D(file_window->RPort,244,166, 68, 15,FALSE,POS); /* GET DIR */
- Draw3D(file_window->RPort,177,166, 61, 15,FALSE,POS); /* CANCEL */
- Draw3D(file_window->RPort,110,166, 61, 15,FALSE,POS); /* DELETE */
- Draw3D(file_window->RPort, 59,166, 45, 15,FALSE,POS); /* SAVE */
- Draw3D(file_window->RPort, 8,166, 45, 15,FALSE,POS); /* LOAD */
- Draw3D(file_window->RPort,352,147,121, 16,FALSE,POS); /* ToShow a */
- Draw3D(file_window->RPort,354,148,117, 14,FALSE,NEG); /* ToShow i */
- Draw3D(file_window->RPort,352,165,121, 16,FALSE,POS); /* ToHide a */
- Draw3D(file_window->RPort,354,166,117, 14,FALSE,NEG); /* ToHide i */
- Draw3D(file_window->RPort, 58,147,254, 16,FALSE,POS); /* File a */
- Draw3D(file_window->RPort, 60,148,250, 14,FALSE,NEG); /* File i */
- Draw3D(file_window->RPort, 74,128,238, 16,FALSE,POS); /* Drawer a */
- Draw3D(file_window->RPort, 76,129,234, 14,FALSE,NEG); /* Drawer i */
-
- Draw3D(file_window->RPort,326, 13, 45, 15,FALSE,POS); /* 1A */
- Draw3D(file_window->RPort,326, 31, 45, 15,FALSE,POS); /* 1B */
- Draw3D(file_window->RPort,326, 49, 45, 15,FALSE,POS); /* 1C */
- Draw3D(file_window->RPort,326, 67, 45, 15,FALSE,POS); /* 1D */
- Draw3D(file_window->RPort,326, 85, 45, 15,FALSE,POS); /* 1E */
- Draw3D(file_window->RPort,326,103, 45, 15,FALSE,POS); /* 1F */
- Draw3D(file_window->RPort,326,121, 45, 15,FALSE,POS); /* 1G */
-
- Draw3D(file_window->RPort,377, 13, 45, 15,FALSE,POS); /* 2A */
- Draw3D(file_window->RPort,377, 31, 45, 15,FALSE,POS); /* 2B */
- Draw3D(file_window->RPort,377, 49, 45, 15,FALSE,POS); /* 2C */
- Draw3D(file_window->RPort,377, 67, 45, 15,FALSE,POS); /* 2D */
- Draw3D(file_window->RPort,377, 85, 45, 15,FALSE,POS); /* 2E */
- Draw3D(file_window->RPort,377,103, 45, 15,FALSE,POS); /* 2F */
- Draw3D(file_window->RPort,377,121, 45, 15,FALSE,POS); /* 2G */
-
- Draw3D(file_window->RPort,428, 13, 45, 15,FALSE,POS); /* 3A */
- Draw3D(file_window->RPort,428, 31, 45, 15,FALSE,POS); /* 3B */
- Draw3D(file_window->RPort,428, 49, 45, 15,FALSE,POS); /* 3C */
- Draw3D(file_window->RPort,428, 67, 45, 15,FALSE,POS); /* 3D */
- Draw3D(file_window->RPort,428, 85, 45, 15,FALSE,POS); /* 3E */
- Draw3D(file_window->RPort,428,103, 45, 15,FALSE,POS); /* 3F */
- Draw3D(file_window->RPort,428,121, 45, 15,FALSE,POS); /* 3G */
-
-
- /* Allocate memory for the FileInfoBlock: */
- if((file_info=(struct FileInfoBlock *)
- AllocMem(sizeof(struct FileInfoBlock), MEMF_PUBLIC|MEMF_CLEAR))==NULL)
- {
- /* Could not allocate memory for the FileInfoBlock! */
- /* Inform the user about the problem, and leave. */
- request_ok("NOT enough memory!");
- return(PANIC);
- }
-
-
- /* Is the there anything in the total_file_name string? */
- if(*total_file_name != '\0')
- {
- /* Yes! */
- /* Try to "lock" the file/directory: */
- if((lock=Lock(total_file_name, ACCESS_READ))==NULL)
- {
- /* PROBLEMS! */
- /* File/directory/device did NOT exist! */
- }
- else
- {
- /* Could lock the file/directory! */
- file_lock=TRUE;
-
- /* Get some information of the file/directory: */
- if((Examine(lock, file_info))==NULL)
- {
- /* Could NOT examine the object! */
- request_ok("ERROR reading file/directory!");
- }
- else
- {
- /* Is it a directory or a file? */
- if(directory(file_info))
- {
- /* It is a directory! */
-
- *file_name='\0'; /* Clear file_name string. */
- /* Copy total_file_name into drawer_name string: */
- strcpy(drawer_name, total_file_name);
-
- /* Since it is a directory, we will look for more files: */
- more_files=TRUE;
- }
- else
- {
- /* It is a file! */
-
- /* Separate the file name from the path: */
- if(string_pointer=right_pos(total_file_name, '/'))
- {
- /* Copy the file name into file_name string: */
- strcpy(file_name, string_pointer+1);
- *string_pointer='\0';
- }
- else
- {
- if(string_pointer=right_pos(total_file_name, ':'))
- {
- /* Copy the file name into file_name string: */
- strcpy(file_name, string_pointer+1);
- *(string_pointer+1)='\0';
- }
- else
- {
- strcpy(file_name, total_file_name);
- *drawer_name='\0';
- *total_file_name='\0';
- }
- }
- strcpy(drawer_name, total_file_name);
-
- /* Since it is a file, we will NOT look for more files: */
- /* However, more_files is already FALSE. */
-
- } /* Is it a directory? */
-
- } /* Could we examine the object? */
-
- } /* Could we "lock" the file/directory? */
-
- } /* Anything in the total_file_name string? */
-
-
- /* Since we have messed around with the string gadgets it is best */
- /* to adjust them so the user can see them clearly: */
- adjust_string_gadgets();
-
-
- new_drawer(); /* Start to show us the files. */
-
-
- position=0; /* The display will show the first file. */
- fix_display=FALSE; /* We do not need to fix the display. */
- first_file=TRUE; /* No files saved. */
- file_count=0; /* No files saved. */
-
-
- working=TRUE;
- do
- {
- /* If we have shown all files in the directory, we put our task */
- /* to sleep. That will speed up other programs, and we will not */
- /* use unnecessary processing time: */
- if(more_files==FALSE)
- Wait(1 << file_window->UserPort->mp_SigBit);
-
-
- /* Has something has happened with the gadgets in the file_window? */
- while(my_gadget_message = (struct IntuiMessage *)
- GetMsg(file_window->UserPort))
- {
- /* As long as something is happening with the gadgets we will */
- /* stay in the while loop. This is very handy since we can */
- /* recieve hundereds of messages if the mouse is moving, and */
- /* we only want to update the display when the mouse has stopped: */
-
- /* Collect some interesting values: */
- class = my_gadget_message->Class;
- address = my_gadget_message->IAddress;
-
- /* We have now saved some important values, and can now reply: */
- /* (Do NEVER try to get some values after you have replied!) */
- ReplyMsg((struct Message *)my_gadget_message);
-
-
- /* What has actually happened? */
- switch(class)
- {
- case MOUSEMOVE:
- /* The proportional gadget is selected, and the mouse is */
- /* moving; we must update the file_display when the mouse */
- /* has stopped: */
- fix_display=TRUE;
- break;
-
- case CLOSEWINDOW:
- /* The user wants to quit. */
- connect_dir_file(total_file_name);
- working=FALSE;
- operation=QUIT;
- break;
-
- case GADGETDOWN:
- /* A gadget has been pressed down. */
- /* Which gadget has been clicked on? */
-
- /* DISPLAY */
- /* Is the user clicking inside the file display? */
- for(temp1=0; temp1 < 13; temp1++)
- {
- if(address == (APTR)&gadget_display[temp1])
- {
- /* The user wants to select a file/directory: */
- pick_file(temp1+position);
- }
- }
- break;
-
-
- case GADGETUP:
- /* A gadget has been released. */
- /* Which gadget has been clicked on? */
-
-
- /* LOAD */
- if(address == (APTR)&gadget_load)
- {
- if(last_check(total_file_name))
- {
- working=FALSE;
- operation=LOAD;
- }
- break;
- }
-
-
- /* SAVE */
- if(address == (APTR)&gadget_save)
- {
- if(last_check(total_file_name))
- {
- working=FALSE;
- operation=SAVE;
- }
- break;
- }
-
-
- /* DELETE */
- if(address == (APTR)&gadget_delete)
- {
- delete_file_dir(total_file_name);
- break;
- }
-
-
- /* CANCEL */
- if(address == (APTR)&gadget_cancel)
- {
- connect_dir_file(total_file_name);
- working=FALSE;
- operation=CANCEL;
- break;
- }
-
-
- /* 1A */
- if(address == (APTR)&gadget_1A)
- {
- change_device(mydev[0]);
- break;
- }
-
-
- /* 1B */
- if(address == (APTR)&gadget_1B)
- {
- change_device(mydev[1]);
- break;
- }
-
-
- /* 1C */
- if(address == (APTR)&gadget_1C)
- {
- change_device(mydev[2]);
- break;
- }
-
-
- /* 1D */
- if(address == (APTR)&gadget_1D)
- {
- change_device(mydev[3]);
- break;
- }
-
-
- /* 1E */
- if(address == (APTR)&gadget_1E)
- {
- change_device(mydev[4]);
- break;
- }
-
-
- /* 1F */
- if(address == (APTR)&gadget_1F)
- {
- change_device(mydev[5]);
- break;
- }
-
-
- /* 1G */
- if(address == (APTR)&gadget_1G)
- {
- change_device(mydev[6]);
- break;
- }
-
-
- /* 2A */
- if(address == (APTR)&gadget_2A)
- {
- change_device(mydev[7]);
- break;
- }
-
-
- /* 2B */
- if(address == (APTR)&gadget_2B)
- {
- change_device(mydev[8]);
- break;
- }
-
-
- /* 2C */
- if(address == (APTR)&gadget_2C)
- {
- change_device(mydev[9]);
- break;
- }
-
-
- /* 2D */
- if(address == (APTR)&gadget_2D)
- {
- change_device(mydev[10]);
- break;
- }
-
-
- /* 2E */
- if(address == (APTR)&gadget_2E)
- {
- change_device(mydev[11]);
- break;
- }
-
-
- /* 2F */
- if(address == (APTR)&gadget_2F)
- {
- change_device(mydev[12]);
- break;
- }
-
-
- /* 2G */
- if(address == (APTR)&gadget_2G)
- {
- change_device(mydev[13]);
- break;
- }
-
-
- /* 3A */
- if(address == (APTR)&gadget_3A)
- {
- change_device(mydev[14]);
- break;
- }
-
-
- /* 1B */
- if(address == (APTR)&gadget_1B)
- {
- change_device(mydev[15]);
- break;
- }
-
-
- /* 3C */
- if(address == (APTR)&gadget_3C)
- {
- change_device(mydev[16]);
- break;
- }
-
-
- /* 3D */
- if(address == (APTR)&gadget_3D)
- {
- change_device(mydev[17]);
- break;
- }
-
-
- /* 3E */
- if(address == (APTR)&gadget_3E)
- {
- change_device(mydev[18]);
- break;
- }
-
-
- /* 3F */
- if(address == (APTR)&gadget_3F)
- {
- change_device(mydev[19]);
- break;
- }
-
-
- /* 3G */
- if(address == (APTR)&gadget_3G)
- {
- change_device(mydev[20]);
- break;
- }
-
-
- /* DRAWER: */
- if(address == (APTR)&gadget_drawer)
- {
- /* The user has entered something new in the drawer: */
- new_drawer();
- break;
- }
-
-
- /* ToShow: */
- if(address == (APTR)&gadget_ToShow)
- {
- new_drawer();
- break;
- }
-
-
- /* ToHide: */
- if(address == (APTR)&gadget_ToHide)
- {
- new_drawer();
- break;
- }
-
-
- /* GET DIR */
- if(address == (APTR)&gadget_getdir)
- {
- new_drawer();
- break;
- }
-
-
- /* PARENT: "<" */
- if(address == (APTR)&gadget_parent)
- {
- parent();
- break;
- }
-
-
- /* PROPORTIONAL */
- if(address == (APTR)&gadget_proportional)
- {
- /* The user has released the proprtional gadget, update */
- /* the display: */
- fix_display=TRUE;
- break;
- }
- }
- }
-
-
- /* Do we need to update the file display? */
- if(fix_display)
- {
- fix_display=FALSE;
-
- /* Which file should we start to show in the display? */
- if(file_count > 13)
- position=(int)((LONG)(prop_info.VertPot)*(LONG)(file_count-13)/(LONG)0xFFFF);
- else
- position=0;
-
- /* List the files: (Starting with position) */
- display_list(position);
- }
-
-
- if(more_files)
- {
- /* Are there more files/dirtectories left to be collected? */
- if(ExNext(lock, file_info))
- {
- /* List the file/directory if it is: */
- /* 1. A file which has the right pattern. */
- /* 2. A directory. */
-
- if(CompiledOK1 && CompiledOK2)
- {
- if((Match(ShowPat,Aux1,file_info->fib_FileName)==TRUE &&
- Match(HidePat,Aux2,file_info->fib_FileName)==FALSE) ||
- directory(file_info) )
- {
- /* Is this the first file/directory? */
- if(first_file)
- {
- /* first_pointer will point at the first file in our list: */
- first_pointer=(struct file_info *) save_file_info(file_info);
-
- if(first_pointer != NULL)
- {
- /* There are no more elements (for the moment) in our list: */
- first_pointer->next=NULL;
- first_file=FALSE;
- }
- file_count=1;
- position=1;
- }
- else
- {
- /* save_file_info will return a pointer to the allocated */
- /* structure: */
- pointer=(struct file_info *) save_file_info(file_info);
-
- /* If we have been able to allocate space for the file we */
- /* put it into our list: */
- if(pointer !=NULL)
- {
- /* Put the new structure into the list: */
- put_in(first_pointer, pointer);
- file_count++;
- }
- }
-
- /* If there are more than 13 files/directories we modify */
- /* the proportional gadget: */
- if(file_count > 13)
- {
- ModifyProp
- (
- &gadget_proportional, /* PropGadget */
- file_window, /* Pointer */
- NULL, /* Requester */
- prop_info.Flags, /* Flags */
- 0, /* HorizPot */
- prop_info.VertPot, /* VertPot */
- 0, /* HorizBody */
- (ULONG) 0xFFFF*13/file_count /* VerBody */
- );
- position=(int)((LONG)(prop_info.VertPot)*(LONG)(file_count-13)/(LONG)0xFFFF);
- }
- else
- position=0;
-
-
- /* List all the files: */
- display_list(position);
- }}
- }
- else
- {
- /* ExNext() failed: */
-
- more_files=FALSE; /* Do not try to list any more files. */
-
- /* Check what went wrong: */
- /* If the error message is NOT "ERROR_NO_MORE_ENTRIES" something */
- /* went terrible wrong while reading: */
- if(IoErr() != ERROR_NO_MORE_ENTRIES)
- {
- request_ok("ERROR reading file/directory!");
- }
- }
- }
- } while(working);
-
- /* Clean up and leave: */
-
-
- /* This will clear the IDCMP port: */
- while( (my_gadget_message = (struct IntuiMessage *)
- GetMsg(file_window->UserPort)) )
- {
- ReplyMsg((struct Message *)my_gadget_message);
- }
-
-
- /* Deallocate the memory we have dynamically allocated: */
- deallocate_file_info();
-
-
- /* If we have "locked" a file/directory, "unlock" it: */
- if(file_lock)
- {
- UnLock(lock);
- file_lock=FALSE;
- }
-
-
- /* Deallocate FileInfoBlock: */
- if(file_info) FreeMem(file_info, sizeof(struct FileInfoBlock));
-
-
- /* If we have successfully opened the file_window, we close it: */
- if(file_window)
- CloseWindow(file_window);
-
- /* Leave with a message: */
- return(operation);
- }
-
-
-
- /* ============= Deallocate the memory we have dynamically allocated: == */
-
- void deallocate_file_info()
- {
- struct file_info *pointer, *temp_pointer;
-
- /* Does the first pointer point to an allocated structure? */
- if(first_pointer)
- {
- /* Save the address of the next structure: */
- pointer=first_pointer->next;
-
- /* Deallocate the first structure: */
- FreeMem( first_pointer, sizeof(struct file_info));
-
- /* As long as pointer points to an allocated structure: */
- while(pointer)
- {
- /* Save the address of the next structure: */
- temp_pointer=pointer->next;
-
- FreeMem( pointer, sizeof(struct file_info));
- pointer=temp_pointer;
- }
- }
-
- /* Clear first_pointer: */
- first_pointer=NULL;
-
- /* Next time we try to list the files, we start with the first_file: */
- first_file=TRUE;
- }
-
-
- /* =================================================================== */
- /* Allocate memory for the new file/directory, and fills the structure */
- /* with information. (name of the object, and if it is a directory.) */
- /* Returns a memory pointer to the allocated structure, or NULL. */
-
- APTR save_file_info(info)
- struct FileInfoBlock *info;
- {
- struct file_info *pointer;
-
- if((pointer=(struct file_info *)
- AllocMem(sizeof(struct file_info), MEMF_PUBLIC|MEMF_CLEAR))==NULL)
- {
- /* We could NOT allocate memory for the structure! */
- request_ok("NOT enough memory!"); /* Inform the user. */
- more_files=FALSE; /* Do not list any more files/directories. */
- return(NULL);
- }
- else
- {
- /* If the file/directory name is not too long, we copy it into the */
- /* new stucture: */
- if(strlen(info->fib_FileName) < 28)
- strcpy(pointer->name, info->fib_FileName);
- else
- {
- /* The file/directory name is too long! */
- /* Inform the user: */
-
- if( directory(info))
- request_ok("Directory name too long!"); /* It is a directory. */
- else
- request_ok("File name too long!"); /* It is a file. */
-
- /* Deallocate the structure: */
- FreeMem( pointer, sizeof(struct file_info));
- return(NULL);
- }
-
- /* Is it a file or a directory? */
- if( directory(info))
- pointer->directory=TRUE; /* It is a directory. */
- else
- pointer->directory=FALSE; /* It is a file. */
- }
-
- /* Return the address of the allocated structure: */
- return( (APTR) pointer);
- }
-
-
- /* ========================================================== */
- /* Will check a FileInfoBlock if it is a file or a directory. */
- /* Return TRUE if it is a directory, FALSE if it is a file. */
-
- BOOL directory(info)
- struct FileInfoBlock *info;
- {
- if(info->fib_DirEntryType < 0)
- return(FALSE);
- else
- return(TRUE);
- }
-
-
- /* ================================================================ */
- /* Put the new structure into the dynamically allocated list at the */
- /* right place (sorted alphabetically, directories first): */
-
- void put_in(a_pointer, pointer)
- struct file_info *a_pointer, *pointer;
- {
- struct file_info *old_pointer=NULL;
-
- /* Move slowly down the list and try to fit in the structure: */
- while( a_pointer && file_comp(a_pointer->name, pointer->name) )
- {
- old_pointer=a_pointer;
- a_pointer=a_pointer->next;
- }
-
- if(a_pointer)
- {
- if(old_pointer)
- {
- /* Put the structure into the list: */
- pointer->next=old_pointer->next;
- old_pointer->next=pointer;
- }
- else
- {
- /* First in the list! */
- pointer->next=first_pointer;
- first_pointer=pointer;
- }
- }
- else
- {
- /* Last int the list: */
- old_pointer->next=pointer;
- pointer->next=NULL;
- }
- }
-
-
- /* =============================================================== */
- /* This function will return TRUE if the first pointer (a_pointer) */
- /* points to a file structure which should come before the second */
- /* pointers file structure. */
- /* ORDER: */
- /* 1. DIRECTORIES sorted alphabetically. */
- /* 2. FILES sorted alphabetically. */
-
- BOOL file_comp(a_pointer, pointer)
- struct file_info *a_pointer, *pointer;
- {
- if(a_pointer->directory == FALSE && pointer->directory)
- return(FALSE);
-
- if(a_pointer->directory == pointer->directory)
- {
- if(stricmp(a_pointer->name, pointer->name) <= 0 )
- return(TRUE);
- else
- return(FALSE);
- }
- return(TRUE);
- }
-
-
- /* ================================================================= */
- /* Give this function a string and a character, and it will return a */
- /* pointer to the right most occurance character in you string which */
- /* match your character. */
-
- STRPTR right_pos(string, sign)
- STRPTR string;
- char sign;
- {
- STRPTR start_pos;
-
- start_pos=string;
-
- /* Go to the end: */
- while(*string != '\0')
- string++;
-
- /* Start to go backwards and check the string: */
- while(*string != sign && string > start_pos)
- string--;
-
- if(*string==sign)
- return(string); /* We have found a matching character. */
-
- return(NULL); /* We could not find a matching character. */
- }
-
-
- /* ============================================================ */
- /* This function will change to a new device, for example df0:. */
- /* Does not return anything. */
-
- void change_device(device)
- STRPTR device;
- {
- strcpy(drawer_name, device); /* Change the drawer string. */
-
- adjust_string_gadgets(); /* Adjust the string gadgets. */
-
- new_drawer(); /* Start to show us the new files/directories */
- }
-
-
- /* ===================================================================== */
- /* When the user or the program has changed the drawer string, this */
- /* function is called, and will do what is necessary to start to collect */
- /* the new files/directories from the disk. */
- /* Returns TRUE if everything is OK, and FALSE if something went wrong. */
-
- BOOL new_drawer()
- {
- STRPTR string_pointer;
-
- /* Compile Patterns: */
- if(ToShow_name[0]=='\0') strcpy(ShowPat,"/");
- else strcpy(ShowPat, ToShow_name);
- if(ToHide_name[0]=='\0') strcpy(HidePat,"/");
- else strcpy(HidePat, ToHide_name);
- CompiledOK1=CmplPat(ShowPat,Aux1);
- CompiledOK2=CmplPat(HidePat,Aux2);
-
- /* Unlock: */
- if(file_lock)
- {
- UnLock(lock);
- file_lock=FALSE;
- }
-
- /* Deallocate the memory we have dynamically allocated: */
- deallocate_file_info();
-
- /* Change the proportianal gadget: */
- ModifyProp
- (
- &gadget_proportional, /* PropGadget */
- file_window, /* Pointer */
- NULL, /* Requester */
- prop_info.Flags, /* Flags */
- 0, /* HorizPot */
- 0, /* VertPot */
- 0, /* HorizBody */
- (ULONG) 0xFFFF /* VerBody */
- );
-
- /* Clear the display: */
- display_list(0);
-
- more_files=FALSE;
-
- /* Try to "lock" the file/directory: */
- if((lock=Lock(drawer_name, ACCESS_READ))==NULL)
- {
- /* We could NOT lock the file/directory/device! */
- /* Inform the user: */
- string_pointer=drawer_name+strlen(drawer_name)-1;
- if(*string_pointer==':')
- request_ok("Device NOT found!");
- else
- request_ok("Device/Directory NOT found!");
-
- return(FALSE); /* ERROR */
- }
- else
- {
- /* We "locked" the file/directory! */
- file_lock=TRUE;
- }
-
- /* Now try to get some information from the file/directory: */
- if((Examine(lock, file_info))==NULL)
- {
- /* We could NOT examine the file/directory! */
-
- request_ok("ERROR reading file/directory!"); /* Inform the user. */
-
- return(FALSE); /* ERROR */
- }
-
- /* Is it a directory or a file? */
- if(directory(file_info))
- {
- /* It is a directory! */
-
- /* Since it is a directory, we will look for more files: */
- more_files=TRUE;
- }
- else
- {
- /* It is a file! */
- request_ok("NOT a valid directory name!"); /* Inform the user. */
- return(FALSE);
- }
- return(TRUE);
- }
-
-
- /* ============================================================== */
- /* The function parent() will try to go backwards one step in the */
- /* directory path. */
- /* Does not return anything. */
-
- void parent()
- {
- STRPTR string_pointer;
-
- /* Separate the last directory from the path: */
- if(string_pointer=right_pos(drawer_name, '/'))
- {
- /* Take away the last directory: */
- *string_pointer='\0';
- }
- else
- {
- if(string_pointer=right_pos(drawer_name, ':'))
- {
- /* Take away the last directory: */
- /* Only the device ("df0:" for example) left: */
- *(string_pointer+1)='\0';
- }
- else
- {
- /* Strange drawer_name, clear it: */
- *drawer_name='\0';
- }
- }
-
- /* Since we have messed around with the string gadgets, adjust them: */
- adjust_string_gadgets();
-
- /* Start to show the user the files etc in the new directory: */
- new_drawer();
- }
-
-
- /* ===================================================================== */
- /* You give this function a pointer to an error string, and it will open */
- /* a simple requester displaying the message. The requester will go away */
- /* first when the user has selected the button "OK". */
- /* Does not return anything. */
-
- void request_ok(message)
- STRPTR message;
- {
- text_request.IText=message;
-
- AutoRequest
- (
- file_window, /* Window */
- &text_request, /* BodyText */
- NULL, /* PositiveText nothing */
- &ok_request, /* NegativeText OK */
- NULL, /* PositiveFlags */
- NULL, /* NegativeFlags */
- 320, /* Width */
- 72 /* Height */
- );
- }
-
-
- /* ====================================================================== */
- /* This function will also open a simple requester, but will instead */
- /* ask the user to make a choice between option1 or option2 */
- /* If the user selects option1 the function returns TRUE, else it returns */
- /* FALSE. */
-
- BOOL request_ask(message, option1, option2)
- STRPTR message, option1, option2;
- {
- text_request.IText=message;
- option1_request.IText=option1;
- option2_request.IText=option2;
-
-
- return( (BOOL) AutoRequest
- (
- file_window, /* Window */
- &text_request, /* BodyText */
- &option1_request, /* PositiveText, TRUE */
- &option2_request, /* NegativeText, FALSE */
- NULL, /* PositiveFlags */
- NULL, /* NegativeFlags */
- 320, /* Width */
- 72 /* Height */
- ));
- }
-
-
- /* ============================================================= */
- /* This function will display the files etc which are inside the */
- /* directory, starting with the file number start_pos. */
- /* Does not return anything. */
-
- void display_list(start_pos)
- int start_pos;
- {
- struct file_info *pointer;
- int pos, temp1;
- /* 123456789012345678901234567890123 */
- char empty_name[]=" ";
- STRPTR string_pointer;
- BOOL clear;
-
- pos=0;
-
- /* Does it exist any files at all? */
- if(first_pointer)
- {
- pointer=first_pointer;
-
- /* Go through the list until you have found the file/directory */
- /* which should be shown first: */
- while(pointer && pos < start_pos)
- {
- pos++;
- pointer=pointer->next;
- }
-
- /* Try to show the eight files: */
- pos=0;
- while(pointer && pos < 13)
- {
- strcpy(display_text[pos], pointer->name);
-
- clear=FALSE;
- temp1=0;
- string_pointer=display_text[pos];
-
- if(pointer->directory)
- {
- /* It is a directory: */
- text_list[pos].FrontPen=3; /* Highlight it. */
-
- /* Clear everything after the name, and add the string "(Dir)". */
- while(temp1 < 28)
- {
- if(*string_pointer=='\0')
- clear=TRUE;
- if(clear)
- *string_pointer=' ';
- string_pointer++;
- temp1++;
- }
- *string_pointer='\0';
- strcat(display_text[pos], "(Dir)");
- }
- else
- {
- /* It is a file: */
- text_list[pos].FrontPen=1; /* Normal colour. */
-
- /* Clear everything after the name: */
- while(temp1 < 33)
- {
- if(*string_pointer=='\0')
- clear=TRUE;
- if(clear)
- *string_pointer=' ';
- string_pointer++;
- temp1++;
- }
- *string_pointer='\0';
- }
- pos++;
- pointer=pointer->next; /* Next. */
- }
- }
-
- /* If there are less than eight files, show clear the rest of the */
- /* display: */
- while(pos < 13)
- {
- strcpy(display_text[pos], empty_name);
- pos++;
- }
-
- /* Show the user the new display: */
- PrintIText(file_window->RPort, text_list, 13+3, 53+1);
- }
-
-
- /* =================================================================== */
- /* The user has selected a file or a directory. If it is a file put it */
- /* into the file string, otherwise put it into the drawer string. */
- /* Returns TRUE if everything went OK, FALSE if there was a problem. */
-
- BOOL pick_file(file_pos)
- int file_pos;
- {
- struct file_info *pointer=NULL;
- STRPTR string_pointer;
- int pos=0;
-
- /* Go through the allocated list untill we find the file/directory: */
- if(first_pointer)
- {
- pointer=first_pointer;
-
- while(pointer && pos < file_pos)
- {
- pos++;
- pointer=pointer->next;
- }
- }
-
- /* Have we found the file/directory? */
- if(pointer)
- {
- if(pointer->directory)
- {
- /* It is a directory! */
-
- /* Is the drawer_name string long enough? */
- /* (+2: 1 for the NULL ('\0') character, 1 for the '\' character) */
- if((strlen(pointer->name)+strlen(drawer_name)+2) <= DRAWER_LENGTH)
- {
- /* YES!, there is enough room for it. */
- string_pointer=drawer_name+strlen(drawer_name)-1;
- if(*string_pointer==':' || *string_pointer=='\0' )
- strcat(drawer_name, pointer->name);
- else
- {
- /* We need to add a '/' before we can add the directory. */
- strcat(drawer_name, "/");
- strcat(drawer_name, pointer->name);
- }
-
- /* Adjust the string gadgets: */
- adjust_string_gadgets();
- }
- else
- {
- /* The drawer_name is NOT big enough! */
- request_ok("Too long drawer string"); /* Inform the user. */
- return(FALSE); /* ERROR */
- }
- new_drawer();
- return(TRUE); /* OK */
- }
- else
- {
- /* It is a File! */
- /* Is the file_name string long enough? */
- /* (+1 for the NULL ('\0') character.) */
- if((strlen(pointer->name)+1) <= FILE_LENGTH)
- {
- strcpy(file_name, pointer->name);
- adjust_string_gadgets();
- }
- else
- {
- /* The file_name is NOT big enough! */
- request_ok("File name too long!"); /* Inform the user. */
- return(FALSE); /* ERROR */
- }
- return(TRUE); /* OK */
- }
- }
- }
-
-
- /* ========================================== */
- /* Adjust the string gadgets, so the user can */
- /* at least see the last 28/22 characters. */
- /* Does not return anything. */
- void adjust_string_gadgets()
- {
- int length;
-
- length=strlen(file_name);
-
- if(length > 28)
- string_file.DispPos=length-28;
- else
- string_file.DispPos=0;
-
- string_file.BufferPos=string_file.DispPos;
-
-
- length=strlen(drawer_name);
-
- if(length > 22)
- string_drawer.DispPos=length-22;
- else
- string_drawer.DispPos=0;
-
- string_drawer.BufferPos=string_drawer.DispPos;
-
- /* Display the changes. */
- RefreshGadgets(&gadget_file, file_window, NULL);
- }
-
-
- /* ========= Returns TRUE if there exist a file name, otherwise FALSE. == */
-
- BOOL last_check(name)
- STRPTR name;
- {
- if(*file_name == '\0')
- {
- /* No file name! */
- request_ok("NO filename selected!"); /* Inform the user. */
- return(FALSE);
- }
- else
- {
- /* Change the total_file_name. Drawer + File. */
- connect_dir_file(name);
- }
- return(TRUE);
- }
-
-
-
- /* ============== Connect the drawer string with the file string. ======= */
- /* Does not return anything. */
-
- void connect_dir_file(name)
- STRPTR name;
- {
- STRPTR string_pointer;
-
- strcpy(name, drawer_name); /* Copy the drawer string into name. */
-
- /* Does it exist a file name? */
- if(*file_name != '\0')
- {
- /* Yes! */
- string_pointer=drawer_name+strlen(drawer_name)-1;
- if(*string_pointer==':' || *string_pointer=='\0' )
- {
- strcat(name, file_name); /* Add the file name. */
- }
- else
- {
- strcat(name, "/"); /* Add a '\'. */
- strcat(name, file_name); /* Add the file name. */
- }
- }
- }
-
-
- /* ========================= */
- /* Does not return anything. */
-
- void delete_file_dir(total_file_name)
- STRPTR total_file_name;
- {
- BOOL delete_it;
-
- /* Presume the user do not want to deleta the file/dir: */
- delete_it=FALSE;
-
- if(*file_name == '\0' && *drawer_name != '\0')
- {
- /* There is no filename string, but there is something */
- /* in the drawer string. The user wants to delete a */
- /* directory: */
-
- /* Is it a device or a directory? */
- if( *(drawer_name+strlen(drawer_name)-1) ==':')
- {
- /* The user wants to delete a device: */
- /* Not a very good idea! */
- request_ok("You can NOT delete a device!");
- }
- else
- {
- /* The user wants to delete a directory: */
-
- /* However, it is important to check that the user */
- /* realy wants to delete it: */
- delete_it=request_ask("OK to delete directory?","DELETE","CANCEL");
-
- if(delete_it)
- {
- /* YES! The user wanted to delete the directory. */
- /* Before we try to delete it we must "unlock" it */
- if(file_lock)
- {
- UnLock(lock);
- file_lock=FALSE;
- }
- }
- }
- }
- else
- {
- if(*file_name != '\0')
- {
- /* There is something in the file_name string. The user */
- /* wants to delete a file: */
-
- /* We will here again give the user a last chance to */
- /* make up his/her mind: */
- delete_it=request_ask("OK to delete file?","DELETE","CANCEL");
- }
- else
- {
- /* Nothing in the drawer string, nor in the file string. */
- /* The user wants to delete something, but has NOT */
- /* declared which file/directory he/she wants to delete: */
- request_ok("NO file/directory selected!");
- }
- }
-
- /* Should we delete the file/directory? */
- if(delete_it)
- {
- /* Yes! */
-
- /* Put the drawer name together with the file name: */
- connect_dir_file(total_file_name);
-
- /* We try to delete the file/directory: */
- if(DeleteFile(total_file_name))
- {
- /* We have deleted the file/directory successfully: */
- if(*file_name != '\0')
- {
- /* A file was deleted: */
- *file_name='\0'; /* Take away the file name. */
- adjust_string_gadgets(); /* Adjust the string gadgets. */
- new_drawer(); /* Show the user the remaining files. */
- }
- else
- {
- /* A directory was deleted: */
- parent(); /* Go back one directory. */
- }
- }
- else
- {
- /* Something went wrong: */
- if(*file_name != '\0')
- request_ok("Could NOT delete the file!");
- else
- request_ok("Could NOT delete directory!");
-
- /* Since we have unlocked the directory/file we have */
- /* to lock it again, and clean up the display: */
- new_drawer();
- }
- }
- }
-
-
- /* ==================== DRAW A 3D GADGET ======================= */
-
- void __regargs Draw3D(struct RastPort *rp,ULONG x,ULONG y,ULONG w,ULONG h,BOOL cl,BOOL posneg)
- {
- h--;
- w--;
-
- if(cl)
- {
- SetAPen(rp,0);
- RectFill(rp,x+2,y+1,x+w-2,y+h-1);
- }
-
- if(posneg==POS) SetAPen(rp,2);
- else SetAPen(rp,1);
- Move(rp,x+w,y);
- Draw(rp,x,y);
- Draw(rp,x,y+h);
- Move(rp,x+1,y);
- Draw(rp,x+1,y+h-1);
-
- if(posneg==POS) SetAPen(rp,1);
- else SetAPen(rp,2);
- Move(rp,x+1,y+h);
- Draw(rp,x+w,y+h);
- Draw(rp,x+w,y);
- Move(rp,x+w-1,y+h);
- Draw(rp,x+w-1,y+1);
- }
-
-
- /* THE END */
-