From: giwoong.kim Date: Thu, 6 Dec 2012 01:32:47 +0000 (+0900) Subject: skin: close the key window X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.1~1313^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8abb7d40002cd2f7d27054155f7fbbcd2bbb7691;p=sdk%2Femulator%2Fqemu.git skin: close the key window Close the key window instead of making a invisible shell. Signed-off-by: GiWoong Kim --- diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java index c8db861948..ad4b4b325a 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java @@ -186,6 +186,12 @@ public class EmulatorSkin { 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; } @@ -352,7 +358,10 @@ public class EmulatorSkin { cpShell.close(); } controlPanel = null; - colorPairTag.dispose(); + + if (colorPairTag != null) { + colorPairTag.dispose(); + } } /* save config only for emulator close */ @@ -914,10 +923,11 @@ public class EmulatorSkin { } 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(); @@ -1011,8 +1021,13 @@ public class EmulatorSkin { 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(); + } } } } ); diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/layout/GeneralPurposeSkinComposer.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/layout/GeneralPurposeSkinComposer.java index 6745f7c8cd..286332ef70 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/layout/GeneralPurposeSkinComposer.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/layout/GeneralPurposeSkinComposer.java @@ -157,8 +157,9 @@ public class GeneralPurposeSkinComposer implements ISkinComposer { @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); @@ -244,12 +245,12 @@ public class GeneralPurposeSkinComposer implements ISkinComposer { 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(); diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/window/ControlPanel.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/window/ControlPanel.java index bdf6f72934..d3f8e296ce 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/window/ControlPanel.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/window/ControlPanel.java @@ -85,12 +85,13 @@ public class ControlPanel extends SkinWindow { private boolean isGrabbedShell; private Point grabPosition; - public ControlPanel(Shell parent, + public ControlPanel(Shell parent, Color colorPairTag, SocketCommunicator communicator, List 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; @@ -116,11 +117,12 @@ public class ControlPanel extends SkinWindow { 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); @@ -149,9 +151,11 @@ public class ControlPanel extends SkinWindow { 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); + } } }); @@ -325,7 +329,6 @@ public class ControlPanel extends SkinWindow { imageHover.dispose(); imagePushed.dispose(); colorFrame.dispose(); - colorPairTag.dispose(); frameMaker.freePatches(); }