1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
|
--- iohandler.cc.orig Wed Jan 15 16:44:05 1997
+++ iohandler.cc Tue Nov 2 17:06:47 1999
@@ -37,13 +37,13 @@
void IOHandler::link(int fd, int mask)
{
fd_ = fd;
- Tk_CreateFileHandler((ClientData) fd, mask, callback, (ClientData)this);
+ Tk_CreateFileHandler(fd, mask, callback, (ClientData)this);
}
void IOHandler::unlink()
{
if (fd_ >= 0) {
- Tk_DeleteFileHandler((ClientData) fd_);
+ Tk_DeleteFileHandler(fd_);
fd_ = -1;
}
}
--- main.cc.orig Wed Jan 15 16:44:05 1997
+++ main.cc Tue Nov 2 17:07:41 1999
@@ -28,10 +28,8 @@
#endif
#include <X11/Xlib.h>
-#ifdef _AIX
#include <stdlib.h>
#include <unistd.h>
-#endif
/* Get FD_SETSIZE */
#if defined(linux)
@@ -79,7 +77,7 @@
else {
Tk_Window tk = t.tkmain();
Tk_Uid uid = Tk_GetUid((char*)argv[1]);
- XFontStruct* p = Tk_GetFontStruct(t.interp(), tk, uid);
+ Tk_Font p = Tk_GetFont(t.interp(), tk, uid);
t.result(p != 0 ? "1" : "0");
}
return (TCL_OK);
--- member.cc.orig Wed Jan 15 16:44:05 1997
+++ member.cc Tue Nov 2 17:08:40 1999
@@ -31,6 +31,8 @@
#include "Tcl.h"
#include "member.h"
+#include <stdlib.h>
+
#ifndef HAVE_SNPRINTF
extern "C" {
int snprintf(char* buf, int s, const char* fmt, ...);
--- monitor.cc.orig Wed Jan 15 16:44:05 1997
+++ monitor.cc Tue Nov 2 17:09:04 1999
@@ -922,7 +922,7 @@
sprintf(val, "%u ms", j);
break;
}
- Tcl_SetVar2(interp, "median", s->name(), val, TCL_GLOBAL_ONLY);
+ Tcl_SetVar2(interp, "median", (char*)s->name(), val, TCL_GLOBAL_ONLY);
}
}
--- tkStripchart.c.orig Wed Jan 15 16:44:06 1997
+++ tkStripchart.c Tue Nov 2 17:18:48 1999
@@ -30,10 +30,6 @@
#include <math.h>
#include "tk.h"
-#if TK_MINOR_VERSION<1
-#define Tk_Cursor Cursor
-#endif
-
#define BLACK "Black"
#define WHITE "White"
#define GRAY "#b0b0b0"
@@ -145,7 +141,7 @@
int scrollrequired;
int guarantee_draw;
int grow_up;
- XFontStruct *fontPtr; /* Information about text font, or NULL. */
+ Tk_Font font; /* TK font */
XColor *textColorPtr; /* Color for drawing text. */
GC textGC; /* GC for drawing text. */
XColor *tickColorPtr; /* Color for drawing ticks. */
@@ -254,7 +250,7 @@
{TK_CONFIG_SYNONYM, "-fg", "stripcolor", 0,
0, 0, 0},
{TK_CONFIG_FONT, "-font", "font", "Font",
- DEF_STRIPCHART_FONT, Tk_Offset(Stripchart, fontPtr),
+ DEF_STRIPCHART_FONT, Tk_Offset(Stripchart, font),
0},
{TK_CONFIG_BOOLEAN, "-guaranteedrawing", "guaranteedrawing",
"Guaranteedrawing", DEF_GUARANTEE_DRAW,
@@ -567,8 +563,8 @@
if (StripchartPtr->value != NULL)
free(StripchartPtr->value);
- if (StripchartPtr->fontPtr != NULL)
- Tk_FreeFontStruct(StripchartPtr->fontPtr);
+ if (StripchartPtr->font != NULL)
+ Tk_FreeFont(StripchartPtr->font);
if (StripchartPtr->textColorPtr != NULL)
Tk_FreeColor(StripchartPtr->textColorPtr);
@@ -628,7 +624,7 @@
Tk_SetBackgroundFromBorder(StripchartPtr->tkwin, StripchartPtr->border);
- gcValues.font = StripchartPtr->fontPtr->fid;
+ gcValues.font = Tk_FontId(StripchartPtr->font);
gcValues.foreground = StripchartPtr->textColorPtr->pixel;
newGC = Tk_GetGC(StripchartPtr->tkwin, GCForeground|GCFont, &gcValues);
if (StripchartPtr->textGC != None && StripchartPtr->tkwin) {
@@ -689,9 +685,11 @@
{
int tt = hasatitle(StripchartPtr);
int bd = StripchartPtr->borderWidth;
- int lineHeight = StripchartPtr->fontPtr->ascent +
- StripchartPtr->fontPtr->descent;
+ int lineHeight;
+ Tk_FontMetrics metrics;
+ Tk_GetFontMetrics(StripchartPtr->font, &metrics);
+ lineHeight = metrics.ascent + metrics.descent;
Tk_GeometryRequest(StripchartPtr->tkwin,
2 * (bd + PADDING) + StripchartPtr->num_strips *
StripchartPtr->strip_width,
@@ -723,11 +721,14 @@
/*
* Variable declarations used in the title drawing routines
*/
- XFontStruct *fp = StripchartPtr->fontPtr;
XCharStruct bbox;
int x, dummy;
- int lineHeight = StripchartPtr->fontPtr->ascent +
- StripchartPtr->fontPtr->descent;
+ Tk_Font tkf = StripchartPtr->font;
+ int lineHeight;
+ Tk_FontMetrics fm;
+
+ Tk_GetFontMetrics(tkf, &fm);
+ lineHeight = fm.ascent + fm.descent;
StripchartPtr->displaybits &= ~REDRAW_PENDING;
if ((StripchartPtr->tkwin == NULL) || !Tk_IsMapped(tkwin))
@@ -744,19 +745,20 @@
* space. Otherwise left justified and clipped on the right.
*/
if (tt && StripchartPtr->displaybits & DISPLAY_TITLE) {
- XTextExtents(fp, StripchartPtr->title,
- strlen(StripchartPtr->title),
- &dummy, &dummy, &dummy, &bbox);
- if (bbox.lbearing + bbox.rbearing < Tk_Width(tkwin) - 2 * bd)
- x = (Tk_Width(tkwin) - bbox.lbearing - bbox.rbearing)/2;
+ int width = Tk_TextWidth(tkf, StripchartPtr->title,
+ strlen(StripchartPtr->title));
+ if (width < Tk_Width(tkwin) - 2 * bd)
+ x = (Tk_Width(tkwin) - width)/2;
else
- x = bd + PADDING;
-
+ x = bd + PADDING;
XClearArea(Tk_Display(tkwin), Tk_WindowId(tkwin), bd, bd,
- Tk_Width(tkwin) - 2 * bd, lineHeight + PADDING, False);
+ Tk_Width(tkwin) - 2*bd,
+ lineHeight + PADDING, False);
+ /* XXX In the absence of max_bounds, approximate... */
XDrawString(Tk_Display(tkwin), Tk_WindowId(tkwin),
- StripchartPtr->textGC, x, fp->max_bounds.ascent + bd,
- StripchartPtr->title, strlen(StripchartPtr->title));
+ StripchartPtr->textGC, x, fm.ascent + bd,
+ StripchartPtr->title,
+ strlen(StripchartPtr->title));
}
/*
* draw the strips
@@ -827,7 +829,8 @@
Tk_CancelIdleCall(DisplayStripchart,
(ClientData)StripchartPtr);
}
- Tk_EventuallyFree((ClientData)StripchartPtr, DestroyStripchart);
+ Tk_EventuallyFree((ClientData)StripchartPtr,
+ (Tcl_FreeProc*)DestroyStripchart);
} else if (eventPtr->type == ConfigureNotify) {
int n = eventPtr->xconfigure.width;
n -= 2 * (StripchartPtr->borderWidth + PADDING);
@@ -1056,14 +1059,20 @@
DrawStripi(Stripchart* SPtr, int i)
{
Tk_Window tkwin = SPtr->tkwin;
- int lineHeight = SPtr->fontPtr->ascent + SPtr->fontPtr->descent;
+ int lineHeight;
int x = SPtr->borderWidth + PADDING + (i - 1) * SPtr->strip_width;
- int y = SPtr->borderWidth + PADDING +
- hasatitle(SPtr) * (lineHeight + PADDING);
+ int y;
int w = SPtr->strip_width;
int h;
double maxv = SPtr->max_value;
double minv = SPtr->min_value;
+ Tk_FontMetrics metrics;
+
+ Tk_GetFontMetrics(SPtr->font, &metrics);
+ lineHeight = metrics.ascent + metrics.descent;
+
+ y = SPtr->borderWidth + PADDING +
+ hasatitle(SPtr) * (lineHeight + PADDING);
if (i < 1 || i > SPtr->num_strips)
return;
@@ -1135,14 +1144,20 @@
ScrollStrips(Stripchart* SPtr)
{
Tk_Window tkwin = SPtr->tkwin;
- int lineHeight = SPtr->fontPtr->ascent + SPtr->fontPtr->descent;
+ int lineHeight;
int src_x = SPtr->borderWidth + PADDING + SPtr->strip_width;
- int src_y = SPtr->borderWidth + PADDING +
- hasatitle(SPtr) * (lineHeight + PADDING);
+ int src_y;
int dest_x = src_x - SPtr->strip_width;
int dest_y = src_y;
int w = (SPtr->num_strips - 1) * SPtr->strip_width;
int h = SPtr->max_height;
+ Tk_FontMetrics metrics;
+
+ Tk_GetFontMetrics(SPtr->font, &metrics);
+ lineHeight = metrics.ascent = metrics.descent;
+
+ src_y = SPtr->borderWidth + PADDING +
+ hasatitle(SPtr) * (lineHeight + PADDING);
XCopyArea(Tk_Display(tkwin), Tk_WindowId(tkwin), Tk_WindowId(tkwin),
Tk_GetGC(tkwin, 0, NULL), src_x, src_y, w, h, dest_x, dest_y);
--- ui-display.tcl.orig Wed Jan 15 16:44:06 1997
+++ ui-display.tcl Tue Nov 2 17:19:30 1999
@@ -307,7 +307,7 @@
bind $b <Leave> "$b conf -bg [option get . background Rtpmon]"
bind $b <Button-1> "CreateInfoWindow $s"
- menu $b.menu -transient yes
+ menu $b.menu
$b.menu add command -label "Site Info" -font [resource smallfont] \
-command "CreateInfoWindow $s"
$b.menu add command -label "Ignore" -font [resource smallfont] \
|