Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!sri-spam!ames!amdahl!orandy From: orandy@amdahl.UUCP Newsgroups: comp.sys.amiga Subject: Initial posting of MandelVroom (4 of 8) Message-ID: <6766@amdahl.amdahl.com> Date: Tue, 19-May-87 21:21:11 EDT Article-I.D.: amdahl.6766 Posted: Tue May 19 21:21:11 1987 Date-Received: Thu, 21-May-87 02:45:11 EDT Organization: Amdahl Corporation, Sunnyvale, CA 94086 Lines: 2928 Keywords: MandelVroom source 2 # This is a shell archive. Remove anything before this line, then # unpack it by saving it in a file and typing "sh file". (Files # unpacked will be owned by you and have default permissions.) # # This archive contains: # main.c mand.c mand.h menu.c menu1.c nav.c echo x - main.c cat > "main.c" << '//E*O*F main.c//' /*************************************************************************** * * MandelZoom Main * * Kevin L. Clague * * Copyright (C) 1986 * **************************************************************************/ #include "mand.h" #include extern struct Menu Menu[], GenMenu[]; extern USHORT CmdMode; extern SHORT CountX,CountY; extern float StartX, StartY, EndX, EndY; extern LONG NavTop,NavBot,NavRight,NavLeft; extern SHORT DragSize, BoxSizeX, BoxSizeY; extern struct NewScreen NewScreen; extern struct Screen *screen; extern struct Window *ContWind,*MandWind,*PalWind; extern struct NewWindow NewMand,NewCont,NewPal; extern SHORT MaxCount; extern SHORT *ContourBase; extern UBYTE *ColorBase; struct IntuiMessage *message; SHORT *CountBase = (SHORT *) NULL; UBYTE QuitScreen = FALSE; UBYTE MandType; ULONG BorderType = 0; SHORT MouseX,MouseY; SHORT Zoom = 0; ULONG SaveIDCMP; SHORT HotSpotX, HotSpotY; struct Windows { struct Windows *NextWindow; struct Window *Window; } *WindowList; /* * Do it all */ main () { if (OpenLibs() == 0 && OpenDisp() == 0) { InitPreset(0); GenerateIt(); DoBrot(); } CloseDisp(); if (CountBase) { FreeMem(CountBase,CountX*CountY*sizeof(SHORT)); } CloseLibs(); } /* * Decide what to do to satisfy this message */ DoBrot() { ULONG class; USHORT code = 0; SHORT ContNum; struct MenuItem *Item; struct Gadget *gadget; struct Windows *Windows; struct Window *Window; ULONG WaitMask; #define INTUINULL ((struct IntuiMessage *) NULL) extern struct MenuItem *ItemAddress(); extern struct IntuiMessage *GetMsg(); if (WindowList == (struct Windows *) NULL) { printf("Fatal programming error\nNo windows\n"); return(0); } while (QuitScreen == FALSE) { /* grab the first window in the list */ Windows = WindowList; Window = Windows->Window; /* while we still have windows and there are no messages, gather up the wait bit mask */ WaitMask = 0; while (Windows && (message = GetMsg( Window->UserPort)) == INTUINULL ) { /* Add to the wait mask */ WaitMask |= 1L << Window->UserPort->mp_SigBit; Windows = Windows->NextWindow; Window = Windows->Window; } /* Wait here for a message */ if (message == (struct IntuiMessage *) NULL) { Wait(WaitMask); continue; } /* got a message */ class = message->Class; code = message->Code; gadget = (struct Gadget *) message->IAddress; MouseX = message->MouseX; MouseY = message->MouseY; ReplyMsg(message); if (class == MOUSEMOVE) { DoMouseMove(MouseX, MouseY); /* Try this first */ } else if (class == MENUPICK) { SetNormPointer(); while (code != MENUNULL) { switch (MENUNUM(code)) { case PROJECTMENU: ScreenProject(code); break; case EDITMENU: EditScreen(code); break; case PRESETMENU: SetPreset(ITEMNUM(code)); break; } Item = ItemAddress( (struct Menu *) &Menu[0], code); code = Item->NextSelect; } } else if (class == GADGETDOWN) { DoGadgetDown(gadget); } else if (class == GADGETUP) { DoGadgetUp(gadget); } else if (class == MOUSEBUTTONS) { DoMouseButtons(code); } else if (class == CLOSEWINDOW) { SetNormPointer(); if (Windows->Window == ContWind) { CloseContWind(); } else if (Windows->Window == PalWind) { ClosePalWind(); } } } } /* DoBrot */ /* * Perform functions for Gadget down messages */ DoGadgetDown(gadget) struct Gadget *gadget; { switch (gadget->GadgetID >> WINDTYPEBITS & WINDMASK) { case PALTYPE: DoPalette(gadget); break; case CONTYPE: DoContourDown(gadget); break; } } /* DoGadgetDown */ /* * Perform functions for Gadget up messages */ DoGadgetUp(gadget) struct Gadget *gadget; { switch (gadget->GadgetID >> WINDTYPEBITS & WINDMASK) { case PALTYPE: SetNormPointer(); break; case CONTYPE: DoContourUp(gadget); break; } } /* DoGadgetUp */ /* * Perform functions for Mouse buttons */ DoMouseButtons(code) USHORT code; { extern SHORT XScale, YScale; #define MINXBOX (8 << XScale) #define MINYBOX (8 << YScale) switch (code) { case SELECTDOWN: switch(CmdMode) { case IMPLIEDSET: DoWindowPick(MouseX, MouseY); CmdMode = NULL; break; case STARTBOX: StartZoomBox(); break; case NULL: /* must be trying to move or resize with mouse */ DoZoomBoxGadgets(); break; } break; case SELECTUP: ModifyIDCMP(MandWind, MandWind->IDCMPFlags & ~MOUSEMOVE); switch(CmdMode) { case ZOOMDRAG: CmdMode = NULL; /* redraw the extras */ DrawExtras(NavLeft, NavTop, NavRight, NavBot ); break; case STRETCHBOX: DrawBox(NavLeft, NavTop, NavRight, NavBot ); if ( NavRight - NavLeft < MINXBOX ) NavRight = NavLeft + MINXBOX; if ( NavBot - NavTop < MINYBOX ) NavBot = NavTop + MINYBOX; /* draw the extras */ DrawExtras(NavLeft, NavTop, NavRight, NavBot ); DrawBox(NavLeft, NavTop, NavRight, NavBot ); CmdMode = NULL; break; } SetNormPointer(); break; } } /* DoMouseButtons */ /* * Start Zoom box */ StartZoomBox() { if (Zoom == 0) { if (MouseX > LEFTMARG && MouseX < MandWind->Width - RIGHTMARG && MouseY > TOPMARG && MouseY < MandWind->Height - BOTMARG) { Zoom = 1; /* Draw first box */ NavTop = MouseY; NavLeft = MouseX; NavBot = NavTop; NavRight = NavLeft; HotSpotX = HotSpotY = 0; CmdMode = STRETCHBOX; DrawBox(NavLeft, NavTop, NavRight, NavBot ); ModifyIDCMP(MandWind, MandWind->IDCMPFlags | MOUSEMOVE); } } } /* * Simulate Zoom box gadgets */ DoZoomBoxGadgets() { extern SHORT XScale, YScale; SetNormPointer(); if ( Zoom == 1 ) { /* is it in the window box? */ if (MouseX >= NavLeft && MouseX <= NavRight && MouseY >= NavTop && MouseY <= NavBot) { /* is it in the top part? */ if (MouseY <= NavTop + (3 << YScale)) { /* is it the drag bar? */ if (MouseX > NavLeft + (3 << XScale)) { HotSpotX = MouseX - NavLeft; HotSpotY = MouseY - NavTop; /* undraw the extras */ DrawExtras(NavLeft, NavTop, NavRight, NavBot ); CmdMode = ZOOMDRAG; } else { /* We got the close gadget */ CmdMode = NULL; DrawBox(NavLeft, NavTop, NavRight, NavBot ); /* undraw the extras */ DrawExtras(NavLeft, NavTop, NavRight, NavBot ); Zoom = 0; } } else { /* is it the Resize Gadget? */ if (MouseY >= NavBot - (3 << YScale) && MouseX >= NavRight - (3 << XScale)) { HotSpotX = NavRight - MouseX; HotSpotY = NavBot - MouseY; CmdMode = STRETCHBOX; /* undraw the extras */ DrawExtras(NavLeft, NavTop, NavRight, NavBot ); } } } } if (CmdMode) { ModifyIDCMP(MandWind, MandWind->IDCMPFlags | MOUSEMOVE); } } /* * Perform functions for Mouse movements */ DoMouseMove( MouseX, MouseY) SHORT MouseX, MouseY; { SHORT Width, Height; switch(CmdMode) { case COLORSLIDE: ModifyColors(); break; case STRETCHBOX: DrawBox(NavLeft, NavTop, NavRight, NavBot ); if ( MouseX < NavLeft ) MouseX = NavLeft; if ( MouseY < NavTop ) MouseY = NavTop; if ( MouseX + HotSpotX > CountX + LEFTMARG ) MouseX = CountX + LEFTMARG - HotSpotX; if ( MouseY + HotSpotY > CountY + TOPMARG ) MouseY = CountY + TOPMARG - HotSpotY; DrawBox(NavLeft, NavTop, MouseX, MouseY); NavBot = MouseY; NavRight = MouseX; break; case ZOOMDRAG: DrawBox(NavLeft, NavTop, NavRight, NavBot ); Width = NavRight - NavLeft - HotSpotX; Height = NavBot - NavTop - HotSpotY; if ( MouseY < 1 ) MouseY = 1; if ( MouseX - HotSpotX < LEFTMARG ) MouseX = LEFTMARG + HotSpotX; if ( MouseY - HotSpotY < TOPMARG ) MouseY = TOPMARG + HotSpotY; if ( MouseX + Width > CountX + LEFTMARG ) MouseX = CountX + LEFTMARG - Width; if ( MouseY + Height > CountY + TOPMARG ) MouseY = CountY + TOPMARG - Height; NavLeft = MouseX - HotSpotX; NavTop = MouseY - HotSpotY; NavRight = MouseX + Width; NavBot = MouseY + Height; DrawBox(NavLeft, NavTop, NavRight, NavBot ); break; } } /* DoMouseMove */ //E*O*F main.c// echo x - mand.c cat > "mand.c" << '//E*O*F mand.c//' /*************************************************************************** * * MandelVroom Generator * * Kevin L. Clague * * Copyright (C) 1987 * **************************************************************************/ #include "mand.h" #define PICTWINDXSIZE 100 #define PICTWINDYSIZE 100 #define PICTXSIZE (PICTWINDXSIZE - LEFTMARG - RIGHTMARG) #define PICTYSIZE (PICTWINDYSIZE - TOPMARG - BOTMARG) #define DEFAULTLEFT -2.0 #define DEFAULTRIGHT 2.0 #define DEFAULTTOP -2.0 #define DEFAULTBOT 2.0 extern struct Screen *screen; extern struct RastPort *rp; extern SHORT *CountBase; extern LONG NavTop, NavBot, NavLeft, NavRight; extern SHORT Zoom; extern struct Menu Menu, GenMenu; extern SHORT *ContourBase; extern UBYTE *ColorBase, MandType; struct Window *MandWind = (struct Window *) NULL; struct NewWindow NewMand = { 0,1, /* start position */ 80,80, /* width, height */ (UBYTE) 0, (UBYTE) 1, /* detail pen, block pen */ /* IDCMP flags */ MENUPICK | GADGETDOWN | GADGETUP | MOUSEBUTTONS, WINDOWDEPTH | WINDOWSIZING | ACTIVATE | REPORTMOUSE, /* MandWind flags */ (struct Gadget *) NULL, /* first gadget */ (struct Image *) NULL, /* user checkmark */ (UBYTE *) "Picture", /* MandWind title */ (struct Screen *) NULL, /* pointer to screen */ (struct BitMap *) NULL, /* pointer to superbitmap */ 80,80,320,200, /* sizing */ CUSTOMSCREEN /* type of screen */ }; float StartX = DEFAULTLEFT; float StartY = DEFAULTTOP; float EndX = DEFAULTRIGHT; float EndY = DEFAULTBOT; float GapY = ( DEFAULTBOT - DEFAULTTOP ) / PICTXSIZE; float GapX = 0.88 * ( DEFAULTBOT - DEFAULTTOP ) / PICTYSIZE; SHORT MaxCount = 1023; SHORT CountX = PICTXSIZE; SHORT CountY = PICTYSIZE; ULONG CalcTime; /* * Generate It */ GenerateIt() { ClosePalWind(); CloseContWind(); ClearMenuStrip(MandWind); SetMenuStrip(MandWind, &GenMenu); switch ( MandType ) { case 0: IntMandelbrot(); break; case 1: Mandelbrot(); break; } ClearMenuStrip(MandWind); SetMenuStrip(MandWind, &Menu); } /* * Fast Floating Point Mandelbrot Generator */ Mandelbrot() { int i, j, k, l; int TraceSize = 32; register float cura, curb, cura2, curb2; float curx, cury, napx, napy; float olda[64], oldb[64]; float *RealTrace,*ImagTrace; SHORT *CountPtr; UBYTE ColorXlate[1030]; #asm olda equ -548 oldb equ -292 TraceSize equ -20 l equ -16 k equ -12 curx equ -24 cury equ -28 #endasm /* Map contours into color translate table */ for (i = 0,j = 1029; i < NUMCONTS; i++) for (; j >= ContourBase[i] && j; ) ColorXlate[j--] = ColorBase[i]; while (j >= 0) ColorXlate[j--] = 0; /* free up old counts memory, get new picture size, get new counts memory */ GetCountsMemory(); /* clear the picture area */ SetAPen(MandWind->RPort, 0); RectFill(MandWind->RPort, LEFTMARG, TOPMARG, MandWind->Width - 12, MandWind->Height - 2); CountPtr = CountBase; /* calculate new picture's coordinates from zoom box */ ZoomIn(); /* start in the upper left hand corner */ cury = StartY; /* * for each pixel, calculate mandelbrot */ for (i = 0; i < CountY; i++) { curx = StartX; for (j = 0; j < CountX; j++) { cura = curb = cura2 = curb2 = 0; for (k = 0; k < MaxCount; k += TraceSize) { #ifdef SLOW RealTrace = olda; ImagTrace = oldb; for (l = 0; l < TraceSize; l++) { *(RealTrace++) = cura; *(ImagTrace++) = curb; curb *= cura; curb += curb + cury; cura = cura2 - curb2 + curx; cura2 = cura * cura; curb2 = curb * curb; if (cura2+curb2 > 4.0) goto out; } RealTrace = olda; ImagTrace = oldb; for (l = 0; l < TraceSize; l++) if (cura == *(RealTrace++) && curb == *(ImagTrace++)) { k += MaxCount; goto out; } #else #asm public _LVOSPMul public _LVOSPAdd public _LVOSPSub public _LVOSPCmp public _MathBase move.l _MathBase,a6 lea.l olda(a5),a0 ; RTrace = olda lea.l oldb(a5),a1 ; ITrace = oldb clr.l l(a5) ;for (l = TraceSize; l--; ) { lloop move.l d4,(a0)+ ; *(RTrace++) = cura move.l d5,(a1)+ ; *(ITrace++) = curb move.l d4,d0 ; curb *= cura move.l d5,d1 jsr _LVOSPMul(a6) move.l d0,d1 ; curb += curb jsr _LVOSPAdd(a6) move.l cury(a5),d1 ; curb += cury jsr _LVOSPAdd(a6) move.l d0,d5 move.l d6,d0 ; cura = cura2-curb2+curx move.l d7,d1 jsr _LVOSPSub(a6) move.l curx(a5),d1 jsr _LVOSPAdd(a6) move.l d0,d4 ; move.l d0,d1 ; cura2 = cura*cura jsr _LVOSPMul(a6) move.l d0,d6 move.l d5,d0 ; curb2 = curb*curb move.l d5,d1 jsr _LVOSPMul(a6) move.l d0,d7 move.l d6,d1 ; if (cura2+curb2 > 4.0) goto out: jsr _LVOSPAdd(a6) move.l #$80000043,d1 jsr _LVOSPCmp(a6) bgt out add.l #1,l(a5) move.l l(a5),d0 cmp.l TraceSize(a5),d0 blt lloop ; lea olda(a5),a0 ; RTrace = olda lea oldb(a5),a1 ; ITrace = oldb clr.l l(a5) ; for (l = TraceSize; l--; ) lloop1 cmp.l (a0)+,d4 bne skipit cmp.l (a1)+,d5 bne nextl move.w _MaxCount,d0 ext.l d0 move.l d0,k(a5) move.l #0,l(a5) bra out skipit add.l #4,a1 nextl add.l #1,l(a5) move.l l(a5),d0 cmp.l TraceSize(a5),d0 blt lloop1 #endasm #endif } k = 0; l = MaxCount; out: #asm out #endasm SetAPen(rp, ColorXlate[ k + l ]); WritePixel(rp, j + LEFTMARG,i + TOPMARG); if (CountPtr) *(CountPtr++) = k + l; curx += GapX; if ( CheckForStop() ) { DisplayBeep(screen); return(0); } } cury += GapY; } DisplayBeep(screen); } /* Mandelbrot */ /* * 32 bit fixed point generator */ IntMandelbrot() { LONG i, j, k; LONG curx, cury, gapx, gapy; register LONG cura, curb, cura2, curb2; float gap; SHORT *CountPtr; LONG OldA[32],OldB[32]; UBYTE MandFlag; UBYTE ColorXlate[1030]; UBYTE OldPen, NewPen; LONG xl,yl; OldPen = 0xff; #define BITS2SHIFT 27 /* Map contours into color translate table */ for (i = 0,j = 1029; i < NUMCONTS; i++) for (; j >= ContourBase[i] && j; ) ColorXlate[j--] = ColorBase[i]; while (j >= 0) ColorXlate[j--] = 0; /* free up old counts memory, get new picture size, get new counts memory */ GetCountsMemory(); /* clear the picture area */ SetAPen(MandWind->RPort, 0); RectFill(MandWind->RPort, LEFTMARG, TOPMARG, MandWind->Width - 12, MandWind->Height - 2); CountPtr = CountBase; /* calculate new picture's coordinates from zoom box */ ZoomIn(); /* figure out horizontal and verticle distances between points in plane. * convert them to fixed point format */ gapy = (int) (GapY*((float)(1<> 12; move.l d1,d2 ; get copy of op1 sign bit bpl pos1 ; get absolute value of op1 neg.l d1 pos1 eor.l d5,d2 ; calculate result sign tst.l d5 ; get absolute value of op2 bpl pos2 neg.l d5 pos2 move.l d1,d0 ; get a copy of op1 swap d0 ; get high half of op1 move.w d0,d2 ; save a copy of high half mulu d5,d0 ; multiply op2 low by op1 high clr.w d0 ; clear least significant part swap d0 ; put it in it's place swap d5 ; get high half of op2 mulu d5,d1 ; multiply op2 high with op1 low clr.w d1 ; clear least significant part swap d1 ; put it in its place mulu d2,d5 ; multiply op2 high by op1 high add.l d0,d5 ; add partial results add.l d1,d5 ; add partial results tst.l d2 ; is the result negative? bpl pos3 neg.l d5 ; yes, better negate it. pos3 asl.l d6,d5 ; now, rescale it. ; ; curb += curb + cury; add.l d5,d5 ; double it and add cury add.l -20(a5),d5 ; ; cura2 = cura * cura; move.l d4,d0 ; get absolute value of a in d0 bpl posa neg.l d0 posa move.l d0,d1 ; copy absolute value into d1 swap d1 ; get high part in d1 mulu d1,d0 ; multiply high and low destroying low clr.w d0 ; clear the least significant part swap d0 ; put most sig. part in low half mulu d1,d1 ; multiply high and high destroing high add.l d0,d1 ; add in lower half twice add.l d0,d1 asl.l d6,d1 ; get radix point back in correct place bvs bailout ; ; curb2 = curb * curb; move.l d5,d0 ; get absolute value of a in d0 bpl posb neg.l d0 posb move.l d0,d2 ; copy absolute value into d2 swap d2 ; get high part in d2 mulu d2,d0 ; multiply high and low destroying low clr.w d0 ; clear the least significant part swap d0 ; put most sig. part in low half mulu d2,d2 ; multiply high and high destroing high add.l d0,d2 ; add in lower half twice add.l d0,d2 asl.l d6,d2 ; get radix point back in correct place bvs bailout ; move.l d1,d0 ; if (cura2 + curb2 >= 4) goto bailout; add.l d2,d0 bvs bailout cmp.l #536870912,d0 bge bailout dbra d7,KLoop ; keep going ; move.w #Trace,d7 lea OldA(a5),a0 ; lea OldB(a5),a1 SLoop cmp.l (a0)+,d4 ; check A ; bne NotIt ; cmp.l (a1),d5 ; check B beq GotIt NotIt add #2,a1 dbra d7,SLoop ; check next one add.w #Trace,k(a5) ; drop the iteration count cmp.w #1023-Trace,k(a5) blt AddrLoop ; GotIt move.w #1023,d0 bra Adjusted bailout move.b #0,-293(a5) ; clear MandFlag here move.w #Trace,d0 sub.w d7,d0 add.w k(a5),d0 Adjusted ext.l d0 move.l d0,-12(a5) #endasm ;} else { /* This code does mandelbrot without any trace lookup. * It is the fastest generator in the house. */ #asm ; ; d1 - a2 ; d2 - b2 ; d4 - a ; d5 - b ; d6 - BITS2SHIFT ; d7 - k ; ; cura = curb = curc = curd = 0; moveq #0,d1 moveq #0,d2 moveq #0,d4 moveq #0,d5 move.l #Bits2Shift,d6 move.w #1023,d7 FKLoop ; ; cura = cura2 - curb2 + curx; exg d1,d4 ; exchange cura and cura2 sub.l d2,d4 ; subtract curb add.l -16(a5),d4 ; add curx ; ; curb = cura * curb >> 12; move.l d1,d2 ; get copy of op1 sign bit bpl Fpos1 ; get absolute value of op1 neg.l d1 Fpos1 eor.l d5,d2 ; calculate result sign tst.l d5 ; get absolute value of op2 bpl Fpos2 neg.l d5 Fpos2 move.l d1,d0 ; get a copy of op1 swap d0 ; get high half of op1 move.w d0,d2 ; save a copy of high half mulu d5,d0 ; multiply op2 low by op1 high clr.w d0 ; clear least significant part swap d0 ; put it in it's place swap d5 ; get high half of op2 mulu d5,d1 ; multiply op2 high with op1 low clr.w d1 ; clear least significant part swap d1 ; put it in its place mulu d2,d5 ; multiply op2 high by op1 high add.l d0,d5 ; add partial results add.l d1,d5 ; add partial results tst.l d2 ; is the result negative? bpl Fpos3 neg.l d5 ; yes, better negate it. Fpos3 asl.l d6,d5 ; now, rescale it. ; ; curb += curb + cury; add.l d5,d5 ; double it and add cury add.l -20(a5),d5 ; ; cura2 = cura * cura; move.l d4,d0 ; get absolute value of a in d0 bpl Fposa neg.l d0 Fposa move.l d0,d1 ; copy absolute value into d1 swap d1 ; get high part in d1 mulu d1,d0 ; multiply high and low destroying low clr.w d0 ; clear the least significant part swap d0 ; put most sig. part in low half mulu d1,d1 ; multiply high and high destroing high add.l d0,d1 ; add in lower half twice add.l d0,d1 asl.l d6,d1 ; get radix point back in correct place bvs Fbailout ; ; curb2 = curb * curb; move.l d5,d0 ; get absolute value of a in d0 bpl Fposb neg.l d0 Fposb move.l d0,d2 ; copy absolute value into d2 swap d2 ; get high part in d2 mulu d2,d0 ; multiply high and low destroying low clr.w d0 ; clear the least significant part swap d0 ; put most sig. part in low half mulu d2,d2 ; multiply high and high destroing high add.l d0,d2 ; add in lower half twice add.l d0,d2 asl.l d6,d2 ; get radix point back in correct place bvs Fbailout ; move.l d1,d0 ; if (cura2 + curb2 >= 4) goto bailout; add.l d2,d0 bvs Fbailout cmp.l #536870912,d0 bge Fbailout dbra d7,FKLoop move.b #1,-293(a5) ; set MandFlag here Fbailout move.w #1023,d0 sub.w d7,d0 move.w d0,d7 ext.l d7 move.l d7,-12(a5) #endasm } NewPen = ColorXlate[k]; if (NewPen != OldPen) { SetAPen(rp,NewPen); OldPen = NewPen; } if (NewPen) WritePixel(rp, j, i); if (CountPtr) *(CountPtr++) = k; curx += gapx; if ( CheckForStop() ) { /* Clean up here */ DisplayBeep(screen); return(0); } } cury += gapy; } DisplayBeep(screen); } /* Mandelbrot */ /* * Free up old memory and get memory for new picture */ GetCountsMemory() { /* free up old pictures iteration count pile */ if (CountBase) { FreeMem(CountBase,CountX*CountY*sizeof(SHORT)); CountBase = (SHORT *) NULL; } /* figure out new picture size */ CountX = MandWind->Width-(LEFTMARG+RIGHTMARG); CountY = MandWind->Height-(TOPMARG+BOTMARG); /* Allocate memory for new picture */ CountBase = (SHORT *) AllocMem(CountX*CountY*sizeof(SHORT),MEMF_CLEAR); if (CountBase == (SHORT *) NULL) { DispErrMsg("Can't save counts. Out of RAM!!",0); return(1); } return(0); } /* * ZoomIn */ ZoomIn() { if (Zoom) { EndY = StartY + GapY * (float)(NavBot-TOPMARG); EndX = StartX + GapX * (float)(NavRight-LEFTMARG); StartY = StartY + GapY * (float)(NavTop-TOPMARG); StartX = StartX + GapX * (float)(NavLeft-LEFTMARG); Zoom = 0; } CalculateGaps(); } /* ZoomIn */ /* * Calculate Gaps */ CalculateGaps() { GapY = (EndY-StartY)/(float)CountY; if (screen->ViewPort.Modes & HIRES) if (screen->ViewPort.Modes & INTERLACE) GapX = GapY*0.88; else GapX = GapY*0.44; else if (screen->ViewPort.Modes & INTERLACE) GapX = GapY*1.76; else GapX = GapY*0.88; } /* * Check For Stop */ CheckForStop() { struct IntuiMessage *message; struct Gadget *gadget; ULONG class; USHORT code; message = (struct IntuiMessage *) GetMsg(MandWind->UserPort); if (message) { class = message->Class; code = message->Code; ReplyMsg(message); if (class == MENUPICK && code != MENUNULL) { ClearMenuStrip(MandWind); return(1); } } return(0); } /* Check for stop */ /* * Open the Mandelbrot window */ OpenMandWind() { extern struct Window *OpenMyWind(); if (MandWind == (struct Window *) NULL) { MandWind = OpenMyWind(&NewMand, screen, NULL, 109, 78, 320, 200); SetMenuStrip(MandWind, &Menu); ForceNormPointer(); } } /* OpenMandWind */ /* * Close the Mandelbrot Window */ CloseMandWind() { if (MandWind != (struct Window *) NULL) { CloseMyWind(MandWind, NewMand.FirstGadget); MandWind = (struct Window *) NULL; } } /* CloseMandWind */ //E*O*F mand.c// echo x - mand.h cat > "mand.h" << '//E*O*F mand.h//' #include #include #include #include #include #include #include /**********************************/ /* Types */ #define PALTYPE 1 #define CONTYPE 2 #define NAVTYPE 3 #define ORBTYPE 4 #define WINDTYPEBITS 11 #define TYPEBITS 6 #define WINDMASK 0xffff #define TYPEMASK 0xf #define NUMMASK 0x3f /* PALETTE GADGET TYPES */ #define PALPENS 0 #define PALPOTS 1 #define PALCNTLS 2 /* Palette Control Gadgets */ #define PALPEN (PALTYPE << WINDTYPEBITS | PALPENS << TYPEBITS) #define PALPOT (PALTYPE << WINDTYPEBITS | PALPOTS << TYPEBITS) #define PALCNTL (PALTYPE << WINDTYPEBITS | PALCNTLS << TYPEBITS) #define PALCOPY (PALCNTL | 0) #define PALRANGE (PALCNTL | 1) #define PALEXCG (PALCNTL | 2) /* CONTOUR DEFINES */ #define CONTSELS 0 #define CONTUPS 1 #define CONTDOWNS 2 #define CONTPOTS 3 #define CONTCNTLS 4 #define CONTSEL (CONTYPE << WINDTYPEBITS | CONTSELS << TYPEBITS) #define CONTUP (CONTYPE << WINDTYPEBITS | CONTUPS << TYPEBITS) #define CONTDOWN (CONTYPE << WINDTYPEBITS | CONTDOWNS << TYPEBITS) #define CONTPOT (CONTYPE << WINDTYPEBITS | CONTPOTS << TYPEBITS) #define CONTCNTL (CONTYPE << WINDTYPEBITS | CONTCNTLS << TYPEBITS) #define CONTRECOL (CONTCNTL | 0) #define CONTSMTH (CONTCNTL | 1) #define CONTCEIL (CONTCNTL | 2) #define NUMCONTS 32 #define TOPMARG 11 #define BOTMARG 11 #define LEFTMARG 4 #define RIGHTMARG 15 /**********************************/ /*-------------------*/ /* Misc. definitions */ #define VERSION 100 /* Menu: Project, Item: Save's SubItems */ #define SAVEMAND 0 #define SAVEILBM 1 /* Menu Project's, Items */ #define LOADITEM 0 #define SAVEITEM 1 #define GENERATEITEM 2 #define USEITEM 3 #define QUITITEM 4 /* Menu: Edit, Item: ZoomIn's, SubItems */ #define ZOOMINON 0 #define ZOOMINOFF 1 /* Menu: Edit, Item: ViewMode's, SubItems */ #define HIRESSUB 0 #define INTERLACESUB 1 #define HALFBRITESUB 2 /* Menu: Edit, Item: Depth's, SubItems */ #define BITPLANE1SUB 0 #define BITPLANES2SUB 1 #define BITPLANES3SUB 2 #define BITPLANES4SUB 3 #define BITPLANES5SUB 4 #define BITPLANES6SUB 5 /* Menu Edit's, Items */ #define ZOOMITEM 0 #define COLORITEM 1 #define CONTOURITEM 2 #define GENERATORITEM 3 #define COUNTITEM 4 #define VIEWMODEITEM 5 #define DEPTHITEM 6 /* Menu Entries */ #define PROJECTMENU 0 #define EDITMENU 1 #define PRESETMENU 2 #define TOGGLED11 0x0200 /************************************/ /* */ /* CmdMode possibilities */ /* */ /* */ /************************************/ #define SMOOTH 1 #define IMPLIEDSET 2 #define COPY 11 #define RANGE 12 #define EXCG 13 #define STARTBOX 20 #define STRETCHBOX 21 #define COLORSLIDE 22 #define ZOOMDRAG 23 #define ZOOMSIZE 24 //E*O*F mand.h// echo x - menu.c cat > "menu.c" << '//E*O*F menu.c//' /*************************************************************************** * * MandelVroom Menu Manipulation routines * * Kevin L. Clague * * Copyright (C) 1987 * **************************************************************************/ #include "mand.h" extern struct Menu Menu, GenMenu; extern struct NewScreen NewScreen; extern struct Screen *screen; extern struct Window *MandWind, *PalWind, *ContWind; extern struct NewWindow *NewMand; extern SHORT MaxCount, Zoom; extern UBYTE MandType, QuitScreen; extern USHORT CmdMode; /* * Decide what to do for Project menu's Items */ ScreenProject(code) USHORT code; { static char File[80] = "", Path[80] = "df1:"; char Name[160]; char *p; switch (ITEMNUM(code)) { case LOADITEM: SetSystemColors(1); if (get_fname(MandWind,screen,"Load Pics",File,Path)) { SetSystemColors(0); strcpy(Name,Path); if (Name[strlen(Name)-1] != ':') { strcat(Name,"/"); } strcat(Name,File); if (PalWind) { ClosePalWind(); } if (ContWind) { CloseContWind(); } ClearMenuStrip(MandWind); LoadCounts(Name); SetNormPointer(); SetMenuStrip(MandWind, &Menu); } else { SetSystemColors(0); } break; case SAVEITEM: switch (SUBNUM(code)) { case 0: p = "Save Pics"; break; case 1: p = "Save ILBM"; break; } SetSystemColors(1); if (get_fname(MandWind, screen, p, File, Path )) { SetSystemColors(0); strcpy(Name, Path); if (Name[strlen(Name)-1] != ':') { strcat(Name,"/"); } strcat(Name,File); ClearMenuStrip(MandWind); switch (SUBNUM(code)) { case 0: SaveCounts(Name); break; case 1: SaveILBM(Name); break; } DisplayBeep(screen); SetNormPointer(); SetMenuStrip(MandWind, &Menu); } else { SetSystemColors(0); } break; case GENERATEITEM: GenerateIt(); break; case USEITEM: CloseDisp(); OpenDisp(); break; case QUITITEM: QuitScreen = TRUE; } } /* DoProjectScreen */ /* * Decide what to do for Edit menu's Items */ EditScreen(code) USHORT code; { float gapy,gapx; extern LONG NavLeft,NavTop,NavBot,NavRight; switch (ITEMNUM(code)) { case COLORITEM: OpenPalWind(); break; case DEPTHITEM: NewScreen.Depth = SUBNUM(code) + 1; if (NewScreen.ViewModes & HIRES) if (NewScreen.Depth > 4) { NewScreen.Depth = 4; InitDepthSubs(); } break; case CONTOURITEM: OpenContWind(); break; case VIEWMODEITEM: EditScreenViewModes(code); break; case GENERATORITEM: /* generator type */ MandType = SUBNUM(code); break; case ZOOMITEM: switch (SUBNUM(code)) { case ZOOMINON: if (Zoom == 0) { CmdMode = STARTBOX; SetToPointer(); } break; case ZOOMINOFF: if (Zoom == 1) { DrawExtras(NavLeft, NavTop, NavRight, NavBot ); DrawBox(NavLeft, NavTop, NavRight, NavBot ); Zoom = 0; } } break; case COUNTITEM: switch (SUBNUM(code)) { case 0: MaxCount = 32; break; case 1: MaxCount = 64; break; case 2: MaxCount = 128; break; case 3: MaxCount = 256; break; case 4: MaxCount = 512; break; case 5: MaxCount = 1023; break; } } } /* EditScreen */ /* * Modify the NewScreens ViewModes to match the menu */ EditScreenViewModes(code) USHORT code; { switch (SUBNUM(code)) { case HIRESSUB: if (NewScreen.ViewModes & HIRES) { NewScreen.Width = 320; NewScreen.ViewModes &= ~HIRES; } else { NewScreen.Width = 640; NewScreen.ViewModes |= HIRES; NewScreen.ViewModes &= ~EXTRA_HALFBRITE; if (NewScreen.Depth > 4) NewScreen.Depth = 4; } break; case INTERLACESUB: if (NewScreen.ViewModes & INTERLACE) { NewScreen.ViewModes &= ~INTERLACE; NewScreen.Height = 200; } else { NewScreen.ViewModes |= INTERLACE; NewScreen.Height = 400; } break; case HALFBRITESUB: if (NewScreen.ViewModes & EXTRA_HALFBRITE) { NewScreen.ViewModes &= ~EXTRA_HALFBRITE; NewScreen.Depth = 5; } else { NewScreen.ViewModes |= EXTRA_HALFBRITE; NewScreen.ViewModes &= ~HIRES; NewScreen.Depth = 6; } break; } InitViewModesSubs(); InitDepthSubs(); } /* EditScreenViewMode */ /* * Set up Menu's check marks to reflect viewmodes. */ InitViewModesSubs() { SHORT i; extern struct MenuItem ViewModeSubs[]; for (i = HIRESSUB; i <= HALFBRITESUB; i++) { ViewModeSubs[i].Flags &= ~CHECKED; switch (i) { case HIRESSUB: if (NewScreen.ViewModes & HIRES) ViewModeSubs[i].Flags |= CHECKED; break; case INTERLACESUB: if (NewScreen.ViewModes & INTERLACE) ViewModeSubs[i].Flags |= CHECKED; break; case HALFBRITESUB: if (NewScreen.ViewModes & EXTRA_HALFBRITE) ViewModeSubs[i].Flags |= CHECKED; break; } } } /* InitViewModesSubs */ /* * Set up Menu's check marks to reflect Depth. */ InitDepthSubs() { SHORT i; extern struct MenuItem DepthSubs[]; for (i = 0; i <= 6; i++) { DepthSubs[i].Flags &= ~CHECKED; } DepthSubs[NewScreen.Depth-1].Flags |= CHECKED; } /* InitScreenViewMode */ /* * Set up Menu's check marks to reflect Generator Type */ InitGenSubs() { SHORT i; extern struct MenuItem GenerateSubs[]; extern UBYTE MandType; for (i = 0; i <= 1; i++) { GenerateSubs[i].Flags &= ~CHECKED; } GenerateSubs[MandType].Flags |= CHECKED; } /* InitGenSubs */ /* * Set up Menu's check marks to reflect Iteration count */ InitMaxISubs() { SHORT i; extern struct MenuItem CountSubs[]; extern SHORT MaxCount; for (i = 0; i <= 1; i++) { CountSubs[i].Flags &= ~CHECKED; } if (MaxCount <= 32) CountSubs[0].Flags |= CHECKED; else if (MaxCount <= 64) CountSubs[1].Flags |= CHECKED; else if (MaxCount <= 128) CountSubs[2].Flags |= CHECKED; else if (MaxCount <= 256) CountSubs[3].Flags |= CHECKED; else if (MaxCount <= 512) CountSubs[4].Flags |= CHECKED; else if (MaxCount <= 1024) CountSubs[5].Flags |= CHECKED; } /* InitGenSubs */ //E*O*F menu.c// echo x - menu1.c cat > "menu1.c" << '//E*O*F menu1.c//' /**************************************************************************** * * MandelVroom Pre-initialized Menu structures * * Kevin L. Clague * * Copyright (C) 1987 * **************************************************************************/ #include "mand.h" struct IntuiText SaveSubsIntui[] = { { 0, 1, 0, 4, 2, NULL, (UBYTE *) "MAND", NULL }, { 0, 1, 0, 4, 2, NULL, (UBYTE *) "ILBM", NULL } }; struct MenuItem SaveSubs[] = { { (struct MenuItem *) &SaveSubs[1], 24, 14, 40, 12, ITEMTEXT|ITEMENABLED|HIGHBOX|0, NULL, (APTR) &SaveSubsIntui[0], NULL, '\0', NULL, NULL }, { (struct MenuItem *) NULL, 24, 26, 40, 12, ITEMTEXT|ITEMENABLED|HIGHBOX|0, NULL, (APTR) &SaveSubsIntui[1], NULL, '\0', NULL, NULL } }; struct IntuiText ProjectItemsIntui[] = { { 0, 1, 0, 4, 2, NULL, (UBYTE *) "Load", NULL }, { 0, 1, 0, 4, 2, NULL, (UBYTE *) "Save", NULL }, { 0, 1, 0, 4, 2, NULL, (UBYTE *) "Generate", NULL }, { 0, 1, 0, 2, 2, NULL, (UBYTE *) "NewScreen", NULL }, { 0, 1, 0, 2, 2, NULL, (UBYTE *) "Quit", NULL } }; struct MenuItem ProjectItems[] = { { (struct MenuItem *) &ProjectItems[1], 0, 0, 106, 14, CHECKED|ITEMTEXT|COMMSEQ|ITEMENABLED|HIGHBOX|0, 0, (APTR) &ProjectItemsIntui[0], NULL, 'l', NULL, NULL }, { (struct MenuItem *) &ProjectItems[2], 0, 14, 106, 14, ITEMTEXT|ITEMENABLED|HIGHBOX|0, 0, (APTR) &ProjectItemsIntui[1], NULL, '\0', (struct MenuItem *) &SaveSubs[0], NULL }, { (struct MenuItem *) &ProjectItems[3], 0, 28, 106, 14, ITEMTEXT|COMMSEQ|ITEMENABLED|HIGHBOX|0, 0, (APTR) &ProjectItemsIntui[2], NULL, 'g', NULL, NULL }, { (struct MenuItem *) &ProjectItems[4], 0, 42, 106, 14, ITEMTEXT|COMMSEQ|ITEMENABLED|HIGHBOX|0, 0, (APTR) &ProjectItemsIntui[3], NULL, 'n', NULL, NULL }, { NULL, 0, 56, 106, 14, ITEMTEXT|COMMSEQ|ITEMENABLED|HIGHBOX|0, 0, (APTR) &ProjectItemsIntui[4], NULL, 'q', NULL, NULL } }; struct IntuiText ZoomInSubsIntui[] = { { 0, 1, 0, 4, 2, NULL, (UBYTE *) "Open", NULL }, { 0, 1, 0, 4, 2, NULL, (UBYTE *) "Close", NULL } }; struct MenuItem ZoomInSubs[] = { { (struct MenuItem *) &ZoomInSubs[1], 24, 14, 48, 12, ITEMTEXT|ITEMENABLED|HIGHBOX|0, 0, (APTR) &ZoomInSubsIntui[0], NULL, '\0', NULL, NULL }, { (struct MenuItem *) NULL, 24, 26, 48, 12, ITEMTEXT|ITEMENABLED|HIGHBOX|0, 0, (APTR) &ZoomInSubsIntui[1], NULL, '\0', NULL, NULL } }; struct IntuiText GenerateSubsIntui[] = { { 0, 1, 0, 16, 2, NULL, (UBYTE *) "Integer", NULL }, { 0, 1, 0, 16, 2, NULL, (UBYTE *) "FFP", NULL } }; struct MenuItem GenerateSubs[] = { { (struct MenuItem *) &GenerateSubs[1], 24, 14, 100, 12, CHECKIT|CHECKED|COMMSEQ|ITEMTEXT|ITEMENABLED|HIGHBOX|0, 0x0003-0x0001, (APTR) &GenerateSubsIntui[0], NULL, 'i', NULL, NULL }, { (struct MenuItem *) NULL, 24, 26, 100, 12, CHECKIT|COMMSEQ|ITEMTEXT|ITEMENABLED|HIGHBOX|0, 0x0003-0x0002, (APTR) &GenerateSubsIntui[1], NULL, 'f', NULL, NULL } }; struct IntuiText ViewModeSubsIntui[] = { { 0, 1, 0, 16, 2, NULL, (UBYTE *) "HIRES", NULL }, { 0, 1, 0, 16, 2, NULL, (UBYTE *) "INTERLACE", NULL }, { 0, 1, 0, 16, 2, NULL, (UBYTE *) "HALFBRITE", NULL } }; struct MenuItem ViewModeSubs[] = { { (struct MenuItem *) &ViewModeSubs[1], 24, 14, 88, 12, CHECKIT|ITEMTEXT|ITEMENABLED|HIGHBOX|0, 0, (APTR) &ViewModeSubsIntui[0], NULL, '\0x1a', NULL, NULL }, { (struct MenuItem *) &ViewModeSubs[2], 24, 26, 88, 12, CHECKIT|ITEMTEXT|ITEMENABLED|HIGHBOX|0, 0, (APTR) &ViewModeSubsIntui[1], NULL, '\0x1a', NULL, NULL }, { (struct MenuItem *) NULL, 24, 38, 88, 12, CHECKIT|ITEMTEXT|ITEMENABLED|HIGHBOX|0, 0, (APTR) &ViewModeSubsIntui[2], NULL, '\0x1a', NULL, NULL } }; struct IntuiText DepthSubsIntui[] = { { 0, 1, 0, 16, 2, NULL, (UBYTE *) "1-BitPlane", NULL }, { 0, 1, 0, 16, 2, NULL, (UBYTE *) "2-BitPlanes", NULL }, { 0, 1, 0, 16, 2, NULL, (UBYTE *) "3-BitPlanes", NULL }, { 0, 1, 0, 16, 2, NULL, (UBYTE *) "4-BitPlanes", NULL }, { 0, 1, 0, 16, 2, NULL, (UBYTE *) "5-BitPlanes", NULL }, { 0, 1, 0, 16, 2, NULL, (UBYTE *) "6-BitPlanes", NULL } }; struct MenuItem DepthSubs[] = { { (struct MenuItem *) &DepthSubs[1], 24, 14, 136, 12, CHECKIT|ITEMTEXT|COMMSEQ|ITEMENABLED|HIGHBOX|0, 0x003F-0x0001, (APTR) &DepthSubsIntui[0], NULL, '1', NULL, NULL }, { (struct MenuItem *) &DepthSubs[2], 24, 26, 136, 12, CHECKIT|ITEMTEXT|COMMSEQ|ITEMENABLED|HIGHBOX|0, 0x003F-0x0002, (APTR) &DepthSubsIntui[1], NULL, '2', NULL, NULL }, { (struct MenuItem *) &DepthSubs[3], 24, 38, 136, 12, CHECKIT|ITEMTEXT|COMMSEQ|ITEMENABLED|HIGHBOX|0, 0x003F-0x0004, (APTR) &DepthSubsIntui[2], NULL, '3', NULL, NULL }, { (struct MenuItem *) &DepthSubs[4], 24, 50, 136, 12, CHECKIT|ITEMTEXT|COMMSEQ|ITEMENABLED|HIGHBOX|0, 0x003F-0x0008, (APTR) &DepthSubsIntui[3], NULL, '4', NULL, NULL }, { (struct MenuItem *) &DepthSubs[5], 24, 62, 136, 12, CHECKIT|CHECKED|ITEMTEXT|COMMSEQ|ITEMENABLED|HIGHBOX|0, 0x003F-0x0010, (APTR) &DepthSubsIntui[4], NULL, '5', NULL, NULL }, { NULL, 24, 74, 136, 12, CHECKIT|ITEMTEXT|COMMSEQ|ITEMENABLED|HIGHBOX|0, 0x003F-0x0020, (APTR) &DepthSubsIntui[5], NULL, '6', NULL, NULL } }; struct IntuiText CountSubsIntui[] = { { 0, 1, 0, 16, 2, NULL, (UBYTE *) "32", NULL }, { 0, 1, 0, 16, 2, NULL, (UBYTE *) "64", NULL }, { 0, 1, 0, 16, 2, NULL, (UBYTE *) "128", NULL }, { 0, 1, 0, 16, 2, NULL, (UBYTE *) "256", NULL }, { 0, 1, 0, 16, 2, NULL, (UBYTE *) "512", NULL }, { 0, 1, 0, 16, 2, NULL, (UBYTE *) "1023", NULL } }; struct MenuItem CountSubs[] = { { (struct MenuItem *) &CountSubs[1], 24, 14, 48, 12, CHECKIT | ITEMTEXT | ITEMENABLED | HIGHBOX, 0x003F-0x0001, (APTR) &CountSubsIntui[0], NULL, '1', NULL, NULL }, { (struct MenuItem *) &CountSubs[2], 24, 26, 48, 12, CHECKIT | ITEMTEXT | ITEMENABLED | HIGHBOX, 0x003F-0x0002, (APTR) &CountSubsIntui[1], NULL, '2', NULL, NULL }, { (struct MenuItem *) &CountSubs[3], 24, 38, 48, 12, CHECKIT | ITEMTEXT | ITEMENABLED | HIGHBOX, 0x003F-0x0004, (APTR) &CountSubsIntui[2], NULL, '3', NULL, NULL }, { (struct MenuItem *) &CountSubs[4], 24, 50, 48, 12, CHECKIT | ITEMTEXT | ITEMENABLED | HIGHBOX, 0x003F-0x0008, (APTR) &CountSubsIntui[3], NULL, '4', NULL, NULL }, { (struct MenuItem *) &CountSubs[5], 24, 62, 48, 12, CHECKIT | ITEMTEXT | ITEMENABLED | HIGHBOX, 0x003F-0x0010, (APTR) &CountSubsIntui[4], NULL, '5', NULL, NULL }, { NULL, 24, 74, 48, 12, CHECKIT | CHECKED | ITEMTEXT | ITEMENABLED | HIGHBOX, 0x003F-0x0020, (APTR) &CountSubsIntui[5], NULL, '6', NULL, NULL } }; struct IntuiText EditItemsIntui[] = { { 0, 1, 0, 4, 2, NULL, (UBYTE *) "Zoom", NULL }, { 0, 1, 0, 4, 2, NULL, (UBYTE *) "Colors", NULL }, { 0, 1, 0, 4, 2, NULL, (UBYTE *) "Contours", NULL }, { 0, 1, 0, 4, 2, NULL, (UBYTE *) "Generator", NULL }, { 0, 1, 0, 4, 2, NULL, (UBYTE *) "Max Iteration", NULL }, { 0, 1, 0, 4, 2, NULL, (UBYTE *) "ViewMode", NULL }, { 0, 1, 0, 4, 2, NULL, (UBYTE *) "Depth", NULL }, }; struct MenuItem EditItems[] = { { /* Zoom */ (struct MenuItem *) &EditItems[1], 0, 0, 104, 14, ITEMTEXT|ITEMENABLED|HIGHBOX|0, 0, (APTR) &EditItemsIntui[0], NULL, 0, (struct MenuItem *) &ZoomInSubs, NULL }, { /* Colors */ (struct MenuItem *) &EditItems[2], 0, 14, 104, 14, CHECKED|ITEMTEXT|COMMSEQ|ITEMENABLED|HIGHBOX|0, 0, (APTR) &EditItemsIntui[1], NULL, 'c', NULL, NULL }, { /* Contours */ (struct MenuItem *) &EditItems[3], 0, 28, 104, 14, ITEMTEXT|COMMSEQ|ITEMENABLED|HIGHBOX|0, 0, (APTR) &EditItemsIntui[2], NULL, 'k', NULL, NULL }, { /* Generator */ (struct MenuItem *) &EditItems[4], 0, 42, 104, 14, ITEMTEXT|ITEMENABLED|HIGHBOX|0, 0, (APTR) &EditItemsIntui[3], NULL, '\0', (struct MenuItem *) &GenerateSubs, NULL }, { /* MaxI */ (struct MenuItem *) &EditItems[5], 0, 56, 104, 14, ITEMTEXT|ITEMENABLED|HIGHBOX|0, 0, (APTR) &EditItemsIntui[4], NULL, '\0x0', (struct MenuItem *) &CountSubs, NULL }, { /* ViewModes */ (struct MenuItem *) &EditItems[6], 0, 70, 104, 14, ITEMTEXT|ITEMENABLED|HIGHBOX|0, 0, (APTR) &EditItemsIntui[5], NULL, '\0x0', (struct MenuItem *) &ViewModeSubs, NULL }, { /* Depth */ NULL, 0, 84, 104, 14, ITEMTEXT|ITEMENABLED|HIGHBOX|0, 0, (APTR) &EditItemsIntui[6], NULL, '\0x0', (struct MenuItem *) &DepthSubs, NULL }, }; struct IntuiText ToolItemsIntui[] = { { 0, 1, 0, 4, 2, NULL, (UBYTE *) "Big Brot", NULL }, { 0, 1, 0, 4, 2, NULL, (UBYTE *) "Hey Baby", NULL }, { 0, 1, 0, 4, 2, NULL, (UBYTE *) "Dragon Family", NULL }, { 0, 1, 0, 4, 2, NULL, (UBYTE *) "Spine", NULL }, { 0, 1, 0, 4, 2, NULL, (UBYTE *) "Vertibrae", NULL }, { 0, 1, 0, 4, 2, NULL, (UBYTE *) "Beauty", NULL }, { 0, 1, 0, 4, 2, NULL, (UBYTE *) "Sea Horse", NULL }, { 0, 1, 0, 4, 2, NULL, (UBYTE *) "Horse Chain", NULL }, { 0, 1, 0, 4, 2, NULL, (UBYTE *) "Chain Link", NULL }, { 0, 1, 0, 4, 2, NULL, (UBYTE *) "Pretty Baby", NULL }, }; struct MenuItem ToolItems[] = { { (struct MenuItem *) &ToolItems[1], 0, 0, 130, 14, ITEMTEXT|ITEMENABLED|HIGHBOX|0, 0, (APTR) &ToolItemsIntui[0], NULL, 'p', NULL, NULL }, { (struct MenuItem *) &ToolItems[2], 0, 14, 130, 14, ITEMTEXT|ITEMENABLED|HIGHBOX|0, 0, (APTR) &ToolItemsIntui[1], NULL, 'p', NULL, NULL }, { (struct MenuItem *) &ToolItems[3], 0, 28, 130, 14, ITEMTEXT|ITEMENABLED|HIGHBOX|0, 0, (APTR) &ToolItemsIntui[2], NULL, 'p', NULL, NULL }, { (struct MenuItem *) &ToolItems[4], 0, 42, 130, 14, ITEMTEXT|ITEMENABLED|HIGHBOX|0, 0, (APTR) &ToolItemsIntui[3], NULL, 'p', NULL, NULL }, { (struct MenuItem *) &ToolItems[5], 0, 56, 130, 14, ITEMTEXT|ITEMENABLED|HIGHBOX|0, 0, (APTR) &ToolItemsIntui[4], NULL, 'p', NULL, NULL }, { (struct MenuItem *) &ToolItems[6], 0, 70, 130, 14, ITEMTEXT|ITEMENABLED|HIGHBOX|0, 0, (APTR) &ToolItemsIntui[5], NULL, 'p', NULL, NULL }, { (struct MenuItem *) &ToolItems[7], 0, 84, 130, 14, ITEMTEXT|ITEMENABLED|HIGHBOX|0, 0, (APTR) &ToolItemsIntui[6], NULL, 'p', NULL, NULL }, { (struct MenuItem *) &ToolItems[8], 0, 98, 130, 14, ITEMTEXT|ITEMENABLED|HIGHBOX|0, 0, (APTR) &ToolItemsIntui[7], NULL, 'p', NULL, NULL }, { (struct MenuItem *) &ToolItems[9], 0, 112, 130, 14, ITEMTEXT|ITEMENABLED|HIGHBOX|0, 0, (APTR) &ToolItemsIntui[8], NULL, 'p', NULL, NULL }, { (struct MenuItem *) NULL, 0, 126, 130, 14, ITEMTEXT|ITEMENABLED|HIGHBOX|0, 0, (APTR) &ToolItemsIntui[9], NULL, 'p', NULL, NULL }, }; struct Menu Menu[] = { { (struct Menu *) &Menu[1], 4, 0, 56, 8, 1, (BYTE *) "Project", (struct MenuItem *) &ProjectItems, }, { (struct Menu *) &Menu[2], 68, 0, 32, 8, 1, (BYTE *) "Edit", (struct MenuItem *) &EditItems, }, { NULL, 108, 0, 64, 8, 1, (BYTE *) "Presets", (struct MenuItem *) &ToolItems, } }; struct IntuiText GenProjIntui[] = { { 0, 1, 0, 4, 2, NULL, (UBYTE *) "Stop", NULL } }; struct MenuItem GenProjItems[] = { { (struct MenuItem *) NULL, 0, 0, 60, 12, ITEMTEXT | COMMSEQ | ITEMENABLED | HIGHBOX, 0, (APTR) &GenProjIntui[0], NULL, 's', NULL, NULL } }; struct Menu GenMenu[] = { { (struct Menu *) NULL, 4, 0, 56, 8, 1, (BYTE *) "Project", (struct MenuItem *) &GenProjItems, }, }; //E*O*F menu1.c// echo x - nav.c cat > "nav.c" << '//E*O*F nav.c//' /*************************************************************************** * * MandelVroom Navigation Control * * Kevin L. Clague * * Copyright (C) 1987 * **************************************************************************/ #include "mand.h" extern struct RastPort *rp; extern USHORT CmdMode; LONG NavTop, NavBot, NavLeft, NavRight; extern SHORT XScale, YScale; SHORT BoxSizeX = 3, BoxSizeY = 3, DragSize = 3; DrawBox( Left, Top, Right, Bottom) SHORT Top, Left, Bottom, Right; { SetDrMd(rp, COMPLEMENT); /* * Draw the new box */ Move(rp, Left, Top ); Draw(rp, Right, Top ); Draw(rp, Right, Bottom); Draw(rp, Left, Bottom); Draw(rp, Left, Top+1 ); SetDrMd(rp, JAM1); } /* DrawBox */ DrawExtras( Left, Top, Right, Bottom) SHORT Top, Left, Bottom, Right; { SetDrMd(rp, COMPLEMENT); /* * Draw Resize gadget */ Move(rp, Right - 1, Bottom - (BoxSizeY << YScale)); Draw(rp, Right - (BoxSizeX << XScale), Bottom - (BoxSizeY << YScale)); Move(rp, Right - (BoxSizeX << XScale), Bottom + 1 - (BoxSizeY << YScale)); Draw(rp, Right - (BoxSizeX << XScale), Bottom - 1); Move(rp, Left + 1, Top + (DragSize << YScale)); Draw(rp, Right - 1, Top + (DragSize << YScale)); /* * Drag bar bar / close gadget separator */ Move(rp, Left + (4 << XScale), Top + 1); Draw(rp, Left + (4 << XScale), Top + (DragSize << YScale) -1 ); SetDrMd(rp, JAM1); } /* DrawBox */ //E*O*F nav.c// echo Possible errors detected by \'wc\' [hopefully none]: temp=/tmp/shar$$ trap "rm -f $temp; exit" 0 1 2 3 15 cat > $temp <<\!!! 436 1124 9159 main.c 726 2477 17997 mand.c 130 380 2980 mand.h 338 709 7367 menu.c 1177 1621 15142 menu1.c 64 207 1563 nav.c 2871 6518 54208 total !!! wc main.c mand.c mand.h menu.c menu1.c nav.c | sed 's=[^ ]*/==' | diff -b $temp - exit 0 -- UUCP: orandy@amdahl.amdahl.com or: {sun,decwrl,hplabs,pyramid,ihnp4,seismo,oliveb,cbosgd}!amdahl!orandy DDD: 408-737-5481 USPS: Amdahl Corp. M/S 249, 1250 E. Arques Av, Sunnyvale, CA 94086 [ Any thoughts or opinions which may or may not have been expressed ] [ herein are my own. They are not necessarily those of my employer. ]