📄 speedscaleshell.java
字号:
{
Integer value = (Integer)iter.next();
String text = (String)mapOptions.get(value);
Rectangle area = new Rectangle(0, y, 120, 15);
org.eclipse.swt.graphics.Color bg;
if (area.contains(mousePos))
{
bg = display.getSystemColor(26);
e.gc.setBackground(bg);
e.gc.setForeground(display.getSystemColor(27));
e.gc.fillRectangle(area);
} else
{
bg = display.getSystemColor(25);
e.gc.setBackground(bg);
e.gc.setForeground(display.getSystemColor(24));
}
int ovalSize = 9;
if (getValue() == value.intValue())
{
org.eclipse.swt.graphics.Color saveColor = e.gc.getBackground();
e.gc.setBackground(e.gc.getForeground());
e.gc.fillOval(4, y + 5, ovalSize - 3, ovalSize - 3);
e.gc.setBackground(saveColor);
}
if (Constants.isLinux)
{
org.eclipse.swt.graphics.Color saveColor = e.gc.getForeground();
e.gc.setForeground(bg);
e.gc.drawPoint(2, y + 3);
e.gc.setForeground(saveColor);
}
e.gc.drawOval(2, y + 3, ovalSize, ovalSize);
GCStringPrinter.printString(e.gc, text, new Rectangle(15, y, 105, 15), true, false, 16384);
y += 15;
}
if (sValue.length() > 0)
{
Point extent = e.gc.textExtent(sValue);
if (extent.x > 110)
extent.x = 110;
Rectangle rect = new Rectangle(112 - extent.x, 14, extent.x + 5, extent.y + 4 + 14 <= 32 ? extent.y + 4 : 17);
e.gc.setBackground(display.getSystemColor(29));
e.gc.fillRectangle(rect);
try
{
e.gc.setAlpha(80);
}
catch (Exception ex) { }
e.gc.setBackground(display.getSystemColor(25));
e.gc.setForeground(display.getSystemColor(24));
GCStringPrinter.printString(e.gc, sValue, new Rectangle(rect.x + 2, rect.y + 2, 115, 15), true, false, 17408);
}
}
{
this$0 = SpeedScaleShell.this;
startValue = i;
display = display1;
super();
}
});
final AERunnable cursorBlinkRunnable = new AERunnable() {
boolean on;
final Display val$display;
final SpeedScaleShell this$0;
public void runSupport()
{
GC gc;
if (composite.isDisposed())
return;
on = !on;
gc = new GC(composite);
gc.setLineWidth(2);
if (!on)
gc.setForeground(display.getSystemColor(29));
else
try
{
gc.setAlpha(80);
}
catch (Exception e) { }
int y = 15;
gc.drawLine(115, y + 1, 115, y + 15);
gc.dispose();
break MISSING_BLOCK_LABEL_115;
Exception exception;
exception;
gc.dispose();
throw exception;
if (cursorBlinkPerformer != null)
cursorBlinkEvent = SimpleTimer.addEvent("BlinkingCursor", SystemTime.getOffsetTime(500L), cursorBlinkPerformer);
return;
}
{
this$0 = SpeedScaleShell.this;
display = display1;
super();
on = false;
}
};
cursorBlinkPerformer = new TimerEventPerformer() {
final AERunnable val$cursorBlinkRunnable;
final SpeedScaleShell this$0;
public void perform(TimerEvent event)
{
Utils.execSWTThread(cursorBlinkRunnable);
}
{
this$0 = SpeedScaleShell.this;
cursorBlinkRunnable = aerunnable;
super();
}
};
cursorBlinkEvent = SimpleTimer.addEvent("BlinkingCursor", SystemTime.getOffsetTime(500L), cursorBlinkPerformer);
composite.addKeyListener(new KeyListener() {
final int val$startValue;
final SpeedScaleShell this$0;
public void keyReleased(KeyEvent keyevent)
{
}
public void keyPressed(KeyEvent e)
{
if (Character.isDigit(e.character))
SpeedScaleShell.access$1284(SpeedScaleShell.this, String.valueOf(e.character));
else
if (e.keyCode == 8 && sValue.length() > 0)
sValue = sValue.substring(0, sValue.length() - 1);
else
return;
try
{
int newValue = Integer.parseInt(sValue);
if (maxTextValue == -1)
{
setValue(newValue);
} else
{
if (minValue > 0 && newValue < minValue)
newValue = minValue;
if (newValue > maxTextValue)
newValue = maxTextValue;
value = newValue;
composite.redraw();
}
}
catch (Exception ex)
{
setValue(startValue);
}
}
{
this$0 = SpeedScaleShell.this;
startValue = i;
super();
}
});
Point location = display.getCursorLocation();
location.y -= getBaselinePos();
int x = (int)(100D * (value <= maxValue ? (double)value / (double)maxValue : 1.0D));
location.x -= 10 + x;
Rectangle bounds = new Rectangle(location.x, location.y, 120, HEIGHT);
Monitor mouseMonitor = shell.getMonitor();
Monitor monitors[] = display.getMonitors();
int i = 0;
do
{
if (i >= monitors.length)
break;
Monitor monitor = monitors[i];
if (monitor.getBounds().contains(location))
{
mouseMonitor = monitor;
break;
}
i++;
} while (true);
Rectangle monitorBounds = mouseMonitor.getBounds();
Rectangle intersection = monitorBounds.intersection(bounds);
if (intersection.width != bounds.width)
{
bounds.x = (monitorBounds.x + monitorBounds.width) - 120;
bounds.width = 120;
}
if (intersection.height != bounds.height)
{
bounds.y = (monitorBounds.y + monitorBounds.height) - HEIGHT;
bounds.height = HEIGHT;
}
shell.setBounds(bounds);
if (!bounds.contains(firstMousePos))
shell.setLocation(firstMousePos.x - bounds.width / 2, (firstMousePos.y - bounds.height) + 2);
shell.open();
composite.setFocus();
try
{
do
{
if (shell.isDisposed())
break;
if (!display.readAndDispatch())
display.sleep();
} while (true);
}
catch (Throwable t)
{
Debug.out(t);
}
if (cursorBlinkEvent != null)
{
cursorBlinkEvent.cancel();
cursorBlinkEvent = null;
}
return !cancelled;
}
protected int getValueFromMousePos(int x)
{
int x0 = x + 1;
if (x < 10)
x0 = 10;
else
if (x > 110)
x0 = 110;
return ((x0 - 10) * maxValue) / 100;
}
public int getValue()
{
return value;
}
public boolean isCancelled()
{
return cancelled;
}
public void setCancelled(boolean cancelled)
{
this.cancelled = cancelled;
}
public int getMinValue()
{
return minValue;
}
public void setMinValue(int minValue)
{
this.minValue = minValue;
}
public int getMaxValue()
{
return maxValue;
}
public void setMaxValue(int maxValue)
{
this.maxValue = maxValue;
}
public void setValue(int value)
{
if (value > maxValue)
value = maxValue;
else
if (value < minValue)
value = minValue;
this.value = value;
if (composite != null && !composite.isDisposed())
composite.redraw();
}
public String _getStringValue()
{
String name = (String)mapOptions.get(new Integer(value));
return getStringValue(value, name);
}
public String getStringValue(int value, String sValue)
{
if (sValue != null)
return sValue;
else
return (new StringBuilder()).append("").append(value).toString();
}
private int getBaselinePos()
{
return HEIGHT - 10;
}
public void addOption(String id, int value)
{
mapOptions.put(new Integer(value), id);
HEIGHT += 15;
}
public int getMaxTextValue()
{
return maxTextValue;
}
public void setMaxTextValue(int maxTextValue)
{
this.maxTextValue = maxTextValue;
}
public boolean wasMenuChosen()
{
return menuChosen;
}
public void setMenuChosen(boolean menuChosen)
{
this.menuChosen = menuChosen;
}
/*
static String access$1284(SpeedScaleShell x0, Object x1)
{
new StringBuilder();
x0;
JVM INSTR dup_x1 ;
sValue;
append();
x1;
append();
toString();
JVM INSTR dup_x1 ;
sValue;
return;
}
*/
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -