/*
 * Header file for the PathMaster File Selector.
 * Copyright © 1989 by Justin V. McCormick.  All Rights Reserved.
 */

#define STANDALONE 1

#ifdef _lint
#define __regargs
#define __stdargs
#define __fARGS(a) ()
#define LATTICE 1
#endif

#ifdef AZTEC_C
#define __regargs
#define __stdargs
#define __fARGS(a) ()
#define __ARGS(a) ()
#endif

#ifndef __fARGS
#define __fARGS(a) a
#endif

#define LABELFPEN	3	/* Forecolor for text labels */
#define LABELBPEN	0	/* Backcolor for text labels */

#define GADTFPEN	0	/* Gadget text forecolor */
#define GADTBPEN	1	/* Gadget text backcolor */

#define GADFILLPEN	1	/* Gadget interior pen */
#define GADBORDPEN	3	/* Gadget border pen   */

#define ARROWFPEN	1	/* Pen used for drawing arrows */
#define ARROWBPEN	3	/* Arrow gadget border pen     */

#define SBORDFPEN	1	/* String and File area border pen */
#define SBORDBPEN	0	/* Backcolor (not really useful	   */

#define FPEN		1	/* Pen for rendering file names      */
#define DPEN		3	/* Pen for rendering directory names */
#define FDBPEN  	0	/* Backfill pen for files & dirs     */

#define PATHSTRSIZE	300	/* 10 subdirs worth of space    */
#define FILESTRSIZE	32	/* Room for filename + null + roundoff	*/
#define MATCHSTRSIZE	32	/* Room for 30 char pattern + null + "  */

/* File node structure */
struct node_data
{
  BYTE alphadata[58];		/* ascii data	  		*/
  WORD filetype;		/* Dir or file flag 		*/
  WORD showit;			/* 0=skip, 1=showable		*/
  WORD textcolor;		/* Color to render this file as	*/
  WORD namelength;		/* Actual length of file name 	*/
  ULONG filesize;		/* File size in bytes		*/
  ULONG days;			/* File creation date		*/
  ULONG minutes;
  ULONG ticks;
};

struct file_node
{
  struct MinNode fn_Node;	/* Exec List linkage	*/
  struct node_data *info;	/* file info structure	*/
  WORD idnum;			/* numerical list position */
};

/* Struct for list of Devices found */
struct dev_node
{
  struct MinNode dn_Node;
  UBYTE name[FILESTRSIZE];
};

/* File selector request structure */
struct FSRequest
{
  BYTE dirname[PATHSTRSIZE];       /* Contents of the "PATH" string gadget	*/
  BYTE filename[FILESTRSIZE];      /* Contents of the "FILE" string gadget 	*/
  BYTE matchpattern[MATCHSTRSIZE]; /* Contents of the "PATTERN" string gadget 	*/
  WORD leftedge;             /* Window initial x position, user modifiable	*/
  WORD topedge;		     /* Window initial y position			*/
  WORD sorttype;             /* -1=NoSort,0=Alpha,1=Size,2=Time			*/
  UWORD flags;	             /* See below defines 				*/
  ULONG windowflags;         /* Special Windowflags				*/
  BYTE *fullname;            /* Must point to BYTE[344] space for full path!	*/
  BYTE *ignorepattern;       /* Wildcard to skip files, e.g. "*.info" 		*/
  BYTE *pathgadstr;	     /* "PATH" or equivalent string gadget label	*/
  BYTE *filegadstr;          /* "FILE", "NAME", string gadget label		*/
  BYTE *titlestr;	     /* Static titlebar message, "LOAD ANIMATION>"	*/
  BYTE *readingstr;	     /* "Reading..." or appropriate substitute		*/
  BYTE *sortingstr;          /* "Sorting..." or equivalent message		*/
  BYTE *emptydirstr;         /* "Empty Directory" or equivalent			*/
  BYTE *nomatchstr;	     /* "Nothing matched PATTERN" or equivalent		*/
  BYTE *selectfilestr;	     /* "Select File:" or equivalent message		*/
  BYTE *selectstr;	     /* "Okay", "Load", etc. gadget text		*/
  BYTE *cancelstr;	     /* "Cancel", "Exit", etc. gadget text		*/
  BYTE *specgadstr;	     /* Text for optional definable gadget		*/
  struct Screen *userscreen; /* Screen to open requester on or 0L for WBench 	*/
  struct MsgPort *userport;  /* port to Wait on, then call userfunc or 0L	*/
/* Function called if specgadstr != 0L on GADGETUP	*/
  LONG (*specgadfunc) __fARGS((struct FSRequest *, struct Window *, struct Gadget *));
/* Clicked on a directory function */
  LONG (*dirfunc) __fARGS((struct FSRequest *, struct Window *));
/* Clicked on a filename function or 0L	 	*/
  LONG (*filefunc) __fARGS((struct FSRequest *, struct Window *));
/* Function called when Signal at userport set	*/
  LONG (*userfunc) __fARGS((struct FSRequest *, struct Window *));
/* Called right after OpenWindow for SetPointering	*/
  LONG (*initfunc) __fARGS((struct FSRequest *, struct Window *));
/* Called for each node_data, your chance to accept/reject/change */
  LONG (*matchfunc) __fARGS((struct FSRequest *, BYTE *, struct file_node *));
};

/* FSRequest flags */
#define FS_NO_DCLICK_EXIT   (1L << 0)	/* Disable Double-Click	exit       	*/
#define FS_NO_STRING_EXIT   (1L << 1)	/* Disable File String Gadget exit 	*/
#define FS_NO_STRING_OKAY   (1L << 2)	/* Allow clean exit with no file name 	*/
#define FS_SHOW_FILES_FIRST (1L << 3)   /* Show files first in mixture		*/
#define FS_SHOW_DIRS_FIRST  (1L << 4)   /* Show dirs first in mixture		*/
#define FS_SHOW_FILES_ONLY  (1L << 5)	/* Don't show dirs			*/
#define FS_SHOW_DIRS_ONLY   (1L << 6)   /* Don't show files			*/
#define FS_DELAYED_SORT     (1L << 7)   /* Don't sort till user hits slide	*/
