Metropoli BBS
VIEWER: wbhelp.c MODE: TEXT (ASCII)
/***************************************************************************
 *		  Copyright (C) 1994  Charles P. Peterson                  *
 *	     4007 Enchanted Sun, San Antonio, Texas 78244-1254             *
 *              Email: Charles_P_Peterson@fcircus.sat.tx.us                *
 *                                                                         *
 *		  This is free software with NO WARRANTY.                  *
 *	      See gfft.c, or run program itself, for details.              *
 *		      Support is available for a fee.                      *
 ***************************************************************************
 *
 * Program:     gfft--General FFT analysis
 * File:        wbhelp.c
 * Purpose:     help requester
 * Author:      Charles Peterson (CPP)
 * History:     2-March-1994 CPP; Created.
 *              7-July-1994 CPP (0.75); Added MORE button
 *              14-Dec-94 CPP (1.17); Fix button gadgets for >4 colors
 * Comments:    Workbench GUI.  Amiga Dependent!
 */

#ifdef AMIGA  /* This module is AMIGA dependent */

#include <stdio.h>     /* sprintf() */
#include <string.h>

/*
 * Amiga includes
 */
#include <exec/types.h>
#include <workbench/workbench.h>
#include <intuition/intuition.h>
#include <clib/intuition_protos.h>
#include <clib/exec_protos.h>
#include <dos.h> /* chkabort() */

/*
 * GFFT includes
 */
#include "gfft.h"
#include "settings.h"  /* for testing */
#include "wbench.h"

/*
 * External globals
 */
extern struct Window *dialog_window_p;

static struct Requester *help_rp = NULL;

static struct Gadget *end_help_gadgetp;
static struct Gadget *intro__gadgetp, *enter_topic_gadgetp;
static struct Gadget *topics__gadgetp;
static struct Gadget *more__gadgetp;

static struct IntuiText *line1_textp;
static struct IntuiText *line2_textp;
static struct IntuiText *line3_textp;
static struct IntuiText *line4_textp;
static struct IntuiText *line5_textp;


void workbench_help_requester (void)
{
    struct IntuiMessage *message;
    APTR *address = NULL;
    ULONG class = 0;
    UWORD qualifier = NULL;

    if (!help_rp)
    {
	gadget__begin (GTYP_REQGADGET);
/*
 * Setup Text
 */
	line1_textp = requester_text__new
  ("For help with any gadget, hold the CTRL key while clicking it.",
   0, 0);

	line2_textp = requester_text__new
  ("For information about the author, available services, and your rights",
   0, 1);

	line3_textp = requester_text__new
  ("    regarding this program, click the version/copyright button (top).",
   0, 2);

	line4_textp = requester_text__new
  ("HINT: After selecting Sample File (and modifying parameters and options,",
   0, 3);

	line5_textp = requester_text__new
  ("    if desired) click the OK button (bottom right of dialog window).",
   0, 4);

/*
 * Setup Gadgets
 */
	more__gadgetp = action_button__new ("MORE",
						64, 0);

	intro__gadgetp = action_button__new ("Intro",
						0, 5);

	topics__gadgetp = action_button__new ("Topics", 8, 5);

#define MAX_TOPIC_LENGTH 50
	enter_topic_gadgetp = string_gadget__new ("Topic:", 
						  NullString,
						  MAX_TOPIC_LENGTH,
						  43, 17, 5);

	end_help_gadgetp = tall_action_button__new
	  ("...OK",
	   63, 5);

	help_rp = requester__new ();
	help_rp->ReqGadget = end_help_gadgetp;
	help_rp->ReqText = line5_textp;

    } /* Ok, help_rp has been created */
    
    if (requester__display (help_rp, dialog_window_p))
    {
	while (TRUE)
	{
	    Wait (1 << dialog_window_p->UserPort->mp_SigBit);
	    while (message = (struct IntuiMessage *) GetMsg 
		   (dialog_window_p->UserPort))
	    {
		CATCH_ERROR
		class = message->Class;
		qualifier = message->Qualifier;
		address = message->IAddress;
		ReplyMsg ((struct Message *) message);
		if (address == (APTR) intro__gadgetp)
		{
		    help_message ("introduction");
		}
		else if (address == (APTR) more__gadgetp)
		{
		    help_message ("Workbench More-Help");
		}
		else if (address == (APTR) topics__gadgetp)
		{
		    help_message ("topics");
		}
		else if (address == (APTR) enter_topic_gadgetp)
		{
		    if (qualifier & IEQUALIFIER_CONTROL)
		    {
			help_message ("Workbench Help Topics");
		    }
		    else
		    {
			if (class == IDCMP_GADGETDOWN) break;
			string_gadget__apply 
			  (enter_topic_gadgetp, help_message);
		    }
		}
		else if (address == (APTR) end_help_gadgetp)
		{
		    requester__remove (help_rp, dialog_window_p);
		    return;
		}
		END_CATCH_ERROR
	    }
	}
    }
}

#endif /* end ifdef AMIGA */
[ RETURN TO DIRECTORY ]