skin: arrange the PairTag
authorgiwoong.kim <giwoong.kim@samsung.com>
Mon, 11 Mar 2013 02:51:22 +0000 (11:51 +0900)
committergiwoong.kim <giwoong.kim@samsung.com>
Mon, 11 Mar 2013 02:51:22 +0000 (11:51 +0900)
Move a PairTag when Emulator is rotated
for General Skin.

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

index cda386bf5c9ebbe72ed1767887e7597c77408667..17afe67518cd625165dcb19aa9cd620193caf0a7 100644 (file)
@@ -176,7 +176,7 @@ public class EmulatorSkin {
        private MenuItem keyWindowItem; /* key window menu */
        public KeyWindow keyWindow;
        public int recentlyDocked;
-       public ColorTag pairTagCanvas;
+       public ColorTag pairTag;
        public CustomProgressBar bootingProgress;
        public ScreenShotDialog screenShotDialog;
 
@@ -1046,7 +1046,7 @@ public class EmulatorSkin {
                        if (recreate == false) {
                                /* show the key window */
                                keyWindowItem.setSelection(isKeyWindow = true);
-                               pairTagCanvas.setVisible(true);
+                               pairTag.setVisible(true);
 
                                keyWindow.getShell().setVisible(true);
                                SkinUtil.setTopMost(keyWindow.getShell(), isOnTop);
@@ -1077,14 +1077,14 @@ public class EmulatorSkin {
                keyWindowItem.setSelection(isKeyWindow = true);
                SkinUtil.setTopMost(keyWindow.getShell(), isOnTop);
 
-               pairTagCanvas.setVisible(true);
+               pairTag.setVisible(true);
 
                keyWindow.open(dockValue);
        }
 
        public void hideKeyWindow() {
                keyWindowItem.setSelection(isKeyWindow = false);
-               pairTagCanvas.setVisible(false);
+               pairTag.setVisible(false);
 
                if (keyWindow != null) {
                        keyWindow.getShell().setVisible(false);
@@ -1093,7 +1093,7 @@ public class EmulatorSkin {
 
        public void closeKeyWindow() {
                keyWindowItem.setSelection(isKeyWindow = false);
-               pairTagCanvas.setVisible(false);
+               pairTag.setVisible(false);
 
                if (keyWindow != null) {
                        keyWindow.getShell().close();
index 30840a47e97217ae41ae3ce884a59c1ae2e601bb..0eb30aa8ae0ab82128ca758f1d867a9b1dd6ff4b 100644 (file)
@@ -319,8 +319,8 @@ public class KeyWindow extends SkinWindow {
                        public void shellClosed(ShellEvent event) {
                                logger.info("Key Window is closed");
 
-                               if (skin.pairTagCanvas != null) {
-                                       skin.pairTagCanvas.setVisible(false);
+                               if (skin.pairTag != null) {
+                                       skin.pairTag.setVisible(false);
                                }
                                skin.keyWindow = null;
 
index 7d0e311ef1e74ed51bf49e6f675ca68c41aeb72e..7454059a799acae90a9084ffe433c4cbb6b92bd2 100644 (file)
@@ -190,9 +190,9 @@ public class GeneralPurposeSkinComposer implements ISkinComposer {
                });
 
                /* make a pair tag circle */
-               skin.pairTagCanvas =
+               skin.pairTag =
                                new ColorTag(shell, SWT.NO_FOCUS, skin.getColorVM());
-               skin.pairTagCanvas.setVisible(false);
+               skin.pairTag.setVisible(false);
 
                /* create a progress bar for booting status */
                skin.bootingProgress = new CustomProgressBar(shell, SWT.NONE);
@@ -258,11 +258,6 @@ public class GeneralPurposeSkinComposer implements ISkinComposer {
                                        displayBounds.y + displayBounds.height + 1, displayBounds.width, 2);
                }
 
-               /* arrange the pair tag */
-               skin.pairTagCanvas.setBounds(
-                               PAIR_TAG_POSITION_X, PAIR_TAG_POSITION_Y,
-                               skin.pairTagCanvas.getWidth(), skin.pairTagCanvas.getHeight());
-
                /* set window size */
                if (currentState.getCurrentImage() != null) {
                        ImageData imageData = currentState.getCurrentImage().getImageData();
@@ -276,6 +271,29 @@ public class GeneralPurposeSkinComposer implements ISkinComposer {
                        shell.setSize(imageData.width, imageData.height);
                }
 
+               /* arrange the pair tag */
+               int rotationType = currentState.getCurrentRotationId();
+               if (rotationType == RotationInfo.PORTRAIT.id()) {
+                       skin.pairTag.setBounds(
+                                       PAIR_TAG_POSITION_X, PAIR_TAG_POSITION_Y,
+                                       skin.pairTag.getWidth(), skin.pairTag.getHeight());
+               } else if (rotationType == RotationInfo.LANDSCAPE.id()) {
+                       skin.pairTag.setBounds(
+                                       PAIR_TAG_POSITION_Y,
+                                       shell.getSize().y - PAIR_TAG_POSITION_X - skin.pairTag.getHeight(),
+                                       skin.pairTag.getWidth(), skin.pairTag.getHeight());
+               } else if (rotationType == RotationInfo.REVERSE_PORTRAIT.id()) {
+                       skin.pairTag.setBounds(
+                                       shell.getSize().x - PAIR_TAG_POSITION_X - skin.pairTag.getWidth(),
+                                       shell.getSize().y - PAIR_TAG_POSITION_Y - skin.pairTag.getHeight(),
+                                       skin.pairTag.getWidth(), skin.pairTag.getHeight());
+               } else if (rotationType == RotationInfo.REVERSE_LANDSCAPE.id()) {
+                       skin.pairTag.setBounds(
+                                       shell.getSize().x - PAIR_TAG_POSITION_Y - skin.pairTag.getWidth(),
+                                       PAIR_TAG_POSITION_X,
+                                       skin.pairTag.getWidth(), skin.pairTag.getHeight());
+               }
+
                /* custom window shape */
                trimPatchedShell(shell, currentState.getCurrentImage());
 
@@ -488,8 +506,8 @@ public class GeneralPurposeSkinComposer implements ISkinComposer {
                        toggleButton.dispose();
                }
 
-               if (skin.pairTagCanvas != null) {
-                       skin.pairTagCanvas.dispose();
+               if (skin.pairTag != null) {
+                       skin.pairTag.dispose();
                }
 
                if (backgroundColor != null) {