home *** CD-ROM | disk | FTP | other *** search
- /* ******************************************************************** */
- /* C code generated by: */
- /* Visual Arts Version 2.1 */
- /* Copyright 1994-95 Danny Y. Wong All rights reserved */
- /* Calgary, Alberta (CANADA) */
- /* Partial of the code is copyright by Jaba Development */
- /* ******************************************************************** */
-
- #include <VisualArts.h>
- #include <clib/VisualArts_protos.h>
-
-
- #include "GraphicPattern_func.c"
-
-
- int GetPubScreen(void);
- void ClosePubScreen(void);
- int OpenGraPatWindow(char windtitle[]);
- void CloseGraPatWindow(void);
- int GraPatHandler(void);
- int GraPatMainHandler(void);
- void DrawGraPatObjs(void);
- int main(int argc, char *argv[]);
-
- UBYTE *PubScrName = "Workbench";
- struct DrawInfo *ScrDrawInfo = NULL;
- APTR VisualInfo = NULL;
- struct Screen *Scr = NULL;
- struct Window *GraPatWnd = NULL;
- struct IntuiMessage GraPatMsg;
- UWORD GraPatLeft = 60;
- UWORD GraPatTop = 54;
- UWORD GraPatWidth = 439;
- UWORD GraPatHeight = 97;
- struct TextAttr topaz8 = { (STRPTR)"topaz.font", 8, 0x00, 0x01 };
- struct TextAttr topaz800 = { (STRPTR)"topaz.font", 8, 0x00, 0x00 };
-
-
- int GetPubScreen(void)
- {
- if (!(Scr = LockPubScreen(PubScrName)))
- return(1L);
-
- if (!(VisualInfo = GetVisualInfo(Scr, TAG_DONE)))
- return(2L);
-
- if (!(ScrDrawInfo = GetScreenDrawInfo(Scr)))
- return(3L);
- return(0L);
- }
-
- void ClosePubScreen(void)
- {
- if (VisualInfo)
- FreeVisualInfo(VisualInfo);
- if (Scr)
- UnlockPubScreen(NULL, Scr);
- if (ScrDrawInfo)
- FreeScreenDrawInfo(Scr, ScrDrawInfo);
- }
-
- int OpenGraPatWindow(char windtitle[80])
- {
- if (!(GraPatWnd = OpenWindowTags(NULL,
- WA_Left, GraPatLeft,
- WA_Top, GraPatTop,
- WA_Width, GraPatWidth,
- WA_Height, GraPatHeight + kWindowOffSetY,
- WA_NewLookMenus, TRUE,
- WA_IDCMP, IDCMP_CLOSEWINDOW ,
- WA_Flags, WFLG_CLOSEGADGET | WFLG_SMART_REFRESH |
- WFLG_ACTIVATE | WFLG_DRAGBAR ,
- WA_Gadgets, NULL,
- WA_Title, windtitle,
- WA_ScreenTitle, "Visual Arts V2.2 Copyright 1994-95 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);
-
- InitTempArea();
- GraPatWnd->RPort->TmpRas=&Temprast;
- GraPatWnd->RPort->AreaInfo=&areaInfo;
- DrawGraPatObjs();
- GT_RefreshWindow(GraPatWnd, NULL);
- return(0L);
- }
-
- void CloseGraPatWindow(void)
- {
- if (GraPatWnd)
- CloseWindow(GraPatWnd);
- }
-
- int GraPatHandler(void)
- {
- struct IntuiMessage *msg;
- struct VAobject VAObject;
- int running = 1;
- ULONG class;
- UWORD code;
-
- while (msg=GT_GetIMsg(GraPatWnd->UserPort))
- {
- CopyMem((char *)msg, (char *)&GraPatMsg, (long)sizeof(struct IntuiMessage));
- class = msg->Class;
- code = msg->Code;
-
- GT_ReplyIMsg(msg);
- switch(class)
- {
-
- case IDCMP_CLOSEWINDOW:
- return(0);
- break;
- }
- }
- return(running);
- }
-
- void DrawGraPatObjs(void)
- {
- GraPatDrawRects(GraPatWnd);
- GraPatDrawCircles(GraPatWnd);
- GraPatDrawLine(GraPatWnd);
-
- }
-
- int GraPatMainHandler(void)
- {
- int running = 1;
- ULONG windsig, signals;
-
- windsig = 1L << GraPatWnd->UserPort->mp_SigBit;
-
- while (running == 1)
- {
- signals = Wait( windsig );
- if (signals & windsig)
- {
- running = GraPatHandler();
- }
- }
- return(running);
- }
-
- int main(int argc, char *argv[])
- {
- int rc;
-
- if (!(GetPubScreen()))
- {
- if (!(OpenGraPatWindow("Graphic and Pattern Demo")))
- {
- rc = GraPatMainHandler();
- CloseGraPatWindow();
- }
- ClosePubScreen();
- }
- return(0L);
- }
-