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 [new file with mode: 0644]
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/HWKeyRegion.java [deleted file]
tizen/src/skin/client/src/org/tizen/emulator/skin/util/SkinUtil.java

index 089d06a3fbbdbe525fef7f6df52f51ab5ea0ceb6..4a33e7335deb690281cc756d3c51a798df64dea9 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 8bc35efdec629fcffe3833638277c2d07cceb573..b83bfa761134886f0364ee41422127550f109ce8 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 23ba4abcd2c76dc0b1dcbbdb158275db68797a3a..73a5d6a7645d3d4373c44d656e582632f08b578e 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 {
diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/layout/HWKeyRegion.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/layout/HWKeyRegion.java
new file mode 100644 (file)
index 0000000..a45dca1
--- /dev/null
@@ -0,0 +1,63 @@
+/**
+ * Hardware Key Region
+ *
+ * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * GiWoong Kim <giwoong.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ * HyunJun Son
+ *
+ * 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.layout;
+
+/**
+ * 
+ *
+ */
+public class HWKeyRegion {
+       public int x;
+       public int y;
+       public int width;
+       public int height;
+       private boolean update;
+
+       public HWKeyRegion(int x, int y, int width, int height) {
+               this.x = x;
+               this.y = y;
+               this.width = width;
+               this.height = height;
+               this.update = false;
+       }
+
+       public HWKeyRegion(int x, int y, int width, int height,
+                       boolean update) {
+               this.x = x;
+               this.y = y;
+               this.width = width;
+               this.height = height;
+               this.update = update;
+       }
+
+       public boolean isNeedUpdate() {
+               return update;
+       }
+}
index 6e0fe030703c39dce3b99229416097e5ed69da09..56819551dd795b3adb53a0c61fa6caf79af04d34 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 4dafc8dce3908913ff1329a98f0a40c12207fb47..b441083e98da2ff2abcbcd4ee40868a407399c6a 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 a235bc00a0a5a0c4a1d549a1f7722e4a9724bd5a..ad68a27157082a326541c996990a791b05769639 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;
diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/util/HWKeyRegion.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/util/HWKeyRegion.java
deleted file mode 100644 (file)
index 140d736..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * Hardware Key Region
- *
- * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * GiWoong Kim <giwoong.kim@samsung.com>
- * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
- * HyunJun Son
- *
- * 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.util;
-
-/**
- * 
- *
- */
-public class HWKeyRegion {
-       public int x;
-       public int y;
-       public int width;
-       public int height;
-       private boolean update;
-
-       public HWKeyRegion(int x, int y, int width, int height) {
-               this.x = x;
-               this.y = y;
-               this.width = width;
-               this.height = height;
-               this.update = false;
-       }
-
-       public HWKeyRegion(int x, int y, int width, int height,
-                       boolean update) {
-               this.x = x;
-               this.y = y;
-               this.width = width;
-               this.height = height;
-               this.update = update;
-       }
-
-       public boolean isNeedUpdate() {
-               return update;
-       }
-}
index 209795491ca57a24551c905f2cb6df277b94c6ed..e2c9ac5f779df7a476f39b584903b3639519f837 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);