home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fred Fish Collection 1.5
/
ffcollection-1-5-1992-11.iso
/
ff_disks
/
200-299
/
ff286.lzh
/
FastDisk
/
Source
/
fds.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-12-04
|
5KB
|
343 lines
#include <proto/intuition.h>
#include <proto/exec.h>
#include <proto/graphics.h>
#include <proto/arp.h>
#include <libraries/arpbase.h>
#include <string.h>
static SHORT BorderVectors1[] = {
0,0,
59,0,
59,21,
0,21,
0,0
};
static struct Border Border1 = {
-1,-1,
3,0,JAM1,
5,
BorderVectors1,
NULL
};
static struct TextAttr TOPAZ80 = {
(STRPTR)"topaz.font",
TOPAZ_EIGHTY,0,0
};
static struct IntuiText IText1 = {
1,0,JAM1,
18,6,
&TOPAZ80,
"GO!",
NULL
};
static struct Gadget gogad = {
NULL,
200,16,
58,20,
NULL,
RELVERIFY,
BOOLGADGET,
(APTR)&Border1,
NULL,
&IText1,
NULL,
NULL,
3,
NULL
};
static SHORT BorderVectors2[] = {
0,0,
72,0,
72,10,
0,10,
0,0
};
static struct Border Border2 = {
-1,-1,
3,0,JAM1,
5,
BorderVectors2,
NULL
};
static struct IntuiText IText2 = {
1,0,JAM1,
3,1,
&TOPAZ80,
"NOFORMAT",
NULL
};
static struct Gadget nfgad = {
&gogad,
115,28,
71,9,
NULL,
RELVERIFY+TOGGLESELECT,
BOOLGADGET,
(APTR)&Border2,
NULL,
&IText2,
NULL,
NULL,
NULL,
NULL
};
static struct IntuiText IText3 = {
1,0,JAM1,
7,1,
&TOPAZ80,
"FASTDIR",
NULL
};
static struct Gadget fdgad = {
&nfgad,
115,15,
71,9,
NULL,
RELVERIFY+TOGGLESELECT,
BOOLGADGET,
(APTR)&Border2,
NULL,
&IText3,
NULL,
NULL,
NULL,
NULL
};
static struct IntuiText IText5 = {
2,0,JAM1,
-39,1,
&TOPAZ80,
"Dest",
NULL
};
static struct IntuiText IText4 = {
1,0,JAM2,
2,1,
&TOPAZ80,
"DF1:",
&IText5
};
static SHORT BorderVectors5[] = {
0,0,
36,0,
36,10,
0,10,
0,0
};
static struct Border Border5 = {
-1,-1,
3,0,JAM1,
5,
BorderVectors5,
NULL
};
static struct Gadget dgad = {
&fdgad,
68,28,
35,9,
NULL,
RELVERIFY,
BOOLGADGET,
(APTR)&Border5,
NULL,
&IText4,
NULL,
NULL,
2,
NULL
};
static struct IntuiText IText7 = {
2,0,JAM1,
-55,1,
&TOPAZ80,
"Source",
NULL
};
static struct IntuiText IText6 = {
1,0,JAM2,
2,1,
&TOPAZ80,
"DF0:",
&IText7
};
static struct Gadget sgad = {
&dgad,
68,15,
35,9,
NULL,
RELVERIFY,
BOOLGADGET,
(APTR)&Border5,
NULL,
&IText6,
NULL,
NULL,
1,
NULL
};
#define GadgetList1 sgad
static SHORT BorderVectors6[] = {
0,0,
270,0,
270,12,
0,12,
0,0
};
static struct Border Border6 = {
5,46,
3,0,JAM1,
5,
BorderVectors6,
NULL
};
#define BorderList1 Border6
static struct NewWindow nw = {
189,67,
282,62,
1,2,
GADGETUP+CLOSEWINDOW,
WINDOWDRAG+WINDOWDEPTH+WINDOWCLOSE+ACTIVATE+RMBTRAP+NOCAREREFRESH,
&sgad,
NULL,
0,
NULL,
NULL,
0,0,
0,0,
WBENCHSCREEN
};
/* end of PowerWindows source generation */
static short dr1=0,dr2=1;
static struct RastPort *rp;
struct Library *IntuitionBase,*GfxBase;
struct ArpBase *ArpBase;
static struct Window *w;
void _main(void);
void _exit(int);
void goodbye(int);
void pmsg(char*,int);
void loop(void);
void ongad(void);
void do_fast(int,int,int,int);
void goodbye(x)
int x;
{
if(w) CloseWindowSafely(w,0);
if(ArpBase) CloseLibrary(ArpBase);
_exit(x);
}
static char pb[34];
void pmsg(s,m)
char *s;
int m;
{
int c;
for(c=0; c<33; pb[c++]=0);
strcpy(pb+16-(strlen(s)/2),s);
for(c=0; c<33; c++) if(!pb[c]) pb[c]=32;
SetDrMd(rp,JAM2);
SetAPen(rp,(m)?3:1);
Move(rp,8,55);
Text(rp,pb,33);
if(m) DisplayBeep(0L);
}
void _main()
{
if(!(ArpBase=OpenLibrary("arp.library",34))) goodbye(30);
GfxBase=ArpBase->GfxBase;
IntuitionBase=ArpBase->IntuiBase;
if(!(w=OpenWindow(&nw))) goodbye(20);
SetWindowTitles(w,"Fastdisk II","Fastdisk II by Thorsten Stolpmann - Improved, Intuized & Arped by Ølli");
rp=w->RPort;
DrawBorder(rp,&BorderList1,0,0);
pmsg("awaiting your orders!",0);
loop();
}
void loop()
{
struct IntuiMessage *msg;
ongad();
for(;;) {
while(!(msg=GetMsg(w->UserPort))) WaitPort(w->UserPort);
if(msg->Class==CLOSEWINDOW) goodbye(0);
switch(((struct Gadget*)(msg->IAddress))->GadgetID) {
case 1:
dr1++;
dr1&=3;
(IText6.IText)[2]='0'+dr1;
RefreshGList(&sgad,w,0,1);
break;
case 2:
dr2++;
dr2&=3;
(IText4.IText)[2]='0'+dr2;
RefreshGList(&dgad,w,0,1);
break;
case 3:
if(dr1==dr2) {
DisplayBeep(0);
pmsg("source == dest !!!",1);
break;
}
sgad.Flags|=GADGDISABLED;
dgad.Flags|=GADGDISABLED;
nfgad.Flags|=GADGDISABLED;
fdgad.Flags|=GADGDISABLED;
gogad.Flags|=GADGDISABLED;
RefreshGadgets(&sgad,w,0);
do_fast(dr1,dr2,fdgad.Flags&SELECTED,nfgad.Flags&SELECTED);
ongad();
break;
}
ReplyMsg(msg);
}
}
void ongad()
{
if(!(sgad.Flags&GADGDISABLED)) return;
SetAPen(rp,0);
RectFill(rp,66,13,259,38);
sgad.Flags&=~GADGDISABLED;
dgad.Flags&=~GADGDISABLED;
nfgad.Flags&=~GADGDISABLED;
fdgad.Flags&=~GADGDISABLED;
gogad.Flags&=~GADGDISABLED;
RefreshGadgets(&sgad,w,0);
}