menu: added KeyWindowKeeper class
authorGiWoong Kim <giwoong.kim@samsung.com>
Tue, 23 Jul 2013 11:41:13 +0000 (20:41 +0900)
committerGiWoong Kim <giwoong.kim@samsung.com>
Wed, 24 Jul 2013 08:47:06 +0000 (17:47 +0900)
added KeyWindowKeeper class

Change-Id: Idba2cfb208db3e2926542cd493f5ff0734ebb163
Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java
tizen/src/skin/client/src/org/tizen/emulator/skin/custom/KeyWindow.java
tizen/src/skin/client/src/org/tizen/emulator/skin/layout/GeneralPurposeSkinComposer.java
tizen/src/skin/client/src/org/tizen/emulator/skin/layout/ProfileSpecificSkinComposer.java
tizen/src/skin/client/src/org/tizen/emulator/skin/menu/KeyWindowKeeper.java [new file with mode: 0644]
tizen/src/skin/client/src/org/tizen/emulator/skin/screenshot/ScreenShotDialog.java

index bf549c5233df75b9e888b996817e465e66c5eff8..498b92fac0a58f4db361ef454721056e983d8aac 100644 (file)
@@ -79,9 +79,8 @@ import org.tizen.emulator.skin.config.EmulatorConfig.ArgsConstants;
 import org.tizen.emulator.skin.config.EmulatorConfig.SkinPropertiesConstants;
 import org.tizen.emulator.skin.custom.ColorTag;
 import org.tizen.emulator.skin.custom.CustomProgressBar;
-import org.tizen.emulator.skin.custom.KeyWindow;
+import org.tizen.emulator.skin.custom.SkinWindow;
 import org.tizen.emulator.skin.dbi.HoverType;
-import org.tizen.emulator.skin.dbi.KeyMapType;
 import org.tizen.emulator.skin.dbi.RgbType;
 import org.tizen.emulator.skin.dbi.RotationType;
 import org.tizen.emulator.skin.dialog.AboutDialog;
@@ -93,6 +92,7 @@ import org.tizen.emulator.skin.layout.GeneralPurposeSkinComposer;
 import org.tizen.emulator.skin.layout.ISkinComposer;
 import org.tizen.emulator.skin.layout.ProfileSpecificSkinComposer;
 import org.tizen.emulator.skin.log.SkinLogger;
+import org.tizen.emulator.skin.menu.KeyWindowKeeper;
 import org.tizen.emulator.skin.menu.PopupMenu;
 import org.tizen.emulator.skin.screenshot.ScreenShotDialog;
 import org.tizen.emulator.skin.util.SkinRotation;
@@ -106,11 +106,10 @@ import org.tizen.emulator.skin.util.SwtUtil;
 public class EmulatorSkin {
 
        public class SkinReopenPolicy {
-
                private EmulatorSkin reopenSkin;
                private boolean reopen;
 
-               private SkinReopenPolicy( EmulatorSkin reopenSkin, boolean reopen ) {
+               private SkinReopenPolicy(EmulatorSkin reopenSkin, boolean reopen) {
                        this.reopenSkin = reopenSkin;
                        this.reopen = reopen;
                }
@@ -122,7 +121,6 @@ public class EmulatorSkin {
                public boolean isReopen() {
                        return reopen;
                }
-
        }
 
        public enum SkinBasicColor {
@@ -174,8 +172,7 @@ public class EmulatorSkin {
        private PopupMenu popupMenu;
 
        public Color colorVM;
-       public KeyWindow keyWindow;
-       public int recentlyDocked;
+       private KeyWindowKeeper keyWindowKeeper;
        public ColorTag pairTag;
        public CustomProgressBar bootingProgress;
        public ScreenShotDialog screenShotDialog;
@@ -207,12 +204,10 @@ public class EmulatorSkin {
                this.skinInfo = skinInfo;
 
                this.screenShotDialog = null;
-               this.keyWindow = null;
                this.pressedKeyEventList = new LinkedList<KeyEventData>();
 
                this.isOnTop = isOnTop;
                this.isKeyWindow = false;
-               this.recentlyDocked = SWT.NONE;
 
                int style = SWT.NO_TRIM | SWT.DOUBLE_BUFFERED;
                this.shell = new Shell(Display.getDefault(), style);
@@ -223,8 +218,8 @@ public class EmulatorSkin {
 
                this.displayCanvasStyle = displayCanvasStyle;
 
-               /* generate a pair tag color of key window */
-               setColorVM();
+               setColorVM(); /* generate a identity color */
+               this.keyWindowKeeper = new KeyWindowKeeper(this);
 
                this.currentState = state;
        }
@@ -340,18 +335,31 @@ public class EmulatorSkin {
                return (new Color(shell.getDisplay(), new RGB(255, 255, 255)));
        }
 
-       public Color getColorVM() {
-               return colorVM;
+       /* getters */
+       public Shell getShell() {
+               return shell;
+       }
+
+       public EmulatorSkinState getEmulatorSkinState() {
+               return currentState;
        }
 
        public ImageRegistry getImageRegistry() {
                return imageRegistry;
        }
 
+       public Color getColorVM() {
+               return colorVM;
+       }
+
        public PopupMenu getPopupMenu() {
                return popupMenu;
        }
 
+       public KeyWindowKeeper getKeyWindowKeeper() {
+               return keyWindowKeeper;
+       }
+
        public SkinReopenPolicy open() {
                if (null == this.communicator) {
                        logger.severe("communicator is null.");
@@ -422,8 +430,10 @@ public class EmulatorSkin {
                                                                SkinPropertiesConstants.WINDOW_ONTOP, Boolean.toString(isOnTop));
 
                                                int dockValue = 0;
-                                               if (keyWindow != null && keyWindow.getShell().isVisible()) {
-                                                       dockValue = keyWindow.getDockPosition();
+                                               SkinWindow keyWindow = getKeyWindowKeeper().getKeyWindow();
+                                               if (keyWindow != null &&
+                                                               keyWindow.getShell().isVisible() == true) {
+                                                       dockValue = getKeyWindowKeeper().getDockPosition();
                                                }
                                                config.setSkinProperty(
                                                                SkinPropertiesConstants.KEYWINDOW_POSITION, dockValue);
@@ -431,7 +441,9 @@ public class EmulatorSkin {
                                                config.saveSkinProperties();
 
                                                /* close the Key Window */
-                                               closeKeyWindow();
+                                               if (getKeyWindowKeeper() != null) {
+                                                       getKeyWindowKeeper().closeKeyWindow();
+                                               }
 
                                                /* dispose the color */
                                                if (colorVM != null) {
@@ -467,16 +479,17 @@ public class EmulatorSkin {
                        public void shellActivated(ShellEvent event) {
                                logger.info("activate");
 
-                               if (keyWindow != null && isKeyWindow == true) {
+                               if (isKeyWindow == true && getKeyWindowKeeper().getKeyWindow() != null) {
                                        if (isOnTop == false) {
-                                               keyWindow.getShell().moveAbove(shell);
+                                               getKeyWindowKeeper().getKeyWindow().getShell().moveAbove(shell);
 
-                                               if (keyWindow.getDockPosition() != SWT.NONE) {
-                                                       shell.moveAbove(keyWindow.getShell());
+                                               if (getKeyWindowKeeper().getDockPosition() != SWT.NONE) {
+                                                       shell.moveAbove(
+                                                                       getKeyWindowKeeper().getKeyWindow().getShell());
                                                }
                                        } else {
-                                               if (keyWindow.getDockPosition() == SWT.NONE) {
-                                                       keyWindow.getShell().moveAbove(shell);
+                                               if (getKeyWindowKeeper().getDockPosition() == SWT.NONE) {
+                                                       getKeyWindowKeeper().getKeyWindow().getShell().moveAbove(shell);
                                                }
                                        }
                                }
@@ -497,12 +510,14 @@ public class EmulatorSkin {
                                shell.getDisplay().asyncExec(new Runnable() {
                                        @Override
                                        public void run() {
-                                               if (isKeyWindow == true && keyWindow != null) {
-                                                       if (keyWindow.getShell().getMinimized() == false) {
-                                                               keyWindow.getShell().setVisible(false);
+                                               if (isKeyWindow == true && getKeyWindowKeeper().getKeyWindow() != null) {
+                                                       Shell keyWindowShell = getKeyWindowKeeper().getKeyWindow().getShell();
+
+                                                       if (keyWindowShell.getMinimized() == false) {
+                                                               keyWindowShell.setVisible(false);
                                                                /* the tool style window is exposed
                                                                when even it was minimized */
-                                                               keyWindow.getShell().setMinimized(true);
+                                                               keyWindowShell.setMinimized(true);
                                                        }
                                                }
                                        }
@@ -513,10 +528,12 @@ public class EmulatorSkin {
                        public void shellDeiconified(ShellEvent event) {
                                logger.info("deiconified");
 
-                               if (isKeyWindow == true && keyWindow != null) {
-                                       if (keyWindow.getShell().getMinimized() == true) {
-                                               keyWindow.getShell().setMinimized(false);
-                                               keyWindow.getShell().setVisible(true);
+                               if (isKeyWindow == true && getKeyWindowKeeper().getKeyWindow() != null) {
+                                       Shell keyWindowShell = getKeyWindowKeeper().getKeyWindow().getShell();
+
+                                       if (keyWindowShell.getMinimized() == true) {
+                                               keyWindowShell.setMinimized(false);
+                                               keyWindowShell.setVisible(true);
                                        }
                                }
 
@@ -657,9 +674,7 @@ public class EmulatorSkin {
                canvasMouseListener = new MouseListener() {
                        @Override
                        public void mouseUp(MouseEvent e) {
-                               if (keyWindow != null) {
-                                       keyWindow.redock(false, false);
-                               }
+                               getKeyWindowKeeper().redock(false, false);
 
                                if (1 == e.button) /* left button */
                                {
@@ -1000,91 +1015,6 @@ public class EmulatorSkin {
                /* abstract */
        }
 
-       public boolean isSelectKeyWindowMenu() {
-               if (popupMenu.keyWindowItem != null) {
-                       return popupMenu.keyWindowItem.getSelection();
-               }
-
-               return false;
-       }
-
-       public void selectKeyWindowMenu(boolean on) {
-               if (popupMenu.keyWindowItem != null) {
-                       popupMenu.keyWindowItem.setSelection(on);
-               }
-       }
-
-       public void openKeyWindow(int dockValue, boolean recreate) {
-               if (keyWindow != null) {
-                       if (recreate == false) {
-                               /* show the key window */
-                               selectKeyWindowMenu(isKeyWindow = true);
-
-                               if (pairTag != null) {
-                                       pairTag.setVisible(true);
-                               }
-
-                               keyWindow.getShell().setVisible(true);
-                               SkinUtil.setTopMost(keyWindow.getShell(), isOnTop);
-
-                               return;
-                       } else {
-                               logger.info("recreate a keywindow");
-                               closeKeyWindow();
-                       }
-               }
-
-               /* create a key window */
-               List<KeyMapType> keyMapList =
-                               SkinUtil.getHWKeyMapList(currentState.getCurrentRotationId());
-
-               if (keyMapList == null) {
-                       selectKeyWindowMenu(isKeyWindow = false);
-                       logger.info("keyMapList is null");
-                       return;
-               } else if (keyMapList.isEmpty() == true) {
-                       selectKeyWindowMenu(isKeyWindow = false);
-                       logger.info("keyMapList is empty");
-                       return;
-               }
-
-               keyWindow = new KeyWindow(this, shell, communicator, keyMapList);
-
-               selectKeyWindowMenu(isKeyWindow = true);
-               SkinUtil.setTopMost(keyWindow.getShell(), isOnTop);
-
-               if (pairTag != null) {
-                       pairTag.setVisible(true);
-               }
-
-               keyWindow.open(dockValue);
-       }
-
-       public void hideKeyWindow() {
-               selectKeyWindowMenu(isKeyWindow = false);
-
-               if (pairTag != null) {
-                       pairTag.setVisible(false);
-               }
-
-               if (keyWindow != null) {
-                       keyWindow.getShell().setVisible(false);
-               }
-       }
-
-       public void closeKeyWindow() {
-               selectKeyWindowMenu(isKeyWindow = false);
-
-               if (pairTag != null) {
-                       pairTag.setVisible(false);
-               }
-
-               if (keyWindow != null) {
-                       keyWindow.getShell().close();
-                       keyWindow = null;
-               }
-       }
-
        /* for popup menu */
        public SelectionAdapter createDetailInfoMenu() {
                SelectionAdapter listener = new SelectionAdapter() {
@@ -1118,8 +1048,9 @@ public class EmulatorSkin {
 
                                        popupMenu.onTopItem.setSelection(isOnTop = false);
                                } else {
-                                       if (keyWindow != null) {
-                                               SkinUtil.setTopMost(keyWindow.getShell(), isOnTop);
+                                       if (getKeyWindowKeeper().getKeyWindow() != null) {
+                                               SkinUtil.setTopMost(
+                                                               getKeyWindowKeeper().getKeyWindow().getShell(), isOnTop);
                                        }
                                }
                        }
@@ -1183,7 +1114,6 @@ public class EmulatorSkin {
                SelectionAdapter selectionAdapter = new SelectionAdapter() {
                        @Override
                        public void widgetSelected(SelectionEvent e) {
-
                                MenuItem item = (MenuItem) e.getSource();
 
                                boolean selection = item.getSelection();
@@ -1206,7 +1136,8 @@ public class EmulatorSkin {
                                        }
 
                                        SkinUtil.openMessage(shell, null,
-                                                       "Rotation is not ready.\nPlease wait until the emulator is completely boot up.",
+                                                       "Rotation is not ready.\n" +
+                                                       "Please wait until the emulator is completely boot up.",
                                                        SWT.ICON_WARNING, config);
                                        return;
                                }
@@ -1319,26 +1250,34 @@ public class EmulatorSkin {
                SelectionAdapter listener = new SelectionAdapter() {
                        @Override
                        public void widgetSelected(SelectionEvent e) {
-                               if (isSelectKeyWindowMenu() == true) {
-                                       if (keyWindow == null) {
-                                               if (recentlyDocked != SWT.NONE) {
-                                                       openKeyWindow(recentlyDocked, false);
-                                                       recentlyDocked = SWT.NONE;
+                               if (getKeyWindowKeeper().isSelectKeyWindowMenu() == true)
+                               {
+                                       if (getKeyWindowKeeper().getKeyWindow() == null) {
+                                               if (getKeyWindowKeeper().getRecentlyDocked() != SWT.NONE) {
+                                                       getKeyWindowKeeper().openKeyWindow(
+                                                                       getKeyWindowKeeper().getRecentlyDocked(), false);
+
+                                                       getKeyWindowKeeper().setRecentlyDocked(SWT.NONE);
                                                } else {
                                                        /* opening for first time */
-                                                       openKeyWindow(SWT.RIGHT | SWT.CENTER, false);
+                                                       getKeyWindowKeeper().openKeyWindow(
+                                                                       SWT.RIGHT | SWT.CENTER, false);
                                                }
                                        } else {
-                                               openKeyWindow(keyWindow.getDockPosition(), false);
+                                               getKeyWindowKeeper().openKeyWindow(
+                                                               getKeyWindowKeeper().getDockPosition(), false);
                                        }
-                               } else { /* hide a key window */
-                                       if (keyWindow != null &&
-                                                       keyWindow.getDockPosition() != SWT.NONE) {
+                               }
+                               else
+                               { /* hide a key window */
+                                       if (getKeyWindowKeeper().getDockPosition() != SWT.NONE) {
                                                /* close the Key Window if it is docked to Main Window */
-                                               recentlyDocked = keyWindow.getDockPosition();
-                                               closeKeyWindow();
+                                               getKeyWindowKeeper().setRecentlyDocked(
+                                                               getKeyWindowKeeper().getDockPosition());
+
+                                               getKeyWindowKeeper().closeKeyWindow();
                                        } else {
-                                               hideKeyWindow();
+                                               getKeyWindowKeeper().hideKeyWindow();
                                        }
                                }
                        }
@@ -1552,10 +1491,6 @@ public class EmulatorSkin {
 
        }
 
-       public short getCurrentRotationId() {
-               return currentState.getCurrentRotationId();
-       }
-
        public void keyForceRelease(boolean isMetaFilter) {
                /* key event compensation */
                if (pressedKeyEventList.isEmpty() == false) {
index f11064c365ed758000c2544245a474e850ffddcd..2b248ba463fcdcb412e6588592c35c371883c9f7 100644 (file)
@@ -324,7 +324,6 @@ public class KeyWindow extends SkinWindow {
                                if (skin.pairTag != null) {
                                        skin.pairTag.setVisible(false);
                                }
-                               skin.keyWindow = null;
 
                                if (null != shellPaintListener) {
                                        shell.removePaintListener(shellPaintListener);
index 81732185ddfb0cebf9c85f521341dd6022935929..eabd9041e841ca9bee4d8a984d8b35e34416e2ed 100644 (file)
@@ -173,10 +173,11 @@ public class GeneralPurposeSkinComposer implements ISkinComposer {
                        @Override
                        public void mouseDown(MouseEvent e) {
                                if (skin.isKeyWindow == true) {
-                                       skin.closeKeyWindow();
-                                       skin.recentlyDocked = SWT.RIGHT | SWT.CENTER;
+                                       skin.getKeyWindowKeeper().closeKeyWindow();
+                                       skin.getKeyWindowKeeper().setRecentlyDocked(SWT.RIGHT | SWT.CENTER);
                                } else {
-                                       skin.openKeyWindow(SWT.RIGHT | SWT.CENTER, true);
+                                       skin.getKeyWindowKeeper().openKeyWindow(
+                                                       SWT.RIGHT | SWT.CENTER, true);
                                }
                        }
 
@@ -213,9 +214,11 @@ public class GeneralPurposeSkinComposer implements ISkinComposer {
                                @Override
                                public void run() {
                                        if (dockValue == 0 || dockValue == SWT.NONE) {
-                                               skin.openKeyWindow(SWT.RIGHT | SWT.CENTER, false);
+                                               skin.getKeyWindowKeeper().openKeyWindow(
+                                                               SWT.RIGHT | SWT.CENTER, false);
                                        } else {
-                                               skin.openKeyWindow(dockValue, false);
+                                               skin.getKeyWindowKeeper().openKeyWindow(
+                                                               dockValue, false);
                                        }
                                }
                        });
@@ -402,9 +405,7 @@ public class GeneralPurposeSkinComposer implements ISkinComposer {
                                        e.gc.drawImage(currentState.getCurrentImage(), 0, 0);
                                }
 
-                               if (skin.keyWindow != null) {
-                                       skin.keyWindow.redock(false, false);
-                               }
+                               skin.getKeyWindowKeeper().redock(false, false);
                        }
                };
 
@@ -421,9 +422,7 @@ public class GeneralPurposeSkinComposer implements ISkinComposer {
 
                                        shell.setLocation(x, y);
 
-                                       if (skin.keyWindow != null) {
-                                               skin.keyWindow.redock(false, false);
-                                       }
+                                       skin.getKeyWindowKeeper().redock(false, false);
                                }
                        }
                };
@@ -439,9 +438,7 @@ public class GeneralPurposeSkinComposer implements ISkinComposer {
                                        isGrabbedShell = false;
                                        grabPosition.x = grabPosition.y = 0;
 
-                                       if (skin.keyWindow != null) {
-                                               skin.keyWindow.redock(false, true);
-                                       }
+                                       skin.getKeyWindowKeeper().redock(false, true);
                                }
                        }
 
index 5c44b6061b547407f444d497a855d7d464c12e94..34e3efce5b38681007b8c644f87fc07eef036499 100644 (file)
@@ -173,9 +173,11 @@ public class ProfileSpecificSkinComposer implements ISkinComposer {
                                @Override
                                public void run() {
                                        if (dockValue == 0 || dockValue == SWT.NONE) {
-                                               skin.openKeyWindow(SWT.RIGHT | SWT.CENTER, false);
+                                               skin.getKeyWindowKeeper().openKeyWindow(
+                                                               SWT.RIGHT | SWT.CENTER, false);
                                        } else {
-                                               skin.openKeyWindow(dockValue, false);
+                                               skin.getKeyWindowKeeper().openKeyWindow(
+                                                               dockValue, false);
                                        }
                                }
                        });
@@ -360,9 +362,7 @@ public class ProfileSpecificSkinComposer implements ISkinComposer {
 
                                        shell.setLocation(x, y);
 
-                                       if (skin.keyWindow != null) {
-                                               skin.keyWindow.redock(false, false);
-                                       }
+                                       skin.getKeyWindowKeeper().redock(false, false);
 
                                        return;
                                }
@@ -425,9 +425,7 @@ public class ProfileSpecificSkinComposer implements ISkinComposer {
                                        isGrabbedShell = false;
                                        grabPosition.x = grabPosition.y = 0;
 
-                                       if (skin.keyWindow != null) {
-                                               skin.keyWindow.redock(false, true);
-                                       }
+                                       skin.getKeyWindowKeeper().redock(false, true);
 
                                        /* HW key handling */
                                        HWKey pressedHWKey = currentState.getCurrentPressedHWKey();
diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/menu/KeyWindowKeeper.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/menu/KeyWindowKeeper.java
new file mode 100644 (file)
index 0000000..3c9d7b6
--- /dev/null
@@ -0,0 +1,171 @@
+/**
+ * Key Window Controller
+ *
+ * Copyright (C) 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * GiWoong Kim <giwoong.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.emulator.skin.menu;
+
+import java.util.List;
+import java.util.logging.Logger;
+
+import org.eclipse.swt.SWT;
+import org.tizen.emulator.skin.EmulatorSkin;
+import org.tizen.emulator.skin.custom.KeyWindow;
+import org.tizen.emulator.skin.custom.SkinWindow;
+import org.tizen.emulator.skin.dbi.KeyMapType;
+import org.tizen.emulator.skin.log.SkinLogger;
+import org.tizen.emulator.skin.util.SkinUtil;
+
+public class KeyWindowKeeper {
+       private static Logger logger =
+                       SkinLogger.getSkinLogger(KeyWindowKeeper.class).getLogger();
+
+       private EmulatorSkin skin;
+       private SkinWindow keyWindow;
+       private int recentlyDocked;
+
+       /**
+        *  Constructor
+        */
+       public KeyWindowKeeper(EmulatorSkin skin) {
+               this.skin = skin;
+               this.recentlyDocked = SWT.NONE;
+       }
+
+       public void openKeyWindow(int dockValue, boolean recreate) {
+               if (keyWindow != null) {
+                       if (recreate == false) {
+                               /* show the key window */
+                               selectKeyWindowMenu(skin.isKeyWindow = true);
+
+                               if (skin.pairTag != null) {
+                                       skin.pairTag.setVisible(true);
+                               }
+
+                               keyWindow.getShell().setVisible(true);
+                               SkinUtil.setTopMost(keyWindow.getShell(), skin.isOnTop);
+
+                               return;
+                       } else {
+                               logger.info("recreate a keywindow");
+                               closeKeyWindow();
+                       }
+               }
+
+               /* create a key window */
+               List<KeyMapType> keyMapList = SkinUtil.getHWKeyMapList(
+                               skin.getEmulatorSkinState().getCurrentRotationId());
+
+               if (keyMapList == null) {
+                       selectKeyWindowMenu(skin.isKeyWindow = false);
+                       logger.info("keyMapList is null");
+                       return;
+               } else if (keyMapList.isEmpty() == true) {
+                       selectKeyWindowMenu(skin.isKeyWindow = false);
+                       logger.info("keyMapList is empty");
+                       return;
+               }
+
+               keyWindow = new KeyWindow(
+                               skin, skin.getShell(), skin.communicator, keyMapList);
+
+               selectKeyWindowMenu(skin.isKeyWindow = true);
+               SkinUtil.setTopMost(keyWindow.getShell(), skin.isOnTop);
+
+               if (skin.pairTag != null) {
+                       skin.pairTag.setVisible(true);
+               }
+
+               keyWindow.open(dockValue);
+       }
+
+       public void closeKeyWindow() {
+               selectKeyWindowMenu(skin.isKeyWindow = false);
+
+               if (skin.pairTag != null) {
+                       skin.pairTag.setVisible(false);
+               }
+
+               if (keyWindow != null) {
+                       keyWindow.getShell().close();
+                       keyWindow = null;
+               }
+       }
+
+       public void hideKeyWindow() {
+               selectKeyWindowMenu(skin.isKeyWindow = false);
+
+               if (skin.pairTag != null) {
+                       skin.pairTag.setVisible(false);
+               }
+
+               if (keyWindow != null) {
+                       keyWindow.getShell().setVisible(false);
+               }
+       }
+
+       public SkinWindow getKeyWindow() {
+               return keyWindow;
+       }
+
+       /* for Menu */
+       public boolean isSelectKeyWindowMenu() {
+               if (skin.getPopupMenu().keyWindowItem != null) {
+                       return skin.getPopupMenu().keyWindowItem.getSelection();
+               }
+
+               return false;
+       }
+
+       public void selectKeyWindowMenu(boolean on) {
+               if (skin.getPopupMenu().keyWindowItem != null) {
+                       skin.getPopupMenu().keyWindowItem.setSelection(on);
+               }
+       }
+
+       /* for docking */
+       public void redock(boolean correction, boolean enableLogger) {
+               if (keyWindow != null) {
+                       keyWindow.redock(correction, enableLogger);
+               }
+       }
+
+       public int getDockPosition() {
+               if (keyWindow == null) {
+                       return SWT.None;
+               }
+
+               return keyWindow.getDockPosition();
+       }
+
+       public int getRecentlyDocked() {
+               return recentlyDocked;
+       }
+
+       public void setRecentlyDocked(int recentlyDocked) {
+               this.recentlyDocked = recentlyDocked;
+       }
+}
index 67bcbf04c89c32ae85698a3c9e77f984135a3ada..d2a8a85494a64b5c418f192757ccc947d3f0860b 100644 (file)
@@ -410,8 +410,10 @@ public class ScreenShotDialog {
        }
 
        protected RotationInfo getCurrentRotation() {
-               short currentRotationId = emulatorSkin.getCurrentRotationId();
-               RotationInfo rotationInfo = RotationInfo.getValue( currentRotationId );
+               short currentRotationId =
+                               emulatorSkin.getEmulatorSkinState().getCurrentRotationId();
+               RotationInfo rotationInfo = RotationInfo.getValue(currentRotationId);
+
                return rotationInfo;
        }