home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
listings
/
v_02_09
/
2n09066a
< prev
next >
Wrap
Text File
|
1991-08-13
|
990b
|
42 lines
-----------------------Z-O-O-M-.-L-----------------------------------
// ZOOM.L - Zooming on Graphics.
main {
window ();
w.menu = new menu
<< new menuitem ("&Unzoom!")
<< new menuitem ("Zoom &In!")
<< new menuitem ("Zoom &Out!");
unzoom ();
}
paint {
w.brush = null;
w.line (-40, -40, 40, 40);
w.line (-40, 40, 40, -40);
w.circle (0, 0, 5);
w.circle (0, 0, 10);
w.circle (0, 0, 20);
w.line (-30, 30, 30, 30);
w.line (-25, 20, 25, 20);
w.line (-15, -20, 15, -20);
w.line (-5, -30, 5, -30);
}
set_window (x1, y1, x2, y2) {
w.data_window (x1, y1, x2, y2);
w.refresh;
}
unzoom {set_window (-50, 50, 50, -50);}
zoom_in {set_window (-20, 20, 20, -20);}
zoom_out {set_window (-100, 100, 100, -100);}
resized (int width, int height) {
int d = (width - height) / 2;
w.top_margin = w.bottom_margin = d > 0 ? 0 : - d;
w.left_margin = w.right_margin = d > 0 ? d : 0;
}