|
|
1.1 root 1: #ifndef lint
2: static char *rcsid_StoreGridBox_c = "$Header: GridBox.c,v 1.3 87/09/11 08:21:55 toddb Exp $";
3: #endif lint
4:
5: #include <X11/copyright.h>
6:
7: /*
8: * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
9: *
10: * All Rights Reserved
11: *
12: * Permission to use, copy, modify, and distribute this software and its
13: * documentation for any purpose and without fee is hereby granted,
14: * provided that the above copyright notice appear in all copies and that
15: * both that copyright notice and this permission notice appear in
16: * supporting documentation, and that the name of Digital Equipment
17: * Corporation not be used in advertising or publicity pertaining to
18: * distribution of the software without specific, written prior permission.
19: *
20: *
21: * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
22: * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
23: * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
24: * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
25: * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
26: * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
27: * SOFTWARE.
28: */
29:
30:
31:
32: /*
33: * MODIFICATION HISTORY
34: *
35: * 000 -- M. Gancarz, DEC Ultrix Engineering Group
36: * 001 -- Loretta Guarino Reid, DEC Ultrix Engineering Group,
37: Western Software Lab. Converted to X11.
38: */
39:
40: #ifndef lint
41: static char *sccsid = "@(#)StoreGridBox.c 3.8 1/24/86";
42: #endif
43: /*
44: * StoreGridBox - This subroutine is used by the X Window Manager (xwm)
45: * to store the vertices for the movement resize grid and box in a
46: * vertex list.
47: */
48:
49: #include "uwm.h"
50:
51: /*
52: * Store the vertices for the movement resize grid and box in a vertex list.
53: */
54: int StoreGridBox(box, ulx, uly, lrx, lry)
55: register XSegment box[];
56: int ulx; /* Upper left X coordinate. */
57: int uly; /* Upper left Y coordinate. */
58: int lrx; /* Lower right X coordinate. */
59: int lry; /* Lower right Y coordinate. */
60: {
61: register int xthird, ythird;
62: int x1third, y1third;
63: int x2third, y2third;
64:
65: /*
66: * Xor in.
67: */
68: box[0].x1 = ulx; box[0].y1 = uly;
69: box[0].x2 = lrx; box[0].y2 = uly;
70:
71: box[1].x1 = lrx; box[1].y1 = uly;
72: box[1].x2 = lrx; box[1].y2 = lry;
73:
74: box[2].x1 = lrx; box[2].y1 = lry;
75: box[2].x2 = ulx; box[2].y2 = lry;
76:
77: box[3].x1 = ulx; box[3].y1 = lry;
78: box[3].x2 = ulx; box[3].y2 = uly;
79:
80:
81: /*
82: * These are the X and Y calculations for the parts of the grid that
83: * are dependent on the division by 3 calculations.
84: */
85:
86: /*
87: * Y dimension third.
88: */
89: ythird = (lry - uly) / 3;
90: y1third = uly + ythird;
91: y2third = y1third + ythird;
92:
93: /*
94: * X dimension third.
95: */
96: xthird = (lrx - ulx) / 3;
97: x1third = ulx + xthird;
98: x2third = x1third + xthird;
99:
100: box[4].x1 = x1third; box[4].y1 = lry;
101: box[4].x2 = x1third; box[4].y2 = uly;
102:
103: box[5].x1 = x2third; box[5].y1 = lry;
104: box[5].x2 = x2third; box[5].y2 = uly;
105:
106: box[6].x1 = ulx; box[6].y1 = y1third;
107: box[6].x2 = lrx; box[6].y2 = y1third;
108:
109: box[7].x1 = ulx; box[7].y1 = y2third;
110: box[7].x2 = lrx; box[7].y2 = y2third;
111:
112: /*
113: * Do not erase if we're freezing the screen.
114: */
115: if (Freeze)
116: return(8);
117:
118: /*
119: * From here on we're retracing the segments to clear the
120: * grid using GXxor.
121: */
122: box[8].x1 = ulx; box[8].y1 = uly;
123: box[8].x2 = lrx; box[8].y2 = uly;
124:
125: box[9].x1 = lrx; box[9].y1 = uly;
126: box[9].x2 = lrx; box[9].y2 = lry;
127:
128: box[10].x1 = lrx; box[10].y1 = lry;
129: box[10].x2 = ulx; box[10].y2 = lry;
130:
131: box[11].x1 = ulx; box[11].y1 = lry;
132: box[11].x2 = ulx; box[11].y2 = uly;
133:
134: box[12].x1 = x1third; box[12].y1 = lry;
135: box[12].x2 = x1third; box[12].y2 = uly;
136:
137: box[13].x1 = x2third; box[13].y1 = lry;
138: box[13].x2 = x2third; box[13].y2 = uly;
139:
140: box[14].x1 = ulx; box[14].y1 = y1third;
141: box[14].x2 = lrx; box[14].y2 = y1third;
142:
143: box[15].x1 = ulx; box[15].y1 = y2third;
144: box[15].x2 = lrx; box[15].y2 = y2third;
145:
146:
147: /*
148: * Total number of segments is 16.
149: */
150: return(16);
151: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.