void PrintError(char * msg) { PrintFault(IoErr(), "IoErr"); if( G->CliUsage ) { Printf("\n +++ Error: %s\n", (long) msg ); } else { STATIC UBYTE okm[] = "Ok"; static struct IntuiText body = { 0,0,0, 15,5, NULL, NULL, NULL }; static struct IntuiText ok = { 0,0,0, 6,3, NULL, okm, NULL }; if(((struct Process *)FindTask(NULL))->pr_WindowPtr != (APTR)-1L) { body.IText = (UBYTE *)msg; AutoRequest(NULL,&body,NULL,&ok,0,0,640,72); } } }
SaveGraph() { short tx=rasInfo->RxOffset,ty=rasInfo->RyOffset; Scrollit(-tx,-ty); DisplaySprites(FALSE); fileRequester->fr_Hail="Save Graph as file"; strcpy(fileRequester->fr_Dir,"pw:graph"); strcpy(fileRequester->fr_File,lastgraph); /* Last maze loaded */ LoadColors(&PlayScreen->ViewPort,FR_COLORS); #if 1 || REGISTERED_USER if(FileRequest(fileRequester)) { strcpy(fr_path,fileRequester->fr_Dir); strcpy(fr_name,fileRequester->fr_File); strcpy(filename,fr_path); if ( !strchr("/:\0",fr_path[strlen(fr_path)-1]) && strlen(fr_path)) strcat(filename,"/"); if (strlen(filename) > 1 && strlen(fr_name)) { strcat(filename,fr_name); WriteGraph(filename); } } #else AutoRequest(PlayWindow,®istertext[0],®postext,®negtext,0L,0L,320,61); #endif SetMazeColors(); Scrollit(tx,ty); ScreenToFront(PlayScreen); DisplaySprites(sprites_on); ToggleScreenToFront(1); return 0; }
/*********************************************************************************** * Procedure: request * Synopsis: rc = request(nochoice, txtidx, parm, option) * Purpose: Present a requester to the user ***********************************************************************************/ int request(int nochoice, int txtidx, char *parm, char *option ) { int rqrc; #ifdef PROJECT_VMAKE /* VOpts doesn't support REXX - under VMake want to fail with no requester */ if (global.inrexx) { global.rexxrc = txtidx; /* rexx RC matches config file text entries */ return 0; /* equivalent to user clicking "Cancel" */ } #endif if (IntuitionBase->LibNode.lib_Version >= 36) { int i; ULONG iflags; char *args[5]; struct EasyStruct RespES = { sizeof(struct EasyStruct), 0, NULL, "%s", "%s|%s" }; i = 0; args[i++] = global.text[txtidx]; if (parm) { RespES.es_TextFormat = "%s\n%s"; args[i++] = parm; } if (nochoice) { RespES.es_GadgetFormat = global.text[TEXT_OK]; } else { args[i++] = global.text[TEXT_OK]; if (option) { RespES.es_GadgetFormat = "%s|%s|%s"; args[i++] = option; } args[i++] = global.text[TEXT_CANCEL]; } iflags = IDCMP_DISKINSERTED; rqrc = EasyRequestArgs(global.window, &RespES, &iflags, (APTR)args); } else { struct IntuiText body, body1, pos, neg; int width, height; body.FrontPen = body.BackPen = -1; body.DrawMode = JAM1; body.LeftEdge = 6; body.TopEdge = 4; body.ITextFont = &global.ri.TextAttr; body.IText = global.text[txtidx]; body.NextText = NULL; body1 = body; pos = body; neg = body; width = IntuiTextLength(&body); height = 4 * global.iheight; if (parm) { int ewidth; body.NextText = &body1; body1.IText = parm; body1.TopEdge = global.iheight; height += global.iheight; ewidth = IntuiTextLength(&body1); if (ewidth > width) width = ewidth; } width += 36; /* margins, resize gadget etc. */ pos.IText = global.text[TEXT_OK]; if (nochoice) { neg.IText = pos.IText; } else { neg.IText = global.text[TEXT_CANCEL]; } rqrc = AutoRequest(global.window, &body, &pos, &neg, 0, 0, width, height); } #ifdef PROJECT_VMAKE /* VOpts doesn't support ARexx - want VMake to set ARexx return code */ /* unless user followed a success path from the requester */ if ((rqrc == 0) || nochoice) global.rexxrc = txtidx; #endif return rqrc; }