home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD2.bin
/
bbs
/
util
/
devicelock-1.2.lha
/
DeviceLock
/
txt
/
DLrequester.mod
< prev
next >
Wrap
Text File
|
1994-03-18
|
3KB
|
126 lines
MODULE DLrequester;
IMPORT
d := Dos,
DLs:= DLstrings,
e := Exec,
I := Intuition,
r := ReqToolsNA,
u := Utility,
sys:= SYSTEM;
TYPE tags = u.Tags5;
CONST
ReqTagsC = tags(r.ezReqTitle,NIL,
r.glFlags,LONGSET{r.ezReqCenterText},
r.Window,NIL,
r.LockWindowTag,I.LTRUE,
u.done,NIL);
VAR
reqToolsAvail-: BOOLEAN;
me -: d.ProcessPtr;
yourwin *: I.WindowPtr;
noWarnings *: BOOLEAN;
centernot *: BOOLEAN;
oldwinPtr : e.APTR;
(***************************************************************************
some often needed requester stuff
***************************************************************************)
(*------ Requester with EasyRequest ---------------------------------------*)
PROCEDURE Request*(head,text,gadget: e.LSTRPTR; arg: e.APTR):LONGINT;
VAR Req : I.EasyStruct;
ReqTags : tags;
BEGIN
IF reqToolsAvail THEN
ReqTags := ReqTagsC;
IF yourwin = NIL THEN
ReqTags[2].tag := u.done;
ELSE
ReqTags[2].data := yourwin;
END;
ReqTags[0].data := head;
IF centernot THEN ReqTags[1].tag := u.ignore END;
RETURN(r.EZRequest(text^, gadget^, NIL, ReqTags, arg));
ELSE
Req.structSize := SIZE(I.EasyStruct);
Req.flags := LONGSET{};
Req.title := head;
Req.textFormat := text;
Req.gadgetFormat := gadget;
RETURN(I.EasyRequest(NIL,sys.ADR(Req),NIL,arg));
END;
END Request;
PROCEDURE RequestNotify*(head,text: e.LSTRPTR; arg: e.APTR);
VAR dummy : LONGINT;
BEGIN
dummy := Request(head,text,DLs.GetString(DLs.GadOK),arg);
END RequestNotify;
PROCEDURE RequestResponseBool*(head,text,gadget: e.LSTRPTR; arg: e.APTR):BOOLEAN;
BEGIN
IF Request(head,text,gadget,arg)=0 THEN RETURN(FALSE)
ELSE RETURN(TRUE) END;
END RequestResponseBool;
PROCEDURE RequestResponseNum*(head,text,gadget: e.LSTRPTR; arg: e.APTR):LONGINT;
BEGIN
RETURN(Request(head,text,gadget,arg));
END RequestResponseNum;
PROCEDURE RequestWarning*(text: e.LSTRPTR; arg: e.APTR);
VAR ret : SHORTINT;
BEGIN
IF noWarnings THEN RETURN END;
ret := SHORT(SHORT(Request(DLs.GetString(DLs.MsgWarning),
text,
DLs.GetString(DLs.GadProceedQuit),
arg)));
CASE ret OF 0 : HALT(5) |
2 : noWarnings := TRUE |
ELSE END;
END RequestWarning;
(*------ Quit Program with error message ----------------------------------*)
PROCEDURE BailOut*(error: ARRAY OF CHAR); (* $CopyArrays- *)
BEGIN
RequestNotify(DLs.GetString(DLs.MsgError),sys.ADR(error),NIL);
HALT(20);
END BailOut;
PROCEDURE FailOut*(error: ARRAY OF CHAR); (* $CopyArrays- *)
BEGIN
RequestNotify(DLs.GetString(DLs.MsgError),DLs.GetString(DLs.MsgFailed),sys.ADR(error));
HALT(20);
END FailOut;
(*------ Other ------------------------------------------------------------*)
PROCEDURE NoDosRequester*():d.ProcessPtr;
BEGIN
me := (sys.VAL(d.ProcessPtr,e.FindTask(NIL)));
oldwinPtr := me.windowPtr;
me.windowPtr := -1;
RETURN(me);
END NoDosRequester;
(***************************************************************************
M A I N
***************************************************************************)
BEGIN
reqToolsAvail := r.req # NIL;
CLOSE
IF oldwinPtr # NIL THEN me.windowPtr := oldwinPtr END;
END DLrequester.