*********************************************************
*							*
*  multireq.i -- definition of library structures	*
*							*
*  Copyright (c) 1992 by Andreas Krebs			*
*							*
*********************************************************

	IFND	LIBRARIES_MULTIREQ_I
LIBRARIES_MULTIREQ_I	SET	1

	IFND	EXEC_TYPES_I
	INCLUDE	"exec/types.i"
	ENDC	; EXEC_TYPES_I

	IFND	EXEC_LIBRARIES_I
	INCLUDE	"exec/libraries.i"
	ENDC	; EXEC_LIBRARIES_I

	IFND	INTUITION_INTUITION_I
	INCLUDE	"intuition/intuition.i"
	ENDC	; INTUITION_INTUITION_I

*********************************
*	data structures		*
*********************************

;--------------------------------------------------------------------------
;
; The FileList structure contains a complete Directory with all informations
;
; The following structures contain some informations, that may never be
; changed by the user, and other informations, that can be changed.
; The structure elements mark with "CSU - Can be Set by User", can be set
; all others should NEVER be changed !!!
; All structure elements with the ending Buff are pointers to a already
; allocated string buffer, so do not change this pointers. Instead use
; StrCpy to fill this buffers with a string.
;
;--------------------------------------------------------------------------


  STRUCTURE	FileList,0
  	APTR	flt_ListKey		;Key to mem for entries of list

  	APTR	flt_FileList		;Ptr to first entry in list
	APTR	flt_FileListPos		;Current pos of ptr in list mem
	APTR	flt_FileListEnd		;end of list mem

	APTR	flt_FirstShown		;Ptr to first shown (not hidden !) entry in list
	APTR	flt_FirstDisplayed	;Ptr to first displayed entry
	APTR	flt_SelectedEntry	;Ptr to selected file
	APTR	flt_Lock		;filelock for list (if still reading or stopped)
	APTR	flt_FInfo		;ptr to FInfoBlock structure
	APTR	flt_DrawerBuff		;Buffer containing the Drawer		[CSU]
	UWORD	flt_AutoRead		;automatically read in dir		[CSU]
	UWORD	flt_DirNum		;Number of dirs read in
	UWORD	flt_FileNum		;Number of files read in
  LABEL	flt_SIZEOF

;	possible Flags for AutoRead

NO_AUTOREAD	EQU	0	;don't read in dir automatically
DO_AUTOREAD	EQU	1	;automatically read in dir, when filelist activated


;--------------------------------------------------------------------------
;
;	The FileReq structure as returned from InitFileReq
;
;--------------------------------------------------------------------------

  STRUCTURE	FileReq,0
	APTR	fr_TitleString		;ptr to title string or NULL (no title) [CSU]
	APTR	fr_OkayString		;ptr to string for okay-gadget or NULL
					;("Okay" used as text)			[CSU]
	UWORD	fr_LeftEdge		;leftedge of filereqwindow 		[CSU]
	UWORD	fr_TopEdge		;topedge of filereqwindow 		[CSU]
	UWORD	fr_Width		;width of window (NOT USED YET)
	UWORD	fr_Height		;height of window (NOT USED YET)
	APTR	fr_AddInfo		;additional info (NOT USED YET)

	APTR	fr_FileNameBuff		;when returning this buffer contains the
					;active filename with full path
	UWORD	fr_ReturnStatus		;MCD_OKAY, MCD_CANCEL, or stuff like that
	UBYTE	fr_ActiveList		;0 (list 1) or 1 (list 2) 		[CSU]
	UBYTE	fr_ShowInfo		;show or hide ".info"-files 		[CSU]

	APTR	fr_BaseAddress		;Base address of data memory (NEVER change !!!)

	APTR	fr_FileBuff		;buffer containing filename 		[CSU]
	APTR	fr_ShowBuff		;buffer with a wildcard string for the files
					;to be shown (e.g: "*.c|*.h")		[CSU]
	APTR	fr_HideBuff		;buffer with wildcard string for the files
					;to be hidden 				[CSU]
	UWORD	fr_FileListNum		;number of filelists (this version only
					;supports 2 filelists)

	STRUCT	fr_FileList1,flt_SIZEOF	;First filelist
	STRUCT	fr_FileList2,flt_SIZEOF	;Second filelist
  LABEL	fr_SIZEOF

;	The possible ReturnStatus flags

RET_ERROR	EQU	0	;something went wrong, (no FilReq structure or
				;unable to open window)

RET_CANCEL	EQU	1	;Cancel-Gadget selected
RET_CLOSE	EQU	2	;Close-Gadget selected
RET_FILE	EQU	3	;RETURN pressed in File-Gadget
RET_DOUBLE	EQU	4	;DoubleClick on File-Entry
RET_OKAY	EQU	5	;Okay-Gadget selected


;	The possible flags for ShowInfo

HIDE_INFO	EQU	0	;Hide all files ending with ".info"
SHOW_INFO	EQU	1	;don't hide ".info" files

;------------------------------------------------------------------------------
;
;	The MRText structure, usefull if you have many texts of the same font
;	and style, cause its shorter than IntuiText
;
;------------------------------------------------------------------------------

  STRUCTURE	MRText,0
	UWORD	mrt_LeftEdge		;left position of text
	UWORD	mrt_TopEdge		;top position of text
	UBYTE	mrt_Pen			;FrontPen of text
	UBYTE	mrt_Length		;Length of text, avoids StrLen to be called
	APTR	mrt_Text		;ptr to text string
  LABEL	mrt_SIZEOF

;
;	the possible styles for the DrawGadgetBorder-function
;

NOBORDER	EQU	0	;draw no border
BOOLBORDER	EQU	1	;draw a simple 3D-Button
FILLEDBORDER	EQU	2	;draw a filled 3D-Button
STRBORDER	EQU	3	;draw a StringGadget-Border
FILLEDSTRBORDER	EQU	4	;draw a filled StringGadget-Border

CYCLEIMG	EQU	$80	;draw a cycle image


; The DrawGadgetBorder-function uses the UserData part of the Gadget structure
; for some additional information in the following way
; 1. Byte: Style, 2. Byte: Pen1, 3. Byte: Pen2, 4.Byte: FillPen (if used)
;
; The following MACRO helps you to set this value

BORDER	MACRO
	dc.b	\1,\2,\3,\4
	ENDM


;	the MultiReqBase structure is almost a normal LibBase structure

  STRUCTURE	MultiReqBase,LIB_SIZE
	UBYTE	mrb_Flags		;some flags for lib
	UBYTE	mrb_pad			;make EVEN address

	APTR	mrb_SegList		;bptr to first segement of library
  LABEL	mrb_SIZEOF



*************************************************************************
*	All following structures are private ! DO NOT USE THEM !!!!	*
*************************************************************************

	IFD	MULTIREQ_PRIVATE

;	if you wish to use the following structures (????) add the following
;	command before INCLUDE "libraries/multireq.i":
;	MULTIREQ_PRIVATE	SET	1


;	The FileEntry-structure contains a file or directory


  STRUCTURE	FileEntry,0
	APTR	fe_NextEntry		;Next entry in list
	APTR	fe_LastEntry		;Last entry in list
	APTR	fe_ImageData		;or fe_FileSize for files
	UBYTE	fe_Pen			;textcolor of entry (also as type ID)
	UBYTE	fe_Length		;length of name
	APTR	fe_Name			;ptr to name
	UBYTE	fe_Shown		;entry hidden or shown ?
	UBYTE	fe_Selected		;0 = Not Selected, 1 = Selected
	APTR	fe_NextShown		;Next shown entry in list
	APTR	fe_LastShown		;Last shown entry in list
  LABEL	fe_SIZEOF

fe_FileSize	EQU	fe_ImageData

;	possible Pens

FILE_PEN	EQU	1	;entry is a file, so use pen 1
DIR_PEN		EQU     2	;entry is a directory, so use pen 2

;	possible Shown flags

ENTRY_HIDDEN	EQU	0	;entry is not show in list
ENTRY_SHOWN	EQU	1	;entry is shown in list

;	possible Selected flags

ENTRY_UNSEL	EQU	0	;entry is not selected
ENTRY_SEL	EQU	1	;entry is selected


;	the VolEntry structure contains an entry of the volumes list

  STRUCTURE	VolEntry,0
	APTR	vle_NextEntry		;next entry in list
	APTR	vle_LastEntry		;last entry in list
	APTR	vle_ImageData		;ptr to imagedata of image to be displayed
	UBYTE	vle_Pen			;textcolor of entry (also type ID)
	UBYTE	vle_Length		;length of name
	APTR	vle_Name			;ptr to name with an added ":"
  LABEL	vle_SIZEOF

;	possible Pens

DEVICE_PEN	EQU	1	;pen for devices like (DF0:, ...)
				;pen for dirs (again 2)
VOLUME_PEN	EQU	3	;pen for volumes

;
; The MRTime structure is needed to save the time of a message
;

  STRUCTURE MRTime,0
	ULONG	mrti_Seconds	; seconds part of the time
	ULONG	mrti_Micros	; micros part of the time
  LABEL	mrti_SIZEOF

;---------------------------------------------------------------------------
;
; The ReqBase is NOT the LibraryBase of multireq.library, it's a structure
; containing all temporary information needed by the FileRequester
; This structure is create by InitFileReq and setup with the values, but
; because of it's size and it's important information, the user gets the
; FileReq structure instead of this one.
;
;---------------------------------------------------------------------------

  STRUCTURE	ReqBase,0
	APTR	rb_begSP		;initial SP of FileReq
	APTR	rb_readSP		;initial SP of ReadProcess
	APTR	rb_ReqKey		;Key for AllocRemember
	APTR	rb_ReqWin		;ptr to FileReq-window
	APTR	rb_rp			;ptr to FileReq-window's RastPort
	APTR	rb_FileReq		;ptr to FileReq structure
	APTR	rb_ActiveList		;ptr to currently active list (1 or 2)

	APTR	rb_ReqPort		;ptr to port of FileReq
	APTR	rb_ReadPort		;ptr to port of ReadProcess
	APTR	rb_ReqMsg		;ptr to mem for FileReq messages
	APTR	rb_ReadMsg		;ptr to mem for ReadProcess messages

	STRUCT	rb_CurrentVol,vle_SIZEOF	;mem for current dir vol entry (always first)
	APTR	rb_VolList              ;ptr to list with all volumes
	APTR	rb_FirstVol             ;first shown volume
	APTR	rb_LastVol              ;last shown volume
	UWORD	rb_VolNum               ;number of volumes in list

	APTR	rb_VolKey		;alloc key for volumes mem
	APTR	rb_VolListPos		;current pos in volumes mem
	APTR	rb_VolListEnd		;end of volumes mem

	UWORD	rb_ShownNum		;number of files+dirs shown (not hidden!)
	UWORD	rb_SelectedPos		;pos of last selected entry (0 to 13)
	APTR	rb_FirstFile		;first shown entry in display
	APTR	rb_LastFile		;last shown entry in display

	APTR	rb_DrawerBuff		;ptr to enough mem to work with drawer buffer
	APTR	rb_UndoDrawerBuff	;ptr to a undobuffer
	STRUCT	rb_MsgTime,mrti_SIZEOF	;for secs and micros of this message
	STRUCT	rb_LastTime,mrti_SIZEOF	;secs and micros of last message

					;the following part contains all gadgets

	STRUCT	rb_FilePropImage,ig_SIZEOF	;the Image structures for the PropGadgets
	STRUCT	rb_VolPropImage,ig_SIZEOF

	STRUCT	rb_ShowSInfo,si_SIZEOF	;the StringInfo structures for the String-Gadget
	STRUCT	rb_HideSInfo,si_SIZEOF
	STRUCT	rb_DrawerSInfo,si_SIZEOF
	STRUCT	rb_FileSInfo,si_SIZEOF

	STRUCT	rb_VolPInfo,pi_SIZEOF	;the PropInfo structures for the Prop-Gadgets
	STRUCT	rb_FilePInfo,pi_SIZEOF

	STRUCT	rb_CloseGadg,gg_SIZEOF	;the gadgets itself
	STRUCT	rb_DepthGadg,gg_SIZEOF
	STRUCT	rb_InfoGadg,gg_SIZEOF
	STRUCT	rb_SwitchGadg,gg_SIZEOF
	STRUCT	rb_Copy12Gadg,gg_SIZEOF
	STRUCT	rb_Copy21Gadg,gg_SIZEOF
	STRUCT	rb_ShowGadg,gg_SIZEOF
	STRUCT	rb_HideGadg,gg_SIZEOF
	STRUCT	rb_ScanGadg,gg_SIZEOF
	STRUCT	rb_StopGadg,gg_SIZEOF
	STRUCT	rb_OkayGadg,gg_SIZEOF
	STRUCT	rb_CancelGadg,gg_SIZEOF
	STRUCT	rb_DrawerGadg,gg_SIZEOF
	STRUCT	rb_FileGadg,gg_SIZEOF
	STRUCT	rb_VolUpGadg,gg_SIZEOF
	STRUCT	rb_VolDownGadg,gg_SIZEOF
	STRUCT	rb_VolPropGadg,gg_SIZEOF
	STRUCT	rb_ParentGadg,gg_SIZEOF
	STRUCT	rb_FileUpGadg,gg_SIZEOF
	STRUCT	rb_FileDownGadg,gg_SIZEOF
	STRUCT	rb_FilePropGadg,gg_SIZEOF
	STRUCT	rb_DragGadg,gg_SIZEOF
  LABEL	rb_SIZEOF


;	The ReadMessage is used for communication between FileReq and ReadProcess

  STRUCTURE	ReadMessage,0
	STRUCT	rdm_Node,LN_SIZE		;a node as all message
	APTR	rdm_ReplyPort
	UWORD	rdm_Length		;length is 10
	UWORD	rdm_Command		;message command
	APTR	rdm_Data1		;2 LONGS for datas to send
	APTR	rdm_Data2
  LABEL	rdm_SIZEOF

;	Message Commands

MCD_NOP		EQU	0	;do nothing

; 	msgs from FileReq to ReadProcess

MCD_READDIR	EQU	1	; readin dir
MCD_SCAN	EQU	2	; same as read, but continues a stopped reading proc
MCD_STOP	EQU	3	; stop read in
MCD_QUIT	EQU	4	; quit ReadProcess, set DO_AUTOREAD, if still reading

; 	msgs from ReadProcess to FileReq

MCD_REDISPLAY	EQU	10	; redisplay filelist (something changed)
MCD_SIZEPROP	EQU	11	; change size of PropGadget (another file read in)
MCD_DONE	EQU	12	; directroy totally read in

MCD_ERROR	EQU	13	; 13 is a great number for an error, is it ??
MCD_EXIT	EQU	14	; only send before ReadProcess is going down
				; cause FileReq is interested in me going down

	ENDC	; MULTIREQ_PRIVATE

	ENDC	; LIBRARIES_MULTIREQ_I
