|
|
1.1 ! root 1: .ds ZZ DEVELOPMENT PACKAGE ! 2: .TH NEWRECT 3R "630 MTG" ! 3: .XE "newrect()" ! 4: .SH NAME ! 5: newrect \- get swept or default rectangle ! 6: .SH SYNOPSIS ! 7: .B #include <dmd.h> ! 8: .sp ! 9: .B Rectangle newrect (btn, rect) ! 10: .br ! 11: .B int btn; ! 12: .br ! 13: .B Rectangle rect; ! 14: .SH DESCRIPTION ! 15: The ! 16: .I newrect ! 17: function ! 18: prompts the user with a sweep cursor and an outline of the ! 19: specified Rectangle \f2rect\f1, which then moves with the mouse. ! 20: The function then busy waits for a ! 21: Rectangle to be swept out with the specified ! 22: .I btn ! 23: button, ! 24: or for the outline to be chosen by a click of ! 25: .I btn. ! 26: The function then returns the screen coordinates of the created Rectangle. ! 27: If any button other than ! 28: .I btn ! 29: is depressed at any stage of the operation, ! 30: .I newrect ! 31: returns a null size Rectangle (i.e., the lower right corner is equal ! 32: to the upper left origin). If \f2rect\f1 is a null size ! 33: Rectangle, no outline will be presented; only a sweep cursor ! 34: will appear. ! 35: ! 36: .SH EXAMPLE ! 37: The following routine will permit the user to sweep out a Rectangle. ! 38: As long as the Rectangle swept out does not have any points in common with ! 39: .IR Drect , ! 40: the user will be prompted to sweep out another Rectangle. ! 41: Once the swept out Rectangle has points within ! 42: .IR Drect , ! 43: the Rectangle will be clipped to \fIDrect\fR and returned. ! 44: .PP ! 45: .RS 3 ! 46: .ft CM ! 47: .nf ! 48: #include <dmd.h> ! 49: ! 50: Rectangle ! 51: sweep_rect( ) ! 52: { ! 53: Rectangle r; ! 54: ! 55: do ! 56: r = newrect(2, Drect); ! 57: while (!rectclip(&r, Drect)); ! 58: return r; ! 59: } ! 60: .fi ! 61: .ft R ! 62: .RE ! 63: ! 64: .SH SEE ALSO ! 65: box(3R), rectclip(3R). ! 66: ! 67: .SH DIAGNOSTICS ! 68: A mouse click is detected by the amount of mouse movement, not by the ! 69: time between a button depression and release. The function \fInewrect\fR ! 70: will see as a click any sweeping action whose result is a Rectangle less than 20 by 20 ! 71: pixels.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.