skin: set states before menu creating
authorGiWoong Kim <giwoong.kim@samsung.com>
Tue, 20 Aug 2013 07:23:22 +0000 (16:23 +0900)
committerGiWoong Kim <giwoong.kim@samsung.com>
Tue, 20 Aug 2013 07:37:51 +0000 (16:37 +0900)
Change-Id: I1642ed96fc1e2a2ae715db8a42841a97d3825c38
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/ImageRegistry.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

index a5a6bb1..43e65e2 100644 (file)
@@ -245,6 +245,19 @@ public class EmulatorSkin {
        public long initLayout() {
                imageRegistry = ImageRegistry.getInstance();
 
+               /* set emulator states */
+               currentState.setCurrentResolutionWidth(
+                               config.getArgInt(ArgsConstants.RESOLUTION_WIDTH));
+               currentState.setCurrentResolutionHeight(
+                               config.getArgInt(ArgsConstants.RESOLUTION_HEIGHT));
+
+               int scale = SkinUtil.getValidScale(config);
+               currentState.setCurrentScale(scale);
+
+               short rotationId = EmulatorConfig.DEFAULT_WINDOW_ROTATION;
+               currentState.setCurrentRotationId(rotationId);
+               currentState.setCurrentAngle(SkinRotation.getAngle(rotationId));
+
                /* create and attach a popup menu */
                isOnKbd = false;
                popupMenu = new PopupMenu(config, this, shell, imageRegistry);
index 5d93293..53434b3 100644 (file)
@@ -56,7 +56,6 @@ import org.tizen.emulator.skin.util.SkinRotation;
  *
  */
 public class ImageRegistry {
-       public static final String GENERAL_FOLDER = "emul-general-3btn";
        public static final String ICON_FOLDER = "icons";
        public static final String IMAGES_FOLDER = "images";
        public static final String KEYWINDOW_FOLDER = "key-window";
index ac158fb..4e24367 100644 (file)
@@ -115,19 +115,13 @@ public class GeneralPurposeSkinComposer implements ISkinComposer {
 
                int vmIndex =
                                config.getArgInt(ArgsConstants.VM_BASE_PORT) % 100;
-
                int x = config.getSkinPropertyInt(SkinPropertiesConstants.WINDOW_X,
                                EmulatorConfig.DEFAULT_WINDOW_X + vmIndex);
                int y = config.getSkinPropertyInt(SkinPropertiesConstants.WINDOW_Y,
                                EmulatorConfig.DEFAULT_WINDOW_Y + vmIndex);
 
-               currentState.setCurrentResolutionWidth(
-                               config.getArgInt(ArgsConstants.RESOLUTION_WIDTH));
-               currentState.setCurrentResolutionHeight(
-                               config.getArgInt(ArgsConstants.RESOLUTION_HEIGHT));
-
-               int scale = SkinUtil.getValidScale(config);
-               short rotationId = EmulatorConfig.DEFAULT_WINDOW_ROTATION;
+               int scale = currentState.getCurrentScale();
+               short rotationId = currentState.getCurrentRotationId();
 
                composeInternal(displayCanvas, x, y, scale, rotationId);
                logger.info("resolution : " + currentState.getCurrentResolution() +
index 59ab257..8896a71 100644 (file)
@@ -106,21 +106,15 @@ public class ProfileSpecificSkinComposer implements ISkinComposer {
        public Canvas compose(int style) {
                lcdCanvas = new Canvas(shell, style);
 
+               int vmIndex =
+                               config.getArgInt(ArgsConstants.VM_BASE_PORT) % 100;
                int x = config.getSkinPropertyInt(SkinPropertiesConstants.WINDOW_X,
-                               EmulatorConfig.DEFAULT_WINDOW_X);
+                               EmulatorConfig.DEFAULT_WINDOW_X + vmIndex);
                int y = config.getSkinPropertyInt(SkinPropertiesConstants.WINDOW_Y,
-                               EmulatorConfig.DEFAULT_WINDOW_Y);
-
-               currentState.setCurrentResolutionWidth(
-                               config.getArgInt(ArgsConstants.RESOLUTION_WIDTH));
-               currentState.setCurrentResolutionHeight(
-                               config.getArgInt(ArgsConstants.RESOLUTION_HEIGHT));
-
-               int scale = SkinUtil.getValidScale(config);
-//             int rotationId = config.getPropertyShort( PropertiesConstants.WINDOW_ROTATION,
-//                             EmulatorConfig.DEFAULT_WINDOW_ROTATION );
-               // has to be portrait mode at first booting time
-               short rotationId = EmulatorConfig.DEFAULT_WINDOW_ROTATION;
+                               EmulatorConfig.DEFAULT_WINDOW_Y + vmIndex);
+
+               int scale = currentState.getCurrentScale();
+               short rotationId = currentState.getCurrentRotationId();
 
                composeInternal(lcdCanvas, x, y, scale, rotationId);
                logger.info("resolution : " + currentState.getCurrentResolution() +