#include #include #include #include #include #include #include //VIEWPORT dimensions #define XLPOS 0 #define YLPOS 20 #define XRPOS maxx-50 #define YRPOS maxy-50 //COLOR Window dimensions #define COLOR_XLPOS 50 #define COLOR_YLPOS maxy-40 #define COLOR_XRPOS 400 #define COLOR_YRPOS maxy #define COLOR_XSIZE 50 #define COLOR_YSIZE 20 //FUNCTION Window dimensions #define FUNC_XLPOS maxx-40 #define FUNC_YLPOS 50 #define FUNC_XRPOS maxx #define FUNC_YRPOS 300 #define FUNC_XSIZE 20 #define FUNC_YSIZE 50 #define DEFAULT_FUNCTION POINT #define ERASE_SIZE 5 int sqr(int n) { return n*n; } enum bool{FALSE,TRUE}; enum Button{NONE,LEFT,RIGHT,BOTH}; enum Function{POINT,PENCIL,LINE,POLYLINE,CIRCLE,RECTANGLE,FILL,ERASE,SAVE,OPEN}; enum Area{VIEWPORT,COLOR,FUNCTION,NON}; char* functions[]={"Point","Pen","Line","Poly","Circle","Rect","Fill","Erase","Save","Open"}; int selectedColor=WHITE,borderColor=WHITE; int maxx,maxy; union REGS p,o; initmouse() { p.x.ax=0; int86(0x33,&p,&o); return(o.x.ax); } void showmouseptr() { p.x.ax=1; int86(0x33,&p,&o); } void restrictmouseptr(int x1,int y1,int x2,int y2) { p.x.ax=7; p.x.ax=x1; p.x.ax=x2; int86(0x33,&p,&o); p.x.ax=8; p.x.ax=y1; p.x.ax=y2; int86(0x33,&p,&o); } void getmousepos(int* button,int* x,int* y) { p.x.ax=3; int86(0x33,&p,&o); *button=o.x.bx; *x=o.x.cx; *y=o.x.dx; } void hidemouseptr() { p.x.ax=2; int86(0x33,&p,&o); } Area getClickedArea(int x,int y) { if(x>XLPOS && xYLPOS) return VIEWPORT; else if(x>=FUNC_XLPOS && x=FUNC_YLPOS && y<=FUNC_YRPOS) return FUNCTION; else if(x>=COLOR_XLPOS && xCOLOR_YLPOS && y