/* * abouthelp.c : file containing about(), and help(), as well as * all the text structs for autorequesters. */ #include #include "helpwin.h" /* * Handle help request */ extern struct Window *wG; /* main window */ struct Window *wH; /* help window */ struct RastPort *rpH; /* help RastPort */ struct Window *OpenWindow(); struct IntuiMessage *GetMsg(); struct TextFont *OpenFont(); help() { struct IntuiMessage *message; /* the message from the IDCMP */ struct TextFont *font; ULONG class; int i, j; int dun = FALSE; font = NULL; wH = NULL; wH = OpenWindow(&NewWindowStructureHelp); /* open the window */ if ( wH == NULL ) { AutoRequest(wG,&winfailtxt,0L,&oktxt,0L,0L,300L,75L); return; } rpH = wH->RPort; /* get a rastport pointer for the window */ font = OpenFont(&TOPAZ80); /* make sure correct size font */ if (font) SetFont(rpH,font); SetAPen(rpH,1L); i = 0; while (!dun) /* repeat til all of text array has been read */ { for (j=0; i<40; j++, i++) /* dump the help text array */ { if (!HelpText[i]) { dun=TRUE; break;} if (*HelpText[i] == '\f') { ++i; break; } /* pause for page */ Move(rpH,25L,(long) j*8+20); if (*HelpText[i] != '\0' ) Text(rpH,HelpText[i], (long) strlen(HelpText[i])); } while(1) /* Process all messages */ { WaitPort(wH->UserPort); /* wait for a message */ while( (message = (struct IntuiMessage *) GetMsg(wH->UserPort) ) != NULL) { class = message->Class; ReplyMsg(message); switch (class) { case GADGETUP: /* MORE is the only gadget */ goto next; break; case MENUPICK: continue; } } } next: SetAPen(rpH,0L); /* clear window for next page */ RectFill(rpH,2L,12L,(long)wH->Width-3L,(long)wH->Height-2L); RefreshGList(&HelpDone_Gad,wH,NULL,-1L); SetAPen(rpH,1L); } if (font) CloseFont(font); if (wH) CloseWindow(wH); } /* * Handle 'about' request */ about() { AutoRequest(wG,&aboutmsg,0L,&oktxt,0L,0L,300L,75L); }