Unit reqtools; Interface Uses Exec,Intuition,graphics; { Filename: libraries/reqtools.h Release: 1.0 (C) Copyright 1991 Nico François All Rights Reserved} const REQTOOLSNAME = 'reqtools.library'; REQTOOLSVERSION = 37; type tReqToolsBase = record LibNode : tlibrary; Flags : byte; pad : array [0..2] of byte; SegList : pointer; IntuitionBase : pointer; GfxBase : pointer; Dosbase : pointer; GadToolsBase : plibrary; UtilityBase : plibrary; end ; pReqToolsBase = ^tReqToolsBase; { types of requesters, for rtAllocRequestA() } const RT_FILEREQ = 0; RT_REQINFO = 1; RT_FONTREQ = 2; {----------------------- = File requester = -----------------------} type rtFileRequester = record ReqPos : longint; LeftOffset : word; TopOffset : word; Flags : longint; Hook : pointer; Dir : pointer; { READ ONLY! Change with rtChangeReqAttrA()! } MatchPat : pointer; { READ ONLY! Change with rtChangeReqAttrA()! } DefaultFont : pointer; WaitPointer : longint; end; rtFileList = record Next : pointer; StrLen : longint; { -1 for directories } Name : pointer; end; {----------------------- = Font requester = -----------------------} rtFontRequester = record ReqPos : longint; LeftOffset : word; TopOffset : word; Flags : longint; Hook : pointer; attr : ttextAttr; { READ ONLY! } DefaultFont : pointer; WaitPointer : longint; end; {----------------------- = Requester Info = -----------------------} rtReqInfo = record ReqPos : longint; leftOffset : word; TopOffset : word; Width : longint; { not for rtEZRequestA() } ReqTitle : pointer; { currently only for rtEZRequestA() } Flags : longint; { only for rtEZRequestA() } DefaultFont : pointer; { currently only for rtPaletteRequestA() } WaitPointer : longint; end; {----------------------- = Handler Info = -----------------------} rtHandlerInfo = record private1 : longint; WaitMask : longint; DoNotWait : longint; end; prtFileRequester = ^rtFileRequester; prtFileList = ^rtFileList; prtFontRequester = ^rtFontRequester; prtReqInfo = ^rtReqInfo; prtHandlerInfo = ^rtHandlerInfo; { possible return codes from rtReqHandlerA() } const CALL_HANDLER = $80000000; {------------------------------------- = TAGS = -------------------------------------} RT_TagBase = $80000000; RT_Window = +1; RT_IDCMPFlags = +2; RT_ReqPos = +3; RT_LeftOffset = +4; RT_TopOffset = +5; RT_PubScrName = +6; RT_Screen = +7; RT_ReqHandler = +8; RT_DefaultFont = +9; RT_WaitPointer = +10; RT_Underscore = +11; RT_ShareIDCMP = +12; RT_LockWindow = +13; RT_ScreenToFront = +14; RT_TextAttr = +15; RT_IntuiMsgFunc = +16; RT_Locale = +17; RTEZ_ReqTitle = +20; RTEZ_Flags = +22; RTEZ_DefaultResponse = +23; RTGL_Min = +30; RTGL_Max = +31; RTGL_Width = +32; RTGL_ShowDefault = +33; RTGS_Width = RTGL_Width; RTGS_AllowEmpty = +80; RTFI_Flags = +40; RTFI_Height = +41; RTFI_OkText = +42; RTFO_Flags = RTFI_Flags; RTFO_Height = RTFI_Height; RTFO_OkText = RTFI_OkText; RTFO_SampleHeight = +60; RTFO_MinHeight = +61; RTFO_MaxHeight = +62; RTFI_Dir = +50; RTFI_MatchPat = +51; RTFI_AddEntry = +52; RTFI_RemoveEntry = +53; RTFO_FontName = +63; RTFO_FontHeight = +64; RTFO_FontStyle = +65; RTFO_FontFlags = +66; RTPA_Color = +70; RTRH_EndRequest = +60; {------------ = RT_ReqPos = ------------} REQPOS_POINTER = 0; REQPOS_CENTERWIN = 1; REQPOS_CENTERSCR = 2; REQPOS_TOPLEFTWIN = 3; REQPOS_TOPLEFTSCR = 4; {------------------ = RTRH_EndRequest = ------------------} REQ_CANCEL = 0; REQ_OK = 1; {--------------------------------------- = flags for RTFI_Flags and RTFO_Flags = = or filereq->Flags and fontreq->Flags = ---------------------------------------} FREQB_NOBUFFER = 2; FREQF_NOBUFFER = 4; FREQB_DOWILDFUNC = 11; FREQF_DOWILDFUNC = 2048; {----------------------------------------- = flags for RTFI_Flags or filereq->Flags = -----------------------------------------} FREQB_MULTISELECT = 0; FREQF_MULTISELECT = 1; FREQB_SAVE = 1; FREQF_SAVE = 2; FREQB_NOFILES = 3; FREQF_NOFILES = 8; FREQB_PATGAD = 4; FREQF_PATGAD = 16; FREQB_SELECTDIRS = 12; FREQF_SELECTDIRS = 4096; {----------------------------------------- = flags for RTFO_Flags or fontreq->Flags = -----------------------------------------} FREQB_FIXEDWIDTH = 5; FREQF_FIXEDWIDTH = 32; FREQB_COLORFONTS = 6; FREQF_COLORFONTS = 64; FREQB_CHANGEPALETTE = 7; FREQF_CHANGEPALETTE = 128; FREQB_LEAVEPALETTE = 8; FREQF_LEAVEPALETTE = 256; FREQB_SCALE = 9; FREQF_SCALE = 512; FREQB_STYLE = 10; FREQF_STYLE = 1024; {----------------------------------------- = flags for RTEZ_Flags or reqinfo->Flags = -----------------------------------------} EZREQB_NORETURNKEY = 0; EZREQF_NORETURNKEY = 1; EZREQB_LAMIGAQUAL = 1; EZREQF_LAMIGAQUAL = 2; EZREQB_CENTERTEXT = 2; EZREQF_CENTERTEXT = 4; {-------- = hooks = --------} REQHOOK_WILDFILE = 0; REQHOOK_WILDFONT = 1; Function rtAllocRequestA(type_ : LongInt; taglist : Pointer): Pointer; Procedure rtFreeRequest(req: Pointer); Procedure rtFreeReqBuffer(req: Pointer); Function rtChangeReqAttrA(req,taglist : Pointer): LongInt; Function rtFileRequestA(filereq : pointer; file_,title : string; taglist : Pointer) : Pointer; Procedure rtFreeFileList (filelist : Pointer); Function rtEZRequestA(bodyfmt,gadfmt : string; reqinfo,argarray,taglist : Pointer): LongInt; Function rtGetStringA(buffer : Pointer; maxchars : LongInt; title : string; reqinfo,taglist : Pointer): LongInt; Function rtGetLongA(longptr : pointer; title : string; reqinfo,taglist : Pointer): LongInt; Function rtFontRequestA(fontreq : pointer; title : string; taglist : Pointer): LongInt; Function rtPaletteRequestA(title : string; reqinfo,taglist : Pointer): LongInt; Function rtReqHandlerA(handlerinfo : Pointer; sigs : LongInt; taglist : Pointer): LongInt; Procedure rtSetWaitPointer(window : Pointer); Procedure rtGetVScreenSize(screen,widthptr,heightptr : Pointer); Procedure rtSetReqPosition(reqpos : LongInt; newwindow,screen,window : Pointer); Procedure rtSpread(posarray,sizearray : Pointer; length,min,max,num : LongInt); Procedure rtScreenToFrontSafely(screen : Pointer); Var ReqToolsBase: pReqToolsBase; Implementation Function rtAllocRequestA; XASSEMBLER; ASM move.l a6,-(sp) lea $8(sp),a6 move.l (a6)+,a0 move.l (a6)+,d0 move.l ReqToolsBase,a6 jsr -$1E(a6) move.l d0,$10(sp) move.l (sp)+,a6 END; Procedure rtFreeRequest; XASSEMBLER; ASM move.l a6,-(sp) move.l $8(sp),a1 move.l ReqToolsBase,a6 jsr -$24(a6) move.l (sp)+,a6 END; Procedure rtFreeReqBuffer; XASSEMBLER; ASM move.l a6,-(sp) move.l $8(sp),a1 move.l ReqToolsBase,a6 jsr -$2A(a6) move.l (sp)+,a6 END; Function rtChangeReqAttrA; XASSEMBLER; ASM move.l a6,-(sp) movem.l $8(sp),a0-a1 move.l ReqToolsBase,a6 jsr -$30(a6) move.l d0,$10(sp) move.l (sp)+,a6 END; Function rtFileRequestA; XASSEMBLER; ASM movem.l a2-a3/a6,-(sp) lea $10(sp),a6 move.l (a6)+,a0 move.l (a6)+,a3 addq.l #1,a3 move.l (a6)+,a2 addq.l #1,a2 move.l (a6)+,a1 move.l ReqToolsBase,a6 jsr -$36(a6) move.l d0,$20(sp) movem.l (sp)+,a2-a3/a6 END; Procedure rtFreeFileList; XASSEMBLER; ASM move.l a6,-(sp) move.l $8(sp),a0 move.l ReqToolsBase,a6 jsr -$3C(a6) move.l (sp)+,a6 END; Function rtEZRequestA; XASSEMBLER; ASM movem.l a2-a4/a6,-(sp) lea $14(sp),a6 move.l (a6)+,a0 move.l (a6)+,a4 move.l (a6)+,a3 move.l (a6)+,a2 addq.l #1,a2 move.l (a6)+,a1 addq.l #1,a1 move.l ReqToolsBase,a6 jsr -$42(a6) move.l d0,$28(sp) movem.l (sp)+,a2-a4/a6 END; Function rtGetStringA; XASSEMBLER; ASM movem.l a2-a3/a6,-(sp) lea $10(sp),a6 move.l (a6)+,a0 move.l (a6)+,a3 move.l (a6)+,a2 addq.l #1,a2 move.l (a6)+,d0 move.l (a6)+,a1 move.l ReqToolsBase,a6 jsr -$48(a6) move.l d0,$24(sp) movem.l (sp)+,a2-a3/a6 END; Function rtGetLongA; XASSEMBLER; ASM movem.l a2-a3/a6,-(sp) lea $10(sp),a6 move.l (a6)+,a0 move.l (a6)+,a3 move.l (a6)+,a2 addq.l #1,a2 move.l (a6)+,a1 move.l ReqToolsBase,a6 jsr -$4E(a6) move.l d0,$20(sp) movem.l (sp)+,a2-a3/a6 END; Function rtFontRequestA; XASSEMBLER; ASM movem.l a3/a6,-(sp) lea $C(sp),a6 move.l (a6)+,a0 move.l (a6)+,a3 addq.l #1,a3 move.l (a6)+,a1 move.l ReqToolsBase,a6 jsr -$60(a6) move.l d0,$18(sp) movem.l (sp)+,a3/a6 END; Function rtPaletteRequestA; XASSEMBLER; ASM movem.l a2-a3/a6,-(sp) lea $10(sp),a6 move.l (a6)+,a0 move.l (a6)+,a3 move.l (a6)+,a2 addq.l #1,a2 move.l ReqToolsBase,a6 jsr -$66(a6) move.l d0,$1C(sp) movem.l (sp)+,a2-a3/a6 END; Function rtReqHandlerA; XASSEMBLER; ASM move.l a6,-(sp) lea $8(sp),a6 move.l (a6)+,a0 move.l (a6)+,d0 move.l (a6)+,a1 move.l ReqToolsBase,a6 jsr -$6C(a6) move.l d0,$14(sp) move.l (sp)+,a6 END; Procedure rtSetWaitPointer; XASSEMBLER; ASM move.l a6,-(sp) move.l $8(sp),a0 move.l ReqToolsBase,a6 jsr -$72(a6) move.l (sp)+,a6 END; Procedure rtGetVScreenSize; XASSEMBLER; ASM movem.l a2/a6,-(sp) lea $C(sp),a6 move.l (a6)+,a2 move.l (a6)+,a1 move.l (a6)+,a0 move.l ReqToolsBase,a6 jsr -$78(a6) movem.l (sp)+,a2/a6 END; Procedure rtSetReqPosition; XASSEMBLER; ASM movem.l a2/a6,-(sp) lea $C(sp),a6 move.l (a6)+,a2 move.l (a6)+,a1 move.l (a6)+,a0 move.l (a6)+,d0 move.l ReqToolsBase,a6 jsr -$7E(a6) movem.l (sp)+,a2/a6 END; Procedure rtSpread; XASSEMBLER; ASM movem.l d3/a6,-(sp) lea $C(sp),a6 move.l (a6)+,d3 move.l (a6)+,d2 move.l (a6)+,d1 move.l (a6)+,d0 move.l (a6)+,a1 move.l (a6)+,a0 move.l ReqToolsBase,a6 jsr -$84(a6) movem.l (sp)+,d3/a6 END; Procedure rtScreenToFrontSafely; XASSEMBLER; ASM move.l a6,-(sp) move.l $8(sp),a0 move.l ReqToolsBase,a6 jsr -$8A(a6) move.l (sp)+,a6 END; End.