/* INCLUDES ********************************************************** */ #include #include #include #include #include /* get the PowerWindows 2.0 code */ #include "NewIntroE.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, "Warning, the PC/AT did not reply to the Amiga ! ", 255, 50, 44, " Program terminated. ", 255, 50, 64, " Continue with left or right mouseclick!", 0 }; struct AlertMessage NoLib[] = { 50, 24, " Warning, can't find PC/AT board! " , 255, 50, 44, " Program terminated. ", 255, 50, 64, " Continue with left or right mouseclick!", 0 }; extern char *CLI_Help = "File(s) TO PC-path OPT [NC] no convert of char's, but convert LF to CRLF\ \n [CR] no convert of LF to CRLF, but convert char's\ \n [B] means both [NC] and [CR];\ \n default full conversion\n"; extern char *CLI_Template = "Files/...,TO/K,OPT/K";