home *** CD-ROM | disk | FTP | other *** search
- /* ******************************************************************** */
- /* C code generated by: */
- /* Visual Arts Version 1.0 */
- /* Copyright 1994 Danny Y. Wong All rights reserved */
- /* Calgary, Alberta (CANADA) */
- /* Partial of the code is copyright by Jaba Development */
- /* ******************************************************************** */
-
- /*
- this is the sub program which the main program will call. It will
- open the window and waits for events. Code generated with following
- preference settings:
-
- entry name: void MultiSub(void)
- project name: Models
- code options: every option except screens
-
- Note that the project is the Models that given in the 'Attr' in the
- window setting in the layout editor.
- */
-
- #include <exec/types.h>
- #include <exec/memory.h>
- #include <exec/lists.h>
- #include <exec/nodes.h>
- #include <intuition/intuitionbase.h>
- #include <intuition/intuition.h>
- #include <intuition/gadgetclass.h>
- #include <graphics/displayinfo.h>
- #include <graphics/gfxbase.h>
- #include <graphics/gfxmacros.h>
- #include <libraries/gadtools.h>
- #include <libraries/dos.h>
- #include <libraries/asl.h>
-
- #include <clib/exec_protos.h>
- #include <clib/intuition_protos.h>
- #include <clib/gadtools_protos.h>
- #include <clib/graphics_protos.h>
- #include <clib/utility_protos.h>
- #include <clib/alib_protos.h>
- #include <clib/dos_protos.h>
- #include <clib/asl_protos.h>
- #include "string.h"
- #include "stdlib.h"
-
- #define ID_numbers 0
- #define ID_numlist 1
-
- #define Window2NumGads 2
- #include "MultiSub.h"
-
- int numbersObj(struct VAobject VAObject);
- int numlistObj(struct VAobject VAObject);
-
- int OpenWindow2Window(char windtitle[80]);
- void CloseWindow2Window(void);
- int Window2Handler(void);
- int Window2MainHandler(void);
- void DrawWindow2Objs(void);
- void MultiSub(void);
-
- extern struct WindowNode *ModelsActiveWind;
- struct Gadget *Window2GList = NULL;
- struct Gadget *Window2Gadgets[2];
- struct IntuiMessage Window2Msg;
- UWORD Window2Left = 238;
- UWORD Window2Top = 29;
- UWORD Window2Width = 217;
- UWORD Window2Height = 93;
- extern struct IntuitionBase *IntuitionBase;
- extern struct List *ModelsWindList;
- extern UWORD ModelsTotalWindows;
- UWORD Window2NumWindows = 0;
- extern struct TextAttr topaz800;
-
- UBYTE *NumbersLabels[] = {
- (UBYTE *)"One",
- (UBYTE *)"Two",
- (UBYTE *)"Three",
- (UBYTE *)"Four",
- (UBYTE *)"Five",
- NULL
- };
-
- WORD Window2GadTypes[] = {
- CYCLE_KIND,
- LISTVIEW_KIND,
- };
-
- struct NewGadget Window2NGads[] = {
- 79, 2, 122, 13, (UBYTE *)"Numbers", &topaz800, ID_numbers, PLACETEXT_LEFT, NULL, (APTR)numbersObj,
- 19, 31, 188, 44, (UBYTE *)"Numbers", &topaz800, ID_numlist, PLACETEXT_ABOVE, NULL, (APTR)numlistObj,
- };
-
- ULONG Window2NTags[] = {
- (GTCY_Labels), (ULONG)&NumbersLabels[0], (GTCY_Active), 3, TAG_DONE,
- (GTLV_Labels), NULL, (GTLV_Top), 0, (GTLV_ScrollWidth), 16, (GTLV_ShowSelected), NULL, (LAYOUTA_Spacing), 0, TAG_DONE,
- };
-
-
- int OpenWindow2Window(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 (Window2NumWindows == 0)
- {
- if (!(Gad = CreateContext(&Window2GList)))
- return(1L);
-
- for (i=0, j=0; i < Window2NumGads; i++)
- {
- CopyMem((char *)&Window2NGads[i], (char *)&NewGad, (long)sizeof(struct NewGadget));
-
- NewGad.ng_VisualInfo = VisualInfo;
- NewGad.ng_LeftEdge += offsetx;
- NewGad.ng_TopEdge += offsety;
-
- Window2Gadgets[i] = Gad = CreateGadgetA((ULONG)Window2GadTypes[i], Gad,&NewGad,
- (struct TagItem *)&Window2NTags[j]);
- while (Window2NTags[j])
- j +=2;
- j++;
- if (!Gad)
- return(2L);
- }
- }
- if (!(ModelsActiveWind = AddWindowNode(ModelsWindList, windtitle, Window2Handler)))
- return(1);
- if (!(ModelsActiveWind->nn_Window = OpenWindowTags(NULL,
- WA_Left, Window2Left,
- WA_Top, Window2Top,
- WA_Width, Window2Width,
- WA_Height, Window2Height - Scr->WBorTop,
- WA_IDCMP, IDCMP_CLOSEWINDOW | IDCMP_MOUSEBUTTONS | IDCMP_MOUSEMOVE | IDCMP_GADGETUP | IDCMP_GADGETDOWN | IDCMP_VANILLAKEY | IDCMP_INTUITICKS | IDCMP_ACTIVEWINDOW | IDCMP_INACTIVEWINDOW ,
- WA_Flags, WFLG_CLOSEGADGET | WFLG_SMART_REFRESH | WFLG_RMBTRAP | WFLG_DRAGBAR ,
- WA_Gadgets, Window2GList,
- WA_Title, windtitle,
- WA_ScreenTitle, "Visual Arts V1.0 Copyright 1994 Danny Y. Wong All Rights Reserved.",
- WA_PubScreen, Scr,
- WA_MinWidth, 20,
- WA_MinHeight, 10,
- WA_MaxWidth, 640,
- WA_MaxHeight, 200,
- TAG_DONE)))
- return(3L);
-
- GT_RefreshWindow(ModelsActiveWind->nn_Window, NULL);
- if (++Window2NumWindows == 1)
- CreateWindow2Lists();
- GT_SetGadgetAttrs(Window2Gadgets[1], ModelsActiveWind->nn_Window, NULL,
- GTLV_Labels, Window2Lists[0], TAG_END);
- RefreshGadgets(Window2Gadgets[0], ModelsActiveWind->nn_Window, NULL);
- return(0L);
- }
-
- int Window2Handler(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(ModelsActiveWind->nn_Window->UserPort))
- {
- CopyMem((char *)msg, (char *)&Window2Msg, (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_GADGETDOWN :
- break;
-
- case IDCMP_INTUITICKS :
- break;
-
- case IDCMP_CLOSEWINDOW:
- CloseModelsWindow();
- if (--Window2NumWindows == 0)
- {
- if (Window2GList)
- FreeGadgets(Window2GList);
- for (running=0; running < 1; running++)
- FreeList(Window2Lists[running]);
- }
- return(1);
- break;
-
- case IDCMP_ACTIVEWINDOW:
- case IDCMP_INACTIVEWINDOW:
- if (!IntuitionBase->ActiveWindow)
- {
- ActivateWindow(ModelsActiveWind->nn_Window);
- break;
- }
- WindNode = FindWindowNode(ModelsWindList, IntuitionBase->ActiveWindow->Title);
- if (WindNode)
- ModelsActiveWind = WindNode;
- break;
-
- case IDCMP_GADGETUP:
- VAObject.va_Window = (struct Window *)ModelsActiveWind->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 *)Window2Msg.IAddress)->UserData;
- running = func(VAObject);
- break;
- }
- }
- return(running);
- }
-
- void MultiSub(void)
- {
- int rc;
-
- for (rc=0; rc < 1; rc++)
- Window2Lists[rc]=GetNewList();
- rc = OpenWindow2Window("MultiProcess");
- }
-