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) */
-
-
- struct VAobject {
- struct Window *va_Window;
- struct Gadget *va_Gadget;
- struct IntuiMessage *va_IntuiMsg;
- ULONG va_Flags;
- APTR va_UserData;
- };
-
- #define GetString(gad) (((struct StringInfo *)gad->SpecialInfo)->Buffer)
- #define GetUndoString(gad) (((struct StringInfo *)gad->SpecialInfo)->UndoBuffer)
- #define GetNumber(gad) (((struct StringInfo *)gad->SpecialInfo)->LongInt)
-
- extern int GetFileName(BOOL save, struct Window *window, char *title, char *path, char *dir, char *file);
- int InitTempArea(void);
- extern void FunnyDrawCircles(struct Window *Wind);
- extern void FunnyDrawRects(struct Window *Wind);
- extern void DrawBox(struct Window *Wind, int Left, int Top, int Wid, int Hi, UBYTE APen, short Pattern );
- extern void DrawFBox(struct Window *Wind, int Left, int Top, int Wid, int Hi, UBYTE APen, short Pattern, UBYTE Outline, short Fill );
- extern void DrawLine(struct Window *Wind, int Left, int Top, int Wid, int Hi, UBYTE APen, short Pattern );
- extern void FunnyDrawLine(struct Window *Wind);
- extern void SetRPortFill(struct Window *Wind, short Type);
- extern void DrawNCircle(struct Window *Wind, int Left, int Top, int Right, int Bottom, UBYTE APen);
- extern void DrawFCircle(struct Window *Wind, int Left, int Top, int Right, int Bottom, UBYTE APen, short Pattern, UBYTE Outline, short Fill );
- extern void ButtonSelected(struct Window *wind, struct Gadget *gad);
- extern struct Window *FunnyWnd;
- extern APTR VisualInfo;
- extern struct Screen *Scr;
- extern struct Gadget *FunnyGadgets[3];
- extern int AddNewNode(struct List *list, char name[255]);
- extern int DeleteNewNode(struct List *list, char name[255]);
- extern struct List *GetNewList(void);
- extern struct NameNode *FindNodeName(struct List *list, char name[255]);
- extern void FreeList(struct List *list);
-
- extern void CreateFunnyLists(void);
- struct NameNode
- {
- struct Node nn_Node;
- UBYTE nn_Data[255];
- };
- extern UBYTE *WantedLabels[];
-
- ULONG LinePatterns[6] = { 0xffff, 0x0cccc, 0xaaaa, 0x8888, 0x3333, 0xffff};
-
- struct List *FunnyLists[1];
-
- void FunnyDrawRects(struct Window *Wind)
- {
- UWORD offsetx = Scr->WBorLeft;
- UWORD offsety = Scr->WBorTop + Scr->RastPort.TxHeight + 1;
-
- DrawBevelBox(Wind->RPort, 10+offsetx, 4+offsety, 141, 117,
- (GT_VisualInfo), VisualInfo, TAG_DONE);
- SetDrPt(Wind->RPort, 0xFFFF);
- SetOPen(Wind->RPort, 0);
- SetAfPt(Wind->RPort, NULL, 0);
- }
-
- void FunnyDrawCircles(struct Window *Wind)
- {
- DrawFCircle(Wind, 50, 44, 18, 6, 1, 0, 1, 0 );
- DrawFCircle(Wind, 106, 44, 18, 6, 1, 0, 1, 0 );
- DrawFCircle(Wind, 100, 44, 7, 3, 2, 0, 2, 0 );
- DrawFCircle(Wind, 58, 44, 7, 3, 2, 0, 2, 0 );
- }
-
- void FunnyDrawLine(struct Window *Wind)
- {
- DrawLine(Wind, 73, 50, 58, 66, 1, 0 );
- DrawLine(Wind, 60, 66, 101, 66, 1, 0 );
- DrawLine(Wind, 85, 50, 101, 66, 1, 0 );
- DrawLine(Wind, 41, 74, 119, 74, 1, 0 );
- DrawLine(Wind, 35, 27, 65, 33, 1, 0 );
- DrawLine(Wind, 92, 32, 128, 27, 1, 0 );
- DrawLine(Wind, 38, 12, 48, 22, 1, 0 );
- DrawLine(Wind, 60, 12, 61, 21, 1, 0 );
- DrawLine(Wind, 76, 22, 78, 10, 1, 0 );
- DrawLine(Wind, 89, 22, 93, 11, 1, 0 );
- DrawLine(Wind, 102, 22, 110, 11, 1, 0 );
- DrawLine(Wind, 125, 10, 117, 22, 1, 0 );
- DrawLine(Wind, 65, 83, 96, 83, 1, 0 );
- DrawLine(Wind, 17, 91, 141, 91, 1, 3 );
- }
-
- struct AreaInfo areaInfo={0};
- struct TmpRas Temprast;
- PLANEPTR AreaPlane=NULL;
- WORD areaBuffer[4000];
-
-
- UWORD AreaPattern1[] =
- {
- 0x1111, 0x2222,
- 0x4444, 0x8888,
- 0x1111, 0x2222,
- 0x4444, 0x8888,
- 0x1111, 0x2222,
- 0x4444, 0x8888,
- 0x1111, 0x2222,
- 0x4444, 0x8888
- };
-
- UWORD AreaPattern2[] =
- {
- 0x8080, 0x8080,
- 0x8080, 0x8080
- };
-
- UWORD AreaPattern3[] =
- {
- 0x3333, 0x3333,
- 0x3333, 0xffff,
- 0x3333, 0x3333,
- 0x3333, 0xffff,
- 0x3333, 0x3333,
- 0x3333, 0xffff,
- 0x3333, 0x3333,
- 0x3333, 0xffff
- };
-
- UWORD AreaPattern4[] =
- {
- 0x8888, 0x8888,
- 0x8888, 0x8888,
- 0x8888, 0x8888,
- 0x8888, 0x8888,
- 0x8888, 0x8888,
- 0x8888, 0x8888,
- 0x8888, 0x8888,
- 0x8888, 0x8888
- };
-
- UWORD AreaPattern5[] =
- {
- 0xffff, 0x0060,
- 0x0060, 0x0060,
- 0xffff, 0x6000,
- 0x6000, 0x6000,
- 0xffff, 0x0060,
- 0x0060, 0x0060,
- 0xffff, 0x6000,
- 0x6000, 0x6000
- };
-
- UWORD AreaPattern6[] =
- {
- 0x0000, 0x0000,
- 0x0000, 0xffff,
- 0x0000, 0x0000,
- 0x0000, 0xffff,
- 0x0000, 0x0000,
- 0x0000, 0xffff,
- 0x0000, 0x0000,
- 0x0000, 0xffff
- };
-
- UWORD AreaPattern7[] =
- {
- 0x4040, 0x0000,
- 0x1010, 0x0000
- };
-
- UWORD AreaPattern8[] =
- {
- 0xffff, 0xffff
- };
-
- UWORD AreaPattern9[] =
- {
- 0xaaaa, 0x5555
- };
-
-
- void SetRPortFill(struct Window *Wind, short Type)
- {
- switch(Type)
- {
- case 1:
- SetAfPt(Wind->RPort, (UWORD *)&AreaPattern1, 4);
- break;
- case 2:
- SetAfPt(Wind->RPort, (UWORD *)&AreaPattern2, 2);
- break;
- case 3:
- SetAfPt(Wind->RPort, (UWORD *)&AreaPattern3, 4);
- break;
- case 4:
- SetAfPt(Wind->RPort, (UWORD *)&AreaPattern4, 4);
- break;
- case 5:
- SetAfPt(Wind->RPort, (UWORD *)&AreaPattern5, 4);
- break;
- case 6:
- SetAfPt(Wind->RPort, (UWORD *)&AreaPattern6, 4);
- break;
- case 7:
- SetAfPt(Wind->RPort, (UWORD *)&AreaPattern7, 2);
- break;
- case 8:
- SetAfPt(Wind->RPort, (UWORD *)&AreaPattern8, 1);
- break;
- case 9:
- SetAfPt(Wind->RPort, (UWORD *)&AreaPattern9, 1);
- break;
- default:
- break;
- }
- }
-
- int InitTempArea(void)
- {
- register UWORD i;
-
- for (i=0; i<4000; i++)
- areaBuffer[i]=0;
- InitArea(&areaInfo, areaBuffer, 800L);
- AreaPlane = AllocRaster(640, 200);
- if (AreaPlane == NULL)
- return(1L);
- InitTmpRas(&Temprast, AreaPlane, (long)RASSIZE(640, 200));
- return(0L);
- }
-
-
- void DrawLine(struct Window *Wind, int Left, int Top, int Wid, int Hi, UBYTE APen, short Pattern )
- {
- UWORD offsetx = Scr->WBorLeft;
- UWORD offsety = Scr->WBorTop + Scr->RastPort.TxHeight + 1;
-
- SetAPen(Wind->RPort, APen);
- SetDrPt(Wind->RPort, LinePatterns[Pattern]);
- Move(Wind->RPort, Left+offsetx, Top+offsety);
- Draw(Wind->RPort, Wid+offsetx, Hi+offsety);
- }
-
- void DrawFCircle(struct Window *Wind, int Left, int Top, int Right, int Bottom, UBYTE APen, short Pattern, UBYTE Outline, short Fill)
- {
- UWORD offsetx = Scr->WBorLeft;
- UWORD offsety = Scr->WBorTop + Scr->RastPort.TxHeight + 1;
-
- SetAPen(Wind->RPort, APen);
- SetOPen(Wind->RPort, Outline);
- SetDrPt(Wind->RPort, LinePatterns[Pattern]);
- SetRPortFill(Wind, Fill);
- AreaEllipse(Wind->RPort, Left+offsetx, Top+offsety, Right, Bottom);
- AreaEnd(Wind->RPort);
- }
-
- struct List *GetNewList(void)
- {
- struct List *list;
-
- if (!( list = AllocMem(sizeof(struct List), MEMF_CLEAR)))
- return(NULL);
- NewList(list);
- return(list);
- }
-
- int AddNewNode(struct List *list, char name[255])
- {
- struct NameNode *namenode;
-
- if (!( namenode = AllocMem(sizeof(struct NameNode), MEMF_CLEAR)))
- return(1L);
- strcpy(namenode->nn_Data, name);
- namenode->nn_Node.ln_Name=namenode->nn_Data;
- namenode->nn_Node.ln_Type=0;
- namenode->nn_Node.ln_Pri=0;
- AddTail((struct List *)list, (struct Node *)namenode);
- return(0L);
- }
-
- int DeleteNode(struct List *list, char name[255])
- {
- struct Node *node;
-
- node=FindName(list, name);
- if (node)
- {
- Remove(node);
- FreeMem((struct NameNode *)node, sizeof(struct NameNode));
- return(0L);
- }
- return(1L);
- }
-
- struct NameNode *FindNodeName(struct List *list, char name[255])
- {
- struct NameNode *worknode, *nextnode;
-
- worknode=(struct NameNode *)(list->lh_Head);
- while (nextnode=(struct NameNode *)(worknode->nn_Node.ln_Succ))
- {
- if (strcmp(worknode->nn_Data, name) == 0)
- return(worknode);
- worknode=nextnode;
- }
- return(NULL);
- }
-
- void FreeList(struct List *list)
- {
- struct NameNode *worknode, *nextnode;
-
- worknode=(struct NameNode *)(list->lh_Head);
- while (nextnode=(struct NameNode *)(worknode->nn_Node.ln_Succ))
- {
- FreeMem(worknode, sizeof(struct NameNode));
- worknode=nextnode;
- }
- FreeMem(list, sizeof(struct List));
- list=NULL;
- }
-
- void CreateFunnyLists(void)
- {
- short i;
-
- i=0;
- while (WantedLabels[i])
- AddNewNode(FunnyLists[0], WantedLabels[i++]);
-
- }
-
- /* gadget functions */
-
- int okObj(struct VAobject VAObject)
- {
- return(-1L);
- }
- /* Button OK */
-
- int ok1Obj(struct VAobject VAObject)
- {
- return(-1L);
- }
- /* Button Cancel */
-
- int wantedObj(struct VAobject VAObject)
- {
- return(1L);
- }
- /* ListView */
-
-