| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
#include "tixPort.h" |
| 17 |
#include "tixUnixInt.h" |
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
void |
| 35 |
TixpDrawTmpLine(x1, y1, x2, y2, tkwin) |
| 36 |
int x1; |
| 37 |
int y1; |
| 38 |
int x2; |
| 39 |
int y2; |
| 40 |
Tk_Window tkwin; |
| 41 |
{ |
| 42 |
GC gc; |
| 43 |
XGCValues values; |
| 44 |
unsigned long valuemask = GCForeground | GCSubwindowMode | GCFunction; |
| 45 |
Window winId; |
| 46 |
Tk_Window toplevel; |
| 47 |
int rootx1, rooty1; |
| 48 |
int rootx2, rooty2; |
| 49 |
|
| 50 |
for (toplevel=tkwin; !Tk_IsTopLevel(toplevel); |
| 51 |
toplevel=Tk_Parent(toplevel)) { |
| 52 |
; |
| 53 |
} |
| 54 |
|
| 55 |
Tk_GetRootCoords(toplevel, &rootx1, &rooty1); |
| 56 |
rootx2 = rootx1 + Tk_Width(toplevel) - 1; |
| 57 |
rooty2 = rooty1 + Tk_Height(toplevel) - 1; |
| 58 |
|
| 59 |
if (x1 >= rootx1 && x2 <= rootx2 && y1 >= rooty1 && y2 <= rooty2) { |
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
winId = Tk_WindowId(toplevel); |
| 67 |
x1 -= rootx1; |
| 68 |
y1 -= rooty1; |
| 69 |
x2 -= rootx1; |
| 70 |
y2 -= rooty1; |
| 71 |
} else { |
| 72 |
winId = XRootWindow(Tk_Display(tkwin), Tk_ScreenNumber(tkwin)); |
| 73 |
} |
| 74 |
|
| 75 |
values.foreground = 0xff; |
| 76 |
values.subwindow_mode = IncludeInferiors; |
| 77 |
values.function = GXxor; |
| 78 |
|
| 79 |
gc = XCreateGC(Tk_Display(tkwin), winId, valuemask, &values); |
| 80 |
XDrawLine(Tk_Display(tkwin), winId, gc, x1, y1, x2, y2); |
| 81 |
XFreeGC(Tk_Display(tkwin), gc); |
| 82 |
} |
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
void TixpDrawAnchorLines(display, drawable, gc, x, y, w, h) |
| 92 |
Display *display; |
| 93 |
Drawable drawable; |
| 94 |
GC gc; |
| 95 |
int x; |
| 96 |
int y; |
| 97 |
int w; |
| 98 |
int h; |
| 99 |
{ |
| 100 |
XPoint points[4]; |
| 101 |
|
| 102 |
if (w < 1) { |
| 103 |
w = 1; |
| 104 |
} |
| 105 |
if (h < 1) { |
| 106 |
h = 1; |
| 107 |
} |
| 108 |
|
| 109 |
XDrawRectangle(display, drawable, gc, x, y, w-1, h-1); |
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
points[0].x = x; |
| 115 |
points[0].y = y; |
| 116 |
points[1].x = x + w - 1; |
| 117 |
points[1].y = y; |
| 118 |
points[2].x = x; |
| 119 |
points[2].y = y + h - 1; |
| 120 |
points[3].x = x + w - 1; |
| 121 |
points[3].y = y + h - 1; |
| 122 |
|
| 123 |
XDrawPoints(display, drawable, gc, points, 4, CoordModeOrigin); |
| 124 |
} |
| 125 |
|
| 126 |
|