home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of A1200
/
World_Of_A1200.iso
/
programs
/
develop
/
visualarts
/
demo
/
source
/
multisub.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-02-27
|
7KB
|
241 lines
/* ******************************************************************** */
/* C code generated by: */
/* Visual Arts Version 2.0 */
/* Copyright 1994 Danny Y. Wong All rights reserved */
/* Calgary, Alberta (CANADA) */
/* Partial of the code is copyright by Jaba Development */
/* ******************************************************************** */
#include "VisualArts.h"
#define ID_sObjID2 0
#define ID_sObjID4 1
#define SubPrgNumGads 2
#define SubPrgNumPopUpGads 1
#include "MultiSub.h"
int sObjID3Obj(struct VAobject VAObject);
int sObjID2Obj(struct VAobject VAObject);
int sObjID4Obj(struct VAobject VAObject);
int OpenSubPrgWindow(char windtitle[80]);
void CloseSubPrgWindow(void);
int SubPrgHandler(void);
int SubPrgMainHandler(void);
void DrawSubPrgObjs(void);
void SubPrg(void);
extern struct WindowNode *ContextSActiveWind;
struct Gadget *SubPrgGList = NULL;
struct Gadget *SubPrgGadgets[SubPrgNumGads];
struct Gadget *SubPrgPopUpGadgets[SubPrgNumPopUpGads];
Class *SubPrgPopUpClass;
struct IntuiMessage SubPrgMsg;
UWORD SubPrgLeft = 168;
UWORD SubPrgTop = 116;
UWORD SubPrgWidth = 298;
UWORD SubPrgHeight = 63;
extern struct IntuitionBase *IntuitionBase;
extern struct List *ContextSWindList;
extern UWORD ContextSTotalWindows;
UWORD SubPrgNumWindows = 0;
extern struct TextAttr topaz8;
extern struct TextAttr topaz800;
UBYTE *ModelsALabels[] = {
(UBYTE *)"Amiga 500",
(UBYTE *)"Amiga 1000",
(UBYTE *)"Amiga 2000",
(UBYTE *)"Amiga 3000",
(UBYTE *)"Amiga 4000",
(UBYTE *)"Amiga CDTV",
(UBYTE *)"Amiga CD32",
NULL
};
WORD SubPrgGadTypes[] = {
LISTVIEW_KIND,
PALETTE_KIND,
};
struct NewGadget SubPrgNGads[] = {
7, 1, 149, 44, (UBYTE *)"", &topaz800, ID_sObjID2, PLACETEXT_ABOVE, NULL, (APTR)sObjID2Obj,
165, 18, 117, 27, (UBYTE *)"", &topaz800, ID_sObjID4, PLACETEXT_ABOVE, NULL, (APTR)sObjID4Obj,
};
ULONG SubPrgNTags[] = {
(GTLV_Labels), NULL, (GTLV_Top), 0, (GTLV_ScrollWidth), 16, (LAYOUTA_Spacing), 0, TAG_DONE,
(GTPA_Depth), 2, (GTPA_Color), 1, (GTPA_ColorOffset), 0, (GTPA_IndicatorWidth), 10, TAG_DONE,
};
ULONG SubPrgPopUpNTags[] = {
GA_Left, 167, GA_Top, 14,
GA_Height, 12, GA_Width, 119,
GA_RelVerify, TRUE, GA_ID, 2,
PUMG_NewLook, TRUE, GA_UserData, (ULONG)((APTR)sObjID3Obj),
PUMG_Active, 0, TAG_DONE,
};
int OpenSubPrgWindow(char windtitle[80])
{
struct NewGadget NewGad;
struct Gadget *Gad;
register UWORD i, j;
UWORD offsetx = Scr->WBorLeft;
UWORD offsety = Scr->WBorTop + Scr->RastPort.TxHeight + 1;
if (!(SubPrgPopUpClass = CreatePopUpMenuClass()))
return(1L);
if (SubPrgNumWindows == 0)
{
if (!(Gad = CreateContext(&SubPrgGList)))
return(1L);
for (i=0, j=0; i < SubPrgNumGads; i++)
{
CopyMem((char *)&SubPrgNGads[i], (char *)&NewGad, (long)sizeof(struct NewGadget));
NewGad.ng_VisualInfo = VisualInfo;
NewGad.ng_LeftEdge += offsetx;
NewGad.ng_TopEdge += offsety;
SubPrgGadgets[i] = Gad = CreateGadgetA((ULONG)SubPrgGadTypes[i], Gad, &NewGad,
(struct TagItem *)&SubPrgNTags[j]);
while (SubPrgNTags[j])
j +=2;
j++;
if (!Gad)
return(2L);
}
}
if (!(ContextSActiveWind = AddWindowNode(ContextSWindList, windtitle, SubPrgHandler)))
return(1);
if (!(ContextSActiveWind->nn_Window = OpenWindowTags(NULL,
WA_Left, SubPrgLeft,
WA_Top, SubPrgTop,
WA_Width, SubPrgWidth,
WA_Height, SubPrgHeight - Scr->WBorTop,
WA_NewLookMenus, TRUE,
WA_IDCMP, IDCMP_CLOSEWINDOW | IDCMP_NEWSIZE | IDCMP_MOUSEBUTTONS | IDCMP_MOUSEMOVE | IDCMP_GADGETUP | IDCMP_GADGETDOWN | IDCMP_INTUITICKS | IDCMP_ACTIVEWINDOW | IDCMP_INACTIVEWINDOW ,
WA_Flags, WFLG_CLOSEGADGET | WFLG_DEPTHGADGET | WFLG_SMART_REFRESH |
WFLG_ACTIVATE | WFLG_DRAGBAR ,
WA_Gadgets, SubPrgGList,
WA_Title, windtitle,
WA_ScreenTitle, "Visual Arts V2.0 Copyright 1994 Danny Y. Wong All Rights Reserved.",
WA_PubScreen, Scr,
WA_MinWidth, 160,
WA_MinHeight, 50,
WA_MaxWidth, 640,
WA_MaxHeight, 200,
TAG_DONE)))
return(3L);
if (++SubPrgNumWindows == 1)
CreateSubPrgLists();
for (i=0, j=0; i < SubPrgNumPopUpGads; i++)
{
SubPrgPopUpGadgets[i]=NewObjectA(SubPrgPopUpClass, NULL, (struct TagItem *)&SubPrgPopUpNTags[j]);
if (SubPrgPopUpGadgets[i])
AddGadget(ContextSActiveWind->nn_Window, SubPrgPopUpGadgets[i], -1);
while (SubPrgPopUpNTags[j])
j +=2;
j++;
}
GT_RefreshWindow(ContextSActiveWind->nn_Window, NULL);
RefreshGadgets(SubPrgGadgets[0], ContextSActiveWind->nn_Window, NULL);
GT_SetGadgetAttrs(SubPrgGadgets[0], ContextSActiveWind->nn_Window, NULL,
GTLV_Labels, SubPrgLists[0], TAG_END);
SetGadgetAttrs(SubPrgPopUpGadgets[0], ContextSActiveWind->nn_Window, NULL,
PUMG_Labels, SubPrgLists[0], TAG_END);
RefreshGadgets(SubPrgPopUpGadgets[0], ContextSActiveWind->nn_Window, NULL);
return(0L);
}
int SubPrgHandler(void)
{
struct IntuiMessage *msg;
struct VAobject VAObject;
int running = 1;
int (*func)(struct VAobject VAObject);
struct WindowNode *WindNode;
ULONG class;
UWORD code;
while (msg=GT_GetIMsg(ContextSActiveWind->nn_Window->UserPort))
{
CopyMem((char *)msg, (char *)&SubPrgMsg, (long)sizeof(struct IntuiMessage));
class = msg->Class;
code = msg->Code;
GT_ReplyIMsg(msg);
switch(class)
{
case IDCMP_MOUSEBUTTONS :
break;
case IDCMP_MOUSEMOVE :
break;
case IDCMP_INTUITICKS :
break;
case IDCMP_NEWSIZE:
break;
case IDCMP_CLOSEWINDOW:
CloseContextSWindow();
if (--SubPrgNumWindows == 0)
{
if (SubPrgGList)
FreeGadgets(SubPrgGList);
for (running=0; running < 1; running++)
FreeList(SubPrgLists[running]);
if (SubPrgPopUpClass)
DisposePopUpMenuClass(SubPrgPopUpClass);
}
return(1);
break;
case IDCMP_ACTIVEWINDOW:
case IDCMP_INACTIVEWINDOW:
if (!IntuitionBase->ActiveWindow)
{
ActivateWindow(ContextSActiveWind->nn_Window);
break;
}
WindNode = FindWindowNode(ContextSWindList, IntuitionBase->ActiveWindow->Title);
if (WindNode)
ContextSActiveWind = WindNode;
break;
case IDCMP_GADGETUP:
VAObject.va_Window = (struct Window *)ContextSActiveWind->nn_Window ;
VAObject.va_Gadget = (struct Gadget *)msg->IAddress;
VAObject.va_IntuiMsg = (struct IntuiMessage *)msg;
VAObject.va_Flags = 0;
VAObject.va_UserData = 0;
func = (void *)((struct Gadget *)SubPrgMsg.IAddress)->UserData;
if (func != NULL)
running = func(VAObject);
break;
}
}
return(running);
}
void SubPrg(void)
{
int rc;
for (rc=0; rc < 1; rc++)
SubPrgLists[rc]=GetNewList();
rc = OpenSubPrgWindow("Sub-Program");
}