home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 300-399 / ff304.lzh / Gears / abouthelp.c < prev    next >
C/C++ Source or Header  |  1990-01-10  |  2KB  |  97 lines

  1. /*
  2.  * abouthelp.c : file containing about(), and help(), as well as
  3.  *    all the text structs for autorequesters.
  4.  */
  5.  
  6. #include <intuition/intuition.h>
  7. #include "helpwin.h"
  8.  
  9. #define HELPCOLOR 2L
  10.  
  11. /*
  12.  *  Handle help request
  13.  */
  14.  
  15. extern struct Window *wG; /* main window */
  16. struct Window *wH;        /* help window */
  17. struct RastPort *rpH;     /* help RastPort */
  18.  
  19. struct Window *OpenWindow();
  20. struct IntuiMessage *GetMsg();
  21. struct TextFont *OpenFont();
  22.  
  23. help()
  24. {
  25.     struct IntuiMessage *message;    /* the message from the IDCMP */
  26.     struct TextFont *font;
  27.     ULONG class;
  28.     int i, j;
  29.     int dun = FALSE;
  30.  
  31.     font = NULL;
  32.     wH = NULL;
  33.  
  34.     wH = OpenWindow(&NewWindowStructureHelp);    /* open the window */
  35.     if ( wH == NULL )
  36.         {
  37.         AutoRequest(wG,&winfailtxt,0L,&oktxt,0L,0L,300L,75L);
  38.         return;
  39.         }
  40.  
  41.     rpH = wH->RPort;    /* get a rastport pointer for the window */
  42.  
  43.     font = OpenFont(&TOPAZ80); /* make sure correct size font */
  44.     if (font) SetFont(rpH,font);
  45.     SetAPen(rpH,HELPCOLOR);
  46.     i = 0;
  47.  
  48.     while (!dun) /* repeat til all of text array has been read */
  49.         {
  50.         for (j=0; i<40; j++, i++)    /* dump the help text array */
  51.             {
  52.             if (!HelpText[i]) { dun=TRUE;  break;}
  53.             if (*HelpText[i] == '\f')  { ++i; break; } /* pause for page */
  54.             Move(rpH,25L,(long) j*8+20);
  55.             if (*HelpText[i] != '\0' )
  56.                 Text(rpH,HelpText[i], (long) strlen(HelpText[i]));
  57.             }
  58.         while(1)    /* Process all messages */
  59.             {
  60.             WaitPort(wH->UserPort); /* wait for a message */
  61.                 while( (message = (struct IntuiMessage *)
  62.                     GetMsg(wH->UserPort) ) != NULL)
  63.                 {
  64.                     class = message->Class;
  65.                     ReplyMsg(message);
  66.                     switch (class)
  67.                         {
  68.                         case GADGETUP:  /* MORE is the only gadget */
  69.                             goto next;
  70.                             break;
  71.                         case MENUPICK:
  72.                             continue;
  73.                         }
  74.                 }
  75.             } 
  76.   next:
  77.         SetAPen(rpH,0L);   /* clear window for next page */
  78.         RectFill(rpH,2L,12L,(long)wH->Width-3L,(long)wH->Height-2L);
  79.         RefreshGList(&HelpDone_Gad,wH,NULL,-1L);
  80.         SetAPen(rpH,HELPCOLOR);
  81.         }
  82.     if (font) CloseFont(font);
  83.     if (wH) CloseWindow(wH);
  84.  
  85. }
  86.  
  87.  
  88. /*
  89.  *  Handle 'about' request
  90.  */
  91.  
  92.  
  93. about()
  94. {
  95.     AutoRequest(wG,&aboutmsg,0L,&oktxt,0L,0L,300L,75L);
  96. }
  97.