home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
573a.lha
/
AT_copy_v2.22
/
NewIntroD.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-06-29
|
5KB
|
213 lines
/* INCLUDES ********************************************************** */
#include <exec/types.h>
#include <exec/io.h>
#include <exec/memory.h>
#include <libraries/dos.h>
#include <intuition/intuition.h>
/* get the PowerWindows 2.0 code */
#include "NewIntroD.h"
#define UNSELECT 0xff7f /* ~SELECTED */
#define Flag_B 'B'
#define Flag_NC 'N'
#define Flag_CR 'C'
#define Flag_none '\0'
char Intro(char **pc,char *Option)
{
USHORT quit_flag = FALSE;
UWORD code;
ULONG class;
char opt;
LONG gnr,flag = FALSE;
struct Gadget *gpt,*oldG;
struct StringInfo *SI;
struct Window *wG; /* we fetch the RastPort pointer from here */
struct RastPort *rpG;
struct IntuiMessage *message; /* the message the IDCMP sends us */
none.Flags &= UNSELECT;
CR.Flags &= UNSELECT;
NC.Flags &= UNSELECT;
B.Flags &= UNSELECT;
switch(*Option)
{
case 'N':
case 'n': NC.Flags |= SELECTED;
oldG = &NC;
break;
case 'C':
case 'c': CR.Flags |= SELECTED;
oldG = &CR;
break;
case 'B':
case 'b': B.Flags |= SELECTED;
oldG = &B;
break;
default: none.Flags |= SELECTED;
oldG = &none;
break;
}
OK.NextGadget = &ABORT;
PATH.NextGadget = &OK;
B.NextGadget = &PATH;
CR.NextGadget = &B;
NC.NextGadget = &CR;
none.NextGadget = &NC;
NewWindowStructure1.FirstGadget = &none;
SI = (struct StringInfo *) PATH.SpecialInfo;
strncpy((char *) SI->Buffer,*pc,19);
SI->Buffer[19] = '\0';
wG = (struct Window *) OpenWindow(&NewWindowStructure1); /* open the window */
if ( wG == NULL )
{
return((char) 255);
}
rpG = wG->RPort; /* get a rastport pointer for the window */
PrintIText(rpG,&IntuiTextList1,0L,0L); /* Print the text if there is */
do
{
WaitPort(wG->UserPort);
while( (message = (struct IntuiMessage *)
GetMsg(wG->UserPort) ) != NULL)
{
code = message->Code; /* MENUNUM */
gpt = (struct Gadget *) message->IAddress; /* Gadget */
class = message->Class;
RefreshGadgets(wG->FirstGadget,wG,NULL);
ReplyMsg((struct Message *) message);
if ( class == CLOSEWINDOW )
{
quit_flag = TRUE;
flag = FALSE;
}
if (( class == GADGETUP ) || /* Gagdets */
( class == GADGETDOWN ))
{
gnr = gpt->GadgetID;
switch(gnr)
{
case 1:
case 2:
case 3:
case 4: RemoveGadget(wG,(struct Gadget *) &none);
RemoveGadget(wG,(struct Gadget *) &CR);
RemoveGadget(wG,(struct Gadget *) &NC);
RemoveGadget(wG,(struct Gadget *) &B);
oldG->Flags &= UNSELECT;
AddGadget(wG,(struct Gadget *) &none,0);
AddGadget(wG,(struct Gadget *) &CR,0);
AddGadget(wG,(struct Gadget *) &NC,0);
AddGadget(wG,(struct Gadget *) &B,0);
RefreshGadgets(wG->FirstGadget,wG,NULL);
if (none.Flags < SELECTED && CR.Flags < SELECTED
&& NC.Flags < SELECTED && B.Flags < SELECTED)
{
oldG = &none;
RemoveGadget(wG,oldG);
RemoveGadget(wG,(struct Gadget *) &CR);
RemoveGadget(wG,(struct Gadget *) &NC);
RemoveGadget(wG,(struct Gadget *) &B);
oldG->Flags |= SELECTED;
AddGadget(wG,oldG,0);
AddGadget(wG,(struct Gadget *) &CR,0);
AddGadget(wG,(struct Gadget *) &NC,0);
AddGadget(wG,(struct Gadget *) &B,0);
RefreshGadgets(wG->FirstGadget,wG,NULL);
}
else
{
oldG = gpt;
}
break;
case 6: flag = TRUE;
quit_flag = TRUE;
break;
case 7: flag = FALSE;
quit_flag = TRUE;
break;
default: ActivateGadget((struct Gadget *) &PATH,wG,NULL);
RefreshGadgets(wG->FirstGadget,wG,NULL);
}
}
}
}
while (quit_flag == FALSE);
if (flag == FALSE)
{
CloseWindow(wG);
return((char) 255);
}
if (none.Flags >= SELECTED)
{
opt = Flag_none;
}
if (CR.Flags >= SELECTED)
{
opt = Flag_CR;
}
if (NC.Flags >= SELECTED)
{
opt = Flag_NC;
}
if (B.Flags >= SELECTED)
{
opt = Flag_B;
}
SI = (struct StringInfo *) PATH.SpecialInfo;
strcpy(*pc,(char *) SI->Buffer);
CloseWindow(wG);
return(opt);
}
struct AlertMessage
{
SHORT LeftEdge;
BYTE TopEdge;
char AlertText[50];
BYTE Flag;
};
struct AlertMessage TimeOut[] =
{
50, 24, "Achtung der PC/AT hat das letzte Datenpaket nicht", 255,
50, 34, "( richtig ? ) beantwortet. ", 255,
50, 44, "Daher wurde der Datentransfer eingestellt. ", 255,
50, 64, " Weiter mit linker / rechter Maustaste!", 0
};
struct AlertMessage NoLib[] =
{
50, 24, "Achtung, ich kann keine PC/AT Karte finden ? ", 255,
50, 44, "Daher wurde das Programm abgebrochen! ", 255,
50, 64, " Weiter mit linker / rechter Maustaste!", 0
};
extern char *CLI_Help =
"Datei(en) TO PC-pfad OPT [NC] keine Zeichensatzkonversion, aber LF in CRLF umwandeln\
\n [CR] keine Umwandlung von LF in CRLF, aber Zeichensatzkonversion\
\n [B] bedeutet beides [NC] und [CR];\
\n
Aufruf ohne Optionen => Volle Konversion
\n";
extern char *CLI_Template = "Datei(en)/...,TO/K,OPT/K";