summaryrefslogtreecommitdiff
path: root/NET/worlds/console/Window.java
blob: beb499450ad4254f44222c9987978281c11716eb (plain) (blame)
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
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
/*     */ package NET.worlds.console;
/*     */ 
/*     */ import NET.worlds.scape.Camera;
/*     */ import java.awt.Component;
/*     */ import java.awt.Dimension;
/*     */ import java.awt.Point;
/*     */ import java.awt.TextArea;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class Window
/*     */ {
/*     */   private static Window activeWindow;
/*     */   private int hWndGamma;
/*     */   private int hWndFrame;
/*     */   private static int hInstGamma;
/*     */   private static int hWndFrameStatic;
/*     */   public static final int NORMAL = 0;
/*     */   public static final int MINIMIZED = 1;
/*     */   public static final int MAXIMIZED = 2;
/*     */   private int windowInstancePtr;
/*     */   
/*     */   public Window(String frameTitle, Point loc, Dimension dim, Camera cam, boolean interceptEvents)
/*     */     throws WindowNotFoundException
/*     */   {
/*  97 */     nativeInit();
/*     */     
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/* 111 */     if (hWndFrameStatic != 0) {
/* 112 */       this.hWndFrame = hWndFrameStatic;
/*     */     } else {
/* 114 */       this.hWndFrame = findWindow(frameTitle);
/*     */     }
/* 116 */     if (this.hWndFrame != 0)
/* 117 */       this.hWndGamma = findOrMakeChildWindow(this.hWndFrame, loc.x, loc.y, 
/* 118 */         dim.width, dim.height);
/* 119 */     if (this.hWndGamma == 0) {
/* 120 */       throw new WindowNotFoundException("No such window");
/*     */     }
/*     */     
/* 123 */     if (hWndFrameStatic == 0) {
/* 124 */       hWndFrameStatic = this.hWndFrame;
/*     */     }
/* 126 */     hInstGamma = install(interceptEvents);
/* 127 */     maybeResize(dim.width, dim.height);
/* 128 */     if (interceptEvents) {
/* 129 */       activeWindow = this;
/*     */     }
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   public void hookChatLine(Component chatLine)
/*     */     throws WindowNotFoundException
/*     */   {
/* 140 */     assert (activeWindow == this);
/* 141 */     Dimension dim = chatLine.getSize();
/*     */     try {
/* 143 */       Point loc = chatLine.getLocationOnScreen();
/* 144 */       int hwndChatLine = findChildWindow(hWndFrameStatic, loc.x, loc.y, 
/* 145 */         dim.width, dim.height);
/* 146 */       if (hwndChatLine != 0) {
/* 147 */         setChatLine(hwndChatLine);
/* 148 */         return;
/*     */       }
/*     */     }
/*     */     catch (Exception localException) {
/* 152 */       throw new WindowNotFoundException();
/*     */     }
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */   private static native void setChatLine(int paramInt);
/*     */   
/*     */ 
/*     */ 
/*     */   public static native int getVoiceChatWParam();
/*     */   
/*     */ 
/*     */ 
/*     */   public static native int getVoiceChatLParam();
/*     */   
/*     */ 
/*     */ 
/*     */   public static native void resetVoiceChatMsg();
/*     */   
/*     */ 
/*     */ 
/*     */   public static native void doMicrosoftVMHacks();
/*     */   
/*     */ 
/*     */ 
/*     */   public static native boolean usingMicrosoftVMHacks();
/*     */   
/*     */ 
/*     */ 
/*     */   public static native boolean getActivated();
/*     */   
/*     */ 
/*     */   public static native boolean isActivated();
/*     */   
/*     */ 
/*     */   public static native int getGammaProcessID();
/*     */   
/*     */ 
/*     */   public native void dispose();
/*     */   
/*     */ 
/*     */   public static Window getMainWindow()
/*     */   {
/* 196 */     return activeWindow;
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */   public native int getHwnd();
/*     */   
/*     */ 
/*     */ 
/*     */   public void hideNativeWindow()
/*     */   {
/* 207 */     if (this.hWndGamma != 0)
/* 208 */       nativeHideChildWindow(this.hWndGamma);
/*     */   }
/*     */   
/*     */   public void showNativeWindow() {
/* 212 */     if (this.hWndGamma != 0)
/* 213 */       nativeShowChildWindow(this.hWndGamma);
/*     */   }
/*     */   
/*     */   native void nativeHideChildWindow(int paramInt);
/*     */   
/*     */   native void nativeShowChildWindow(int paramInt);
/*     */   
/*     */   public static int getHWnd() {
/* 221 */     return activeWindow == null ? 0 : activeWindow.hWndGamma;
/*     */   }
/*     */   
/*     */   public static int getHInst() {
/* 225 */     return hInstGamma;
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */   public native void maybeResize(int paramInt1, int paramInt2);
/*     */   
/*     */ 
/*     */   public native void setDeltaMode(boolean paramBoolean);
/*     */   
/*     */ 
/*     */   public static native int getAndResetUserActionCount();
/*     */   
/*     */ 
/*     */   public native boolean getDeltaMode();
/*     */   
/*     */ 
/*     */   public static native void makeJavaReleaseCapture();
/*     */   
/*     */ 
/*     */   public native void reShape(int paramInt1, int paramInt2, int paramInt3, int paramInt4);
/*     */   
/*     */ 
/*     */   public void setBounds(int x, int y, int width, int height)
/*     */   {
/* 250 */     reShape(x, y, width, height);
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */   public native int fullWidth();
/*     */   
/*     */ 
/*     */ 
/*     */   public native int fullHeight();
/*     */   
/*     */ 
/*     */ 
/*     */   public static native int findWindow(String paramString);
/*     */   
/*     */ 
/*     */ 
/*     */   public static native int getFrameWindow();
/*     */   
/*     */ 
/*     */ 
/*     */   public static native void hideCursor();
/*     */   
/*     */ 
/*     */ 
/*     */   public static native int[] getHiddenCursorDelta();
/*     */   
/*     */ 
/*     */ 
/*     */   public static native void setCursor(int paramInt);
/*     */   
/*     */ 
/*     */ 
/*     */   public static native int getWindowState(int paramInt);
/*     */   
/*     */ 
/*     */   public static native void setWindowState(int paramInt1, int paramInt2);
/*     */   
/*     */ 
/*     */   public static native void setForegroundWindow(int paramInt);
/*     */   
/*     */ 
/*     */   public static native void setVideoMode(int paramInt1, int paramInt2, int paramInt3);
/*     */   
/*     */ 
/*     */   public static native void nativeInit();
/*     */   
/*     */ 
/*     */   private native int install(boolean paramBoolean);
/*     */   
/*     */ 
/*     */   static synchronized int findChildWindow(int hWndParent, int x, int y, int w, int h)
/*     */   {
/* 303 */     return nativeFindChildWindow(hWndParent, x, y, w, h);
/*     */   }
/*     */   
/*     */   static synchronized int findOrMakeChildWindow(int hWndParent, int x, int y, int w, int h)
/*     */   {
/* 308 */     return nativeFindOrMakeChildWindow(hWndParent, x, y, w, h);
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */   public static boolean isLastLineVisible(int hwnd, TextArea ta)
/*     */   {
/* 316 */     Dimension s = ta.getSize();
/*     */     
/* 318 */     return nativeIsLastLineVisible(hwnd, s.width, s.height) != 0;
/*     */   }
/*     */   
/*     */ 
/*     */   private static native int nativeIsLastLineVisible(int paramInt1, int paramInt2, int paramInt3);
/*     */   
/*     */ 
/*     */   private static native int nativeFindChildWindow(int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5);
/*     */   
/*     */ 
/*     */   private static native int nativeFindOrMakeChildWindow(int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5);
/*     */   
/*     */   public static int playVideoClip(Component c, String name)
/*     */   {
/* 332 */     Point p = c.getLocationOnScreen();
/* 333 */     Dimension s = c.getSize();
/* 334 */     return playVideoClip(name, findChildWindow(
/* 335 */       activeWindow.hWndFrame, p.x, p.y, s.width, s.height));
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */   public static native boolean isVideoPlaying(int paramInt);
/*     */   
/*     */ 
/*     */ 
/*     */   private static native int playVideoClip(String paramString, int paramInt);
/*     */   
/*     */ 
/*     */ 
/*     */   public static native void hookWinAPIs(String paramString);
/*     */   
/*     */ 
/*     */   public static native int getWindowWidth(int paramInt);
/*     */   
/*     */ 
/*     */   public static native int getWindowHeight(int paramInt);
/*     */   
/*     */ 
/*     */   public static native void allowFGJavaPalette(boolean paramBoolean);
/*     */   
/*     */ 
/*     */   public static int getFrameHandle()
/*     */   {
/* 362 */     return hWndFrameStatic;
/*     */   }
/*     */   
/*     */   public static native int getSystemMetrics(int paramInt);
/*     */ }


/* Location:              C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\console\Window.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */