home *** CD-ROM | disk | FTP | other *** search
- #include "sysi2.h"
-
- #include <dos/dos.h>
-
- UBYTE *vers = "\0$VER: SysI2 2.0";
-
- /* This will show you a demostration of the new images without replacing the old ones. */
- /* comment it out to apply the new images to the system. */
-
- //#define DEMO
-
- LONG Enabled=1;
-
- void test(void);
- void install(void);
-
- struct SignalSemaphore TRBMSem; /* To protect and share TmpRasBM */
- struct BitMap *TmpRasBM;
-
- struct IntuitionBase *IntuitionBase;
-
- void main(void)
- {
- if (IntuitionBase = (struct IntuitionBase *)OpenLibrary((UBYTE *)"intuition.library", 36L))
- {
- InitSemaphore(&TRBMSem);
- if(TmpRasBM=MyAllocBM(100,100,1,BMF_DISPLAYABLE,0))
- {
- #ifndef DEMO
- install();
- #else
- test();
- #endif
- MyFreeBM(TmpRasBM);
- }
- CloseLibrary((struct Library *)IntuitionBase);
- }
- }
-
- #ifndef DEMO
- void install(void)
- {
- Class *cl,*syscl;
- STRPTR oldsysname;
-
- if(cl=MakeClass(0,(UBYTE *)"sysiclass",NULL,0,0))
- {
- syscl=cl->cl_Super;
- RemoveClass(syscl);
- oldsysname=syscl->cl_ID;
- syscl->cl_ID=(UBYTE *)"oldsysiclass";
- AddClass(syscl);
- FreeClass(cl);
- if(cl=MakeClass((UBYTE *)"sysiclass",(UBYTE *)"oldsysiclass",NULL,sizeof(struct SysIData),0))
- {
- cl->cl_Dispatcher.h_Entry=Dispatcher;
- AddClass(cl);
- while(1) // endless waiting loop
- {
- Wait(SIGBREAKF_CTRL_C);
- Enabled=!Enabled;
- }
- FreeClass(cl); // should never get executed!
- }
- syscl->cl_ID=oldsysname;
- }
- }
- #else
-
- #define NUM_IMAGES 13
- void test(void)
- {
- struct Window *w;
- struct IntuiMessage *msg;
- Class *cl;
- Object *o[NUM_IMAGES];
- struct DrawInfo *di;
- WORD width=32,l,done=0;
- LONG state=0;
- ULONG sysnum[]=
- {
- ZOOMIMAGE,
- SIZEIMAGE,
- CLOSEIMAGE,
- SDEPTHIMAGE,
- DEPTHIMAGE,
- LEFTIMAGE,
- UPIMAGE,
- RIGHTIMAGE,
- DOWNIMAGE,
- CHECKIMAGE,
- MXIMAGE,
- MENUCHECK,
- AMIGAKEY
- };
-
- if(cl=MakeClass((UBYTE *)"test",(UBYTE *)"sysiclass",NULL,sizeof(struct SysIData),0))
- {
- cl->cl_Dispatcher.h_Entry=Dispatcher;
- AddClass(cl);
-
- if (w = OpenWindowTags(NULL,
- WA_Flags, WFLG_CLOSEGADGET|WFLG_SIZEGADGET|WFLG_DRAGBAR|WFLG_DEPTHGADGET|WFLG_SIZEBBOTTOM,
- WA_IDCMP, IDCMP_CLOSEWINDOW|IDCMP_MOUSEBUTTONS|IDCMP_NEWSIZE,
- WA_MinWidth, 100,
- WA_MinHeight, 100,
- WA_MaxWidth, 32000,
- WA_MaxHeight, 32000,
- WA_Width, 32000,
- WA_Height, 32000,
- WA_AutoAdjust, 1,
- WA_Title, "Click in window to change image states! To apply patch comment \"#define DEMO\" in main.c!",
- TAG_END))
- {
- printf("%d %d\n",w->WScreen->WBorBottom,w->WScreen->WBorRight);
-
- if(di=GetScreenDrawInfo(w->WScreen))
- {
- for(l=0;l<NUM_IMAGES;l++)
- {
- o[l] = NewObject(cl, NULL,
- IA_Top ,(w->BorderTop) + 5,
- IA_Left ,(w->BorderLeft) + 5 + l * (width+10),
- IA_Width ,25,
- IA_Height ,25,
- SYSIA_Size ,2,
- SYSIA_Which ,sysnum[l],
- SYSIA_DrawInfo,di,
- TAG_END);
- }
- while (done == FALSE)
- {
-
- for(l=0;l<NUM_IMAGES;l++)
- {
- DrawImageState(w->RPort,(struct Image *)o[l],(w->BorderLeft) + 5 + l * (width + 10),(w->BorderTop) + 5 ,state ,di);
- }
-
- state++;
-
- WaitPort((struct MsgPort *)w->UserPort);
- while (msg = (struct IntuiMessage *)GetMsg((struct MsgPort *)w->UserPort))
- {
- if (msg->Class == IDCMP_CLOSEWINDOW)
- done = TRUE;
- ReplyMsg((struct Message *)msg);
- }
- }
- for(l=0;l<NUM_IMAGES;l++)
- DisposeObject(o[l]);
- FreeScreenDrawInfo(w->WScreen,di);
- }
- CloseWindow(w);
- }
- FreeClass(cl);
- }
- }
- #endif
-
-
-
-
-