skin: source clean-up 34/17834/2
authorGiWoong Kim <giwoong.kim@samsung.com>
Tue, 11 Mar 2014 08:07:53 +0000 (17:07 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Wed, 12 Mar 2014 08:06:29 +0000 (01:06 -0700)
add HW key informations to SkinRotations
modified some variable names
move HWKeyRegion to layout package

Change-Id: Icdd777654030f3ac4cd564ca91bf633d46913329
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/image/ProfileSkinImageRegistry.java
tizen/src/skin/client/src/org/tizen/emulator/skin/layout/HWKey.java
tizen/src/skin/client/src/org/tizen/emulator/skin/layout/HWKeyRegion.java [moved from tizen/src/skin/client/src/org/tizen/emulator/skin/util/HWKeyRegion.java with 97% similarity]
tizen/src/skin/client/src/org/tizen/emulator/skin/layout/ProfileSpecificSkinComposer.java
tizen/src/skin/client/src/org/tizen/emulator/skin/layout/rotation/Rotation.java
tizen/src/skin/client/src/org/tizen/emulator/skin/menu/SpecialKeyWindow.java
tizen/src/skin/client/src/org/tizen/emulator/skin/util/SkinUtil.java

index 089d06a..4a33e73 100755 (executable)
@@ -567,11 +567,11 @@ public class EmulatorSkin {
                                        }
                                }
 
-                               DisplayStateData lcdStateData = new DisplayStateData(
+                               DisplayStateData stateData = new DisplayStateData(
                                                currentState.getCurrentScale(),
                                                currentState.getCurrentRotationId());
                                communicator.sendToQEMU(SendCommand.SEND_DISPLAY_STATE,
-                                               lcdStateData, false);
+                                               stateData, false);
                        }
                };
 
@@ -1509,10 +1509,10 @@ public class EmulatorSkin {
                                        }
                                });
 
-                               DisplayStateData lcdStateData = new DisplayStateData(
+                               DisplayStateData stateData = new DisplayStateData(
                                                currentState.getCurrentScale(), rotationId);
                                communicator.sendToQEMU(SendCommand.SEND_DISPLAY_STATE,
-                                               lcdStateData, false);
+                                               stateData, false);
                        }
                };
 
@@ -1553,10 +1553,10 @@ public class EmulatorSkin {
                                        }
                                });
 
-                               DisplayStateData lcdStateData = new DisplayStateData(scale,
+                               DisplayStateData stateData = new DisplayStateData(scale,
                                                currentState.getCurrentRotationId());
                                communicator.sendToQEMU(SendCommand.SEND_DISPLAY_STATE,
-                                               lcdStateData, false);
+                                               stateData, false);
 
                        }
                };
index 8bc35ef..b83bfa7 100644 (file)
@@ -42,6 +42,7 @@ import org.tizen.emulator.skin.dbi.EmulatorUI;
 import org.tizen.emulator.skin.dbi.ImageListType;
 import org.tizen.emulator.skin.dbi.RotationType;
 import org.tizen.emulator.skin.dbi.RotationsType;
+import org.tizen.emulator.skin.layout.rotation.Rotation;
 import org.tizen.emulator.skin.layout.rotation.SkinRotations;
 import org.tizen.emulator.skin.log.SkinLogger;
 
@@ -87,7 +88,7 @@ public class ProfileSkinImageRegistry {
 
                        logger.info("get skin image from " + skinPath);
 
-                       RotationType targetRotation = SkinRotations.getRotation(id);
+                       Rotation targetRotation = SkinRotations.getRotation(id);
                        if (targetRotation == null) {
                                return null;
                        }
index 23ba4ab..73a5d6a 100644 (file)
@@ -28,7 +28,6 @@
 
 package org.tizen.emulator.skin.layout;
 
-import org.tizen.emulator.skin.util.HWKeyRegion;
 import org.tizen.emulator.skin.util.SkinUtil;
 
 public class HWKey {
index 6e0fe03..5681955 100644 (file)
@@ -59,16 +59,15 @@ import org.tizen.emulator.skin.config.EmulatorConfig.SkinPropertiesConstants;
 import org.tizen.emulator.skin.custom.CustomProgressBar;
 import org.tizen.emulator.skin.dbi.DisplayType;
 import org.tizen.emulator.skin.dbi.RegionType;
-import org.tizen.emulator.skin.dbi.RotationType;
 import org.tizen.emulator.skin.image.ImageRegistry.IconName;
 import org.tizen.emulator.skin.image.ProfileSkinImageRegistry;
 import org.tizen.emulator.skin.image.ProfileSkinImageRegistry.SkinImageType;
 import org.tizen.emulator.skin.info.EmulatorSkinState;
+import org.tizen.emulator.skin.layout.rotation.Rotation;
 import org.tizen.emulator.skin.layout.rotation.SkinRotations;
 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.util.HWKeyRegion;
 import org.tizen.emulator.skin.util.SkinUtil;
 import org.tizen.emulator.skin.util.SwtUtil;
 
@@ -269,7 +268,7 @@ public class ProfileSpecificSkinComposer implements ISkinComposer {
                Rectangle displayBounds = new Rectangle(0, 0, 0, 0);
 
                float convertedScale = SkinUtil.convertScale(scale);
-               RotationType rotation = SkinRotations.getRotation(rotationId);
+               Rotation rotation = SkinRotations.getRotation(rotationId);
                if (rotation == null) {
                        return null;
                }
@@ -434,7 +433,8 @@ public class ProfileSpecificSkinComposer implements ISkinComposer {
                                }
 
                                final HWKey hwKey = SkinUtil.getHWKey(e.x, e.y,
-                                               currentState.getCurrentRotationId(), currentState.getCurrentScale());
+                                               currentState.getCurrentScale(),
+                                               currentState.getCurrentRotationId());
 
                                if (hwKey == null) {
                                        shell.setToolTipText(null);
@@ -521,7 +521,8 @@ public class ProfileSpecificSkinComposer implements ISkinComposer {
 
                                        /* HW key handling */
                                        final HWKey hwKey = SkinUtil.getHWKey(e.x, e.y,
-                                                       currentState.getCurrentRotationId(), currentState.getCurrentScale());
+                                                       currentState.getCurrentScale(),
+                                                       currentState.getCurrentRotationId());
                                        if (hwKey == null) {
                                                logger.info("mouseDown in Skin : " + e.x + ", " + e.y);
 
index 4dafc8d..b441083 100644 (file)
 
 package org.tizen.emulator.skin.layout.rotation;
 
+import java.util.List;
+
+import org.tizen.emulator.skin.dbi.KeyMapListType;
+import org.tizen.emulator.skin.dbi.KeyMapType;
 import org.tizen.emulator.skin.dbi.RotationType;
 
 
 public class Rotation extends RotationType {
        private int angle;
+       private List<KeyMapType> listHWKey;
+
+       public int getAngle() {
+               return angle;
+       }
 
        public void setAngle(int degree) {
                this.angle = degree;
        }
 
-       public int getAngle() {
-               return angle;
+       public List<KeyMapType> getListHWKey() {
+               if (listHWKey == null) {
+                       KeyMapListType list = getKeyMapList();
+                       if (list == null) {
+                               /* try to using a KeyMapList of portrait */
+                               Rotation rotation = SkinRotations.getRotation(SkinRotations.PORTRAIT_ID);
+                               if (rotation == null) {
+                                       return null;
+                               }
+
+                               list = rotation.getKeyMapList();
+                               if (list == null) {
+                                       return null;
+                               }
+                       }
+
+                       listHWKey = list.getKeyMap();
+               }
+
+               return listHWKey;
        }
 }
index a235bc0..ad68a27 100644 (file)
@@ -69,7 +69,7 @@ import org.tizen.emulator.skin.keywindow.dbi.KeyMapType;
 import org.tizen.emulator.skin.keywindow.dbi.KeyWindowUI;
 import org.tizen.emulator.skin.keywindow.dbi.RegionType;
 import org.tizen.emulator.skin.layout.HWKey;
-import org.tizen.emulator.skin.util.HWKeyRegion;
+import org.tizen.emulator.skin.layout.HWKeyRegion;
 import org.tizen.emulator.skin.util.IOUtil;
 import org.tizen.emulator.skin.util.JaxbUtil;
 import org.tizen.emulator.skin.util.SkinUtil;
index 2097954..e2c9ac5 100644 (file)
@@ -52,11 +52,11 @@ import org.eclipse.swt.widgets.Shell;
 import org.tizen.emulator.skin.config.EmulatorConfig;
 import org.tizen.emulator.skin.config.EmulatorConfig.ArgsConstants;
 import org.tizen.emulator.skin.dbi.EventInfoType;
-import org.tizen.emulator.skin.dbi.KeyMapListType;
 import org.tizen.emulator.skin.dbi.KeyMapType;
 import org.tizen.emulator.skin.dbi.RegionType;
-import org.tizen.emulator.skin.dbi.RotationType;
 import org.tizen.emulator.skin.layout.HWKey;
+import org.tizen.emulator.skin.layout.HWKeyRegion;
+import org.tizen.emulator.skin.layout.rotation.Rotation;
 import org.tizen.emulator.skin.layout.rotation.SkinRotations;
 import org.tizen.emulator.skin.log.SkinLogger;
 
@@ -169,30 +169,16 @@ public class SkinUtil {
        }
 
        public static List<KeyMapType> getHWKeyMapList(short rotationId) {
-               RotationType rotation = SkinRotations.getRotation(rotationId);
+               Rotation rotation = SkinRotations.getRotation(rotationId);
                if (rotation == null) {
                        return null;
                }
 
-               KeyMapListType list = rotation.getKeyMapList();
-               if (list == null) {
-                       /* try to using a KeyMapList of portrait */
-                       rotation = SkinRotations.getRotation(SkinRotations.PORTRAIT_ID);
-                       if (rotation == null) {
-                               return null;
-                       }
-
-                       list = rotation.getKeyMapList();
-                       if (list == null) {
-                               return null;
-                       }
-               }
-
-               return list.getKeyMap();
+               return rotation.getListHWKey();
        }
 
-       public static HWKey getHWKey(
-                       int currentX, int currentY, short rotationId, int scale) {
+       public static HWKey getHWKey(int currentX, int currentY,
+                       int scale, short rotationId) {
                float convertedScale = convertScale(scale);
 
                List<KeyMapType> keyMapList = getHWKeyMapList(rotationId);
@@ -200,8 +186,9 @@ public class SkinUtil {
                        return null;
                }
 
+               RegionType region = null;
                for (KeyMapType keyEntry : keyMapList) {
-                       RegionType region = keyEntry.getRegion();
+                       region = keyEntry.getRegion();
 
                        int scaledX = (int) (region.getLeft() * convertedScale);
                        int scaledY = (int) (region.getTop() * convertedScale);