home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of A1200
/
World_Of_A1200.iso
/
programs
/
disk
/
backup_utils
/
kwikbackup
/
source.lha
/
source
/
KwikBackUp.mod
< prev
next >
Wrap
Text File
|
1989-09-24
|
5KB
|
161 lines
(*---------------------------------------------------------------------------
:Program. KwikBackUp
:Author. Fridtjof Siebert
:Address. Nobileweg 67, D-7-Stgt-40
:Shortcut. [fbs]
:Version. 1.0
:Date. 15-Dez-88
:Copyright. ShareWare, send me $10 if you want to use this.
:Language. Modula-II
:Translator. M2Amiga v3.1d
:Contents. Fast and secure HD-BackUp utility.
:Remark. Uses the Archive-Flag.
---------------------------------------------------------------------------*)
MODULE KwikBackUp;
FROM SYSTEM IMPORT ADR;
FROM Dos IMPORT Delay;
FROM Exec IMPORT WaitPort, GetMsg, ReplyMsg;
FROM Graphics IMPORT SetAPen, SetDrMd, jam1, jam2, DrawModes, DrawModeSet,
RectFill, SetBPen;
FROM Intuition IMPORT IntuiMessagePtr, IntuiMessage, GadgetPtr, GadgetFlags,
GadgetFlagSet, IDCMPFlags, IDCMPFlagSet, OnGadget,
RemoveGadget, AddGadget, RefreshGadgets;
FROM HDDisplay IMPORT OpenDisplay, HDRequest, ReqResults, gadgets, Redraw,
Window, Gadgets, DriveName, Type, RP;
FROM BackUp IMPORT BackUp, Restore;
VAR
MyMsgPtr: IntuiMessagePtr;
MyMsg: IntuiMessage;
gdg: GadgetPtr;
Drive: CARDINAL;
GdgCnt: gadgets;
(*------ Redraw SaveAll & RegardArch Gadgets: ------*)
PROCEDURE RedrawSaveAll(SaveAll: BOOLEAN);
BEGIN
IF SaveAll THEN
INCL(Gadgets[SaveAllGadg].flags,selected);
WITH Gadgets[RegardArchivedGadg] DO
flags := flags - GadgetFlagSet{selected};
END;
ELSE
INCL(Gadgets[RegardArchivedGadg].flags,selected);
WITH Gadgets[SaveAllGadg] DO
flags := flags - GadgetFlagSet{selected};
END;
END;
SetAPen(RP,0); SetDrMd(RP,jam1);
RectFill(RP,320,118,459,133);
RectFill(RP,476,118,615,133);
SetAPen(RP,1);
Type(514,128,"Save All");
Type(330,128,"Regard Archived");
SetAPen(RP,3); SetDrMd(RP,DrawModeSet{complement});
IF SaveAll THEN
RectFill(RP,476,118,615,133);
ELSE
RectFill(RP,320,118,459,133);
END;
END RedrawSaveAll;
(*------ MAIN: ------*)
BEGIN
(*------ Init: ------*)
Drive := 0;
OpenDisplay();
(*------ Main Loop: ------*)
LOOP
WaitPort(Window^.userPort);
MyMsgPtr := GetMsg(Window^.userPort);
IF MyMsgPtr#NIL THEN
MyMsg := MyMsgPtr^;
ReplyMsg(MyMsgPtr);
IF MyMsg.class=IDCMPFlagSet{gadgetDown} THEN
gdg := MyMsg.iAddress;
CASE gadgets(gdg^.gadgetID) OF
HDGadg: |
BackUpGadg:
INCL(Gadgets[BackUpGadg].flags,selected);
WITH Gadgets[RestoreGadg] DO
flags := flags - GadgetFlagSet{selected};
END;
OnGadget(ADR(Gadgets[BackUpGadg]),Window,NIL); |
RestoreGadg:
INCL(Gadgets[RestoreGadg].flags,selected);
WITH Gadgets[BackUpGadg] DO
flags := flags - GadgetFlagSet{selected};
END;
OnGadget(ADR(Gadgets[BackUpGadg]),Window,NIL); |
DiskGadg:
IF Drive=3 THEN
Drive := 0;
ELSE
INC(Drive);
END;
DriveName[2] := CHAR(ORD("0")+Drive);
SetAPen(RP,2); SetBPen(RP,1); SetDrMd(RP,jam2);
Type(396,59,DriveName); |
SaveAllGadg:
RedrawSaveAll(TRUE); |
RegardArchivedGadg:
RedrawSaveAll(FALSE); |
SetArchivedGadg: |
StartGadg:
FOR GdgCnt:=MIN(gadgets) TO MAX(gadgets) DO
IF GdgCnt#StartGadg THEN
IF RemoveGadget(Window,ADR(Gadgets[GdgCnt]))=0 THEN END;
END;
END;
SetAPen(RP,0); SetDrMd(RP,jam1);
RectFill(RP,8,118,147,133);
SetAPen(RP,1);
Type(58,128,"ABORT");
IF selected IN Gadgets[BackUpGadg].flags THEN
BackUp(Drive);
ELSE
Restore(Drive);
END;
WITH Gadgets[StartGadg] DO
flags := flags - GadgetFlagSet{selected};
END;
SetAPen(RP,0); SetDrMd(RP,jam1);
RectFill(RP,8,118,147,133);
SetAPen(RP,1);
Type(58,128,"Start");
LOOP
MyMsgPtr := GetMsg(Window^.userPort);
IF MyMsgPtr=NIL THEN EXIT END;
ReplyMsg(MyMsgPtr);
END;
FOR GdgCnt:=MIN(gadgets) TO MAX(gadgets) DO
IF GdgCnt#StartGadg THEN
IF AddGadget(Window,ADR(Gadgets[GdgCnt]),-1)=0 THEN END;
END;
END; |
END;
ELSIF MyMsg.class=IDCMPFlagSet{closeWindow} THEN
EXIT;
END;
END;
END;
(*------ Exit: ------*)
END KwikBackUp.