blob: a0452d8ebb2155c09cf733512485e5a5b62d8185 (
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
|
/* */ package NET.worlds.scape;
/* */
/* */ import NET.worlds.console.Console;
/* */ import NET.worlds.console.DefaultConsole;
/* */ import NET.worlds.console.MultiLineLabel;
/* */ import NET.worlds.console.RenderCanvas;
/* */ import NET.worlds.core.IniFile;
/* */ import java.awt.Color;
/* */ import java.awt.Font;
/* */ import java.awt.Point;
/* */ import java.awt.Window;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class ToolTipManager
/* */ {
/* 22 */ private static ToolTipManager manager_ = null;
/* */ private static final int FRAME_DELAY = 15;
/* */ private int savedX;
/* */ private int savedY;
/* */ private int savedLoops;
/* */ private boolean toolTipActive;
/* */ private WObject savedObject;
/* */ private Window toolTipWindow;
/* */ private MultiLineLabel toolTipTextArea;
/* */ private Font toolTipFont;
/* */
/* */ private ToolTipManager()
/* */ {
/* 35 */ this.savedX = (this.savedY = this.savedLoops = 0);
/* 36 */ this.toolTipActive = false;
/* 37 */ this.savedObject = null;
/* */
/* */
/* 40 */ this.toolTipFont = new Font("Arial", 0, 10);
/* 41 */ Console.getActive();
/* */
/* 43 */ this.toolTipWindow = new Window(Console.getFrame());
/* 44 */ this.toolTipTextArea = new MultiLineLabel();
/* 45 */ this.toolTipTextArea.setBackground(Color.yellow);
/* 46 */ this.toolTipTextArea.setForeground(Color.black);
/* 47 */ this.toolTipTextArea.setMarginWidth(2);
/* 48 */ this.toolTipTextArea.setMarginHeight(2);
/* 49 */ this.toolTipWindow.setFont(this.toolTipFont);
/* 50 */ this.toolTipWindow.add(this.toolTipTextArea);
/* */ }
/* */
/* */ public static ToolTipManager toolTipManager()
/* */ {
/* 55 */ if (manager_ == null)
/* */ {
/* 57 */ manager_ = new ToolTipManager();
/* */ }
/* */
/* 60 */ return manager_;
/* */ }
/* */
/* */ public void heartbeat()
/* */ {
/* 65 */ if (IniFile.gamma().getIniInt("DisableToolTips", 0) == 1)
/* */ {
/* */
/* 68 */ return;
/* */ }
/* */
/* 71 */ WObject obj = Camera.getMousePickWObject();
/* 72 */ int x = (int)Camera.getMousePickX();
/* 73 */ int y = (int)Camera.getMousePickY();
/* */
/* */
/* 76 */ if ((obj != null) && (x > 0) && (y > 0) &&
/* 77 */ (x == this.savedX) && (y == this.savedY) && (this.savedObject == obj))
/* */ {
/* 79 */ this.savedLoops += 1;
/* */ }
/* */ else
/* */ {
/* 83 */ if (this.toolTipActive)
/* */ {
/* 85 */ removeToolTip();
/* 86 */ this.toolTipActive = false;
/* */ }
/* 88 */ this.savedLoops = 0;
/* */ }
/* */
/* 91 */ if ((!this.toolTipActive) && (obj != null) &&
/* 92 */ (this.savedLoops > 15))
/* */ {
/* 94 */ this.toolTipActive = true;
/* 95 */ if (obj != null)
/* */ {
/* 97 */ this.savedObject = obj;
/* 98 */ if (obj.getToolTipText() != null)
/* */ {
/* 100 */ String oldText = obj.getToolTipText();
/* 101 */ String newText = oldText.replace('|', '\n');
/* 102 */ createToolTip(this.savedX, this.savedY, newText);
/* */ }
/* */ }
/* */ }
/* */
/* 107 */ this.savedX = x;
/* 108 */ this.savedY = y;
/* 109 */ this.savedObject = obj;
/* */ }
/* */
/* */ void createToolTip(int winX, int winY, String text)
/* */ {
/* 114 */ int baseX = ((DefaultConsole)Console.getActive()).getRender().getLocationOnScreen().x;
/* 115 */ int baseY = ((DefaultConsole)Console.getActive()).getRender().getLocationOnScreen().y;
/* 116 */ int offsetX = 16;
/* 117 */ int offsetY = 16;
/* */
/* 119 */ this.toolTipWindow.setLocation(winX + baseX + offsetX, winY + baseY + offsetY);
/* 120 */ this.toolTipTextArea.setLabel(text);
/* 121 */ this.toolTipWindow.setSize(this.toolTipTextArea.getPreferredSize());
/* 122 */ this.toolTipWindow.setEnabled(false);
/* 123 */ this.toolTipWindow.setVisible(true);
/* */ }
/* */
/* */
/* */ public void removeToolTip()
/* */ {
/* 129 */ this.toolTipWindow.setVisible(false);
/* */ }
/* */
/* */ public void killToolTip()
/* */ {
/* 134 */ this.savedLoops = 0;
/* 135 */ this.toolTipWindow.setVisible(false);
/* */ }
/* */ }
/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\ToolTipManager.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/
|