From f090dc6fb6a80dd0119328fef55a6b3d36f21d05 Mon Sep 17 00:00:00 2001 From: "giwoong.kim" Date: Wed, 5 Dec 2012 17:21:22 +0900 Subject: [PATCH] skin: key window docking The key window is converted to dockable windows. Signed-off-by: GiWoong Kim --- .../src/org/tizen/emulator/skin/EmulatorSkin.java | 9 +++++-- .../skin/layout/GeneralPurposeSkinComposer.java | 28 +++++++++++++++++----- .../tizen/emulator/skin/window/ControlPanel.java | 5 +++- .../org/tizen/emulator/skin/window/SkinWindow.java | 24 +++++++++++++++---- tizen/src/skin/maruskin_server.c | 0 5 files changed, 52 insertions(+), 14 deletions(-) mode change 100644 => 100755 tizen/src/skin/maruskin_server.c diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java index 8ad1686..c8db861 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java @@ -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(); } diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/layout/GeneralPurposeSkinComposer.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/layout/GeneralPurposeSkinComposer.java index 7eb3530..6745f7c 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/layout/GeneralPurposeSkinComposer.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/layout/GeneralPurposeSkinComposer.java @@ -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); + } } } diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/window/ControlPanel.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/window/ControlPanel.java index c8a9dfd..bdf6f72 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/window/ControlPanel.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/window/ControlPanel.java @@ -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; } } } diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/window/SkinWindow.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/window/SkinWindow.java index 8d07e66..a4b6e87 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/window/SkinWindow.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/window/SkinWindow.java @@ -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; + } } diff --git a/tizen/src/skin/maruskin_server.c b/tizen/src/skin/maruskin_server.c old mode 100644 new mode 100755 -- 2.7.4