home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 2 / goldfish_vol2_cd1.bin / files / misc / sci / gfft / source / wbhelp.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-10  |  4.3 KB  |  171 lines

  1. /***************************************************************************
  2.  *          Copyright (C) 1994  Charles P. Peterson                  *
  3.  *         4007 Enchanted Sun, San Antonio, Texas 78244-1254             *
  4.  *              Email: Charles_P_Peterson@fcircus.sat.tx.us                *
  5.  *                                                                         *
  6.  *          This is free software with NO WARRANTY.                  *
  7.  *          See gfft.c, or run program itself, for details.              *
  8.  *              Support is available for a fee.                      *
  9.  ***************************************************************************
  10.  *
  11.  * Program:     gfft--General FFT analysis
  12.  * File:        wbhelp.c
  13.  * Purpose:     help requester
  14.  * Author:      Charles Peterson (CPP)
  15.  * History:     2-March-1994 CPP; Created.
  16.  *              7-July-1994 CPP (0.75); Added MORE button
  17.  * Comments:    Workbench GUI.  Amiga Dependent!
  18.  */
  19.  
  20. #ifdef AMIGA  /* This module is AMIGA dependent */
  21.  
  22. #include <stdio.h>     /* sprintf() */
  23. #include <string.h>
  24.  
  25. /*
  26.  * Amiga includes
  27.  */
  28. #include <exec/types.h>
  29. #include <workbench/workbench.h>
  30. #include <intuition/intuition.h>
  31. #include <clib/intuition_protos.h>
  32. #include <clib/exec_protos.h>
  33. #include <dos.h> /* chkabort() */
  34.  
  35. /*
  36.  * GFFT includes
  37.  */
  38. #include "gfft.h"
  39. #include "settings.h"  /* for testing */
  40. #include "wbench.h"
  41.  
  42. /*
  43.  * External globals
  44.  */
  45. extern struct Window *dialog_window_p;
  46.  
  47. static struct Requester *help_rp = NULL;
  48.  
  49. static struct Gadget *end_help_gadgetp;
  50. static struct Gadget *intro__gadgetp, *enter_topic_gadgetp;
  51. static struct Gadget *topics__gadgetp;
  52. static struct Gadget *more__gadgetp;
  53.  
  54. static struct IntuiText *line1_textp;
  55. static struct IntuiText *line2_textp;
  56. static struct IntuiText *line3_textp;
  57. static struct IntuiText *line4_textp;
  58. static struct IntuiText *line5_textp;
  59.  
  60.  
  61. void workbench_help_requester (void)
  62. {
  63.     struct IntuiMessage *message;
  64.     APTR *address = NULL;
  65.     ULONG class = 0;
  66.     UWORD qualifier = NULL;
  67.  
  68.     if (!help_rp)
  69.     {
  70.     gadget__begin (GTYP_REQGADGET);
  71. /*
  72.  * Setup Text
  73.  */
  74.     line1_textp = requester_text__new
  75.   ("For help with any gadget, hold the CTRL key while clicking it.",
  76.    0, 0);
  77.  
  78.     line2_textp = requester_text__new
  79.   ("For information about the author, available services, and your rights",
  80.    0, 1);
  81.  
  82.     line3_textp = requester_text__new
  83.   ("    regarding this program, click the version/copyright button (top).",
  84.    0, 2);
  85.  
  86.     line4_textp = requester_text__new
  87.   ("HINT: After selecting Read File (and modifying parameters and options,",
  88.    0, 3);
  89.  
  90.     line5_textp = requester_text__new
  91.   ("    if desired) click the OK button (bottom right of dialog window).",
  92.    0, 4);
  93.  
  94. /*
  95.  * Setup Gadgets
  96.  */
  97.     more__gadgetp = text_button__new ("MORE",
  98.                         64, 0);
  99.  
  100.     intro__gadgetp = text_button__new ("Intro",
  101.                         0, 5);
  102.  
  103.     topics__gadgetp = text_button__new ("Topics", 8, 5);
  104.  
  105. #define MAX_TOPIC_LENGTH 50
  106.     enter_topic_gadgetp = string_gadget__new ("Topic:", 
  107.                           NullString,
  108.                           MAX_TOPIC_LENGTH,
  109.                           43, 17, 5);
  110.  
  111.     end_help_gadgetp = text_button__new
  112.       ("...OK",
  113.        63, 5);
  114.  
  115.     help_rp = requester__new ();
  116.     help_rp->ReqGadget = end_help_gadgetp;
  117.     help_rp->ReqText = line5_textp;
  118.  
  119.     } /* Ok, help_rp has been created */
  120.     
  121.     if (requester__display (help_rp, dialog_window_p))
  122.     {
  123.     while (TRUE)
  124.     {
  125.         Wait (1 << dialog_window_p->UserPort->mp_SigBit);
  126.         while (message = (struct IntuiMessage *) GetMsg 
  127.            (dialog_window_p->UserPort))
  128.         {
  129.         CATCH_ERROR
  130.         class = message->Class;
  131.         qualifier = message->Qualifier;
  132.         address = message->IAddress;
  133.         ReplyMsg ((struct Message *) message);
  134.         if (address == (APTR) intro__gadgetp)
  135.         {
  136.             help_message ("introduction");
  137.         }
  138.         else if (address == (APTR) more__gadgetp)
  139.         {
  140.             help_message ("Workbench More-Help");
  141.         }
  142.         else if (address == (APTR) topics__gadgetp)
  143.         {
  144.             help_message ("topics");
  145.         }
  146.         else if (address == (APTR) enter_topic_gadgetp)
  147.         {
  148.             if (qualifier & IEQUALIFIER_CONTROL)
  149.             {
  150.             help_message ("Workbench Help Topics");
  151.             }
  152.             else
  153.             {
  154.             if (class == IDCMP_GADGETDOWN) break;
  155.             string_gadget__apply 
  156.               (enter_topic_gadgetp, help_message);
  157.             }
  158.         }
  159.         else if (address == (APTR) end_help_gadgetp)
  160.         {
  161.             requester__remove (help_rp, dialog_window_p);
  162.             return;
  163.         }
  164.         END_CATCH_ERROR
  165.         }
  166.     }
  167.     }
  168. }
  169.  
  170. #endif /* end ifdef AMIGA */
  171.