/* $Revision Header *** Header built automatically - do not edit! ***********
 *
 *	(C) Copyright 1991 by Torsten Jürgeleit
 *
 *	Name .....: window.c
 *	Created ..: Sunday 22-Dec-91 21:23:20
 *	Revision .: 0
 *
 *	Date        Author                 Comment
 *	=========   ====================   ====================
 *	22-Dec-91   Torsten Jürgeleit      Created this file!
 *
 ****************************************************************************
 *
 *	Change project window
 *
 * $Revision Header ********************************************************/

	/* Includes */

#include "includes.h"
#include "defines.h"
#include "imports.h"
#include "protos.h"

	/* Defines for window */

#define WINDOW_TITLE_LEFT_EDGE	0
#define WINDOW_TITLE_TOP_EDGE	5
#define WINDOW_TITLE_TYPE	TEXT_DATA_TYPE_TEXT
#define WINDOW_TITLE_FLAGS	(TEXT_DATA_FLAG_CENTER | TEXT_DATA_FLAG_BOLD)
#define WINDOW_TITLE_TEXT	"Change project window"
#define WINDOW_TITLE_TEXT_ATTR	&topaz80_attr

	/* Defines for window gadgets */

#define WINDOW_GADGET_OK		0
#define WINDOW_GADGET_CANCEL		1
#define WINDOW_GADGET_LEFT_EDGE		2
#define WINDOW_GADGET_TOP_EDGE		3
#define WINDOW_GADGET_WIDTH		4
#define WINDOW_GADGET_HEIGHT		5
#define WINDOW_GADGET_RESIZING		6
#define WINDOW_GADGET_BACK_FILL		7
#define WINDOW_GADGET_RENDER_COLORS	8
#define WINDOW_GADGET_AVAIL_FONTS	9

#define WINDOW_GADGET1_TYPE		GADGET_DATA_TYPE_BUTTON
#define WINDOW_GADGET1_FLAGS		GADGET_DATA_FLAG_HOTKEY
#define WINDOW_GADGET1_TEXT		"_Ok"
#define WINDOW_GADGET1_LEFT_EDGE	((EDITOR_WINDOW_WIDTH / 2 - WINDOW_GADGET1_WIDTH) / 2)
#define WINDOW_GADGET1_TOP_EDGE		(EDITOR_WINDOW_HEIGHT - WINDOW_GADGET1_HEIGHT - 5)
#define WINDOW_GADGET1_WIDTH		((6 + 2) * 8)
#define WINDOW_GADGET1_HEIGHT		15
#define WINDOW_GADGET1_TEXT_ATTR	&topaz80_attr

#define WINDOW_GADGET2_TYPE		GADGET_DATA_TYPE_BUTTON
#define WINDOW_GADGET2_FLAGS		GADGET_DATA_FLAG_HOTKEY
#define WINDOW_GADGET2_TEXT		"_Cancel"
#define WINDOW_GADGET2_LEFT_EDGE	(EDITOR_WINDOW_WIDTH / 2 + (EDITOR_WINDOW_WIDTH / 2 - WINDOW_GADGET1_WIDTH) / 2)
#define WINDOW_GADGET2_TOP_EDGE		(EDITOR_WINDOW_HEIGHT - WINDOW_GADGET1_HEIGHT - 5)
#define WINDOW_GADGET2_WIDTH		WINDOW_GADGET1_WIDTH
#define WINDOW_GADGET2_HEIGHT		WINDOW_GADGET1_HEIGHT
#define WINDOW_GADGET2_TEXT_ATTR	&topaz80_attr

#define WINDOW_GADGET3_TYPE		GADGET_DATA_TYPE_INTEGER
#define WINDOW_GADGET3_FLAGS		(GADGET_DATA_FLAG_HOTKEY | GADGET_DATA_FLAG_TEXT_LEFT | GADGET_DATA_FLAG_INPUT_AUTO_ACTIVATE)
#define WINDOW_GADGET3_LEFT_EDGE	(90 + (9 + 1) * 8)
#define WINDOW_GADGET3_TOP_EDGE		21
#define WINDOW_GADGET3_WIDTH		52
#define WINDOW_GADGET3_HEIGHT		12
#define WINDOW_GADGET3_TEXT		"_Left edge"
#define WINDOW_GADGET3_TEXT_ATTR	&topaz80_attr
#define WINDOW_GADGET3_INPUT_LEN	5
#define WINDOW_GADGET3_INPUT_ACTIVATE	((ULONG)WINDOW_GADGET_TOP_EDGE << 16 | WINDOW_GADGET_HEIGHT)
#define WINDOW_GADGET3_INPUT_DEFAULT	NULL

#define WINDOW_GADGET4_TYPE		GADGET_DATA_TYPE_INTEGER
#define WINDOW_GADGET4_FLAGS		(GADGET_DATA_FLAG_HOTKEY | GADGET_DATA_FLAG_TEXT_LEFT | GADGET_DATA_FLAG_INPUT_AUTO_ACTIVATE)
#define WINDOW_GADGET4_LEFT_EDGE	WINDOW_GADGET3_LEFT_EDGE
#define WINDOW_GADGET4_TOP_EDGE		(WINDOW_GADGET3_TOP_EDGE + WINDOW_GADGET3_HEIGHT + 4)
#define WINDOW_GADGET4_WIDTH		WINDOW_GADGET3_WIDTH
#define WINDOW_GADGET4_HEIGHT		WINDOW_GADGET3_HEIGHT
#define WINDOW_GADGET4_TEXT		"_Top edge"
#define WINDOW_GADGET4_TEXT_ATTR	&topaz80_attr
#define WINDOW_GADGET4_INPUT_LEN	5
#define WINDOW_GADGET4_INPUT_ACTIVATE	((ULONG)WINDOW_GADGET_WIDTH << 16 | WINDOW_GADGET_LEFT_EDGE)
#define WINDOW_GADGET4_INPUT_DEFAULT	NULL

#define WINDOW_GADGET5_TYPE		GADGET_DATA_TYPE_INTEGER
#define WINDOW_GADGET5_FLAGS		(GADGET_DATA_FLAG_HOTKEY | GADGET_DATA_FLAG_TEXT_LEFT | GADGET_DATA_FLAG_INPUT_AUTO_ACTIVATE)
#define WINDOW_GADGET5_LEFT_EDGE	WINDOW_GADGET3_LEFT_EDGE
#define WINDOW_GADGET5_TOP_EDGE		(WINDOW_GADGET4_TOP_EDGE + WINDOW_GADGET3_HEIGHT + 4)
#define WINDOW_GADGET5_WIDTH		WINDOW_GADGET3_WIDTH
#define WINDOW_GADGET5_HEIGHT		WINDOW_GADGET3_HEIGHT
#define WINDOW_GADGET5_TEXT		"_Width"
#define WINDOW_GADGET5_TEXT_ATTR	&topaz80_attr
#define WINDOW_GADGET5_INPUT_LEN	5
#define WINDOW_GADGET5_INPUT_ACTIVATE	((ULONG)WINDOW_GADGET_HEIGHT << 16 | WINDOW_GADGET_TOP_EDGE)
#define WINDOW_GADGET5_INPUT_DEFAULT	NULL

#define WINDOW_GADGET6_TYPE		GADGET_DATA_TYPE_INTEGER
#define WINDOW_GADGET6_FLAGS		(GADGET_DATA_FLAG_HOTKEY | GADGET_DATA_FLAG_TEXT_LEFT | GADGET_DATA_FLAG_INPUT_AUTO_ACTIVATE)
#define WINDOW_GADGET6_LEFT_EDGE	WINDOW_GADGET3_LEFT_EDGE
#define WINDOW_GADGET6_TOP_EDGE		(WINDOW_GADGET5_TOP_EDGE + WINDOW_GADGET3_HEIGHT + 4)
#define WINDOW_GADGET6_WIDTH		WINDOW_GADGET3_WIDTH
#define WINDOW_GADGET6_HEIGHT		WINDOW_GADGET3_HEIGHT
#define WINDOW_GADGET6_TEXT		"_Height"
#define WINDOW_GADGET6_TEXT_ATTR	&topaz80_attr
#define WINDOW_GADGET6_INPUT_LEN	5
#define WINDOW_GADGET6_INPUT_ACTIVATE	((ULONG)WINDOW_GADGET_LEFT_EDGE << 16 | WINDOW_GADGET_WIDTH)
#define WINDOW_GADGET6_INPUT_DEFAULT	NULL

#define WINDOW_GADGET7_TYPE		GADGET_DATA_TYPE_CHECK
#define WINDOW_GADGET7_FLAGS		(GADGET_DATA_FLAG_HOTKEY | GADGET_DATA_FLAG_TEXT_RIGHT)
#define WINDOW_GADGET7_TEXT		"_Resizing gadget"
#define WINDOW_GADGET7_LEFT_EDGE	(WINDOW_GADGET3_LEFT_EDGE + WINDOW_GADGET3_WIDTH + 60)
#define WINDOW_GADGET7_TOP_EDGE		(WINDOW_GADGET3_TOP_EDGE + 1)
#define WINDOW_GADGET7_WIDTH		0
#define WINDOW_GADGET7_HEIGHT		0
#define WINDOW_GADGET7_TEXT_ATTR	&topaz80_attr

#define WINDOW_GADGET8_TYPE		GADGET_DATA_TYPE_CHECK
#define WINDOW_GADGET8_FLAGS		(GADGET_DATA_FLAG_HOTKEY | GADGET_DATA_FLAG_TEXT_RIGHT)
#define WINDOW_GADGET8_TEXT		"_Fill background"
#define WINDOW_GADGET8_LEFT_EDGE	WINDOW_GADGET7_LEFT_EDGE
#define WINDOW_GADGET8_TOP_EDGE		(WINDOW_GADGET7_TOP_EDGE + 17)
#define WINDOW_GADGET8_WIDTH		0
#define WINDOW_GADGET8_HEIGHT		0
#define WINDOW_GADGET8_TEXT_ATTR	&topaz80_attr

#define WINDOW_GADGET9_TYPE		GADGET_DATA_TYPE_CHECK
#define WINDOW_GADGET9_FLAGS		(GADGET_DATA_FLAG_HOTKEY | GADGET_DATA_FLAG_TEXT_RIGHT)
#define WINDOW_GADGET9_TEXT		"_Use render colors"
#define WINDOW_GADGET9_LEFT_EDGE	WINDOW_GADGET7_LEFT_EDGE
#define WINDOW_GADGET9_TOP_EDGE		(WINDOW_GADGET8_TOP_EDGE + 17)
#define WINDOW_GADGET9_WIDTH		0
#define WINDOW_GADGET9_HEIGHT		0
#define WINDOW_GADGET9_TEXT_ATTR	&topaz80_attr

#define WINDOW_GADGET10_TYPE		GADGET_DATA_TYPE_CHECK
#define WINDOW_GADGET10_FLAGS		(GADGET_DATA_FLAG_HOTKEY | GADGET_DATA_FLAG_TEXT_RIGHT)
#define WINDOW_GADGET10_TEXT		"_Avail fonts"
#define WINDOW_GADGET10_LEFT_EDGE	WINDOW_GADGET7_LEFT_EDGE
#define WINDOW_GADGET10_TOP_EDGE	(WINDOW_GADGET9_TOP_EDGE + 17)
#define WINDOW_GADGET10_WIDTH		0
#define WINDOW_GADGET10_HEIGHT		0
#define WINDOW_GADGET10_TEXT_ATTR	&topaz80_attr

	/* Statics for window requester */

STATIC struct GadgetData  window_gadget_data[] = {
   {
	WINDOW_GADGET1_TYPE,		/* gd_Type */
	WINDOW_GADGET1_FLAGS,		/* gd_Flags */
	WINDOW_GADGET1_LEFT_EDGE,	/* gd_LeftEdge */
	WINDOW_GADGET1_TOP_EDGE,	/* gd_TopEdge */
	WINDOW_GADGET1_WIDTH,		/* gd_Width */
	WINDOW_GADGET1_HEIGHT,		/* gd_Height */
	WINDOW_GADGET1_TEXT,		/* *gd_Text */
	WINDOW_GADGET1_TEXT_ATTR,	/* *gd_TextAttr */
	{ 0, 0, 0 }
   }, {
	WINDOW_GADGET2_TYPE,		/* gd_Type */
	WINDOW_GADGET2_FLAGS,		/* gd_Flags */
	WINDOW_GADGET2_LEFT_EDGE,	/* gd_LeftEdge */
	WINDOW_GADGET2_TOP_EDGE,	/* gd_TopEdge */
	WINDOW_GADGET2_WIDTH,		/* gd_Width */
	WINDOW_GADGET2_HEIGHT,		/* gd_Height */
	WINDOW_GADGET2_TEXT,		/* *gd_Text */
	WINDOW_GADGET2_TEXT_ATTR,	/* *gd_TextAttr */
	{ 0, 0, 0 }
   }, {
	WINDOW_GADGET3_TYPE,		/* gd_Type */
	WINDOW_GADGET3_FLAGS,		/* gd_Flags */
	WINDOW_GADGET3_LEFT_EDGE,	/* gd_LeftEdge */
	WINDOW_GADGET3_TOP_EDGE,	/* gd_TopEdge */
	WINDOW_GADGET3_WIDTH,		/* gd_Width */
	WINDOW_GADGET3_HEIGHT,		/* gd_Height */
	WINDOW_GADGET3_TEXT,		/* *gd_Text */
	WINDOW_GADGET3_TEXT_ATTR,	/* *gd_TextAttr */
	{
	WINDOW_GADGET3_INPUT_LEN,	/* gd_InputLen */
	WINDOW_GADGET3_INPUT_ACTIVATE,	/* gd_InputActivate */
	WINDOW_GADGET3_INPUT_DEFAULT	/* gd_InputDefault */
	}
   }, {
	WINDOW_GADGET4_TYPE,		/* gd_Type */
	WINDOW_GADGET4_FLAGS,		/* gd_Flags */
	WINDOW_GADGET4_LEFT_EDGE,	/* gd_LeftEdge */
	WINDOW_GADGET4_TOP_EDGE,	/* gd_TopEdge */
	WINDOW_GADGET4_WIDTH,		/* gd_Width */
	WINDOW_GADGET4_HEIGHT,		/* gd_Height */
	WINDOW_GADGET4_TEXT,		/* *gd_Text */
	WINDOW_GADGET4_TEXT_ATTR,	/* *gd_TextAttr */
	{
	WINDOW_GADGET4_INPUT_LEN,	/* gd_InputLen */
	WINDOW_GADGET4_INPUT_ACTIVATE,	/* gd_InputActivate */
	WINDOW_GADGET4_INPUT_DEFAULT	/* gd_InputDefault */
	}
   }, {
	WINDOW_GADGET5_TYPE,		/* gd_Type */
	WINDOW_GADGET5_FLAGS,		/* gd_Flags */
	WINDOW_GADGET5_LEFT_EDGE,	/* gd_LeftEdge */
	WINDOW_GADGET5_TOP_EDGE,	/* gd_TopEdge */
	WINDOW_GADGET5_WIDTH,		/* gd_Width */
	WINDOW_GADGET5_HEIGHT,		/* gd_Height */
	WINDOW_GADGET5_TEXT,		/* *gd_Text */
	WINDOW_GADGET5_TEXT_ATTR,	/* *gd_TextAttr */
	{
	WINDOW_GADGET5_INPUT_LEN,	/* gd_InputLen */
	WINDOW_GADGET5_INPUT_ACTIVATE,	/* gd_InputActivate */
	WINDOW_GADGET5_INPUT_DEFAULT	/* gd_InputDefault */
	}
   }, {
	WINDOW_GADGET6_TYPE,		/* gd_Type */
	WINDOW_GADGET6_FLAGS,		/* gd_Flags */
	WINDOW_GADGET6_LEFT_EDGE,	/* gd_LeftEdge */
	WINDOW_GADGET6_TOP_EDGE,	/* gd_TopEdge */
	WINDOW_GADGET6_WIDTH,		/* gd_Width */
	WINDOW_GADGET6_HEIGHT,		/* gd_Height */
	WINDOW_GADGET6_TEXT,		/* *gd_Text */
	WINDOW_GADGET6_TEXT_ATTR,	/* *gd_TextAttr */
	{
	WINDOW_GADGET6_INPUT_LEN,	/* gd_InputLen */
	WINDOW_GADGET6_INPUT_ACTIVATE,	/* gd_InputActivate */
	WINDOW_GADGET6_INPUT_DEFAULT	/* gd_InputDefault */
	}
   }, {
	WINDOW_GADGET7_TYPE,		/* gd_Type */
	WINDOW_GADGET7_FLAGS,		/* gd_Flags */
	WINDOW_GADGET7_LEFT_EDGE,	/* gd_LeftEdge */
	WINDOW_GADGET7_TOP_EDGE,	/* gd_TopEdge */
	WINDOW_GADGET7_WIDTH,		/* gd_Width */
	WINDOW_GADGET7_HEIGHT,		/* gd_Height */
	WINDOW_GADGET7_TEXT,		/* *gd_Text */
	WINDOW_GADGET7_TEXT_ATTR,	/* *gd_TextAttr */
	{ 0, 0, 0 }
   }, {
	WINDOW_GADGET8_TYPE,		/* gd_Type */
	WINDOW_GADGET8_FLAGS,		/* gd_Flags */
	WINDOW_GADGET8_LEFT_EDGE,	/* gd_LeftEdge */
	WINDOW_GADGET8_TOP_EDGE,	/* gd_TopEdge */
	WINDOW_GADGET8_WIDTH,		/* gd_Width */
	WINDOW_GADGET8_HEIGHT,		/* gd_Height */
	WINDOW_GADGET8_TEXT,		/* *gd_Text */
	WINDOW_GADGET8_TEXT_ATTR,	/* *gd_TextAttr */
	{ 0, 0, 0 }
   }, {
	WINDOW_GADGET9_TYPE,		/* gd_Type */
	WINDOW_GADGET9_FLAGS,		/* gd_Flags */
	WINDOW_GADGET9_LEFT_EDGE,	/* gd_LeftEdge */
	WINDOW_GADGET9_TOP_EDGE,	/* gd_TopEdge */
	WINDOW_GADGET9_WIDTH,		/* gd_Width */
	WINDOW_GADGET9_HEIGHT,		/* gd_Height */
	WINDOW_GADGET9_TEXT,		/* *gd_Text */
	WINDOW_GADGET9_TEXT_ATTR,	/* *gd_TextAttr */
	{ 0, 0, 0 }
   }, {
	WINDOW_GADGET10_TYPE,		/* gd_Type */
	WINDOW_GADGET10_FLAGS,		/* gd_Flags */
	WINDOW_GADGET10_LEFT_EDGE,	/* gd_LeftEdge */
	WINDOW_GADGET10_TOP_EDGE,	/* gd_TopEdge */
	WINDOW_GADGET10_WIDTH,		/* gd_Width */
	WINDOW_GADGET10_HEIGHT,		/* gd_Height */
	WINDOW_GADGET10_TEXT,		/* *gd_Text */
	WINDOW_GADGET10_TEXT_ATTR,	/* *gd_TextAttr */
	{ 0, 0, 0 }
   }, {
	INTUISUP_DATA_END		/* mark end of gadget data */
   }
};
	/* Change settings for project window */

   SHORT
change_project_window(VOID)
{
   struct GadgetData  *gd = &window_gadget_data[0];
   APTR   gl;
   USHORT flags = template_list.tl_Flags;
   SHORT  status;

   /* Init gadgets with current project window dimension */
   (gd + WINDOW_GADGET_LEFT_EDGE)->gd_SpecialData.gd_InputData.gd_InputDefault      = (BYTE *)pwin->LeftEdge;
   (gd + WINDOW_GADGET_TOP_EDGE)->gd_SpecialData.gd_InputData.gd_InputDefault       = (BYTE *)pwin->TopEdge;
   (gd + WINDOW_GADGET_WIDTH)->gd_SpecialData.gd_InputData.gd_InputDefault          = (BYTE *)pwin->Width;
   (gd + WINDOW_GADGET_HEIGHT)->gd_SpecialData.gd_InputData.gd_InputDefault         = (BYTE *)pwin->Height;
   (gd + WINDOW_GADGET_RESIZING)->gd_SpecialData.gd_CheckData.gd_CheckSelected      = (flags & TEMPLATE_LIST_FLAG_RESIZING ? 1 : 0);
   (gd + WINDOW_GADGET_BACK_FILL)->gd_SpecialData.gd_CheckData.gd_CheckSelected     = (flags & TEMPLATE_LIST_FLAG_BACK_FILL ? 1 : 0);
   (gd + WINDOW_GADGET_RENDER_COLORS)->gd_SpecialData.gd_CheckData.gd_CheckSelected = (flags & TEMPLATE_LIST_FLAG_RENDER_COLORS ? 1 : 0);
   (gd + WINDOW_GADGET_AVAIL_FONTS)->gd_SpecialData.gd_CheckData.gd_CheckSelected   = (flags & TEMPLATE_LIST_FLAG_AVAIL_FONTS ? 1 : 0);

   /* Print title and display gadgets */
   IClearWindow(eri, ewin, 0, 0, EDITOR_WINDOW_WIDTH, EDITOR_WINDOW_HEIGHT,
									 0);
   IPrintText(eri, ewin, WINDOW_TITLE_TEXT, WINDOW_TITLE_LEFT_EDGE,
	       WINDOW_TITLE_TOP_EDGE, WINDOW_TITLE_TYPE, WINDOW_TITLE_FLAGS,
						    WINDOW_TITLE_TEXT_ATTR);
   if (!(gl = ICreateGadgets(eri, &window_gadget_data[0], 0, 0, NULL))) {
      status = EDITOR_ERROR_OUT_OF_MEM;
   } else {
      IDisplayGadgets(ewin, gl);
      status = change_project_window_action(gl);
      IRemoveGadgets(gl);
      IFreeGadgets(gl);
   }
   return(status);
}
	/* Perform action for change project window settings */

   STATIC SHORT
change_project_window_action(APTR gl)
{
   struct TemplateList  *tl = &template_list;
   struct NewWindow     *nwin = &project_new_window;
   struct MsgPort       *up = ewin->UserPort;
   USHORT left_edge = pwin->LeftEdge, top_edge = pwin->TopEdge,
	  width = pwin->Width, height = pwin->Height,
	  max_width = wb_screen.Width, max_height = wb_screen.Height,
	  flags = tl->tl_Flags;
   BOOL   keepon = TRUE;
   SHORT  status = EDITOR_STATUS_NORMAL;

   do {
      struct IntuiMessage  *msg;

      WaitPort(up);
      while (msg = IGetMsg(up)) {
	 ULONG value;

	 switch (msg->Class) {
	    case CLOSEWINDOW :
	       status = EDITOR_STATUS_QUIT;
	       keepon = FALSE;
	       break;

	    case ISUP_ID :
	       value = (ULONG)msg->IAddress;
	       switch (msg->Code) {
		  case WINDOW_GADGET_OK :

		     /* Change project window */
		     nwin->LeftEdge = left_edge;
		     nwin->TopEdge  = top_edge;
		     nwin->Width    = width;
		     nwin->Height   = height;
		     tl->tl_Flags   = flags;
		     if ((status = new_project_window(tl, flags)) ==
						     EDITOR_STATUS_NORMAL) {
			refresh_all_templates();
		     }
		     keepon = FALSE;
		     break;

		  case WINDOW_GADGET_CANCEL :
		     keepon = FALSE;
		     break;

		  case WINDOW_GADGET_LEFT_EDGE :
		     if ((value + width) > max_width) {
			DisplayBeep(NULL);
			ISetGadgetAttributes(gl, WINDOW_GADGET_LEFT_EDGE,
			       0L, 0L, USE_CURRENT_VALUE, USE_CURRENT_VALUE,
							 (BYTE *)left_edge);
		     } else {
			left_edge = value;
			flags    |= TEMPLATE_LIST_FLAG_CHANGED;
		     }
		     break;

		  case WINDOW_GADGET_TOP_EDGE :
		     if ((value + height) > max_height) {
			DisplayBeep(NULL);
			ISetGadgetAttributes(gl, WINDOW_GADGET_TOP_EDGE,
			       0L, 0L, USE_CURRENT_VALUE, USE_CURRENT_VALUE,
							  (BYTE *)top_edge);
		     } else {
			top_edge = value;
			flags   |= TEMPLATE_LIST_FLAG_CHANGED;
		     }
		     break;

		  case WINDOW_GADGET_WIDTH :
		     if ((left_edge + value) > max_width) {
			DisplayBeep(NULL);
			ISetGadgetAttributes(gl, WINDOW_GADGET_WIDTH,
			       0L, 0L, USE_CURRENT_VALUE, USE_CURRENT_VALUE,
							     (BYTE *)width);
		     } else {
			width  = value;
			flags |= TEMPLATE_LIST_FLAG_CHANGED;
		     }
		     break;

		  case WINDOW_GADGET_HEIGHT :
		     if ((top_edge + value) > max_height) {
			DisplayBeep(NULL);
			ISetGadgetAttributes(gl, WINDOW_GADGET_HEIGHT,
			       0L, 0L, USE_CURRENT_VALUE, USE_CURRENT_VALUE,
							    (BYTE *)height);
		     } else {
			height = value;
			flags |= TEMPLATE_LIST_FLAG_CHANGED;
		     }
		     break;

		  case WINDOW_GADGET_RESIZING :
		     if (value) {
			flags |= TEMPLATE_LIST_FLAG_RESIZING;
		     } else {
			flags &= ~TEMPLATE_LIST_FLAG_RESIZING;
		     }
		     flags |= TEMPLATE_LIST_FLAG_CHANGED;
		     break;

		  case WINDOW_GADGET_BACK_FILL :
		     if (value) {
			flags |= TEMPLATE_LIST_FLAG_BACK_FILL;
		     } else {
			flags &= ~TEMPLATE_LIST_FLAG_BACK_FILL;
		     }
		     flags |= TEMPLATE_LIST_FLAG_CHANGED;
		     break;

		  case WINDOW_GADGET_RENDER_COLORS :
		     if (value) {
			flags |= TEMPLATE_LIST_FLAG_RENDER_COLORS;
		     } else {
			flags &= ~TEMPLATE_LIST_FLAG_RENDER_COLORS;
		     }
		     flags |= TEMPLATE_LIST_FLAG_CHANGED;
		     break;

		  case WINDOW_GADGET_AVAIL_FONTS :
		     if (value) {
			flags |= TEMPLATE_LIST_FLAG_AVAIL_FONTS;
		     } else {
			flags &= ~TEMPLATE_LIST_FLAG_AVAIL_FONTS;
		     }
		     flags |= TEMPLATE_LIST_FLAG_CHANGED;
		     break;
	       }
	       break;
	 }
	 IReplyMsg(msg);
      }
   } while (keepon == TRUE);
   return(status);
}
