home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fred Fish Collection 1.5
/
ffcollection-1-5-1992-11.iso
/
ff_progs
/
fract
/
mandel.lzh
/
MANDEL
/
SRC
/
MENU.C
< prev
next >
Wrap
C/C++ Source or Header
|
1991-08-16
|
9KB
|
335 lines
/*
* M A N D E L B R O T C O N S T R U C T I O N S E T
*
* (C) Copyright 1989 by Olaf Seibert.
* Mandel may be freely distributed. See file 'doc/Notice' for details.
*
* Menu definitions.
*/
#include <exec/types.h>
#include <intuition/intuition.h>
#define MENUFRONTPEN 2
/*-
* (C) project options draw batch
* ----------------------------------------------------------------
* About Mandel... new * colors * function file...
* open... /O resolution * iplot wait
* save /S parameters eplot continue
* save as... priority * abort
* stop
* quit /Q
*
* new colors resolution priority
* -------------------------------------------------------------
* absolute pos'n /A select normal /1 normal /0
* enlarge /E modulo 1/2 /2 low /-
* reduce /R ranges 1/3 /3
* shift /T palette /P 1/4 /4
* zoom in /< fill in /F
* zoom out /> hi-res /H
* interlace /I
* borderless /B
* halfbrite //
*
* functions iplot eplot
* -------------------------------------------------------------------
* z^2-c None Depth
* z*c*(1-z) Z Z
* z^3+z*(c-1)-c
* i:user
* i:z^2-c
*/
/*
* Define some handy shortcuts.
*/
#define ITEXT(left,text) \
{ MENUFRONTPEN,AUTOBACKPEN,JAM1,left,1,NULL, (UBYTE*)text, NULL }
#define ITEM(num,top,next,text,flags,mutex,cmd) \
SITEM(num,top,next,text,flags,mutex,cmd,NULL)
#define SITEM(num,top,next,text,flags,mutex,cmd,sub) \
{next,MLEFT,top,MWIDTH,10,flags,mutex,(APTR)&text[num],NULL,cmd,sub}
#define Ax COMMSEQ
#define Vx CHECKIT
#define VV CHECKIT | CHECKED
#define TG MENUTOGGLE
#define EN ITEMENABLED
#define DEFMLEFT 40
/*
* First the menu texts.
*/
struct IntuiText c_it[] = {
ITEXT(1, "About Mandel..."),
};
struct IntuiText project_it[] = {
ITEXT(1, "New \xBB"), /* 0xBB is the >> character */
ITEXT(1, "Open..."),
ITEXT(1, "Save"),
ITEXT(1, "Save As..."),
ITEXT(1, "Stop"),
ITEXT(1, "Quit..."),
};
struct IntuiText opts_it[] = {
ITEXT(1, "Colors \xBB"),
ITEXT(1, "Resolution \xBB"),
ITEXT(1, "Parameters"),
ITEXT(1, "Priority \xBB"),
};
struct IntuiText draw_it[] = {
ITEXT(1, "Func \xBB"),
ITEXT(1, "IPlot \xBB"),
ITEXT(1, "EPlot \xBB"),
};
struct IntuiText batch_it[] = {
ITEXT(1, "File..."),
ITEXT(1, "Wait"),
ITEXT(1, "Continue"),
ITEXT(1, "Abort"),
};
struct IntuiText new_it[] = {
ITEXT(1, "Absolute"),
ITEXT(1, "Enlarge"),
ITEXT(1, "Reduce"),
ITEXT(1, "Shift"),
ITEXT(1, "Zoom In"),
ITEXT(1, "Zoom Out"),
};
struct IntuiText color_it[] = {
ITEXT(CHECKWIDTH, "Select"),
ITEXT(CHECKWIDTH, "Modulo"),
ITEXT(CHECKWIDTH, "Ranges"),
ITEXT(CHECKWIDTH, "Palette"),
};
struct IntuiText pri_it[] = {
ITEXT(CHECKWIDTH, "Normal"),
ITEXT(CHECKWIDTH, "Low"),
};
struct IntuiText res_it[] = {
ITEXT(CHECKWIDTH, "Normal"),
ITEXT(CHECKWIDTH, "1/2"),
ITEXT(CHECKWIDTH, "1/3"),
ITEXT(CHECKWIDTH, "1/4"),
ITEXT(CHECKWIDTH, "Fill In"),
ITEXT(CHECKWIDTH, "Hires"),
ITEXT(CHECKWIDTH, "Interlace"),
ITEXT(CHECKWIDTH, "BorderLess"),
ITEXT(CHECKWIDTH, "HalfBrite"),
};
struct IntuiText fun_it[] = {
ITEXT(CHECKWIDTH, "Z^2-C"),
ITEXT(CHECKWIDTH, "Z*C*(1-Z)"),
ITEXT(CHECKWIDTH, "Z^3+Z*(C-1)-C"),
ITEXT(CHECKWIDTH, "iplot: User"),
ITEXT(CHECKWIDTH, "iplot: Z^2-C"),
};
struct IntuiText plot_it[] = {
ITEXT(CHECKWIDTH, "None"),
ITEXT(CHECKWIDTH, "Depth"),
ITEXT(CHECKWIDTH, "Z"),
};
#define FLAGS ITEMTEXT | ITEMENABLED | HIGHBOX
/*
* New submenu
*/
#define MLEFT DEFMLEFT
#define MWIDTH 8*8+2+COMMWIDTH+8 /* Funny we need 2 more pixels */
struct MenuItem new_mi[] = {
ITEM(0,05,&new_mi[1],new_it,FLAGS|Ax,0,'A'), /* absolute */
ITEM(1,15,&new_mi[2],new_it,FLAGS|Ax,0,'E'), /* enlarge */
ITEM(2,25,&new_mi[3],new_it,FLAGS|Ax,0,'R'), /* reduce */
ITEM(3,35,&new_mi[4],new_it,FLAGS|Ax,0,'T'), /* shift */
ITEM(4,45,&new_mi[5],new_it,FLAGS|Ax,0,'<'), /* Zoom In */
ITEM(5,55,NULL, new_it,FLAGS|Ax,0,'>'), /* Zoom Out */
};
/*
* Colors submenu
*/
#undef MWIDTH
#define MWIDTH CHECKWIDTH+7*8+COMMWIDTH+8
struct MenuItem color_mi[] = {
ITEM(0,05,&color_mi[1],color_it,FLAGS|Vx,1<<1|1<<2,0), /* select */
ITEM(1,15,&color_mi[2],color_it,FLAGS|VV,1<<0|1<<2,0), /* modulo */
ITEM(2,25,&color_mi[3],color_it,FLAGS|Vx,1<<0|1<<1,0), /* ranges */
ITEM(3,35,NULL ,color_it,FLAGS|Ax,0, 'P'), /* palette */
};
#undef MWIDTH
#define MWIDTH CHECKWIDTH+10*8+COMMWIDTH+8
struct MenuItem res_mi[] = {
ITEM(0,05,&res_mi[1],res_it,FLAGS|Ax|VV,1<<1|1<<2|1<<3,'1'), /* normal */
ITEM(1,15,&res_mi[2],res_it,FLAGS|Ax|Vx,1<<0|1<<2|1<<3,'2'), /* 1/2 */
ITEM(2,25,&res_mi[3],res_it,FLAGS|Ax|Vx,1<<0|1<<1|1<<3,'3'), /* 1/3 */
ITEM(3,35,&res_mi[4],res_it,FLAGS|Ax|Vx,1<<0|1<<1|1<<2,'4'), /* 1/4 */
ITEM(4,45,&res_mi[5],res_it,FLAGS|Ax ,0 ,'F'), /* fill in */
ITEM(5,60,&res_mi[6],res_it,FLAGS|Ax|Vx|TG,1<<8,'H'), /* hi-res */
ITEM(6,70,&res_mi[7],res_it,FLAGS|Ax|Vx|TG,0 ,'I'), /* interlace */
ITEM(7,80,&res_mi[8],res_it,FLAGS|Ax|Vx|TG,0 ,'B'), /* borderless */
ITEM(8,90,NULL ,res_it,FLAGS|Ax|Vx|TG,1<<4,'/'), /* extra halfbrite */
};
#undef MWIDTH
#define MWIDTH CHECKWIDTH+6*8+COMMWIDTH+8
struct MenuItem pri_mi[] = {
ITEM(0,05,&pri_mi[1],pri_it,FLAGS|Ax|VV,1<<1,'0'), /* normal */
ITEM(1,15,NULL ,pri_it,FLAGS|Ax|Vx,1<<0,'-'), /* low */
};
/*
* Functions submenu:
*/
#undef MWIDTH
#define MWIDTH CHECKWIDTH+104
#undef MLEFT
#define MLEFT DEFMLEFT - 8
struct MenuItem fun_mi[] = {
ITEM(0,05,&fun_mi[1],fun_it,FLAGS|VV,0x1F- 1,0), /* Z^2 - C */
ITEM(1,15,&fun_mi[2],fun_it,FLAGS|Vx,0x1F- 2,0), /* z*c*(1-z) */
ITEM(2,25,&fun_mi[3],fun_it,FLAGS|Vx,0x1F- 4,0), /* z^3+z*(c-1)-c */
ITEM(3,35,&fun_mi[4],fun_it,FLAGS|Vx,0x1F- 8,0), /* i: User */
ITEM(4,45,NULL ,fun_it,FLAGS|Vx,0x1F-16,0), /* i: Z^2 - C */
};
/*
* iplot submenu
*/
#undef MWIDTH
#define MWIDTH CHECKWIDTH + (5*8)
#undef MLEFT
#define MLEFT DEFMLEFT
struct MenuItem iplot_mi[] = {
ITEM(0,05,&iplot_mi[1], plot_it, FLAGS|VV,1<<1,0), /* None */
ITEM(1,15,NULL ,(plot_it+1),FLAGS|Vx,1<<0,0), /* Z */
};
/*
* eplot submenu
*/
struct MenuItem eplot_mi[] = {
ITEM(0,05,&eplot_mi[1],(plot_it+1),FLAGS|VV,1<<1,0), /* Depth */
ITEM(1,15,NULL ,(plot_it+1),FLAGS|Vx,1<<0,0), /* Z */
};
/*
* (C) menu
*/
#undef MLEFT
#define MLEFT 0
#undef MWIDTH
#define MWIDTH 15*8
struct MenuItem c_mi[] = {
ITEM(0,00,NULL,c_it,FLAGS,0,0), /* About Mandel... */
};
/*
* Project menu
*/
#undef MWIDTH
#define MWIDTH 9*8+COMMWIDTH
struct MenuItem project_mi[] = {
SITEM(0,00,&project_mi[1],project_it,FLAGS ,0,0,new_mi), /* new */
ITEM(1,10,&project_mi[2],project_it,FLAGS|Ax,0,'O' ), /* open... */
ITEM(2,20,&project_mi[3],project_it,FLAGS|Ax,0,'S' ), /* save */
ITEM(3,30,&project_mi[4],project_it,FLAGS ,0,0 ), /* save as... */
ITEM(4,45,&project_mi[5],project_it,FLAGS ,0,0 ), /* stop */
ITEM(5,55,NULL ,project_it,FLAGS|Ax,0,'Q' ), /* quit */
};
/*
* Options menu
*/
#undef MWIDTH
#define MWIDTH 12*8+2
struct MenuItem opt_mi[] = {
SITEM(0,00,&opt_mi[1],opts_it,FLAGS,0,0,color_mi), /* colors */
SITEM(1,10,&opt_mi[2],opts_it,FLAGS,0,0,res_mi ), /* resolution */
ITEM(2,20,&opt_mi[3],opts_it,FLAGS,0,0 ), /* parameters */
SITEM(3,30,NULL ,opts_it,FLAGS,0,0,pri_mi ), /* priority */
};
/*
* Draw Menu
*/
#undef MWIDTH
#define MWIDTH (7*8)
#undef MLEFT
#define MLEFT -MWIDTH+40
struct MenuItem draw_mi[] = {
SITEM(0,00,&draw_mi[1],draw_it,FLAGS,0,0,fun_mi ), /* func */
SITEM(1,10,&draw_mi[2],draw_it,FLAGS,0,0,iplot_mi), /* iplot */
SITEM(2,20,NULL ,draw_it,FLAGS,0,0,eplot_mi), /* eplot */
};
/*
* Batch Menu
*/
#undef MWIDTH
#define MWIDTH (8*8)
#undef MLEFT
#define MLEFT -MWIDTH+43
struct MenuItem batch_mi[] = {
ITEM(0,00,&batch_mi[1],batch_it,FLAGS, 0,0), /* file */
ITEM(1,10,&batch_mi[2],batch_it,(FLAGS)-EN,0,0), /* wait */
ITEM(2,20,&batch_mi[3],batch_it,(FLAGS)-EN,0,0), /* continue */
ITEM(3,30,NULL ,batch_it,(FLAGS)-EN,0,0), /* abort */
};
/*
* Main MenuStrip structure
*/
struct Menu MandelMenu[] = {
{ &MandelMenu[1], 2,0,21,10, MENUENABLED, " \xA9", c_mi },
{ &MandelMenu[2], 30,0,59,10, MENUENABLED, "Project", project_mi },
{ &MandelMenu[3], 100,0,59,10, MENUENABLED, "Options", opt_mi },
{ &MandelMenu[4], 170,0,37,10, MENUENABLED, "Draw", draw_mi },
{ NULL, 220,0,43,10, MENUENABLED, "Batch", batch_mi },
};