home *** CD-ROM | disk | FTP | other *** search
- /*
- * Config program for use by savers that don't need configuration. Just
- * report that to the user.
- *
- * Copyright (c) 1991, Mike Meyer
- * All Rights Reserved
- *
- * See the file "ShadowMaster:Distribution" for information on distribution.
- *
- * ===build instructions
- * % lc no-config ; output= no-config.o input= no-config.c
- * % blink no-config.o lib lib:amiga.lib to no-config SC SD ; output= no-config input= no-config.o
- * % copy no-config //config
- * ===endbuild
- */
-
- #include <exec/types.h>
- #include <utility/tagitem.h>
- #include <dos/dos.h>
- #include <intuition/intuition.h>
- #include <libraries/gadtools.h>
- #include <proto/exec.h>
- #include <proto/dos.h>
- #include <proto/intuition.h>
- #include <proto/gadtools.h>
-
- struct ExecBase *SysBase = NULL ;
- struct DosLibrary *DOSBase = NULL ;
- struct IntuitionBase *IntuitionBase = NULL ;
- struct Library *GadToolsBase = NULL ;
-
- struct TextAttr topaz_8 = { "topaz", 8, 0, 0 } ;/* Blame this on GadTools */
- struct IntuiText Message[2] = {
- { 1, 0, JAM2, 0, 0, &topaz_8,
- "No config needed for saver:" , &Message[1]
- } ,
- { 1, 0, JAM2, 0, 16, &topaz_8, NULL, NULL }
- } ;
-
-
- struct NewGadget no_good = {
- 0, 0, /* Must fill out later, gadtools to stupid to do it right */
- 45, 12, "Okay", &topaz_8, 0, 0, NULL, NULL
- } ;
-
- #define done(x) do { status = x; goto out; } while (0) ;
- int __saveds
- start(void) {
- struct Window *window = NULL ;
- int status ;
- struct RDArgs *args = NULL ;
- struct IntuiMessage *bounce, in ;
- struct Gadget *gadget_crap = NULL, *gadtools_turd ;
-
-
- SysBase = *((struct ExecBase **) 4);
- if (!(DOSBase = (struct DosLibrary *) OpenLibrary("dos.library", 37)))
- done(RETURN_FAIL) ;
- if (!(IntuitionBase = (struct IntuitionBase *)
- OpenLibrary("intuition.library", 37)))
- done(RETURN_FAIL) ;
- if (!(GadToolsBase = OpenLibrary("gadtools.library", 37)))
- done(RETURN_FAIL) ;
-
- if (!(args = ReadArgs("NAME/A", (LONG *) &(Message[1].IText), NULL)))
- done(RETURN_ERROR) ;
-
- if (!(window = OpenWindowTags(NULL,
- WA_Left, 0, WA_InnerWidth, IntuiTextLength(&Message[0]) + 20,
- WA_Top, 11, WA_InnerHeight, 55, WA_AutoAdjust, 1,
- WA_Title, "Shadow Master Configuration:",
- WA_DragBar, 1, WA_IDCMP, IDCMP_GADGETUP,
- TAG_DONE, 0)))
- done(RETURN_FAIL) ;
-
- if (!(no_good.ng_VisualInfo = GetVisualInfoA(window->WScreen, NULL)))
- done(RETURN_FAIL) ;
- if (!(gadtools_turd = CreateContext(&gadget_crap))) done(RETURN_FAIL) ;
- no_good.ng_TopEdge = window->Height - 17 ;
- no_good.ng_LeftEdge = window->Width - 65 ;
- if (!(CreateGadgetA(BUTTON_KIND, gadtools_turd, &no_good, NULL)))
- done(RETURN_FAIL) ;
- AddGList(window, gadget_crap, -1, -1, NULL) ;
- RefreshGList(gadget_crap, window, NULL, -1) ;
- GT_RefreshWindow(window, NULL) ;
-
- Message[0].LeftEdge = (window->Width - IntuiTextLength(&Message[0])) / 2;
- Message[1].LeftEdge = (window->Width - IntuiTextLength(&Message[1])) / 2;
- PrintIText(window->RPort, &Message[0], 0, 20) ;
-
- FOREVER {
- WaitPort(window->UserPort) ;
- while (bounce = GT_GetIMsg(window->UserPort)) {
- in = *bounce ;
- GT_ReplyIMsg(bounce) ;
- switch (in.Class) {
- case IDCMP_GADGETUP: done(RETURN_OK) ;
- case IDCMP_REFRESHWINDOW:
- GT_BeginRefresh(window);
- GT_EndRefresh(window, TRUE);
- break ;
- }
- }
- }
-
- out:
- if (window) CloseWindow(window) ;
- if (gadget_crap) FreeGadgets(gadget_crap) ;
- if (no_good.ng_VisualInfo) FreeVisualInfo(no_good.ng_VisualInfo) ;
- FreeArgs(args) ;
- if (GadToolsBase) CloseLibrary(GadToolsBase) ;
- if (IntuitionBase) CloseLibrary((struct Library *) IntuitionBase) ;
- if (DOSBase) CloseLibrary((struct Library *) DOSBase) ;
- return status ;
- }
-