skin: key window docking
authorgiwoong.kim <giwoong.kim@samsung.com>
Wed, 5 Dec 2012 08:21:22 +0000 (17:21 +0900)
committergiwoong.kim <giwoong.kim@samsung.com>
Wed, 5 Dec 2012 08:21:22 +0000 (17:21 +0900)
The key window is converted to dockable windows.

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/layout/GeneralPurposeSkinComposer.java
tizen/src/skin/client/src/org/tizen/emulator/skin/window/ControlPanel.java
tizen/src/skin/client/src/org/tizen/emulator/skin/window/SkinWindow.java
tizen/src/skin/maruskin_server.c [changed mode: 0644->0755]

index 8ad1686..c8db861 100644 (file)
@@ -182,6 +182,9 @@ public class EmulatorSkin {
 //                     style = SWT.TITLE | SWT.CLOSE | SWT.MIN | SWT.BORDER;
 //             }
                this.shell = new Shell(Display.getDefault(), style);
+               if (isOnTop == true) {
+                       SkinUtil.setTopMost(shell, true);
+               }
 
                this.currentState = state;
        }
@@ -888,10 +891,11 @@ public class EmulatorSkin {
                return isControlPanel;
        }
 
-       public void openKeyWindow() {
+       public void openKeyWindow(boolean attach) {
                if (controlPanel != null) {
                        controlPanel.getShell().setVisible(true);
                        SkinUtil.setTopMost(controlPanel.getShell(), isOnTop);
+                       controlPanel.setAttach(attach);
 
                        pairTagCanvas.setVisible(true);
                        return;
@@ -1005,7 +1009,8 @@ public class EmulatorSkin {
 
                                setIsControlPanel(isControlPanel);
                                if (isControlPanel == true) {
-                                       openKeyWindow();
+                                       openKeyWindow((controlPanel == null) ?
+                                                       true : controlPanel.isAttach());
                                } else {
                                        hideKeyWindow();
                                }
index 7eb3530..6745f7c 100644 (file)
@@ -161,13 +161,13 @@ public class GeneralPurposeSkinComposer implements ISkinComposer {
                                        skin.hideKeyWindow();
                                } else {
                                        skin.setIsControlPanel(true);
-                                       skin.openKeyWindow();
+                                       skin.openKeyWindow(true);
 
                                        /* move a key window to right of the emulator window */
-                                       skin.controlPanel.getShell().setLocation(
-                                                       shell.getLocation().x + shell.getSize().x,
-                                                       shell.getLocation().y + (shell.getSize().y / 2) -
-                                                       (skin.controlPanel.getShell().getSize().y / 2));
+                                       if (skin.controlPanel != null) {
+                                               skin.controlPanel.setShellPosition(
+                                                               SWT.RIGHT | SWT.CENTER, false);
+                                       }
                                }
                        }
 
@@ -319,6 +319,11 @@ public class GeneralPurposeSkinComposer implements ISkinComposer {
                                        e.gc.drawImage(currentState.getCurrentImage(), 0, 0);
                                }
 
+                               if (skin.controlPanel != null &&
+                                               skin.controlPanel.isAttach() == true) {
+                                       skin.controlPanel.setShellPosition(
+                                                       SWT.RIGHT | SWT.CENTER, false);
+                               }
                        }
                };
 
@@ -334,7 +339,12 @@ public class GeneralPurposeSkinComposer implements ISkinComposer {
                                        int y = previousLocation.y + (e.y - grabPosition.y);
 
                                        shell.setLocation(x, y);
-                                       return;
+
+                                       if (skin.controlPanel != null &&
+                                                       skin.controlPanel.isAttach() == true) {
+                                               skin.controlPanel.setShellPosition(
+                                                               SWT.RIGHT | SWT.CENTER, false);
+                                       }
                                }
                        }
                };
@@ -349,6 +359,12 @@ public class GeneralPurposeSkinComposer implements ISkinComposer {
 
                                        isGrabbedShell = false;
                                        grabPosition.x = grabPosition.y = 0;
+
+                                       if (skin.controlPanel != null &&
+                                                       skin.controlPanel.isAttach() == true) {
+                                               skin.controlPanel.setShellPosition(
+                                                               SWT.RIGHT | SWT.CENTER, true);
+                                       }
                                }
                        }
 
index c8a9dfd..bdf6f72 100644 (file)
@@ -279,7 +279,10 @@ public class ControlPanel extends SkinWindow {
                                                        30, 4);
 
                                        if (childBounds.intersects(attachBounds) == true) {
-                                               setShellPosition(SWT.RIGHT | SWT.CENTER);
+                                               setShellPosition(SWT.RIGHT | SWT.CENTER, true);
+                                               isAttach = true;
+                                       } else {
+                                               isAttach = false;
                                        }
                                }
                        }
index 8d07e66..a4b6e87 100644 (file)
@@ -43,10 +43,12 @@ public class SkinWindow {
        protected Shell shell;
        protected Shell parent;
        private int shellPositionType;
+       protected boolean isAttach;
 
        public SkinWindow(Shell parent, int shellPositionType) {
                this.parent = parent;
                this.shellPositionType = shellPositionType;
+               this.isAttach = false;
        }
 
        public Shell getShell() {
@@ -58,7 +60,8 @@ public class SkinWindow {
                        return;
                }
 
-               setShellPosition(shellPositionType);
+               setShellPosition(shellPositionType, true);
+               isAttach = true;
 
                shell.open();
 
@@ -69,16 +72,19 @@ public class SkinWindow {
                }
        }
 
-       protected void setShellPosition(int shellPositionType) {
+       public void setShellPosition(int shellPositionType, boolean enableLogger) {
                int x = 0;
                int y = 0;
 
                Rectangle monitorBounds = Display.getDefault().getBounds();
-               logger.info("host monitor display bounds : " + monitorBounds);
                Rectangle parentBounds = parent.getBounds();
-               logger.info("current parent shell bounds : " + parentBounds);
                Rectangle childBounds = shell.getBounds();
-               logger.info("current child shell bounds : " + childBounds);
+
+               if (enableLogger == true) {
+                       logger.info("host monitor display bounds : " + monitorBounds);
+                       logger.info("current parent shell bounds : " + parentBounds);
+                       logger.info("current child shell bounds : " + childBounds);
+               }
 
                if (shellPositionType == (SWT.RIGHT | SWT.TOP)) {
                        x = parentBounds.x + parentBounds.width;
@@ -105,4 +111,12 @@ public class SkinWindow {
 
                shell.setLocation(x, y);
        }
+
+       public void setAttach(boolean attach) {
+               isAttach = attach;
+       }
+
+       public boolean isAttach() {
+               return isAttach;
+       }
 }
old mode 100644 (file)
new mode 100755 (executable)