SkinUtil.setTopMost(shell, true);
}
+ /* generate a pair tag color of key window */
+ int red = (int) (Math.random() * 256);
+ int green = (int) (Math.random() * 256);
+ int blue = (int) (Math.random() * 256);
+ this.colorPairTag = new Color(shell.getDisplay(), new RGB(red, green, blue));
+
this.currentState = state;
}
cpShell.close();
}
controlPanel = null;
- colorPairTag.dispose();
+
+ if (colorPairTag != null) {
+ colorPairTag.dispose();
+ }
}
/* save config only for emulator close */
}
try {
- controlPanel = new ControlPanel(shell, communicator, keyMapList);
+ controlPanel = new ControlPanel(shell, colorPairTag,
+ communicator, keyMapList);
SkinUtil.setTopMost(controlPanel.getShell(), isOnTop);
- colorPairTag = controlPanel.getPairTagColor();
+ //colorPairTag = controlPanel.getPairTagColor();
pairTagCanvas.setVisible(true);
controlPanel.open();
if (isControlPanel == true) {
openKeyWindow((controlPanel == null) ?
true : controlPanel.isAttach());
- } else {
- hideKeyWindow();
+ } else { /* hide a key window */
+ if (controlPanel != null && controlPanel.isAttach()) {
+ pairTagCanvas.setVisible(false);
+ controlPanel.getShell().close();
+ } else {
+ hideKeyWindow();
+ }
}
}
} );
@Override
public void mouseDown(MouseEvent e) {
if (skin.getIsControlPanel() == true) {
+ skin.controlPanel.getShell().close();
skin.setIsControlPanel(false);
- skin.hideKeyWindow();
+ skin.pairTagCanvas.setVisible(false);
} else {
skin.setIsControlPanel(true);
skin.openKeyWindow(true);
lcdBounds.y + (lcdBounds.height / 2) - (toggleButton.getImageSize().y / 2),
toggleButton.getImageSize().x, toggleButton.getImageSize().y);
- /* arrange the pair tag */
- skin.pairTagCanvas.setBounds(26, 13, 8, 8);
-
/* custom window shape */
trimPatchedShell(shell, currentState.getCurrentImage());
+ /* arrange the pair tag */
+ skin.pairTagCanvas.setBounds(26, 13, 8, 8);
+
/* set window size */
if (currentState.getCurrentImage() != null) {
ImageData imageData = currentState.getCurrentImage().getImageData();
private boolean isGrabbedShell;
private Point grabPosition;
- public ControlPanel(Shell parent,
+ public ControlPanel(Shell parent, Color colorPairTag,
SocketCommunicator communicator, List<KeyMapType> keyMapList) {
super(parent, SWT.RIGHT | SWT.CENTER);
this.shell = new Shell(Display.getDefault(), SWT.NO_TRIM | SWT.RESIZE);
this.frameMaker = new SkinPatches(PATCH_IMAGES_PATH);
+ this.colorPairTag = colorPairTag;
this.keyMapList = keyMapList;
this.communicator = communicator;
this.imageFrame = frameMaker.getPatchedImage(width, height);
this.colorFrame = new Color(shell.getDisplay(), new RGB(38, 38, 38));
- /* generate a pair tag color of key window */
- int red = (int) (Math.random() * 256);
- int green = (int) (Math.random() * 256);
- int blue = (int) (Math.random() * 256);
- this.colorPairTag = new Color(shell.getDisplay(), new RGB(red, green, blue));
+// /* generate a pair tag color of key window */
+// int red = (int) (Math.random() * 256);
+// int green = (int) (Math.random() * 256);
+// int blue = (int) (Math.random() * 256);
+// this.colorPairTag = new Color(shell.getDisplay(), new RGB(red, green, blue));
+ this.colorPairTag = colorPairTag;
createContents();
trimPatchedShell(shell, imageFrame);
pairTagCanvas.addPaintListener(new PaintListener() {
@Override
public void paintControl(PaintEvent e) {
- e.gc.setBackground(colorPairTag);
- e.gc.setAntialias(SWT.ON);
- e.gc.fillOval(0, 0, PAIRTAG_CIRCLE_SIZE, PAIRTAG_CIRCLE_SIZE);
+ if (colorPairTag != null) {
+ e.gc.setBackground(colorPairTag);
+ e.gc.setAntialias(SWT.ON);
+ e.gc.fillOval(0, 0, PAIRTAG_CIRCLE_SIZE, PAIRTAG_CIRCLE_SIZE);
+ }
}
});
imageHover.dispose();
imagePushed.dispose();
colorFrame.dispose();
- colorPairTag.dispose();
frameMaker.freePatches();
}