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
|
/* */ package NET.worlds.scape;
/* */
/* */ import NET.worlds.console.Console;
/* */ import NET.worlds.console.DialogDisabled;
/* */ import NET.worlds.console.ExposedPanel;
/* */ import NET.worlds.console.GammaFrame;
/* */ import NET.worlds.console.Main;
/* */ import NET.worlds.console.MainCallback;
/* */ import NET.worlds.console.Window;
/* */ import java.awt.Color;
/* */ import java.awt.Event;
/* */ import java.awt.FlowLayout;
/* */ import java.awt.Rectangle;
/* */ import java.util.Enumeration;
/* */ import java.util.Vector;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ class ToolBar
/* */ extends ExposedPanel
/* */ implements MainCallback, DialogDisabled
/* */ {
/* */ private static final long serialVersionUID = 1L;
/* 31 */ private Vector<WidgetButton> buttons = new Vector();
/* */ private WidgetButton active;
/* */ private boolean activeDown;
/* */ private WidgetButton entered;
/* */ private WObject curWObj;
/* 36 */ private boolean haveDelta = false;
/* */ private WObjectHighlighter highlight;
/* */ private boolean initialDrag;
/* */ private boolean isDialogDisabled;
/* */ private boolean testConstrained;
/* */
/* */ public ToolBar() {
/* 43 */ setLayout(new FlowLayout(0, 1, 1));
/* 44 */ addButton(new HTransWidget(this));
/* 45 */ addButton(new VTransWidget(this));
/* 46 */ addButton(new PitchWidget(this));
/* 47 */ addButton(new RollWidget(this));
/* 48 */ addButton(new YawWidget(this));
/* 49 */ addButton(new ScaleWidget(this));
/* 50 */ addButton(new CutWidget(this));
/* 51 */ addButton(new CopyWidget(this));
/* 52 */ addButton(new PasteWidget(this));
/* 53 */ addButton(new SaveWidget(this));
/* 54 */ addButton(new UndoWidget(this));
/* 55 */ setBackground(Color.lightGray);
/* */ }
/* */
/* */ public void done()
/* */ {
/* 60 */ if (this.highlight != null) {
/* 61 */ this.highlight.stop();
/* */ }
/* */ }
/* */
/* */ private void addButton(WidgetButton button) {
/* 66 */ add(button);
/* 67 */ this.buttons.addElement(button);
/* */ }
/* */
/* */ public void setCurrentObject(Object obj)
/* */ {
/* 72 */ this.curWObj = ((obj instanceof WObject) ? (WObject)obj : null);
/* 73 */ if (this.highlight != null) {
/* 74 */ this.highlight.stop();
/* 75 */ this.highlight = null;
/* */ }
/* 77 */ if (this.curWObj != null)
/* 78 */ this.highlight = new WObjectHighlighter(this.curWObj);
/* 79 */ Enumeration<WidgetButton> e = this.buttons.elements();
/* 80 */ clearPrompt();
/* 81 */ while (e.hasMoreElements()) {
/* 82 */ ((WidgetButton)e.nextElement()).repaint();
/* */ }
/* */ }
/* */
/* */ public WObject getCurrentWObject() {
/* 87 */ return this.curWObj;
/* */ }
/* */
/* */ public void dialogDisable(boolean disable)
/* */ {
/* 92 */ this.isDialogDisabled = disable;
/* */ }
/* */
/* */ @Deprecated
/* */ public boolean handleEvent(Event event)
/* */ {
/* 98 */ if (this.isDialogDisabled)
/* 99 */ return false;
/* 100 */ return super.handleEvent(event);
/* */ }
/* */
/* */ @Deprecated
/* */ public synchronized boolean mouseDown(Event event, int x, int y)
/* */ {
/* */ WidgetButton button;
/* 107 */ if (((event.target instanceof WidgetButton)) &&
/* 108 */ ((event.modifiers & 0x4) == 0) && (this.active == null) &&
/* 109 */ ((button = (WidgetButton)event.target).available())) {
/* 110 */ this.active = button;
/* 111 */ this.active.draw(true);
/* 112 */ if (this.active.usesDrag()) {
/* 113 */ this.initialDrag = true;
/* 114 */ this.highlight.stop();
/* 115 */ Window.hideCursor();
/* 116 */ Main.register(this);
/* */
/* */
/* 119 */ this.haveDelta = true;
/* */ }
/* */ else {
/* 122 */ this.activeDown = true;
/* */ } }
/* 124 */ return true;
/* */ }
/* */
/* */ private boolean constrainToX;
/* */ private boolean constrainToY;
/* */ private int cumx;
/* */ private int cumy;
/* 131 */ private float motionDivisor = 1.0F;
/* */ private static final int constrainThresh = 5;
/* */
/* */ @Deprecated
/* */ public synchronized boolean mouseDrag(Event event, int x, int y)
/* */ {
/* 137 */ if (this.active != null) {
/* 138 */ if (this.active.usesDrag())
/* */ {
/* 140 */ if (((event.modifiers & 0x1) != 0) &&
/* 141 */ (!this.constrainToX) && (!this.constrainToY)) {
/* 142 */ this.testConstrained = true;
/* 143 */ this.cumx = (this.cumy = 0);
/* */ }
/* */
/* 146 */ this.motionDivisor = ((event.modifiers & 0x2) != 0 ?
/* 147 */ 10.0F : 1.0F);
/* 148 */ this.haveDelta = true;
/* */ }
/* */ else {
/* 151 */ boolean inside = this.active.getBounds().contains(x, y);
/* 152 */ if (inside != this.activeDown)
/* 153 */ this.active.draw(this.activeDown = inside);
/* */ }
/* */ }
/* 156 */ return true;
/* */ }
/* */
/* */ public synchronized void mainCallback()
/* */ {
/* 161 */ if ((this.haveDelta) && (this.active != null)) {
/* 162 */ int[] pos = Window.getHiddenCursorDelta();
/* 163 */ if (this.testConstrained) {
/* 164 */ this.cumx += pos[0];
/* 165 */ this.cumy += pos[1];
/* 166 */ int acumx = Math.abs(this.cumx);
/* 167 */ int acumy = Math.abs(this.cumy);
/* 168 */ if (acumx > acumy + 5) {
/* 169 */ this.constrainToX = true;
/* 170 */ } else if (acumy > acumx + 5) {
/* 171 */ this.constrainToY = true;
/* */ } else
/* 173 */ return;
/* 174 */ this.testConstrained = false;
/* */ }
/* 176 */ if (this.constrainToX) {
/* 177 */ pos[0] += this.cumx;
/* 178 */ this.cumx = 0;
/* 179 */ pos[1] = 0;
/* */ }
/* 181 */ else if (this.constrainToY) {
/* 182 */ pos[1] += this.cumy;
/* 183 */ this.cumy = 0;
/* 184 */ pos[0] = 0;
/* */ }
/* 186 */ setPrompt(this.active.drag(this.initialDrag, pos[0] / this.motionDivisor,
/* 187 */ -pos[1] / this.motionDivisor));
/* 188 */ this.initialDrag = false;
/* 189 */ this.haveDelta = false;
/* */ }
/* */ }
/* */
/* */ @Deprecated
/* */ public synchronized boolean mouseUp(Event event, int x, int y)
/* */ {
/* 196 */ if (this.active != null) {
/* 197 */ this.active.draw(false);
/* 198 */ boolean needUpdate = true;
/* 199 */ if (this.active.usesDrag()) {
/* 200 */ this.highlight.start();
/* 201 */ Main.unregister(this);
/* 202 */ } else if (this.activeDown) {
/* 203 */ this.active.perform();
/* 204 */ this.activeDown = false;
/* */ }
/* */ else {
/* 207 */ needUpdate = false; }
/* 208 */ this.active = null;
/* 209 */ if (needUpdate)
/* 210 */ Console.getFrame().getEditTile().update();
/* */ }
/* 212 */ return true;
/* */ }
/* */
/* */ @Deprecated
/* */ public boolean mouseEnter(Event event, int x, int y)
/* */ {
/* */ WidgetButton button;
/* 219 */ if ((this.active == null) && ((event.target instanceof WidgetButton)) &&
/* 220 */ ((button = (WidgetButton)event.target).available())) {
/* 221 */ this.entered = button;
/* 222 */ setPrompt(this.entered.getPrompt());
/* */ }
/* 224 */ return true;
/* */ }
/* */
/* */ @Deprecated
/* */ public boolean mouseMove(Event event, int x, int y)
/* */ {
/* 230 */ return mouseEnter(event, x, y);
/* */ }
/* */
/* */ @Deprecated
/* */ public synchronized boolean keyUp(Event event, int key)
/* */ {
/* 236 */ if ((event.modifiers & 0x1) == 0)
/* 237 */ this.testConstrained = (this.constrainToX = this.constrainToY = 0);
/* 238 */ return true;
/* */ }
/* */
/* */ public void setPrompt(String prompt)
/* */ {
/* 243 */ Console.getFrame().getEditTile().setPrompt(prompt);
/* */ }
/* */
/* */ private void clearPrompt()
/* */ {
/* 248 */ this.entered = null;
/* 249 */ Console.getFrame().getEditTile().setPrompt(null);
/* */ }
/* */
/* */ @Deprecated
/* */ public boolean mouseExit(Event event, int x, int y)
/* */ {
/* 255 */ if ((this.active == null) && (event.target == this.entered))
/* 256 */ clearPrompt();
/* 257 */ return true;
/* */ }
/* */ }
/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\ToolBar.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/
|